BPELscript provides:
- a compact syntax inspired by scripting languages such as JavaScript and Ruby
- the full coverage of all features provided by BPEL
- a translation from & to WS-BPEL 2.0
- The translation to WS-BPEL 2.0 ensures that BPELscript can be executed on all workflow engines supporting WS-BPEL 2.0.
Eg:
namespace pns = "http://example.com/loan-approval/";
namespace lns = "http://example.com/loan-approval/wsdl/";
@type "http://schemas.xmlsoap.org/wsdl/"
import lServicePT = lns::"loanServicePT.wsdl";
@suppressJoinFailure
process pns::loanApprovalProcess {
partnerLink customer = (lns::loanPartnerLT, loanService, null),
approver = (lns::loanApprovalLT, null, approver),
assessor = (lns::riskAssessmentLT, null, assessor);
try {
parallel {
@portType "lns::loanServicePT" @createInstance
request = receive(customer, request);
signal(receive-to-assess, [$request.amount < 10000]);
signal(receive-to-approval, [$request.amount >= 10000]);
} and {
join(receive-to-assess);
@portType "lns::riskAssessmentPT"
risk = invoke(assessor, check, request);
signal(assess-to-setMessage, [$risk.level = 'low']);
signal(assess-to-approval, [$risk.level != 'low']);
} and {
join(assess-to-setMessage);
approval.accept = "yes";
signal(setMessage-to-reply);
} and {
join(receive-to-approval, assess-to-approval);
@portType "lns::loanApprovalPT"
approval = invoke(approver, approve, request);
signal(approval-to-reply);
} and {
join(approval-to-reply, setMessage-to-reply);
@portType "lns::loanServicePT"
reply(customer, request, approval);
}
}
@faultMessageType "lns::errorMessage"
catch(lns::loanProcessFault) { |error|
@portType "lns::loanServicePT" @fault "unableToHandleRequest"
reply(customer, request, error);
}
}
how it works:
It uses a translator based on the ANTLR v3 (ANother Tool for Language Recognition) parser generator which is based on a predicated-LL(*) parsing strategy. This solution uses the implicit tree structure behind the input sentences to construct an abstract syntax tree (AST) which is a highly processed and condensed version of the input. The translator maps each input sentence of the source language to an output sentence by embedding actions (e.g. code) within the grammar or tree. This actions will be executed according to its position within the grammar or tree. To support an easy handling of implicit declarations the translation is broken down into multiple passes.
References:
No comments:
Post a Comment