EndpointReferenceType eprt = EndpointReferenceType.Factory
.newInstance();
eprt.addNewAddress().setStringValue(factoryUrl);
System.out.println("========================================");
System.out.println(String.format("Job Submitted to %s.\n", factoryUrl));
FactoryClient factory = null;
try {
factory = new FactoryClient(eprt, securityProperties);
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
CreateActivityDocument cad = CreateActivityDocument.Factory
.newInstance();
cad.addNewCreateActivity().addNewActivityDocument()
.setJobDefinition(job.getJobDoc().getJobDefinition());
CreateActivityResponseDocument response = null;
try {
response = factory.createActivity(cad);
} catch (NotAcceptingNewActivitiesFault notAcceptingNewActivitiesFault) {
notAcceptingNewActivitiesFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (InvalidRequestMessageFault invalidRequestMessageFault) {
invalidRequestMessageFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (UnsupportedFeatureFault unsupportedFeatureFault) {
unsupportedFeatureFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
EndpointReferenceType activityEpr = response
.getCreateActivityResponse().getActivityIdentifier();
//factory.waitWhileActivityIsDone(activityEpr, 1000);
jobId = WSUtilities.extractResourceID(activityEpr);
if (jobId == null) {
jobId = new Long(Calendar.getInstance().getTimeInMillis())
.toString();
}
ActivityStateEnumeration.Enum state = factory.getActivityStatus(activityEpr);
String status;
status = String.format("Job %s is %s.\n", activityEpr.getAddress()
.getStringValue(), factory.getActivityStatus(activityEpr)
.toString()).toString();
while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
(factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
status = String.format("Job %s is %s.\n", activityEpr.getAddress()
.getStringValue(), factory.getActivityStatus(activityEpr)
.toString()).toString();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
continue;
}
status = String.format("Job %s is %s.\n", activityEpr.getAddress()
.getStringValue(), factory.getActivityStatus(activityEpr)
.toString()).toString();
log.debug("Request to contact:" + unicoreHost);
buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" JSDL = ")