You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:05:16 UTC

[31/79] [partial] incubator-taverna-language git commit: Revert "temporarily empty repository"

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/DotProduct.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/DotProduct.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/DotProduct.java
new file mode 100644
index 0000000..486908b
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/DotProduct.java
@@ -0,0 +1,105 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.AbstractCloneable;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+
+/**
+ * @author Stian Soiland-Reyes
+ */
+@SuppressWarnings("serial")
+public class DotProduct extends ArrayList<IterationStrategyNode> implements
+		IterationStrategyTopNode {
+	private IterationStrategyParent parent;
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		if (visitor.visitEnter(this))
+			for (IterationStrategyNode strategy : this)
+				if (!strategy.accept(visitor))
+					break;
+		return visitor.visitLeave(this);
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		return o instanceof DotProduct && super.equals(o);
+	}
+
+	@Override
+	public IterationStrategyParent getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(IterationStrategyParent newParent) {
+		if (parent == newParent)
+			return;
+
+		if (parent != null) {
+			// Remove from old parent
+			if (parent instanceof IterationStrategyStack) {
+				IterationStrategyStack stack = (IterationStrategyStack) parent;
+				stack.remove(this);
+			} else if (parent instanceof DotProduct
+					|| parent instanceof CrossProduct) {
+				@SuppressWarnings("unchecked")
+				List<IterationStrategyNode> parentList = (List<IterationStrategyNode>) parent;
+				parentList.remove(this);
+			} else
+				throw new IllegalArgumentException(
+						"Old parent must be a IterationStrategy, DotProduct or CrossProduct: "
+								+ parent);
+		}
+
+		parent = newParent;
+		if (parent instanceof IterationStrategyStack) {
+			IterationStrategyStack stack = (IterationStrategyStack) parent;
+			if (!stack.contains(this))
+				stack.add(this);
+		} else if (parent instanceof DotProduct
+				|| parent instanceof CrossProduct) {
+			@SuppressWarnings("unchecked")
+			List<IterationStrategyNode> parentList = (List<IterationStrategyNode>) parent;
+			if (!parentList.contains(this))
+				parentList.add(this);
+		} else
+			throw new IllegalArgumentException(
+					"Parent must be a IterationStrategy, DotProduct or CrossProduct: "
+							+ parent);
+	}
+
+	@Override
+	public WorkflowBean clone() {
+		return AbstractCloneable.cloneWorkflowBean(this);
+	}
+
+	@Override
+	public String toString() {
+		return getClass().getSimpleName() + super.toString();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyNode.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyNode.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyNode.java
new file mode 100644
index 0000000..4fa1982
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyNode.java
@@ -0,0 +1,30 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.Child;
+
+/**
+ * @author Alan R Williams
+ */
+public interface IterationStrategyNode extends
+		Child<IterationStrategyParent> {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyParent.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyParent.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyParent.java
new file mode 100644
index 0000000..8b38fe2
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyParent.java
@@ -0,0 +1,26 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+public interface IterationStrategyParent extends WorkflowBean {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyStack.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyStack.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyStack.java
new file mode 100644
index 0000000..3fe0ee1
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyStack.java
@@ -0,0 +1,86 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.AbstractCloneable;
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+
+@SuppressWarnings("serial")
+public class IterationStrategyStack extends ArrayList<IterationStrategyTopNode>
+		implements List<IterationStrategyTopNode>, Child<Processor>,
+		IterationStrategyParent {
+	private Processor parent;
+
+	public IterationStrategyStack() {
+	}
+
+	public IterationStrategyStack(Processor parent) {
+		setParent(parent);
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		return o instanceof IterationStrategyStack && super.equals(o);
+	}
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		if (visitor.visitEnter(this))
+			for (IterationStrategyTopNode strategy : this)
+				if (!strategy.accept(visitor))
+					break;
+		return visitor.visitLeave(this);
+	}
+
+	@Override
+	public Processor getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Processor parent) {
+		if (this.parent == parent)
+			return;
+		if (this.parent != null
+				&& this.parent.getIterationStrategyStack() == this)
+			this.parent.setIterationStrategyStack(null);
+		this.parent = parent;
+		if (parent != null && parent.getIterationStrategyStack() != this)
+			parent.setIterationStrategyStack(this);
+	}
+
+	@Override
+	public WorkflowBean clone() {
+		return AbstractCloneable.cloneWorkflowBean(this);
+	}
+
+	@Override
+	public String toString() {
+		return getClass().getSimpleName() + " for " + getParent();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyTopNode.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyTopNode.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyTopNode.java
new file mode 100644
index 0000000..ceb7d19
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/IterationStrategyTopNode.java
@@ -0,0 +1,30 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import java.util.List;
+
+/**
+ * @author Stian Soiland-Reyes
+ */
+public interface IterationStrategyTopNode extends IterationStrategyNode,
+		List<IterationStrategyNode>, IterationStrategyParent {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/PortNode.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/PortNode.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/PortNode.java
new file mode 100644
index 0000000..12cf537
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/PortNode.java
@@ -0,0 +1,188 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.AbstractCloneable;
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.URITools;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+
+
+public class PortNode extends AbstractCloneable implements IterationStrategyNode {
+	private InputProcessorPort inputProcessorPort;
+
+	private IterationStrategyParent parent;
+	private Integer desiredDepth;
+
+	public PortNode() {
+	}
+
+	public PortNode(IterationStrategyParent parent,
+			InputProcessorPort inputProcessorPort) {
+		setParent(parent);
+		setInputProcessorPort(inputProcessorPort);
+	}
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		return visitor.visit(this);
+	}
+
+	public Integer getDesiredDepth() {
+		return desiredDepth;
+	}
+
+	public InputProcessorPort getInputProcessorPort() {
+		return inputProcessorPort;
+	}
+
+	@Override
+	public IterationStrategyParent getParent() {
+		return parent;
+	}
+
+	public void setDesiredDepth(Integer desiredDepth) {
+		this.desiredDepth = desiredDepth;
+	}
+
+	public void setInputProcessorPort(InputProcessorPort inputProcessorPort) {
+		this.inputProcessorPort = inputProcessorPort;
+	}
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((desiredDepth == null) ? 0 : desiredDepth.hashCode());
+        result = prime
+                * result
+                + ((inputProcessorPort == null) ? 0 : inputProcessorPort
+                        .hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof PortNode))
+            return false;
+        PortNode other = (PortNode) obj;
+        if (desiredDepth == null) {
+            if (other.desiredDepth != null)
+                return false;
+        } else if (!desiredDepth.equals(other.desiredDepth))
+            return false;
+        if (inputProcessorPort == null) {
+            if (other.inputProcessorPort != null)
+                return false;
+        } else if (!inputProcessorPort.equals(other.inputProcessorPort))
+            return false;
+        return true;
+    }
+
+	private static boolean saneParent(IterationStrategyParent node) {
+		return (node == null) || (node instanceof DotProduct)
+				|| (node instanceof CrossProduct);
+	}
+
+    @Override
+	public void setParent(IterationStrategyParent newParent) {
+		if (parent == newParent)
+			return;
+		if (!saneParent(newParent))
+			throw new IllegalArgumentException(
+					"PortNode parent must be a DotProduct or CrossProduct: "
+							+ parent);
+
+		if (parent != null) {
+			// Remove from old parent
+			if (!saneParent(parent))
+				throw new IllegalArgumentException(
+						"Old PortNode parent must be a DotProduct or CrossProduct: "
+								+ parent);
+			@SuppressWarnings("unchecked")
+			List<IterationStrategyNode> parentList = (List<IterationStrategyNode>) parent;
+			parentList.remove(this);
+		}
+
+		parent = newParent;
+		@SuppressWarnings("unchecked")
+		List<IterationStrategyNode> parentList = (List<IterationStrategyNode>) parent;
+		if (!parentList.contains(this))
+			parentList.add(this);
+	}
+	
+	@Override
+	public String toString() {
+		return getClass().getSimpleName()  + " for " + getInputProcessorPort();
+	}
+	
+	@Override
+	protected void cloneInto(WorkflowBean clone, Cloning cloning) {
+		PortNode cloneNode = (PortNode)clone;
+		cloneNode.setDesiredDepth(getDesiredDepth());
+		cloneNode.setInputProcessorPort(cloning.cloneOrOriginal(getInputProcessorPort()));		
+	}
+
+	// Derived operations
+
+	/**
+	 * Get all the annotations that pertain to this port node.
+	 * 
+	 * @return The collection of annotations.
+	 * @see Scufl2Tools#annotationsFor(Child)
+	 */
+	public Collection<Annotation> getAnnotations() {
+		return getTools().annotationsFor(this);
+	}
+
+	/**
+	 * Get the URI of this port node.
+	 * 
+	 * @return The absolute URI.
+	 * @see URITools#uriForBean(WorkflowBean)
+	 */
+	public URI getURI() {
+		return getUriTools().uriForBean(this);
+	}
+
+	/**
+	 * Get the URI of this port node relative to another workflow element.
+	 * 
+	 * @return The relative URI.
+	 * @see URITools#relativeUriForBean(WorkflowBean,WorflowBean)
+	 */
+	public URI getRelativeURI(WorkflowBean relativeTo) {
+		return getUriTools().relativeUriForBean(this, relativeTo);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/package-info.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/package-info.java
new file mode 100644
index 0000000..02d2df8
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/iterationstrategy/package-info.java
@@ -0,0 +1,22 @@
+package org.apache.taverna.scufl2.api.iterationstrategy;
+
+/*
+ * 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.
+ */
+
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/package-info.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/package-info.java
new file mode 100644
index 0000000..f571661
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/package-info.java
@@ -0,0 +1,49 @@
+/**
+ * Scufl2 Workflow language API
+ * <p>
+ * A {@link org.apache.taverna.scufl2.api.container.WorkflowBundle} is
+ * the main entry point for description of a workflow. It contains
+ * several {@link org.apache.taverna.scufl2.api.core.Workflow Workflows}, one
+ * of which is the
+ * {@link org.apache.taverna.scufl2.api.container.WorkflowBundle#getMainWorkflow()}.
+ * A workflow is configured for execution in a
+ * {@link org.apache.taverna.scufl2.api.profiles.Profile Profile}, one of which is
+ * the {@link org.apache.taverna.scufl2.api.container.WorkflowBundle#getMainProfile()}.
+ * <p>
+ * You can load and save WorkflowBundle instances using 
+ * {@link org.apache.taverna.scufl2.api.io.WorkflowBundleIO} as long as the 
+ * implementations from the modules scufl2-t2flow and scufl2-rdfxml are
+ * discoverable the classpath or available as OSGi services, alternatively
+ * implementations of {@link org.apache.taverna.scufl2.api.io.WorkflowBundleReader}
+ * and {@link org.apache.taverna.scufl2.api.io.WorkflowBundleWriter} can be used independently.
+ * <p>
+ * Also see <a href="http://dev.mygrid.org.uk/wiki/display/developer/SCUFL2+API">SCUFL 2 API in myGrid wiki</a> and 
+ * the <a href="https://github.com/myGrid/scufl2">scufl2 github projecT</a>.
+ *  
+ *  @author Stian Soiland-Reyes
+ *  @author Alan Williams
+ *  @author David Withers
+ *  @author Paolo Missier
+ */
+package org.apache.taverna.scufl2.api;
+
+/*
+ * 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.
+ */
+
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractDepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractDepthPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractDepthPort.java
new file mode 100644
index 0000000..196722b
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractDepthPort.java
@@ -0,0 +1,91 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * Abstract implementation of a <code>Port</code> that has a depth property.
+ * <p>
+ * The depth of a <code>Port </code> specifies whether the data is a list and
+ * how deep lists are nested. A depth of 0 is a single element, depth 1 is a
+ * list, depth 2 is a list of lists and so on.
+ * 
+ * @author Alan R Williams
+ */
+public abstract class AbstractDepthPort extends AbstractNamed implements
+		DepthPort {
+	private Integer depth;
+
+	/**
+	 * Constructs an <code>AbstractDepthPort</code> with a random UUID as the
+	 * name.
+	 */
+	public AbstractDepthPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>AbstractDepthPort</code> with the specified name.
+	 * 
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public AbstractDepthPort(String name) {
+		super(name);
+	}
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		return visitor.visit(this);
+	}
+
+	/**
+	 * Returns the depth of the <code>Port</code>.
+	 * 
+	 * @return the depth of the <code>Port</code>
+	 */
+	@Override
+	public Integer getDepth() {
+		return depth;
+	}
+
+	/**
+	 * Sets the depth of the <code>Port</code>.
+	 * 
+	 * @param depth
+	 *            the depth of the <code>Port</code>
+	 */
+	@Override
+	public void setDepth(Integer depth) {
+		this.depth = depth;
+	}
+
+	@Override
+	protected void cloneInto(WorkflowBean clone, Cloning cloning) {
+		super.cloneInto(clone, cloning);
+		AbstractDepthPort clonePort = (AbstractDepthPort) clone;
+		clonePort.setDepth(getDepth());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractGranularDepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractGranularDepthPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractGranularDepthPort.java
new file mode 100644
index 0000000..eb95584
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/AbstractGranularDepthPort.java
@@ -0,0 +1,90 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * Abstract implementation of a <code>Port</code> that has a granular depth
+ * property.
+ * <p>
+ * The granular depth of a <code>Port </code> specifies the granularity of the
+ * depth at which data is emitted. The granular depth must be less than or equal
+ * to the depth.
+ * <p>
+ * For example, if a <code>Port</code> has a depth of 1 and a granular depth of
+ * 0 the <code>Port</code> will emit each element of the list separately.
+ * 
+ * @author Alan R Williams
+ * 
+ */
+public abstract class AbstractGranularDepthPort extends AbstractDepthPort
+		implements GranularDepthPort {
+	private Integer granularDepth;
+
+	/**
+	 * Constructs an <code>AbstractGranularDepthPort</code> with a random UUID
+	 * as the name.
+	 */
+	public AbstractGranularDepthPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>AbstractGranularDepthPort</code> with the specified
+	 * name.
+	 * 
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public AbstractGranularDepthPort(String name) {
+		super(name);
+	}
+
+	/**
+	 * Returns the granular depth of the <code>Port</code>.
+	 * 
+	 * @return the granular depth of the <code>Port</code>
+	 */
+	@Override
+	public Integer getGranularDepth() {
+		return granularDepth;
+	}
+
+	/**
+	 * Sets the granular depth of the <code>Port</code>.
+	 * 
+	 * @param granularDepth
+	 *            the granular depth of the <code>Port</code>
+	 */
+	@Override
+	public void setGranularDepth(Integer granularDepth) {
+		this.granularDepth = granularDepth;
+	}
+
+	@Override
+	protected void cloneInto(WorkflowBean clone, Cloning cloning) {
+		super.cloneInto(clone, cloning);
+		AbstractGranularDepthPort clonePort = (AbstractGranularDepthPort) clone;
+		clonePort.setGranularDepth(getGranularDepth());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ActivityPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ActivityPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ActivityPort.java
new file mode 100644
index 0000000..5f1d54f
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ActivityPort.java
@@ -0,0 +1,32 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Child;
+
+/**
+ * A <code>Port</code> that specifies the data consumed or produced by an
+ * {@link Activity}.
+ */
+public interface ActivityPort extends DepthPort, Child<Activity> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/DepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/DepthPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/DepthPort.java
new file mode 100644
index 0000000..55a7bad
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/DepthPort.java
@@ -0,0 +1,38 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+public interface DepthPort extends Port {
+	/**
+	 * Returns the depth of the <code>Port</code>.
+	 * 
+	 * @return the depth of the <code>Port</code>
+	 */
+	Integer getDepth();
+
+	/**
+	 * Sets the depth of the <code>Port</code>.
+	 * 
+	 * @param depth
+	 *            the depth of the <code>Port</code>
+	 */
+	void setDepth(Integer depth);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/GranularDepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/GranularDepthPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/GranularDepthPort.java
new file mode 100644
index 0000000..187fdbb
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/GranularDepthPort.java
@@ -0,0 +1,38 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+public interface GranularDepthPort extends DepthPort {
+	/**
+	 * Returns the granular depth of the <code>Port</code>.
+	 * 
+	 * @return the granular depth of the <code>Port</code>
+	 */
+	Integer getGranularDepth();
+
+	/**
+	 * Sets the granular depth of the <code>Port</code>.
+	 * 
+	 * @param granularDepth
+	 *            the granular depth of the <code>Port</code>
+	 */
+	void setGranularDepth(Integer granularDepth);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputActivityPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputActivityPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputActivityPort.java
new file mode 100644
index 0000000..a3825dd
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputActivityPort.java
@@ -0,0 +1,77 @@
+/**
+ * 
+ */
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * An <code>InputActivityPort</code> is a <Port> that inputs data to an
+ * {@link Activity}.
+ * 
+ * @author Alan R Williams
+ */
+public class InputActivityPort extends AbstractDepthPort implements
+		ActivityPort, InputPort {
+	private Activity parent;
+
+	/**
+	 * Constructs an <code>InputActivityPort</code> with a random UUID as the
+	 * name.
+	 */
+	public InputActivityPort() {
+	}
+
+	/**
+	 * Constructs an <code>InputPort</code> for the specified
+	 * <code>Activity</code> with the specified name.
+	 * <p>
+	 * The <code>InputPort</code> is added to the <code>Activity</code> (if the
+	 * <code>Activity</code> is not <code>null</code>).
+	 * 
+	 * @param activity
+	 *            the <code>Activity</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public InputActivityPort(Activity activity, String name) {
+		super(name);
+		setParent(activity);
+	}
+
+	@Override
+	public Activity getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Activity parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getInputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getInputPorts().add(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputPort.java
new file mode 100644
index 0000000..2988b5c
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputPort.java
@@ -0,0 +1,29 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * A <code>Port</code> that specifies inputs to a {@link org.apache.taverna.scufl2.api.core.Workflow
+ * Workflow} component.
+ */
+public interface InputPort extends DepthPort {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputProcessorPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputProcessorPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputProcessorPort.java
new file mode 100644
index 0000000..7a05a91
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputProcessorPort.java
@@ -0,0 +1,92 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+
+/**
+ * An <code>InputProcessorPort</code> is a <Port> that inputs data to a
+ * {@link Processor}.
+ * 
+ * @author Alan R Williams
+ */
+public class InputProcessorPort extends AbstractDepthPort implements
+		ReceiverPort, ProcessorPort, InputPort {
+	private Processor parent;
+
+	/**
+	 * Constructs an <code>InputProcessorPort</code> with a random UUID as the
+	 * name.
+	 */
+	public InputProcessorPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>InputProcessorPort</code> for the specified
+	 * <code>Processor</code> with the specified name.
+	 * <p>
+	 * The <code>InputPort</code> is added to the <code>Processor</code> (if the
+	 * <code>Processor</code> is not <code>null</code>).
+	 * 
+	 * @param parent
+	 *            the <code>Processor</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public InputProcessorPort(Processor parent, String name) {
+		super(name);
+		setParent(parent);
+	}
+
+	@Override
+	public Processor getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Processor parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getInputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getInputPorts().add(this);
+	}
+
+	// Derived operations, implemented via Scufl2Tools
+
+	/**
+	 * Get the datalinks leading to this port.
+	 * 
+	 * @return the collection of links.
+	 * @see Scufl2Tools#datalinksFrom(ReceiverPort)
+	 */
+	public List<DataLink> getDatalinksTo() {
+		return getTools().datalinksTo(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputWorkflowPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputWorkflowPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputWorkflowPort.java
new file mode 100644
index 0000000..4c84fb5
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/InputWorkflowPort.java
@@ -0,0 +1,92 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+
+/**
+ * An <code>InputWorkflowPort</code> is a <Port> that inputs data to a
+ * {@link Workflow}.
+ * 
+ * @author Alan R Williams
+ */
+public class InputWorkflowPort extends AbstractDepthPort implements SenderPort,
+		WorkflowPort, InputPort {
+	private Workflow parent;
+
+	/**
+	 * Constructs an <code>InputWorkflowPort</code> with a random UUID as the
+	 * name.
+	 */
+	public InputWorkflowPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>InputWorkflowPort</code> for the specified
+	 * <code>Workflow</code> with the specified name.
+	 * <p>
+	 * The <code>InputPort</code> is added to the <code>Workflow</code> (if the
+	 * <code>Workflow</code> is not <code>null</code>).
+	 * 
+	 * @param parent
+	 *            the <code>Workflow</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public InputWorkflowPort(Workflow parent, String name) {
+		super(name);
+		setParent(parent);
+	}
+
+	@Override
+	public Workflow getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Workflow parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getInputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getInputPorts().add(this);
+	}
+
+	// Derived operations, implemented via Scufl2Tools
+
+	/**
+	 * Get the datalinks leading from this port.
+	 * 
+	 * @return the collection of links.
+	 * @see Scufl2Tools#datalinksFrom(SenderPort)
+	 */
+	public List<DataLink> getDatalinksFrom() {
+		return getTools().datalinksFrom(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputActivityPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputActivityPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputActivityPort.java
new file mode 100644
index 0000000..f146d5f
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputActivityPort.java
@@ -0,0 +1,77 @@
+/**
+ * 
+ */
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * An <code>OutputActivityPort</code> is a <Port> that outputs data from an
+ * {@link Activity}.
+ * 
+ * @author Alan R Williams
+ */
+public class OutputActivityPort extends AbstractGranularDepthPort implements
+		ActivityPort, OutputPort, GranularDepthPort {
+	private Activity parent;
+
+	/**
+	 * Constructs an <code>OutputActivityPort</code> with a random UUID as the
+	 * name.
+	 */
+	public OutputActivityPort() {
+	}
+
+	/**
+	 * Constructs an <code>OutputPort</code> for the specified
+	 * <code>Activity</code> with the specified name.
+	 * <p>
+	 * The <code>OutputPort</code> is added to the <code>Activity</code> (if the
+	 * <code>Activity</code> is not <code>null</code>).
+	 * 
+	 * @param activity
+	 *            the <code>Activity</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public OutputActivityPort(Activity activity, String name) {
+		super(name);
+		setParent(activity);
+	}
+
+	@Override
+	public Activity getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Activity parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getOutputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getOutputPorts().add(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputPort.java
new file mode 100644
index 0000000..519b177
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputPort.java
@@ -0,0 +1,29 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * A <code>Port</code> that specifies outputs from a {@link org.apache.taverna.scufl2.api.core.Workflow
+ * Workflow} component.
+ */
+public interface OutputPort extends Port {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputProcessorPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputProcessorPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputProcessorPort.java
new file mode 100644
index 0000000..f8e0d56
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputProcessorPort.java
@@ -0,0 +1,90 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+
+/**
+ * An <code>OutputProcessorPort</code> is a <Port> that outputs data from a
+ * {@link Processor}.
+ */
+public class OutputProcessorPort extends AbstractGranularDepthPort implements
+		SenderPort, ProcessorPort, OutputPort, GranularDepthPort {
+	private Processor parent;
+
+	/**
+	 * Constructs an <code>OutputProcessorPort</code> with a random UUID as the
+	 * name.
+	 */
+	public OutputProcessorPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>OutputProcessorPort</code> for the specified
+	 * <code>Processor</code> with the specified name.
+	 * <p>
+	 * The <code>OutputPort</code> is added to the <code>Processor</code> (if
+	 * the <code>Processor</code> is not <code>null</code>).
+	 * 
+	 * @param parent
+	 *            the <code>Processor</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public OutputProcessorPort(Processor parent, String name) {
+		super(name);
+		setParent(parent);
+	}
+
+	@Override
+	public Processor getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Processor parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getOutputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getOutputPorts().add(this);
+	}
+
+	// Derived operations, implemented via Scufl2Tools
+
+	/**
+	 * Get the datalinks leading from this port.
+	 * 
+	 * @return the collection of links.
+	 * @see Scufl2Tools#datalinksFrom(SenderPort)
+	 */
+	public List<DataLink> getDatalinksFrom() {
+		return getTools().datalinksFrom(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputWorkflowPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputWorkflowPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputWorkflowPort.java
new file mode 100644
index 0000000..2fa4902
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/OutputWorkflowPort.java
@@ -0,0 +1,99 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+
+/**
+ * An <code>OutputWorkflowPort</code> is a <Port> that outputs data from a
+ * {@link Workflow}.
+ * 
+ * @author Alan R Williams
+ */
+public class OutputWorkflowPort extends AbstractNamed implements ReceiverPort,
+		WorkflowPort, OutputPort {
+	private Workflow parent;
+
+	/**
+	 * Constructs an <code>OutputWorkflowPort</code> with a random UUID as the
+	 * name.
+	 */
+	public OutputWorkflowPort() {
+		super();
+	}
+
+	/**
+	 * Constructs an <code>OutputWorkflowPort</code> for the specified
+	 * <code>Workflow</code> with the specified name.
+	 * <p>
+	 * The <code>OutputPort</code> is added to the <code>Workflow</code> (if the
+	 * <code>Workflow</code> is not <code>null</code>).
+	 * 
+	 * @param parent
+	 *            the <code>Workflow</code> to add this <code>Port</code> to.
+	 *            Can be <code>null</code>
+	 * @param name
+	 *            the name of the <code>Port</code>. <strong>Must not</strong>
+	 *            be <code>null</code> or an empty String.
+	 */
+	public OutputWorkflowPort(Workflow parent, String name) {
+		super(name);
+		setParent(parent);
+	}
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		return visitor.visit(this);
+	}
+
+	@Override
+	public Workflow getParent() {
+		return parent;
+	}
+
+	@Override
+	public void setParent(Workflow parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getOutputPorts().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getOutputPorts().add(this);
+	}
+
+	// Derived operations, implemented via Scufl2Tools
+
+	/**
+	 * Get the datalinks leading to this port.
+	 * 
+	 * @return the collection of links.
+	 * @see Scufl2Tools#datalinksFrom(ReceiverPort)
+	 */
+	public List<DataLink> getDatalinksTo() {
+		return getTools().datalinksTo(this);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/Port.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/Port.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/Port.java
new file mode 100644
index 0000000..fda9af9
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/Port.java
@@ -0,0 +1,32 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.Named;
+
+/**
+ * A <code>Port</code> specifies the data consumed or produced by a
+ * {@link org.apache.taverna.scufl2.api.core.Workflow Workflow} component.
+ * 
+ * @author Alan R Williams
+ */
+public interface Port extends Named {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ProcessorPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ProcessorPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ProcessorPort.java
new file mode 100644
index 0000000..cb9d3d0
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ProcessorPort.java
@@ -0,0 +1,33 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+/**
+ * A <code>Port</code> that specifies the data consumed or produced by an
+ * {@link Processor}.
+ *
+ * @author Alan R Williams
+ */
+public interface ProcessorPort extends Port, Child<Processor> {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ReceiverPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ReceiverPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ReceiverPort.java
new file mode 100644
index 0000000..19d5c72
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/ReceiverPort.java
@@ -0,0 +1,36 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * A <code>Port</code> that receives data from a {@link DataLink} in a {@link Workflow}.
+ * 
+ * @see SenderPort
+ * @see DataLink
+ * @author Alan R Williams
+ * @author Stian Soiland-Reyes
+ */
+public interface ReceiverPort extends Port {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/SenderPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/SenderPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/SenderPort.java
new file mode 100644
index 0000000..6b9c1df
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/SenderPort.java
@@ -0,0 +1,36 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * A <code>Port</code> that sends data out to a {@link DataLink} in a {@link Workflow}.
+ * 
+ * @see DataLink
+ * @see Workflow
+ * @author Alan R Williams
+ * @author Stian Soiland-Reyes
+ */
+public interface SenderPort extends Port {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/WorkflowPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/WorkflowPort.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/WorkflowPort.java
new file mode 100644
index 0000000..5a16c70
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/WorkflowPort.java
@@ -0,0 +1,34 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * A <code>Port</code> that specifies the data consumed or produced by an
+ * {@link Workflow}.
+ *
+ * @author Alan R Williams
+ */
+public interface WorkflowPort extends Port, Child<Workflow> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/package-info.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/package-info.java
new file mode 100644
index 0000000..aef7b72
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/port/package-info.java
@@ -0,0 +1,23 @@
+package org.apache.taverna.scufl2.api.port;
+
+/*
+ * 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.
+ */
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorBinding.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorBinding.java
new file mode 100644
index 0000000..40afcc4
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorBinding.java
@@ -0,0 +1,235 @@
+package org.apache.taverna.scufl2.api.profiles;
+
+/*
+ * 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.
+ */
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+
+/**
+ * A <code>ProcessorBinding</code> specifies that when enacting a
+ * {@link org.apache.taverna.scufl2.api.core.Workflow Workflow}, if this particular
+ * <code>ProcessorBinding</code> is used, then the boundActivity will be used to
+ * implement the boundProcessor.
+ * <p>
+ * The <code>ProcessorBinding</code> specifies the sets of input and output port
+ * bindings for the ports of the {@link Processor}. Note that there may not need
+ * to be a binding for every <code>Processor</code> port, nor for every
+ * {@link Activity} port. However, the ports must be of the bound
+ * <code>Processor</code> and <code>Activity</code>.
+ * <p>
+ * It has not been decided if the binding must be unique for a given
+ * <code>Processor</code> or <code>Activity</code> port within a
+ * <code>ProcessorBinding</code>.
+ * 
+ * @author Alan R Williams
+ */
+public class ProcessorBinding extends AbstractNamed implements Child<Profile> {
+	private Processor boundProcessor;
+	private Activity boundActivity;
+
+	private Set<ProcessorInputPortBinding> inputPortBindings = new HashSet<>();
+	private Set<ProcessorOutputPortBinding> outputPortBindings = new HashSet<>();
+
+	private Integer activityPosition;
+	private Profile parent;
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		if (visitor.visitEnter(this)) {
+			List<Iterable<? extends WorkflowBean>> children = new ArrayList<>();
+			if (getInputPortBindings() != null)
+				children.add(getInputPortBindings());
+			if (getOutputPortBindings() != null)
+				children.add(getOutputPortBindings());
+			outer: for (Iterable<? extends WorkflowBean> it : children)
+				for (WorkflowBean bean : it)
+					if (!bean.accept(visitor))
+						break outer;
+		}
+		return visitor.visitLeave(this);
+	}
+
+	/**
+	 * Returns the relative position of the bound <code>Activity</code> within
+	 * the <code>Processor</code> (for the purpose of Failover).
+	 * <p>
+	 * <code>Activity</code>s will be ordered by this position. Gaps will be
+	 * ignored, overlapping <code>Activity</code> positions will have an
+	 * undetermined order.
+	 * 
+	 * @return the relative position of the bound <code>Activity</code> within
+	 *         the <code>Processor</code>
+	 */
+	public final Integer getActivityPosition() {
+		return activityPosition;
+	}
+
+	/**
+	 * Returns the <code>Activity</code> that will be used to enact the
+	 * <code>Processor</code> if this ProcessorBinding is used.
+	 * 
+	 * @return the <code>Activity</code> that will be used to enact the
+	 *         <code>Processor</code>
+	 */
+	public Activity getBoundActivity() {
+		return boundActivity;
+	}
+
+	/**
+	 * Returns the <code>Processor</code> for which a possible means of
+	 * enactment is specified.
+	 * 
+	 * @return the <code>Processor</code> for which a possible means of
+	 *         enactment is specified
+	 */
+	public Processor getBoundProcessor() {
+		return boundProcessor;
+	}
+
+	/**
+	 * Returns the bindings for individual input ports of the bound
+	 * <code>Processor</code>.
+	 * 
+	 * @return the bindings for individual input ports of the bound
+	 *         <code>Processor</code>
+	 */
+	public Set<ProcessorInputPortBinding> getInputPortBindings() {
+		return inputPortBindings;
+	}
+
+	/**
+	 * Returns the bindings for individual output ports of the bound
+	 * <code>Processor</code>.
+	 * 
+	 * @return the bindings for individual output ports of the bound
+	 *         <code>Processor</code>
+	 */
+	public Set<ProcessorOutputPortBinding> getOutputPortBindings() {
+		return outputPortBindings;
+	}
+
+	@Override
+	public Profile getParent() {
+		return parent;
+	}
+
+	/**
+	 * Sets the relative position of the bound <code>Activity</code> within the
+	 * processor (for the purpose of Failover).
+	 * <p>
+	 * <code>Activity</code>s will be ordered by this position. Gaps will be
+	 * ignored, overlapping <code>Activity</code> positions will have an
+	 * undetermined order.
+	 * 
+	 * @param activityPosition
+	 *            the relative position of the bound <code>Activity</code>
+	 *            within the <code>Processor</code>
+	 */
+	public void setActivityPosition(Integer activityPosition) {
+		this.activityPosition = activityPosition;
+	}
+
+	/**
+	 * Sets the Activity that will be used to enact the <code>Processor</code>
+	 * if this ProcessorBinding is used.
+	 * 
+	 * @param boundActivity
+	 *            the Activity that will be used to enact the
+	 *            <code>Processor</code>
+	 */
+	public void setBoundActivity(Activity boundActivity) {
+		this.boundActivity = boundActivity;
+	}
+
+	/**
+	 * Sets the <code>Processor</code> for which a possible means of enactment
+	 * is specified.
+	 * 
+	 * @param boundProcessor
+	 *            the <code>Processor</code> for which a possible means of
+	 *            enactment is specified
+	 */
+	public void setBoundProcessor(Processor boundProcessor) {
+		this.boundProcessor = boundProcessor;
+	}
+
+	/**
+	 * Sets the bindings for individual input ports of the bound
+	 * <code>Processor</code>.
+	 * 
+	 * @param inputPortBindings
+	 *            the bindings for individual input ports of the bound
+	 *            <code>Processor</code>
+	 */
+	public void setInputPortBindings(
+			Set<ProcessorInputPortBinding> inputPortBindings) {
+		this.inputPortBindings = inputPortBindings;
+	}
+
+	/**
+	 * Sets the bindings for individual output ports of the bound
+	 * <code>Processor</code>.
+	 * 
+	 * @param outputPortBindings
+	 *            the bindings for individual output ports of the bound
+	 *            <code>Processor</code>
+	 */
+	public void setOutputPortBindings(
+			Set<ProcessorOutputPortBinding> outputPortBindings) {
+		this.outputPortBindings = outputPortBindings;
+	}
+
+	@Override
+	public void setParent(Profile parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getProcessorBindings().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getProcessorBindings().add(this);
+	}
+
+	@Override
+	public String toString() {
+		return getClass().getSimpleName() + " " + getBoundProcessor() + " "
+				+ getBoundActivity();
+	}
+
+	@Override
+	protected void cloneInto(WorkflowBean clone, Cloning cloning) {
+		super.cloneInto(clone, cloning);
+		ProcessorBinding cloneBinding = (ProcessorBinding) clone;
+		cloneBinding.setActivityPosition(getActivityPosition());
+		cloneBinding.setBoundProcessor(cloning
+				.cloneOrOriginal(getBoundProcessor()));
+		cloneBinding.setBoundActivity(cloning
+				.cloneOrOriginal(getBoundActivity()));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorInputPortBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorInputPortBinding.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorInputPortBinding.java
new file mode 100644
index 0000000..5ff342f
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorInputPortBinding.java
@@ -0,0 +1,140 @@
+/**
+ *
+ */
+package org.apache.taverna.scufl2.api.profiles;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+
+/**
+ * A <code>ProcessorInputPortBinding</code> specifies the
+ * <code>InputActivityPort</code> to which data passed into an
+ * <code>InputProcessorPort</code> is sent.
+ * 
+ * Note that the <code>InputProcessorPort</code> must be a
+ * {@link org.apache.taverna.scufl2.api.port.Port Port} of the
+ * {@link org.apache.taverna.scufl2.api.core.Processor Processor} of the parent
+ * <code>ProcessorBinding</code>. The <code>InputActivityPort</code> must be a
+ * <code>Port</code> of the {@link org.apache.taverna.scufl2.api.activity.Activity
+ * Activity} of the parent <code>ProcessorBinding</code>.
+ * 
+ * @author Alan R Williams
+ * @author Stian Soiland-Reyes
+ */
+public class ProcessorInputPortBinding extends
+		ProcessorPortBinding<InputActivityPort, InputProcessorPort> {
+	private ProcessorBinding parent;
+
+	/**
+	 * Constructs a <code>ProcessorInputPortBinding</code> with no binding set.
+	 */
+	public ProcessorInputPortBinding() {
+	}
+
+	/**
+	 * Constructs a <code>ProcessorInputPortBinding</code> for the specified
+	 * <code>ProcessorBinding</code>.
+	 * 
+	 * @param processorBinding
+	 *            the <code>ProcessorBinding</code> to add this
+	 *            <code>ProcessorInputPortBinding</code> to. Can be
+	 *            <code>null</code>
+	 * @param processorPort
+	 *            the bound <code>InputProcessorPort</code>. Can be
+	 *            <code>null</code>
+	 * @param activityPort
+	 *            the bound <code>InputActivityPort</code>. Can be
+	 *            <code>null</code>
+	 */
+	public ProcessorInputPortBinding(ProcessorBinding processorBinding,
+			InputProcessorPort processorPort, InputActivityPort activityPort) {
+		setParent(processorBinding);
+		setBoundProcessorPort(processorPort);
+		setBoundActivityPort(activityPort);
+	}
+
+	/**
+	 * Returns the <code>InputActivityPort</code> to which data is actually sent
+	 * when passed to the bound <code>InputProcessorPort</code>.
+	 * 
+	 * @return the <code>InputActivityPort</code> to which data is actually sent
+	 *         when passed to the bound <code>InputProcessorPort</code>
+	 */
+	@Override
+	public InputActivityPort getBoundActivityPort() {
+		return super.getBoundActivityPort();
+	}
+
+	/**
+	 * Returns the <code>InputProcessorPort</code> that the binding is for.
+	 * 
+	 * @return the <code>InputProcessorPort</code> that the binding is for
+	 */
+	@Override
+	public InputProcessorPort getBoundProcessorPort() {
+		return super.getBoundProcessorPort();
+	}
+
+	@Override
+	public ProcessorBinding getParent() {
+		return parent;
+	}
+
+	/**
+	 * Sets the <code>InputActivityPort</code> to which data is actually sent
+	 * when passed to the bound <code>InputProcessorPort</code>.
+	 * 
+	 * @param boundActivityPort
+	 *            the <code>InputActivityPort</code> to which data is actually
+	 *            sent when passed to the bound <code>InputProcessorPort</code>
+	 */
+	@Override
+	public void setBoundActivityPort(InputActivityPort boundActivityPort) {
+		super.setBoundActivityPort(boundActivityPort);
+	}
+
+	/**
+	 * Sets the InputProcessorPort that the binding is for.
+	 * 
+	 * @param boundProcessorPort
+	 *            the InputProcessorPort that the binding is for
+	 */
+	@Override
+	public void setBoundProcessorPort(InputProcessorPort boundProcessorPort) {
+		super.setBoundProcessorPort(boundProcessorPort);
+	}
+
+	@Override
+	public void setParent(ProcessorBinding parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getInputPortBindings().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getInputPortBindings().add(this);
+	}
+
+	@Override
+	public String toString() {
+		return getBoundProcessorPort() + "->" + getBoundActivityPort();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorOutputPortBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorOutputPortBinding.java b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorOutputPortBinding.java
new file mode 100644
index 0000000..ce879e9
--- /dev/null
+++ b/taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/profiles/ProcessorOutputPortBinding.java
@@ -0,0 +1,146 @@
+/**
+ *
+ */
+package org.apache.taverna.scufl2.api.profiles;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+/**
+ * A <code>ProcessorOutputPortBinding</code> specifies the
+ * <code>OutputActivityPort</code> from which data is received for an
+ * <code>OutputProcessorPort</code>.
+ * 
+ * Note that the <code>OutputProcessorPort</code> must be a
+ * {@link org.apache.taverna.scufl2.api.port.Port Port} of the
+ * {@link org.apache.taverna.scufl2.api.core.Processor Processor} of the parent
+ * <code>ProcessorBinding</code>. The <code>OutputActivityPort</code> must be a
+ * <code>Port</code> of the {@link org.apache.taverna.scufl2.api.activity.Activity
+ * Activity} of the parent <code>ProcessorBinding</code>.
+ * 
+ * @author Alan R Williams
+ * @author Stian Soiland-Reyes
+ */
+public class ProcessorOutputPortBinding extends
+		ProcessorPortBinding<OutputActivityPort, OutputProcessorPort> {
+	private ProcessorBinding parent;
+
+	/**
+	 * Constructs a <code>ProcessorOutputPortBinding</code> with no binding set.
+	 */
+	public ProcessorOutputPortBinding() {
+	}
+
+	/**
+	 * Constructs a <code>ProcessorOutputPortBinding</code> for the specified
+	 * <code>ProcessorBinding</code>.
+	 * 
+	 * @param processorBinding
+	 *            the <code>ProcessorBinding</code> to add this
+	 *            <code>ProcessorOutputPortBinding</code> to. Can be
+	 *            <code>null</code>
+	 * @param activityPort
+	 *            the bound <code>OutputActivityPort</code>. Can be
+	 *            <code>null</code>
+	 * @param processorPort
+	 *            the bound <code>OutputProcessorPort</code>. Can be
+	 *            <code>null</code>
+	 */
+	public ProcessorOutputPortBinding(ProcessorBinding processorBinding,
+			OutputActivityPort activityPort, OutputProcessorPort processorPort) {
+		setParent(processorBinding);
+		setBoundActivityPort(activityPort);
+		setBoundProcessorPort(processorPort);
+	}
+
+	@Override
+	public boolean accept(Visitor visitor) {
+		return visitor.visit(this);
+	}
+
+	/**
+	 * Returns the <code>OutputActivityPort</code> from which data is received
+	 * for the bound <code>OutputProcessorPort</code>.
+	 * 
+	 * @return the <code>OutputActivityPort</code> from which data is received
+	 *         for the bound <code>OutputProcessorPort</code>
+	 */
+	@Override
+	public OutputActivityPort getBoundActivityPort() {
+		return super.getBoundActivityPort();
+	}
+
+	/**
+	 * Returns the <code>OutputProcessorPort</code> that the binding is for.
+	 * 
+	 * @return the <code>OutputProcessorPort</code> that the binding is for
+	 */
+	@Override
+	public OutputProcessorPort getBoundProcessorPort() {
+		return super.getBoundProcessorPort();
+	}
+
+	@Override
+	public ProcessorBinding getParent() {
+		return parent;
+	}
+
+	/**
+	 * Sets the <code>OutputActivityPort</code> from which data is received for
+	 * the bound <code>OutputProcessorPort</code>.
+	 * 
+	 * @param boundActivityPort
+	 *            the <code>OutputActivityPort</code> from which data is
+	 *            received for the bound <code>OutputProcessorPort</code>
+	 */
+	@Override
+	public void setBoundActivityPort(OutputActivityPort boundActivityPort) {
+		super.setBoundActivityPort(boundActivityPort);
+	}
+
+	/**
+	 * Sets the <code>OutputProcessorPort</code> that the binding is for.
+	 * 
+	 * @param boundProcessorPort
+	 *            the <code>OutputProcessorPort</code> that the binding is for
+	 */
+	@Override
+	public void setBoundProcessorPort(OutputProcessorPort boundProcessorPort) {
+		super.setBoundProcessorPort(boundProcessorPort);
+	}
+
+	@Override
+	public void setParent(ProcessorBinding parent) {
+		if (this.parent != null && this.parent != parent)
+			this.parent.getOutputPortBindings().remove(this);
+		this.parent = parent;
+		if (parent != null)
+			parent.getOutputPortBindings().add(this);
+	}
+
+	@Override
+	public String toString() {
+		return getBoundProcessorPort() + "<-" + getBoundActivityPort();
+	}
+}