use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription 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.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.
the class AppCatalogThriftConversion method getApplicationInterfaceDescription.
public static ApplicationInterfaceDescription getApplicationInterfaceDescription(AppInterfaceResource resource) throws AppCatalogException {
ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
description.setApplicationInterfaceId(resource.getInterfaceId());
description.setApplicationName(resource.getAppName());
description.setApplicationDescription(resource.getAppDescription());
description.setArchiveWorkingDirectory(resource.isArchiveWorkingDirectory());
description.setHasOptionalFileInputs(resource.isHasOptionalFileInputs());
AppModuleMappingAppCatalogResourceAppCat appModuleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
List<AppCatalogResource> appModules = appModuleMappingResource.get(AppCatAbstractResource.AppModuleMappingConstants.INTERFACE_ID, resource.getInterfaceId());
if (appModules != null && !appModules.isEmpty()) {
description.setApplicationModules(getAppModuleIds(appModules));
}
ApplicationInputResource inputResource = new ApplicationInputResource();
List<AppCatalogResource> appInputs = inputResource.get(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, resource.getInterfaceId());
if (appInputs != null && !appInputs.isEmpty()) {
description.setApplicationInputs(getAppInputs(appInputs));
}
ApplicationOutputResource outputResource = new ApplicationOutputResource();
List<AppCatalogResource> appOutputs = outputResource.get(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, resource.getInterfaceId());
if (appOutputs != null && !appOutputs.isEmpty()) {
description.setApplicationOutputs(getAppOutputs(appOutputs));
}
return description;
}
use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.
the class JCRComponentRegistry method getComponentReferenceList.
/**
* @see org.apache.airavata.workflow.model.component.registry.ComponentRegistry#getComponentReferenceList()
*/
@Override
public List<ComponentReference> getComponentReferenceList() {
List<ComponentReference> tree = new ArrayList<ComponentReference>();
try {
if (client.isGatewayExist(gatewayId)) {
List<ApplicationInterfaceDescription> allApplicationInterfaces = client.getAllApplicationInterfaces(gatewayId);
for (ApplicationInterfaceDescription interfaceDescription : allApplicationInterfaces) {
JCRComponentReference jcr = new JCRComponentReference(interfaceDescription.getApplicationName(), interfaceDescription);
tree.add(jcr);
}
} else {
log.error("Gateway {} Id is not exist", gatewayId);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return tree;
}
use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription 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();
}
}
use of org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription in project airavata by apache.
the class RegistryServerHandler method getAllApplicationInterfaces.
/**
* Fetch all Application Interface documents.
*
* @param gatewayId
* @return map<applicationId, applicationInterfaceNames>
* Returns a list of application interfaces documents (Application Interface ID, name, description, Inputs and Outputs objects).
*/
@Override
public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(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> interfaces = appCatalog.getApplicationInterface().getAllApplicationInterfaces(gatewayId);
logger.debug("Airavata retrieved application interfaces for gateway id : " + gatewayId);
return interfaces;
} 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