use of org.apache.airavata.registry.cpi.CompositeIdentifier in project airavata by apache.
the class UsrResourceProfileImpl method getUserStoragePreference.
@Override
public UserStoragePreference getUserStoragePreference(String userId, String gatewayId, String storageId) throws AppCatalogException {
try {
UserStoragePreferenceResource prefResource = new UserStoragePreferenceResource();
CompositeIdentifier ids = new CompositeIdentifier(userId, gatewayId);
List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.UserComputeResourcePreferenceConstants.USER_ID, ids);
for (AppCatalogResource resource : computePrefList) {
UserStoragePreferenceResource dsP = (UserStoragePreferenceResource) resource;
if (dsP.getStorageResourceId() != null && !dsP.getStorageResourceId().equals("")) {
if (dsP.getStorageResourceId().equals(storageId)) {
return AppCatalogThriftConversion.getUserDataStoragePreference(dsP);
}
}
}
} catch (Exception e) {
logger.error("Error while retrieving user data storage preference...", e);
throw new AppCatalogException(e);
}
return null;
}
use of org.apache.airavata.registry.cpi.CompositeIdentifier in project airavata by apache.
the class UsrResourceProfileImpl method getAllUserComputeResourcePreferences.
/**
* @param userId
* @return
*/
@Override
public List<UserComputeResourcePreference> getAllUserComputeResourcePreferences(String userId, String gatewayID) throws AppCatalogException {
try {
UserComputeHostPreferenceResource prefResource = new UserComputeHostPreferenceResource();
CompositeIdentifier ids = new CompositeIdentifier(userId, gatewayID);
List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.UserComputeResourcePreferenceConstants.USER_ID, ids);
return AppCatalogThriftConversion.getUserComputeResourcePreferences(computePrefList);
} catch (Exception e) {
logger.error("Error while retrieving compute resource preference...", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.CompositeIdentifier in project airavata by apache.
the class UsrResourceProfileImpl method isUserResourceProfileExists.
@Override
public boolean isUserResourceProfileExists(String userId, String gatewayId) throws AppCatalogException {
try {
UserResourceProfileResource resource = new UserResourceProfileResource();
CompositeIdentifier ids = new CompositeIdentifier(userId, gatewayId);
return resource.isExists(ids);
} catch (Exception e) {
logger.error("Error while retrieving user resource profile...", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.CompositeIdentifier in project airavata by apache.
the class UsrResourceProfileImpl method getAllUserStoragePreferences.
@Override
public List<UserStoragePreference> getAllUserStoragePreferences(String userId, String gatewayID) throws AppCatalogException {
try {
UserStoragePreferenceResource prefResource = new UserStoragePreferenceResource();
CompositeIdentifier ids = new CompositeIdentifier(userId, gatewayID);
List<AppCatalogResource> dataStoragePrefList = prefResource.get(AppCatAbstractResource.UserStoragePreferenceConstants.USER_ID, ids);
return AppCatalogThriftConversion.getUserDataStoragePreferences(dataStoragePrefList);
} catch (Exception e) {
logger.error("Error while retrieving data storage preference...", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.CompositeIdentifier in project airavata by apache.
the class UsrResourceProfileImpl method getUserResourceProfile.
@Override
public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws AppCatalogException {
try {
UserResourceProfileResource resource = new UserResourceProfileResource();
CompositeIdentifier ids = new CompositeIdentifier(userId, gatewayId);
UserResourceProfileResource uResource = (UserResourceProfileResource) resource.get(ids);
UserComputeHostPreferenceResource prefResource = new UserComputeHostPreferenceResource();
List<AppCatalogResource> usercomputePrefList = prefResource.get(AppCatAbstractResource.UserComputeResourcePreferenceConstants.USER_ID, ids);
List<UserComputeResourcePreference> userComputeResourcePreferences = AppCatalogThriftConversion.getUserComputeResourcePreferences(usercomputePrefList);
List<UserStoragePreference> dataStoragePreferences = getAllUserStoragePreferences(userId, gatewayId);
if (uResource != null) {
return AppCatalogThriftConversion.getUserResourceProfile(uResource, userComputeResourcePreferences, dataStoragePreferences);
} else {
return AppCatalogThriftConversion.createNullUserResourceProfile(userId, gatewayId);
}
} catch (Exception e) {
logger.error("Error while retrieving user resource profile...", e);
throw new AppCatalogException(e);
}
}
Aggregations