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 2012/05/17 19:12:21 UTC
svn commit: r1339718 [2/10] - in /incubator/airavata/trunk: ./
modules/airavata-client/ modules/distribution/
modules/distribution/src/main/assembly/ modules/workflow-model/
modules/workflow-model/src/ modules/workflow-model/src/main/
modules/workflow-...
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/dynamic/DynamicComponentPort.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/dynamic/DynamicComponentPort.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/dynamic/DynamicComponentPort.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/dynamic/DynamicComponentPort.java Thu May 17 17:12:15 2012
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.dynamic;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.workflow.model.component.ComponentDataPort;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.dynamic.DynamicPort;
+import org.apache.airavata.common.utils.WSConstants;
+
+public class DynamicComponentPort extends ComponentDataPort {
+
+ private DynamicComponent component;
+
+ public DynamicComponentPort(DynamicComponent component) {
+ super();
+ this.component = component;
+ this.type = WSConstants.XSD_ANY_TYPE;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.ComponentDataPort#createPort()
+ */
+ @Override
+ public DataPort createPort() {
+ DynamicPort port = new DynamicPort();
+ port.setComponentPort(this);
+
+ return port;
+ }
+
+ public void setType(QName type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns the component.
+ *
+ * @return The component
+ */
+ public DynamicComponent getComponent() {
+ return this.component;
+ }
+
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/BlockComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/BlockComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/BlockComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/BlockComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.BlockNode;
+
+public class BlockComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "Block";
+
+ private static final String DESCRIPTION = "TODO";
+
+ private static final String CONTROL_OUT_TRUE_DESCRIPTION = "TODO";
+
+ private static final String CONTROL_OUT_FALSE_DESCRIPTION = "TODO";
+
+ private SystemComponentDataPort inputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public BlockComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.controlInPort = new ComponentControlPort();
+
+ ComponentControlPort outputPortTrue = new ComponentControlPort();
+ outputPortTrue.setDescription(CONTROL_OUT_TRUE_DESCRIPTION);
+ this.controlOutPorts.add(outputPortTrue);
+
+ ComponentControlPort outputPortFalse = new ComponentControlPort();
+ outputPortFalse.setDescription(CONTROL_OUT_FALSE_DESCRIPTION);
+ this.controlOutPorts.add(outputPortFalse);
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by IfNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a if node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ BlockNode node = new BlockNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ConstantComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ConstantComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ConstantComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ConstantComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,72 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+
+public class ConstantComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "Const";
+
+ private static final String DESCRIPTION = "A system component that represents a constant variable.";
+
+ private static final String PORT_NAME = "Const";
+
+ private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ /**
+ * Creates an InputComponent.
+ */
+ public ConstantComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+ SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+ port.setDescription(PORT_DESCRIPTION);
+ this.outputs.add(port);
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ ConstantNode node = new ConstantNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/DifferedInputComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/DifferedInputComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/DifferedInputComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/DifferedInputComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.workflow.model.component.system;
+
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputComponent extends SystemComponent {
+
+ /**
+ * The name of the input component
+ */
+ public static final String NAME = "DifferedInput";
+
+ private static final String DESCRIPTION = "A system component that represents an differred input parameter of a workflow.";
+
+ private static final String PORT_NAME = "Parameter";
+
+ /**
+ * The description.
+ */
+ private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ /**
+ * Creates an InputComponent.
+ */
+ public DifferedInputComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+ port.setDescription(PORT_DESCRIPTION);
+ this.outputs.add(port);
+ }
+
+ /**
+ * @see edu.indiana.extreme.xbaya.component.Component#createNode(edu.indiana.extreme.xbaya.graph.Graph)
+ */
+ @Override
+ public DifferedInputNode createNode(Graph graph) {
+ DifferedInputNode node = new DifferedInputNode(graph);
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ // Creates a output port
+ createPorts(node);
+
+ return node;
+ }
+
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ *
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ *
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ *
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ *
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ *
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ *
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ *
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ *
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ *
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndBlockComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndBlockComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndBlockComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndBlockComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.EndBlockNode;
+
+public class EndBlockComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "EndBlock";
+
+ private static final String DESCRIPTION = "TODO";
+
+ private static final String INPUT_PORT_NAME = "Input";
+
+ private static final String INPUT_PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ private static final String OUTPUT_PORT_NAME = "Output";
+
+ private static final String OUTPUT_PORT_DESCRIPTION = "";
+
+ private SystemComponentDataPort inputPort;
+
+ private SystemComponentDataPort outputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public EndBlockComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.inputPort = new SystemComponentDataPort(INPUT_PORT_NAME);
+ this.inputPort.setDescription(INPUT_PORT_DESCRIPTION);
+ this.inputs.add(this.inputPort);
+ this.inputs.add(this.inputPort);
+
+ this.outputPort = new SystemComponentDataPort(OUTPUT_PORT_NAME);
+ this.outputPort.setDescription(OUTPUT_PORT_DESCRIPTION);
+ this.outputs.add(this.outputPort);
+
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The output component port.
+ */
+ public SystemComponentDataPort getOutputPort() {
+ return this.outputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getOutputPort(int)
+ */
+ @Override
+ public ComponentPort getOutputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getOutputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ EndBlockNode node = new EndBlockNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndForEachComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndForEachComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndForEachComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndForEachComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+
+public class EndForEachComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "EndForEach";
+
+ private static final String DESCRIPTION = "A system component that takes multiple values and creates an array.";
+
+ private static final String INPUT_PORT_NAME = "Input";
+
+ private static final String INPUT_PORT_DESCRIPTION = "An value.";
+
+ private static final String OUTPUT_PORT_NAME = "Output";
+
+ private static final String OUTPUT_PORT_DESCRIPTION = "Array.";
+
+ private SystemComponentDataPort inputPort;
+
+ private SystemComponentDataPort outputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public EndForEachComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.inputPort = new SystemComponentDataPort(INPUT_PORT_NAME);
+ this.inputPort.setDescription(INPUT_PORT_DESCRIPTION);
+ this.inputs.add(this.inputPort);
+
+ this.outputPort = new SystemComponentDataPort(OUTPUT_PORT_NAME);
+ this.outputPort.setDescription(OUTPUT_PORT_DESCRIPTION);
+ this.outputPort.setArrayDimension(1);
+ this.outputs.add(this.outputPort);
+
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The output component port.
+ */
+ public SystemComponentDataPort getOutputPort() {
+ return this.outputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getOutputPort(int)
+ */
+ @Override
+ public ComponentPort getOutputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getOutputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ EndForEachNode node = new EndForEachNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndifComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndifComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndifComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/EndifComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+
+public class EndifComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "Endif";
+
+ private static final String DESCRIPTION = "A system component that represents a condition to branch.";
+
+ private static final String INPUT_PORT_NAME = "Input";
+
+ private static final String INPUT_PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ private static final String OUTPUT_PORT_NAME = "Output";
+
+ private static final String OUTPUT_PORT_DESCRIPTION = "";
+
+ private SystemComponentDataPort inputPort;
+
+ private SystemComponentDataPort outputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public EndifComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.inputPort = new SystemComponentDataPort(INPUT_PORT_NAME);
+ this.inputPort.setDescription(INPUT_PORT_DESCRIPTION);
+ this.inputs.add(this.inputPort);
+ this.inputs.add(this.inputPort);
+
+ this.outputPort = new SystemComponentDataPort(OUTPUT_PORT_NAME);
+ this.outputPort.setDescription(OUTPUT_PORT_DESCRIPTION);
+ this.outputs.add(this.outputPort);
+
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The output component port.
+ */
+ public SystemComponentDataPort getOutputPort() {
+ return this.outputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getOutputPort(int)
+ */
+ @Override
+ public ComponentPort getOutputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getOutputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ EndifNode node = new EndifNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ForEachComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ForEachComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ForEachComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ForEachComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+
+public class ForEachComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "ForEach";
+
+ private static final String DESCRIPTION = "A system component that represents splits an array.";
+
+ private static final String INPUT_PORT_NAME = "Input";
+
+ private static final String INPUT_PORT_DESCRIPTION = "Array.";
+
+ private static final String OUTPUT_PORT_NAME = "Output1";
+
+ private static final String OUTPUT_PORT_DESCRIPTION = "Each value in the input array.";
+
+ private SystemComponentDataPort inputPort;
+
+ private SystemComponentDataPort outputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public ForEachComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.inputPort = new SystemComponentDataPort(INPUT_PORT_NAME);
+ this.inputPort.setDescription(INPUT_PORT_DESCRIPTION);
+ this.inputPort.setArrayDimension(1);
+ this.inputs.add(this.inputPort);
+
+ this.controlInPort = new ComponentControlPort();
+
+ this.outputPort = new SystemComponentDataPort(OUTPUT_PORT_NAME);
+ this.outputPort.setDescription(OUTPUT_PORT_DESCRIPTION);
+ this.outputs.add(this.outputPort);
+
+ ComponentControlPort controlOutPort = new ComponentControlPort();
+ this.controlOutPorts.add(controlOutPort);
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by EndifNode to create additional output port.
+ *
+ * @return The output component port.
+ */
+ public SystemComponentDataPort getOutputPort() {
+ return this.outputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getOutputPort(int)
+ */
+ @Override
+ public ComponentPort getOutputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a endif node dynamically
+ // changes, we overwrite it.
+ return getOutputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ ForEachNode node = new ForEachNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/IfComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/IfComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/IfComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/IfComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,120 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+
+public class IfComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "If";
+
+ /**
+ * The name of control output port if condition is true
+ */
+ public static final String TRUE_PORT_NAME = "If_True";
+
+ /**
+ * The name of control output port if condition is false
+ */
+ public static final String FALSE_PORT_NAME = "If_False";
+
+ private static final String DESCRIPTION = "A system component that represents a condition to branch.";
+
+ private static final String INPUT_PORT_NAME = "Input";
+
+ private static final String INPUT_PORT_DESCRIPTION = "The input value is used to evaluate the if condition.";
+
+ private static final String CONTROL_OUT_TRUE_DESCRIPTION = "If the condition is true, services connected to this port will be executed.";
+
+ private static final String CONTROL_OUT_FALSE_DESCRIPTION = "If the condition is false, services connected to this port will be executed.";
+
+ private SystemComponentDataPort inputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public IfComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.inputPort = new SystemComponentDataPort(INPUT_PORT_NAME);
+ this.inputPort.setDescription(INPUT_PORT_DESCRIPTION);
+ this.inputs.add(this.inputPort);
+
+ this.controlInPort = new ComponentControlPort();
+
+ ComponentControlPort outputPortTrue = new ComponentControlPort(TRUE_PORT_NAME);
+ outputPortTrue.setDescription(CONTROL_OUT_TRUE_DESCRIPTION);
+ this.controlOutPorts.add(outputPortTrue);
+
+ ComponentControlPort outputPortFalse = new ComponentControlPort(FALSE_PORT_NAME);
+ outputPortFalse.setDescription(CONTROL_OUT_FALSE_DESCRIPTION);
+ this.controlOutPorts.add(outputPortFalse);
+ }
+
+ /**
+ * Returns the input component port.
+ *
+ * This method is used by IfNode to create additional output port.
+ *
+ * @return The input component port.
+ */
+ public SystemComponentDataPort getInputPort() {
+ return this.inputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getInputPort(int)
+ */
+ @Override
+ public ComponentPort getInputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a if node dynamically
+ // changes, we overwrite it.
+ return getInputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ IfNode node = new IfNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/InputComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/InputComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/InputComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/InputComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+
+public class InputComponent extends SystemComponent {
+
+ /**
+ * The name of the input component
+ */
+ public static final String NAME = "Input";
+
+ private static final String DESCRIPTION = "A system component that represents an input parameter of a workflow.";
+
+ private static final String PORT_NAME = "Parameter";
+
+ /**
+ * The description.
+ */
+ private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ /**
+ * Creates an InputComponent.
+ */
+ public InputComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+ port.setDescription(PORT_DESCRIPTION);
+ this.outputs.add(port);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public InputNode createNode(Graph graph) {
+ InputNode node = new InputNode(graph);
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ // Creates a output port
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/MemoComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/MemoComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/MemoComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/MemoComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.MemoNode;
+
+public class MemoComponent extends SystemComponent {
+
+ /**
+ * The name of the input component
+ */
+ public static final String NAME = "Memo";
+
+ private static final String DESCRIPTION = "A system component that can be used to take memo";
+
+ /**
+ * Creates an InputComponent.
+ */
+ public MemoComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ MemoNode node = new MemoNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ return node;
+ }
+
+
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/OutputComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/OutputComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/OutputComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/OutputComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+
+public class OutputComponent extends SystemComponent {
+
+ /**
+ * The name of the parameter component
+ */
+ public static final String NAME = "Output";
+
+ private static final String DESCRIPTION = "A system component that represents an output parameter of a workflow.";
+
+ private static final String PORT_NAME = "Parameter";
+
+ private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ /**
+ * Creates an OutputComponent.
+ */
+ public OutputComponent() {
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+ port.setDescription(PORT_DESCRIPTION);
+ this.inputs.add(port);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ OutputNode node = new OutputNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ // Creates an input port
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ReceiveComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ReceiveComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ReceiveComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/ReceiveComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentEPRPort;
+import org.apache.airavata.workflow.model.component.ComponentPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
+
+public class ReceiveComponent extends SystemComponent {
+
+ /**
+ * The name of the const component
+ */
+ public static final String NAME = "Receive";
+
+ private static final String DESCRIPTION = "";
+
+ private static final String OUTPUT_PORT_NAME = "Output";
+
+ private static final String OUTPUT_PORT_DESCRIPTION = "";
+
+ private SystemComponentDataPort outputPort;
+
+ /**
+ * Creates an InputComponent.
+ */
+ public ReceiveComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ this.outputPort = new SystemComponentDataPort(OUTPUT_PORT_NAME);
+ this.outputPort.setDescription(OUTPUT_PORT_DESCRIPTION);
+ this.outputs.add(this.outputPort);
+
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ this.eprPort = new ComponentEPRPort();
+ }
+
+ /**
+ * Returns the output component port.
+ *
+ * This method is used by ReceiveNode to create additional output port.
+ *
+ * @return The output component port.
+ */
+ public SystemComponentDataPort getOutputPort() {
+ return this.outputPort;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#getOutputPort(int)
+ */
+ @Override
+ public ComponentPort getOutputPort(int index) {
+ // This method is called during the parsing to bind port to a component
+ // port. Since the number of output ports in a receive node dynamically
+ // changes, we overwrite it.
+ return getOutputPort();
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ ReceiveNode node = new ReceiveNode(graph);
+
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/S3InputComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/S3InputComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/S3InputComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/S3InputComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.system.S3InputNode;
+
+public class S3InputComponent extends SystemComponent {
+
+ /**
+ * The name of the input component
+ */
+ public static final String NAME = "S3Input";
+
+ private static final String DESCRIPTION = "A system component that represents an input parameter of a workflow.";
+
+ private static final String PORT_NAME = "Parameter";
+
+ /**
+ * The description.
+ */
+ private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+ /**
+ * Creates an InputComponent.
+ */
+ public S3InputComponent() {
+ super();
+ setName(NAME);
+ setDescription(DESCRIPTION);
+
+ SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+ port.setDescription(PORT_DESCRIPTION);
+ this.outputs.add(port);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public S3InputNode createNode(Graph graph) {
+ S3InputNode node = new S3InputNode(graph);
+ node.setName(NAME);
+ node.setComponent(this);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ // Creates a output port
+ createPorts(node);
+
+ return node;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,96 @@
+/*
+ *
+ * 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.system;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.component.ComponentDataPort;
+
+public abstract class SystemComponent extends Component {
+
+ /**
+ * The list of output component ports.
+ */
+ protected List<ComponentDataPort> inputs;
+
+ /**
+ * The list of input component ports.
+ */
+ protected List<ComponentDataPort> outputs;
+
+ /**
+ * Constructs a SystemComponent.
+ */
+ public SystemComponent() {
+ this.inputs = new ArrayList<ComponentDataPort>();
+ this.outputs = new ArrayList<ComponentDataPort>();
+ }
+
+ /**
+ * @return The list of input WSComponentPorts
+ */
+ @Override
+ public List<ComponentDataPort> getInputPorts() {
+ return this.inputs;
+ }
+
+ /**
+ * @return The list of output WSComponentPorts
+ */
+ @Override
+ public List<ComponentDataPort> getOutputPorts() {
+ return this.outputs;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#toHTML()
+ */
+ @Override
+ public String toHTML() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<html> <h1>" + this.name + " Component</h1>");
+ buf.append("<h2>Description:</h2> " + this.description);
+
+ for (int i = 0; i < this.inputs.size(); i++) {
+ ComponentDataPort port = this.inputs.get(i);
+ buf.append("<h3>Input" + (i + 1) + "</h3>");
+ buf.append("<strong>Name: </strong>");
+ buf.append("" + port.getName() + "<br>");
+ buf.append("<strong>Description: </strong>");
+ buf.append("" + port.getDescription());
+ }
+
+ for (int i = 0; i < this.outputs.size(); i++) {
+ ComponentDataPort port = this.outputs.get(i);
+ buf.append("<h3>Output" + (i + 1) + "</h3>");
+ buf.append("<strong>Name: </strong>");
+ buf.append("" + port.getName() + "<br>");
+ buf.append("<strong>Description: </strong>");
+ buf.append("" + port.getDescription());
+ }
+
+ buf.append("</html>");
+ return buf.toString();
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponentDataPort.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponentDataPort.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponentDataPort.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/system/SystemComponentDataPort.java Thu May 17 17:12:15 2012
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.system;
+
+import org.apache.airavata.workflow.model.component.ComponentDataPort;
+import org.apache.airavata.workflow.model.graph.system.SystemDataPort;
+
+public class SystemComponentDataPort extends ComponentDataPort {
+
+ private int arrayDimension;
+
+ /**
+ * Constructs a SystemComponentDataPort.
+ *
+ * @param name
+ */
+ public SystemComponentDataPort(String name) {
+ super(name);
+ this.arrayDimension = 0;
+ }
+
+ /**
+ * Sets arrayDimension.
+ *
+ * @param arrayDimension
+ * The arrayDimension to set.
+ */
+ public void setArrayDimension(int arrayDimension) {
+ this.arrayDimension = arrayDimension;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.ComponentPort#createPort()
+ */
+ @Override
+ public SystemDataPort createPort() {
+ SystemDataPort port = new SystemDataPort();
+ port.setArrayDimension(this.arrayDimension);
+ port.setName(this.name);
+ port.setComponentPort(this);
+ return port;
+ }
+
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java Thu May 17 17:12:15 2012
@@ -0,0 +1,507 @@
+/*
+ *
+ * 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.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.exception.UtilsException;
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.WSDLUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.component.ComponentControlPort;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.gpel.DSCUtil;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.infoset.XmlCharacters;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.wsdl.WsdlDefinitions;
+import xsul5.wsdl.WsdlDocumentation;
+import xsul5.wsdl.WsdlMessage;
+import xsul5.wsdl.WsdlMessagePart;
+import xsul5.wsdl.WsdlPortType;
+import xsul5.wsdl.WsdlPortTypeInput;
+import xsul5.wsdl.WsdlPortTypeOperation;
+import xsul5.wsdl.WsdlPortTypeOutput;
+
+public class WSComponent extends Component {
+
+ private static final Logger logger = LoggerFactory.getLogger(WSComponent.class);
+
+ protected WsdlDefinitions wsdl;
+
+ protected QName wsdlQName;
+
+ /**
+ * The list of output component ports.
+ */
+ protected List<WSComponentPort> inputs;
+
+ /**
+ * The list of input component ports.
+ */
+ protected List<WSComponentPort> outputs;
+
+ private String description;
+
+ private String operationName;
+
+ private String targetNamespace;
+
+ private QName portTypeQName;
+
+ private String inputPartName;
+
+ private String outputPartName;
+
+ private String inputTypeName;
+
+ private String outputTypeName;
+
+ protected WSComponent() {
+
+ }
+
+ /**
+ * Constructs a WSComponent.
+ *
+ * @param componentPath
+ * @param wsdl
+ * @throws ComponentException
+ */
+ public WSComponent(WsdlDefinitions wsdl) throws ComponentException {
+ // This constructor is called only from WorkflowComponent where we know
+ // that there is only one operation in WSDL.
+ this(wsdl, null, null);
+ }
+
+ /**
+ * Constructs a WSComponent.
+ *
+ * @param wsdl
+ * @param portTypeQName
+ * @param operationName
+ * @throws ComponentException
+ */
+ public WSComponent(WsdlDefinitions wsdl, QName portTypeQName, String operationName) throws ComponentException {
+ this.inputs = new ArrayList<WSComponentPort>();
+ this.outputs = new ArrayList<WSComponentPort>();
+
+ try {
+ this.wsdl = wsdl;
+ if (portTypeQName == null) {
+ portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
+ }
+ this.portTypeQName = portTypeQName;
+ if (operationName == null) {
+ operationName = WSDLUtil.getFirstOperationName(wsdl, this.portTypeQName);
+ }
+ this.operationName = operationName;
+ this.description = ""; // To prevent to show null
+
+ setName(this.portTypeQName.getLocalPart() + ":" + this.operationName);
+
+ parse();
+ } catch (UtilsException e) {
+ e.printStackTrace();
+ }
+
+ this.controlInPort = new ComponentControlPort();
+ this.controlOutPorts.add(new ComponentControlPort());
+ }
+
+ /**
+ * @return The WSDL
+ */
+ public WsdlDefinitions getWSDL() {
+ return this.wsdl;
+ }
+
+ public WsdlDefinitions getConcreteWSDL(URI dscUri) {
+ if (WSDLUtil.isAWSDL(this.wsdl)) {
+ return DSCUtil.convertToCWSDL(this.wsdl, dscUri);
+ } else {
+ return this.wsdl;
+ }
+ }
+
+ /**
+ * Returns the QName of the WSDL.
+ *
+ * @return The QName of the WSDL.
+ */
+ public QName getWSDLQName() {
+ return this.wsdlQName;
+ }
+
+ /**
+ * Returns the QName of the portType.
+ *
+ * @return The QName of the portType
+ */
+ public QName getPortTypeQName() {
+ return this.portTypeQName;
+ }
+
+ /**
+ * Returns the operation name.
+ *
+ * @return The operation name
+ */
+ public String getOperationName() {
+ return this.operationName;
+ }
+
+ /**
+ * Returns the inputPartName.
+ *
+ * @return The inputPartName
+ */
+ public String getInputPartName() {
+ return this.inputPartName;
+ }
+
+ /**
+ * Returns the outputPartName.
+ *
+ * @return The outputPartName
+ */
+ public String getOutputPartName() {
+ return this.outputPartName;
+ }
+
+ /**
+ * Returns the inputTypeName.
+ *
+ * @return The inputTypeName
+ */
+ public String getInputTypeName() {
+ return this.inputTypeName;
+ }
+
+ /**
+ * Returns the outputTypeName.
+ *
+ * @return The outputTypeName
+ */
+ public String getOutputTypeName() {
+ return this.outputTypeName;
+ }
+
+ // TODO inputAppinfo, outputAppinfo
+
+ /**
+ * @return The list of input WSComponentPorts
+ */
+ @Override
+ public List<WSComponentPort> getInputPorts() {
+ return this.inputs;
+ }
+
+ /**
+ * @return The list of output WSComponentPorts
+ */
+ @Override
+ public List<WSComponentPort> getOutputPorts() {
+ return this.outputs;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
+ */
+ @Override
+ public Node createNode(Graph graph) {
+ return createNode(graph, new WSNode(graph));
+ }
+
+ protected Node createNode(Graph graph, WSNode node) {
+
+ // Copy some infomation from the component
+
+ node.setName(getName());
+ node.setComponent(this);
+ // node.setWSDLQName(this.wsdlQName);
+
+ // Creates a unique ID for the node. This has to be after setName().
+ node.createID();
+
+ // Creat ports
+ createPorts(node);
+
+ return node;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.Component#toHTML()
+ */
+ @Override
+ public String toHTML() {
+
+ StringBuffer buf = new StringBuffer();
+ buf.append("<html>\n");
+ buf.append("<h1>Service: " + getName() + "</h1>\n");
+
+ buf.append("<h2>Description:</h2>\n");
+ buf.append(this.description);
+
+ buf.append("<h2>Operation: " + this.operationName + "</h2>\n");
+
+ if (getInputPorts().size()>0) {
+ buf.append("<h3>Input parameter(s)</h3>\n");
+ messageToHtml(getInputPorts(), buf);
+ }
+ if (getOutputPorts().size()>0) {
+ buf.append("<h3>Output parameter(s)</h3>\n");
+ messageToHtml(getOutputPorts(), buf);
+ }
+ buf.append("</html>\n");
+ return buf.toString();
+ }
+
+ /**
+ * @return The XML Element.
+ */
+ public XmlElement toXML() {
+ return this.wsdl.xml();
+ }
+
+ /**
+ * @return The WSDL in String.
+ */
+ public String toXMLText() {
+ return this.wsdl.xmlStringPretty();
+ }
+
+ private void messageToHtml(List<WSComponentPort> ports, StringBuffer buf) {
+ buf.append("<dl>\n");
+ for (WSComponentPort port : ports) {
+ buf.append("<dt><strong>" + port.getName() + "</strong></dt>\n");
+ buf.append("<dd>Type: " + port.getType().getLocalPart() + "</dd>\n");
+ if (port.getDescription() != null && !port.getDescription().equals("")) {
+ buf.append("<dd>Description: " + port.getDescription() + "</dd>\n");
+ }
+ }
+ buf.append("</dl>\n");
+ }
+
+ private void parse() throws ComponentException {
+
+ // The name of WSDL changes even with the same portType.
+ // this.name = this.definitions.getAttributeValue(null, "name");
+
+ this.targetNamespace = this.wsdl.getTargetNamespace();
+
+ String wsdlName = this.wsdl.xml().attributeValue(WSConstants.NAME_ATTRIBUTE);
+ if (wsdlName == null) {
+ wsdlName = "NoName"; // TODO
+ }
+ this.wsdlQName = new QName(this.targetNamespace, wsdlName);
+
+ WsdlDocumentation documentation = this.wsdl.getDocumentation();
+ if (documentation != null) {
+ StringBuffer buf = new StringBuffer();
+ for (Object child : documentation.xml().children()) {
+ if (child instanceof String) {
+ buf.append(child.toString());
+ } else if (child instanceof XmlCharacters) {
+ buf.append(((XmlCharacters) child).getText());
+ }
+ }
+ this.description = buf.toString();
+ }
+
+ WsdlPortType portType = this.wsdl.getPortType(this.portTypeQName.getLocalPart());
+ if (portType == null) {
+ throw new ComponentException("portType, " + this.portTypeQName + " is not defined.");
+ }
+ parsePortType(portType);
+ }
+
+ private void parsePortType(WsdlPortType portType) throws ComponentException {
+ WsdlPortTypeOperation operation = portType.getOperation(this.operationName);
+ if (operation == null) {
+ throw new ComponentException("Operation, " + this.operationName + " is not defined.");
+ }
+ parseOperation(operation);
+ }
+
+ private void parseOperation(WsdlPortTypeOperation operation) throws ComponentException {
+
+ WsdlPortTypeInput input = operation.getInput();
+ // No input is possible.
+ if (input != null) {
+ WsdlMessage inputMessage = input.lookupMessage();
+ this.inputs = parseMessage(inputMessage, true);
+ }
+
+ WsdlPortTypeOutput output = operation.getOutput();
+ // No output is possible.
+ if (output != null) {
+ WsdlMessage outputMessage = output.lookupMessage();
+ this.outputs = parseMessage(outputMessage, false);
+ }
+ }
+
+ private List<WSComponentPort> parseMessage(WsdlMessage message, boolean input) throws ComponentException {
+ List<WSComponentPort> parts = new ArrayList<WSComponentPort>();
+ for (WsdlMessagePart part : message.parts()) {
+ String partName = part.getName();
+ if (input) {
+ this.inputPartName = partName;
+ } else {
+ this.outputPartName = partName;
+ }
+
+ QName partElement = part.getElement();
+ if (partElement == null) {
+ // In case type is used directly. This is an old way.
+ QName partType = part.getType();
+ if (partType != null) {
+ parts.add(new WSComponentPort(partName, partType, this));
+ }
+
+ } else {
+ String typeName = partElement.getLocalPart();
+ if (input) {
+ this.inputTypeName = typeName;
+ } else {
+ this.outputTypeName = typeName;
+ }
+ parseType(typeName, parts);
+ }
+ }
+ return parts;
+ }
+
+ private void parseType(String typeName, List<WSComponentPort> parts) throws ComponentException {
+
+ XmlElement typesElement = this.wsdl.getTypes();
+ if (typesElement == null) {
+ throw new ComponentException("No types is defined.");
+ }
+
+ if (typesElement.element(null, WSConstants.SCHEMA_TAG) == null) {
+ throw new ComponentException("No schema is defined.");
+ }
+
+ XmlElement elementElement = null;
+ XmlElement schemaElement = null;
+
+ Iterable<XmlElement> schemaElements = typesElement.elements(null, WSConstants.SCHEMA_TAG);
+ for (XmlElement elemt : schemaElements) {
+ schemaElement = elemt;
+ elementElement = findElementElement(typeName, elemt);
+ if (null != elementElement) {
+ break;
+ }
+ }
+
+ if (elementElement == null) {
+ throw new ComponentException("No element is defined for " + typeName);
+ }
+ String typesTargetNamespace = schemaElement.attributeValue(WSConstants.TARGET_NAMESPACE_ATTRIBUTE);
+ String elementType = elementElement.attributeValue(WSConstants.TYPE_ATTRIBUTE);
+
+ XmlElement sequenceElement;
+ if (elementType == null) {
+ // anonymous type
+ XmlElement complexElement = elementElement.element(null, WSConstants.COMPLEX_TYPE_TAG);
+ if (complexElement == null) {
+ throw new ComponentException("We only support complexType as annonymous type: "
+ + XMLUtil.xmlElementToString(elementElement));
+ }
+ sequenceElement = complexElement.element(null, WSConstants.SEQUENCE_TAG);
+ // TODO Check if there is any other defined.
+ } else {
+ // named complexType
+ String elementTypeName = XMLUtil.getLocalPartOfQName(elementType);
+ XmlElement typeElement = findTypeElement(elementTypeName, schemaElement);
+ sequenceElement = typeElement.element(null, WSConstants.SEQUENCE_TAG);
+ // TODO Check if there is any other defined.
+ }
+
+ if (sequenceElement == null) {
+ // Assume that there is no input/output.
+ logger.info("There is no sequence defined.");
+ } else {
+ // Only supports elements in the sequence now.
+ for (XmlElement element : sequenceElement.elements(null, WSConstants.ELEMENT_TAG)) {
+ WSComponentPort componentPort = new WSComponentPort(element, typesTargetNamespace, this);
+ // Check if the type is defined in types
+ QName paramType = componentPort.getType();
+ if (!(WSConstants.XSD_NS_URI.equalsIgnoreCase(paramType.getNamespaceURI()))) {
+ XmlElement typeDefinition = null;
+ try {
+ typeDefinition = WSDLUtil.getTypeDefinition(this.wsdl, paramType);
+ } catch (UtilsException e) {
+ e.printStackTrace();
+ }
+ if (typeDefinition == null) {
+ throw new ComponentException("could not find definition for type " + paramType + " in "
+ + this.wsdlQName);
+ }
+ }
+ parts.add(componentPort);
+ }
+ }
+ }
+
+ /**
+ * @param typeName
+ * @param schemaElement
+ * @return The XmlElement
+ */
+ private XmlElement findElementElement(String typeName, XmlElement schemaElement) {
+ for (XmlElement element : schemaElement.elements(null, WSConstants.ELEMENT_TAG)) {
+ String elementName = element.attributeValue(WSConstants.NAME_ATTRIBUTE);
+ if (typeName.equals(elementName)) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param typeName
+ * @param schemaElement
+ * @return The XmlElement
+ */
+ private XmlElement findTypeElement(String typeName, XmlElement schemaElement) {
+ // Only supports complexType now
+ for (XmlElement complexTypeElement : schemaElement.elements(null, WSConstants.COMPLEX_TYPE_TAG)) {
+ String elementName = complexTypeElement.attributeValue(WSConstants.NAME_ATTRIBUTE);
+ if (typeName.equals(elementName)) {
+ return complexTypeElement;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java?rev=1339718&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java Thu May 17 17:12:15 2012
@@ -0,0 +1,147 @@
+/*
+ *
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.exception.UtilsException;
+import org.apache.airavata.common.utils.WSDLUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.utils.MessageConstants;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.wsdl.WsdlDefinitions;
+import xsul5.wsdl.WsdlPortType;
+import xsul5.wsdl.WsdlPortTypeOperation;
+
+public class WSComponentFactory {
+
+ /**
+ * @param wsdlString
+ * @return The list of components in the specified WSDL.
+ * @throws ComponentException
+ */
+ public static List<WSComponent> createComponents(String wsdlString) throws ComponentException {
+ try {
+ return createComponents(XMLUtil.stringToXmlElement(wsdlString));
+ } catch (RuntimeException e) {
+ throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
+ }
+
+ }
+
+ /**
+ * @param componentElement
+ * @return The list of components in the specified WSDL.
+ * @throws ComponentException
+ */
+ public static List<WSComponent> createComponents(XmlElement componentElement) throws ComponentException {
+ try {
+ WsdlDefinitions definitions = new WsdlDefinitions(componentElement);
+ return createComponents(definitions);
+ } catch (RuntimeException e) {
+ throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
+ }
+ }
+
+ /**
+ * @param wsdl
+ * @return The list of components in the specified WSDL.
+ * @throws ComponentException
+ */
+ public static List<WSComponent> createComponents(WsdlDefinitions wsdl) throws ComponentException {
+ List<WSComponent> components = new ArrayList<WSComponent>();
+ try {
+ QName portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
+ WsdlPortType portType = wsdl.getPortType(portTypeQName.getLocalPart());
+ for (WsdlPortTypeOperation operation : portType.operations()) {
+ String operationName = operation.getOperationName();
+ WSComponent component = createComponent(wsdl, portTypeQName, operationName);
+ components.add(component);
+ }
+ } catch (Exception e) {
+ throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
+ }
+ return components;
+ }
+
+ /**
+ * Creates a WSComponent.
+ *
+ * @param wsdlString
+ * The string representation of the component
+ * @return The WsdlComponent created
+ * @throws ComponentException
+ */
+ @Deprecated
+ public static WSComponent createComponent(String wsdlString) throws ComponentException {
+ return createComponents(wsdlString).get(0);
+ }
+
+ /**
+ * @param wsdl
+ * @return The Component created
+ * @throws ComponentException
+ */
+ public static WSComponent createComponent(WsdlDefinitions wsdl) throws ComponentException {
+ return createComponent(wsdl, null, null);
+ }
+
+ /**
+ * @param wsdl
+ * @param portTypeQName
+ * @param operationName
+ * @return The component created.
+ * @throws ComponentException
+ */
+ public static WSComponent createComponent(WsdlDefinitions wsdl, QName portTypeQName, String operationName)
+ throws ComponentException {
+ try {
+ if (portTypeQName == null) {
+ portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
+ }
+ if (operationName == null) {
+ operationName = WSDLUtil.getFirstOperationName(wsdl, portTypeQName);
+ }
+
+ // check if it's WSComponent or WorkflowComponent
+ WsdlPortType portType = wsdl.getPortType(portTypeQName.getLocalPart());
+ XmlElement templateIDElement = portType.xml().element(WorkflowComponent.GPEL_NAMESPACE,
+ WorkflowComponent.WORKFLOW_TEMPLATE_ID_TAG);
+ WSComponent component;
+ if (templateIDElement == null) {
+ component = new WSComponent(wsdl, portTypeQName, operationName);
+ } else {
+ component = new WorkflowComponent(wsdl, portTypeQName, operationName);
+ }
+ return component;
+ } catch (RuntimeException e) {
+ throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
+ } catch (UtilsException e) {
+ throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
+ }
+ }
+}
\ No newline at end of file