use of org.apache.airavata.gfac.bes.utils.StorageCreator in project airavata by apache.
the class AbstractSMSHandler method invoke.
@Override
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
try {
initSecurityProperties(jobExecutionContext);
JobSubmissionInterface preferredJobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
JobSubmissionProtocol protocol = preferredJobSubmissionInterface.getJobSubmissionProtocol();
String interfaceId = preferredJobSubmissionInterface.getJobSubmissionInterfaceId();
String factoryUrl = null;
if (protocol.equals(JobSubmissionProtocol.UNICORE)) {
UnicoreJobSubmission unicoreJobSubmission = GFacUtils.getUnicoreJobSubmission(interfaceId);
factoryUrl = unicoreJobSubmission.getUnicoreEndPointURL();
}
storageClient = null;
if (!isSMSInstanceExisting(jobExecutionContext)) {
EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
eprt.addNewAddress().setStringValue(factoryUrl);
StorageCreator storageCreator = new StorageCreator(secProperties, factoryUrl, 5, null);
try {
storageClient = storageCreator.createStorage();
} catch (Exception e2) {
log.error("Cannot create storage..");
throw new GFacHandlerException("Cannot create storage..", e2);
}
jobExecutionContext.setProperty(PROP_SMS_EPR, storageClient.getEPR());
} else {
EndpointReferenceType eprt = (EndpointReferenceType) jobExecutionContext.getProperty(PROP_SMS_EPR);
try {
storageClient = new StorageClient(eprt, secProperties);
} catch (Exception e) {
throw new GFacHandlerException("Cannot create storage..", e);
}
}
dataTransferrer = new DataTransferrer(jobExecutionContext, storageClient);
} catch (AppCatalogException e) {
throw new GFacHandlerException("Error occurred while retrieving unicore job submission interface..", e);
}
}
Aggregations