use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ApplicationInterfaceImpl method addApplicationModuleMapping.
@Override
public void addApplicationModuleMapping(String moduleId, String interfaceId) throws AppCatalogException {
try {
AppModuleResource appModuleResource = new AppModuleResource();
AppInterfaceResource interfaceResource = new AppInterfaceResource();
AppModuleMappingAppCatalogResourceAppCat moduleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
moduleMappingResource.setInterfaceId(interfaceId);
moduleMappingResource.setModuleId(moduleId);
moduleMappingResource.setModuleResource((AppModuleResource) appModuleResource.get(moduleId));
moduleMappingResource.setAppInterfaceResource((AppInterfaceResource) interfaceResource.get(interfaceId));
moduleMappingResource.save();
} catch (Exception e) {
logger.error("Error while saving application module mapping " + moduleId, e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ApplicationInterfaceImpl method getApplicationInterfaces.
@Override
public List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException {
List<ApplicationInterfaceDescription> appInterfaces = new ArrayList<ApplicationInterfaceDescription>();
try {
AppInterfaceResource resource = new AppInterfaceResource();
for (String fieldName : filters.keySet()) {
if (fieldName.equals(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME)) {
List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, filters.get(fieldName));
appInterfaces = AppCatalogThriftConversion.getAppInterfaceDescList(resources);
} else {
logger.error("Unsupported field name for app interface.", new IllegalArgumentException());
throw new IllegalArgumentException("Unsupported field name '" + fieldName + "' for app interface.");
}
}
} catch (Exception e) {
logger.error("Error while retrieving app interface list...", e);
throw new AppCatalogException(e);
}
return appInterfaces;
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ApplicationInterfaceImpl method getAllApplicationModules.
@Override
public List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException {
List<ApplicationModule> applicationModules = new ArrayList<ApplicationModule>();
try {
AppModuleResource resource = new AppModuleResource();
resource.setGatewayId(gatewayId);
List<AppCatalogResource> resources = resource.getAll();
if (resources != null && !resources.isEmpty()) {
applicationModules = AppCatalogThriftConversion.getAppModules(resources);
}
} catch (Exception e) {
logger.error("Error while retrieving compute resource list...", e);
throw new AppCatalogException(e);
}
return applicationModules;
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ApplicationInterfaceImpl method getApplicationInputs.
@Override
public List<InputDataObjectType> getApplicationInputs(String interfaceId) throws AppCatalogException {
try {
ApplicationInputResource resource = new ApplicationInputResource();
List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
return AppCatalogThriftConversion.getAppInputs(resources);
} catch (Exception e) {
logger.error("Error while retrieving app inputs for application " + interfaceId, e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ApplicationDeploymentImpl method getApplicationDeployements.
@Override
public List<ApplicationDeploymentDescription> getApplicationDeployements(Map<String, String> filters) throws AppCatalogException {
List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
try {
AppDeploymentResource resource = new AppDeploymentResource();
boolean firstTry = true;
for (String fieldName : filters.keySet()) {
List<ApplicationDeploymentDescription> tmpDescriptions = new ArrayList<ApplicationDeploymentDescription>();
if (fieldName.equals(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID)) {
List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, filters.get(fieldName));
if (resources != null && !resources.isEmpty()) {
tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
}
} else if (fieldName.equals(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, filters.get(fieldName));
if (resources != null && !resources.isEmpty()) {
tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
}
} else {
logger.error("Unsupported field name for app deployment.", new IllegalArgumentException());
throw new IllegalArgumentException("Unsupported field name for app deployment.");
}
if (firstTry) {
deploymentDescriptions.addAll(tmpDescriptions);
firstTry = false;
} else {
List<String> ids = new ArrayList<String>();
for (ApplicationDeploymentDescription applicationDeploymentDescription : deploymentDescriptions) {
ids.add(applicationDeploymentDescription.getAppDeploymentId());
}
List<ApplicationDeploymentDescription> tmp2Descriptions = new ArrayList<ApplicationDeploymentDescription>();
for (ApplicationDeploymentDescription applicationDeploymentDescription : tmpDescriptions) {
if (ids.contains(applicationDeploymentDescription.getAppDeploymentId())) {
tmp2Descriptions.add(applicationDeploymentDescription);
}
}
deploymentDescriptions.clear();
deploymentDescriptions.addAll(tmp2Descriptions);
}
}
} catch (Exception e) {
logger.error("Error while retrieving app deployment list...", e);
throw new AppCatalogException(e);
}
return deploymentDescriptions;
}
Aggregations