proxy = myProxyClient.getProxy();
} else {
proxy = SecurityUtil.getGSSCredential(this.username, this.password, this.configuration.getMyProxyServer());
}
LeadContextHeader leadCtxHeader = null;
try {
if (this.mode == GUI_MODE) {
leadCtxHeader = WSDLUtil.buildLeadContextHeader(this.workflow, this.configuration, this.engine.getMyLead(), new MonitorConfiguration(this.configuration.getBrokerURL(), this.topic, true, this.configuration.getMessageBoxURL()), wsNode.getID(), null);
} else {
leadCtxHeader = WSDLUtil.buildLeadContextHeader(this.workflow, this.configuration,
// Set the userdn in the right proxy if necessary
new MyLead(new MyLeadConfiguration(), proxy), new MonitorConfiguration(this.configuration.getBrokerURL(), this.topic, true, this.configuration.getMessageBoxURL()), wsNode.getID(), null);
}
} catch (URISyntaxException e) {
throw new XBayaException(e);
}
leadCtxHeader.setServiceId(node.getID());
try {
leadCtxHeader.setWorkflowId(new URI(this.workflow.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 XBayaRuntimeException(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.configuration.getMessageBoxURL().toString(), leadCtxHeader, this.notifier.createServiceNotificationSender(node.getID()));