final WSNode wsNode = (WSNode) node;
String wsdlLocation = InterpreterUtil.getEPR(wsNode);
final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
if (null == wsdlLocation) {
if (gfacURLString.startsWith("https")) {
LeadContextHeader leadCtxHeader = null;
// try {
// leadCtxHeader =
// (LeadContextHeader)getInputViaInteractor(WorkflowExecutionMessage.INPUT_LEAD_CONTEXT_HEADER,
// wsNode);
// } catch (Exception e1) {
// throw new WorkflowException(e1);
// }
try {
leadCtxHeader = XBayaUtil.buildLeadContextHeader(this.getWorkflow(), this.getConfig().getConfiguration(), new MonitorConfiguration(this
.getConfig().getConfiguration().getBrokerURL(), this.config.getTopic(), true, this.getConfig().getConfiguration()
.getMessageBoxURL()), wsNode.getID(), null);
// if (this.config.getMode() ==
// WorkflowInterpreterConfiguration.GUI_MODE) {
// leadCtxHeader = XBayaUtil.buildLeadContextHeader(
// this.getWorkflow(),
// this.getConfig().getConfiguration(),
// new
// MonitorConfiguration(this.getConfig().getConfiguration()
// .getBrokerURL(), this.config.getTopic(), true,
// this.getConfig().getConfiguration().getMessageBoxURL()),
// wsNode.getID(), null);
// } else {
// leadCtxHeader = XBayaUtil.buildLeadContextHeader(
// this.getWorkflow(),
// this.getConfig().getConfiguration(),
// new
// MonitorConfiguration(this.getConfig().getConfiguration()
// .getBrokerURL(), this.config.getTopic(), true,
// this.getConfig().getConfiguration().getMessageBoxURL()),
// wsNode.getID(), null);
// }
} catch (URISyntaxException e) {
throw new WorkflowException(e);
}
leadCtxHeader.setServiceId(node.getID());
try {
leadCtxHeader.setWorkflowId(new URI(this.getWorkflow().getName()));
// We do this so that the wsdl resolver can is setup
// wsdlresolver.getInstance is static so once this is
// done
// rest of the loading should work.
XBayaSecurity.init();
} catch (URISyntaxException e) {
throw new WorkflowRuntimeException(e);
}
/*
* Resource Mapping Header
*/
if (this.resourceMapping != null) {
leadCtxHeader.setResourceMapping(this.resourceMapping);
}
/*
* If there is a instance control component connects to this
* component send information in soap header
*/
for (Node n : wsNode.getControlInPort().getFromNodes()) {
if (n instanceof InstanceNode) {
// TODO make it as constant
LeadResourceMapping x = new LeadResourceMapping("AMAZON");
x.addAttribute("ACCESS_KEY", AmazonCredential.getInstance().getAwsAccessKeyId());
x.addAttribute("SECRET_KEY", AmazonCredential.getInstance().getAwsSecretAccessKey());
if (((InstanceNode) n).isStartNewInstance()) {
x.addAttribute("AMI_ID", ((InstanceNode) n).getIdAsValue());
x.addAttribute("INS_TYPE", ((InstanceNode) n).getInstanceType());
} else {
x.addAttribute("INS_ID", ((InstanceNode) n).getIdAsValue());
}
x.addAttribute("USERNAME", ((InstanceNode) n).getUsername());
// set to leadHeader
leadCtxHeader.setResourceMapping(x);
}
}
invoker = new WorkflowInvokerWrapperForGFacInvoker(portTypeQName, gfacURLString, this.config.getMonitor().getConfiguration().getMessageBoxURL()
.toString(), leadCtxHeader, this.config.getNotifier().createServiceNotificationSender(node.getID()));