You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/05/30 21:53:58 UTC
[03/11] adding proper entity manager closing and exception handling -
AIRAVATA-1285
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
index 559080f..1fed39c 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
@@ -29,6 +29,7 @@ import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
import org.apache.airavata.registry.cpi.utils.StatusType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.airavata.registry.cpi.RegistryException;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -75,8 +76,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
this.nodeName = nodeName;
}
- @Override
- public Resource create(ResourceType type) {
+ public Resource create(ResourceType type) throws RegistryException{
switch (type){
case TASK_DETAIL:
TaskDetailResource taskDetailResource = new TaskDetailResource();
@@ -104,230 +104,262 @@ public class WorkflowNodeDetailResource extends AbstractResource {
}
}
- @Override
- public void remove(ResourceType type, Object name) {
- EntityManager em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type){
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ em.close();
+ }
}
- em.getTransaction().commit();
- em.close();
}
- @Override
- public Resource get(ResourceType type, Object name) {
- EntityManager em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- TaskDetail taskDetail = (TaskDetail)q.getSingleResult();
- TaskDetailResource taskDetailResource = (TaskDetailResource)Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- em.getTransaction().commit();
- em.close();
- return taskDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail)q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource)Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeInput nodeInput = (NodeInput)q.getSingleResult();
- NodeInputResource nodeInputResource = (NodeInputResource)Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- em.getTransaction().commit();
- em.close();
- return nodeInputResource;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeOutput nodeOutput = (NodeOutput)q.getSingleResult();
- NodeOutputResource nodeOutputResource = (NodeOutputResource)Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- em.getTransaction().commit();
- em.close();
- return nodeOutputResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- Status status = (Status)q.getSingleResult();
- StatusResource statusResource = (StatusResource)Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- default:
- em.getTransaction().commit();
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ TaskDetail taskDetail = (TaskDetail) q.getSingleResult();
+ TaskDetailResource taskDetailResource = (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
+ em.getTransaction().commit();
+ em.close();
+ return taskDetailResource;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ em.getTransaction().commit();
+ em.close();
+ return errorDetailResource;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ NodeInput nodeInput = (NodeInput) q.getSingleResult();
+ NodeInputResource nodeInputResource = (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
+ em.getTransaction().commit();
+ em.close();
+ return nodeInputResource;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ NodeOutput nodeOutput = (NodeOutput) q.getSingleResult();
+ NodeOutputResource nodeOutputResource = (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
+ em.getTransaction().commit();
+ em.close();
+ return nodeOutputResource;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
em.close();
- logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
+ }
}
}
- @Override
- public List<Resource> get(ResourceType type) {
+ public List<Resource> get(ResourceType type) throws RegistryException{
List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type){
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- TaskDetail taskDetail = (TaskDetail) result;
- TaskDetailResource taskDetailResource =
- (TaskDetailResource)Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- resourceList.add(taskDetailResource);
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ TaskDetail taskDetail = (TaskDetail) result;
+ TaskDetailResource taskDetailResource =
+ (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
+ resourceList.add(taskDetailResource);
+ }
}
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource)Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ErrorDetail errorDetail = (ErrorDetail) result;
+ ErrorDetailResource errorDetailResource =
+ (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ resourceList.add(errorDetailResource);
+ }
}
- }
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeInput nodeInput = (NodeInput) result;
- NodeInputResource nodeInputResource =
- (NodeInputResource)Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- resourceList.add(nodeInputResource);
+ break;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ NodeInput nodeInput = (NodeInput) result;
+ NodeInputResource nodeInputResource =
+ (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
+ resourceList.add(nodeInputResource);
+ }
}
- }
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeOutput nodeOutput = (NodeOutput) result;
- NodeOutputResource nodeOutputResource =
- (NodeOutputResource)Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- resourceList.add(nodeOutputResource);
+ break;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ NodeOutput nodeOutput = (NodeOutput) result;
+ NodeOutputResource nodeOutputResource =
+ (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
+ resourceList.add(nodeOutputResource);
+ }
}
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource)Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
}
- }
- break;
- default:
- em.getTransaction().commit();
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ } catch (Exception e) {
+// logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
+ }
}
- em.getTransaction().commit();
- em.close();
return resourceList;
}
- @Override
- public void save() {
- EntityManager em = ResourceUtils.getEntityManager();
- WorkflowNodeDetail existingNode = em.find(WorkflowNodeDetail.class, nodeInstanceId);
- em.close();
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ WorkflowNodeDetail existingNode = em.find(WorkflowNodeDetail.class, nodeInstanceId);
+ em.close();
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- WorkflowNodeDetail workflowNodeDetail = new WorkflowNodeDetail();
- workflowNodeDetail.setNodeId(nodeInstanceId);
- Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
- workflowNodeDetail.setExperiment(experiment);
- workflowNodeDetail.setExpId(experimentResource.getExpID());
- workflowNodeDetail.setCreationTime(creationTime);
- workflowNodeDetail.setNodeName(nodeName);
- if (existingNode != null){
- existingNode.setExperiment(experiment);
- existingNode.setExpId(experimentResource.getExpID());
- existingNode.setCreationTime(creationTime);
- existingNode.setNodeName(nodeName);
- workflowNodeDetail = em.merge(existingNode);
- }else {
- em.merge(workflowNodeDetail);
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ WorkflowNodeDetail workflowNodeDetail = new WorkflowNodeDetail();
+ workflowNodeDetail.setNodeId(nodeInstanceId);
+ Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
+ workflowNodeDetail.setExperiment(experiment);
+ workflowNodeDetail.setExpId(experimentResource.getExpID());
+ workflowNodeDetail.setCreationTime(creationTime);
+ workflowNodeDetail.setNodeName(nodeName);
+ if (existingNode != null) {
+ existingNode.setExperiment(experiment);
+ existingNode.setExpId(experimentResource.getExpID());
+ existingNode.setCreationTime(creationTime);
+ existingNode.setNodeName(nodeName);
+ workflowNodeDetail = em.merge(existingNode);
+ } else {
+ em.merge(workflowNodeDetail);
+ }
+ em.getTransaction().commit();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ em.close();
+ }
}
- em.getTransaction().commit();
- em.close();
}
- public List<NodeInputResource> getNodeInputs(){
+ public List<NodeInputResource> getNodeInputs() throws RegistryException{
List<NodeInputResource> nodeInputResourceList = new ArrayList<NodeInputResource>();
List<Resource> resources = get(ResourceType.NODE_INPUT);
for (Resource resource : resources) {
@@ -337,7 +369,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return nodeInputResourceList;
}
- public List<NodeOutputResource> getNodeOutputs(){
+ public List<NodeOutputResource> getNodeOutputs() throws RegistryException{
List<NodeOutputResource> outputResources = new ArrayList<NodeOutputResource>();
List<Resource> resources = get(ResourceType.NODE_OUTPUT);
for (Resource resource : resources) {
@@ -347,7 +379,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return outputResources;
}
- public StatusResource getWorkflowNodeStatus(){
+ public StatusResource getWorkflowNodeStatus() throws RegistryException{
List<Resource> resources = get(ResourceType.STATUS);
for (Resource resource : resources) {
StatusResource nodeStatus = (StatusResource) resource;
@@ -361,7 +393,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return null;
}
- public StatusResource getTaskStatus(String taskId){
+ public StatusResource getTaskStatus(String taskId) throws RegistryException{
List<Resource> resources = get(ResourceType.STATUS);
for (Resource resource : resources) {
StatusResource taskStatus = (StatusResource) resource;
@@ -376,7 +408,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return null;
}
- public List<TaskDetailResource> getTaskDetails(){
+ public List<TaskDetailResource> getTaskDetails() throws RegistryException{
List<TaskDetailResource> taskDetailResources = new ArrayList<TaskDetailResource>();
List<Resource> resources = get(ResourceType.TASK_DETAIL);
for (Resource resource : resources) {
@@ -386,7 +418,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return taskDetailResources;
}
- public List<ErrorDetailResource> getErrorDetails(){
+ public List<ErrorDetailResource> getErrorDetails() throws RegistryException{
List<ErrorDetailResource> errorDetails = new ArrayList<ErrorDetailResource>();
List<Resource> resources = get(ResourceType.ERROR_DETAIL);
for (Resource resource : resources) {
@@ -396,7 +428,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
return errorDetails;
}
- public TaskDetailResource getTaskDetail(String taskId){
+ public TaskDetailResource getTaskDetail(String taskId) throws RegistryException{
return (TaskDetailResource)get(ResourceType.TASK_DETAIL, taskId);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
index 7c4ad7b..a66d743 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
@@ -25,6 +25,7 @@ import org.apache.airavata.model.workspace.Project;
import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
import org.apache.airavata.persistance.registry.jpa.resources.*;
+import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,7 +35,7 @@ import java.util.List;
public class ThriftDataModelConversion {
private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
- public static Project getProject (ProjectResource pr){
+ public static Project getProject (ProjectResource pr) throws RegistryException {
if (pr != null) {
Project project = new Project();
project.setProjectID(pr.getId());
@@ -58,7 +59,7 @@ public class ThriftDataModelConversion {
}
- public static Experiment getExperiment(ExperimentResource experimentResource){
+ public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException {
if (experimentResource != null){
Experiment experiment = new Experiment();
if (experimentResource.getProject()!= null){
@@ -105,7 +106,7 @@ public class ThriftDataModelConversion {
return null;
}
- public static ExperimentSummary getExperimentSummary(ExperimentResource experimentResource){
+ public static ExperimentSummary getExperimentSummary(ExperimentResource experimentResource) throws RegistryException {
if (experimentResource != null){
ExperimentSummary experimentSummary = new ExperimentSummary();
if (experimentResource.getProject()!= null){
@@ -336,7 +337,7 @@ public class ThriftDataModelConversion {
return wfNodeStatuses;
}
- public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource){
+ public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
if (nodeDetailResource != null){
WorkflowNodeDetails wfNode = new WorkflowNodeDetails();
wfNode.setNodeInstanceId(nodeDetailResource.getNodeInstanceId());
@@ -356,7 +357,7 @@ public class ThriftDataModelConversion {
return null;
}
- public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources){
+ public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources) throws RegistryException {
List<WorkflowNodeDetails> workflowNodeDetailsList = new ArrayList<WorkflowNodeDetails>();
if (resources != null && !resources.isEmpty()){
for (WorkflowNodeDetailResource resource : resources){
@@ -366,7 +367,7 @@ public class ThriftDataModelConversion {
return workflowNodeDetailsList;
}
- public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource){
+ public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource) throws RegistryException {
if (taskDetailResource != null){
TaskDetails taskDetails = new TaskDetails();
String taskId = taskDetailResource.getTaskId();
@@ -402,7 +403,7 @@ public class ThriftDataModelConversion {
return null;
}
- public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources){
+ public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources) throws RegistryException {
List<TaskDetails> taskDetailsList = new ArrayList<TaskDetails>();
if (resources != null && !resources.isEmpty()){
for (TaskDetailResource resource : resources){
@@ -412,7 +413,7 @@ public class ThriftDataModelConversion {
return taskDetailsList;
}
- public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs){
+ public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs) throws RegistryException {
List<JobDetails> jobDetailsList = new ArrayList<JobDetails>();
if (jobs != null && !jobs.isEmpty()){
for (JobDetailResource resource : jobs){
@@ -423,7 +424,7 @@ public class ThriftDataModelConversion {
}
- public static JobDetails getJobDetail(JobDetailResource jobDetailResource){
+ public static JobDetails getJobDetail(JobDetailResource jobDetailResource) throws RegistryException {
if (jobDetailResource != null){
JobDetails jobDetails = new JobDetails();
jobDetails.setJobID(jobDetailResource.getJobId());
@@ -467,7 +468,7 @@ public class ThriftDataModelConversion {
return errorDetailsList;
}
- public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource){
+ public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource) throws RegistryException {
if (resource != null){
DataTransferDetails details = new DataTransferDetails();
details.setTransferID(resource.getTransferId());
@@ -479,7 +480,7 @@ public class ThriftDataModelConversion {
return null;
}
- public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources){
+ public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources) throws RegistryException {
List<DataTransferDetails> transferDetailsList = new ArrayList<DataTransferDetails>();
if (resources != null && !resources.isEmpty()){
for (DataTransferDetailResource resource : resources){
@@ -490,7 +491,7 @@ public class ThriftDataModelConversion {
}
- public static UserConfigurationData getUserConfigData (ConfigDataResource resource){
+ public static UserConfigurationData getUserConfigData (ConfigDataResource resource) throws RegistryException {
if (resource != null){
UserConfigurationData data = new UserConfigurationData();
data.setAiravataAutoSchedule(resource.isAiravataAutoSchedule());
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
index ec1c3bc..3d1014b 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
@@ -29,6 +29,7 @@ import org.apache.airavata.persistance.registry.jpa.resources.Utils;
import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
import org.apache.airavata.registry.api.exception.RegistrySettingsException;
import org.apache.airavata.registry.api.util.RegistrySettings;
+import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -167,6 +168,8 @@ public class Initialize {
} catch (RegistrySettingsException e) {
logger.error("Unable to read properties", e);
+ } catch (RegistryException e) {
+ logger.error("Error while saving data", e);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
index 7751da3..e93da37 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
@@ -21,7 +21,7 @@
package org.apache.airavata.registry.api;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
import java.net.URI;
import java.util.Observable;
@@ -42,9 +42,9 @@ public abstract class AiravataRegistry2 extends Observable implements Descriptor
/**
* Initialize the Airavata Registry
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- protected abstract void initialize() throws RegistryException;
+ protected abstract void initialize() throws RegException;
public Gateway getGateway() {
return gateway;
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
index 4146c83..0a2f643 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
@@ -22,7 +22,6 @@
package org.apache.airavata.registry.api;
import org.apache.airavata.registry.api.exception.RegistrySettingsException;
-import org.apache.airavata.registry.api.exception.UnknownRegistryConnectionDataException;
public interface AiravataRegistryConnectionDataProvider {
public void setIdentity(Gateway gateway, AiravataUser use);
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
index 5b5147a..e875898 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
@@ -38,17 +38,17 @@ public class AiravataRegistryFactory {
* @param gateway
* @param user
* @return
- * @throws RegistryAccessorNotFoundException
- * @throws RegistryAccessorUndefinedException
- * @throws RegistryAccessorInstantiateException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorNotFoundException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorUndefinedException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorInstantiateException
* @throws AiravataConfigurationException
- * @throws RegistryAccessorInvalidException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorInvalidException
*/
public static AiravataRegistry2 getRegistry(Gateway gateway,
- AiravataUser user) throws RegistryException,
- RegistryAccessorUndefinedException,
- RegistryAccessorInstantiateException,
- AiravataConfigurationException, RegistryAccessorInvalidException {
+ AiravataUser user) throws RegException,
+ RegAccessorUndefinedException,
+ RegAccessorInstantiateException,
+ AiravataConfigurationException, RegAccessorInvalidException {
return getRegistry(null, gateway, user, null);
}
@@ -60,17 +60,17 @@ public class AiravataRegistryFactory {
* @param user
* @param callback
* @return
- * @throws RegistryAccessorNotFoundException
- * @throws RegistryAccessorUndefinedException
- * @throws RegistryAccessorInstantiateException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorNotFoundException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorUndefinedException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorInstantiateException
* @throws AiravataConfigurationException
- * @throws RegistryAccessorInvalidException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorInvalidException
*/
public static AiravataRegistry2 getRegistry(URI connectionURI, Gateway gateway,
- AiravataUser user, PasswordCallback callback) throws RegistryException,
- RegistryAccessorUndefinedException,
- RegistryAccessorInstantiateException,
- AiravataConfigurationException, RegistryAccessorInvalidException {
+ AiravataUser user, PasswordCallback callback) throws RegException,
+ RegAccessorUndefinedException,
+ RegAccessorInstantiateException,
+ AiravataConfigurationException, RegAccessorInvalidException {
Object registryObj = getRegistryClass(REGISTRY_ACCESSOR_CLASS);
if (registryObj instanceof AiravataRegistry2) {
AiravataRegistry2 registry = (AiravataRegistry2) registryObj;
@@ -78,7 +78,7 @@ public class AiravataRegistryFactory {
registry.initialize();
return registry;
}
- throw new RegistryAccessorInvalidException(registryObj.getClass().getName());
+ throw new RegAccessorInvalidException(registryObj.getClass().getName());
}
/***
@@ -87,21 +87,21 @@ public class AiravataRegistryFactory {
*
* @param registryClassKey
* @return
- * @throws RegistryAccessorNotFoundException
- * @throws RegistryAccessorUndefinedException
- * @throws RegistryAccessorInstantiateException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorNotFoundException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorUndefinedException
+ * @throws org.apache.airavata.registry.api.exception.RegAccessorInstantiateException
* @throws AiravataConfigurationException
*/
public static Object getRegistryClass(String registryClassKey)
- throws RegistryAccessorNotFoundException,
- RegistryAccessorUndefinedException,
- RegistryAccessorInstantiateException,
+ throws RegAccessorNotFoundException,
+ RegAccessorUndefinedException,
+ RegAccessorInstantiateException,
AiravataConfigurationException {
try {
String regAccessorClass = RegistrySettings.getSetting(registryClassKey);
if (regAccessorClass == null) {
- throw new RegistryAccessorUndefinedException();
+ throw new RegAccessorUndefinedException();
} else {
try {
Class<?> classInstance = AiravataRegistryFactory.class
@@ -109,13 +109,13 @@ public class AiravataRegistryFactory {
regAccessorClass);
return classInstance.newInstance();
} catch (ClassNotFoundException e) {
- throw new RegistryAccessorNotFoundException(
+ throw new RegAccessorNotFoundException(
regAccessorClass, e);
} catch (InstantiationException e) {
- throw new RegistryAccessorInstantiateException(
+ throw new RegAccessorInstantiateException(
regAccessorClass, e);
} catch (IllegalAccessException e) {
- throw new RegistryAccessorInstantiateException(
+ throw new RegAccessorInstantiateException(
regAccessorClass, e);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
index c560c26..1c1987e 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
@@ -25,35 +25,35 @@ import java.net.URI;
import java.util.Date;
import java.util.List;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
public interface ConfigurationRegistry extends AiravataSubRegistry {
- public Object getConfiguration(String key) throws RegistryException;
- public List<Object> getConfigurationList(String key) throws RegistryException;
- public void setConfiguration(String key, String value, Date expire) throws RegistryException;
- public void addConfiguration(String key, String value, Date expire) throws RegistryException;
- public void removeAllConfiguration(String key) throws RegistryException;
- public void removeConfiguration(String key, String value) throws RegistryException;
+ public Object getConfiguration(String key) throws RegException;
+ public List<Object> getConfigurationList(String key) throws RegException;
+ public void setConfiguration(String key, String value, Date expire) throws RegException;
+ public void addConfiguration(String key, String value, Date expire) throws RegException;
+ public void removeAllConfiguration(String key) throws RegException;
+ public void removeConfiguration(String key, String value) throws RegException;
- public List<URI> getGFacURIs() throws RegistryException;
- public List<URI> getWorkflowInterpreterURIs() throws RegistryException;
- public URI getEventingServiceURI() throws RegistryException;
- public URI getMessageBoxURI() throws RegistryException;
+ public List<URI> getGFacURIs() throws RegException;
+ public List<URI> getWorkflowInterpreterURIs() throws RegException;
+ public URI getEventingServiceURI() throws RegException;
+ public URI getMessageBoxURI() throws RegException;
- public void addGFacURI(URI uri) throws RegistryException;
- public void addWorkflowInterpreterURI(URI uri) throws RegistryException;
- public void setEventingURI(URI uri) throws RegistryException;
- public void setMessageBoxURI(URI uri) throws RegistryException;
+ public void addGFacURI(URI uri) throws RegException;
+ public void addWorkflowInterpreterURI(URI uri) throws RegException;
+ public void setEventingURI(URI uri) throws RegException;
+ public void setMessageBoxURI(URI uri) throws RegException;
- public void addGFacURI(URI uri, Date expire) throws RegistryException;
- public void addWorkflowInterpreterURI(URI uri, Date expire) throws RegistryException;
- public void setEventingURI(URI uri, Date expire) throws RegistryException;
- public void setMessageBoxURI(URI uri, Date expire) throws RegistryException;
+ public void addGFacURI(URI uri, Date expire) throws RegException;
+ public void addWorkflowInterpreterURI(URI uri, Date expire) throws RegException;
+ public void setEventingURI(URI uri, Date expire) throws RegException;
+ public void setMessageBoxURI(URI uri, Date expire) throws RegException;
- public void removeGFacURI(URI uri) throws RegistryException;
- public void removeAllGFacURI() throws RegistryException;
- public void removeWorkflowInterpreterURI(URI uri) throws RegistryException;
- public void removeAllWorkflowInterpreterURI() throws RegistryException;
- public void unsetEventingURI() throws RegistryException;
- public void unsetMessageBoxURI() throws RegistryException;
+ public void removeGFacURI(URI uri) throws RegException;
+ public void removeAllGFacURI() throws RegException;
+ public void removeWorkflowInterpreterURI(URI uri) throws RegException;
+ public void removeAllWorkflowInterpreterURI() throws RegException;
+ public void unsetEventingURI() throws RegException;
+ public void unsetMessageBoxURI() throws RegException;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/CredentialRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/CredentialRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/CredentialRegistry.java
index 2cf1041..041c9ad 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/CredentialRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/CredentialRegistry.java
@@ -21,7 +21,7 @@
package org.apache.airavata.registry.api;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
public interface CredentialRegistry extends AiravataSubRegistry{
@@ -31,19 +31,19 @@ public interface CredentialRegistry extends AiravataSubRegistry{
* @param String gatewayId
* @param String tokenId
* @return a boolean (true is credential exists, false if not)
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public boolean isCredentialExist(String gatewayId, String tokenId) throws RegistryException;
+ public boolean isCredentialExist(String gatewayId, String tokenId) throws RegException;
/**
* Get the public key for a credential in the credential store for given gateway and token
* @param String gatewayId
* @param String tokenId
* @return String The public key of the credential
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public String getCredentialPublicKey(String gatewayId, String tokenId) throws RegistryException;
+ public String getCredentialPublicKey(String gatewayId, String tokenId) throws RegException;
/**
* Creates a new SSH credential for given gateway and token, encrypts it with a randomly
@@ -51,9 +51,9 @@ public interface CredentialRegistry extends AiravataSubRegistry{
* @param String gatewayId
* @param String tokenId
* @return String The public key of the credential
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public String createCredential(String gatewayId, String tokenId) throws RegistryException;
+ public String createCredential(String gatewayId, String tokenId) throws RegException;
/**
* Creates a new SSH credential for given gateway and token, encrypts it with the given password
@@ -62,8 +62,8 @@ public interface CredentialRegistry extends AiravataSubRegistry{
* @param String tokenId
* @param String username
* @return String The public key of the credential
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public String createCredential(String gatewayId, String tokenId, String username) throws RegistryException;
+ public String createCredential(String gatewayId, String tokenId, String username) throws RegException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DataRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DataRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DataRegistry.java
index 96290cd..fa0ed54 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DataRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DataRegistry.java
@@ -23,7 +23,7 @@ package org.apache.airavata.registry.api;
import java.util.List;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
import org.apache.airavata.commons.gfac.type.ActualParameter;
public interface DataRegistry {
@@ -34,17 +34,17 @@ public interface DataRegistry {
* @param workflowId
* @param parameters
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public String saveOutput(String workflowId, List<ActualParameter> parameters) throws RegistryException;
+ public String saveOutput(String workflowId, List<ActualParameter> parameters) throws RegException;
/**
* Load output from workflow execution.
*
* @param workflowId
* @return List of parameters
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- public List<ActualParameter> loadOutput(String workflowId) throws RegistryException;
+ public List<ActualParameter> loadOutput(String workflowId) throws RegException;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
index c3398c5..92bf424 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.registry.api.exception.gateway.DescriptorAlreadyExistsException;
@@ -39,36 +39,36 @@ public interface DescriptorRegistry extends AiravataSubRegistry {
*/
//---------Host Descriptor data------------
- public boolean isHostDescriptorExists(String descriptorName)throws RegistryException;
- public void addHostDescriptor(HostDescription descriptor) throws DescriptorAlreadyExistsException, RegistryException;
- public void updateHostDescriptor(HostDescription descriptor)throws DescriptorDoesNotExistsException, RegistryException;
- public HostDescription getHostDescriptor(String hostName)throws DescriptorDoesNotExistsException,MalformedDescriptorException, RegistryException;
- public void removeHostDescriptor(String hostName)throws DescriptorDoesNotExistsException, RegistryException;
- public List<HostDescription> getHostDescriptors()throws MalformedDescriptorException, RegistryException;
- public ResourceMetadata getHostDescriptorMetadata(String hostName)throws DescriptorDoesNotExistsException, RegistryException;
+ public boolean isHostDescriptorExists(String descriptorName)throws RegException;
+ public void addHostDescriptor(HostDescription descriptor) throws DescriptorAlreadyExistsException, RegException;
+ public void updateHostDescriptor(HostDescription descriptor)throws DescriptorDoesNotExistsException, RegException;
+ public HostDescription getHostDescriptor(String hostName)throws DescriptorDoesNotExistsException,MalformedDescriptorException, RegException;
+ public void removeHostDescriptor(String hostName)throws DescriptorDoesNotExistsException, RegException;
+ public List<HostDescription> getHostDescriptors()throws MalformedDescriptorException, RegException;
+ public ResourceMetadata getHostDescriptorMetadata(String hostName)throws DescriptorDoesNotExistsException, RegException;
//---------Service Descriptor data------------
- public boolean isServiceDescriptorExists(String descriptorName)throws RegistryException;
- public void addServiceDescriptor(ServiceDescription descriptor)throws DescriptorAlreadyExistsException, RegistryException;
- public void updateServiceDescriptor(ServiceDescription descriptor)throws DescriptorDoesNotExistsException, RegistryException;
- public ServiceDescription getServiceDescriptor(String serviceName)throws DescriptorDoesNotExistsException,MalformedDescriptorException, RegistryException;
- public void removeServiceDescriptor(String serviceName)throws DescriptorDoesNotExistsException, RegistryException;
- public List<ServiceDescription> getServiceDescriptors()throws MalformedDescriptorException, RegistryException;
- public ResourceMetadata getServiceDescriptorMetadata(String serviceName)throws DescriptorDoesNotExistsException, RegistryException;
+ public boolean isServiceDescriptorExists(String descriptorName)throws RegException;
+ public void addServiceDescriptor(ServiceDescription descriptor)throws DescriptorAlreadyExistsException, RegException;
+ public void updateServiceDescriptor(ServiceDescription descriptor)throws DescriptorDoesNotExistsException, RegException;
+ public ServiceDescription getServiceDescriptor(String serviceName)throws DescriptorDoesNotExistsException,MalformedDescriptorException, RegException;
+ public void removeServiceDescriptor(String serviceName)throws DescriptorDoesNotExistsException, RegException;
+ public List<ServiceDescription> getServiceDescriptors()throws MalformedDescriptorException, RegException;
+ public ResourceMetadata getServiceDescriptorMetadata(String serviceName)throws DescriptorDoesNotExistsException, RegException;
//---------Application Descriptor data------------
- public boolean isApplicationDescriptorExists(String serviceName, String hostName, String descriptorName)throws RegistryException;
- public void addApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDescription descriptor)throws DescriptorAlreadyExistsException, RegistryException;
- public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor)throws DescriptorAlreadyExistsException, RegistryException;
- public void udpateApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDescription descriptor)throws DescriptorDoesNotExistsException, RegistryException;
- public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor)throws DescriptorDoesNotExistsException, RegistryException;
- public ApplicationDescription getApplicationDescriptor(String serviceName, String hostname, String applicationName)throws DescriptorDoesNotExistsException, MalformedDescriptorException, RegistryException;
- public ApplicationDescription getApplicationDescriptors(String serviceName, String hostname)throws MalformedDescriptorException, RegistryException;
- public Map<String,ApplicationDescription> getApplicationDescriptors(String serviceName)throws MalformedDescriptorException, RegistryException;
+ public boolean isApplicationDescriptorExists(String serviceName, String hostName, String descriptorName)throws RegException;
+ public void addApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDescription descriptor)throws DescriptorAlreadyExistsException, RegException;
+ public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor)throws DescriptorAlreadyExistsException, RegException;
+ public void udpateApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDescription descriptor)throws DescriptorDoesNotExistsException, RegException;
+ public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor)throws DescriptorDoesNotExistsException, RegException;
+ public ApplicationDescription getApplicationDescriptor(String serviceName, String hostname, String applicationName)throws DescriptorDoesNotExistsException, MalformedDescriptorException, RegException;
+ public ApplicationDescription getApplicationDescriptors(String serviceName, String hostname)throws MalformedDescriptorException, RegException;
+ public Map<String,ApplicationDescription> getApplicationDescriptors(String serviceName)throws MalformedDescriptorException, RegException;
//public Map<String,ApplicationDescription> getApplicationDescriptorsFromHostName(String hostName)throws MalformedDescriptorException, RegistryException;
- public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException, RegistryException;
- public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName)throws DescriptorDoesNotExistsException, RegistryException;
- public ResourceMetadata getApplicationDescriptorMetadata(String serviceName, String hostName, String applicationName)throws DescriptorDoesNotExistsException, RegistryException;
+ public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException, RegException;
+ public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName)throws DescriptorDoesNotExistsException, RegException;
+ public ResourceMetadata getApplicationDescriptorMetadata(String serviceName, String hostName, String applicationName)throws DescriptorDoesNotExistsException, RegException;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
index 70cbdda..2d65a22 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
@@ -21,7 +21,7 @@
package org.apache.airavata.registry.api;
import org.apache.airavata.common.utils.AiravataJobState;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
import java.util.List;
import java.util.Map;
@@ -32,9 +32,9 @@ public interface OrchestratorRegistry extends AiravataSubRegistry {
/**
* this return information about GFAC instances running in the system.
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- Map<String, Integer> getGFACNodeList() throws RegistryException;
+ Map<String, Integer> getGFACNodeList() throws RegException;
/**
* This is the method to use to add a GFAC Node to registry,
@@ -42,9 +42,9 @@ public interface OrchestratorRegistry extends AiravataSubRegistry {
* @param uri
* @param nodeID
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- boolean addGFACNode(String uri, int nodeID)throws RegistryException;
+ boolean addGFACNode(String uri, int nodeID)throws RegException;
/**
@@ -53,27 +53,27 @@ public interface OrchestratorRegistry extends AiravataSubRegistry {
* @param state
* @param gfacEPR
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- boolean changeStatus(String experimentID,AiravataJobState.State state, String gfacEPR)throws RegistryException;
+ boolean changeStatus(String experimentID,AiravataJobState.State state, String gfacEPR)throws RegException;
/**
* This can be used to change the status to any valid status
* @param experimentID
* @param state
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- boolean changeStatus(String experimentID,AiravataJobState.State state)throws RegistryException;
+ boolean changeStatus(String experimentID,AiravataJobState.State state)throws RegException;
/**
* This method can be used to seek the status of a given experiment
* @param experimentID
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- AiravataJobState getState(String experimentID)throws RegistryException;
+ AiravataJobState getState(String experimentID)throws RegException;
/**
* This returns all the jobs with the given state
@@ -87,34 +87,34 @@ public interface OrchestratorRegistry extends AiravataSubRegistry {
* This will return list of experimentID of jobs which are in
* ACCEPTED state
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- List<String> getAllAcceptedJobs()throws RegistryException;
+ List<String> getAllAcceptedJobs()throws RegException;
/**
* This will return all the hanged jobs, the logic to determine
* whether job is hanged or not is depend on the implementation
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- List<String> getAllHangedJobs()throws RegistryException;
+ List<String> getAllHangedJobs()throws RegException;
/**
* return the number of jobs hanged, it not normal that jobs are hanged
* all the time, so users can use this method before try to retrieve
* list of hanged jobs
* @return number of hanged jobs
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- int getHangedJobCount()throws RegistryException;
+ int getHangedJobCount()throws RegException;
/**
* reset hanged jobs based on previous state
* @param experimentID
* @return true if operation is successful
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.api.exception.RegException
*/
- boolean resetHangedJob(String experimentID)throws RegistryException;
+ boolean resetHangedJob(String experimentID)throws RegException;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf5f8c3c/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
index 2df4e58..ffe905e 100644
--- a/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
+++ b/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
@@ -24,7 +24,7 @@ package org.apache.airavata.registry.api;
import java.util.Date;
import java.util.List;
-import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.RegException;
import org.apache.airavata.registry.api.exception.worker.ExperimentDoesNotExistsException;
import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectAlreadyExistsException;
import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNotExistsException;
@@ -32,19 +32,19 @@ import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNot
public interface ProjectsRegistry extends AiravataSubRegistry {
//------------Project management
- public boolean isWorkspaceProjectExists(String projectName) throws RegistryException;
- public boolean isWorkspaceProjectExists(String projectName, boolean createIfNotExists) throws RegistryException;
- public void addWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectAlreadyExistsException, RegistryException;
- public void updateWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectDoesNotExistsException, RegistryException;
- public void deleteWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegistryException;
- public WorkspaceProject getWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegistryException;
- public List<WorkspaceProject> getWorkspaceProjects() throws RegistryException;
+ public boolean isWorkspaceProjectExists(String projectName) throws RegException;
+ public boolean isWorkspaceProjectExists(String projectName, boolean createIfNotExists) throws RegException;
+ public void addWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectAlreadyExistsException, RegException;
+ public void updateWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectDoesNotExistsException, RegException;
+ public void deleteWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegException;
+ public WorkspaceProject getWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegException;
+ public List<WorkspaceProject> getWorkspaceProjects() throws RegException;
//------------Experiment management
- public void addExperiment(String projectName, AiravataExperiment experiment) throws WorkspaceProjectDoesNotExistsException, ExperimentDoesNotExistsException, RegistryException;
+ public void addExperiment(String projectName, AiravataExperiment experiment) throws WorkspaceProjectDoesNotExistsException, ExperimentDoesNotExistsException, RegException;
public void removeExperiment(String experimentId) throws ExperimentDoesNotExistsException;
- public List<AiravataExperiment> getExperiments() throws RegistryException;
- public List<AiravataExperiment> getExperiments(String projectName)throws RegistryException;
- public List<AiravataExperiment> getExperiments(Date from, Date to)throws RegistryException;
- public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to) throws RegistryException;
+ public List<AiravataExperiment> getExperiments() throws RegException;
+ public List<AiravataExperiment> getExperiments(String projectName)throws RegException;
+ public List<AiravataExperiment> getExperiments(Date from, Date to)throws RegException;
+ public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to) throws RegException;
}