public MyRoleMessageExchange createMessageExchange(String clientKey, QName targetService, String operation) {
return createMessageExchange(clientKey, targetService, operation, null);
}
public MessageExchange getMessageExchange(String mexId) throws BpelEngineException {
MessageExchangeDAO mexdao = _contexts.inMemDao.getConnection().getMessageExchange(mexId);
if (mexdao == null) mexdao = _contexts.dao.getConnection().getMessageExchange(mexId);
if (mexdao == null)
return null;
ProcessDAO pdao = mexdao.getProcess();
BpelProcess process = pdao == null ? null : _activeProcesses.get(pdao.getProcessId());
MessageExchangeImpl mex;
switch (mexdao.getDirection()) {
case MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE:
if (process == null) {
String errmsg = __msgs.msgProcessNotActive(pdao.getProcessId());
__log.error(errmsg);
// TODO: Perhaps we should define a checked exception for this
// condition.
throw new BpelEngineException(errmsg);
}
{
OPartnerLink plink = (OPartnerLink) process.getOProcess().getChild(mexdao.getPartnerLinkModelId());
PortType ptype = plink.partnerRolePortType;
Operation op = plink.getPartnerRoleOperation(mexdao.getOperation());
// TODO: recover Partner's EPR
mex = new PartnerRoleMessageExchangeImpl(this, mexdao, ptype, op, null, plink.hasMyRole() ? process
.getInitialMyRoleEPR(plink) : null, process.getPartnerRoleChannel(plink));
}
break;
case MessageExchangeDAO.DIR_PARTNER_INVOKES_MYROLE:
mex = new MyRoleMessageExchangeImpl(this, mexdao);
if (process != null) {
OPartnerLink plink = (OPartnerLink) process.getOProcess().getChild(mexdao.getPartnerLinkModelId());
PortType ptype = plink.myRolePortType;
Operation op = plink.getMyRoleOperation(mexdao.getOperation());
mex.setPortOp(ptype, op);
}
break;
default:
String errmsg = "BpelEngineImpl: internal error, invalid MexDAO direction: " + mexId;