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/06/11 18:35:42 UTC

[23/31] incubator-taverna-language git commit: Package updated

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ProcessorNames.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ProcessorNames.java b/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ProcessorNames.java
deleted file mode 100644
index 3a0dd31..0000000
--- a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ProcessorNames.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.apache.tavlang.commandline.tools.inspect;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeModel;
-import javax.xml.bind.JAXBException;
-
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.common.URITools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/*
- * 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.
- */
-
-
-/*
- * list the processor names used in the workflow.
- * Supported formats: .t2flow, .wfbundle
- * */
-
-public class ProcessorNames {
-	
-	private List<String> fileList;
-	
-	private String file2;
-	
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	private URITools uriTools = new URITools();
-
-	public ProcessorNames(List<String> fileList, String file) throws ReaderException, IOException, JAXBException{
-		this.fileList = fileList;
-		this.file2 = file;
-		this.show();
-	}
-	
-	public void show() throws ReaderException, IOException, JAXBException{
-		WorkflowBundleIO io = new WorkflowBundleIO();
-		StringBuilder sb = new StringBuilder();
-		
-		for(String file : this.fileList){
-			File file2 = new File(file);
-			if(file2.isDirectory()){
-				for(File f : file2.listFiles()){
-					WorkflowBundle wfb = io.readBundle(f, null);
-					System.out.println("Processor tree of "+ f.getName() +" \n" +this.showProcessorTree(wfb));
-					sb.append("Processor tree of "+ f.getName() +" \n" +this.showProcessorTree(wfb) + "\n");
-				}
-			}else{
-				WorkflowBundle wfb = io.readBundle(new File(file), null);
-				System.out.println("Processor tree of "+ file +" \n" +this.showProcessorTree(wfb));
-				sb.append("Processor tree of "+ file +" \n" +this.showProcessorTree(wfb) + "\n");
-			}
-			
-			
-		}
-		
-		if(this.file2!=null){
-			File log = new File(file2);
-			FileWriter fw = new FileWriter(log);
-			BufferedWriter bw = new BufferedWriter(fw);
-			bw.write(sb.toString());
-			bw.close();
-			fw.close();
-		}
-	}
-	
-	private Workflow findNestedWorkflow(Processor processor) {
-		Profile profile = processor.getParent().getParent().getMainProfile();
-		return scufl2Tools.nestedWorkflowForProcessor(processor, profile);
-	}
-
-	private void findProcessors(WorkflowBundle ro, Workflow workflow,
-			DefaultMutableTreeNode parent) {
-		for (Processor processor : workflow.getProcessors()) {
-			DefaultMutableTreeNode processorNode = new DefaultMutableTreeNode(
-					processor.getName());
-			parent.add(processorNode);
-			Workflow wf = findNestedWorkflow(processor);
-			if (wf != null) {
-				findProcessors(ro, wf, processorNode);
-			}
-		}
-
-	}
-
-	public TreeModel makeProcessorTree(WorkflowBundle workflowBundle)
-			throws JAXBException, IOException {
-		Workflow workflow = workflowBundle.getMainWorkflow();
-		TreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(
-				workflow.getName()));
-		DefaultMutableTreeNode parent = (DefaultMutableTreeNode) treeModel
-				.getRoot();
-
-		findProcessors(workflowBundle, workflow, parent);
-		return treeModel;
-	}
-
-	public List<String> showProcessorNames(WorkflowBundle ro)
-			throws JAXBException, IOException {
-		ArrayList<String> names = new ArrayList<String>();
-		for (Processor processor : ro.getMainWorkflow().getProcessors()) {
-			names.add(processor.getName());
-		}
-		Collections.sort(names);
-		return names;
-	}
-
-	public String showProcessorTree(WorkflowBundle ro) throws JAXBException,
-			IOException {
-		TreeModel treeModel = makeProcessorTree(ro);
-		return treeModelAsString(treeModel);
-	}
-
-	public String treeModelAsString(TreeModel treeModel) {
-		StringBuffer sb = new StringBuffer();
-		Object root = treeModel.getRoot();
-		treeModelAsString(treeModel, root, sb, "");
-		return sb.toString();
-	}
-
-	protected void treeModelAsString(TreeModel treeModel, Object parent,
-			StringBuffer sb, String indentation) {
-		sb.append(indentation);
-		int childCount = treeModel.getChildCount(parent);
-		if (childCount == 0) {
-			sb.append("- ");
-		} else {
-			sb.append("+ ");
-			indentation = indentation + "  ";
-		}
-		sb.append(parent);
-		sb.append("\n");
-		for (int i = 0; i < childCount; i++) {
-			Object child = treeModel.getChild(parent, i);
-			treeModelAsString(treeModel, child, sb, indentation);
-		}
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ServiceTypes.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ServiceTypes.java b/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ServiceTypes.java
deleted file mode 100644
index f3d7396..0000000
--- a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/inspect/ServiceTypes.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.tavlang.commandline.tools.inspect;
-
-
-/*
- * 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.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/*
- * List the service types used in workflow.
- * Supported file formats : .wfbundle, .t2flow
- * */
-
-public class ServiceTypes {
-	
-	private List<String> filesList;
-	private Set<String> types = new LinkedHashSet<String>();
-	private String save;
-	
-	public ServiceTypes(List<String> filesList, String file) throws IOException, ReaderException{
-		this.filesList = filesList;
-		this.save = file;
-		this.service();
-		
-	}
-	
-	public void service() throws ReaderException, IOException{
-		WorkflowBundleIO io = new WorkflowBundleIO();
-		StringBuilder sb = new StringBuilder();
-		
-		for (String filepath : filesList) {
-			File file = new File(filepath);
-			
-			if(file.isDirectory()){
-				for(File f : file.listFiles()){
-				WorkflowBundle wfBundle = io.readBundle(f, null);
-				System.out.println("Service types used in " + f.getCanonicalPath() + " :" +"\n");
-				sb.append("Service types used in " + f.getCanonicalPath() + " :");
-				for (Profile profile : wfBundle.getProfiles()) {
-					for (Activity activity : profile.getActivities()) {
-						this.types.add(activity.getType().toASCIIString());
-					}
-				}
-				for(String t : types){
-					System.out.println(t);
-					sb.append(t + "\n");
-				}
-				System.out.println("\n**************************************************\n");
-				sb.append("\n**************************************************\n");
-				}
-			}else{
-			// mediaType = null  --> guess
-				WorkflowBundle wfBundle = io.readBundle(file, null);
-				System.out.println("Service types used in " + file.getCanonicalPath() + " :" + "\n");
-				sb.append("Service types used in " + file.getCanonicalPath() + " :");
-				for (Profile profile : wfBundle.getProfiles()) {
-					for (Activity activity : profile.getActivities()) {
-						this.types.add(activity.getType().toASCIIString());
-					}
-				}
-				for(String t : types){
-					System.out.println(t);
-					sb.append(t + "\n");
-				}
-				
-				System.out.println("\n**************************************************\n");
-				sb.append("\n**************************************************\n");
-			}
-		}
-		
-		if(save!=null){
-			File log = new File(save);
-			FileWriter fw = new FileWriter(log);
-			BufferedWriter bw = new BufferedWriter(fw);
-			bw.write(sb.toString());
-			bw.close();
-			fw.close();
-		}
-		
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/validate/Validate.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/validate/Validate.java b/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/validate/Validate.java
deleted file mode 100644
index 0da3363..0000000
--- a/taverna-language-commandline/src/main/java/org/apache/tavlang/commandline/tools/validate/Validate.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.tavlang.commandline.tools.validate;
-
-/*
- * 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.container.WorkflowBundle;
-import org.apache.taverna.scufl2.validation.ValidationReport;
-import org.apache.taverna.scufl2.validation.Validator;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidationListener;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-
-
-public class Validate {
-
-	public Validate(WorkflowBundle wfb){
-		System.out.println("Validation started...");
-		StructuralValidator v = new StructuralValidator();
-		StructuralValidationListener l = v.validate(wfb);
-		ValidationReport r;
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java b/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
new file mode 100644
index 0000000..0d1b3b2
--- /dev/null
+++ b/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
@@ -0,0 +1,57 @@
+package org.apache.taverna.tavlang.test;
+
+/*
+ * 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.tavlang.CommandLineTool;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CommandLineTest {
+	CommandLineTool commandLineTool = new CommandLineTool();
+	
+	@Test
+	public void testHelp(){
+//		Assert
+		commandLineTool.parse();
+		commandLineTool.parse("version");
+		commandLineTool.parse("help");
+		commandLineTool.parse("help", "convert");
+		commandLineTool.parse("help", "inspect");
+		commandLineTool.parse("help", "validate");
+		commandLineTool.parse("help", "help");
+	}
+	
+	@Test
+	public void testConvert(){
+		
+		
+//		CommandLineTool tool = new CommandLineTool();
+		commandLineTool.parse("convert", "-r", "-structure",  "-i", "/home/menaka/conv/aaa");
+//		CommandLineTool tool2 = new CommandLineTool();
+//		commandLineTool.parse("convert", "-r", "-wfdesc", "-o", "/files/dir", "-i", "/files0/dir");
+//		commandLineTool.parse();
+//		commandLineTool.parse();
+//		commandLineTool.parse();
+		
+	}
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/Scufl2ConvertTest.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/Scufl2ConvertTest.java b/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/Scufl2ConvertTest.java
new file mode 100644
index 0000000..5e882d3
--- /dev/null
+++ b/taverna-language-commandline/src/test/java/org/apache/taverna/tavlang/test/Scufl2ConvertTest.java
@@ -0,0 +1,14 @@
+package org.apache.taverna.tavlang.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class Scufl2ConvertTest{
+
+	@Test
+	public void test() {
+//		fail("Not yet implemented");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/CommandLineTest.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/CommandLineTest.java b/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/CommandLineTest.java
deleted file mode 100644
index 6e03c88..0000000
--- a/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/CommandLineTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.tavlang.commandline.test;
-
-/*
- * 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.tavlang.commandline.CommandLineTool;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CommandLineTest {
-	CommandLineTool commandLineTool = new CommandLineTool();
-	
-	@Test
-	public void testHelp(){
-//		Assert
-		commandLineTool.parse();
-		commandLineTool.parse("version");
-		commandLineTool.parse("help");
-		commandLineTool.parse("help", "convert");
-		commandLineTool.parse("help", "inspect");
-		commandLineTool.parse("help", "validate");
-		commandLineTool.parse("help", "help");
-	}
-	
-	@Test
-	public void testConvert(){
-		
-		
-//		CommandLineTool tool = new CommandLineTool();
-//		commandLineTool.parse("convert", "-r", "-wfbundle", "-o", "/files/dir", "-i", "/files0/dir");
-//		CommandLineTool tool2 = new CommandLineTool();
-//		commandLineTool.parse("convert", "-r", "-wfdesc", "-o", "/files/dir", "-i", "/files0/dir");
-//		commandLineTool.parse();
-//		commandLineTool.parse();
-//		commandLineTool.parse();
-		
-	}
-	
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/7fea7108/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/Scufl2ConvertTest.java
----------------------------------------------------------------------
diff --git a/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/Scufl2ConvertTest.java b/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/Scufl2ConvertTest.java
deleted file mode 100644
index 09fce9c..0000000
--- a/taverna-language-commandline/src/test/java/org/apache/tavlang/commandline/test/Scufl2ConvertTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.tavlang.commandline.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class Scufl2ConvertTest{
-
-	@Test
-	public void test() {
-//		fail("Not yet implemented");
-	}
-
-}