Search in sources :

Example 46 with AppCatalogException

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);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 47 with AppCatalogException

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;
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) ArrayList(java.util.ArrayList) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 48 with AppCatalogException

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;
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) ArrayList(java.util.ArrayList) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 49 with AppCatalogException

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);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 50 with AppCatalogException

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;
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) ArrayList(java.util.ArrayList) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)353 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)268 EntityManager (javax.persistence.EntityManager)261 Query (javax.persistence.Query)176 AppCatalogQueryGenerator (org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator)176 ArrayList (java.util.ArrayList)94 HashMap (java.util.HashMap)70 Map (java.util.Map)54 List (java.util.List)42 CompositeIdentifier (org.apache.airavata.registry.cpi.CompositeIdentifier)22 ComputeResource (org.apache.airavata.registry.core.app.catalog.model.ComputeResource)14 ApplicationDeployment (org.apache.airavata.registry.core.app.catalog.model.ApplicationDeployment)13 ApplicationInterface (org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface)10 ApplicationModule (org.apache.airavata.registry.core.app.catalog.model.ApplicationModule)8 GatewayProfile (org.apache.airavata.registry.core.app.catalog.model.GatewayProfile)6 ResourceJobManager (org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager)6 StorageResource (org.apache.airavata.registry.core.app.catalog.model.StorageResource)6 Initialize (org.apache.airavata.app.catalog.util.Initialize)5 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)5 GSISSHSubmission (org.apache.airavata.registry.core.app.catalog.model.GSISSHSubmission)5