use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getProject.
/**
* Get a Project by ID
* This method is to obtain a project by providing a projectId.
*
* @param projectId projectId of the project you require.
* @return project
* project data model will be returned.
*/
@Override
public Project getProject(String projectId) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getDefaultExpCatalog();
if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)) {
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
logger.debug("Airavata retrieved project with project Id : " + projectId);
Project project = (Project) experimentCatalog.get(ExperimentCatalogModelType.PROJECT, projectId);
return project;
} catch (RegistryException e) {
logger.error("Error while retrieving the project", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while retrieving the project. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method registerApplicationDeployment.
/**
* Register an Application Deployment.
*
* @param gatewayId ID of the gateway which is registering the new Application Deployment.
* @param applicationDeployment Application Module Object created from the datamodel.
* @return appDeploymentId
* Returns a server-side generated airavata appDeployment globally unique identifier.
*/
@Override
public String registerApplicationDeployment(String gatewayId, ApplicationDeploymentDescription applicationDeployment) 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();
String deployment = appCatalog.getApplicationDeployment().addApplicationDeployment(applicationDeployment, gatewayId);
logger.debug("Airavata registered application deployment for gateway id : " + gatewayId);
return deployment;
} catch (AppCatalogException e) {
logger.error("Error while adding application deployment...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while adding application deployment. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getGateway.
/**
* Get Gateway details by providing gatewayId
*
* @param gatewayId The gateway Id of the Gateway.
* @return gateway
* Gateway obejct.
*/
@Override
public Gateway getGateway(String gatewayId) 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;
}
Gateway gateway = (Gateway) experimentCatalog.get(ExperimentCatalogModelType.GATEWAY, gatewayId);
logger.debug("Airavata retrieved gateway with gateway id : " + gateway.getGatewayId());
return gateway;
} catch (RegistryException e) {
logger.error("Error while getting the gateway", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while getting the gateway. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getLocalJobSubmission.
/**
* This method returns localJobSubmission object
*
* @param jobSubmissionId@return LOCALSubmission instance
*/
@Override
public LOCALSubmission getLocalJobSubmission(String jobSubmissionId) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
LOCALSubmission localJobSubmission = appCatalog.getComputeResource().getLocalJobSubmission(jobSubmissionId);
logger.debug("Airavata retrieved local job submission for job submission interface id: " + jobSubmissionId);
return localJobSubmission;
} catch (AppCatalogException e) {
String errorMsg = "Error while retrieving local job submission interface to resource compute resource...";
logger.error(jobSubmissionId, 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 getGatewayComputeResourcePreference.
/**
* Fetch a Compute Resource Preference of a registered gateway profile.
*
* @param gatewayID The identifier for the gateway profile to be requested
* @param computeResourceId Preferences related to a particular compute resource
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
@Override
public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId) 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();
ComputeResource computeResource = appCatalog.getComputeResource();
if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)) {
logger.error(gatewayID, "Given gateway profile does not exist in the system. Please provide a valid gateway id...");
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Given gateway profile does not exist in the system. Please provide a valid gateway id...");
throw exception;
}
if (!computeResource.isComputeResourceExists(computeResourceId)) {
logger.error(computeResourceId, "Given compute resource does not exist in the system. Please provide a valid compute resource id...");
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Given compute resource does not exist in the system. Please provide a valid compute resource id...");
throw exception;
}
ComputeResourcePreference computeResourcePreference = gatewayProfile.getComputeResourcePreference(gatewayID, computeResourceId);
logger.debug("Airavata retrieved gateway compute resource preference with gateway id : " + gatewayID + " and for compute resoruce id : " + computeResourceId);
return computeResourcePreference;
} catch (AppCatalogException e) {
logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while reading gateway compute resource preference. More info : " + e.getMessage());
throw exception;
}
}
Aggregations