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:06:00 UTC
[75/79] incubator-taverna-language git commit: validation moved into
api
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/DotProductTest.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/DotProductTest.java b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/DotProductTest.java
new file mode 100644
index 0000000..57b9fed
--- /dev/null
+++ b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/DotProductTest.java
@@ -0,0 +1,181 @@
+/**
+ *
+ */
+package org.apache.taverna.scufl2.validation.structural;
+/*
+ *
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
+import org.junit.Test;
+
+
+
+/**
+ * @author alanrw
+ *
+ */
+public class DotProductTest {
+
+ private InputProcessorPort a;
+ private InputProcessorPort b;
+
+ private DotProduct getDot(int depthA, int depthB) {
+ a = new InputProcessorPort();
+ a.setName("a");
+ a.setDepth(0);
+ DotProduct dp = new DotProduct();
+ PortNode nipn1 = new PortNode(dp, a);
+ nipn1.setDesiredDepth(depthA);
+
+ b = new InputProcessorPort();
+ b.setName("b");
+ b.setDepth(0);
+ PortNode nipn2 = new PortNode(dp, b);
+ nipn2.setDesiredDepth(depthB);
+
+ return dp;
+ }
+
+ @Test
+ public void testSingletonDotUnstagedIteration(){
+ DotProduct dp = getDot(0, 0);
+
+ StructuralValidator sv = new StructuralValidator();
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a, 1);
+ tempDepths.put(b, 1);
+
+ assertEquals(Integer.valueOf(1), sv.getIterationDepth(dp,
+ tempDepths));
+ }
+
+ @Test
+ public void testListDotUnstagedIteration() {
+ DotProduct dp = getDot(0, 0);
+ StructuralValidator sv = new StructuralValidator();
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,2);
+ tempDepths.put(b,2);
+
+ assertEquals(Integer.valueOf(2), sv.getIterationDepth(dp,
+ tempDepths));
+ }
+
+ @Test
+ public void testDifferentDepthsDotUnstagedIteration() {
+ DotProduct dp = getDot(0, 1);
+ StructuralValidator sv = new StructuralValidator();
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,3);
+ tempDepths.put(b,4);
+
+ assertEquals(Integer.valueOf(3), sv.getIterationDepth(dp,
+ tempDepths));
+
+ }
+
+ @Test
+ public void testValidationFailureWithDot() {
+ DotProduct dp = getDot(0, 0);
+ StructuralValidator sv = new StructuralValidator();
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,1);
+ tempDepths.put(b,2);
+ assertNull(sv.getIterationDepth(dp,
+ tempDepths));
+ }
+
+ @Test
+ public void testStagedCombinationOfDot1() {
+
+ Processor p = new Processor();
+ IterationStrategyStack iss = new IterationStrategyStack(p);
+
+ iss.add(getDot(1, 1));
+ iss.add(getDot(0, 0));
+ StructuralValidator sv = new StructuralValidator();
+ sv.getValidatorState().setProcessor(p);
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,2);
+ tempDepths.put(b,2);
+
+ assertEquals(Integer.valueOf(2), sv.calculateResultWrappingDepth(tempDepths));
+
+}
+
+ @Test
+ public void testStagedCombinationOfDot2() {
+
+ Processor p = new Processor();
+ IterationStrategyStack iss = new IterationStrategyStack(p);
+
+ iss.add(getDot(1, 1));
+ iss.add(getDot(0, 0));
+ StructuralValidator sv = new StructuralValidator();
+ sv.getValidatorState().setProcessor(p);
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,0);
+ tempDepths.put(b,0);
+
+ // Should pass because the single items (depth 0) are promoted to single
+ // item lists before being passed into the iteration system so are
+ // effectively both depth 1 going into the second stage which then
+ // iterates to produce an index array length of 1
+ assertEquals(Integer.valueOf(1), sv.calculateResultWrappingDepth(tempDepths));
+
+}
+
+ @Test
+ public void testStagedCombinationOfDot3() {
+
+ Processor p = new Processor();
+ IterationStrategyStack iss = new IterationStrategyStack(p);
+
+ iss.add(getDot(1, 1));
+ iss.add(getDot(0, 0));
+ StructuralValidator sv = new StructuralValidator();
+ sv.getValidatorState().setProcessor(p);
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,1);
+ tempDepths.put(b,0);
+
+ // Slightly strange superficially that this should work, but in fact
+ // what happens is that the first single item is lifted to a list before
+ // being passed to the iteration strategy. The result is that it's fine
+ // to match with the dot product against the other list as neither at
+ // this point have index arrays, then in the second stage both are lists
+ // to be iterated over and both have single length index arrays.
+ assertEquals(Integer.valueOf(1), sv.calculateResultWrappingDepth(tempDepths));
+
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/StagedCombinationTest.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/StagedCombinationTest.java b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/StagedCombinationTest.java
new file mode 100644
index 0000000..0aa556f
--- /dev/null
+++ b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/StagedCombinationTest.java
@@ -0,0 +1,104 @@
+package org.apache.taverna.scufl2.validation.structural;
+/*
+ *
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
+import org.junit.Test;
+
+
+
+public class StagedCombinationTest {
+
+ private InputProcessorPort a;
+ private InputProcessorPort b;
+
+ private CrossProduct getCross(int depthA, int depthB) {
+ a = new InputProcessorPort();
+ a.setName("a");
+ a.setDepth(0);
+ CrossProduct cp = new CrossProduct();
+ PortNode nipn1 = new PortNode(cp, a);
+ nipn1.setDesiredDepth(depthA);
+
+ b = new InputProcessorPort();
+ b.setName("b");
+ b.setDepth(0);
+ PortNode nipn2 = new PortNode(cp, b);
+ nipn2.setDesiredDepth(depthB);
+
+ return cp;
+ }
+
+ private DotProduct getDot(int depthA, int depthB) {
+ a = new InputProcessorPort();
+ a.setName("a");
+ a.setDepth(0);
+ DotProduct dp = new DotProduct();
+ PortNode nipn1 = new PortNode(dp, a);
+ nipn1.setDesiredDepth(depthA);
+
+ b = new InputProcessorPort();
+ b.setName("b");
+ b.setDepth(0);
+ PortNode nipn2 = new PortNode(dp, b);
+ nipn2.setDesiredDepth(depthB);
+
+ return dp;
+ }
+
+ /**
+ * Test whether Paul's example of iterating with dot product then cross
+ * product can typecheck in a single staged iteration. This was an example
+ * where the user had two lists of folders (a1, a2, b1, b2, c1, c2) and
+ * wanted to compare all the contents of each 'a' folder with the other 'a'
+ * folder and so on, doing a dot match to only compare a1 and a2 then a
+ * cross product join within each pair to compare all contents of a1 with
+ * all contents of a2. This appears to work!
+ */
+ @Test
+ public void testStagedCombinationOfDotAndCross() {
+ Processor p = new Processor();
+ IterationStrategyStack iss = new IterationStrategyStack(p);
+ iss.add(getDot(1, 1));
+ iss.add(getCross(0, 0));
+
+ StructuralValidator sv = new StructuralValidator();
+ sv.getValidatorState().setProcessor(p);
+ Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
+ tempDepths.put(a,2);
+ tempDepths.put(b,2);
+
+ assertEquals(Integer.valueOf(3), sv.calculateResultWrappingDepth(tempDepths));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/WorkflowTest.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/WorkflowTest.java b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/WorkflowTest.java
new file mode 100644
index 0000000..6606a96
--- /dev/null
+++ b/taverna-scufl2-api/src/test/java/org/apache/taverna/scufl2/validation/structural/WorkflowTest.java
@@ -0,0 +1,55 @@
+package org.apache.taverna.scufl2.validation.structural;
+/*
+ *
+ * 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 static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
+import org.apache.taverna.scufl2.validation.structural.ValidatorState;
+import org.junit.Test;
+
+
+
+public class WorkflowTest {
+
+ @Test
+ public void testIncompleteWorkflow() throws ReaderException, IOException {
+ ReportStructuralValidationListener l = new ReportStructuralValidationListener();
+ WorkflowBundle wb = new WorkflowBundle();
+ Workflow w = new Workflow();
+ wb.setMainWorkflow(w);
+ StructuralValidator sv = new StructuralValidator();
+ sv.checkStructure(wb, l);
+ @SuppressWarnings("unused")
+ ValidatorState vs = sv.getValidatorState();
+ assertEquals(1, l.getIncompleteWorkflows().size());
+ assert(l.getIncompleteWorkflows().contains(w));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-integration-tests/src/test/resources/t172starterpacklist
----------------------------------------------------------------------
diff --git a/taverna-scufl2-integration-tests/src/test/resources/t172starterpacklist b/taverna-scufl2-integration-tests/src/test/resources/t172starterpacklist
new file mode 100644
index 0000000..35358b0
--- /dev/null
+++ b/taverna-scufl2-integration-tests/src/test/resources/t172starterpacklist
@@ -0,0 +1 @@
+http://www.myexperiment.org/workflows/157/download/example_of_a_conditional_execution_workflow_7882.xml?version=1
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-integration-tests/src/test/resources/t230starterpacklist
----------------------------------------------------------------------
diff --git a/taverna-scufl2-integration-tests/src/test/resources/t230starterpacklist b/taverna-scufl2-integration-tests/src/test/resources/t230starterpacklist
new file mode 100644
index 0000000..b03b4c6
--- /dev/null
+++ b/taverna-scufl2-integration-tests/src/test/resources/t230starterpacklist
@@ -0,0 +1,30 @@
+#Here is the starter pack
+http://www.myexperiment.org/workflows/2254/download/secure_web_service_call_example_565494.t2flow?version=1
+http://www.myexperiment.org/workflows/2253/download/secure_rest_service_call_example_19600.t2flow?version=1
+http://www.myexperiment.org/workflows/2231/download/numerically_adding_two_values._763485.t2flow?version=1
+http://www.myexperiment.org/workflows/2230/download/example_for_external_tools_with_zip_and_unzip_57117.t2flow?version=1
+http://www.myexperiment.org/workflows/2229/download/unix_tool_service_using_string_replacement_219870.t2flow?version=1
+http://www.myexperiment.org/workflows/2226/download/a_workflow_version_of_the_emboss_tutorial_602335.t2flow?version=1
+#http://www.myexperiment.org/workflows/2225/download/biomoby_tutorial_workflow_822226.t2flow?version=1
+http://www.myexperiment.org/workflows/2224/download/demonstration_of_configurable_iteration_687594.t2flow?version=1
+http://www.myexperiment.org/workflows/2223/download/fetch_pdb_flatfile_from_rcsb_server_969158.t2flow?version=1
+http://www.myexperiment.org/workflows/2222/download/fetch_today_s_xkcd_comic_451319.t2flow?version=1
+http://www.myexperiment.org/workflows/2221/download/gbseq_test_330068.t2flow?version=1
+http://www.myexperiment.org/workflows/2220/download/pipelined_list_iteration_106641.t2flow?version=1
+http://www.myexperiment.org/workflows/2219/download/retrieve_sequence_in_embl_format_491484.t2flow?version=1
+http://www.myexperiment.org/workflows/2218/download/spreadsheet_import_example_392470.t2flow?version=1
+#http://www.myexperiment.org/workflows/2217/download/fetch_dragon_images_from_biomoby_210389.t2flow?version=1
+http://www.myexperiment.org/workflows/2216/download/multiple_choice_quiz_541689.t2flow?version=1
+http://www.myexperiment.org/workflows/2215/download/example_workflow_for_rest_and_xpath_activities_912889.t2flow?version=1
+http://www.myexperiment.org/workflows/2214/download/ebi_interproscan_newservices_702837.t2flow?version=1
+http://www.myexperiment.org/workflows/2213/download/biomartandembossdisease_841605.t2flow?version=1
+
+#Here are the secured workflows
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-basic-authentication.t2flow?version=2&modificationDate=1308826501000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-basic-authentication-https.t2flow?version=2&modificationDate=1308826501000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-digest-authentication.t2flow?version=2&modificationDate=1308826485000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-digest-authentication-https.t2flow?version=2&modificationDate=1308826485000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-ws.t2flow?version=2&modificationDate=1308826485000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-ws-https.t2flow?version=2&modificationDate=1308826485000
+http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-client-cert-authentication-https.t2flow?version=1&modificationDate=1308826485000
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/pom.xml b/taverna-scufl2-validation-correctness/pom.xml
deleted file mode 100644
index a5289d8..0000000
--- a/taverna-scufl2-validation-correctness/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.language</groupId>
- <artifactId>taverna-language</artifactId>
- <version>0.15.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-scufl2-validation-correctness</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Scufl 2 validation correctness</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Export-Package>org.apache.taverna.scufl2.validation.correctness.*;provide:=true</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidationListener.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidationListener.java
deleted file mode 100644
index 4227564..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidationListener.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.validation.ValidationReport;
-
-
-/**
- * @author alanrw
- */
-public interface CorrectnessValidationListener extends ValidationReport {
- void emptyIterationStrategyTopNode(IterationStrategyTopNode bean);
-
- void mismatchConfigurableType(Configuration bean, Configurable configures);
-
- void nonAbsoluteURI(WorkflowBean bean, String fieldName, URI fieldValue);
-
- void nullField(WorkflowBean bean, String string);
-
- void portMentionedTwice(IterationStrategyNode subNode,
- IterationStrategyNode iterationStrategyNode);
-
- void portMissingFromIterationStrategyStack(Port p,
- IterationStrategyStack bean);
-
- void wrongParent(Child<?> iap);
-
- void negativeValue(WorkflowBean bean, String fieldName, Integer fieldValue);
-
- void outOfScopeValue(WorkflowBean bean, String fieldName, Object value);
-
- void incompatibleGranularDepth(AbstractGranularDepthPort bean,
- Integer depth, Integer granularDepth);
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidator.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidator.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidator.java
deleted file mode 100644
index c20e3ad..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessValidator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.validation.Validator;
-
-
-/**
- * @author alanrw
- */
-public class CorrectnessValidator implements Validator<CorrectnessValidationListener> {
- public void checkCorrectness(WorkflowBean bean, boolean checkComplete,
- CorrectnessValidationListener listener) {
- CorrectnessVisitor visitor = new CorrectnessVisitor(checkComplete,
- listener);
- bean.accept(visitor);
- }
-
- @Override
- public CorrectnessValidationListener validate(WorkflowBundle workflowBundle) {
- CorrectnessValidationListener l = new ReportCorrectnessValidationListener();
- checkCorrectness(workflowBundle, false, l);
- return l;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessVisitor.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessVisitor.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessVisitor.java
deleted file mode 100644
index 228a91e..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/CorrectnessVisitor.java
+++ /dev/null
@@ -1,644 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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.EmptyStackException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Ported;
-import org.apache.taverna.scufl2.api.common.Root;
-import org.apache.taverna.scufl2.api.common.Typed;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.AbstractDepthPort;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-
-/**
- * @author alanrw
- */
-public class CorrectnessVisitor extends DispatchingVisitor {
- private final boolean checkComplete;
- private final CorrectnessValidationListener listener;
-
- public CorrectnessVisitor(boolean checkComplete, CorrectnessValidationListener listener) {
- this.checkComplete = checkComplete;
- this.listener = listener;
- }
-
- public boolean isCheckComplete() {
- return checkComplete;
- }
-
- private WorkflowBean peekPath() {
- return getCurrentPath().peek();
- }
-
- public <T> T findAncestral(Child<?> bean, Class<T> class1) {
- T result = null;
- for (WorkflowBean parent = bean.getParent(); parent != null; parent = ((Child<?>) parent)
- .getParent()) {
- if (class1.isInstance(parent))
- return class1.cast(parent);
- if (!(parent instanceof Child))
- return null;
- }
- return result;
- }
-
- @Override
- public void visitAbstractDepthPort(AbstractDepthPort bean) {
- Integer depth = bean.getDepth();
- if (depth != null && depth < 0)
- listener.negativeValue(bean, "depth", depth);
- if (checkComplete && depth == null)
- listener.nullField(bean, "depth");
- }
-
- @Override
- public void visitAbstractGranularDepthPort(AbstractGranularDepthPort bean) {
- Integer granularDepth = bean.getGranularDepth();
- if (granularDepth != null) {
- if (granularDepth < 0)
- listener.negativeValue(bean, "granularDepth", granularDepth);
- Integer depth = bean.getDepth();
- if (depth != null)
- if (granularDepth > depth)
- listener.incompatibleGranularDepth(bean, depth,
- granularDepth);
- }
- if (checkComplete && granularDepth == null)
- listener.nullField(bean, "granularDepth");
- }
-
- @Override
- public void visitActivity(Activity bean) {
- // All checks are covered by those in Named, Typed, Child.
- }
-
- @Override
- public void visitActivityPort(ActivityPort bean) {
- // All checks are covered by those in Named and Child
- }
-
- @Override
- public void visitBlockingControlLink(BlockingControlLink bean) {
- // Also checks from Child
-
- Workflow parent = bean.getParent();
- Processor block = bean.getBlock();
- Processor untilFinished = bean.getUntilFinished();
-
- // Check the block and untilFinished processors are in the same workflow
- if (block != null) {
- Workflow blockParent = block.getParent();
- if ((parent == null) || !parent.equals(blockParent))
- listener.outOfScopeValue(bean, "block", block);
- }
- if (untilFinished != null) {
- Workflow untilFinishedParent = untilFinished.getParent();
- if ((parent == null) || !parent.equals(untilFinishedParent))
- listener.outOfScopeValue(bean, "untilFinished", untilFinished);
- }
-
- // Check the block and untilFinished processors are specified
- if (checkComplete) {
- if (block == null)
- listener.nullField(bean, "block");
- if (untilFinished == null)
- listener.nullField(bean, "untilFinished");
- }
- }
-
- @Override
- public void visitChild(Child<?> bean) {
- WorkflowBean p = bean.getParent();
- try {
- if (p != null) {
- WorkflowBean up = peekPath();
- if ((up != null) && (up != p))
- listener.wrongParent(bean);
- }
- } catch (EmptyStackException e) {
- // Nothing
- }
- if (checkComplete && p == null)
- listener.nullField(bean, "parent");
- }
-
- @Override
- public void visitConfigurable(Configurable bean) {
- // Are there any checks that it is actually configured?
- }
-
- @Override
- public void visitConfiguration(Configuration bean) {
- Configurable configures = bean.getConfigures();
- JsonNode json = bean.getJson();
- @SuppressWarnings("unused")
- URI type = null;
- if (configures != null && configures instanceof Typed)
- type = ((Typed) configures).getType();
- // Correct check cannot be completed unless property descriptions are available
-// URI configurationType = bean.getConfigurableType();
-// if ((configuresType != null) && (configurationType != null))
-// if (!configuresType.equals(configurationType))
-// listener.mismatchConfigurableType(bean, configures);
-
- if (checkComplete) {
- if (configures == null)
- listener.nullField(bean, "configures");
- if (json == null)
- listener.nullField(bean, "json");
- // TODO Check that the PropertyResource is complete
- }
- }
-
- @Override
- public void visitControlLink(ControlLink bean) {
- // All done in Child or BlockingControlLink
- }
-
- @Override
- public void visitCrossProduct(CrossProduct bean) {
- // All done in IterationStrategyTopNode and Child
- }
-
- @Override
- public void visitDataLink(DataLink bean) {
- ReceiverPort sendsTo = bean.getSendsTo();
- SenderPort receivesFrom = bean.getReceivesFrom();
-
- Workflow parent = bean.getParent();
- if (sendsTo != null) {
- Workflow sendsToWorkflow = findAncestral((Child<?>) sendsTo,
- Workflow.class);
- if ((parent == null) || !parent.equals(sendsToWorkflow))
- listener.outOfScopeValue(bean, "sendsTo", sendsTo);
- }
- if (receivesFrom != null) {
- Workflow receivesFromWorkflow = findAncestral((Child<?>) receivesFrom,
- Workflow.class);
- if ((parent == null) || !parent.equals(receivesFromWorkflow))
- listener.outOfScopeValue(bean, "receivesFrom", receivesFrom);
- }
-
- Integer mergePosition = bean.getMergePosition();
- if (mergePosition != null && mergePosition < 0)
- listener.negativeValue(bean, "mergePosition", mergePosition);
-
- // How to check mergePosition
-
- if (checkComplete) {
- if (sendsTo == null)
- listener.nullField(bean, "sendsTo");
- if (receivesFrom == null)
- listener.nullField(bean, "receivesFrom");
- }
- }
-
- @Override
- public void visitDotProduct(DotProduct bean) {
- // All done in IterationStrategyTopNode and Child
- }
-
- @Override
- public void visitInputActivityPort(InputActivityPort bean) {
- // All done in Child, Named and Configurable
- }
-
- @Override
- public void visitInputPort(InputPort bean) {
- // All done in Named and Configurable
- }
-
- @Override
- public void visitInputProcessorPort(InputProcessorPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitInputWorkflowPort(InputWorkflowPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitIterationStrategyNode(IterationStrategyNode bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitIterationStrategyParent(IterationStrategyParent bean) {
- // Nothing to do
- }
-
- @Override
- public void visitIterationStrategyStack(IterationStrategyStack bean) {
- Processor parent = bean.getParent();
- if (parent != null && checkComplete) {
- Set<Port> mentionedPorts = new HashSet<>();
- for (IterationStrategyTopNode node : bean)
- mentionedPorts.addAll(getReferencedPorts(node));
- NamedSet<InputProcessorPort> inputPorts = parent.getInputPorts();
- if (inputPorts != null)
- for (Port p : inputPorts)
- if (!mentionedPorts.contains(p))
- listener.portMissingFromIterationStrategyStack(p, bean);
- }
- }
-
- @Override
- public void visitIterationStrategyTopNode(IterationStrategyTopNode bean) {
- if (checkComplete&&bean.isEmpty())
- listener.emptyIterationStrategyTopNode(bean);
- Map<Port, IterationStrategyNode> portsSoFar = new HashMap<>();
- for (IterationStrategyNode subNode : bean)
- if (subNode instanceof PortNode) {
- InputProcessorPort port = ((PortNode) subNode).getInputProcessorPort();
- if (port != null) {
- if (portsSoFar.containsKey(port))
- listener.portMentionedTwice(portsSoFar.get(port), subNode);
- else
- portsSoFar.put(port, subNode);
- }
- } else
- for (Port p : getReferencedPorts((IterationStrategyTopNode) subNode))
- if (portsSoFar.containsKey(p))
- listener.portMentionedTwice(portsSoFar.get(p), subNode);
- else
- portsSoFar.put(p, subNode);
- }
-
- private Set<Port> getReferencedPorts(IterationStrategyTopNode bean) {
- Set<Port> result = new HashSet<>();
- for (IterationStrategyNode subNode : bean)
- if (subNode instanceof PortNode) {
- InputProcessorPort port = ((PortNode) subNode).getInputProcessorPort();
- if (port != null)
- result.add(port);
- } else
- result.addAll(getReferencedPorts((IterationStrategyTopNode) subNode));
- return result;
- }
-
- @Override
- public void visitNamed(Named bean) {
- // What are the constraints upon the string used as the name?
- if (checkComplete) {
- String name = bean.getName();
- if ((name == null) || name.isEmpty())
- listener.nullField(bean, "name");
- }
- }
-
- @Override
- public void visitOutputActivityPort(OutputActivityPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitOutputPort(OutputPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitOutputProcessorPort(OutputProcessorPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitOutputWorkflowPort(OutputWorkflowPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitPort(Port bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitPortNode(PortNode bean) {
- InputProcessorPort inputProcessorPort = bean.getInputProcessorPort();
- Integer desiredDepth = bean.getDesiredDepth();
- if (desiredDepth != null && desiredDepth < 0)
- listener.negativeValue(bean, "desiredDepth", desiredDepth);
-
- if (inputProcessorPort != null) {
- Processor ancestralProcessor = findAncestral(bean, Processor.class);
- Processor portAncestralProcessor = findAncestral(
- inputProcessorPort, Processor.class);
- if ((ancestralProcessor == null)
- || !ancestralProcessor.equals(portAncestralProcessor))
- listener.outOfScopeValue(bean, "inputProcessorPort",
- inputProcessorPort);
- }
-
- if (checkComplete) {
- if (inputProcessorPort == null)
- listener.nullField(bean, "inputProcessorPort");
- if (desiredDepth == null)
- listener.nullField(bean, "desiredDepth");
- }
- }
-
- @Override
- public void visitPorted(Ported bean) {
- if (checkComplete) {
- if (bean.getInputPorts() == null)
- listener.nullField(bean, "inputPorts");
- if (bean.getOutputPorts() == null)
- listener.nullField(bean, "outputPorts");
- }
- }
-
- @Override
- public void visitProcessor(Processor bean) {
- if (checkComplete && bean.getIterationStrategyStack() == null)
- listener.nullField(bean, "iterationStrategyStack");
- }
-
- @Override
- public void visitProcessorBinding(ProcessorBinding bean) {
- Processor boundProcessor = bean.getBoundProcessor();
- Activity boundActivity = bean.getBoundActivity();
- WorkflowBundle workflowBundle = findAncestral(bean,
- WorkflowBundle.class);
-
- if (boundProcessor != null) {
- WorkflowBundle boundProcessorBundle = findAncestral(boundProcessor,
- WorkflowBundle.class);
- if ((workflowBundle == null)
- || !workflowBundle.equals(boundProcessorBundle))
- listener.outOfScopeValue(bean, "boundProcessor", boundProcessor);
- }
- if (boundActivity != null) {
- WorkflowBundle boundActivityBundle = findAncestral(boundActivity,
- WorkflowBundle.class);
- if ((workflowBundle == null)
- || !workflowBundle.equals(boundActivityBundle))
- listener.outOfScopeValue(bean, "boundActivity", boundActivity);
- }
-
- Integer activityPosition = bean.getActivityPosition();
- if (activityPosition != null && activityPosition < 0)
- listener.negativeValue(bean, "activityPosition", activityPosition);
-
- if (checkComplete) {
- if (boundProcessor == null)
- listener.nullField(bean, "boundProcessor");
- if (boundActivity == null)
- listener.nullField(bean, "boundActivity");
- // ActivityPosition can be null
- if (bean.getInputPortBindings() == null)
- listener.nullField(bean, "inputPortBindings");
- if (bean.getOutputPortBindings() == null)
- listener.nullField(bean, "outputPortBindings");
- }
- }
-
- @Override
- public void visitProcessorInputPortBinding(ProcessorInputPortBinding bean) {
- ProcessorBinding parent = bean.getParent();
- InputProcessorPort boundProcessorPort = bean.getBoundProcessorPort();
- InputActivityPort boundActivityPort = bean.getBoundActivityPort();
-
- if (parent != null) {
- Processor boundProcessor = parent.getBoundProcessor();
- if (boundProcessorPort != null) {
- Processor boundPortProcessor = findAncestral(
- boundProcessorPort, Processor.class);
- if ((boundProcessor == null)
- || !boundProcessor.equals(boundPortProcessor))
- listener.outOfScopeValue(bean, "boundProcessorPort",
- boundProcessorPort);
- }
- Activity boundActivity = parent.getBoundActivity();
- if (boundActivityPort != null) {
- Activity boundPortActivity = findAncestral(boundActivityPort,
- Activity.class);
- if ((boundActivity == null)
- || !boundActivity.equals(boundPortActivity))
- listener.outOfScopeValue(bean, "boundActivityPort",
- boundActivityPort);
- }
- }
- if (checkComplete) {
- if (boundProcessorPort == null)
- listener.nullField(bean, "boundProcessorPort");
- if (boundActivityPort == null)
- listener.nullField(bean, "boundActivityPort");
- }
- }
-
- @Override
- public void visitProcessorOutputPortBinding(ProcessorOutputPortBinding bean) {
- ProcessorBinding parent = bean.getParent();
- OutputProcessorPort boundProcessorPort = bean.getBoundProcessorPort();
- OutputActivityPort boundActivityPort = bean.getBoundActivityPort();
-
- if (parent != null) {
- Processor boundProcessor = parent.getBoundProcessor();
- if (boundProcessorPort != null) {
- Processor boundPortProcessor = findAncestral(boundProcessorPort, Processor.class);
- if ((boundProcessor == null) || !boundProcessor.equals(boundPortProcessor))
- listener.outOfScopeValue(bean, "boundProcessorPort", boundProcessorPort);
- }
- Activity boundActivity = parent.getBoundActivity();
- if (boundActivityPort != null) {
- Activity boundPortActivity = findAncestral(boundActivityPort, Activity.class);
- if ((boundActivity == null) || !boundActivity.equals(boundPortActivity))
- listener.outOfScopeValue(bean, "boundActivityPort", boundActivityPort);
- }
- }
- if (checkComplete) {
- if (boundProcessorPort == null)
- listener.nullField(bean, "boundProcessorPort");
- if (boundActivityPort == null)
- listener.nullField(bean, "boundActivityPort");
- }
- }
-
- @Override
- public void visitProcessorPort(ProcessorPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitProcessorPortBinding(ProcessorPortBinding<?,?> bean) {
- // Done in sub-classes
- }
-
- @Override
- public void visitProfile(Profile bean) {
- Integer profilePosition = bean.getProfilePosition();
-
- if (profilePosition != null && profilePosition < 0)
- listener.negativeValue(bean, "profilePosition", profilePosition);
- if (checkComplete) {
- if (bean.getProcessorBindings() == null)
- listener.nullField(bean, "processorBindings");
- if (bean.getConfigurations() == null)
- listener.nullField(bean, "configurations");
- // It may be OK for the profilePosition to be null
- if (bean.getActivities() == null)
- listener.nullField(bean, "activities");
- }
- }
-
- @Override
- public void visitReceiverPort(ReceiverPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitRoot(Root bean) {
- URI globalBaseURI = bean.getGlobalBaseURI();
- if (globalBaseURI != null) {
- if (!globalBaseURI.isAbsolute())
- listener.nonAbsoluteURI(bean, "globalBaseURI", globalBaseURI);
- else if (globalBaseURI.getScheme().equals("file"))
- listener.nonAbsoluteURI(bean, "globalBaseURI", globalBaseURI);
- }
- if (checkComplete && globalBaseURI == null)
- listener.nullField(bean, "globalBaseURI");
- }
-
- @Override
- public void visitSenderPort(SenderPort bean) {
- // All done in superclasses and interfaces
- }
-
- @Override
- public void visitTyped(Typed bean) {
- URI configurableType = bean.getType();
- if (configurableType != null) {
- if (!configurableType.isAbsolute())
- listener.nonAbsoluteURI(bean, "configurableType", configurableType);
- else if (configurableType.getScheme().equals("file"))
- listener.nonAbsoluteURI(bean, "configurableType", configurableType);
- }
- if (checkComplete && configurableType == null)
- listener.nullField(bean, "configurableType");
- }
-
- @Override
- public void visitWorkflow(Workflow bean) {
- Set<DataLink> dataLinks = bean.getDataLinks();
- Set<ControlLink> controlLinks = bean.getControlLinks();
-
- // ports are done in Ported
-
- NamedSet<Processor> processors = bean.getProcessors();
- URI workflowIdentifier = bean.getIdentifier();
-
- if (workflowIdentifier != null) {
- if (!workflowIdentifier.isAbsolute())
- listener.nonAbsoluteURI(bean, "workflowIdentifier", workflowIdentifier);
- else if (workflowIdentifier.getScheme().equals("file"))
- listener.nonAbsoluteURI(bean, "workflowIdentifier", workflowIdentifier);
- }
-
- if (checkComplete) {
- if (dataLinks == null)
- listener.nullField(bean, "dataLinks");
- if (controlLinks == null)
- listener.nullField(bean, "controlLinks");
- if (processors == null)
- listener.nullField(bean, "processors");
- if (workflowIdentifier == null)
- listener.nullField(bean, "workflowIdentifier");
- }
- }
-
- @Override
- public void visitWorkflowBundle(WorkflowBundle bean) {
- NamedSet<Profile> profiles = bean.getProfiles();
- NamedSet<Workflow> workflows = bean.getWorkflows();
- Workflow mainWorkflow = bean.getMainWorkflow();
- Profile mainProfile = bean.getMainProfile();
-
- if ((profiles != null) && (mainProfile != null)
- && !profiles.contains(mainProfile))
- listener.outOfScopeValue(bean, "mainProfile", mainProfile);
- if ((workflows != null) && (mainWorkflow != null)
- && !workflows.contains(mainWorkflow))
- listener.outOfScopeValue(bean, "mainWorkflow", mainWorkflow);
-
- if (checkComplete) {
- if (profiles == null)
- listener.nullField(bean, "profiles");
- if (workflows == null)
- listener.nullField(bean, "workflows");
- }
- }
-
- @Override
- public void visitWorkflowPort(WorkflowPort bean) {
- // All done in superclasses and interfaces
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultCorrectnessValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultCorrectnessValidationListener.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultCorrectnessValidationListener.java
deleted file mode 100644
index 14051a7..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultCorrectnessValidationListener.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.validation.ValidationException;
-
-
-/**
- * @author alanrw
- */
-public class DefaultCorrectnessValidationListener implements
- CorrectnessValidationListener {
- @Override
- public void emptyIterationStrategyTopNode(IterationStrategyTopNode bean) {
- }
-
- @Override
- public void mismatchConfigurableType(Configuration bean,
- Configurable configures) {
- }
-
- @Override
- public void negativeValue(WorkflowBean bean, String fieldName,
- Integer fieldValue) {
- }
-
- @Override
- public void nonAbsoluteURI(WorkflowBean bean, String fieldName,
- URI fieldValue) {
- }
-
- @Override
- public void nullField(WorkflowBean bean, String fieldName) {
- }
-
- @Override
- public void outOfScopeValue(WorkflowBean bean, String fieldName,
- Object value) {
- }
-
- @Override
- public void portMentionedTwice(IterationStrategyNode subNode,
- IterationStrategyNode iterationStrategyNode) {
- }
-
- @Override
- public void portMissingFromIterationStrategyStack(Port p,
- IterationStrategyStack bean) {
- }
-
- @Override
- public void wrongParent(Child<?> iap) {
- }
-
- @Override
- public void incompatibleGranularDepth(AbstractGranularDepthPort bean,
- Integer depth, Integer granularDepth) {
- }
-
- @Override
- public boolean detectedProblems() {
- return false;
- }
-
- @Override
- public ValidationException getException() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.java
deleted file mode 100644
index d4ec8b7..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.common.Ported;
-import org.apache.taverna.scufl2.api.common.Root;
-import org.apache.taverna.scufl2.api.common.Typed;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.AbstractDepthPort;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/**
- * @author alanrw
- */
-public class DefaultDispatchingVisitor extends DispatchingVisitor {
- @Override
- public void visitActivity(Activity bean) {
- }
-
- @Override
- public void visitActivityPort(ActivityPort bean) {
- }
-
- @Override
- public void visitBlockingControlLink(BlockingControlLink bean) {
- }
-
- @Override
- public void visitChild(Child<?> bean) {
- }
-
- @Override
- public void visitConfigurable(Configurable bean) {
- }
-
- @Override
- public void visitConfiguration(Configuration bean) {
- }
-
- @Override
- public void visitControlLink(ControlLink bean) {
- }
-
- @Override
- public void visitCrossProduct(CrossProduct bean) {
- }
-
- @Override
- public void visitDataLink(DataLink bean) {
- }
-
- @Override
- public void visitDotProduct(DotProduct bean) {
- }
-
- @Override
- public void visitInputActivityPort(InputActivityPort bean) {
- }
-
- @Override
- public void visitInputPort(InputPort bean) {
- }
-
- @Override
- public void visitInputProcessorPort(InputProcessorPort bean) {
- }
-
- @Override
- public void visitInputWorkflowPort(InputWorkflowPort bean) {
- }
-
- @Override
- public void visitIterationStrategyNode(IterationStrategyNode bean) {
- }
-
- @Override
- public void visitIterationStrategyParent(IterationStrategyParent bean) {
- }
-
- @Override
- public void visitIterationStrategyStack(IterationStrategyStack bean) {
- }
-
- @Override
- public void visitIterationStrategyTopNode(IterationStrategyTopNode bean) {
- }
-
- @Override
- public void visitNamed(Named bean) {
- }
-
- @Override
- public void visitOutputActivityPort(OutputActivityPort bean) {
- }
-
- @Override
- public void visitOutputPort(OutputPort bean) {
- }
-
- @Override
- public void visitOutputProcessorPort(OutputProcessorPort bean) {
- }
-
- @Override
- public void visitOutputWorkflowPort(OutputWorkflowPort bean) {
- }
-
- @Override
- public void visitPort(Port bean) {
- }
-
- @Override
- public void visitPortNode(PortNode bean) {
- }
-
- @Override
- public void visitPorted(Ported bean) {
- }
-
- @Override
- public void visitProcessor(Processor bean) {
- }
-
- @Override
- public void visitProcessorBinding(ProcessorBinding bean) {
- }
-
- @Override
- public void visitProcessorInputPortBinding(ProcessorInputPortBinding bean) {
- }
-
- @Override
- public void visitProcessorOutputPortBinding(ProcessorOutputPortBinding bean) {
- }
-
- @Override
- public void visitProcessorPort(ProcessorPort bean) {
- }
-
- @Override
- public void visitProcessorPortBinding(ProcessorPortBinding<?, ?> bean) {
- }
-
- @Override
- public void visitProfile(Profile bean) {
- }
-
- @Override
- public void visitReceiverPort(ReceiverPort bean) {
- }
-
- @Override
- public void visitRoot(Root bean) {
- }
-
- @Override
- public void visitSenderPort(SenderPort bean) {
- }
-
- @Override
- public void visitTyped(Typed bean) {
- }
-
- @Override
- public void visitWorkflow(Workflow bean) {
- }
-
- @Override
- public void visitWorkflowBundle(WorkflowBundle bean) {
- }
-
- @Override
- public void visitWorkflowPort(WorkflowPort bean) {
- }
-
- @Override
- public void visitAbstractDepthPort(AbstractDepthPort bean) {
- }
-
- @Override
- public void visitAbstractGranularDepthPort(AbstractGranularDepthPort bean) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DispatchingVisitor.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DispatchingVisitor.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DispatchingVisitor.java
deleted file mode 100644
index 275368b..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/DispatchingVisitor.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.common.Ported;
-import org.apache.taverna.scufl2.api.common.Root;
-import org.apache.taverna.scufl2.api.common.Typed;
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.AbstractDepthPort;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/**
- * @author alanrw
- */
-public abstract class DispatchingVisitor extends Visitor.VisitorWithPath {
- @Override
- public boolean visit() {
- WorkflowBean bean = this.getCurrentNode();
-
- // First, the interfaces
- if (bean instanceof AbstractDepthPort)
- visitAbstractDepthPort((AbstractDepthPort) bean);
- if (bean instanceof AbstractGranularDepthPort)
- visitAbstractGranularDepthPort((AbstractGranularDepthPort) bean);
- if (bean instanceof ActivityPort)
- visitActivityPort((ActivityPort) bean);
- if (bean instanceof Child)
- visitChild((Child<?>) bean);
- if (bean instanceof Configurable)
- visitConfigurable((Configurable) bean);
- if (bean instanceof ControlLink)
- visitControlLink((ControlLink) bean);
- if (bean instanceof InputPort)
- visitInputPort((InputPort) bean);
- if (bean instanceof IterationStrategyNode)
- visitIterationStrategyNode((IterationStrategyNode) bean);
- if (bean instanceof IterationStrategyParent)
- visitIterationStrategyParent((IterationStrategyParent) bean);
- if (bean instanceof IterationStrategyTopNode)
- visitIterationStrategyTopNode((IterationStrategyTopNode) bean);
- if (bean instanceof Named)
- visitNamed((Named) bean);
- if (bean instanceof OutputPort)
- visitOutputPort((OutputPort) bean);
- if (bean instanceof Port)
- visitPort((Port) bean);
- if (bean instanceof Ported)
- visitPorted((Ported) bean);
- if (bean instanceof ProcessorPort)
- visitProcessorPort((ProcessorPort) bean);
- if (bean instanceof ProcessorPortBinding)
- visitProcessorPortBinding((ProcessorPortBinding<?,?>) bean);
- if (bean instanceof ReceiverPort)
- visitReceiverPort((ReceiverPort) bean);
- if (bean instanceof Root)
- visitRoot((Root) bean);
- if (bean instanceof SenderPort)
- visitSenderPort((SenderPort) bean);
- if (bean instanceof Typed)
- visitTyped((Typed) bean);
- if (bean instanceof WorkflowPort)
- visitWorkflowPort((WorkflowPort) bean);
-
- // Now for the classes; these are mutually exclusive
- if (bean instanceof Activity)
- visitActivity((Activity) bean);
- else if (bean instanceof BlockingControlLink)
- visitBlockingControlLink((BlockingControlLink) bean);
- else if (bean instanceof Configuration)
- visitConfiguration((Configuration) bean);
- else if (bean instanceof CrossProduct)
- visitCrossProduct((CrossProduct) bean);
- else if (bean instanceof DataLink)
- visitDataLink((DataLink) bean);
- else if (bean instanceof DotProduct)
- visitDotProduct((DotProduct) bean);
- else if (bean instanceof InputActivityPort)
- visitInputActivityPort((InputActivityPort) bean);
- else if (bean instanceof InputProcessorPort)
- visitInputProcessorPort((InputProcessorPort) bean);
- else if (bean instanceof InputWorkflowPort)
- visitInputWorkflowPort((InputWorkflowPort) bean);
- else if (bean instanceof IterationStrategyStack)
- visitIterationStrategyStack((IterationStrategyStack) bean);
- else if (bean instanceof OutputActivityPort)
- visitOutputActivityPort((OutputActivityPort) bean);
- else if (bean instanceof OutputProcessorPort)
- visitOutputProcessorPort((OutputProcessorPort) bean);
- else if (bean instanceof OutputWorkflowPort)
- visitOutputWorkflowPort((OutputWorkflowPort) bean);
- else if (bean instanceof PortNode)
- visitPortNode((PortNode) bean);
- else if (bean instanceof Processor)
- visitProcessor((Processor) bean);
- else if (bean instanceof ProcessorBinding)
- visitProcessorBinding((ProcessorBinding) bean);
- else if (bean instanceof ProcessorInputPortBinding)
- visitProcessorInputPortBinding((ProcessorInputPortBinding) bean);
- else if (bean instanceof ProcessorOutputPortBinding)
- visitProcessorOutputPortBinding((ProcessorOutputPortBinding) bean);
- else if (bean instanceof Profile)
- visitProfile((Profile) bean);
- else if (bean instanceof Workflow)
- visitWorkflow((Workflow) bean);
- else if (bean instanceof WorkflowBundle)
- visitWorkflowBundle((WorkflowBundle) bean);
- return true;
- }
-
- protected abstract void visitAbstractGranularDepthPort(AbstractGranularDepthPort bean);
-
- protected abstract void visitAbstractDepthPort(AbstractDepthPort bean);
-
- protected abstract void visitWorkflowBundle(WorkflowBundle bean);
-
- protected abstract void visitWorkflow(Workflow bean);
-
- protected abstract void visitProfile(Profile bean);
-
- protected abstract void visitProcessorOutputPortBinding(ProcessorOutputPortBinding bean);
-
- protected abstract void visitProcessorInputPortBinding(ProcessorInputPortBinding bean);
-
- protected abstract void visitProcessorBinding(ProcessorBinding bean);
-
- protected abstract void visitProcessor(Processor bean);
-
- protected abstract void visitPortNode(PortNode bean);
-
- protected abstract void visitOutputWorkflowPort(OutputWorkflowPort bean);
-
- protected abstract void visitOutputProcessorPort(OutputProcessorPort bean);
-
- protected abstract void visitOutputActivityPort(OutputActivityPort bean);
-
- protected abstract void visitIterationStrategyStack(IterationStrategyStack bean);
-
- protected abstract void visitInputWorkflowPort(InputWorkflowPort bean);
-
- protected abstract void visitInputProcessorPort(InputProcessorPort bean);
-
- protected abstract void visitInputActivityPort(InputActivityPort bean);
-
- protected abstract void visitDotProduct(DotProduct bean);
-
- protected abstract void visitDataLink(DataLink bean);
-
- protected abstract void visitCrossProduct(CrossProduct bean);
-
- protected abstract void visitConfiguration(Configuration bean);
-
- protected abstract void visitBlockingControlLink(BlockingControlLink bean);
-
- protected abstract void visitActivity(Activity bean);
-
- protected abstract void visitWorkflowPort(WorkflowPort bean);
-
- protected abstract void visitTyped(Typed bean);
-
- protected abstract void visitSenderPort(SenderPort bean);
-
- protected abstract void visitRoot(Root bean);
-
- protected abstract void visitReceiverPort(ReceiverPort bean);
-
- protected abstract void visitProcessorPortBinding(ProcessorPortBinding<?,?> bean);
-
- protected abstract void visitProcessorPort(ProcessorPort bean);
-
- protected abstract void visitPorted(Ported bean);
-
- protected abstract void visitPort(Port bean);
-
- protected abstract void visitOutputPort(OutputPort bean);
-
- protected abstract void visitNamed(Named bean);
-
- protected abstract void visitIterationStrategyTopNode(IterationStrategyTopNode bean);
-
- protected abstract void visitIterationStrategyParent(IterationStrategyParent bean);
-
- protected abstract void visitIterationStrategyNode(IterationStrategyNode bean);
-
- protected abstract void visitInputPort(InputPort bean);
-
- protected abstract void visitControlLink(ControlLink bean);
-
- protected abstract void visitConfigurable(Configurable bean);
-
- protected abstract void visitChild(Child<?> bean);
-
- protected abstract void visitActivityPort(ActivityPort bean);
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/ReportCorrectnessValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/ReportCorrectnessValidationListener.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/ReportCorrectnessValidationListener.java
deleted file mode 100644
index 7124d7b..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/ReportCorrectnessValidationListener.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * 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.HashSet;
-import java.util.Iterator;
-
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.port.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.validation.ValidationException;
-import org.apache.taverna.scufl2.validation.correctness.report.EmptyIterationStrategyTopNodeProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.IncompatibleGranularDepthProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.MismatchConfigurableTypeProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NonAbsoluteURIProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.PortMentionedTwiceProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.PortMissingFromIterationStrategyStackProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.WrongParentProblem;
-
-
-/**
- * @author alanrw
- */
-public class ReportCorrectnessValidationListener implements
- CorrectnessValidationListener {
- private HashSet<EmptyIterationStrategyTopNodeProblem> emptyIterationStrategyTopNodeProblems = new HashSet<>();
- private HashSet<MismatchConfigurableTypeProblem> mismatchConfigurableTypeProblems = new HashSet<>();
- private HashSet<NegativeValueProblem> negativeValueProblems = new HashSet<>();
- private HashSet<NonAbsoluteURIProblem> nonAbsoluteURIProblems = new HashSet<>();
- private HashSet<NullFieldProblem> nullFieldProblems = new HashSet<>();
- private HashSet<OutOfScopeValueProblem> outOfScopeValueProblems = new HashSet<>();
- private HashSet<PortMentionedTwiceProblem> portMentionedTwiceProblems = new HashSet<>();
- private HashSet<PortMissingFromIterationStrategyStackProblem> portMissingFromIterationStrategyStackProblems = new HashSet<>();
- private HashSet<WrongParentProblem> wrongParentProblems = new HashSet<>();
- private HashSet<IncompatibleGranularDepthProblem> incompatibleGranularDepthProblems = new HashSet<>();
-
- @Override
- public void emptyIterationStrategyTopNode(IterationStrategyTopNode bean) {
- emptyIterationStrategyTopNodeProblems
- .add(new EmptyIterationStrategyTopNodeProblem(bean));
- }
-
- @Override
- public void mismatchConfigurableType(Configuration bean,
- Configurable configures) {
- mismatchConfigurableTypeProblems
- .add(new MismatchConfigurableTypeProblem(bean, configures));
- }
-
- @Override
- public void negativeValue(WorkflowBean bean, String fieldName,
- Integer fieldValue) {
- negativeValueProblems.add(new NegativeValueProblem(bean, fieldName,
- fieldValue));
- }
-
- @Override
- public void nonAbsoluteURI(WorkflowBean bean, String fieldName,
- URI fieldValue) {
- nonAbsoluteURIProblems.add(new NonAbsoluteURIProblem(bean, fieldName,
- fieldValue));
- }
-
- @Override
- public void nullField(WorkflowBean bean, String string) {
- nullFieldProblems.add(new NullFieldProblem(bean, string));
- }
-
- @Override
- public void outOfScopeValue(WorkflowBean bean, String fieldName,
- Object value) {
- outOfScopeValueProblems.add(new OutOfScopeValueProblem(bean, fieldName,
- value));
- }
-
- @Override
- public void portMentionedTwice(IterationStrategyNode subNode,
- IterationStrategyNode iterationStrategyNode) {
- portMentionedTwiceProblems.add(new PortMentionedTwiceProblem(subNode,
- iterationStrategyNode));
- }
-
- @Override
- public void portMissingFromIterationStrategyStack(Port p,
- IterationStrategyStack bean) {
- portMissingFromIterationStrategyStackProblems
- .add(new PortMissingFromIterationStrategyStackProblem(p, bean));
- }
-
- @Override
- public void wrongParent(Child<?> iap) {
- wrongParentProblems.add(new WrongParentProblem(iap));
- }
-
- @Override
- public void incompatibleGranularDepth(AbstractGranularDepthPort bean,
- Integer depth, Integer granularDepth) {
- incompatibleGranularDepthProblems
- .add(new IncompatibleGranularDepthProblem(bean, depth,
- granularDepth));
- }
-
- public HashSet<NegativeValueProblem> getNegativeValueProblems() {
- return negativeValueProblems;
- }
-
- /**
- * @return the emptyIterationStrategyTopNodes
- */
- public HashSet<EmptyIterationStrategyTopNodeProblem> getEmptyIterationStrategyTopNodeProblems() {
- return emptyIterationStrategyTopNodeProblems;
- }
-
- /**
- * @return the mismatchConfigurableTypeProblems
- */
- public HashSet<MismatchConfigurableTypeProblem> getMismatchConfigurableTypeProblems() {
- return mismatchConfigurableTypeProblems;
- }
-
- /**
- * @return the nonAbsoluteGlobalBaseURIs
- */
- public HashSet<NonAbsoluteURIProblem> getNonAbsoluteURIProblems() {
- return nonAbsoluteURIProblems;
- }
-
- /**
- * @return the nullFieldProblems
- */
- public HashSet<NullFieldProblem> getNullFieldProblems() {
- return nullFieldProblems;
- }
-
- /**
- * @return the outOfScopeValueProblems
- */
- public HashSet<OutOfScopeValueProblem> getOutOfScopeValueProblems() {
- return outOfScopeValueProblems;
- }
-
- /**
- * @return the portMentionedTwiceProblems
- */
- public HashSet<PortMentionedTwiceProblem> getPortMentionedTwiceProblems() {
- return portMentionedTwiceProblems;
- }
-
- /**
- * @return the portMissingFromIterationStrategyStackProblems
- */
- public HashSet<PortMissingFromIterationStrategyStackProblem> getPortMissingFromIterationStrategyStackProblems() {
- return portMissingFromIterationStrategyStackProblems;
- }
-
- /**
- * @return the wrongParents
- */
- public HashSet<WrongParentProblem> getWrongParentProblems() {
- return wrongParentProblems;
- }
-
- /**
- * @return the incompatibleGranularDepthProblems
- */
- public HashSet<IncompatibleGranularDepthProblem> getIncompatibleGranularDepthProblems() {
- return incompatibleGranularDepthProblems;
- }
-
- @Override
- public boolean detectedProblems() {
- return !emptyIterationStrategyTopNodeProblems.isEmpty()
- || !incompatibleGranularDepthProblems.isEmpty()
- || !mismatchConfigurableTypeProblems.isEmpty()
- || !negativeValueProblems.isEmpty()
- || !nonAbsoluteURIProblems.isEmpty()
- || !nullFieldProblems.isEmpty()
- || !outOfScopeValueProblems.isEmpty()
- || !portMentionedTwiceProblems.isEmpty()
- || !portMissingFromIterationStrategyStackProblems.isEmpty()
- || !wrongParentProblems.isEmpty();
- }
-
- @Override
- public ValidationException getException() {
- // TODO Needs to be improved;
- if (!detectedProblems())
- return null;
- return new ValidationException(this.toString());
- }
-
- @Override
- public String toString() {
- final int maxLen = 10;
- StringBuilder builder = new StringBuilder();
- builder.append("ReportCorrectnessValidationListener [getNegativeValueProblems()=");
- builder.append(getNegativeValueProblems() != null ? toString(
- getNegativeValueProblems(), maxLen) : null);
- builder.append(", getEmptyIterationStrategyTopNodeProblems()=");
- builder.append(getEmptyIterationStrategyTopNodeProblems() != null ? toString(
- getEmptyIterationStrategyTopNodeProblems(), maxLen) : null);
- builder.append(", getMismatchConfigurableTypeProblems()=");
- builder.append(getMismatchConfigurableTypeProblems() != null ? toString(
- getMismatchConfigurableTypeProblems(), maxLen) : null);
- builder.append(", getNonAbsoluteURIProblems()=");
- builder.append(getNonAbsoluteURIProblems() != null ? toString(
- getNonAbsoluteURIProblems(), maxLen) : null);
- builder.append(", getNullFieldProblems()=");
- builder.append(getNullFieldProblems() != null ? toString(
- getNullFieldProblems(), maxLen) : null);
- builder.append(", getOutOfScopeValueProblems()=");
- builder.append(getOutOfScopeValueProblems() != null ? toString(
- getOutOfScopeValueProblems(), maxLen) : null);
- builder.append(", getPortMentionedTwiceProblems()=");
- builder.append(getPortMentionedTwiceProblems() != null ? toString(
- getPortMentionedTwiceProblems(), maxLen) : null);
- builder.append(", getPortMissingFromIterationStrategyStackProblems()=");
- builder.append(getPortMissingFromIterationStrategyStackProblems() != null ? toString(
- getPortMissingFromIterationStrategyStackProblems(), maxLen)
- : null);
- builder.append(", getWrongParentProblems()=");
- builder.append(getWrongParentProblems() != null ? toString(
- getWrongParentProblems(), maxLen) : null);
- builder.append(", getIncompatibleGranularDepthProblems()=");
- builder.append(getIncompatibleGranularDepthProblems() != null ? toString(
- getIncompatibleGranularDepthProblems(), maxLen) : null);
- builder.append("]");
- return builder.toString();
- }
-
- private String toString(Collection<?> collection, int maxLen) {
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- int i = 0;
- for (Iterator<?> iterator = collection.iterator(); iterator.hasNext()
- && i < maxLen; i++) {
- if (i > 0)
- builder.append(", ");
- builder.append(iterator.next());
- }
- builder.append("]");
- return builder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/EmptyIterationStrategyTopNodeProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/EmptyIterationStrategyTopNodeProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/EmptyIterationStrategyTopNodeProblem.java
deleted file mode 100644
index 77fbfaf..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/EmptyIterationStrategyTopNodeProblem.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-/**
- * @author alanrw
- *
- */
-public class EmptyIterationStrategyTopNodeProblem extends ValidationProblem {
- public EmptyIterationStrategyTopNodeProblem(IterationStrategyTopNode bean) {
- super(bean);
- }
-
- @Override
- public String toString() {
- return getBean() + " is empty";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/IncompatibleGranularDepthProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/IncompatibleGranularDepthProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/IncompatibleGranularDepthProblem.java
deleted file mode 100644
index b86b05f..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/IncompatibleGranularDepthProblem.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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.AbstractGranularDepthPort;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-/**
- * @author alanrw
- */
-public class IncompatibleGranularDepthProblem extends ValidationProblem {
- private final Integer depth;
- private final Integer granularDepth;
-
- public IncompatibleGranularDepthProblem(AbstractGranularDepthPort bean,
- Integer depth, Integer granularDepth) {
- super(bean);
- this.depth = depth;
- this.granularDepth = granularDepth;
- }
-
- /**
- * @return the depth
- */
- public Integer getDepth() {
- return depth;
- }
-
- /**
- * @return the granularDepth
- */
- public Integer getGranularDepth() {
- return granularDepth;
- }
-
- @Override
- public String toString() {
- return getBean() + " has depth " + depth + " and granular depth "
- + granularDepth;
- }
-}