Search in sources :

Example 1 with RegistryServiceException

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

the class AiravataServerHandler method getRegistryServiceClient.

private RegistryService.Client getRegistryServiceClient() throws TException, ApplicationSettingsException {
    final int serverPort = Integer.parseInt(ServerSettings.getRegistryServerPort());
    final String serverHost = ServerSettings.getRegistryServerHost();
    try {
        return RegistryServiceClientFactory.createRegistryClient(serverHost, serverPort);
    } catch (RegistryServiceException e) {
        throw new TException("Unable to create registry client...", e);
    }
}
Also used : TException(org.apache.thrift.TException) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 2 with RegistryServiceException

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

the class RegistryServerHandler method updateGatewayStoragePreference.

/**
 * Update a Storage Resource Preference of a registered gateway profile.
 *
 * @param gatewayID         The identifier of the gateway profile to be updated.
 * @param storageId         The Storage resource identifier of the one that you want to update
 * @param storagePreference The storagePreference object to be updated to the resource profile.
 * @return status
 * Returns a success/failure of the updation.
 */
@Override
public boolean updateGatewayStoragePreference(String gatewayID, String storageId, StoragePreference storagePreference) throws RegistryServiceException, TException {
    try {
        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...");
        }
        appCatalog = RegistryFactory.getAppCatalog();
        GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
        GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
        List<StoragePreference> dataStoragePreferences = profile.getStoragePreferences();
        StoragePreference preferenceToRemove = null;
        for (StoragePreference preference : dataStoragePreferences) {
            if (preference.getStorageResourceId().equals(storageId)) {
                preferenceToRemove = preference;
                break;
            }
        }
        if (preferenceToRemove != null) {
            profile.getStoragePreferences().remove(preferenceToRemove);
        }
        profile.getStoragePreferences().add(storagePreference);
        gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
        logger.debug("Airavata updated storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageId);
        return true;
    } catch (AppCatalogException e) {
        logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) UserStoragePreference(org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference) StoragePreference(org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference)

Example 3 with RegistryServiceException

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

the class RegistryServerHandler method getApplicationInputs.

/**
 * Fetch the list of Application Inputs.
 *
 * @param appInterfaceId The identifier of the application interface which need inputs to be fetched.
 * @return list<application_interface_model.InputDataObjectType>
 * Returns a list of application inputs.
 */
@Override
public List<InputDataObjectType> getApplicationInputs(String appInterfaceId) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        List<InputDataObjectType> applicationInputs = appCatalog.getApplicationInterface().getApplicationInputs(appInterfaceId);
        logger.debug("Airavata retrieved application inputs for application interface id : " + appInterfaceId);
        return applicationInputs;
    } catch (AppCatalogException e) {
        logger.error(appInterfaceId, "Error while retrieving application inputs...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving application inputs. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType)

Example 4 with RegistryServiceException

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

the class RegistryServerHandler method getLocalDataMovement.

/**
 * This method returns local datamovement object.
 *
 * @param dataMovementId The identifier of the datamovement Interface to be retrieved.
 * @return LOCALDataMovement instance
 */
@Override
public LOCALDataMovement getLocalDataMovement(String dataMovementId) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        LOCALDataMovement localDataMovement = appCatalog.getComputeResource().getLocalDataMovement(dataMovementId);
        logger.debug("Airavata retrieved local data movement with data movement id: " + dataMovementId);
        return localDataMovement;
    } catch (AppCatalogException e) {
        String errorMsg = "Error while retrieving local data movement interface to resource compute resource...";
        logger.error(dataMovementId, errorMsg, e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage(errorMsg + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 5 with RegistryServiceException

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

the class RegistryServerHandler method getDataProduct.

@Override
public DataProductModel getDataProduct(String productUri) throws RegistryServiceException, TException {
    try {
        dataCatalog = RegistryFactory.getReplicaCatalog();
        DataProductModel dataProductModel = dataCatalog.getDataProduct(productUri);
        return dataProductModel;
    } catch (RegistryException e) {
        String msg = "Error in retreiving the data product " + productUri + ".";
        logger.error(msg, e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage(msg + " More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) DataProductModel(org.apache.airavata.model.data.replica.DataProductModel)

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