You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/24 11:45:27 UTC
[5/5] incubator-taverna-commandline git commit: package name changes
package name changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/commit/9965dffe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/tree/9965dffe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/diff/9965dffe
Branch: refs/heads/master
Commit: 9965dffe95f0a9568f3defde1b20487c96024b02
Parents: 7db5214
Author: Dmitry Repchevsky <re...@list.ru>
Authored: Tue Mar 24 11:44:58 2015 +0100
Committer: Dmitry Repchevsky <re...@list.ru>
Committed: Tue Mar 24 11:44:58 2015 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
taverna-commandline-api/pom.xml | 2 +-
.../exceptions/ArgumentsParsingException.java | 34 --
.../CommandLineMasterPasswordException.java | 34 --
.../DatabaseConfigurationException.java | 43 --
.../exceptions/InputMismatchException.java | 61 ---
.../exceptions/InvalidOptionException.java | 30 --
.../exceptions/OpenDataflowException.java | 44 --
.../exceptions/ReadInputException.java | 35 --
.../exceptions/SaveResultsException.java | 34 --
.../commandline/options/CommandLineOptions.java | 119 -----
.../exceptions/ArgumentsParsingException.java | 33 ++
.../CommandLineMasterPasswordException.java | 33 ++
.../DatabaseConfigurationException.java | 42 ++
.../exceptions/InputMismatchException.java | 60 +++
.../exceptions/InvalidOptionException.java | 29 ++
.../exceptions/OpenDataflowException.java | 43 ++
.../exceptions/ReadInputException.java | 34 ++
.../exceptions/SaveResultsException.java | 33 ++
.../commandline/options/CommandLineOptions.java | 118 +++++
taverna-commandline-common/pom.xml | 2 +-
.../CommandLineMasterPasswordProvider.java | 184 -------
.../taverna/t2/commandline/CommandLineTool.java | 437 -----------------
.../data/DatabaseConfigurationHandler.java | 154 ------
.../t2/commandline/data/ErrorValueHandler.java | 72 ---
.../t2/commandline/data/InputsHandler.java | 277 -----------
.../t2/commandline/data/SaveResultsHandler.java | 86 ----
.../CommandLineMasterPasswordProvider.java | 183 +++++++
.../taverna/commandline/CommandLineTool.java | 436 +++++++++++++++++
.../data/DatabaseConfigurationHandler.java | 153 ++++++
.../commandline/data/ErrorValueHandler.java | 71 +++
.../taverna/commandline/data/InputsHandler.java | 276 +++++++++++
.../commandline/data/SaveResultsHandler.java | 85 ++++
.../taverna-commandline-common-context-osgi.xml | 16 +-
.../taverna-commandline-common-context.xml | 4 +-
.../TestDatabaseConfigurationHandler.java | 15 -
.../TestDatabaseConfigurationHandler.java | 33 ++
taverna-commandline-launcher/pom.xml | 2 +-
.../commandline/CommandLineOptionsImpl.java | 444 +++++++++++++++++
.../taverna/commandline/TavernaCommandLine.java | 142 ++++++
.../commandline/CommandLineOptionsImpl.java | 445 -----------------
.../taverna/commandline/TavernaCommandLine.java | 143 ------
.../TestCommandLineOptionsHandler.java | 286 +++++++++++
.../TestCommandLineOptionsHandler.java | 267 ----------
taverna-commandline-product/pom.xml | 6 +-
taverna-commandline-tests/pom.xml | 10 +-
.../commandline/TavernaCommandLineTest.java | 485 +++++++++++++++++++
.../taverna/commandline/WorkflowTestRunner.java | 70 +++
.../taverna/commandline/WorkflowTestSuite.java | 79 +++
.../commandline/TavernaCommandLineTest.java | 485 -------------------
.../taverna/commandline/WorkflowTestRunner.java | 70 ---
.../taverna/commandline/WorkflowTestSuite.java | 79 ---
.../workflows/xmlSplitter/xmlSplitter.t2flow | 206 ++++----
53 files changed, 3297 insertions(+), 3269 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 861f32f..4446961 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
</parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Taverna Command Line</name>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/pom.xml b/taverna-commandline-api/pom.xml
index 98ae247..ab49d38 100644
--- a/taverna-commandline-api/pom.xml
+++ b/taverna-commandline-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<packaging>bundle</packaging>
<artifactId>taverna-commandline-api</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
deleted file mode 100644
index eb21cd7..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class ArgumentsParsingException extends Exception {
-
- public ArgumentsParsingException(String message) {
- super(message);
- }
-
- public ArgumentsParsingException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
deleted file mode 100644
index 0714275..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class CommandLineMasterPasswordException extends Exception {
-
- public CommandLineMasterPasswordException(String message) {
- super(message);
- }
-
- public CommandLineMasterPasswordException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
deleted file mode 100644
index 616fb70..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-public class DatabaseConfigurationException extends Exception {
-
- private static final long serialVersionUID = -4128248547532355697L;
-
- public DatabaseConfigurationException() {
-
- }
-
- public DatabaseConfigurationException(String message) {
- super(message);
- }
-
- public DatabaseConfigurationException(Throwable cause) {
- super(cause);
- }
-
- public DatabaseConfigurationException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
deleted file mode 100644
index da03891..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-import java.util.Set;
-
-public class InputMismatchException extends InvalidOptionException {
-
- private static final long serialVersionUID = -5368068332397293706L;
- private final Set<String> expectedInputNames;
- private final Set<String> providedInputNames;
-
- public InputMismatchException(String msg, Set<String> expectedInputNames, Set<String> providedInputNames) {
- super(msg);
- this.expectedInputNames = expectedInputNames;
- this.providedInputNames = providedInputNames;
- }
-
- public String getMessage() {
- String result = super.getMessage();
-
- if (expectedInputNames != null){
- result += "\n" + expectedInputNames.size() + " inputs were expected";
- if (expectedInputNames.size()>0) result += " which are:\n";
- for (String name : expectedInputNames) {
- result += "'"+name+"' ";
- }
- }
-
- if (providedInputNames != null){
- result += "\n" + providedInputNames.size()
- + " inputs were provided";
- if (providedInputNames.size() > 0)
- result += " which are:\n";
- for (String name : providedInputNames) {
- result += "'" + name + "' ";
- }
- }
- return result;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
deleted file mode 100644
index c07a19f..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-public class InvalidOptionException extends Exception {
-
- private static final long serialVersionUID = 2467409785164223258L;
-
- public InvalidOptionException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
deleted file mode 100644
index 664ab71..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-public class OpenDataflowException extends Exception {
-
-
- private static final long serialVersionUID = 4778578311101082197L;
-
- public OpenDataflowException() {
-
- }
-
- public OpenDataflowException(String message) {
- super(message);
- }
-
- public OpenDataflowException(Throwable cause) {
- super(cause);
- }
-
- public OpenDataflowException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
deleted file mode 100644
index 226d6ea..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-public class ReadInputException extends Exception {
-
- private static final long serialVersionUID = -3494432791254643055L;
-
- public ReadInputException(String msg) {
- super(msg);
- }
-
- public ReadInputException(String msg, Throwable e) {
- super(msg,e);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
deleted file mode 100644
index 7ad460d..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class SaveResultsException extends Exception {
-
- public SaveResultsException(String message) {
- super(message);
- }
-
- public SaveResultsException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
deleted file mode 100644
index dd8e20f..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.options;
-
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-
-/**
- *
- *
- * @author David Withers
- */
-public interface CommandLineOptions {
-
- public static final String CREDENTIAL_MANAGER_DIR_OPTION = "cmdir";
- public static final String CREDENTIAL_MANAGER_PASSWORD_OPTION = "cmpassword";
-
- public boolean askedForHelp();
-
- public boolean isProvenanceEnabled();
-
- public void displayHelp();
-
- public void displayHelp(boolean showFullText);
-
- public String[] getArgs();
-
- /**
- *
- * @return the port that the database should run on
- */
- public String getDatabasePort();
-
- /**
- *
- * @return a path to a properties file that contains database configuration
- * settings
- */
- public String getDatabaseProperties();
-
- /**
- * Returns an array that alternates between a portname and path to a file
- * containing the input values. Therefore the array will always contain an
- * even number of elements
- *
- * @return an array of portname and path to files containing individual
- * inputs.
- */
- public String[] getInputFiles();
-
- public String[] getInputValues();
-
- public String getLogFile();
-
- /**
- *
- * @return the directory to write the results to
- */
- public String getOutputDirectory();
-
- public boolean getStartDatabase();
-
- /**
- * @return the directory with Credential Manager's files
- */
- public String getCredentialManagerDir();
-
- public boolean getStartDatabaseOnly() throws InvalidOptionException;
-
- public String getWorkflow() throws InvalidOptionException;
-
- public boolean hasDelimiterFor(String inputName);
-
- public boolean hasInputFiles();
-
- public boolean hasInputValues();
-
- public boolean hasLogFile();
-
- public boolean hasOption(String option);
-
- public boolean hasSaveResultsToBundle() ;
-
- public String inputDelimiter(String inputName);
-
- public boolean isClientServer();
-
- public boolean isEmbedded();
-
- public boolean isInMemory();
-
- /**
- * Save the results to a directory if -outputdir has been explicitly defined,
- * or if -outputdoc has not been defined.
- *
- * @return boolean
- */
- public boolean saveResultsToDirectory();
-
- public String saveResultsToBundle();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
new file mode 100644
index 0000000..bf3785f
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
@@ -0,0 +1,33 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class ArgumentsParsingException extends Exception {
+
+ public ArgumentsParsingException(String message) {
+ super(message);
+ }
+
+ public ArgumentsParsingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
new file mode 100644
index 0000000..65442ab
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
@@ -0,0 +1,33 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class CommandLineMasterPasswordException extends Exception {
+
+ public CommandLineMasterPasswordException(String message) {
+ super(message);
+ }
+
+ public CommandLineMasterPasswordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
new file mode 100644
index 0000000..05da893
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+public class DatabaseConfigurationException extends Exception {
+
+ private static final long serialVersionUID = -4128248547532355697L;
+
+ public DatabaseConfigurationException() {
+
+ }
+
+ public DatabaseConfigurationException(String message) {
+ super(message);
+ }
+
+ public DatabaseConfigurationException(Throwable cause) {
+ super(cause);
+ }
+
+ public DatabaseConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
new file mode 100644
index 0000000..cae6bfb
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
@@ -0,0 +1,60 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+import java.util.Set;
+
+public class InputMismatchException extends InvalidOptionException {
+
+ private static final long serialVersionUID = -5368068332397293706L;
+ private final Set<String> expectedInputNames;
+ private final Set<String> providedInputNames;
+
+ public InputMismatchException(String msg, Set<String> expectedInputNames, Set<String> providedInputNames) {
+ super(msg);
+ this.expectedInputNames = expectedInputNames;
+ this.providedInputNames = providedInputNames;
+ }
+
+ public String getMessage() {
+ String result = super.getMessage();
+
+ if (expectedInputNames != null){
+ result += "\n" + expectedInputNames.size() + " inputs were expected";
+ if (expectedInputNames.size()>0) result += " which are:\n";
+ for (String name : expectedInputNames) {
+ result += "'"+name+"' ";
+ }
+ }
+
+ if (providedInputNames != null){
+ result += "\n" + providedInputNames.size()
+ + " inputs were provided";
+ if (providedInputNames.size() > 0)
+ result += " which are:\n";
+ for (String name : providedInputNames) {
+ result += "'" + name + "' ";
+ }
+ }
+ return result;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
new file mode 100644
index 0000000..410803c
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+public class InvalidOptionException extends Exception {
+
+ private static final long serialVersionUID = 2467409785164223258L;
+
+ public InvalidOptionException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java
new file mode 100644
index 0000000..3926dd7
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java
@@ -0,0 +1,43 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+public class OpenDataflowException extends Exception {
+
+
+ private static final long serialVersionUID = 4778578311101082197L;
+
+ public OpenDataflowException() {
+
+ }
+
+ public OpenDataflowException(String message) {
+ super(message);
+ }
+
+ public OpenDataflowException(Throwable cause) {
+ super(cause);
+ }
+
+ public OpenDataflowException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
new file mode 100644
index 0000000..22b6f82
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
@@ -0,0 +1,34 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+public class ReadInputException extends Exception {
+
+ private static final long serialVersionUID = -3494432791254643055L;
+
+ public ReadInputException(String msg) {
+ super(msg);
+ }
+
+ public ReadInputException(String msg, Throwable e) {
+ super(msg,e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
new file mode 100644
index 0000000..501b4b5
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
@@ -0,0 +1,33 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class SaveResultsException extends Exception {
+
+ public SaveResultsException(String message) {
+ super(message);
+ }
+
+ public SaveResultsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
new file mode 100644
index 0000000..1b00c96
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
@@ -0,0 +1,118 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.commandline.options;
+
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public interface CommandLineOptions {
+
+ public static final String CREDENTIAL_MANAGER_DIR_OPTION = "cmdir";
+ public static final String CREDENTIAL_MANAGER_PASSWORD_OPTION = "cmpassword";
+
+ public boolean askedForHelp();
+
+ public boolean isProvenanceEnabled();
+
+ public void displayHelp();
+
+ public void displayHelp(boolean showFullText);
+
+ public String[] getArgs();
+
+ /**
+ *
+ * @return the port that the database should run on
+ */
+ public String getDatabasePort();
+
+ /**
+ *
+ * @return a path to a properties file that contains database configuration
+ * settings
+ */
+ public String getDatabaseProperties();
+
+ /**
+ * Returns an array that alternates between a portname and path to a file
+ * containing the input values. Therefore the array will always contain an
+ * even number of elements
+ *
+ * @return an array of portname and path to files containing individual
+ * inputs.
+ */
+ public String[] getInputFiles();
+
+ public String[] getInputValues();
+
+ public String getLogFile();
+
+ /**
+ *
+ * @return the directory to write the results to
+ */
+ public String getOutputDirectory();
+
+ public boolean getStartDatabase();
+
+ /**
+ * @return the directory with Credential Manager's files
+ */
+ public String getCredentialManagerDir();
+
+ public boolean getStartDatabaseOnly() throws InvalidOptionException;
+
+ public String getWorkflow() throws InvalidOptionException;
+
+ public boolean hasDelimiterFor(String inputName);
+
+ public boolean hasInputFiles();
+
+ public boolean hasInputValues();
+
+ public boolean hasLogFile();
+
+ public boolean hasOption(String option);
+
+ public boolean hasSaveResultsToBundle() ;
+
+ public String inputDelimiter(String inputName);
+
+ public boolean isClientServer();
+
+ public boolean isEmbedded();
+
+ public boolean isInMemory();
+
+ /**
+ * Save the results to a directory if -outputdir has been explicitly defined,
+ * or if -outputdoc has not been defined.
+ *
+ * @return boolean
+ */
+ public boolean saveResultsToDirectory();
+
+ public String saveResultsToBundle();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/pom.xml b/taverna-commandline-common/pom.xml
index 0627097..f9af66e 100644
--- a/taverna-commandline-common/pom.xml
+++ b/taverna-commandline-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>taverna-commandline-common</artifactId>
<packaging>bundle</packaging>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
deleted file mode 100644
index f9a0171..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-2010 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline;
-
-import java.io.BufferedReader;
-import java.io.Console;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import net.sf.taverna.t2.commandline.exceptions.CommandLineMasterPasswordException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
-
-import org.apache.log4j.Logger;
-
-/**
- * An implementation of {@link MasterPasswordProvider} that reads Credential Manager's
- * master password from stdin (pipe or terminal) is -cmpassword option is present in command
- * line arguments. Otherwise it tries to read it from a special file password.txt in a special
- * directory specified by -cmdir option, if present.
- *
- * @author Alex Nenadic
- */
-public class CommandLineMasterPasswordProvider implements MasterPasswordProvider {
-
- private static final String CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION = "cmpassword";
- private static final String CREDENTIAL_MANAGER_DIRECTORY_OPTION = "cmdir";
-
- private static Logger logger = Logger.getLogger(CommandLineMasterPasswordProvider.class);
-
- private String masterPassword = null;
- private int priority = 200;
-
- private boolean finishedReadingPassword = false;
- private final CommandLineOptions commandLineOptions;
-
- public CommandLineMasterPasswordProvider(CommandLineOptions commandLineOptions) {
- this.commandLineOptions = commandLineOptions;
- }
-
- @Override
- public String getMasterPassword(boolean firstTime) {
- if (!finishedReadingPassword) {
- // -cmpassword option was present in the command line arguments
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION)) {
- // Try to read the password from stdin (terminal or pipe)
- try {
- masterPassword = getCredentialManagerPasswordFromStdin();
- } catch (CommandLineMasterPasswordException e) {
- masterPassword = null;
- }
- }
- // -cmpassword option was not present in the command line arguments
- // and -cmdir option was there - try to get the master password from
- // the "special" password file password.txt inside the Cred. Manager directory.
- else {
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
- // Try to read the password from a special file located in
- // Credential Manager directory (if the dir was not null)
- try {
- masterPassword = getCredentialManagerPasswordFromFile();
- } catch (CommandLineMasterPasswordException ex) {
- masterPassword = null;
- }
- }
- }
- finishedReadingPassword = true; // we do not want to attempt to read from stdin several
- // times
- }
- return masterPassword;
- }
-
- public void setMasterPassword(String masterPassword) {
- this.masterPassword = masterPassword;
- finishedReadingPassword = true;
- }
-
- @Override
- public int getProviderPriority() {
- return priority;
- }
-
- private String getCredentialManagerPasswordFromStdin()
- throws CommandLineMasterPasswordException {
-
- String password = null;
-
- Console console = System.console();
-
- if (console == null) { // password is being piped in, not entered in the terminal by user
- BufferedReader buffReader = null;
- try {
- buffReader = new BufferedReader(new InputStreamReader(System.in));
- password = buffReader.readLine();
- } catch (IOException ex) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error(
- "An error occured while trying to read Credential Manager's password that was piped in: "
- + ex.getMessage(), ex);
- throw new CommandLineMasterPasswordException(
- "An error occured while trying to read Credential Manager's password that was piped in: "
- + ex.getMessage(), ex);
- } finally {
- try {
- buffReader.close();
- } catch (Exception ioe1) {
- // Ignore
- }
- }
- } else { // read the password from the terminal as entered by the user
- try {
- // Block until user enters password
- char passwordArray[] = console.readPassword("Password for Credential Manager: ");
- if (passwordArray != null) { // user did not abort input
- password = new String(passwordArray);
- } // else password will be null
-
- } catch (Exception ex) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error(
- "An error occured while trying to read Credential Manager's password from the terminal: "
- + ex.getMessage(), ex);
- throw new CommandLineMasterPasswordException(
- "An error occured while trying to read Credential Manager's password from the terminal: "
- + ex.getMessage(), ex);
- }
- }
- return password;
- }
-
- private String getCredentialManagerPasswordFromFile() throws CommandLineMasterPasswordException {
- String password = null;
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
- String cmDir = commandLineOptions.getCredentialManagerDir();
-
- File passwordFile = new File(cmDir, "password.txt");
- BufferedReader buffReader = null;
- try {
- buffReader = new BufferedReader(new FileReader(passwordFile));
- password = buffReader.readLine();
- } catch (IOException ioe) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error("There was an error reading the Credential Manager password from "
- + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
- throw new CommandLineMasterPasswordException(
- "There was an error reading the Credential Manager password from "
- + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
- } finally {
- try {
- buffReader.close();
- } catch (Exception ioe1) {
- // Ignore
- }
- }
- }
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
deleted file mode 100644
index 87be64b..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingException;
-
-import net.sf.taverna.t2.commandline.data.DatabaseConfigurationHandler;
-import net.sf.taverna.t2.commandline.data.InputsHandler;
-import net.sf.taverna.t2.commandline.data.SaveResultsHandler;
-import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
-import net.sf.taverna.t2.commandline.exceptions.InputMismatchException;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.exceptions.OpenDataflowException;
-import net.sf.taverna.t2.commandline.exceptions.ReadInputException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.RollingFileAppender;
-import org.apache.taverna.databundle.DataBundles;
-import org.apache.taverna.robundle.Bundle;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-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.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.validation.ValidationException;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-
-import uk.org.taverna.configuration.database.DatabaseConfiguration;
-import uk.org.taverna.configuration.database.DatabaseManager;
-import uk.org.taverna.platform.execution.api.ExecutionEnvironment;
-import uk.org.taverna.platform.execution.api.InvalidExecutionIdException;
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-import uk.org.taverna.platform.report.State;
-import uk.org.taverna.platform.report.WorkflowReport;
-import uk.org.taverna.platform.run.api.InvalidRunIdException;
-import uk.org.taverna.platform.run.api.RunProfile;
-import uk.org.taverna.platform.run.api.RunProfileException;
-import uk.org.taverna.platform.run.api.RunService;
-import uk.org.taverna.platform.run.api.RunStateException;
-
-/**
- * A utility class that wraps the process of executing a workflow, allowing workflows to be easily
- * executed independently of the GUI.
- *
- * @author Stuart Owen
- * @author Alex Nenadic
- */
-public class CommandLineTool {
- private static boolean BOOTSTRAP_LOGGING = false;
- private static Logger logger = Logger.getLogger(CommandLineTool.class);
-
- private RunService runService;
- private CredentialManager credentialManager;
- private CommandLineOptions commandLineOptions;
- private WorkflowBundle workflowBundle;
- private WorkflowBundleIO workflowBundleIO;
- private DatabaseConfiguration databaseConfiguration;
- private DatabaseManager databaseManager;
-
- public void run() {
- try {
- if (BOOTSTRAP_LOGGING)
- initialiseLogging();
- int result = setupAndExecute();
- System.exit(result);
- } catch (InvalidOptionException | IOException | ReadInputException
- | InvalidRunIdException | RunStateException
- | InvalidExecutionIdException | OpenDataflowException
- | RunProfileException e) {
- error(e.getMessage());
- } catch (CMException e) {
- error("There was an error initializing Taverna's SSLSocketFactory from Credential Manager. "
- + e.getMessage());
- } catch (ReaderException e) {
- error("There was an error reading the workflow: " + e.getMessage());
- } catch (ValidationException e) {
- error("There was an error validating the workflow: " + e.getMessage());
- } catch (InvalidWorkflowException e) {
- error("There was an error validating the workflow: " + e.getMessage());
- } catch (DatabaseConfigurationException e) {
- error("There was an error configuring the database: " + e.getMessage());
- }
- System.exit(1);
- }
-
- private void initialiseLogging() {
- LogManager.resetConfiguration();
-
- if (System.getProperty("log4j.configuration") == null) {
- try {
- PropertyConfigurator.configure(CommandLineTool.class.getClassLoader()
- .getResource("cl-log4j.properties").toURI().toURL());
- } catch (MalformedURLException e) {
- logger.error("There was a serious error reading the default logging configuration",
- e);
- } catch (URISyntaxException e) {
- logger.error("There was a serious error reading the default logging configuration",
- e);
- }
-
- } else {
- PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
- }
-
- if (commandLineOptions.hasLogFile()) {
- RollingFileAppender appender;
- try {
-
- PatternLayout layout = new PatternLayout("%-5p %d{ISO8601} (%c:%L) - %m%n");
- appender = new RollingFileAppender(layout, commandLineOptions.getLogFile());
- appender.setMaxFileSize("1MB");
- appender.setEncoding("UTF-8");
- appender.setMaxBackupIndex(4);
- // Let root logger decide level
- appender.setThreshold(Level.ALL);
- LogManager.getRootLogger().addAppender(appender);
- } catch (IOException e) {
- System.err.println("Could not log to " + commandLineOptions.getLogFile());
- }
- }
- }
-
- public int setupAndExecute() throws InputMismatchException, InvalidOptionException,
- CMException, OpenDataflowException, ReaderException, IOException, ValidationException,
- ReadInputException, InvalidWorkflowException, RunProfileException,
- InvalidRunIdException, RunStateException, InvalidExecutionIdException, DatabaseConfigurationException {
-
- if (!commandLineOptions.askedForHelp()) {
- setupDatabase(commandLineOptions);
-
- if (commandLineOptions.getWorkflow() != null) {
-
- /* Set context class loader to us,
- * so that things such as JSON-LD caching of
- * robundle works.
- */
-
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
-
- /*
- * Initialise Credential Manager and SSL stuff quite early as
- * parsing and validating the workflow may require it
- */
- String credentialManagerDirPath = commandLineOptions.getCredentialManagerDir();
-
- /*
- * If credentialManagerDirPath is null, the Credential Manager
- * will be initialized from the default location in
- * <TAVERNA_HOME>/security somewhere inside user's home
- * directory. This should not be used when running command line
- * tool on a server and the Credential Manager dir path should
- * always be passed in as we do not want to store the security
- * files in user's home directory on the server (we do not even
- * know which user the command line tool will be running as).
- */
- if (credentialManagerDirPath != null) {
- credentialManager.setConfigurationDirectoryPath(new File(
- credentialManagerDirPath));
- }
-
- // Initialise the SSL stuff - set the SSLSocketFactory
- // to use Taverna's Keystore and Truststore.
- credentialManager.initializeSSL();
-
- URL workflowURL = readWorkflowURL(commandLineOptions.getWorkflow());
-
- workflowBundle = workflowBundleIO.readBundle(workflowURL, null);
-
- logger.debug("Read the wf bundle");
-
- validateWorkflowBundle(workflowBundle);
- logger.debug("Validated the wf bundle");
-
-
- Set<ExecutionEnvironment> executionEnvironments = runService
- .getExecutionEnvironments();
-
- ExecutionEnvironment executionEnvironment = null;
-
- /*
- * Find the right execution environment, e.g. local execution
- * with the correct reference service based on command line
- * options
- */
- while (executionEnvironments.iterator().hasNext()) {
- // TODO Choose the right one
- // take the fist one for now
- executionEnvironment = executionEnvironments.iterator().next();
- break;
- }
-
- logger.debug("Got the execution environment");
-
- InputsHandler inputsHandler = new InputsHandler();
- Map<String, InputWorkflowPort> portMap = new HashMap<String, InputWorkflowPort>();
-
- Workflow workflow = workflowBundle.getMainWorkflow();
-
- for (InputWorkflowPort port : workflow.getInputPorts()) {
- portMap.put(port.getName(), port);
- }
- inputsHandler.checkProvidedInputs(portMap, commandLineOptions);
- logger.debug("Checked inputs");
-
- Bundle inputs = inputsHandler.registerInputs(portMap, commandLineOptions, null);
- logger.debug("Registered inputs");
-
- RunProfile runProfile = new RunProfile(executionEnvironment, workflowBundle, inputs);
-
- String runId = runService.createRun(runProfile);
-
- runService.start(runId);
- logger.debug("Started wf run");
-
- WorkflowReport report = runService.getWorkflowReport(runId);
-
- while (!workflowFinished(report)) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- System.err.println("Interrupted while waiting for workflow to finish");
- return 1;
- }
- }
-
- NamedSet<OutputWorkflowPort> workflowOutputPorts = workflow.getOutputPorts();
- if (!workflowOutputPorts.isEmpty()) {
- File outputDir = null;
-
- if (commandLineOptions.saveResultsToDirectory()) {
- outputDir = determineOutputDir(commandLineOptions, workflowBundle.getName());
- outputDir.mkdirs();
- }
-
- Path outputs = DataBundles.getOutputs(runService.getDataBundle(runId));
-
- if (outputDir != null) {
- SaveResultsHandler saveResultsHandler = new SaveResultsHandler(outputDir);
-
- for (OutputWorkflowPort outputWorkflowPort : workflowOutputPorts) {
- String workflowOutputPortName = outputWorkflowPort.getName();
- Path output = DataBundles.getPort(outputs, workflowOutputPortName);
- if (!DataBundles.isMissing(output)) {
- saveResultsHandler.saveResultsForPort(workflowOutputPortName, output);
- }
- }
- }
- }
- if (commandLineOptions.saveResultsToBundle() != null) {
- Path bundlePath = Paths.get(commandLineOptions.saveResultsToBundle());
- DataBundles.closeAndSaveBundle(runService.getDataBundle(runId), bundlePath);
- System.out.println("Workflow Run Bundle saved to: " + bundlePath.toAbsolutePath());
- } else {
- System.out.println("Workflow Run Bundle: " + runService.getDataBundle(runId).getSource());
- // For debugging we'll leave it in /tmp for now
- runService.getDataBundle(runId).setDeleteOnClose(false);
- DataBundles.closeBundle(runService.getDataBundle(runId));
- }
-
- if (report.getState().equals(State.FAILED)) {
- System.out.println("Workflow failed - see report below.");
- System.out.println(report);
- } else if (report.getState().equals(State.COMPLETED)) {
- System.out.println("Workflow completed.");
- }
-
- }
- } else {
- commandLineOptions.displayHelp();
- }
-
- // wait until user hits CTRL-C before exiting
- if (commandLineOptions.getStartDatabaseOnly()) {
- // FIXME: need to do this more gracefully.
- while (true) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- return 0;
- }
- }
- }
-
- return 0;
- }
-
- private boolean workflowFinished(WorkflowReport report) {
- State state = report.getState();
- if (state == State.CANCELLED || state == State.COMPLETED || state == State.FAILED) {
- return true;
- }
- return false;
- }
-
- protected void validateWorkflowBundle(WorkflowBundle workflowBundle) throws ValidationException {
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
- cv.checkCorrectness(workflowBundle, true, rcvl);
- if (rcvl.detectedProblems()) {
- throw rcvl.getException();
- }
-
- StructuralValidator sv = new StructuralValidator();
- ReportStructuralValidationListener rsvl = new ReportStructuralValidationListener();
- sv.checkStructure(workflowBundle, rsvl);
- if (rsvl.detectedProblems()) {
- throw rcvl.getException();
- }
- }
-
- private void setupDatabase(CommandLineOptions options)
- throws DatabaseConfigurationException {
- DatabaseConfigurationHandler dbHandler = new DatabaseConfigurationHandler(
- options, databaseConfiguration, databaseManager);
- dbHandler.configureDatabase();
- try {
- if (!options.isInMemory())
- dbHandler.testDatabaseConnection();
- } catch (NamingException e) {
- throw new DatabaseConfigurationException(
- "There was an error trying to setup the database datasource: "
- + e.getMessage(), e);
- } catch (SQLException e) {
- if (options.isClientServer())
- throw new DatabaseConfigurationException(
- "There was an error whilst making a test database connection. If running with -clientserver you should check that a server is running (check -startdb or -dbproperties)",
- e);
- if (options.isEmbedded())
- throw new DatabaseConfigurationException(
- "There was an error whilst making a test database connection. If running with -embedded you should make sure that another process isn't using the database, or a server running through -startdb",
- e);
- }
- }
-
- private File determineOutputDir(CommandLineOptions options, String dataflowName) {
- File result = new File(dataflowName + "_output");
- int x = 1;
- while (result.exists()) {
- result = new File(dataflowName + "_output_" + x);
- x++;
- }
- System.out.println("Outputs will be saved to the directory: "
- + result.getAbsolutePath());
- return result;
- }
-
- protected void error(String msg) {
- System.err.println(msg);
- }
-
- private URL readWorkflowURL(String workflowOption) throws OpenDataflowException {
- try {
- return new URL(new URL("file:"), workflowOption);
- } catch (MalformedURLException e) {
- throw new OpenDataflowException("The was an error processing the URL to the workflow: "
- + e.getMessage(), e);
- }
- }
-
- public void setCommandLineOptions(CommandLineOptions commandLineOptions){
- this.commandLineOptions = commandLineOptions;
- }
-
- public void setRunService(RunService runService) {
- this.runService = runService;
- }
-
- public void setCredentialManager(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
- public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
- this.workflowBundleIO = workflowBundleIO;
- }
-
- /**
- * Sets the databaseConfiguration.
- *
- * @param databaseConfiguration the new value of databaseConfiguration
- */
- public void setDatabaseConfiguration(DatabaseConfiguration databaseConfiguration) {
- this.databaseConfiguration = databaseConfiguration;
- }
-
- /**
- * Sets the databaseManager.
- *
- * @param databaseManager the new value of databaseManager
- */
- public void setDatabaseManager(DatabaseManager databaseManager) {
- this.databaseManager = databaseManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
deleted file mode 100644
index 46b6c92..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.data;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.naming.NamingException;
-
-import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.database.DatabaseConfiguration;
-import uk.org.taverna.configuration.database.DatabaseManager;
-
-/**
- * Handles the initialisation and configuration of the data source according to
- * the command line arguments, or a properties file.
- * This also handles starting a network based instance of a Derby server, if requested.
- *
- * @author Stuart Owen
- *
- */
-public class DatabaseConfigurationHandler {
-
- private static Logger logger = Logger.getLogger(DatabaseConfigurationHandler.class);
- private final CommandLineOptions options;
- private final DatabaseConfiguration dbConfig;
- private final DatabaseManager databaseManager;
-
- public DatabaseConfigurationHandler(CommandLineOptions options, DatabaseConfiguration databaseConfiguration, DatabaseManager databaseManager) {
- this.options = options;
- this.dbConfig = databaseConfiguration;
- this.databaseManager = databaseManager;
- databaseConfiguration.disableAutoSave();
- }
-
- public void configureDatabase() throws DatabaseConfigurationException {
- overrideDefaults();
- useOptions();
- if (dbConfig.getStartInternalDerbyServer()) {
- databaseManager.startDerbyNetworkServer();
- System.out.println("Started Derby Server on Port: "
- + dbConfig.getCurrentPort());
- }
- }
-
- public DatabaseConfiguration getDBConfig() {
- return dbConfig;
- }
-
- private void importConfigurationFromStream(InputStream inStr)
- throws IOException {
- Properties p = new Properties();
- p.load(inStr);
- for (Object key : p.keySet()) {
- dbConfig.setProperty((String)key, p.getProperty((String)key).trim());
- }
- }
-
- protected void overrideDefaults() throws DatabaseConfigurationException {
-
- InputStream inStr = DatabaseConfigurationHandler.class.getClassLoader().getResourceAsStream("database-defaults.properties");
- try {
- importConfigurationFromStream(inStr);
- } catch (IOException e) {
- throw new DatabaseConfigurationException("There was an error reading the default database configuration settings: "+e.getMessage(),e);
- }
- }
-
- protected void readConfigirationFromFile(String filename) throws IOException {
- FileInputStream fileInputStream = new FileInputStream(filename);
- importConfigurationFromStream(fileInputStream);
- fileInputStream.close();
- }
-
- public void testDatabaseConnection()
- throws DatabaseConfigurationException, NamingException, SQLException {
- //try and get a connection
- Connection con = null;
- try {
- con = databaseManager.getConnection();
- } finally {
- if (con!=null)
- try {
- con.close();
- } catch (SQLException e) {
- logger.warn("There was an SQL error whilst closing the test connection: "+e.getMessage(),e);
- }
- }
- }
-
- public void useOptions() throws DatabaseConfigurationException {
-
- if (options.hasOption("port")) {
- dbConfig.setPort(options.getDatabasePort());
- }
-
- if (options.hasOption("startdb")) {
- dbConfig.setStartInternalDerbyServer(true);
- }
-
- if (options.hasOption("inmemory")) {
- dbConfig.setInMemory(true);
- }
-
- if (options.hasOption("embedded")) {
- dbConfig.setInMemory(false);
- dbConfig.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
- }
-
- if (options.isProvenanceEnabled()) {
- dbConfig.setProvenanceEnabled(true);
- }
-
- if (options.hasOption("clientserver")) {
- dbConfig.setInMemory(false);
- dbConfig.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
- dbConfig.setJDBCUri("jdbc:derby://localhost:" + dbConfig.getPort() + "/t2-database;create=true;upgrade=true");
- }
-
- if (options.hasOption("dbproperties")) {
- try {
- readConfigirationFromFile(options.getDatabaseProperties());
- } catch (IOException e) {
- throw new DatabaseConfigurationException("There was an error reading the database configuration options at "+options.getDatabaseProperties()+" : "+e.getMessage(),e);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
deleted file mode 100644
index bd83e8f..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.commandline.data;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.List;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.apache.taverna.databundle.DataBundles;
-import org.apache.taverna.databundle.ErrorDocument;
-
-/**
- * Handles ErrorValues and transforming them into String representations
- * that can be stored as a file, or within a Baclava document.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class ErrorValueHandler {
-
- /**
- * Creates a string representation of the ErrorValue.
- * @throws IOException
- */
- public static String buildErrorValueString(ErrorDocument errorValue) throws IOException {
-
- String errDocumentString = errorValue.getMessage() + "\n";
-
- String exceptionMessage = errorValue.getMessage();
- if (exceptionMessage != null && !exceptionMessage.equals("")) {
- DefaultMutableTreeNode exceptionMessageNode = new DefaultMutableTreeNode(
- exceptionMessage);
- errDocumentString += exceptionMessageNode + "\n";
- errDocumentString += errorValue.getTrace();
- }
-
- List<Path> errorReferences = errorValue.getCausedBy();
- if (!errorReferences.isEmpty()) {
- errDocumentString += "Set of cause errors to follow." + "\n";
- }
- int errorCounter = 1;
- for (Path cause : errorReferences) {
- if (DataBundles.isError(cause)) {
- errDocumentString += "ErrorValue " + (errorCounter++) + "\n";
- errDocumentString += buildErrorValueString(DataBundles.getError(cause)) + "\n";
- }
- }
-
- return errDocumentString;
- }
-
-}