Search in sources :

Example 1 with ApplicationInterfaceDescription

use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.

the class AiravataServerHandler method getApplicationInterface.

/**
 * Fetch a Application Interface.
 *
 * @param appInterfaceId The identifier for the requested application module
 * @return applicationInterface
 * Returns a application Interface Object.
 */
@Override
@SecurityCheck
public ApplicationInterfaceDescription getApplicationInterface(AuthzToken authzToken, String appInterfaceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
    RegistryService.Client regClient = registryClientPool.getResource();
    try {
        ApplicationInterfaceDescription result = regClient.getApplicationInterface(appInterfaceId);
        registryClientPool.returnResource(regClient);
        return result;
    } catch (Exception e) {
        logger.error(appInterfaceId, "Error while retrieving application interface...", e);
        AiravataSystemException exception = new AiravataSystemException();
        exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
        exception.setMessage("Error while retrieving application interface. More info : " + e.getMessage());
        registryClientPool.returnBrokenResource(regClient);
        throw exception;
    }
}
Also used : ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) RegistryService(org.apache.airavata.registry.api.RegistryService) SharingRegistryService(org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) AiravataException(org.apache.airavata.common.exception.AiravataException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Example 2 with ApplicationInterfaceDescription

use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.

the class AiravataServerHandler method cloneApplicationInterface.

@Override
@SecurityCheck
public String cloneApplicationInterface(AuthzToken authzToken, String existingAppInterfaceID, String newApplicationName, String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
    RegistryService.Client regClient = registryClientPool.getResource();
    try {
        ApplicationInterfaceDescription existingInterface = regClient.getApplicationInterface(existingAppInterfaceID);
        if (existingInterface == null) {
            logger.error("Provided application interface does not exist.Please provide a valid application interface id...");
            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
        }
        existingInterface.setApplicationName(newApplicationName);
        existingInterface.setApplicationInterfaceId(airavata_commonsConstants.DEFAULT_ID);
        String interfaceId = regClient.registerApplicationInterface(gatewayId, existingInterface);
        logger.debug("Airavata cloned application interface : " + existingAppInterfaceID + " for gateway id : " + gatewayId);
        registryClientPool.returnResource(regClient);
        return interfaceId;
    } catch (Exception e) {
        logger.error("Error while adding application interface...", e);
        AiravataSystemException exception = new AiravataSystemException();
        exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
        exception.setMessage("Error while adding application interface. More info : " + e.getMessage());
        registryClientPool.returnBrokenResource(regClient);
        throw exception;
    }
}
Also used : ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) RegistryService(org.apache.airavata.registry.api.RegistryService) SharingRegistryService(org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) AiravataException(org.apache.airavata.common.exception.AiravataException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Example 3 with ApplicationInterfaceDescription

use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.

the class AiravataIT method testAddApplication.

@org.testng.annotations.Test(priority = 4)
public void testAddApplication() {
    try {
        logger.info("testAddApplication() -> Adding test application......");
        applicationProperties = setup.getApplicationRegister().addApplications();
        ;
        Assert.assertNotNull(applicationProperties);
        ApplicationModule applicationModule = setup.getApplicationRegister().getApplicationModule(applicationProperties.getApplicationModuleId());
        Assert.assertNotNull(applicationModule);
        Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
        Assert.assertEquals(applicationModule.getAppModuleVersion(), LOCAL_ECHO_VERSION);
        Assert.assertEquals(applicationModule.getAppModuleDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
        Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
        ApplicationInterfaceDescription applicationInterfaceDescription = setup.getApplicationRegister().getApplicationInterfaceDescription(applicationProperties.getApplicationInterfaceId());
        Assert.assertNotNull(applicationInterfaceDescription);
        Assert.assertEquals(applicationInterfaceDescription.getApplicationName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
        Assert.assertEquals(applicationInterfaceDescription.getApplicationDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
        InputDataObjectType input = applicationInterfaceDescription.getApplicationInputs().get(0);
        Assert.assertNotNull(input);
        Assert.assertEquals(input.getName(), INPUT_NAME);
        Assert.assertEquals(input.getValue(), INPUT_VALUE);
        Assert.assertEquals(input.getType(), DataType.STRING);
        Assert.assertEquals(input.getApplicationArgument(), null);
        Assert.assertEquals(input.getInputOrder(), 0);
        Assert.assertEquals(input.isIsRequired(), true);
        Assert.assertEquals(input.isRequiredToAddedToCommandLine(), true);
        Assert.assertEquals(input.isStandardInput(), false);
        Assert.assertEquals(input.getUserFriendlyDescription(), INPUT_DESC);
        Assert.assertEquals(input.getMetaData(), null);
        List<OutputDataObjectType> outputDataObjectTypes = applicationInterfaceDescription.getApplicationOutputs();
        Assert.assertNotNull(outputDataObjectTypes.get(0));
        Assert.assertEquals(outputDataObjectTypes.get(0).getName(), STDERR_NAME);
        Assert.assertEquals(outputDataObjectTypes.get(0).getValue(), STDERR_VALUE);
        Assert.assertEquals(outputDataObjectTypes.get(0).getType(), DataType.URI);
        Assert.assertEquals(outputDataObjectTypes.get(0).isIsRequired(), true);
        Assert.assertEquals(outputDataObjectTypes.get(0).isRequiredToAddedToCommandLine(), true);
        Assert.assertEquals(outputDataObjectTypes.get(0).getApplicationArgument(), null);
        Assert.assertNotNull(outputDataObjectTypes.get(1));
        Assert.assertEquals(outputDataObjectTypes.get(1).getName(), STDOUT_NAME);
        Assert.assertEquals(outputDataObjectTypes.get(1).getValue(), STDOUT_VALUE);
        Assert.assertEquals(outputDataObjectTypes.get(1).getType(), DataType.URI);
        Assert.assertEquals(outputDataObjectTypes.get(1).isIsRequired(), true);
        Assert.assertEquals(outputDataObjectTypes.get(1).isRequiredToAddedToCommandLine(), true);
        Assert.assertEquals(outputDataObjectTypes.get(1).getApplicationArgument(), null);
        ApplicationDeploymentDescription applicationDeploymentDescription = setup.getApplicationRegister().getApplicationDeploymentDescription(applicationProperties.getApplicationDeployId());
        Assert.assertNotNull(applicationDeploymentDescription);
        Assert.assertEquals(applicationDeploymentDescription.getExecutablePath(), TestFrameworkConstants.LOCAL_ECHO_JOB_FILE_PATH);
        Assert.assertEquals(applicationDeploymentDescription.getParallelism(), ApplicationParallelismType.SERIAL);
        Assert.assertEquals(applicationDeploymentDescription.getAppDeploymentDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
        Assert.assertEquals(applicationDeploymentDescription.getModuleLoadCmds(), null);
        Assert.assertEquals(applicationDeploymentDescription.getPostJobCommands(), null);
        Assert.assertEquals(applicationDeploymentDescription.getPreJobCommands(), null);
        logger.info("testAddApplication() -> Adding test application." + applicationProperties.toString());
    } catch (Exception e) {
        logger.error("Error occured while testAddApplication", e);
        Assert.fail();
    }
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 4 with ApplicationInterfaceDescription

use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.

the class ApplicationRegister method createApplicationInterfaceDescription.

protected ApplicationInterfaceDescription createApplicationInterfaceDescription(String applicationName, String applicationDescription, List<String> applicationModules, List<InputDataObjectType> applicationInputs, List<OutputDataObjectType> applicationOutputs) {
    ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();
    applicationInterfaceDescription.setApplicationName(applicationName);
    if (applicationDescription != null)
        applicationInterfaceDescription.setApplicationDescription(applicationDescription);
    if (applicationModules != null)
        applicationInterfaceDescription.setApplicationModules(applicationModules);
    if (applicationInputs != null)
        applicationInterfaceDescription.setApplicationInputs(applicationInputs);
    if (applicationOutputs != null)
        applicationInterfaceDescription.setApplicationOutputs(applicationOutputs);
    return applicationInterfaceDescription;
}
Also used : ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)

Example 5 with ApplicationInterfaceDescription

use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.

the class RegistryServerHandler method getAllApplicationInterfaceNames.

/**
 * Fetch name and ID of  Application Interface documents.
 *
 * @param gatewayId
 * @return map<applicationId, applicationInterfaceNames>
 * Returns a list of application interfaces with corresponsing ID's
 */
@Override
public Map<String, String> getAllApplicationInterfaceNames(String gatewayId) throws RegistryServiceException, TException {
    if (!isGatewayExistInternal(gatewayId)) {
        logger.error("Gateway does not exist.Please provide a valid gateway id...");
        throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
    }
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        List<ApplicationInterfaceDescription> allApplicationInterfaces = appCatalog.getApplicationInterface().getAllApplicationInterfaces(gatewayId);
        Map<String, String> allApplicationInterfacesMap = new HashMap<String, String>();
        if (allApplicationInterfaces != null && !allApplicationInterfaces.isEmpty()) {
            for (ApplicationInterfaceDescription interfaceDescription : allApplicationInterfaces) {
                allApplicationInterfacesMap.put(interfaceDescription.getApplicationInterfaceId(), interfaceDescription.getApplicationName());
            }
        }
        logger.debug("Airavata retrieved application interfaces for gateway id : " + gatewayId);
        return allApplicationInterfacesMap;
    } catch (AppCatalogException e) {
        logger.error("Error while retrieving application interfaces...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving application interfaces. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)

Aggregations

ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)28 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)13 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)13 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)11 ResourceJobManager (org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager)11 SSHJobSubmission (org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)10 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)6 ArrayList (java.util.ArrayList)3 AiravataException (org.apache.airavata.common.exception.AiravataException)3 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)3 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)3 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)3 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)2 JobManagerCommand (org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand)2 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)2 RegistryService (org.apache.airavata.registry.api.RegistryService)2 ApplicationInterface (org.apache.airavata.registry.cpi.ApplicationInterface)2 SecurityCheck (org.apache.airavata.service.security.interceptor.SecurityCheck)2 SharingRegistryService (org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService)2 TException (org.apache.thrift.TException)2