Search in sources :

Example 1 with DataTransferrer

use of org.apache.airavata.gfac.bes.utils.DataTransferrer 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);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) EndpointReferenceType(org.w3.x2005.x08.addressing.EndpointReferenceType) DataTransferrer(org.apache.airavata.gfac.bes.utils.DataTransferrer) StorageClient(de.fzj.unicore.uas.client.StorageClient) StorageCreator(org.apache.airavata.gfac.bes.utils.StorageCreator) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) GFacException(org.apache.airavata.gfac.core.GFacException) GFacHandlerException(org.apache.airavata.gfac.core.handler.GFacHandlerException) GFacHandlerException(org.apache.airavata.gfac.core.handler.GFacHandlerException)

Aggregations

StorageClient (de.fzj.unicore.uas.client.StorageClient)1 DataTransferrer (org.apache.airavata.gfac.bes.utils.DataTransferrer)1 StorageCreator (org.apache.airavata.gfac.bes.utils.StorageCreator)1 GFacException (org.apache.airavata.gfac.core.GFacException)1 GFacHandlerException (org.apache.airavata.gfac.core.handler.GFacHandlerException)1 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)1 EndpointReferenceType (org.w3.x2005.x08.addressing.EndpointReferenceType)1