use of org.apache.airavata.registry.cpi.ApplicationInterface in project airavata by apache.
the class WorkflowUtils method getExecutionType.
public static ExecutionType getExecutionType(Experiment experiment) {
try {
ApplicationInterface applicationInterface = RegistryFactory.getAppCatalog().getApplicationInterface();
List<String> allApplicationInterfaceIds = applicationInterface.getAllApplicationInterfaceIds();
String applicationId = experiment.getApplicationId();
if (allApplicationInterfaceIds.contains(applicationId)) {
return ExecutionType.SINGLE_APP;
} else {
List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(ServerSettings.getDefaultUserGateway());
if (allWorkflows.contains(applicationId)) {
return ExecutionType.WORKFLOW;
}
}
} catch (AppCatalogException e) {
logger.error(e.getMessage(), e);
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
}
return ExecutionType.UNKNOWN;
}
use of org.apache.airavata.registry.cpi.ApplicationInterface in project airavata by apache.
the class OrchestratorUtils method getApplicationInterfaceName.
public static String getApplicationInterfaceName(OrchestratorContext context, ProcessModel model) throws RegistryException {
try {
ApplicationInterface applicationInterface = context.getRegistry().getAppCatalog().getApplicationInterface();
ApplicationInterfaceDescription appInterface = applicationInterface.getApplicationInterface(model.getApplicationInterfaceId());
return appInterface.getApplicationName();
} catch (AppCatalogException e) {
throw new RegistryException("Error while retrieving application interface", e);
}
}
use of org.apache.airavata.registry.cpi.ApplicationInterface in project airavata by apache.
the class AppInterfaceTest method testAppInterface.
@Test
public void testAppInterface() {
try {
ApplicationInterface appInterface = appcatalog.getApplicationInterface();
ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
String wrfModuleId = addAppModule("WRF");
String amberModuleId = addAppModule("AMBER");
List<String> modules = new ArrayList<String>();
modules.add(wrfModuleId);
modules.add(amberModuleId);
InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
inputs.add(appInput1);
inputs.add(appInput2);
OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
outputs.add(output1);
outputs.add(output2);
description.setApplicationName("testApplication");
description.setApplicationDescription("my testApplication");
description.setApplicationModules(modules);
description.setApplicationInputs(inputs);
description.setApplicationOutputs(outputs);
String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway());
System.out.println("********** application id ************* : " + appID);
ApplicationInterfaceDescription ainterface = null;
if (appInterface.isApplicationInterfaceExists(appID)) {
ainterface = appInterface.getApplicationInterface(appID);
OutputDataObjectType output3 = createAppOutput("output3", "", DataType.STRING);
OutputDataObjectType output4 = createAppOutput("output4", "", DataType.STRING);
outputs.add(output3);
outputs.add(output4);
ainterface.setApplicationOutputs(outputs);
appInterface.updateApplicationInterface(appID, ainterface);
ApplicationInterfaceDescription updateApp = appInterface.getApplicationInterface(appID);
List<OutputDataObjectType> appOutputs = updateApp.getApplicationOutputs();
System.out.println("********** application name ************* : " + updateApp.getApplicationName());
System.out.println("********** application description ************* : " + updateApp.getApplicationDescription());
System.out.println("********** output size ************* : " + appOutputs.size());
}
ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
System.out.println("********** App Input size ************* : " + applicationInputs.size());
List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
System.out.println("********** App output size ************* : " + applicationOutputs.size());
description.setApplicationName("testApplication2");
appInterface.updateApplicationInterface(appID, description);
if (appInterface.isApplicationInterfaceExists(appID)) {
ainterface = appInterface.getApplicationInterface(appID);
System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
}
wrfModule.setAppModuleVersion("1.0.1");
appInterface.updateApplicationModule(wrfModuleId, wrfModule);
wrfModule = appInterface.getApplicationModule(wrfModuleId);
System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
Map<String, String> filters = new HashMap<String, String>();
filters.put(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
System.out.println("********** Size og app interfaces ************* : " + apps.size());
List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway());
System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
assertTrue("App interface saved successfully", ainterface != null);
} catch (AppCatalogException e) {
e.printStackTrace();
} catch (ApplicationSettingsException e) {
e.printStackTrace();
}
}
Aggregations