Search in sources :

Example 26 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException 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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)

Example 27 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method addUnicoreDataMovementDetails.

/**
 * Add a UNICORE data movement details to a compute resource
 * App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces.
 *
 *  productUri          The identifier of the compute resource to which data movement protocol to be added
 * @param dmType
 * @param priorityOrder       Specify the priority of this job manager. If this is the only jobmanager, the priority can be zero.
 * @param unicoreDataMovement
 * @return status
 * Returns the unique data movement id.
 */
@Override
public String addUnicoreDataMovementDetails(String resourceId, DMType dmType, int priorityOrder, UnicoreDataMovement unicoreDataMovement) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        ComputeResource computeResource = appCatalog.getComputeResource();
        String movementInterface = addDataMovementInterface(computeResource, resourceId, dmType, computeResource.addUnicoreDataMovement(unicoreDataMovement), DataMovementProtocol.UNICORE_STORAGE_SERVICE, priorityOrder);
        logger.debug("Airavata registered UNICORE data movement for resource Id: " + resourceId);
        return movementInterface;
    } catch (AppCatalogException e) {
        logger.error(resourceId, "Error while adding data movement interface to resource compute resource...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while adding data movement interface to resource compute resource. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 28 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method updateGateway.

/**
 * Update previously registered Gateway metadata.
 *
 * @param gatewayId      The gateway Id of the Gateway which require an update.
 * @param updatedGateway
 * @return gateway
 * Modified gateway obejct.
 * @throws AiravataClientException
 */
@Override
public boolean updateGateway(String gatewayId, Gateway updatedGateway) throws RegistryServiceException, TException {
    try {
        experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
        if (!experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId)) {
            logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
            AiravataSystemException exception = new AiravataSystemException();
            exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
            throw exception;
        }
        experimentCatalog.update(ExperimentCatalogModelType.GATEWAY, updatedGateway, gatewayId);
        // check if gatewayprofile exists and check if the identity server password token equals the admin password token, if not update
        GatewayResourceProfile existingGwyResourceProfile = appCatalog.getGatewayProfile().getGatewayProfile(gatewayId);
        if (existingGwyResourceProfile.getIdentityServerPwdCredToken() == null || !existingGwyResourceProfile.getIdentityServerPwdCredToken().equals(updatedGateway.getIdentityServerPasswordToken())) {
            existingGwyResourceProfile.setIdentityServerPwdCredToken(updatedGateway.getIdentityServerPasswordToken());
            appCatalog.getGatewayProfile().updateGatewayResourceProfile(gatewayId, existingGwyResourceProfile);
        }
        logger.debug("Airavata update gateway with gateway id : " + gatewayId);
        return true;
    } catch (RegistryException e) {
        logger.error("Error while updating the gateway", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while updating the gateway. More info : " + e.getMessage());
        throw exception;
    } catch (AppCatalogException e) {
        logger.error("Error while updating gateway profile", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while updating gateway profile. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 29 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method updateLocalDataMovementDetails.

/**
 * Update the given Local data movement details
 *
 * @param dataMovementInterfaceId The identifier of the data movement Interface to be updated.
 * @param localDataMovement       The LOCALDataMovement object to be updated.
 * @return status
 * Returns a success/failure of the update.
 */
@Override
public boolean updateLocalDataMovementDetails(String dataMovementInterfaceId, LOCALDataMovement localDataMovement) throws RegistryServiceException, TException {
    try {
        LocalDataMovementResource movment = AppCatalogThriftConversion.getLocalDataMovement(localDataMovement);
        movment.setDataMovementInterfaceId(dataMovementInterfaceId);
        movment.save();
        logger.debug("Airavata updated local data movement with data movement id: " + dataMovementInterfaceId);
        return true;
    } catch (Exception e) {
        logger.error(dataMovementInterfaceId, "Error while updating local data movement interface..", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while updating local data movement interface. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException)

Example 30 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method updateApplicationDeployment.

/**
 * Update an Application Deployment.
 *
 * @param appDeploymentId       The identifier of the requested application deployment to be updated.
 * @param applicationDeployment
 * @return status
 * Returns a success/failure of the update.
 */
@Override
public boolean updateApplicationDeployment(String appDeploymentId, ApplicationDeploymentDescription applicationDeployment) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        appCatalog.getApplicationDeployment().updateApplicationDeployment(appDeploymentId, applicationDeployment);
        logger.debug("Airavata updated application deployment for deployment id : " + appDeploymentId);
        return true;
    } catch (AppCatalogException e) {
        logger.error(appDeploymentId, "Error while updating application deployment...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while updating application deployment. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Aggregations

RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)131 TException (org.apache.thrift.TException)28 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)26 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)9 UserResourceProfile (org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile)5 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)4 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)4 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)4 UserStoragePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference)4 DataProductModel (org.apache.airavata.model.data.replica.DataProductModel)4 JobModel (org.apache.airavata.model.job.JobModel)3 ProcessModel (org.apache.airavata.model.process.ProcessModel)3 ExperimentState (org.apache.airavata.model.status.ExperimentState)3 ExperimentStatus (org.apache.airavata.model.status.ExperimentStatus)3 Project (org.apache.airavata.model.workspace.Project)3 CredentialStoreService (org.apache.airavata.credential.store.cpi.CredentialStoreService)2 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)2 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)2 StoragePreference (org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference)2 PasswordCredential (org.apache.airavata.model.credential.store.PasswordCredential)2