use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method registerQueueStatuses.
@Override
public void registerQueueStatuses(List<QueueStatusModel> queueStatuses) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getExperimentCatalog(ServerSettings.getDefaultUserGateway());
experimentCatalog.add(ExpCatParentDataType.QUEUE_STATUS, queueStatuses, null);
} catch (RegistryException | ApplicationSettingsException e) {
logger.error("Error while storing queue status models....", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while storing queue status models.... : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getAllGatewayResourceProfiles.
/**
* Fetch all Gateway Profiles registered
*
* @return GatewayResourceProfile
* Returns all the GatewayResourcePrifle list object.
*/
@Override
public List<GatewayResourceProfile> getAllGatewayResourceProfiles() throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.getAllGatewayProfiles();
} catch (AppCatalogException e) {
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method deleteExperiment.
/**
* Delete an Experiment
* If the experiment is not already launched experiment can be deleted.
*
* @param experimentId@return boolean
* Identifier for the success or failure of the deletion operation.
*/
@Override
public boolean deleteExperiment(String experimentId) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getDefaultExpCatalog();
if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, experimentId)) {
throw new ExperimentNotFoundException("Requested experiment id " + experimentId + " does not exist in the system..");
}
ExperimentModel experimentModel = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
if (!(experimentModel.getExperimentStatus().get(0).getState() == ExperimentState.CREATED)) {
logger.error("Error while deleting the experiment");
throw new ExperimentCatalogException("Experiment is not in CREATED state. Hence cannot deleted. ID:" + experimentId);
}
experimentCatalog.remove(ExperimentCatalogModelType.EXPERIMENT, experimentId);
logger.debug("Airavata removed experiment with experiment id : " + experimentId);
return true;
} catch (Exception e) {
logger.error("Error while deleting the experiment", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while deleting the experiment. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getUserProjects.
/**
* Get All User Projects
* Get all Project for the user with pagination. Results will be ordered based on creation time DESC.
*
* @param gatewayId The identifier for the requested gateway.
* @param userName The identifier of the user.
* @param limit The amount results to be fetched.
* @param offset The starting point of the results to be fetched.
*/
@Override
public List<Project> getUserProjects(String gatewayId, String userName, int limit, int offset) throws RegistryServiceException, TException {
if (!validateString(userName)) {
logger.error("Username cannot be empty. Please provide a valid user..");
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Username cannot be empty. Please provide a valid user..");
throw exception;
}
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...");
}
List<Project> projects = new ArrayList<Project>();
try {
if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)) {
logger.warn("User does not exist in the system. Please provide a valid user..");
return projects;
}
experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
filters.put(Constants.FieldConstants.ProjectConstants.GATEWAY_ID, gatewayId);
List<Object> list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, limit, offset, Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
if (list != null && !list.isEmpty()) {
for (Object o : list) {
projects.add((Project) o);
}
}
logger.debug("Airavata retrieved projects for user : " + userName + " and gateway id : " + gatewayId);
return projects;
} catch (RegistryException e) {
logger.error("Error while retrieving projects", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method deleteComputeResource.
/**
* Delete a Compute Resource.
*
* @param computeResourceId The identifier for the requested compute resource to be deleted.
* @return status
* Returns a success/failure of the deletion.
*/
@Override
public boolean deleteComputeResource(String computeResourceId) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
appCatalog.getComputeResource().removeComputeResource(computeResourceId);
logger.debug("Airavata deleted compute resource with compute resource Id : " + computeResourceId);
return true;
} catch (AppCatalogException e) {
logger.error(computeResourceId, "Error while deleting compute resource...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while deleting compute resource. More info : " + e.getMessage());
throw exception;
}
}
Aggregations