You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:30:13 UTC
[11/90] [abbrv] [partial] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
deleted file mode 100644
index acaa398..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import org.apache.airavata.schemas.gfac.Parameter;
-
-
-public class NodeParameter {
- private Parameter parameter;
- private Object value;
-
- public NodeParameter(Parameter parameter) {
- this(parameter,null);
- }
-
- public NodeParameter(Parameter parameter, Object value) {
- setParameter(parameter);
- setValue(value);
- }
- public Parameter getParameter() {
- return parameter;
- }
- public void setParameter(Parameter parameter) {
- this.parameter = parameter;
- }
- public Object getValue() {
- return value;
- }
- public void setValue(Object value) {
- this.value = value;
- }
-
- public String getName(){
- return getParameter().getParameterName();
- }
-
- public String getDescription(){
- return getParameter().getParameterDescription();
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
deleted file mode 100644
index f3067e5..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import org.apache.airavata.schemas.gfac.Parameter;
-
-public class OutputParameters extends ServiceParameters {
-
- public OutputParameters(NodeParameter[] parameters) {
- super(parameters);
- }
-
- public OutputParameters(Parameter[] parameters) {
- super(parameters);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceDescriptions.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceDescriptions.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceDescriptions.java
deleted file mode 100644
index dcef41f..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceDescriptions.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.List;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.commons.gfac.type.ServiceDescription;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-
-public class ServiceDescriptions {
- private AiravataAPI airavataAPI;
-
- public ServiceDescriptions(AiravataAPI airavataAPI) {
- setAiravataAPI(airavataAPI);
- }
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public void setAiravataAPI(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-
- public List<ServiceDescription> getDescriptions() throws RegistryException, AiravataAPIInvocationException {
- return getAiravataAPI().getApplicationManager().getAllServiceDescriptions();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
deleted file mode 100644
index a3ea981..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.airavata.schemas.gfac.Parameter;
-
-public class ServiceParameters {
- private List<NodeParameter> parameters;
-
- public ServiceParameters(Parameter[] parameters) {
- if (parameters!=null) {
- List<NodeParameter> serviceParaList = new ArrayList<NodeParameter>();
- for (Parameter parameter : parameters) {
- serviceParaList.add(new NodeParameter(parameter));
- }
- setParameters(serviceParaList);
- }
- }
-
- public ServiceParameters(NodeParameter[] parameters) {
- if (parameters!=null) {
- setParameters(Arrays.asList(parameters));
- }
- }
- public List<NodeParameter> getParameters() {
- if (parameters==null){
- parameters=new ArrayList<NodeParameter>();
- }
- return parameters;
- }
- public void setParameters(List<NodeParameter> parameters) {
- this.parameters = parameters;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
deleted file mode 100644
index 4b619b3..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.exception.worker.ExperimentLazyLoadedException;
-import org.apache.airavata.registry.api.workflow.NodeExecutionData;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.registry.api.workflow.WorkflowExecutionData;
-
-public class XBayaWorkflow {
- private List<XBayaWorkflowNodeElement> workflowServices;
- private WorkflowExecution workflowInstance;
- private AiravataAPI airavataAPI;
-
- public XBayaWorkflow(WorkflowExecution workflowInstance, AiravataAPI airavataAPI) {
- setWorkflowInstance(workflowInstance);
- setAiravataAPI(airavataAPI);
- }
-
- public List<XBayaWorkflowNodeElement> getWorkflowServices() {
- if (workflowServices==null){
- workflowServices=new ArrayList<XBayaWorkflowNodeElement>();
- try {
- WorkflowExecutionData workflowInstanceData = getAiravataAPI().getProvenanceManager().getWorkflowInstanceData(getWorkflowId(), getWorkflowId());
- List<NodeExecutionData> nodeDataList = workflowInstanceData.getNodeDataList();
- for (NodeExecutionData nodeData : nodeDataList) {
- workflowServices.add(new XBayaWorkflowNodeElement(nodeData.getWorkflowInstanceNode().getNodeId(), nodeData));
- }
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- } catch (ExperimentLazyLoadedException e) {
- e.printStackTrace();
- }
- }
- return workflowServices;
- }
-
- public void setWorkflowNodes(List<XBayaWorkflowNodeElement> workflowServices) {
- this.workflowServices = workflowServices;
- }
-
- public void add(XBayaWorkflowNodeElement workflowService){
- getWorkflowServices().add(workflowService);
- }
-
- public String getWorkflowName() {
- return getWorkflowInstance().getTemplateName();
- }
-
- public String getWorkflowId() {
- return getWorkflowInstance().getWorkflowExecutionId();
- }
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public void setAiravataAPI(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-
- public WorkflowExecution getWorkflowInstance() {
- return workflowInstance;
- }
-
- public void setWorkflowInstance(WorkflowExecution workflowInstance) {
- this.workflowInstance = workflowInstance;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
deleted file mode 100644
index 04f6fae..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-
-public class XBayaWorkflowExperiment {
- private List<XBayaWorkflow> workflows;
- private String experimentId;
- private AiravataAPI airavataAPI;
-
- public XBayaWorkflowExperiment(String experimentId, AiravataAPI airavataAPI) {
- setExperimentId(experimentId);
- setAiravataAPI(airavataAPI);
- }
-
- public List<XBayaWorkflow> getWorkflows() {
- if (workflows==null){
- workflows=new ArrayList<XBayaWorkflow>();
- try {
- List<WorkflowExecution> experimentWorkflowInstances = getAiravataAPI().getProvenanceManager().getExperimentWorkflowInstances(getExperimentId());
- for (WorkflowExecution workflowInstance : experimentWorkflowInstances) {
- workflows.add(new XBayaWorkflow(workflowInstance, getAiravataAPI()));
- }
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- }
- }
- return workflows;
- }
-
- public void setWorkflows(List<XBayaWorkflow> workflows) {
- this.workflows = workflows;
- }
-
- public void add(XBayaWorkflow workflow){
- getWorkflows().add(workflow);
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public void setAiravataAPI(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
deleted file mode 100644
index 555aaf2..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-
-public class XBayaWorkflowExperiments {
- private AiravataAPI airavataAPI;
-
- public XBayaWorkflowExperiments(AiravataAPI airavataAPI) {
- setAiravataAPI(airavataAPI);
- }
-
- public List<XBayaWorkflowExperiment> getAllExperiments(){
- Map<String, XBayaWorkflowExperiment> experiments=new HashMap<String,XBayaWorkflowExperiment>();
- try {
- initializeExperimentMap(experiments);
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- }
- return Arrays.asList(experiments.values().toArray(new XBayaWorkflowExperiment[]{}));
- }
-
- public void initializeExperimentMap(Map<String, XBayaWorkflowExperiment> experiments) throws AiravataAPIInvocationException {
- List<String> experimentIdByUser = getAiravataAPI().getProvenanceManager().getExperimentIdList();
- for (String id : experimentIdByUser) {
- experiments.put(id, new XBayaWorkflowExperiment(id, getAiravataAPI()));
- }
- }
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public void setAiravataAPI(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
deleted file mode 100644
index a3072e0..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.airavata.registry.api.workflow.NodeExecutionData;
-import org.apache.airavata.registry.api.workflow.InputData;
-import org.apache.airavata.registry.api.workflow.OutputData;
-import org.apache.airavata.registry.api.workflow.WorkflowInstanceNodePortData;
-import org.apache.airavata.schemas.gfac.Parameter;
-
-public class XBayaWorkflowNodeElement {
- private InputParameters inputParameters;
- private OutputParameters outputParameters;
- private NodeExecutionData nodeData;
- private String nodeId;
-
- public XBayaWorkflowNodeElement(String nodeId, NodeExecutionData nodeData) {
- setNodeId(nodeId);
- setNodeData(nodeData);
- }
-
- public OutputParameters getOutputParameters() {
- if (outputParameters==null){
- outputParameters=new OutputParameters((NodeParameter[])null);
- outputParameters.getParameters().addAll(generateParameterListForOutput(nodeData.getOutputData()));
- }
- return outputParameters;
- }
-
- private List<NodeParameter> generateParameterListForInput(
- List<InputData> list) {
- List<NodeParameter> params=new ArrayList<NodeParameter>();
- for (WorkflowInstanceNodePortData portData : list) {
- Parameter parameter = Parameter.Factory.newInstance();
- parameter.setParameterName(portData.getName());
- NodeParameter serviceParameter = new NodeParameter(parameter, portData.getValue());
- params.add(serviceParameter);
- }
- return params;
- }
-
- private List<NodeParameter> generateParameterListForOutput(
- List<OutputData> list) {
- List<NodeParameter> params=new ArrayList<NodeParameter>();
- for (WorkflowInstanceNodePortData portData : list) {
- Parameter parameter = Parameter.Factory.newInstance();
- parameter.setParameterName(portData.getName());
- NodeParameter serviceParameter = new NodeParameter(parameter, portData.getValue());
- params.add(serviceParameter);
- }
- return params;
- }
-
- public void setOutputParameters(OutputParameters outputParameters) {
- this.outputParameters = outputParameters;
- }
-
- public InputParameters getInputParameters() {
- if (inputParameters==null){
- inputParameters=new InputParameters((NodeParameter[])null);
- inputParameters.getParameters().addAll(generateParameterListForInput(nodeData.getInputData()));
- }
- return inputParameters;
- }
-
- public void setInputParameters(InputParameters inputParameters) {
- this.inputParameters = inputParameters;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public NodeExecutionData getNodeData() {
- return nodeData;
- }
-
- public void setNodeData(NodeExecutionData nodeData) {
- this.nodeData = nodeData;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplate.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplate.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplate.java
deleted file mode 100644
index 63af7ac..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplate.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-
-public class XBayaWorkflowTemplate {
- private String workflowGraph;
- private String workflowName;
-
- public XBayaWorkflowTemplate(String workflowName, String workflowGraph) {
- setWorkflowGraph(workflowGraph);
- setWorkflowName(workflowName);
- }
-
- public String getWorkflowGraph() {
- return workflowGraph;
- }
-
- public void setWorkflowGraph(String workflowGraph) {
- this.workflowGraph = workflowGraph;
- }
-
- public String getWorkflowName() {
- return workflowName;
- }
-
- public void setWorkflowName(String workflowName) {
- this.workflowName = workflowName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplates.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplates.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplates.java
deleted file mode 100644
index 318c3ac..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowTemplates.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.model.registrybrowser;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.workflow.model.wf.Workflow;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-
-public class XBayaWorkflowTemplates {
- private AiravataAPI airavataAPI;
-
- public XBayaWorkflowTemplates(AiravataAPI airavataAPI) {
- setAiravataAPI(airavataAPI);
- }
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public void setAiravataAPI(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-
- public List<XBayaWorkflowTemplate> getWorkflows() {
- List<XBayaWorkflowTemplate> workflows = new ArrayList<XBayaWorkflowTemplate>();
- try {
- List<Workflow> list = getAiravataAPI().getWorkflowManager().getWorkflows();
-
- for (Workflow workflow : list){
- String workflowAsString = getAiravataAPI().getWorkflowManager().getWorkflowAsString(workflow.getName());
- workflows.add(new XBayaWorkflowTemplate(workflow.getName(), workflowAsString));
- }
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- }
- return workflows;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/modifier/WorkflowModifier.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/modifier/WorkflowModifier.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/modifier/WorkflowModifier.java
deleted file mode 100644
index 5a0746c..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/modifier/WorkflowModifier.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.modifier;
-
-import java.awt.Color;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.airavata.common.exception.UtilsException;
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.workflow.model.component.system.InputComponent;
-import org.apache.airavata.workflow.model.component.ws.WSComponent;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.Port;
-import org.apache.airavata.workflow.model.graph.impl.PortImpl;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.graph.ws.WSGraph;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.graph.ws.WSPort;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.ws.monitor.EventData;
-import org.apache.airavata.ws.monitor.EventDataRepository;
-import org.apache.airavata.ws.monitor.MonitorException;
-import org.apache.airavata.ws.monitor.MonitorUtil;
-import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-import xsul.XmlConstants;
-import xsul5.wsdl.WsdlPortTypeOperation;
-
-public class WorkflowModifier {
-
- private static final Logger logger = LoggerFactory.getLogger(WorkflowModifier.class);
-
- private Workflow modifiedWorkflow;
-
- private EventDataRepository eventData;
-
- /**
- * Constructs a WorkflowModifier.
- *
- * @param modifiedWorkflow
- * @param eventData
- */
- public WorkflowModifier(Workflow modifiedWorkflow, EventDataRepository eventData) {
- this.modifiedWorkflow = modifiedWorkflow;
- this.eventData = eventData;
- }
-
- /**
- * @return The workflow that needs to be executed.
- * @throws GraphException
- * @throws MonitorException
- */
- public Workflow createDifference() throws GraphException, MonitorException {
- WSGraph originalGraph = this.modifiedWorkflow.getGraph();
- Workflow workflow = this.modifiedWorkflow.clone();
- String name = workflow.getName();
- name += " (diff)";
- workflow.setName(name);
- WSGraph graph = workflow.getGraph();
-
- // Remove the finished node.
- removeFinishedNodes(originalGraph, graph);
-
- Set<WSPort> originalFromPorts = getFinalOutputPorts(originalGraph, graph);
-
- // Create input nodes for unconnected input ports.
- createInputNodes(graph, originalFromPorts);
-
- // Set default values.
- for (WSPort originalFromPort : originalFromPorts) {
- // TODO handle the case that node is not WSNode.
- Node originalFromNode = originalFromPort.getNode();
- String fromNodeID = originalFromNode.getID();
- String output;
- if (originalFromNode instanceof InputNode) {
- // notification that includes the input of the workflow.
- output = getWorkflowInput(fromNodeID);
- } else if (originalFromNode instanceof WSNode) {
- // Retrieve input value from notification.
- WSComponent component = ((WSNode) originalFromNode).getComponent();
- String messageName = component.getOutputTypeName();
- String parameterName = originalFromPort.getComponentPort().getName();
- output = getOutput(fromNodeID, messageName, parameterName);
- } else {
- // This should not happen.
- throw new WorkflowRuntimeException(originalFromNode.getClass().getName());
- }
- Port originalToPort = originalFromPort.getToPorts().get(0);
- PortImpl toPort = graph.getPort(originalToPort.getID());
- InputNode inputNode = (InputNode) toPort.getFromNode();
- inputNode.setDefaultValue(output);
- }
-
- return workflow;
- }
-
- /**
- * @param originalGraph
- * @param graph
- * @throws GraphException
- */
- private void removeFinishedNodes(WSGraph originalGraph, WSGraph graph) throws GraphException {
- ArrayList<Node> finishedNodes = new ArrayList<Node>();
- for (Node node : originalGraph.getNodes()) {
- Color color = NodeController.getGUI(node).getBodyColor();
- if (NodeState.FINISHED.color.equals(color)) {
- finishedNodes.add(node);
- }
- }
- for (Node finishedNode : finishedNodes) {
- Node node = graph.getNode(finishedNode.getID());
- graph.removeNode(node);
- }
- }
-
- /**
- * @param originalGraph
- * @param graph
- * @return The final output ports.
- */
- private Set<WSPort> getFinalOutputPorts(WSGraph originalGraph, WSGraph graph) {
- Collection<Port> inputPorts = GraphUtil.getPorts(graph, Port.Kind.DATA_IN);
- Set<WSPort> originalFromPorts = new HashSet<WSPort>();
- for (Port inputPort : inputPorts) {
- Port fromPort = inputPort.getFromPort();
- if (fromPort == null) {
- // This input port is not connected.
- String inputPortID = inputPort.getID();
- logger.debug("id: " + inputPortID);
- Port originalInputPort = originalGraph.getPort(inputPortID);
- // No duplicate in set.
- Port originalFromPort = originalInputPort.getFromPort();
- originalFromPorts.add((WSPort) originalFromPort);
- }
- }
- return originalFromPorts;
- }
-
- /**
- * @param graph
- * @param originalFromPorts
- * @throws GraphException
- */
- private void createInputNodes(WSGraph graph, Set<WSPort> originalFromPorts) throws GraphException {
- InputComponent inputComponent = new InputComponent();
- for (WSPort originalFromPort : originalFromPorts) {
- InputNode inputNode = inputComponent.createNode(graph);
- List<Port> originalToPorts = originalFromPort.getToPorts();
- boolean first = true;
- for (Port originalToPort : originalToPorts) {
- String toPortID = originalToPort.getID();
- Port toPort = graph.getPort(toPortID);
- graph.addEdge(inputNode.getPort(), toPort);
- if (first) {
- first = false;
- Point position = NodeController.getGUI(originalToPort).getPosition();
- Point inputNodePosition = new Point(0, position.y);
- inputNode.setPosition(inputNodePosition);
- }
- }
- }
- }
-
- private String getWorkflowInput(String nodeID) throws MonitorException {
- logger.debug("Node:" + nodeID);
- List<EventData> events = this.eventData.getEvents();
- for (EventData event : events) {
- EventType type = event.getType();
- // TODO change this to read from the notification from GPEL.
- if (type != EventType.INVOKING_SERVICE) {
- continue;
- }
- String id = event.getNodeID();
- if (!"".equals(id)) {
- continue;
- }
- // TODO null check
- XmlElement eventElement = event.getEvent();
- XmlElement result = eventElement.element(MonitorUtil.REQUEST);
- XmlElement body = result.element(MonitorUtil.BODY);
- XmlElement soapBody = body.element(XmlConstants.S_BODY);
- WsdlPortTypeOperation wsdlPortTypeOperation;
- try {
- wsdlPortTypeOperation = WSDLUtil.getFirstOperation(this.modifiedWorkflow.getWorkflowWSDL());
- } catch (UtilsException e) {
- throw new MonitorException(e);
- }
- XmlElement part = soapBody.element(wsdlPortTypeOperation.getName());
- XmlElement parameter = part.element(nodeID);
- // TODO support complex type.
- String value = parameter.requiredText();
- return value;
- }
- // TODO
- String message = "Couldn't find a notification of about the input with nodeID, " + nodeID;
- throw new MonitorException(message);
- }
-
- private String getOutput(String nodeID, String messageName, String parameterName) throws MonitorException {
- List<EventData> events = this.eventData.getEvents();
- for (EventData event : events) {
- // We need to find the notification that contains the output of the
- // service invocation.
- EventType type = event.getType();
- if (!(type == EventType.SENDING_RESULT || type == EventType.RECEIVED_RESULT)) {
- continue;
- }
- String id = event.getNodeID();
- if (!nodeID.equals(id)) {
- continue;
- }
- // TODO null check
- XmlElement eventElement = event.getEvent();
- XmlElement result = eventElement.element(MonitorUtil.RESULT);
- XmlElement body = result.element(MonitorUtil.BODY);
- XmlElement soapBody = body.element(XmlConstants.S_BODY);
- XmlElement part = soapBody.element(messageName);
- XmlElement parameter = part.element(parameterName);
- // TODO support complex type.
- String value = parameter.requiredText();
- return value;
- }
- // TODO
- String message = "Couldn't find a notification of the output from the service with nodeID, " + nodeID;
- throw new MonitorException(message);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
deleted file mode 100644
index cf6ce0c..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.provenance;
-
-import java.util.List;
-
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.registry.api.workflow.ExperimentData;
-import org.apache.airavata.registry.api.workflow.NodeExecutionData;
-import org.apache.airavata.workflow.model.graph.Node;
-
-public class ProvenanceReader {
-
- public String DEFAULT_LIBRARY_FOLDER_NAME = "provenance";
-
- private String experimentId;
-
- private AiravataAPI airavataAPI;
-
- private Node node;
-
- public ProvenanceReader(Node node,String experimentId,AiravataAPI airavataAPI) {
- this.experimentId = experimentId;
- this.airavataAPI = airavataAPI;
- this.node = node;
- }
-
- public Object read() throws Exception {
- try {
- ExperimentData workflowExecution = airavataAPI.getProvenanceManager().getExperimentData(experimentId);
- List<NodeExecutionData> nodeDataList = workflowExecution.getWorkflowExecutionDataList().get(0).getNodeDataList();
- if (nodeDataList.size() == 0) {
- return null;
- }
- for (NodeExecutionData data : nodeDataList) {
- if (this.node.getID().equals(data.getWorkflowInstanceNode().getNodeId())) {
- return data.getOutputData().get(0).getValue();
- }
- }
- return null;
- } catch (Exception e) {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
deleted file mode 100644
index 25401dc..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.provenance;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.common.utils.XMLUtil;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.registry.api.workflow.WorkflowInstanceNode;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.graph.DataPort;
-import org.apache.airavata.workflow.model.graph.ForEachExecutableNode;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
-import org.apache.airavata.workflow.model.graph.system.ForEachNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.xbaya.concurrent.PredicatedExecutable;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.util.XBayaUtil;
-import org.xmlpull.infoset.XmlElement;
-
-import xsul5.XmlConstants;
-
-/**
- * @author Chathura Herath
- */
-public final class ProvenanceWrite implements PredicatedExecutable {
-
- private static final String PROVENANCE_DIR = "provenance";
-
- private Node node;
-
- private String workflowName;
-
- private Map<Node, Invoker> invokerMap;
-
- private String experimentId;
-
- private AiravataAPI airavataAPI;
-
- public ProvenanceWrite(Node node, String workflowName,
- Map<Node, Invoker> invokerMap, String experimentId,AiravataAPI airavataAPI) {
- this.node = node;
- this.workflowName = workflowName;
- this.invokerMap = invokerMap;
- this.experimentId = experimentId;
- this.airavataAPI = airavataAPI;
- }
-
- public void run() {
-
- try {
- saveNodeOutputs(node, invokerMap, workflowName);
- } catch (WorkflowException e) {
- // do nothing its a failure but go on
- e.printStackTrace();
- }
-
- }
-
- public boolean isReady() {
- return NodeController.isFinished(this.node) && invokerMap.get(node) != null;
- }
-
- private void saveNodeOutputs(Node node,
- Map<Node, Invoker> invokerMap, String workflowName)
- throws WorkflowException {
-
- if (null != node && !(node instanceof InputNode)) {
- XmlElement elem = XmlConstants.BUILDER.newFragment("previousdat");
- XmlElement inputs = null;
- if (node instanceof WSNode) {
- String nodeID = node.getComponent().getName();
- XmlElement nodeElement = elem.newElement("wsnode");
- elem.addChild(nodeElement);
- nodeElement.addChild(nodeID);
- inputs = elem.newElement("inputs");
- elem.addChild(inputs);
-
- List<DataPort> portsToBeSaved = node.getInputPorts();
- for (DataPort savePort : portsToBeSaved) {
-
- String portID = savePort.getName();
- XmlElement portElem = inputs.newElement(portID);
- inputs.addChild(portElem);
- Object portInput = XBayaUtil.findInputFromPort(
- savePort, invokerMap);
- if (portInput instanceof org.xmlpull.v1.builder.XmlElement) {
- portInput = XMLUtil
- .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) portInput);
- }
- portElem.addChild(portInput);
-
- }
-
- } else if (node instanceof EndForEachNode) {
- // here we save the inputs for the entire foreach block
- Node middleNode = node.getInputPort(0).getFromNode();
- String nodeID = middleNode.getComponent().getName();
- XmlElement nodeElement = elem.newElement("foreach");
- elem.addChild(nodeElement);
- nodeElement.addChild(nodeID);
- inputs = elem.newElement("inputs");
- elem.addChild(inputs);
- XmlConstants.BUILDER.serializeToString(elem);
- if (middleNode instanceof ForEachExecutableNode) {
- List<DataPort> portsToBeSaved = middleNode.getInputPorts();
- for (DataPort savePort : portsToBeSaved) {
- // we will save all the inputs
- // these are static inputs and
- // input to the foreach node
-
- if (savePort.getFromNode() instanceof ForEachNode) {
- // this is the foreach node rest are simple
- // inputs
- Object value = XBayaUtil
- .getInputsForForEachNode(
- (ForEachNode) savePort
- .getFromNode(),
- new LinkedList<String>(),
- invokerMap);
- if (value instanceof org.xmlpull.v1.builder.XmlElement) {
- value = XMLUtil
- .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) value);
- }
-
- XmlElement portElement = inputs.newElement(savePort
- .getName());
- inputs.addChild(portElement);
- portElement.addChild(value);
- } else {
- String portID = savePort.getName();
- XmlElement portElem = inputs.newElement(portID);
- inputs.addChild(portElem);
- Object portInput = XBayaUtil
- .findInputFromPort(savePort, invokerMap);
- if (portInput instanceof org.xmlpull.v1.builder.XmlElement) {
- portInput = XMLUtil
- .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) portInput);
- }
-
- portElem.addChild(portInput);
- }
-
- }
-
- } else {
- // error but we will let it pass because it will be
- // caught at higher level
- }
-
- }
- if (inputs!=null) {
- try {
- this.airavataAPI.getProvenanceManager().setWorkflowInstanceNodeInput(new WorkflowInstanceNode(new WorkflowExecution(experimentId, experimentId), node.getID()), xsul5.XmlConstants.BUILDER.serializeToString(inputs));
- } catch (AiravataAPIInvocationException e) {
- throw new WorkflowException(e);
- }
- // deal with the outputs
- }
- XmlElement outputs = elem.newElement("outputs");
- elem.addChild(outputs);
-
- List<DataPort> outputPorts = node.getOutputPorts();
- for (DataPort outputPort : outputPorts) {
- String outputName = outputPort.getName();
-
- XmlElement outputParamElement = outputs.newElement(outputName);
- outputs.addChild(outputParamElement);
- Object ouputParamValue = invokerMap.get(node).getOutput(
- outputName);
-
- if (ouputParamValue instanceof org.xmlpull.v1.builder.XmlElement) {
- ouputParamValue = XMLUtil
- .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) ouputParamValue);
- }
-
- if (ouputParamValue != null) {
- outputParamElement.addChild(ouputParamValue);
- } else {
- outputParamElement.addChild("null");
- }
- }
- try {
- this.airavataAPI.getProvenanceManager().setWorkflowInstanceNodeOutput(new WorkflowInstanceNode(new WorkflowExecution(experimentId,experimentId),node.getID()),xsul5.XmlConstants.BUILDER.serializeToString(outputs));
- } catch (AiravataAPIInvocationException e) {
- throw new WorkflowException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
deleted file mode 100644
index de2d836..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.provenance;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.registry.api.workflow.WorkflowInstanceNode;
-import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
-import org.apache.airavata.registry.api.workflow.WorkflowNodeType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WorkflowNodeStatusUpdater {
- private static Logger logger = LoggerFactory.getLogger(WorkflowNodeStatusUpdater.class);
-
- private AiravataAPI airavataAPI;
-
- public WorkflowNodeStatusUpdater(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-
- public boolean workflowNodeStarted(String workflowInstanceID,String nodeID,String inputs,String workflowID){
- try {
- //todo we currently save only service nodes
- WorkflowNodeType workflowNodeType = new WorkflowNodeType();
- workflowNodeType.setNodeType(WorkflowNodeType.WorkflowNode.SERVICENODE);
- WorkflowInstanceNode node = new WorkflowInstanceNode(new WorkflowExecution(workflowInstanceID,workflowInstanceID), nodeID);
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeInput(node, inputs);
- airavataAPI.getProvenanceManager().setWorkflowNodeType(node, workflowNodeType);
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.STARTED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeFailed(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.FAILED);
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(workflowInstanceID, workflowInstanceID, WorkflowExecutionStatus.State.FAILED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeFinished(String workflowInstanceID,String nodeID,String inputs,String workflowID){
- try {
- WorkflowNodeType workflowNodeType = new WorkflowNodeType();
- workflowNodeType.setNodeType(WorkflowNodeType.WorkflowNode.SERVICENODE);
- WorkflowInstanceNode node = new WorkflowInstanceNode(new WorkflowExecution(workflowInstanceID,workflowInstanceID), nodeID);
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeOutput(node, inputs);
- airavataAPI.getProvenanceManager().setWorkflowNodeType(node,workflowNodeType);
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.FINISHED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeRunning(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.RUNNING);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodePaused(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.PAUSED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeStatusPending(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.PENDING);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeStatusActive(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.ACTIVE);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowNodeStatusDone(String workflowInstanceID,String nodeID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceNodeStatus(workflowInstanceID, workflowInstanceID, nodeID, WorkflowExecutionStatus.State.DONE);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
deleted file mode 100644
index cc444b0..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.provenance;
-
-import java.sql.Timestamp;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WorkflowStatusUpdater {
- private static Logger logger = LoggerFactory.getLogger(WorkflowStatusUpdater.class);
-
- private AiravataAPI airavataAPI;
-
- public WorkflowStatusUpdater(AiravataAPI airavataAPI) {
- this.airavataAPI = airavataAPI;
- }
-
- public boolean workflowStarted(String experimentID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(experimentID, experimentID, WorkflowExecutionStatus.State.STARTED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowFailed(String experimentID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(experimentID, experimentID, WorkflowExecutionStatus.State.FAILED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowFinished(String experimentID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(experimentID, experimentID, WorkflowExecutionStatus.State.FINISHED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowRunning(String experimentID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(experimentID, experimentID, WorkflowExecutionStatus.State.RUNNING);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean workflowPaused(String experimentID){
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(experimentID, experimentID, WorkflowExecutionStatus.State.PAUSED);
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error updating Wokflow Node status !!");
- return false;
- }
- return true;
- }
-
- public boolean saveWorkflowData(String experimentID,String workflowInstanceID,String workflowTemplateID) {
- Timestamp currentTime = new Timestamp((new java.util.Date()).getTime());
- try {
- airavataAPI.getProvenanceManager().setWorkflowInstanceTemplateName(workflowInstanceID, workflowTemplateID);
- airavataAPI.getProvenanceManager().setWorkflowInstanceStatus(new WorkflowExecutionStatus(new WorkflowExecution(experimentID, workflowInstanceID), WorkflowExecutionStatus.State.STARTED,currentTime));
- } catch (AiravataAPIInvocationException e) {
- logger.error("Error saving Workflow Data !!");
- }
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/PasswordCallbackImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/PasswordCallbackImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/PasswordCallbackImpl.java
deleted file mode 100644
index da83cb2..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/PasswordCallbackImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.registry;
-
-import org.apache.airavata.registry.api.PasswordCallback;
-
-public class PasswordCallbackImpl implements PasswordCallback {
- private String username;
- private String password;
-
- public PasswordCallbackImpl(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- @Override
- public String getPassword(String username) {
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
deleted file mode 100644
index 63c6948..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.registry;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.RepositoryException;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.apache.airavata.xbaya.XBayaConstants;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.jython.script.JythonScript;
-import org.apache.airavata.xbaya.ui.experiment.RegistryWorkflowPublisherWindow;
-import org.apache.airavata.xbaya.util.XBayaUtil;
-import org.ietf.jgss.GSSCredential;
-import org.xmlpull.infoset.XmlElement;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-
-public class RegistryAccesser {
-
- /**
- * PUBLIC_ACTOR
- */
- public static final String PUBLIC_ACTOR = "public";
-
- private XBayaEngine engine;
-
- private GSSCredential gssCredential;
-
- /**
- * Constructs a RegistryAccesser.
- *
- * @param engine
- */
- public RegistryAccesser(XBayaEngine engine) {
- this.engine = engine;
- }
-
- private AiravataAPI connectToRegistry() {
- return this.engine.getConfiguration().getAiravataAPI();
- }
-
- /**
- *
- * @return
- * @throws RepositoryException
- */
- public Map<String, String> getOGCEWorkflowTemplateList() throws AiravataAPIInvocationException {
- AiravataAPI airavataAPI = connectToRegistry();
- List<Workflow> workflows = airavataAPI.getWorkflowManager().getWorkflows();
- Map<String, String> workflowMap = new HashMap<String, String>();
- for(Workflow workflow : workflows){
- workflowMap.put(workflow.getName(), airavataAPI.getWorkflowManager().getWorkflowAsString(workflow.getName()));
- }
- return workflowMap;
- }
-
- /**
- *
- * @param workflowTemplateId
- * @return
- * @throws RepositoryException
- * @throws GraphException
- * @throws ComponentException
- * @throws Exception
- */
- public Workflow getOGCEWorkflow(QName workflowTemplateId) throws RepositoryException, GraphException,
- ComponentException, Exception {
- AiravataAPI registry = connectToRegistry();
- String xml = registry.getWorkflowManager().getWorkflowAsString(workflowTemplateId.getLocalPart());
- XmlElement xwf = XMLUtil.stringToXmlElement(xml);
- Workflow workflow = new Workflow(xwf);
- return workflow;
- }
-
- /**
- * Save workflow in to Registry
- */
- public boolean saveWorkflow() {
- if (XBayaUtil.acquireJCRRegistry(this.engine)) {
- try {
-
- Workflow workflow = this.engine.getGUI().getWorkflow();
- JythonScript script = new JythonScript(workflow, this.engine.getConfiguration());
-
- // Check if there is any errors in the workflow first.
- ArrayList<String> warnings = new ArrayList<String>();
- if (!script.validate(warnings)) {
- StringBuilder buf = new StringBuilder();
- for (String warning : warnings) {
- buf.append("- ");
- buf.append(warning);
- buf.append("\n");
- }
- this.engine.getGUI().getErrorWindow().warning(buf.toString());
- return false;
- }
- RegistryWorkflowPublisherWindow registryPublishingWindow = new RegistryWorkflowPublisherWindow(
- this.engine);
- registryPublishingWindow.show();
-
- String workflowId = workflow.getName();
-
- workflowId = StringUtil.convertToJavaIdentifier(workflowId);
-
- QName workflowQName = new QName(XBayaConstants.OGCE_WORKFLOW_NS, workflowId);
-
- String workflowAsString = XMLUtil.xmlElementToString(workflow.toXML());
- String owner = this.engine.getConfiguration().getRegistryUserName();
-
- AiravataAPI registry = this.connectToRegistry();
- if (registry.getWorkflowManager().isWorkflowExists(workflow.getName())){
- registry.getWorkflowManager().updateWorkflow(workflow.getName(), workflowAsString);
- }else{
- registry.getWorkflowManager().saveWorkflow(workflowAsString);
- }
- if (registryPublishingWindow.isMakePublic()){
-
- registry.getWorkflowManager().publishWorkflow(workflow.getName());
- }
- registryPublishingWindow.hide();
- return true;
- } catch (Exception e) {
- this.engine.getGUI().getErrorWindow().error(e.getMessage(), e);
- }
- }
- return false;
- }
-
- /**
- *
- * @param workflowTemplateId
- * @throws RepositoryException
- */
- public void deleteOGCEWorkflow(QName workflowTemplateId) throws AiravataAPIInvocationException {
- if (XBayaUtil.acquireJCRRegistry(this.engine)) {
- AiravataAPI registry = connectToRegistry();
- registry.getWorkflowManager().removeWorkflow(workflowTemplateId.getLocalPart());
- }
- }
-
- /**
- *
- * @param qname
- * @return
- */
- public Workflow getWorkflow(QName qname) throws AiravataAPIInvocationException {
- AiravataAPI registry = connectToRegistry();
- String xml = registry.getWorkflowManager().getWorkflowAsString(qname.getLocalPart());
- Workflow workflow = null;
- try {
- XmlElement xwf = XMLUtil.stringToXmlElement(xml);
- workflow = new Workflow(xwf);
- } catch (GraphException e) {
- e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
- } catch (ComponentException e) {
- e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
- }
- return workflow;
- }
-
- /**
- *
- * @param name
- * @return
- * @throws RegistryException
- */
- public Workflow getWorkflow(String name) throws AiravataAPIInvocationException {
- return getWorkflow(new QName(XBayaConstants.LEAD_NS, name));
- }
-
- public void main() {
-
- XBayaConfiguration config = new XBayaConfiguration();
- config.setMyProxyServer("myproxy.teragrid.org");
- config.setMyProxyUsername("USER");
- config.setMyProxyPassphrase("PASSWORD");
-
- new XBayaEngine(config);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java
deleted file mode 100644
index 9203e01..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.registrybrowser.nodes;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
-import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
-
-public abstract class AbstractAiravataTreeNode implements TreeNode {
-
- private TreeNode parent;
- private Color backgroundSelectionColor;
- private DefaultTreeCellRenderer defaultCellRenderer = new DefaultTreeCellRenderer();
- private List<TreeNode> children;
-
- public AbstractAiravataTreeNode(TreeNode parent) {
- setParent(parent);
- }
-
- protected XBayaEngine getXBayaEngine(){
- TreeNode root=getRootNode();
- if (root instanceof RegistryNode){
- return ((RegistryNode)root).getEngine();
- }
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Enumeration children() {
- this.children = listOfChildren();
- Collections.enumeration(children);
- return Collections.enumeration(children);
- }
-
- protected abstract List<TreeNode> getChildren();
-
- private List<TreeNode> listOfChildren() {
- children = (children == null) ? getChildren() : children;
- return children;
- }
-
- @Override
- public boolean getAllowsChildren() {
- return listOfChildren().size() > 0;
- }
-
- @Override
- public TreeNode getChildAt(int index) {
- return listOfChildren().get(index);
- }
-
- @Override
- public int getChildCount() {
- return listOfChildren().size();
- }
-
- @Override
- public int getIndex(TreeNode node) {
- return listOfChildren().indexOf(node);
- }
-
- @Override
- public TreeNode getParent() {
- return parent;
- }
-
- @Override
- public boolean isLeaf() {
- return listOfChildren().size() == 0;
- }
-
- public void setParent(TreeNode parent) {
- this.parent = parent;
- }
-
- public abstract String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
-
- public abstract Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
-
- public void setBackgroundSelectionColor(Color c) {
- backgroundSelectionColor = c;
- }
-
- public Color getBackgroundSelectionColor() {
- return backgroundSelectionColor;
- }
-
- public Component getNodeComponent(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
- return null;
- }
-
- public Component getNodeComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf,
- int row, boolean hasFocus) {
- Component nodeComponent = getNodeComponent(selected, expanded, leaf, hasFocus);
- if (nodeComponent == null) {
- nodeComponent = getDefaultCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded,
- leaf, row, hasFocus);
- if (nodeComponent instanceof JLabel) {
- JLabel lbl = (JLabel) nodeComponent;
- lbl.setText(getCaption(selected, expanded, leaf, hasFocus));
- lbl.setIcon(getIcon(selected, expanded, leaf, hasFocus));
- }
- }
- return nodeComponent;
- }
-
- protected DefaultTreeCellRenderer getDefaultCellRenderer() {
- return defaultCellRenderer;
- }
-
- protected List<TreeNode> getTreeNodeList(Object[] list, TreeNode parent) {
- List<TreeNode> nodes = new ArrayList<TreeNode>();
- for (Object o : list) {
- nodes.add(AiravataTreeNodeFactory.getTreeNode(o, parent));
- }
- return nodes;
- }
-
- protected List<TreeNode> emptyList() {
- return new ArrayList<TreeNode>();
- }
-
- public void refresh() {
- this.children = null;
- }
-
- public abstract List<String> getSupportedActions();
-
- public String getDefaultAction() {
- return null;
- }
-
- public boolean isActionSupported(AbstractBrowserActionItem action) {
- return getSupportedActions().contains(action.getID());
- }
-
- public boolean triggerAction(JTree tree, String action) throws Exception {
- return triggerAction(tree, action, false);
- }
-
- public boolean triggerAction(JTree tree, String action, boolean force) throws Exception {
- if (action.equals(RefreshAction.ID)) {
- refresh();
- ((DefaultTreeModel) tree.getModel()).reload(this);
- return true;
- }
- return false;
- }
-
- protected TreeNode getRootNode() {
- TreeNode rootNode = this;
- while (rootNode.getParent() != null) {
- rootNode = rootNode.getParent();
- }
- return rootNode;
- }
-
- public AiravataAPI getRegistry() {
- TreeNode rootNode = getRootNode();
- if (rootNode instanceof RegistryNode) {
- return ((RegistryNode) rootNode).getRegistry();
- }
- return null;
- }
-
- protected boolean askQuestion(String title, String question) {
- return JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
- }
-
- protected void reloadTreeNode(JTree tree, TreeNode node) {
- TreePath selectionPath = tree.getSelectionPath();
- ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
- ((DefaultTreeModel) tree.getModel()).reload(node);
- tree.expandPath(selectionPath);
- }
-
- public abstract String getActionCaption(AbstractBrowserActionItem action);
-
- public abstract Icon getActionIcon(AbstractBrowserActionItem action);
-
- public abstract String getActionDescription(AbstractBrowserActionItem action);
-
- protected String wrapAsHtml(String...data){
- String result="<html>";
- for (String item : data) {
- result+=item;
- }
- result+="</html>";
- return result;
- }
-
- public String createHTMLUrlTaggedString(String value) {
- String urledString = "";
- int lastIndex=0,index=0;
- while(index!=-1){
- index=value.toLowerCase().indexOf("://",lastIndex);
- if (index!=-1){
- int beginIndex=value.lastIndexOf(" ",index);
- urledString+=value.substring(lastIndex,beginIndex+1);
- int endIndex=value.indexOf(" ",index);
- if (beginIndex==-1){
- beginIndex=0;
- }else{
- beginIndex++;
- }
- if (endIndex==-1){
- endIndex=value.length();
- }
- String url=value.substring(beginIndex, endIndex);
- urledString+="<a href='"+url+"'>"+url+"</a>";
- lastIndex=endIndex;
- }
- }
- urledString+=value.substring(lastIndex, value.length());
- return urledString;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataConfigurationsNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataConfigurationsNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataConfigurationsNode.java
deleted file mode 100644
index 6a3bf87..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataConfigurationsNode.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.registrybrowser.nodes;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.swing.tree.TreeNode;
-
-import org.apache.airavata.xbaya.model.registrybrowser.AiravataConfigurations;
-import org.apache.airavata.xbaya.model.registrybrowser.EventingServiceURLs;
-import org.apache.airavata.xbaya.model.registrybrowser.GFacURLs;
-import org.apache.airavata.xbaya.model.registrybrowser.InterpreterServiceURLs;
-import org.apache.airavata.xbaya.model.registrybrowser.MessageBoxURLs;
-import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
-import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
-
-public class AiravataConfigurationsNode extends AbstractAiravataTreeNode {
- private AiravataConfigurations airavataConfigurations;
-
- public AiravataConfigurationsNode(AiravataConfigurations airavataConfigurations, TreeNode parent) {
- super(parent);
- setAiravataConfigurations(airavataConfigurations);
- }
-
- @Override
- protected List<TreeNode> getChildren() {
- List<Object> children=new ArrayList<Object>();
-// children.add(new GFacURLs(getRegistry()));
- children.add(new InterpreterServiceURLs(getRegistry()));
- children.add(new MessageBoxURLs(getRegistry()));
- children.add(new EventingServiceURLs(getRegistry()));
- return getTreeNodeList(children.toArray(), this);
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
- return "Airavata Configuration";
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
- return JCRBrowserIcons.AIRAVATA_CONFIG_ICON;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList(RefreshAction.ID);
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- return action.getDefaultCaption();
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
-
- public AiravataConfigurations getAiravataConfigurations() {
- return airavataConfigurations;
- }
-
- public void setAiravataConfigurations(AiravataConfigurations airavataConfigurations) {
- this.airavataConfigurations = airavataConfigurations;
- }
-}