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;
}
}
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;
}
}
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();
}
}
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;
}
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;
}
}
Aggregations