Search in sources :

Example 11 with UserResourceProfile

use of org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile in project airavata by apache.

the class RegistryServerHandler method getUserResourceProfile.

/**
 * Fetch the given Gateway Resource Profile.
 *
 * @param userId The identifier for the requested user resource.
 * @return UserResourceProfile object
 */
@Override
public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws RegistryServiceException, TException {
    try {
        if (!ExpCatResourceUtils.isUserExist(userId, gatewayId)) {
            logger.error("user does not exist.Please provide a valid gateway id...");
            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
        }
        appCatalog = RegistryFactory.getAppCatalog();
        UsrResourceProfile usrResourceProfile = appCatalog.getUserResourceProfile();
        UserResourceProfile userResourceProfile = usrResourceProfile.getUserResourceProfile(userId, gatewayId);
        logger.debug("Airavata retrieved User resource profile with user id : " + userId);
        return userResourceProfile;
    } catch (AppCatalogException e) {
        logger.error(userId, "Error while retrieving user resource profile...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving user resource profile. More info : " + e.getMessage());
        throw exception;
    } catch (RegistryException e) {
        logger.error(userId, "Error while retrieving user resource profile...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving user resource profile. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) UserResourceProfile(org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile)

Aggregations

UserResourceProfile (org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile)11 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)6 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)3 UserStoragePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference)3 ArrayList (java.util.ArrayList)2 AiravataException (org.apache.airavata.common.exception.AiravataException)1 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)1 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)1 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)1 ProcessModel (org.apache.airavata.model.process.ProcessModel)1 RegistryService (org.apache.airavata.registry.api.RegistryService)1 AppCatalog (org.apache.airavata.registry.cpi.AppCatalog)1 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)1 ComputeResource (org.apache.airavata.registry.cpi.ComputeResource)1 UsrResourceProfile (org.apache.airavata.registry.cpi.UsrResourceProfile)1 SecurityCheck (org.apache.airavata.service.security.interceptor.SecurityCheck)1 SharingRegistryService (org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService)1 TException (org.apache.thrift.TException)1 Test (org.junit.Test)1