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/07/23 18:48:24 UTC
[10/20] git commit: fixing workflow serialization and deserialization
issues
fixing workflow serialization and deserialization issues
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c424c37a
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c424c37a
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c424c37a
Branch: refs/heads/master
Commit: c424c37a6928773599e5a6cbcba0d993e6b10d46
Parents: 0095c91
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Sat Jul 12 02:20:24 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Sat Jul 12 02:20:24 2014 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 12 +-
.../client/samples/CreateLaunchExperiment.java | 30 +--
.../model/component/ws/WSComponent.java | 79 +++----
.../component/ws/WSComponentApplication.java | 207 +++++++++++++++++++
.../ws/WSComponentApplicationParameter.java | 81 ++++++++
.../model/component/ws/WSComponentFactory.java | 2 +-
.../workflow/model/graph/ws/WSNode.java | 83 ++++----
.../airavata/workflow/model/wf/Workflow.java | 61 +++---
8 files changed, 408 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 9831431..58d8acf 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -90,6 +90,9 @@ import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetai
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
import org.apache.airavata.workflow.catalog.WorkflowCatalogException;
import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
+import org.apache.airavata.workflow.engine.WorkflowEngine;
+import org.apache.airavata.workflow.engine.WorkflowEngineException;
+import org.apache.airavata.workflow.engine.WorkflowEngineFactory;
import org.apache.thrift.TException;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
@@ -1076,8 +1079,13 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
}
}
- private boolean launchWorkflowExperiment(String experimentId, String airavataCredStoreToken) throws TException {
- return true;
+ private void launchWorkflowExperiment(String experimentId, String airavataCredStoreToken) throws TException {
+ try {
+ WorkflowEngine workflowEngine = WorkflowEngineFactory.getWorkflowEngine();
+ workflowEngine.launchExperiment(experimentId, airavataCredStoreToken);
+ } catch (WorkflowEngineException e) {
+ e.printStackTrace();
+ }
}
private boolean launchSingleAppExperiment(String experimentId, String airavataCredStoreToken, OrchestratorService.Client orchestratorClient) throws TException {
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index fa29da2..e99fa23 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -79,21 +79,21 @@ public class CreateLaunchExperiment {
System.out.println("API version is " + client.getAPIVersion());
addDescriptors();
-// final String expId = createExperimentForSSHHost(airavata);
-// final String expId = createExperimentForTrestles(client);
-// final String expId = createExperimentForStampede(client);
- final String expId = createExperimentForLocalHost(client);
-// final String expId = createExperimentForLonestar(airavata);
-// final String expId = createExperimentWRFTrestles(client);
-// final String expId = createExperimentForBR2(client);
-// final String expId = createExperimentForBR2Amber(client);
-// final String expId = createExperimentWRFStampede(client);
-// final String expId = createExperimentForStampedeAmber(client);
-// final String expId = createExperimentForTrestlesAmber(client);
-
- System.out.println("Experiment ID : " + expId);
-// updateExperiment(airavata, expId);
- launchExperiment(client, expId);
+//// final String expId = createExperimentForSSHHost(airavata);
+//// final String expId = createExperimentForTrestles(client);
+//// final String expId = createExperimentForStampede(client);
+// final String expId = createExperimentForLocalHost(client);
+//// final String expId = createExperimentForLonestar(airavata);
+//// final String expId = createExperimentWRFTrestles(client);
+//// final String expId = createExperimentForBR2(client);
+//// final String expId = createExperimentForBR2Amber(client);
+//// final String expId = createExperimentWRFStampede(client);
+//// final String expId = createExperimentForStampedeAmber(client);
+//// final String expId = createExperimentForTrestlesAmber(client);
+//
+// System.out.println("Experiment ID : " + expId);
+//// updateExperiment(airavata, expId);
+// launchExperiment(client, expId);
// System.out.println("retrieved exp id : " + experiment.getExperimentID());
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
index ccdaaba..ac86b05 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
@@ -26,10 +26,6 @@ import java.util.List;
import javax.xml.namespace.QName;
-import org.apache.airavata.common.utils.WSConstants;
-import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.workflow.model.component.Component;
import org.apache.airavata.workflow.model.component.ComponentControlPort;
import org.apache.airavata.workflow.model.component.ComponentException;
@@ -39,15 +35,12 @@ import org.apache.airavata.workflow.model.graph.ws.WSNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmlpull.infoset.XmlElement;
-import org.xmlpull.infoset.XmlNamespace;
-
-import xsul5.XmlConstants;
public class WSComponent extends Component {
private static final Logger logger = LoggerFactory.getLogger(WSComponent.class);
- private ApplicationInterfaceDescription application;
+ private WSComponentApplication application;
/**
* The list of output component ports.
@@ -63,8 +56,6 @@ public class WSComponent extends Component {
private String operationName;
- private QName portTypeQName;
-
private String inputPartName;
private String outputPartName;
@@ -85,59 +76,35 @@ public class WSComponent extends Component {
* @param operationName
* @throws ComponentException
*/
- public WSComponent(ApplicationInterfaceDescription application, String operationName) throws ComponentException {
- this.operationName = operationName;
- this.description = application.getApplicationDesription();
+ public WSComponent(WSComponentApplication application) throws ComponentException {
this.setApplication(application);
- setName(application.getApplicationName());
+ this.operationName = application.getName();
+ this.description = application.getDescription();
+ setName(application.getName());
this.inputs = new ArrayList<WSComponentPort>();
this.outputs = new ArrayList<WSComponentPort>();
- List<InputDataObjectType> applicationInputs = application.getApplicationInputs();
- for (InputDataObjectType inputDataObjectType : applicationInputs) {
-
- String typeName = inputDataObjectType.getType().toString().toLowerCase();
- XmlNamespace namespace = null;
- namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
- String prefix = "xsd";
- QName type = new QName(namespace.getName(), typeName, prefix);
-
- WSComponentPort port = new WSComponentPort(inputDataObjectType.getName(),type , this);
- port.setDescription(inputDataObjectType.getUserFriendlyDescription());
- port.setDefaultValue(inputDataObjectType.getValue());
+ List<WSComponentApplicationParameter> applicationInputs = application.getInputParameters();
+ for (WSComponentApplicationParameter inputDataObjectType : applicationInputs) {
+ WSComponentPort port = new WSComponentPort(inputDataObjectType.getName(),inputDataObjectType.getType() , this);
+ port.setDescription(inputDataObjectType.getDescription());
+ port.setDefaultValue(inputDataObjectType.getDefaultValue());
inputs.add(port);
}
- List<OutputDataObjectType> applicationOutputs = application.getApplicationOutputs();
- for (OutputDataObjectType outputDataObjectType : applicationOutputs) {
-
- String typeName = outputDataObjectType.getType().toString().toLowerCase();
- XmlNamespace namespace = null;
- namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
- String prefix = "xsd";
- QName type = new QName(namespace.getName(), typeName, prefix);
-
- WSComponentPort port = new WSComponentPort(outputDataObjectType.getName(),type , this);
- port.setDefaultValue(outputDataObjectType.getValue());
- outputs.add(port);
+ List<WSComponentApplicationParameter> applicationOutputs = application.getOutputParameters();
+ for (WSComponentApplicationParameter outputDataObjectType : applicationOutputs) {
+ WSComponentPort port = new WSComponentPort(outputDataObjectType.getName(),outputDataObjectType.getType() , this);
+ port.setDescription(outputDataObjectType.getDescription());
+ port.setDefaultValue(outputDataObjectType.getDefaultValue());
+ outputs.add(port);
}
this.controlInPort = new ComponentControlPort();
this.controlOutPorts.add(new ComponentControlPort());
}
-
-
- /**
- * Returns the QName of the portType.
- *
- * @return The QName of the portType
- */
- public QName getPortTypeQName() {
- return this.portTypeQName;
- }
-
/**
* Returns the operation name.
*
@@ -237,9 +204,7 @@ public class WSComponent extends Component {
buf.append("<h1>Application: " + getName() + "</h1>\n");
buf.append("<h2>Description:</h2>\n");
- buf.append(this.description);
-
- buf.append("<h2>Operation: " + this.operationName + "</h2>\n");
+ buf.append(this.description==null?"":this.description);
if (getInputPorts().size()>0) {
buf.append("<h3>Input parameter(s)</h3>\n");
@@ -266,15 +231,19 @@ public class WSComponent extends Component {
}
public XmlElement toXML() {
- return null;
+ return getApplication().toXml();
}
- public ApplicationInterfaceDescription getApplication() {
+ public WSComponentApplication getApplication() {
return application;
}
- public void setApplication(ApplicationInterfaceDescription application) {
+ public void setApplication(WSComponentApplication application) {
this.application = application;
}
+ public QName getPortTypeQName() {
+ return null;
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplication.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplication.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplication.java
new file mode 100644
index 0000000..0d38d6d
--- /dev/null
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplication.java
@@ -0,0 +1,207 @@
+/*
+ *
+ * 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.workflow.model.component.ws;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.xmlpull.infoset.XmlNamespace;
+
+import xsul.dsig.apache.axis.uti.XMLUtils;
+import xsul5.XmlConstants;
+
+@XmlRootElement(name="Application")
+@XmlType(propOrder = {"applicationId", "name", "description", "inputParameters", "outputParameters"})
+public class WSComponentApplication {
+
+ private String applicationId;
+ private String name;
+ private String description;
+ private List<WSComponentApplicationParameter> inputParameters;
+ private List<WSComponentApplicationParameter> outputParameters;
+
+ public WSComponentApplication() {
+ }
+
+ public static void main(String[] args) {
+ WSComponentApplication app = new WSComponentApplication();
+ app.setApplicationId("dsfds");
+ app.setName("dfd");
+ app.setDescription("sdfdsfds");
+ app.addInputParameter(new WSComponentApplicationParameter("asas", new QName("sdf"), null, "sdfds"));
+ app.addOutputParameter(new WSComponentApplicationParameter("9842", new QName("sdv99304"), null, null));
+ app.addOutputParameter(new WSComponentApplicationParameter("AAAAA", new QName("sdfd"), "sdfsdf", "243bs sd fsd fs f dfd"));
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try {
+ JAXBContext context = JAXBContext.newInstance(WSComponentApplication.class);
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "ISO-8859-1"); // specify encoding
+ // output xml to outputstream.
+ marshaller.marshal(app, byteArrayOutputStream);
+ org.xmlpull.infoset.XmlElement s = XMLUtil.stringToXmlElement(byteArrayOutputStream.toString());
+ System.out.println(s.toString());
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
+ try {
+ JAXBContext context = JAXBContext.newInstance(WSComponentApplication.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ // parse xml.
+ WSComponentApplication d = (WSComponentApplication)unmarshaller.unmarshal(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
+ System.out.println(d.getApplicationId());
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static WSComponentApplication parse(org.xmlpull.infoset.XmlElement element) {
+ String xmlString = XMLUtil.xmlElementToString(element);
+ try {
+ JAXBContext context = JAXBContext.newInstance(WSComponentApplication.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ return (WSComponentApplication) unmarshaller.unmarshal(new ByteArrayInputStream(xmlString.getBytes()));
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+ public org.xmlpull.infoset.XmlElement toXml(){
+ try {
+ JAXBContext context = JAXBContext.newInstance(WSComponentApplication.class);
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "ISO-8859-1"); // specify encoding
+ // output xml to outputstream.
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ marshaller.marshal(this, byteArrayOutputStream);
+ return XMLUtil.stringToXmlElement(byteArrayOutputStream.toString());
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public WSComponentApplication(ApplicationInterfaceDescription application) {
+ setApplicationId(application.getApplicationInterfaceId());
+ setName(application.getApplicationName());
+ setDescription(application.getApplicationDesription());
+
+ List<InputDataObjectType> applicationInputs = application.getApplicationInputs();
+ for (InputDataObjectType inputDataObjectType : applicationInputs) {
+ String typeName = inputDataObjectType.getType().toString().toLowerCase();
+ XmlNamespace namespace = null;
+ namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
+ String prefix = "xsd";
+ QName type = new QName(namespace.getName(), typeName, prefix);
+
+ addInputParameter(new WSComponentApplicationParameter(inputDataObjectType.getName(),type ,inputDataObjectType.getUserFriendlyDescription(), inputDataObjectType.getValue()));
+ }
+
+ List<OutputDataObjectType> applicationOutputs = application.getApplicationOutputs();
+ for (OutputDataObjectType outputDataObjectType : applicationOutputs) {
+ String typeName = outputDataObjectType.getType().toString().toLowerCase();
+ XmlNamespace namespace = null;
+ namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
+ String prefix = "xsd";
+ QName type = new QName(namespace.getName(), typeName, prefix);
+
+ addOutputParameter(new WSComponentApplicationParameter(outputDataObjectType.getName(),type ,outputDataObjectType.getName(), outputDataObjectType.getValue()));
+ }
+ }
+
+ @XmlAttribute (required = true, name = "application")
+ public String getApplicationId() {
+ return applicationId;
+ }
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+ @XmlAttribute (required = true)
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+// @XmlElementWrapper(name = "Input")
+ @XmlElement(name = "Input")
+ public List<WSComponentApplicationParameter> getInputParameters() {
+ return inputParameters;
+ }
+
+ public void setInputParameters(
+ List<WSComponentApplicationParameter> inputParameters) {
+ this.inputParameters = inputParameters;
+ }
+
+ @XmlElement(name = "Output")
+ public List<WSComponentApplicationParameter> getOutputParameters() {
+ return outputParameters;
+ }
+ public void setOutputParameters(
+ List<WSComponentApplicationParameter> outputParameters) {
+ this.outputParameters = outputParameters;
+ }
+
+ public void addInputParameter(WSComponentApplicationParameter inputParameter){
+ if (inputParameters==null){
+ inputParameters = new ArrayList<WSComponentApplicationParameter>();
+ }
+ inputParameters.add(inputParameter);
+ }
+
+ public void addOutputParameter(WSComponentApplicationParameter outputParameter){
+ if (outputParameters==null){
+ outputParameters = new ArrayList<WSComponentApplicationParameter>();
+ }
+ outputParameters.add(outputParameter);
+ }
+
+ @XmlAttribute (required = false)
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplicationParameter.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplicationParameter.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplicationParameter.java
new file mode 100644
index 0000000..92f6e56
--- /dev/null
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentApplicationParameter.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * 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.workflow.model.component.ws;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.namespace.QName;
+
+@XmlRootElement(name="Parameter")
+@XmlType(propOrder = {"name", "type", "description", "defaultValue"})
+public class WSComponentApplicationParameter {
+ private String name;
+ private QName type;
+ private String description;
+ private String defaultValue;
+
+ public WSComponentApplicationParameter() {
+ }
+
+ public WSComponentApplicationParameter(String name, QName type,
+ String description, String defaultValue) {
+ this.name = name;
+ this.type = type;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ }
+
+ @XmlAttribute (required = true)
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @XmlAttribute (required = true)
+ public QName getType() {
+ return type;
+ }
+ public void setType(QName type) {
+ this.type = type;
+ }
+
+ @XmlAttribute (required = false)
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @XmlValue
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
index 8c8bacc..c7a1305 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
@@ -54,7 +54,7 @@ public class WSComponentFactory {
throws ComponentException {
try {
WSComponent component;
- component = new WSComponent(application, operationName);
+ component = new WSComponent(new WSComponentApplication(application));
return component;
} catch (RuntimeException e) {
throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
index 00ded8f..7a6d1ba 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
@@ -23,7 +23,9 @@ package org.apache.airavata.workflow.model.graph.ws;
import javax.xml.namespace.QName;
+import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.component.ws.WSComponent;
+import org.apache.airavata.workflow.model.component.ws.WSComponentApplication;
import org.apache.airavata.workflow.model.graph.Edge;
import org.apache.airavata.workflow.model.graph.ForEachExecutableNode;
import org.apache.airavata.workflow.model.graph.Graph;
@@ -85,21 +87,6 @@ public class WSNode extends NodeImpl implements ForEachExecutableNode{
}
/**
- * @return The name of portType.
- */
- public QName getPortTypeQName() {
- if (this.portTypeQName == null) {
- if (getComponent() == null) {
- // XXX This happens while parsing xwf created by the version
- // 2.2.6_1 or below.
- return null;
- }
- this.portTypeQName = getComponent().getPortTypeQName();
- }
- return this.portTypeQName;
- }
-
- /**
* @return The name of the operation.
*/
public String getOperationName() {
@@ -131,16 +118,20 @@ public class WSNode extends NodeImpl implements ForEachExecutableNode{
XmlElement nodeElement = super.toXML();
nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_WS);
- XmlElement wsdlElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_QNAME_TAG);
- // wsdlElement.setText(getWSDLQName().toString());
- wsdlElement.setText(getWSDLID());
-
- XmlElement portTypeElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_PORT_TYPE_TAG);
- portTypeElement.setText(getPortTypeQName().toString());
-
- XmlElement operationElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_OPERATION_TAG);
- operationElement.setText(getOperationName());
-
+// XmlElement wsdlElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_QNAME_TAG);
+// // wsdlElement.setText(getWSDLQName().toString());
+// wsdlElement.setText(getWSDLID());
+//
+// XmlElement portTypeElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_PORT_TYPE_TAG);
+// portTypeElement.setText(getPortTypeQName().toString());
+//
+// XmlElement operationElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_WSDL_OPERATION_TAG);
+// operationElement.setText(getOperationName());
+
+ XmlElement xml = getComponent().toXML();
+ xml.setParent(null);
+ nodeElement.addElement(xml);
+
return nodeElement;
}
@@ -150,24 +141,30 @@ public class WSNode extends NodeImpl implements ForEachExecutableNode{
@Override
protected void parse(XmlElement nodeElement) throws GraphException {
super.parse(nodeElement);
-
- XmlElement wsdlElement = nodeElement.element(null, GraphSchema.NODE_WSDL_QNAME_TAG);
- if (wsdlElement != null) {
- this.wsdlID = wsdlElement.requiredText();
- // String wsdlQNameString = wsdlElement.requiredText();
- // this.wsdlQName = QName.valueOf(wsdlQNameString);
- }
-
- XmlElement portTypeElement = nodeElement.element(null, GraphSchema.NODE_WSDL_PORT_TYPE_TAG);
- if (portTypeElement != null) {
- String portTypeString = portTypeElement.requiredText();
- this.portTypeQName = QName.valueOf(portTypeString);
- }
-
- XmlElement operationElement = nodeElement.element(null, GraphSchema.NODE_WSDL_OPERATION_TAG);
- if (operationElement != null) {
- this.operationName = operationElement.requiredText();
- }
+ XmlElement element = nodeElement.element(null, "Application");
+ WSComponentApplication application = WSComponentApplication.parse(element);
+ try {
+ setComponent(new WSComponent(application));
+ } catch (ComponentException e) {
+ e.printStackTrace();
+ }
+// XmlElement wsdlElement = nodeElement.element(null, GraphSchema.NODE_WSDL_QNAME_TAG);
+// if (wsdlElement != null) {
+// this.wsdlID = wsdlElement.requiredText();
+// // String wsdlQNameString = wsdlElement.requiredText();
+// // this.wsdlQName = QName.valueOf(wsdlQNameString);
+// }
+//
+// XmlElement portTypeElement = nodeElement.element(null, GraphSchema.NODE_WSDL_PORT_TYPE_TAG);
+// if (portTypeElement != null) {
+// String portTypeString = portTypeElement.requiredText();
+// this.portTypeQName = QName.valueOf(portTypeString);
+// }
+//
+// XmlElement operationElement = nodeElement.element(null, GraphSchema.NODE_WSDL_OPERATION_TAG);
+// if (operationElement != null) {
+// this.operationName = operationElement.requiredText();
+// }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/c424c37a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
index 22bb29d..04446aa 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
@@ -43,7 +43,6 @@ import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.workflow.model.component.Component;
import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.component.ws.WSComponent;
-import org.apache.airavata.workflow.model.component.ws.WSComponentFactory;
import org.apache.airavata.workflow.model.component.ws.WSComponentKey;
import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
@@ -612,36 +611,36 @@ public class Workflow implements Cloneable {
}
}
}
- if (wsdl == null) {
- continue;
- }
- try {
- QName portType = node.getPortTypeQName();
- if (portType == null) {
- // XXX This happens while parsing xwf created by the version
- // 2.2.6_1 or below.
- portType = WSDLUtil.getFirstPortTypeQName(wsdl);
- }
- String operation = node.getOperationName();
- if (operation == null) {
- // XXX This happens while parsing xwf created by the version
- // 2.2.6_1 or below.
- operation = WSDLUtil.getFirstOperationName(wsdl, portType);
- }
- WSComponentKey key = new WSComponentKey(id, portType, operation);
-
- WSComponent component = null;
- if (components.containsKey(key)) {
- component = components.get(key);
- } else {
- //FIXME
-// component = WSComponentFactory.createComponent(wsdl, portType, operation);
- components.put(key, component);
- }
- node.setComponent(component);
- } catch (UtilsException e) {
- logger.error(e.getMessage(), e);
- }
+// if (wsdl == null) {
+// continue;
+// }
+// try {
+// QName portType = node.getPortTypeQName();
+// if (portType == null) {
+// // XXX This happens while parsing xwf created by the version
+// // 2.2.6_1 or below.
+// portType = WSDLUtil.getFirstPortTypeQName(wsdl);
+// }
+// String operation = node.getOperationName();
+// if (operation == null) {
+// // XXX This happens while parsing xwf created by the version
+// // 2.2.6_1 or below.
+// operation = WSDLUtil.getFirstOperationName(wsdl, portType);
+// }
+// WSComponentKey key = new WSComponentKey(id, portType, operation);
+//
+// WSComponent component = null;
+// if (components.containsKey(key)) {
+// component = components.get(key);
+// } else {
+// //FIXME
+//// component = WSComponentFactory.createComponent(wsdl, portType, operation);
+// components.put(key, component);
+// }
+// node.setComponent(component);
+// } catch (UtilsException e) {
+// logger.error(e.getMessage(), e);
+// }
}
this.graph.fixParameterNodes();