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);
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
Aggregations