You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2015/10/28 01:08:01 UTC
[1/5] oodt git commit: OODT-909 create improved exceptions
Repository: oodt
Updated Branches:
refs/heads/master b8d99d611 -> 0c67a3305
OODT-909 create improved exceptions
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/c364b7b1
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/c364b7b1
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/c364b7b1
Branch: refs/heads/master
Commit: c364b7b1e50541f73491d75dd580adfadefd4a8d
Parents: b8d99d6
Author: Tom Barber <to...@analytical-labs.com>
Authored: Tue Oct 27 20:17:30 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Tue Oct 27 20:17:30 2015 +0000
----------------------------------------------------------------------
.../catalog/solr/DefaultProductSerializer.java | 7 +++++--
.../cas/filemgr/catalog/solr/SolrClient.java | 10 +++++----
.../action/DeleteProductByNameCliAction.java | 7 ++++++-
.../exceptions/FileManagerException.java | 11 ++++++++++
.../cas/filemgr/ingest/CmdLineIngester.java | 5 ++++-
.../oodt/cas/filemgr/structs/Product.java | 6 ++++--
.../conv/AsciiSortableVersionConverter.java | 2 +-
.../cas/filemgr/system/XmlRpcFileManager.java | 14 ++++++-------
.../filemgr/system/XmlRpcFileManagerClient.java | 7 ++++---
.../filemgr/system/auth/SecureWebServer.java | 9 ++++----
.../cas/filemgr/tools/DumpDbElementsToXml.java | 11 ++++++----
.../oodt/cas/filemgr/tools/ExpImpCatalog.java | 22 ++++++++++++--------
.../tools/MetadataBasedProductMover.java | 15 ++++++++-----
.../oodt/cas/filemgr/tools/MetadataDumper.java | 2 +-
.../filemgr/tools/OptimizeLuceneCatalog.java | 2 +-
.../oodt/cas/filemgr/tools/ProductDumper.java | 2 +-
.../cas/filemgr/tools/ProductTypeDocTool.java | 10 ++++++---
.../oodt/cas/filemgr/tools/QueryTool.java | 8 +++----
.../oodt/cas/filemgr/tools/SolrIndexer.java | 2 +-
19 files changed, 96 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
index 74e070c..a6b4eef 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
@@ -26,7 +26,9 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Date;
@@ -36,6 +38,7 @@ import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
/**
* Default implementation of {@link ProductSerializer}
@@ -472,10 +475,10 @@ public class DefaultProductSerializer implements ProductSerializer {
}
- private Document parseXml(String xml) throws Exception {
+ private Document parseXml(String xml) throws IOException, SAXException, ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
+ DocumentBuilder parser = factoriy.newDocumentBuilder();
return parser.parse( new InputSource(new StringReader(xml)) );
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
index dbae244..bd5551f 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
@@ -27,6 +27,7 @@ import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import java.io.BufferedReader;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
@@ -189,7 +190,7 @@ public class SolrClient {
* Method to commit the current changes to the Solr index.
* @throws Exception
*/
- public void commit() throws Exception {
+ public void commit() throws IOException, CatalogException {
String message = "<commit waitSearcher=\"true\"/>";
String url = this.buildUpdateUrl();
@@ -227,7 +228,8 @@ public class SolrClient {
* @param parameters
* @return
*/
- private String doGet(String url, Map<String, String[]> parameters, String mimeType) throws Exception {
+ private String doGet(String url, Map<String, String[]> parameters, String mimeType)
+ throws IOException, CatalogException {
// build HTTP/GET request
GetMethod method = new GetMethod(url);
@@ -253,7 +255,7 @@ public class SolrClient {
* @param document
* @return
*/
- private String doPost(String url, String document, String mimeType) throws Exception {
+ private String doPost(String url, String document, String mimeType) throws IOException, CatalogException {
// build HTTP/POST request
PostMethod method = new PostMethod(url);
@@ -271,7 +273,7 @@ public class SolrClient {
* @return
* @throws Exception
*/
- private String doHttp(HttpMethod method) throws Exception {
+ private String doHttp(HttpMethod method) throws IOException, CatalogException {
StringBuilder response = new StringBuilder();
BufferedReader br = null;
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
index 254d02f..c911430 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
@@ -22,6 +22,10 @@ import org.apache.commons.lang.Validate;
//OODT imports
import org.apache.oodt.cas.cli.exception.CmdLineActionException;
import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+
+import java.net.MalformedURLException;
/**
* A {@link CmdLineAction} which deletes a {@link Product} by name.
@@ -34,7 +38,8 @@ public class DeleteProductByNameCliAction extends
private String productName;
@Override
- protected Product getProductToDelete() throws Exception {
+ protected Product getProductToDelete()
+ throws CmdLineActionException, MalformedURLException, ConnectionException, CatalogException {
Validate.notNull(productName, "Must specify productName");
Product p = getClient().getProductByName(productName);
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
new file mode 100644
index 0000000..1561fcf
--- /dev/null
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
@@ -0,0 +1,11 @@
+package org.apache.oodt.cas.filemgr.exceptions;
+
+/**
+ * Created by bugg on 27/10/15.
+ */
+public class FileManagerException extends Exception {
+
+ public FileManagerException(String message){
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
index 4aa9912..59d0736 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
@@ -19,6 +19,7 @@
package org.apache.oodt.cas.filemgr.ingest;
//OODT imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.IngestException;
import org.apache.oodt.cas.metadata.MetExtractor;
import org.apache.oodt.cas.metadata.SerializableMetadata;
import org.apache.oodt.cas.metadata.util.GenericMetadataObjectFactory;
@@ -28,8 +29,10 @@ import org.apache.oodt.cas.metadata.util.GenericMetadataObjectFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Vector;
@@ -60,7 +63,7 @@ public class CmdLineIngester extends StdIngester {
* @throws org.apache.oodt.cas.filemgr.structs.exceptions.IngestException
* @throws java.net.MalformedURLException
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException, IngestException {
String usage = CmdLineIngester.class.getName()
+ " --url <filemgr url> [options]\n"
+ "[--extractor <met extractor class name> <met conf file path>|"
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
index cfc7d41..242db6d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
@@ -18,6 +18,8 @@
package org.apache.oodt.cas.filemgr.structs;
//JDK imports
+
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
import org.apache.oodt.commons.xml.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -274,7 +276,7 @@ public class Product {
return defaultProduct;
}
- public Document toXML() throws Exception {
+ public Document toXML() throws UnsupportedEncodingException, FileManagerException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Document doc;
@@ -315,7 +317,7 @@ public class Product {
} catch (ParserConfigurationException pce) {
LOG.log(Level.WARNING, "Error generating product xml file!: "
+ pce.getMessage());
- throw new Exception("Error generating product xml file!: "
+ throw new FileManagerException("Error generating product xml file!: "
+ pce.getMessage());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
index e56dfee..23be461 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
@@ -28,7 +28,7 @@ package org.apache.oodt.cas.filemgr.structs.query.conv;
*/
public class AsciiSortableVersionConverter implements VersionConverter {
- public double convertToPriority(String version) throws Exception {
+ public double convertToPriority(String version) {
double priority = 0;
char[] versionCharArray = version.toCharArray();
for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--)
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
index baa30e1..a2a0d9b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
@@ -54,6 +54,7 @@ import org.apache.oodt.cas.filemgr.versioning.VersioningUtils;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
import org.apache.oodt.commons.date.DateUtils;
+import org.apache.oodt.commons.exceptions.CommonsException;
import org.apache.xmlrpc.WebServer;
import java.io.File;
@@ -64,6 +65,7 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.text.ParseException;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.LinkedList;
@@ -119,7 +121,7 @@ public class XmlRpcFileManager {
* The web server port to run the XML Rpc server on, defaults to
* 1999.
*/
- public XmlRpcFileManager(int port) throws Exception {
+ public XmlRpcFileManager(int port) throws IOException {
webServerPort = port;
// start up the web server
@@ -993,7 +995,7 @@ public class XmlRpcFileManager {
return XmlRpcStructFactory.getXmlRpcQuery(this.getCatalogQuery(query, productType));
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException {
int portNum = -1;
String usage = "FileManager --portNum <port number for xml rpc service>\n";
@@ -1129,15 +1131,11 @@ public class XmlRpcFileManager {
return true;
}
- private void setProductType(List<Product> products) throws Exception {
+ private void setProductType(List<Product> products) throws RepositoryManagerException {
if (products != null && products.size() > 0) {
for (Product p : products) {
- try {
p.setProductType(repositoryManager.getProductTypeById(p
.getProductType().getProductTypeId()));
- } catch (RepositoryManagerException e) {
- throw new Exception(e.getMessage());
- }
}
}
}
@@ -1249,7 +1247,7 @@ public class XmlRpcFileManager {
@SuppressWarnings("unchecked")
private List<QueryResult> applyFilterToResults(
List<QueryResult> queryResults, QueryFilter queryFilter)
- throws Exception {
+ throws Exception {
List<TimeEvent> events = new LinkedList<TimeEvent>();
for (QueryResult queryResult : queryResults) {
Metadata m = new Metadata();
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
index b8bb51f..eda060e 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
@@ -23,6 +23,7 @@ import org.apache.commons.httpclient.HttpMethodRetryHandler;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.oodt.cas.cli.CmdLineUtility;
import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
import org.apache.oodt.cas.filemgr.structs.Element;
import org.apache.oodt.cas.filemgr.structs.FileTransferStatus;
import org.apache.oodt.cas.filemgr.structs.Product;
@@ -1179,7 +1180,7 @@ public class XmlRpcFileManagerClient {
}
public String ingestProduct(Product product, Metadata metadata,
- boolean clientTransfer) throws Exception {
+ boolean clientTransfer) throws VersioningException, XmlRpcException, FileManagerException {
try {
// ingest product
Vector<Object> argList = new Vector<Object>();
@@ -1293,7 +1294,7 @@ public class XmlRpcFileManagerClient {
LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
+ product + "] : " + e2.getMessage());
}
- throw new Exception(e2);
+ throw e2;
}
catch (Exception e) {
LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + product.getProductId() +
@@ -1308,7 +1309,7 @@ public class XmlRpcFileManagerClient {
LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
+ product + "] : " + e.getMessage());
}
- throw new Exception("Failed to ingest product [" + product + "] : "
+ throw new FileManagerException("Failed to ingest product [" + product + "] : "
+ e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
index 46d87d6..445c052 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
@@ -18,13 +18,14 @@
package org.apache.oodt.cas.filemgr.system.auth;
//JDK imports
-import java.util.List;
+import org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
+
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
-import java.io.IOException;
//XML-RPC imports
-import org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
/**
* An XML-RPC Web Server that requires authentication and authorization.
@@ -60,7 +61,7 @@ public final class SecureWebServer extends org.apache.xmlrpc.WebServer
* @pass The password to use for the user.
*/
public Object execute(String methodSpecifier, Vector params, String user,
- String password) throws Exception {
+ String password) {
for (Object dispatcher : dispatchers) {
Result rc = ((Dispatcher) dispatcher).handleRequest(methodSpecifier,
params, user, password);
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
index 0982219..2165579 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
@@ -18,14 +18,17 @@
package org.apache.oodt.cas.filemgr.tools;
//JDK imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
+import org.apache.oodt.cas.filemgr.util.XmlStructFactory;
+import org.apache.oodt.cas.filemgr.validation.DataSourceValidationLayerFactory;
+import org.apache.oodt.cas.filemgr.validation.ValidationLayer;
+
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.util.List;
//OODT imports
-import org.apache.oodt.cas.filemgr.util.XmlStructFactory;
-import org.apache.oodt.cas.filemgr.validation.DataSourceValidationLayerFactory;
-import org.apache.oodt.cas.filemgr.validation.ValidationLayer;
/**
* @author mattmann
@@ -47,7 +50,7 @@ public final class DumpDbElementsToXml {
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException, ValidationLayerException {
String propFile = null, outXmlFile = null;
String usage = "DumpDbElementsToXml --propFile </path/to/propFile> --out </path/to/xml/file>\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
index bbb764e..ef90492 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
@@ -17,25 +17,26 @@
package org.apache.oodt.cas.filemgr.tools;
-// JDK imports
import org.apache.oodt.cas.filemgr.catalog.Catalog;
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.ProductPage;
import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
import org.apache.oodt.cas.metadata.Metadata;
import java.io.File;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
-// OODT imports
/**
* @author mattmann
@@ -137,7 +138,8 @@ public class ExpImpCatalog {
}
- public void doExpImport(List sourceProductTypes) throws Exception {
+ public void doExpImport(List sourceProductTypes)
+ throws FileManagerException, RepositoryManagerException, CatalogException {
if (this.sourceClient != null && this.destClient != null) {
// do validation of source/dest types
@@ -145,7 +147,7 @@ public class ExpImpCatalog {
List destProductTypes = destClient.getProductTypes();
if (!typesExist(sourceProductTypes, destProductTypes)) {
- throw new Exception(
+ throw new FileManagerException(
"The source product types must be present in the dest file manager!");
} else {
LOG
@@ -163,7 +165,7 @@ public class ExpImpCatalog {
ProductType type = (ProductType) sourceProductType;
try {
exportTypeToDest(type);
- } catch (Exception e) {
+ } catch (CatalogException e) {
LOG.log(Level.WARNING, "Error exporting product type: ["
+ type.getName() + "] from source to dest: Message: "
+ e.getMessage(), e);
@@ -173,7 +175,7 @@ public class ExpImpCatalog {
}
- public void doExpImport() throws Exception {
+ public void doExpImport() throws RepositoryManagerException, FileManagerException, CatalogException {
if (sourceClient == null)
throw new RuntimeException(
"Cannot request exp/imp of all product types if no filemgr url specified!");
@@ -181,7 +183,7 @@ public class ExpImpCatalog {
doExpImport(sourceProductTypes);
}
- private void exportTypeToDest(ProductType type) throws Exception {
+ private void exportTypeToDest(ProductType type) throws CatalogException, RepositoryManagerException {
ProductPage page;
if (this.srcCatalog != null) {
@@ -206,7 +208,7 @@ public class ExpImpCatalog {
}
private void exportProductsToDest(List products, ProductType type)
- throws Exception {
+ throws CatalogException, RepositoryManagerException {
if (products != null && products.size() > 0) {
for (Object product : products) {
Product p = (Product) product;
@@ -324,7 +326,9 @@ public class ExpImpCatalog {
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args)
+ throws RepositoryManagerException, FileManagerException, MalformedURLException, InstantiationException,
+ CatalogException {
String sourceUrl = null, destUrl = null, srcCatPropFile = null, destCatPropFile = null;
boolean unique = false;
List types = null;
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
index 694bf3c..8092018 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
@@ -17,12 +17,14 @@
package org.apache.oodt.cas.filemgr.tools;
-//JDK imports
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.ProductPage;
import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.metadata.util.PathUtils;
@@ -30,11 +32,11 @@ import org.apache.oodt.cas.metadata.util.PathUtils;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
-//OODT imports
/**
* @author mattmann
@@ -83,7 +85,7 @@ public class MetadataBasedProductMover {
}
}
- public void moveProducts(ProductType type) throws Exception {
+ public void moveProducts(ProductType type) throws CatalogException, URISyntaxException, DataTransferException {
// paginate through the product list
ProductPage page = fmgrClient.getFirstPage(type);
@@ -132,14 +134,17 @@ public class MetadataBasedProductMover {
}
- public void moveProducts(String typeName) throws Exception {
+ public void moveProducts(String typeName)
+ throws RepositoryManagerException, CatalogException, DataTransferException, URISyntaxException {
moveProducts(fmgrClient.getProductTypeByName(typeName));
}
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args)
+ throws URISyntaxException, CatalogException, RepositoryManagerException, DataTransferException,
+ InstantiationException {
String typeName = null, pathSpec = null, fmUrlStr = null;
String usage = "MetadataBasedProductMover [options]\n"
+ "--typeName <product type>\n"
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
index bc2c26e..b842dd2 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
@@ -139,7 +139,7 @@ public final class MetadataDumper {
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws InstantiationException {
String fileManagerUrlStr = null, productId = null, outDirPath = null;
String usage = "MetadataDumper --url <filemgr url> --productId <id> [--out <dir path>]\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
index 06d1d79..9cec69b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
@@ -83,7 +83,7 @@ public class OptimizeLuceneCatalog {
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
String usage = "OptimizeLuceneCatalog [options]\n"
+ "--catalogPath <path to lucene catalog>\n"
+ "[--mergeFactor <merge factor for index>]\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
index 289d1b6..da98438 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
@@ -151,7 +151,7 @@ public final class ProductDumper {
/**
* @param args
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws InstantiationException {
String fileManagerUrlStr = null, productId = null, outDirPath = null;
String usage = "ProductDumper --url <filemgr url> --productId <id> [--out <dir path>]\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
index fac190d..2411f50 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
@@ -19,9 +19,13 @@ package org.apache.oodt.cas.filemgr.tools;
//JDK imports
import java.io.File;
+import java.io.IOException;
+
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
@@ -36,7 +40,7 @@ import org.apache.commons.io.FileUtils;
* <p>
* A tool to output HTML documentation for {@link ProductType} policy xml files.
* </p>.
- */
+ */o
public final class ProductTypeDocTool {
private String xslFilePath;
@@ -52,7 +56,7 @@ public final class ProductTypeDocTool {
}
public void doProductTypeDoc(String productTypeXmlFilePath,
- String elementXmlFilePath) throws Exception {
+ String elementXmlFilePath) throws IOException, TransformerException {
// copy element xml to current path
FileUtils.copyFileToDirectory(new File(elementXmlFilePath), new File(
"."));
@@ -91,7 +95,7 @@ public final class ProductTypeDocTool {
new File(elementLocalFilePath).delete();
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException, TransformerException {
String productTypeXmlFilePath = null, xslFilePath = null, outputDirPath = null, elementXmlFilePath = null;
String usage = "ProductTypeDocTool --productTypeXml <path> "
+ "--elementXml <path> --xsl <path> --out <dir path>\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
index e36c262..c1c1a0b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
@@ -17,7 +17,6 @@
package org.apache.oodt.cas.filemgr.tools;
-//JDK imports
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
@@ -47,9 +46,6 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
-//OODT imports
-//APACHE imports
-
/**
* @author mattmann
* @author bfoster
@@ -173,7 +169,9 @@ public final class QueryTool {
return prodTypes;
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args)
+ throws MalformedURLException, InstantiationException, CatalogException, QueryFormulationException,
+ ConnectionException {
String usage = "Usage: QueryTool [options] \n"
+ "options: \n"
+ "--url <fm url> \n"
http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
index d75d652..89e1226 100755
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
@@ -620,7 +620,7 @@ public class SolrIndexer {
* @param args
* Command-line arguments.
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
Options options = SolrIndexer.buildCommandLine();
CommandLineParser parser = new GnuParser();
CommandLine line = null;
[3/5] oodt git commit: OODT-909 create improved exceptions
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
index 839f0a8..0dda943 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
@@ -16,85 +16,71 @@
*/
package org.apache.oodt.cas.pge;
-//OODT static imports
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.ACTION_IDS;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.ATTEMPT_INGEST_ALL;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.CRAWLER_CONFIG_FILE;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.CRAWLER_CRAWL_FOR_DIRS;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.CRAWLER_RECUR;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.DUMP_METADATA;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.FILE_STAGER;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.INGEST_CLIENT_TRANSFER_SERVICE_FACTORY;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.INGEST_FILE_MANAGER_URL;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.LOG_FILENAME_PATTERN;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.MET_FILE_EXT;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.NAME;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.MIME_EXTRACTOR_REPO;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.PGE_CONFIG_BUILDER;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.PGE_RUNTIME;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.PROPERTY_ADDERS;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.REQUIRED_METADATA;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.WORKFLOW_MANAGER_URL;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskStatus.CONF_FILE_BUILD;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskStatus.CRAWLING;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskStatus.RUNNING_PGE;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskStatus.STAGING_INPUT;
-import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createConfigFilePropertyAdder;
-import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createFileStager;
-import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createPgeConfigBuilder;
-import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createSciPgeConfigFileWriter;
-
-//JDK imports
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.FileHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
-import java.util.regex.Pattern;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
-//Apache imports
import org.apache.commons.lang.Validate;
-
-//OODT imports
import org.apache.oodt.cas.crawl.AutoDetectProductCrawler;
import org.apache.oodt.cas.crawl.ProductCrawler;
import org.apache.oodt.cas.crawl.StdProductCrawler;
import org.apache.oodt.cas.crawl.status.IngestStatus;
+import org.apache.oodt.cas.crawl.structs.exceptions.CrawlerActionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.metadata.SerializableMetadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractorConfigReaderException;
+import org.apache.oodt.cas.metadata.exceptions.NamingConventionException;
import org.apache.oodt.cas.metadata.filenaming.PathUtilsNamingConvention;
import org.apache.oodt.cas.pge.config.DynamicConfigFile;
import org.apache.oodt.cas.pge.config.OutputDir;
import org.apache.oodt.cas.pge.config.PgeConfig;
import org.apache.oodt.cas.pge.config.RegExprOutputFiles;
import org.apache.oodt.cas.pge.config.XmlFilePgeConfigBuilder;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
import org.apache.oodt.cas.pge.metadata.PgeMetadata;
import org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys;
import org.apache.oodt.cas.pge.staging.FileManagerFileStager;
import org.apache.oodt.cas.pge.staging.FileStager;
import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
import org.apache.oodt.cas.pge.writers.SciPgeConfigFileWriter;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
import org.apache.oodt.cas.workflow.metadata.CoreMetKeys;
import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
import org.apache.oodt.cas.workflow.util.ScriptFile;
+import org.apache.oodt.commons.exceptions.CommonsException;
import org.apache.oodt.commons.exec.ExecUtils;
-
-//Spring imports
+import org.apache.xmlrpc.XmlRpcException;
import org.springframework.context.support.FileSystemXmlApplicationContext;
-//Google imports
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+import java.util.regex.Pattern;
+
+import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.*;
+import static org.apache.oodt.cas.pge.metadata.PgeTaskStatus.*;
+import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.*;
+
/**
* Runs a CAS-style Product Generation Executive based on the PCS Wrapper
@@ -151,18 +137,18 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
- protected void updateStatus(String status) throws Exception {
+ protected void updateStatus(String status) throws PGEException, XmlRpcException, IOException {
logger.info("Updating status to workflow as [" + status + "]");
if (!wm.updateWorkflowInstanceStatus(workflowInstId, status)) {
- throw new Exception(
+ throw new PGEException(
"Failed to update workflow status : client returned false");
}
}
- protected Logger createLogger() throws Exception {
+ protected Logger createLogger() throws IOException, PGEException {
File logDir = new File(pgeConfig.getExeDir(), "logs");
if (!(logDir.exists() || logDir.mkdirs())) {
- throw new Exception("mkdirs for logs directory return false");
+ throw new PGEException("mkdirs for logs directory return false");
}
Logger logger = Logger.getLogger(PGETaskInstance.class.getName()
@@ -231,7 +217,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
- protected void runPropertyAdders() throws Exception {
+ protected void runPropertyAdders() throws PGEException {
try {
logger.info("Loading/Running property adders...");
List<String> propertyAdders = pgeMetadata
@@ -244,7 +230,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
logger.info("No property adders specified");
}
} catch (Exception e) {
- throw new Exception("Failed to instanciate/run Property Adders : "
+ throw new PGEException("Failed to instanciate/run Property Adders : "
+ e.getMessage(), e);
}
}
@@ -263,7 +249,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
protected XmlRpcWorkflowManagerClient createWorkflowManagerClient()
- throws Exception {
+ throws MalformedURLException {
String url = pgeMetadata.getMetadata(WORKFLOW_MANAGER_URL);
logger.info("Creating WorkflowManager client for url [" + url + "]");
Validate.notNull(url, "Must specify " + WORKFLOW_MANAGER_URL);
@@ -278,7 +264,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
return instanceId;
}
- protected void dumpMetadataIfRequested() throws Exception {
+ protected void dumpMetadataIfRequested() throws IOException {
if (Boolean.parseBoolean(pgeMetadata
.getMetadata(DUMP_METADATA))) {
new SerializableMetadata(pgeMetadata.asMetadata())
@@ -287,7 +273,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
- protected String getDumpMetadataPath() throws Exception {
+ protected String getDumpMetadataPath() {
return new File(pgeConfig.getExeDir()).getAbsolutePath() + "/"
+ getDumpMetadataName();
}
@@ -296,31 +282,33 @@ public class PGETaskInstance implements WorkflowTaskInstance {
return "pgetask-metadata.xml";
}
- protected void createExeDir() throws Exception {
+ protected void createExeDir() throws PGEException {
logger.info("Creating PGE execution working directory: ["
+ pgeConfig.getExeDir() + "]");
File executionDir = new File(pgeConfig.getExeDir());
if (!(executionDir.exists() || executionDir.mkdirs())) {
- throw new Exception("mkdirs returned false for creating ["
+ throw new PGEException("mkdirs returned false for creating ["
+ pgeConfig.getExeDir() + "]");
}
}
- protected void createOuputDirsIfRequested() throws Exception {
+ protected void createOuputDirsIfRequested() throws PGEException {
for (OutputDir outputDir : pgeConfig.getOuputDirs()) {
if (outputDir.isCreateBeforeExe()) {
logger.info("Creating PGE file ouput directory: ["
+ outputDir.getPath() + "]");
File dir = new File(outputDir.getPath());
if (!(dir.exists() || dir.mkdirs())) {
- throw new Exception("mkdir returned false for creating ["
+ throw new PGEException("mkdir returned false for creating ["
+ outputDir.getPath() + "]");
}
}
}
}
- protected void stageFiles() throws Exception {
+ protected void stageFiles()
+ throws PGEException, IOException, ConnectionException, CatalogException, URISyntaxException,
+ DataTransferException, InstantiationException {
if (pgeConfig.getFileStagingInfo() != null) {
FileStager fileStager = getFileStager();
logger.info("Starting file staging...");
@@ -343,7 +331,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
- protected void createDynamicConfigFiles() throws Exception {
+ protected void createDynamicConfigFiles() throws IOException, PGEException {
logger.info("Starting creation of sci pge config files...");
for (DynamicConfigFile dynamicConfigFile : pgeConfig
.getDynamicConfigFiles()) {
@@ -353,7 +341,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
protected void createDynamicConfigFile(DynamicConfigFile dynamicConfigFile)
- throws Exception {
+ throws PGEException, IOException {
Validate.notNull(dynamicConfigFile, "dynamicConfigFile cannot be null");
logger.fine("Starting creation of sci pge config file ["
+ dynamicConfigFile.getFilePath() + "]...");
@@ -362,7 +350,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
File parentDir = new File(dynamicConfigFile.getFilePath())
.getParentFile();
if (!(parentDir.exists() || parentDir.mkdirs())) {
- throw new Exception("Failed to create directory where sci pge config file ["
+ throw new PGEException("Failed to create directory where sci pge config file ["
+ dynamicConfigFile.getFilePath() + "] was to be written");
}
@@ -379,7 +367,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
File configFile = writer.createConfigFile(dynamicConfigFile.getFilePath(),
pgeMetadata.asMetadata(), dynamicConfigFile.getArgs());
if (!configFile.exists()) {
- throw new Exception("Writer failed to create config file ["
+ throw new PGEException("Writer failed to create config file ["
+ configFile + "], exists returned false");
}
}
@@ -404,7 +392,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
return pgeScriptName;
}
- protected void runPge() throws Exception {
+ protected void runPge() throws PGEException, XmlRpcException {
ScriptFile sf = null;
try {
long startTime = System.currentTimeMillis();
@@ -434,10 +422,14 @@ public class PGETaskInstance implements WorkflowTaskInstance {
pgeMetadata.replaceMetadata(PGE_RUNTIME, Long.toString(runTime));
- } catch (Exception e) {
- throw new Exception("Exception when executing PGE commands '"
- + (sf != null ? sf.getCommands() : "NULL") + "' : "
- + e.getMessage(), e);
+ } catch (WorkflowException e) {
+ throw new PGEException("Exception when executing PGE commands '"
+ + (sf != null ? sf.getCommands() : "NULL") + "' : "
+ + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new PGEException("Exception when executing PGE commands '"
+ + (sf != null ? sf.getCommands() : "NULL") + "' : "
+ + e.getMessage(), e);
}
}
@@ -478,14 +470,16 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
protected File renameFile(File file, PathUtilsNamingConvention renamingConv)
- throws Exception {
+ throws NamingConventionException {
Metadata curMetadata = this.pgeMetadata.asMetadata();
curMetadata.replaceMetadata(renamingConv.getTmpReplaceMet());
return renamingConv.rename(file, curMetadata);
}
protected Metadata getMetadataForFile(File sciPgeCreatedDataFile,
- PcsMetFileWriter writer, Object[] args) throws Exception {
+ PcsMetFileWriter writer, Object[] args)
+ throws PGEException, MetExtractorConfigReaderException, ParseException, MetExtractionException,
+ CommonsException, CasMetadataException, FileNotFoundException {
return writer.getMetadataForFile(sciPgeCreatedDataFile,
this.pgeMetadata, args);
}
@@ -496,7 +490,9 @@ public class PGETaskInstance implements WorkflowTaskInstance {
.writeMetadataToXmlStream(new FileOutputStream(toMetFilePath));
}
- protected ProductCrawler createProductCrawler() throws Exception {
+ protected ProductCrawler createProductCrawler()
+ throws MalformedURLException, IllegalAccessException, CrawlerActionException, MetExtractionException,
+ InstantiationException, FileNotFoundException, ClassNotFoundException {
/* create a ProductCrawler based on whether or not the output dir specifies a MIME_EXTRACTOR_REPO */
logger.info("Configuring ProductCrawler...");
ProductCrawler crawler;
@@ -535,7 +531,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
return crawler;
}
- protected void runIngestCrawler(ProductCrawler crawler) throws Exception {
+ protected void runIngestCrawler(ProductCrawler crawler) throws PGEException, IOException, XmlRpcException {
// Determine if we need to create Metadata files
if (crawler instanceof StdProductCrawler){
this.processOutput();
@@ -563,7 +559,7 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
- protected void verifyIngests(ProductCrawler crawler) throws Exception {
+ protected void verifyIngests(ProductCrawler crawler) throws PGEException {
logger.info("Verifying ingests successful...");
boolean ingestsSuccess = true;
String exceptionMsg = "";
@@ -581,13 +577,13 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
if (!ingestsSuccess) {
- throw new Exception(exceptionMsg);
+ throw new PGEException(exceptionMsg);
} else {
logger.info("Ingests were successful");
}
}
- protected void updateDynamicMetadata() throws Exception {
+ protected void updateDynamicMetadata() throws XmlRpcException, IOException {
pgeMetadata.commitMarkedDynamicMetadataKeys();
wm.updateMetadataForWorkflow(workflowInstId,
pgeMetadata.asMetadata(PgeMetadata.Type.DYNAMIC));
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/config/XmlFilePgeConfigBuilder.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/config/XmlFilePgeConfigBuilder.java b/pge/src/main/java/org/apache/oodt/cas/pge/config/XmlFilePgeConfigBuilder.java
index 20580f3..3281106 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/config/XmlFilePgeConfigBuilder.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/config/XmlFilePgeConfigBuilder.java
@@ -17,41 +17,23 @@
package org.apache.oodt.cas.pge.config;
//OODT static imports
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.CONFIG_FILE_PATH;
-import static org.apache.oodt.cas.pge.util.XmlHelper.fillIn;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getCustomMetadataElement;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getDir;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getDynamicConfigFiles;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getExeCmds;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getFileStaging;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getImports;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getMetadataElements;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getMetadataKey;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getMetadataKeyRef;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getMetadataValues;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getOuputDirs;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getOutput;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getRootElement;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getShellType;
-import static org.apache.oodt.cas.pge.util.XmlHelper.getStageFilesMetKeys;
-import static org.apache.oodt.cas.pge.util.XmlHelper.isForceStage;
-import static org.apache.oodt.cas.pge.util.XmlHelper.isWorkflowMetKey;
-
-//JDK imports
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
+import com.google.common.collect.Lists;
-//OODT imports
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
import org.apache.oodt.cas.pge.metadata.PgeMetadata;
import org.apache.oodt.cas.pge.util.Pair;
import org.apache.oodt.cas.pge.util.XmlHelper;
-
-//DOM imports
import org.w3c.dom.Element;
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.List;
+
+import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.CONFIG_FILE_PATH;
+import static org.apache.oodt.cas.pge.util.XmlHelper.*;
+
/**
* An implementation of the {@link PgeConfigBuilder} that reads an XML file
@@ -89,7 +71,7 @@ public class XmlFilePgeConfigBuilder implements PgeConfigBuilder {
}
private PgeMetadata loadConfigFile(String configFile, PgeConfig pgeConfig,
- PgeMetadata parentPgeMetadata) throws Exception {
+ PgeMetadata parentPgeMetadata) throws FileNotFoundException, PGEException {
PgeMetadata pgeMetadata = new PgeMetadata(parentPgeMetadata);
Element root = getRootElement(configFile);
@@ -147,7 +129,7 @@ public class XmlFilePgeConfigBuilder implements PgeConfigBuilder {
}
private void loadCustomMetadata(Element root, PgeMetadata pgeMetadata)
- throws Exception {
+ throws PGEException {
// Check if there is a 'customMetadata' elem and load it.
Element customMetadataElem = getCustomMetadataElement(root);
@@ -166,7 +148,7 @@ public class XmlFilePgeConfigBuilder implements PgeConfigBuilder {
// Check that either val or key-ref is given.
if (!values.isEmpty() && keyRef != null) {
- throw new Exception(
+ throw new PGEException(
"Cannot specify both values and keyref for metadata key '"
+ key + "'");
@@ -187,7 +169,7 @@ public class XmlFilePgeConfigBuilder implements PgeConfigBuilder {
}
private void loadFileStagingInfo(Element root, PgeConfig pgeConfig,
- PgeMetadata pgeMetadata) throws Exception {
+ PgeMetadata pgeMetadata) throws PGEException {
Metadata metadata = pgeMetadata.asMetadata();
Element fileStagingElem = getFileStaging(root);
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/exceptions/PGEException.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/exceptions/PGEException.java b/pge/src/main/java/org/apache/oodt/cas/pge/exceptions/PGEException.java
new file mode 100644
index 0000000..b394998
--- /dev/null
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/exceptions/PGEException.java
@@ -0,0 +1,16 @@
+package org.apache.oodt.cas.pge.exceptions;
+
+/**
+ * Created by bugg on 27/10/15.
+ */
+public class PGEException extends Exception {
+
+ public PGEException(String message){
+ super(message);
+ }
+
+ public PGEException(String s, Exception e) {
+ super(s, e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileManagerFileStager.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileManagerFileStager.java b/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileManagerFileStager.java
index a97c0fb..3122f6f 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileManagerFileStager.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileManagerFileStager.java
@@ -25,6 +25,7 @@ import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
import org.apache.oodt.cas.filemgr.datatransfer.RemoteDataTransferFactory;
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
import org.apache.oodt.cas.pge.metadata.PgeMetadata;
@@ -34,6 +35,7 @@ import com.google.common.collect.Lists;
//JDK imports
import java.io.File;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
@@ -49,7 +51,7 @@ public class FileManagerFileStager extends FileStager {
@Override
public void stageFile(URI stageFile, File destDir,
- PgeMetadata pgeMetadata, Logger logger) throws Exception {
+ PgeMetadata pgeMetadata, Logger logger) throws IOException, DataTransferException, InstantiationException {
DataTransfer dataTransferer = createDataTransfer(pgeMetadata, logger);
logger.log(Level.INFO, "Using DataTransfer ["
+ dataTransferer.getClass().getCanonicalName() + "]");
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileStager.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileStager.java b/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileStager.java
index 3ee5c2d..db3dc42 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileStager.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/staging/FileStager.java
@@ -16,30 +16,31 @@
*/
package org.apache.oodt.cas.pge.staging;
-//OODT static imports
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.QUERY_FILE_MANAGER_URL;
-
-//JDK imports
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Lists;
-//OODT imports
import org.apache.commons.lang.Validate;
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.Reference;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
import org.apache.oodt.cas.pge.config.FileStagingInfo;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
import org.apache.oodt.cas.pge.metadata.PgeMetadata;
-//Google imports
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.QUERY_FILE_MANAGER_URL;
/**
* Responsible for transferring Product files to a directory accessible by
@@ -50,7 +51,9 @@ import com.google.common.collect.Lists;
public abstract class FileStager {
public void stageFiles(FileStagingInfo fileStagingInfo,
- PgeMetadata pgeMetadata, Logger logger) throws Exception {
+ PgeMetadata pgeMetadata, Logger logger)
+ throws PGEException, CatalogException, URISyntaxException, IOException, ConnectionException,
+ InstantiationException, DataTransferException {
logger.log(Level.INFO, "Creating staging directory ["
+ fileStagingInfo.getStagingDir() + "]");
new File(fileStagingInfo.getStagingDir()).mkdirs();
@@ -84,10 +87,10 @@ public abstract class FileStager {
@VisibleForTesting
static XmlRpcFileManagerClient createFileManagerClient(PgeMetadata pgeMetadata)
- throws Exception {
+ throws PGEException, MalformedURLException, ConnectionException {
String filemgrUrl = pgeMetadata.getMetadata(QUERY_FILE_MANAGER_URL);
if (filemgrUrl == null) {
- throw new Exception("Must specify [" + QUERY_FILE_MANAGER_URL
+ throw new PGEException("Must specify [" + QUERY_FILE_MANAGER_URL
+ "] if you want to stage product IDs");
}
return new XmlRpcFileManagerClient(new URL(filemgrUrl));
@@ -119,5 +122,6 @@ public abstract class FileStager {
}
protected abstract void stageFile(URI stageFile, File destDir,
- PgeMetadata pgeMetadata, Logger logger) throws Exception;
+ PgeMetadata pgeMetadata, Logger logger)
+ throws PGEException, IOException, DataTransferException, InstantiationException;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/util/GenericPgeObjectFactory.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/util/GenericPgeObjectFactory.java b/pge/src/main/java/org/apache/oodt/cas/pge/util/GenericPgeObjectFactory.java
index 6df7975..d6e31dd 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/util/GenericPgeObjectFactory.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/util/GenericPgeObjectFactory.java
@@ -53,11 +53,20 @@ public class GenericPgeObjectFactory {
String clazz, Logger logger) {
try {
return (PgeConfigBuilder) Class.forName(clazz).newInstance();
- } catch (Exception e) {
+ } catch (InstantiationException e) {
logger.log(Level.SEVERE, "Failed to create PgeConfigBuilder ["
- + clazz + "] : " + e.getMessage(), e);
+ + clazz + "] : " + e.getMessage(), e);
+ return null;
+ } catch (IllegalAccessException e) {
+ logger.log(Level.SEVERE, "Failed to create PgeConfigBuilder ["
+ + clazz + "] : " + e.getMessage(), e);
+ return null;
+ } catch (ClassNotFoundException e) {
+ logger.log(Level.SEVERE, "Failed to create PgeConfigBuilder ["
+ + clazz + "] : " + e.getMessage(), e);
return null;
}
+
}
public static ConfigFilePropertyAdder createConfigFilePropertyAdder(
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java b/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
index 4a905fc..0bdc74c 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
@@ -16,53 +16,10 @@
*/
package org.apache.oodt.cas.pge.util;
-//OODT static imports
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.ARGS_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.CMD_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.CREATE_BEFORE_EXEC_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.CUSTOM_METADATA_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.DIR_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.DIR_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.DYN_INPUT_FILES_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.ENV_REPLACE_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.ENV_REPLACE_NO_RECUR_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.EXE_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.FILE_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.FILE_STAGING_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.FILE_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.FILES_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.FORCE_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.IMPORT_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.KEYREF_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.KEY_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.KEY_GEN_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.METADATA_KEY_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.METADATA_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.MET_FILE_WRITER_CLASS_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.NAME_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.NAMING_EXPR_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.NAMESPACE_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.OUTPUT_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.PATH_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.RENAMING_CONV_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.REGEX_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.SHELL_TYPE_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.SPLIT_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.STAGE_FILES_TAG;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.VAL_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.WORKFLOW_MET_ATTR;
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.WRITER_CLASS_ATTR;
-import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.QUERY_FILE_MANAGER_URL;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
-//OODT imports
import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
import org.apache.oodt.cas.filemgr.util.QueryUtils;
import org.apache.oodt.cas.filemgr.util.SqlParser;
@@ -72,16 +29,21 @@ import org.apache.oodt.cas.metadata.util.PathUtils;
import org.apache.oodt.cas.pge.config.DynamicConfigFile;
import org.apache.oodt.cas.pge.config.OutputDir;
import org.apache.oodt.cas.pge.config.RegExprOutputFiles;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
import org.apache.oodt.commons.xml.XMLUtils;
-
-//DOM imports
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-//Google imports
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.*;
+import static org.apache.oodt.cas.pge.metadata.PgeTaskMetKeys.QUERY_FILE_MANAGER_URL;
+
/**
* Help class with method for parsing XMLFilePgeConfigBuilder config XML file.
@@ -102,7 +64,7 @@ public class XmlHelper {
}
public static List<Pair<String, String>> getImports(Element elem,
- Metadata metadata) throws Exception {
+ Metadata metadata) throws PGEException {
List<Pair<String, String>> imports = Lists.newArrayList();
NodeList nodeList = elem.getElementsByTagName(IMPORT_TAG);
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -115,7 +77,7 @@ public class XmlHelper {
}
public static String getNamespace(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
String namespace = elem.getAttribute(NAMESPACE_ATTR);
if (!Strings.isNullOrEmpty(namespace)) {
return fillIn(namespace, metadata, false);
@@ -125,7 +87,7 @@ public class XmlHelper {
}
public static String getFile(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
String file = elem.getAttribute(FILE_ATTR);
if (!Strings.isNullOrEmpty(file)) {
return fillIn(file, metadata, false);
@@ -135,14 +97,14 @@ public class XmlHelper {
}
public static Element getCustomMetadataElement(Element root)
- throws Exception {
+ throws PGEException {
NodeList nodes = root.getElementsByTagName(CUSTOM_METADATA_TAG);
if (nodes.getLength() == 0) {
return null;
} else if (nodes.getLength() == 1) {
return (Element) nodes.item(0);
} else {
- throw new Exception("Found more than one '" + CUSTOM_METADATA_TAG
+ throw new PGEException("Found more than one '" + CUSTOM_METADATA_TAG
+ "' element");
}
}
@@ -158,7 +120,7 @@ public class XmlHelper {
}
public static String getMetadataKey(Element metElem, Metadata metadata)
- throws Exception {
+ throws PGEException {
String key = metElem.getAttribute(KEY_ATTR);
// no key attr, so check for key_gen attr.
@@ -168,7 +130,7 @@ public class XmlHelper {
// if still no key value, then fail.
if (Strings.isNullOrEmpty(key)) {
- throw new Exception("Must specify either metadata attr '"
+ throw new PGEException("Must specify either metadata attr '"
+ KEY_ATTR + "' or '" + KEY_GEN_ATTR + "'");
}
@@ -196,13 +158,13 @@ public class XmlHelper {
}
public static boolean isMultiValue(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return Boolean.parseBoolean(fillIn(elem.getAttribute(SPLIT_ATTR),
metadata));
}
public static List<String> getMetadataValues(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
List<String> values = Lists.newArrayList();
// Read val attr.
@@ -248,7 +210,7 @@ public class XmlHelper {
}
public static String getMetadataKeyRef(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
String keyRef = elem.getAttribute(KEYREF_ATTR);
if (!Strings.isNullOrEmpty(keyRef)) {
@@ -266,23 +228,23 @@ public class XmlHelper {
}
public static boolean isWorkflowMetKey(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return Boolean.parseBoolean(fillIn(
elem.getAttribute(WORKFLOW_MET_ATTR), metadata, false));
}
public static String getPath(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return fillIn(elem.getAttribute(PATH_ATTR), metadata, false);
}
public static String getWriter(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return fillIn(elem.getAttribute(WRITER_CLASS_ATTR), metadata, false);
}
public static List<String> getArgs(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
List<String> args = Lists.newArrayList();
for (String arg : Splitter.on(",").split(elem.getAttribute(ARGS_ATTR))) {
args.add(fillIn(arg, metadata, false));
@@ -295,7 +257,7 @@ public class XmlHelper {
}
public static List<DynamicConfigFile> getDynamicConfigFiles(Element elem,
- Metadata metadata) throws Exception {
+ Metadata metadata) throws PGEException {
List<DynamicConfigFile> dynamicConfigFiles = Lists.newArrayList();
NodeList nodeList = elem.getElementsByTagName(DYN_INPUT_FILES_TAG);
@@ -317,10 +279,10 @@ public class XmlHelper {
return dynamicConfigFiles;
}
- public static Element getExe(Element elem) throws Exception {
+ public static Element getExe(Element elem) throws PGEException {
NodeList nodeList = elem.getElementsByTagName(EXE_TAG);
if (nodeList.getLength() > 1) {
- throw new Exception("Can only specify '" + EXE_TAG + "' once!");
+ throw new PGEException("Can only specify '" + EXE_TAG + "' once!");
} else if (nodeList.getLength() == 1) {
return (Element) nodeList.item(0);
} else {
@@ -329,17 +291,17 @@ public class XmlHelper {
}
public static String getDir(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return fillIn(elem.getAttribute(DIR_ATTR), metadata);
}
public static String getShellType(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return fillIn(elem.getAttribute(SHELL_TYPE_ATTR), metadata);
}
public static List<String> getExeCmds(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
List<String> exeCmds = Lists.newArrayList();
NodeList nodeList = elem.getElementsByTagName(CMD_TAG);
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -355,10 +317,10 @@ public class XmlHelper {
return exeCmds;
}
- public static Element getFileStaging(Element elem) throws Exception {
+ public static Element getFileStaging(Element elem) throws PGEException {
NodeList nodeList = elem.getElementsByTagName(FILE_STAGING_TAG);
if (nodeList.getLength() > 1) {
- throw new Exception("Can only specify '" + FILE_STAGING_TAG
+ throw new PGEException("Can only specify '" + FILE_STAGING_TAG
+ "' once!");
} else if (nodeList.getLength() == 1) {
return (Element) nodeList.item(0);
@@ -368,18 +330,18 @@ public class XmlHelper {
}
public static boolean isForceStage(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return Boolean.parseBoolean(fillIn(elem.getAttribute(FORCE_ATTR),
metadata));
}
public static String getFileStagingMetadataKey(Element elem,
- Metadata metadata) throws Exception {
+ Metadata metadata) throws PGEException {
return fillIn(elem.getAttribute(METADATA_KEY_ATTR), metadata);
}
public static List<String> getStageFilesMetKeys(Element elem,
- Metadata metadata) throws Exception {
+ Metadata metadata) throws PGEException {
List<String> metKeys = Lists.newArrayList();
NodeList nodeList = elem.getElementsByTagName(STAGE_FILES_TAG);
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -389,10 +351,10 @@ public class XmlHelper {
return metKeys;
}
- public static Element getOutput(Element elem) throws Exception {
+ public static Element getOutput(Element elem) throws PGEException {
NodeList nodeList = elem.getElementsByTagName(OUTPUT_TAG);
if (nodeList.getLength() > 1) {
- throw new Exception("Can only specify '" + OUTPUT_TAG + "' once!");
+ throw new PGEException("Can only specify '" + OUTPUT_TAG + "' once!");
} else if (nodeList.getLength() == 1) {
return (Element) nodeList.item(0);
} else {
@@ -401,13 +363,13 @@ public class XmlHelper {
}
public static boolean isCreateBeforeExe(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
return Boolean.parseBoolean(fillIn(
elem.getAttribute(CREATE_BEFORE_EXEC_ATTR), metadata));
}
public static List<OutputDir> getOuputDirs(Element elem, Metadata metadata)
- throws Exception {
+ throws PGEException {
List<OutputDir> outputDirs = Lists.newArrayList();
NodeList nodeList = elem.getElementsByTagName(DIR_TAG);
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -423,7 +385,7 @@ public class XmlHelper {
}
public static void getRegExpOutputFiles(Element elem, Metadata metadata,
- OutputDir outputDir) throws Exception {
+ OutputDir outputDir) throws PGEException {
NodeList fileList = elem.getElementsByTagName(FILES_TAG);
for (int j = 0; j < fileList.getLength(); j++) {
Element fileElement = (Element) fileList.item(j);
@@ -472,12 +434,12 @@ public class XmlHelper {
}
public static String fillIn(String value, Metadata inputMetadata)
- throws Exception {
+ throws PGEException {
return fillIn(value, inputMetadata, true);
}
public static String fillIn(String value, Metadata inputMetadata,
- boolean envReplaceRecur) throws Exception {
+ boolean envReplaceRecur) throws PGEException {
try {
while ((value = PathUtils
.doDynamicReplacement(value, inputMetadata)).contains("[")
@@ -494,7 +456,7 @@ public class XmlHelper {
.parseSqlQueryMethod(value)));
return value;
} catch (Exception e) {
- throw new Exception("Failed to parse value: " + value, e);
+ throw new PGEException("Failed to parse value: " + value, e);
}
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/CsvConfigFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/CsvConfigFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/CsvConfigFileWriter.java
index f21f251..168ba08 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/CsvConfigFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/CsvConfigFileWriter.java
@@ -16,11 +16,13 @@
*/
package org.apache.oodt.cas.pge.writers;
-//Google static imports
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+
+import org.apache.oodt.cas.metadata.Metadata;
-//JDK imports
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -28,14 +30,9 @@ import java.io.PrintStream;
import java.util.List;
import java.util.logging.Logger;
-//Google imports
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
/**
* CSV {@link SciPgeConfigFileWriter} which takes a comma separted list of
@@ -74,7 +71,7 @@ public class CsvConfigFileWriter extends DynamicConfigFileWriter {
@Override
public File generateFile(String filePath, Metadata metadata, Logger logger,
- Object... customArgs) throws Exception {
+ Object... customArgs) throws IOException {
checkArgument(customArgs.length > 0,
CsvConfigFileWriter.class.getCanonicalName()
+ " has no args specified");
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/ExternExtractorMetWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/ExternExtractorMetWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/ExternExtractorMetWriter.java
index 4c9c61e..063efa2 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/ExternExtractorMetWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/ExternExtractorMetWriter.java
@@ -17,14 +17,20 @@
package org.apache.oodt.cas.pge.writers;
-//JDK imports
-import java.io.File;
-
-//OODT imports
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractorConfigReaderException;
import org.apache.oodt.cas.metadata.extractors.ExternConfigReader;
import org.apache.oodt.cas.metadata.extractors.ExternMetExtractor;
-import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
+import org.apache.oodt.commons.exceptions.CommonsException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.text.ParseException;
+
+
/**
*
@@ -35,15 +41,14 @@ import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
public class ExternExtractorMetWriter extends PcsMetFileWriter {
@Override
- protected Metadata getSciPgeSpecificMetadata(File sciPgeConfigFilePath,
- Metadata inputMetadata, Object... customArgs) throws Exception {
+ protected Metadata getSciPgeSpecificMetadata(File sciPgeConfigFilePath, Metadata inputMetadata, Object... customArgs)
+ throws PGEException, MetExtractorConfigReaderException, MetExtractionException, FileNotFoundException,
+ ParseException, CommonsException, CasMetadataException {
ExternMetExtractor extractor = new ExternMetExtractor();
extractor.setConfigFile(new ExternConfigReader().parseConfigFile(new File(
(String) customArgs[0])));
Metadata m = new Metadata();
m.addMetadata(extractor.extractMetadata(sciPgeConfigFilePath)
- .getHashtable(), true);
- return m;
- }
-
+ .getHashtable(), true);
+ return m; }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/FilenameExtractorWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/FilenameExtractorWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/FilenameExtractorWriter.java
index 5cae64f..38f2d83 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/FilenameExtractorWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/FilenameExtractorWriter.java
@@ -16,14 +16,12 @@
*/
package org.apache.oodt.cas.pge.writers;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+import org.apache.oodt.cas.metadata.extractors.FilenameTokenMetExtractor;
-//JDK imports
import java.io.File;
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.extractors.FilenameTokenMetExtractor;
-import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
/**
*
@@ -45,7 +43,7 @@ public class FilenameExtractorWriter extends PcsMetFileWriter {
*/
@Override
protected Metadata getSciPgeSpecificMetadata(File generatedFile,
- Metadata workflowMet, Object... args) throws Exception {
+ Metadata workflowMet, Object... args) throws MetExtractionException {
String metConfFilePath = String.valueOf(args[0]);
FilenameTokenMetExtractor extractor = new FilenameTokenMetExtractor();
extractor.setConfigFile(metConfFilePath);
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
index f0ee686..cbdd74a 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
@@ -18,14 +18,16 @@
package org.apache.oodt.cas.pge.writers;
//JDK imports
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.oodt.cas.metadata.Metadata;
+
import java.io.File;
+import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;
//APACHE imports
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.metadata.Metadata;
/**
*
@@ -56,7 +58,7 @@ public class MetadataKeyReplacerTemplateWriter extends
*/
@Override
public File generateFile(String filePath, Metadata metadata, Logger logger,
- Object... args) throws Exception {
+ Object... args) throws IOException {
String templateFile = (String) args[0];
String processedTemplate = FileUtils
.readFileToString(new File(templateFile));
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/PcsMetFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/PcsMetFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/PcsMetFileWriter.java
index 60256e3..579c5a4 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/PcsMetFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/PcsMetFileWriter.java
@@ -18,13 +18,20 @@
package org.apache.oodt.cas.pge.writers;
-//OODT imports
-import org.apache.oodt.cas.pge.metadata.PgeMetadata;
+
import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractorConfigReaderException;
+import org.apache.oodt.cas.pge.exceptions.PGEException;
+import org.apache.oodt.cas.pge.metadata.PgeMetadata;
+import org.apache.oodt.commons.exceptions.CommonsException;
-//OODT imports
import java.io.File;
+import java.io.FileNotFoundException;
+import java.text.ParseException;
+
/**
*
@@ -40,7 +47,9 @@ public abstract class PcsMetFileWriter {
public static final String FILE_SIZE = "FileSize";
public Metadata getMetadataForFile(File sciPgeCreatedDataFile,
- PgeMetadata pgeMetadata, Object... customArgs) throws Exception {
+ PgeMetadata pgeMetadata, Object... customArgs)
+ throws PGEException, MetExtractorConfigReaderException, MetExtractionException, CommonsException,
+ FileNotFoundException, CasMetadataException, ParseException {
try {
Metadata inputMetadata = pgeMetadata.asMetadata();
@@ -54,14 +63,16 @@ public abstract class PcsMetFileWriter {
return this.getSciPgeSpecificMetadata(
sciPgeCreatedDataFile, inputMetadata, customArgs);
- } catch (Exception e) {
- throw new Exception("Failed to create PCS metadata file for '"
+ } catch (PGEException e) {
+ throw new PGEException("Failed to create PCS metadata file for '"
+ sciPgeCreatedDataFile + "' : " + e.getMessage(), e);
}
}
protected abstract Metadata getSciPgeSpecificMetadata(
File sciPgeCreatedDataFile, Metadata inputMetadata,
- Object... customArgs) throws Exception;
+ Object... customArgs)
+ throws PGEException, MetExtractorConfigReaderException, MetExtractionException, FileNotFoundException,
+ ParseException, CommonsException, CasMetadataException;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/TextConfigFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/TextConfigFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/TextConfigFileWriter.java
index 161b21b..f32b3a7 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/TextConfigFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/TextConfigFileWriter.java
@@ -17,24 +17,24 @@
package org.apache.oodt.cas.pge.writers;
//Google static imports
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.annotations.VisibleForTesting;
-//OODT static imports
-import static org.apache.oodt.cas.pge.util.XmlHelper.fillIn;
+import org.apache.oodt.cas.metadata.Metadata;
-//JDK imports
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.logging.Logger;
-//Google imports
-import com.google.common.annotations.VisibleForTesting;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.oodt.cas.pge.util.XmlHelper.fillIn;
+//OODT static imports
+//JDK imports
+//Google imports
//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
/**
* Text {@link SciPgeConfigFileWriter} which takes a template with envReplace
@@ -48,7 +48,7 @@ public class TextConfigFileWriter extends DynamicConfigFileWriter {
@Override
public File generateFile(String filePath, Metadata metadata, Logger logger,
- Object... customArgs) throws Exception {
+ Object... customArgs) throws IOException {
checkArgument(customArgs.length > 0,
TextConfigFileWriter.class.getCanonicalName()
+ " has no args specified");
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
index 9aa4526..e213094 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
@@ -18,17 +18,19 @@
package org.apache.oodt.cas.pge.writers;
//JDK imports
-import java.io.File;
-import java.io.StringWriter;
-import java.util.logging.Logger;
-
-//APACHE imports
import org.apache.commons.io.FileUtils;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.logging.Logger;
+
+//APACHE imports
+
/**
*
* A PGE input file writer based on Apache Velocity and Paul Ramirez's need to
@@ -53,7 +55,7 @@ public class VelocityConfigFileWriter extends DynamicConfigFileWriter {
*/
@Override
public File generateFile(String filePath, Metadata metadata, Logger logger,
- Object... args) throws Exception {
+ Object... args) throws IOException {
File configFile = new File(filePath);
VelocityMetadata velocityMetadata = new VelocityMetadata(metadata);
// Velocity requires you to set a path of where to look for
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
index b2509c0..e664379 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
@@ -19,19 +19,24 @@
package org.apache.oodt.cas.pge.writers.metlist;
//JDK imports
-import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.*;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
+import org.apache.oodt.commons.exceptions.CommonsException;
+import org.apache.oodt.commons.xml.XMLUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.text.ParseException;
import java.util.Arrays;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+
+import static org.apache.oodt.cas.pge.config.PgeConfigMetKeys.*;
//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.apache.oodt.cas.pge.writers.PcsMetFileWriter;
/**
*
@@ -47,7 +52,8 @@ public class MetadataListPcsMetFileWriter extends PcsMetFileWriter {
@Override
protected Metadata getSciPgeSpecificMetadata(File sciPgeCreatedDataFile,
- Metadata inputMetadata, Object... customArgs) throws Exception {
+ Metadata inputMetadata, Object... customArgs)
+ throws FileNotFoundException, ParseException, CommonsException, CasMetadataException {
Metadata metadata = new Metadata();
for (Object arg : customArgs) {
Element root = XMLUtils.getDocumentRoot(
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
index 336d99d..e535525 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
@@ -26,6 +26,7 @@ import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
@@ -100,7 +101,7 @@ public class XmlRpcWorkflowManagerClient {
}
- public List getRegisteredEvents() throws XmlRpcException, IOException {
+ public List getRegisteredEvents() throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
return (List) client.execute("workflowmgr.getRegisteredEvents",
@@ -190,7 +191,7 @@ public class XmlRpcWorkflowManagerClient {
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
- public List getWorkflowsByEvent(String eventName) throws XmlRpcException, IOException {
+ public List getWorkflowsByEvent(String eventName) throws XmlRpcException, IOException, RepositoryException {
List workflows = new Vector();
Vector workflowVector;
Vector argList = new Vector();
@@ -349,7 +350,7 @@ public class XmlRpcWorkflowManagerClient {
}
- public WorkflowTask getTaskById(String taskId) throws XmlRpcException, IOException {
+ public WorkflowTask getTaskById(String taskId) throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
argList.add(taskId);
@@ -360,7 +361,7 @@ public class XmlRpcWorkflowManagerClient {
}
public WorkflowCondition getConditionById(String conditionId)
- throws XmlRpcException, IOException {
+ throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
argList.add(conditionId);
@@ -371,7 +372,7 @@ public class XmlRpcWorkflowManagerClient {
}
public WorkflowInstance getWorkflowInstanceById(String wInstId)
- throws XmlRpcException, IOException {
+ throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
argList.add(wInstId);
@@ -382,7 +383,7 @@ public class XmlRpcWorkflowManagerClient {
}
- public Workflow getWorkflowById(String workflowId) throws XmlRpcException, IOException {
+ public Workflow getWorkflowById(String workflowId) throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
argList.add(workflowId);
@@ -392,7 +393,7 @@ public class XmlRpcWorkflowManagerClient {
}
- public Vector getWorkflows() throws XmlRpcException, IOException {
+ public Vector getWorkflows() throws XmlRpcException, IOException, RepositoryException {
Vector argList = new Vector();
Vector works;
Vector workflows;
@@ -481,7 +482,6 @@ public class XmlRpcWorkflowManagerClient {
return instsUnpacked;
} else
return null;
-
}
public static void main(String[] args) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
----------------------------------------------------------------------
diff --git a/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java b/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
index 9c05cbc..ca37774 100644
--- a/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
+++ b/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
@@ -17,12 +17,8 @@
package org.apache.oodt.cas.workflow.system;
//JDK imports
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-import java.util.Vector;
+import com.google.common.collect.Lists;
-//OODT imports
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.workflow.repository.MockWorkflowRepository;
import org.apache.oodt.cas.workflow.structs.Workflow;
@@ -30,9 +26,15 @@ import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
//Google imports
-import com.google.common.collect.Lists;
/**
* A Mock {@link XmlRpcWorkflowManagerClient}.
@@ -55,19 +57,19 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails("executeDynamicWorkflow",
Lists.newArrayList(taskIds, metadata));
return "TestId1";
}
- public List<String> getRegisteredEvents() throws Exception {
+ public List<String> getRegisteredEvents() throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails("getRegisteredEvents",
Lists.newArrayList());
return workflowRepo.getRegisteredEvents();
}
- public WorkflowInstancePage getFirstPage() throws Exception {
+ public WorkflowInstancePage getFirstPage(){
lastMethodCallDetails = new MethodCallDetails("getFirstPage",
Lists.newArrayList());
WorkflowInstancePage page = new WorkflowInstancePage();
@@ -79,7 +81,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails("getNextPage",
Lists.newArrayList((Object) currentPage));
WorkflowInstancePage page = new WorkflowInstancePage();
@@ -91,7 +93,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails("getPrevPage",
Lists.newArrayList((Object) currentPage));
WorkflowInstancePage page = new WorkflowInstancePage();
@@ -102,7 +104,7 @@ public class MockXmlRpcWorkflowManagerClient extends
return page;
}
- public WorkflowInstancePage getLastPage() throws Exception {
+ public WorkflowInstancePage getLastPage() {
lastMethodCallDetails = new MethodCallDetails("getLastPage", null);
WorkflowInstancePage page = new WorkflowInstancePage();
page.setPageNum(1);
@@ -113,7 +115,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public WorkflowInstancePage paginateWorkflowInstances(int pageNum,
- String status) throws Exception {
+ String status) {
lastMethodCallDetails = new MethodCallDetails("paginateWorkflowInstances",
Lists.newArrayList(pageNum, (Object) status));
WorkflowInstancePage page = new WorkflowInstancePage();
@@ -125,7 +127,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public WorkflowInstancePage paginateWorkflowInstances(int pageNum)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails("paginateWorkflowInstances",
Lists.newArrayList((Object) pageNum));
WorkflowInstancePage page = new WorkflowInstancePage();
@@ -136,20 +138,20 @@ public class MockXmlRpcWorkflowManagerClient extends
return page;
}
- public List<Workflow> getWorkflowsByEvent(String eventName) throws Exception {
+ public List<Workflow> getWorkflowsByEvent(String eventName) throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails("getWorkflowsByEvent",
Lists.newArrayList((Object) eventName));
return workflowRepo.getWorkflowsForEvent(eventName);
}
- public Metadata getWorkflowInstanceMetadata(String wInstId) throws Exception {
+ public Metadata getWorkflowInstanceMetadata(String wInstId) {
lastMethodCallDetails = new MethodCallDetails("getWorkflowInstanceMetadata",
Lists.newArrayList((Object) wInstId));
return new Metadata();
}
public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(
- String wInstId, String startDateTimeIsoStr) throws Exception {
+ String wInstId, String startDateTimeIsoStr) {
lastMethodCallDetails = new MethodCallDetails(
"setWorkflowInstanceCurrentTaskStartDateTime",
Lists.newArrayList((Object) wInstId, startDateTimeIsoStr));
@@ -157,7 +159,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowCurrentTaskWallClockMinutes",
Lists.newArrayList((Object) workflowInstId));
@@ -165,7 +167,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public double getWorkflowWallClockMinutes(String workflowInstId)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowWallClockMinutes",
Lists.newArrayList((Object) workflowInstId));
@@ -173,7 +175,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean stopWorkflowInstance(String workflowInstId)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"stopWorkflowInstance",
Lists.newArrayList((Object) workflowInstId));
@@ -181,7 +183,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean pauseWorkflowInstance(String workflowInstId)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"pauseWorkflowInstance",
Lists.newArrayList((Object) workflowInstId));
@@ -189,7 +191,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean resumeWorkflowInstance(String workflowInstId)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"resumeWorkflowInstance",
Lists.newArrayList((Object) workflowInstId));
@@ -197,7 +199,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
- String wInstId, String endDateTimeIsoStr) throws Exception {
+ String wInstId, String endDateTimeIsoStr) {
lastMethodCallDetails = new MethodCallDetails(
"setWorkflowInstanceCurrentTaskEndDateTime",
Lists.newArrayList((Object) wInstId, endDateTimeIsoStr));
@@ -205,7 +207,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean updateWorkflowInstanceStatus(
- String workflowInstId, String status) throws Exception {
+ String workflowInstId, String status) {
lastMethodCallDetails = new MethodCallDetails(
"updateWorkflowInstanceStatus",
Lists.newArrayList((Object) workflowInstId, status));
@@ -213,7 +215,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean updateWorkflowInstance(WorkflowInstance instance)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"updateWorkflowInstance",
Lists.newArrayList((Object) instance));
@@ -221,7 +223,7 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public synchronized boolean updateMetadataForWorkflow(String workflowInstId,
- Metadata metadata) throws Exception {
+ Metadata metadata) {
lastMethodCallDetails = new MethodCallDetails(
"updateMetadataForWorkflow",
Lists.newArrayList((Object) workflowInstId, metadata));
@@ -229,30 +231,28 @@ public class MockXmlRpcWorkflowManagerClient extends
}
public boolean sendEvent(String eventName, Metadata metadata)
- throws Exception {
+ {
lastMethodCallDetails = new MethodCallDetails(
"sendEvent",
Lists.newArrayList((Object) eventName, metadata));
return true;
}
- public WorkflowTask getTaskById(String taskId) throws Exception {
+ public WorkflowTask getTaskById(String taskId) throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails(
"getTaskById",
Lists.newArrayList((Object) taskId));
return workflowRepo.getWorkflowTaskById(taskId);
}
- public WorkflowCondition getConditionById(String conditionId)
- throws Exception {
+ public WorkflowCondition getConditionById(String conditionId) throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails(
"getConditionById",
Lists.newArrayList((Object) conditionId));
return workflowRepo.getWorkflowConditionById(conditionId);
}
- public WorkflowInstance getWorkflowInstanceById(String wInstId)
- throws Exception {
+ public WorkflowInstance getWorkflowInstanceById(String wInstId) throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowInstanceById",
Lists.newArrayList((Object) wInstId));
@@ -265,42 +265,42 @@ public class MockXmlRpcWorkflowManagerClient extends
return wInst;
}
- public Workflow getWorkflowById(String workflowId) throws Exception {
+ public Workflow getWorkflowById(String workflowId) throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowById",
Lists.newArrayList((Object) workflowId));
return workflowRepo.getWorkflowById(workflowId);
}
- public Vector<Workflow> getWorkflows() throws Exception {
+ public Vector<Workflow> getWorkflows() throws RepositoryException {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflows",
Lists.newArrayList());
return new Vector<Workflow>(workflowRepo.getWorkflows());
}
- public int getNumWorkflowInstancesByStatus(String status) throws Exception {
+ public int getNumWorkflowInstancesByStatus(String status) {
lastMethodCallDetails = new MethodCallDetails(
"getNumWorkflowInstancesByStatus",
Lists.newArrayList((Object) status));
return 1;
}
- public int getNumWorkflowInstances() throws Exception {
+ public int getNumWorkflowInstances() {
lastMethodCallDetails = new MethodCallDetails(
"getNumWorkflowInstances",
Lists.newArrayList());
return 1;
}
- public Vector<WorkflowInstance> getWorkflowInstancesByStatus(String status) throws Exception {
+ public Vector<WorkflowInstance> getWorkflowInstancesByStatus(String status) {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowInstancesByStatus",
Lists.newArrayList((Object) status));
return new Vector<WorkflowInstance>();
}
- public Vector<WorkflowInstance> getWorkflowInstances() throws Exception {
+ public Vector<WorkflowInstance> getWorkflowInstances() {
lastMethodCallDetails = new MethodCallDetails(
"getWorkflowInstances",
Lists.newArrayList());
[2/5] oodt git commit: OODT-909 create improved exceptions
Posted by ma...@apache.org.
OODT-909 create improved exceptions
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/11e28571
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/11e28571
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/11e28571
Branch: refs/heads/master
Commit: 11e28571225a883ecb2afe66f64941e2dc91112f
Parents: c364b7b
Author: Tom Barber <to...@analytical-labs.com>
Authored: Tue Oct 27 20:40:58 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Tue Oct 27 20:40:58 2015 +0000
----------------------------------------------------------------------
.../processor/WorkflowProcessorHelper.java | 16 +-
.../workflow/exceptions/WorkflowException.java | 11 +
...SourceWorkflowInstanceRepositoryFactory.java | 14 +-
.../WorkflowInstanceMetadataReader.java | 19 +-
.../lifecycle/WorkflowLifecyclesReader.java | 19 +-
.../DataSourceWorkflowRepositoryFactory.java | 9 +-
.../repository/PackagedWorkflowRepository.java | 44 ++-
.../apache/oodt/cas/workflow/structs/Graph.java | 17 +-
.../workflow/system/XmlRpcWorkflowManager.java | 10 +-
.../system/XmlRpcWorkflowManagerClient.java | 357 +++++--------------
.../cas/workflow/tools/InstanceRepoCleaner.java | 23 +-
.../cas/workflow/util/CygwinScriptFile.java | 6 +-
.../oodt/cas/workflow/util/ScriptFile.java | 15 +-
.../cas/workflow/util/XmlStructFactory.java | 32 +-
14 files changed, 230 insertions(+), 362 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
index 2955d27..29a6743 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
@@ -17,24 +17,24 @@
package org.apache.oodt.cas.workflow.engine.processor;
//OODT imports
-import org.apache.oodt.commons.exec.ExecHelper;
+import org.apache.commons.lang.StringUtils;
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycle;
+import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
import org.apache.oodt.cas.workflow.structs.Graph;
+import org.apache.oodt.cas.workflow.structs.ParentChildWorkflow;
import org.apache.oodt.cas.workflow.structs.Priority;
import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
-import org.apache.oodt.cas.workflow.structs.ParentChildWorkflow;
import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
-import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycle;
-import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
+import org.apache.oodt.commons.exec.ExecHelper;
-//JDK imports
import java.net.InetAddress;
import java.util.List;
import java.util.Map;
import java.util.Vector;
+//JDK imports
//APACHE imports
-import org.apache.commons.lang.StringUtils;
/**
*
@@ -131,7 +131,7 @@ public class WorkflowProcessorHelper {
public WorkflowProcessor buildProcessor(String instanceId,
ParentChildWorkflow workflow,
Map<String, Class<? extends WorkflowProcessor>> modelToProcessorMap,
- boolean preCond) throws Exception {
+ boolean preCond) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
List<WorkflowProcessor> subProcessors = new Vector<WorkflowProcessor>();
List<WorkflowCondition> conditions = preCond ? workflow.getPreConditions()
: workflow.getPostConditions();
@@ -151,7 +151,7 @@ public class WorkflowProcessorHelper {
public WorkflowProcessor buildProcessor(String instanceId,
ParentChildWorkflow model, boolean isCondition,
Map<String, Class<? extends WorkflowProcessor>> modelToProcessorMap)
- throws Exception {
+ throws IllegalAccessException, InstantiationException, ClassNotFoundException {
WorkflowProcessor wp = modelToProcessorMap.get(
model.getGraph().getExecutionType()).newInstance();
WorkflowLifecycle wLifecycle = getLifecycle(model);
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/exceptions/WorkflowException.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/exceptions/WorkflowException.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/exceptions/WorkflowException.java
new file mode 100644
index 0000000..308c5ad
--- /dev/null
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/exceptions/WorkflowException.java
@@ -0,0 +1,11 @@
+package org.apache.oodt.cas.workflow.exceptions;
+
+/**
+ * Created by bugg on 27/10/15.
+ */
+public class WorkflowException extends Exception {
+
+ public WorkflowException(String message){
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/DataSourceWorkflowInstanceRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/DataSourceWorkflowInstanceRepositoryFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/DataSourceWorkflowInstanceRepositoryFactory.java
index f814922..caf68ad 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/DataSourceWorkflowInstanceRepositoryFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/DataSourceWorkflowInstanceRepositoryFactory.java
@@ -19,20 +19,20 @@
package org.apache.oodt.cas.workflow.instrepo;
//OODT imports
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository;
-import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepositoryFactory;
-//APACHE imports
import org.apache.commons.dbcp.ConnectionFactory;
import org.apache.commons.dbcp.DriverManagerConnectionFactory;
import org.apache.commons.dbcp.PoolableConnectionFactory;
import org.apache.commons.dbcp.PoolingDataSource;
import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
-//JDK imports
import javax.sql.DataSource;
+//APACHE imports
+//JDK imports
+
/**
* @author mattmann
* @version $Revision$
@@ -60,7 +60,7 @@ public class DataSourceWorkflowInstanceRepositoryFactory implements
* Default constructor
* </p>
*/
- public DataSourceWorkflowInstanceRepositoryFactory() throws Exception {
+ public DataSourceWorkflowInstanceRepositoryFactory() throws WorkflowException {
String jdbcUrl, user, pass, driver;
jdbcUrl = PathUtils
@@ -79,7 +79,7 @@ public class DataSourceWorkflowInstanceRepositoryFactory implements
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
- throw new Exception("Cannot load driver: " + driver);
+ throw new WorkflowException("Cannot load driver: " + driver);
}
GenericObjectPool connectionPool = new GenericObjectPool(null);
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
index 8f1efe5..406846b 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
@@ -19,9 +19,15 @@
package org.apache.oodt.cas.workflow.instrepo;
//OODT imports
+
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+import org.apache.oodt.commons.exceptions.CommonsException;
import org.apache.oodt.commons.xml.DOMUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
-//JDK imports
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -29,12 +35,11 @@ import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
+
+//JDK imports
/**
* @author mattmann
@@ -56,7 +61,7 @@ public final class WorkflowInstanceMetadataReader implements
}
public static WorkflowInstanceMetMap parseMetMapFile(String mapFilePath)
- throws Exception {
+ throws CommonsException, WorkflowException {
Document doc = getDocumentRoot(mapFilePath);
Element rootElem = doc.getDocumentElement();
WorkflowInstanceMetMap map = new WorkflowInstanceMetMap();
@@ -66,7 +71,7 @@ public final class WorkflowInstanceMetadataReader implements
DEFAULT_WORKFLOW_MAP);
if (defaultElem == null) {
- throw new Exception("file: [" + mapFilePath
+ throw new WorkflowException("file: [" + mapFilePath
+ "] must specify a default workflow to field map!");
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
index 22fc39a..b42b8d8 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
@@ -19,10 +19,16 @@
package org.apache.oodt.cas.workflow.lifecycle;
//OODT imports
+
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+import org.apache.oodt.commons.exceptions.CommonsException;
import org.apache.oodt.commons.xml.DOMUtil;
import org.apache.oodt.commons.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
-//JDK imports
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -30,12 +36,11 @@ import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
+
+//JDK imports
/**
* @author mattmann
@@ -56,7 +61,7 @@ public final class WorkflowLifecyclesReader implements WorkflowLifecycleMetKeys
}
public static List parseLifecyclesFile(String lifecyclesFilePath)
- throws Exception {
+ throws CommonsException, WorkflowException {
Document doc = getDocumentRoot(lifecyclesFilePath);
Element rootElem = doc.getDocumentElement();
List lifecycles = new Vector();
@@ -66,7 +71,7 @@ public final class WorkflowLifecyclesReader implements WorkflowLifecycleMetKeys
DEFAULT_LIFECYCLE);
if (defaultElem == null) {
- throw new Exception("file: [" + lifecyclesFilePath
+ throw new WorkflowException("file: [" + lifecyclesFilePath
+ "] must specify a default workflow lifecycle!");
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepositoryFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepositoryFactory.java
index dea7dda..d622aee 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepositoryFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepositoryFactory.java
@@ -19,15 +19,18 @@
package org.apache.oodt.cas.workflow.repository;
//APACHE imports
+
import org.apache.commons.dbcp.ConnectionFactory;
import org.apache.commons.dbcp.DriverManagerConnectionFactory;
import org.apache.commons.dbcp.PoolableConnectionFactory;
import org.apache.commons.dbcp.PoolingDataSource;
import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
-//JDK imports
import javax.sql.DataSource;
+//JDK imports
+
/**
* @author mattmann
* @version $Revision$
@@ -49,7 +52,7 @@ public class DataSourceWorkflowRepositoryFactory implements
* Default Constructor
* </p>.
*/
- public DataSourceWorkflowRepositoryFactory() throws Exception {
+ public DataSourceWorkflowRepositoryFactory() throws WorkflowException {
String jdbcUrl, user, pass, driver;
jdbcUrl = System
@@ -64,7 +67,7 @@ public class DataSourceWorkflowRepositoryFactory implements
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
- throw new Exception("Cannot load driver: " + driver);
+ throw new WorkflowException("Cannot load driver: " + driver);
}
GenericObjectPool connectionPool = new GenericObjectPool(null);
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
index 50ed8b5..f24f785 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
@@ -17,17 +17,38 @@
package org.apache.oodt.cas.workflow.repository;
//OODT imports
+
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
import org.apache.oodt.cas.workflow.examples.BranchRedirector;
import org.apache.oodt.cas.workflow.examples.NoOpTask;
-import org.apache.oodt.cas.workflow.structs.*;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+import org.apache.oodt.cas.workflow.structs.Graph;
+import org.apache.oodt.cas.workflow.structs.ParentChildWorkflow;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
import org.apache.oodt.cas.workflow.util.XmlStructFactory;
+import org.apache.oodt.commons.exceptions.CommonsException;
import org.apache.oodt.commons.xml.XMLUtils;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import java.io.File;
-import java.util.*;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -398,7 +419,7 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
}
}
- private void computeEvents() throws Exception {
+ private void computeEvents() throws WorkflowException {
List<ParentChildWorkflow> workflows = new Vector<ParentChildWorkflow>();
for (ParentChildWorkflow w : this.workflows.values()) {
workflows.add(w);
@@ -441,13 +462,14 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
}
}
} else
- throw new Exception("Unsupported execution type: ["
+ throw new WorkflowException("Unsupported execution type: ["
+ workflow.getGraph().getExecutionType() + "]");
}
}
private void loadTaskAndConditionDefinitions(List<Element> rootElements,
- Element rootElem, Metadata staticMetadata) throws Exception {
+ Element rootElem, Metadata staticMetadata)
+ throws CommonsException, CasMetadataException, WorkflowException, ParseException {
List<Element> conditionBlocks = this.getChildrenByTagName(rootElem,
"condition");
@@ -474,7 +496,8 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
}
private void loadGraphs(List<Element> rootElements, Element graphElem,
- Graph parent, Metadata staticMetadata) throws Exception {
+ Graph parent, Metadata staticMetadata)
+ throws CommonsException, CasMetadataException, WorkflowException, ParseException {
LOG.log(Level.FINEST, "Visiting node: [" + graphElem.getNodeName() + "]");
loadConfiguration(rootElements, graphElem, staticMetadata);
@@ -520,7 +543,7 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
}
private void loadConfiguration(List<Element> rootElements, Node workflowNode,
- Metadata staticMetadata) throws Exception {
+ Metadata staticMetadata) throws ParseException, CommonsException, CasMetadataException, WorkflowException {
NodeList children = workflowNode.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curChild = children.item(i);
@@ -562,7 +585,8 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
}
private Metadata loadConfGroup(List<Element> rootElements, String group,
- Map<String, Metadata> globalConfGroups) throws Exception {
+ Map<String, Metadata> globalConfGroups)
+ throws ParseException, CommonsException, CasMetadataException, WorkflowException {
for (final Element rootElement : rootElements) {
NodeList nodes = rootElement.getElementsByTagName("configuration");
for (int i = 0; i < nodes.getLength(); i++) {
@@ -572,7 +596,7 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
return XmlStructFactory.getConfigurationAsMetadata(node);
}
}
- throw new Exception("Configuration group '" + group + "' not defined!");
+ throw new WorkflowException("Configuration group '" + group + "' not defined!");
}
private void expandWorkflowTasksAndConditions(Graph graph,
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
index bf2a074..e8015c7 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
@@ -18,16 +18,19 @@
package org.apache.oodt.cas.workflow.structs;
//JDK imports
+
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.Vector;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
/**
*
@@ -73,7 +76,7 @@ public class Graph {
public static final List<String> processorIds = Arrays.asList(new String[] {
"sequential", "parallel", "condition", "task" });
- public Graph(Element graphElem, Metadata staticMetadata) throws Exception {
+ public Graph(Element graphElem, Metadata staticMetadata) throws WorkflowException {
this();
this.modelId = graphElem.getAttribute("id");
this.modelName = graphElem.getAttribute("name");
@@ -100,14 +103,14 @@ public class Graph {
if ((graphElem.getNodeName().equals("workflow") || graphElem.getNodeName()
.equals("conditions")) && this.executionType == null) {
- throw new Exception("workflow model '" + graphElem.getNodeName()
+ throw new WorkflowException("workflow model '" + graphElem.getNodeName()
+ "' missing execution type");
} else {
this.executionType = graphElem.getNodeName();
}
if (!processorIds.contains(this.executionType))
- throw new Exception("Unsupported execution type id '"
+ throw new WorkflowException("Unsupported execution type id '"
+ this.executionType + "'");
if (!checkValue(this.modelId) && !checkValue(this.modelIdRef)) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
index 4e191a5..33bb5b5 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
@@ -581,21 +581,17 @@ public class XmlRpcWorkflowManager {
}
public synchronized boolean updateWorkflowInstanceStatus(
- String workflowInstanceId, String status) throws Exception {
+ String workflowInstanceId, String status) throws InstanceRepositoryException {
WorkflowInstance wInst;
- try {
wInst = engine.getInstanceRepository().getWorkflowInstanceById(
workflowInstanceId);
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
+
wInst.setStatus(status);
return doUpdateWorkflowInstance(wInst);
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException {
int portNum = -1;
String usage = "XmlRpcWorkflowManager --portNum <port number for xml rpc service>\n";
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
index cfa013f..336d99d 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
@@ -19,26 +19,26 @@
package org.apache.oodt.cas.workflow.system;
//APACHE imports
+import org.apache.oodt.cas.cli.CmdLineUtility;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
-//JDK imports
+import java.io.IOException;
import java.net.URL;
import java.util.Hashtable;
-import java.util.Vector;
import java.util.List;
+import java.util.Vector;
import java.util.logging.Logger;
-import java.io.IOException;
+//JDK imports
//OODT imports
-import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
-import org.apache.oodt.cas.workflow.structs.WorkflowTask;
-import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
-import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
-import org.apache.oodt.cas.workflow.structs.Workflow;
-import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
-import org.apache.oodt.cas.cli.CmdLineUtility;
-import org.apache.oodt.cas.metadata.Metadata;
/**
* @author mattmann
@@ -76,20 +76,14 @@ public class XmlRpcWorkflowManagerClient {
}
public boolean refreshRepository()
- throws Exception {
- try {
+ throws XmlRpcException, IOException {
return (Boolean) client.execute(
"workflowmgr.refreshRepository", new Vector());
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
Vector<String> taskIdVector = new Vector<String>();
taskIdVector.addAll(taskIds);
@@ -98,67 +92,42 @@ public class XmlRpcWorkflowManagerClient {
argList.add(taskIdVector);
argList.add(metadata.getHashtable());
- try {
instId = (String) client.execute("workflowmgr.executeDynamicWorkflow",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return instId;
}
- public List getRegisteredEvents() throws Exception {
+ public List getRegisteredEvents() throws XmlRpcException, IOException {
Vector argList = new Vector();
- try {
return (List) client.execute("workflowmgr.getRegisteredEvents",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
- public WorkflowInstancePage getFirstPage() throws Exception {
+ public WorkflowInstancePage getFirstPage() throws XmlRpcException, IOException {
Vector argList = new Vector();
Hashtable pageHash;
- try {
pageHash = (Hashtable) client.execute("workflowmgr.getFirstPage",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(XmlRpcStructFactory
.getXmlRpcWorkflowInstancePage(currentPage));
Hashtable pageHash;
- try {
pageHash = (Hashtable) client.execute("workflowmgr.getNextPage",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
@@ -183,69 +152,51 @@ public class XmlRpcWorkflowManagerClient {
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
- public WorkflowInstancePage getLastPage() throws Exception {
+ public WorkflowInstancePage getLastPage() throws XmlRpcException, IOException {
Vector argList = new Vector();
Hashtable pageHash;
- try {
pageHash = (Hashtable) client.execute("workflowmgr.getLastPage",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
public WorkflowInstancePage paginateWorkflowInstances(int pageNum,
- String status) throws Exception {
+ String status) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(pageNum);
argList.add(status);
Hashtable pageHash;
- try {
pageHash = (Hashtable) client.execute(
"workflowmgr.paginateWorkflowInstances", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
public WorkflowInstancePage paginateWorkflowInstances(int pageNum)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(pageNum);
Hashtable pageHash;
- try {
pageHash = (Hashtable) client.execute(
"workflowmgr.paginateWorkflowInstances", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}
- public List getWorkflowsByEvent(String eventName) throws Exception {
+ public List getWorkflowsByEvent(String eventName) throws XmlRpcException, IOException {
List workflows = new Vector();
Vector workflowVector;
Vector argList = new Vector();
argList.add(eventName);
- try {
+
workflowVector = (Vector) client.execute(
"workflowmgr.getWorkflowsByEvent", argList);
@@ -259,300 +210,193 @@ public class XmlRpcWorkflowManagerClient {
}
return workflows;
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
- public Metadata getWorkflowInstanceMetadata(String wInstId) throws Exception {
+ public Metadata getWorkflowInstanceMetadata(String wInstId) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(wInstId);
Metadata met;
- try {
Hashtable instMetHash = (Hashtable) client.execute(
"workflowmgr.getWorkflowInstanceMetadata", argList);
met = new Metadata();
met.addMetadata(instMetHash);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
return met;
}
public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(
- String wInstId, String startDateTimeIsoStr) throws Exception {
+ String wInstId, String startDateTimeIsoStr) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(wInstId);
argList.add(startDateTimeIsoStr);
- try {
return (Boolean) client.execute(
"workflowmgr.setWorkflowInstanceCurrentTaskStartDateTime",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
- try {
return (Double) client.execute(
"workflowmgr.getWorkflowCurrentTaskWallClockMinutes",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public double getWorkflowWallClockMinutes(String workflowInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
- try {
return (Double) client.execute(
"workflowmgr.getWorkflowWallClockMinutes", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean stopWorkflowInstance(String workflowInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
- try {
return (Boolean) client.execute(
"workflowmgr.stopWorkflowInstance", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean pauseWorkflowInstance(String workflowInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
- try {
return (Boolean) client.execute(
"workflowmgr.pauseWorkflowInstance", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean resumeWorkflowInstance(String workflowInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
- try {
return (Boolean) client.execute(
"workflowmgr.resumeWorkflowInstance", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
- String wInstId, String endDateTimeIsoStr) throws Exception {
+ String wInstId, String endDateTimeIsoStr) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(wInstId);
argList.add(endDateTimeIsoStr);
- try {
return (Boolean) client.execute(
"workflowmgr.setWorkflowInstanceCurrentTaskEndDateTime",
argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean updateWorkflowInstanceStatus(
- String workflowInstId, String status) throws Exception {
+ String workflowInstId, String status) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
argList.add(status);
- try {
return (Boolean) client.execute(
"workflowmgr.updateWorkflowInstanceStatus", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean updateWorkflowInstance(WorkflowInstance instance)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(XmlRpcStructFactory.getXmlRpcWorkflowInstance(instance));
- try {
- return (Boolean) client.execute(
+ return (Boolean) client.execute(
"workflowmgr.updateWorkflowInstance", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public synchronized boolean updateMetadataForWorkflow(
- String workflowInstId, Metadata metadata) throws Exception {
+ String workflowInstId, Metadata metadata) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowInstId);
argList.add(metadata.getHashtable());
- try {
return (Boolean) client.execute(
"workflowmgr.updateMetadataForWorkflow", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
public boolean sendEvent(String eventName, Metadata metadata)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(eventName);
argList.add(metadata.getHashtable());
- try {
return (Boolean) client
.execute("workflowmgr.handleEvent", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- throw new Exception(e.getMessage());
- }
+
}
- public WorkflowTask getTaskById(String taskId) throws Exception {
+ public WorkflowTask getTaskById(String taskId) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(taskId);
- try {
Hashtable t = (Hashtable) client.execute("workflowmgr.getTaskById",
argList);
return XmlRpcStructFactory.getWorkflowTaskFromXmlRpc(t);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
}
public WorkflowCondition getConditionById(String conditionId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(conditionId);
- try {
Hashtable c = (Hashtable) client.execute(
"workflowmgr.getConditionById", argList);
return XmlRpcStructFactory.getWorkflowConditionFromXmlRpc(c);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
}
public WorkflowInstance getWorkflowInstanceById(String wInstId)
- throws Exception {
+ throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(wInstId);
- try {
Hashtable workflowInstance = (Hashtable) client.execute(
"workflowmgr.getWorkflowInstanceById", argList);
return XmlRpcStructFactory
.getWorkflowInstanceFromXmlRpc(workflowInstance);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
}
- public Workflow getWorkflowById(String workflowId) throws Exception {
+ public Workflow getWorkflowById(String workflowId) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(workflowId);
- try {
Hashtable workflow = (Hashtable) client.execute(
"workflowmgr.getWorkflowById", argList);
return XmlRpcStructFactory.getWorkflowFromXmlRpc(workflow);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
}
- public Vector getWorkflows() throws Exception {
+ public Vector getWorkflows() throws XmlRpcException, IOException {
Vector argList = new Vector();
Vector works;
Vector workflows;
- try {
works = (Vector) client
.execute("workflowmgr.getWorkflows", argList);
@@ -569,60 +413,39 @@ public class XmlRpcWorkflowManagerClient {
return workflows;
} else
return null;
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
}
- public int getNumWorkflowInstancesByStatus(String status) throws Exception{
+ public int getNumWorkflowInstancesByStatus(String status) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(status);
int numInsts;
- try {
numInsts = (Integer) client.execute(
"workflowmgr.getNumWorkflowInstancesByStatus", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
return numInsts;
}
- public int getNumWorkflowInstances() throws Exception{
+ public int getNumWorkflowInstances() throws XmlRpcException, IOException {
Vector argList = new Vector();
int numInsts;
- try {
numInsts = (Integer) client.execute(
"workflowmgr.getNumWorkflowInstances", argList);
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
return numInsts;
}
- public Vector getWorkflowInstancesByStatus(String status) throws Exception {
+ public Vector getWorkflowInstancesByStatus(String status) throws XmlRpcException, IOException {
Vector argList = new Vector();
argList.add(status);
Vector insts;
Vector instsUnpacked;
- try {
insts = (Vector) client.execute(
"workflowmgr.getWorkflowInstancesByStatus", argList);
if (insts != null) {
@@ -637,42 +460,28 @@ public class XmlRpcWorkflowManagerClient {
} else
return null;
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
+
}
- public Vector getWorkflowInstances() throws Exception {
+ public Vector getWorkflowInstances() throws XmlRpcException, IOException {
Vector argList = new Vector();
Vector insts;
Vector instsUnpacked;
- try {
- insts = (Vector) client.execute("workflowmgr.getWorkflowInstances",
- argList);
- if (insts != null) {
- instsUnpacked = new Vector(insts.size());
- for (Object inst1 : insts) {
- Hashtable hWinst = (Hashtable) inst1;
- WorkflowInstance inst = XmlRpcStructFactory
- .getWorkflowInstanceFromXmlRpc(hWinst);
- instsUnpacked.add(inst);
- }
- return instsUnpacked;
- } else
- return null;
+ insts = (Vector) client.execute("workflowmgr.getWorkflowInstances",
+ argList);
+ if (insts != null) {
+ instsUnpacked = new Vector(insts.size());
+ for (Object inst1 : insts) {
+ Hashtable hWinst = (Hashtable) inst1;
+ WorkflowInstance inst = XmlRpcStructFactory
+ .getWorkflowInstanceFromXmlRpc(hWinst);
+ instsUnpacked.add(inst);
+ }
+ return instsUnpacked;
+ } else
+ return null;
- } catch (XmlRpcException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
- throw new Exception(e.getMessage());
- }
}
public static void main(String[] args) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
index 83196e9..cf7f021 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
@@ -18,6 +18,17 @@
package org.apache.oodt.cas.workflow.tools;
//JDK imports
+import org.apache.oodt.cas.workflow.instrepo.LuceneWorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowStatus;
+import org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException;
+import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
+import org.apache.oodt.commons.date.DateUtils;
+import org.apache.xmlrpc.XmlRpcException;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;
import java.util.List;
@@ -25,12 +36,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
//OODT imports
-import org.apache.oodt.cas.workflow.instrepo.LuceneWorkflowInstanceRepository;
-import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
-import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
-import org.apache.oodt.cas.workflow.structs.WorkflowStatus;
-import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
-import org.apache.oodt.commons.date.DateUtils;
/**
*
@@ -61,7 +66,7 @@ public class InstanceRepoCleaner {
public InstanceRepoCleaner() {
}
- public InstanceRepoCleaner(String wmUrlStr) throws Exception {
+ public InstanceRepoCleaner(String wmUrlStr) throws MalformedURLException {
this.wm = new XmlRpcWorkflowManagerClient(new URL(wmUrlStr));
}
@@ -69,7 +74,7 @@ public class InstanceRepoCleaner {
this.rep = new LuceneWorkflowInstanceRepository(idxPath, 1000);
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws IOException, InstanceRepositoryException, XmlRpcException {
String usage = "InstanceRepoCleaner [options]\n"
+ "<workflow manager url>\n" + "--idxPath <path>\n";
if (args.length != 1 && args.length != 2) {
@@ -89,7 +94,7 @@ public class InstanceRepoCleaner {
clean.cleanRepository();
}
- public void cleanRepository() throws Exception {
+ public void cleanRepository() throws XmlRpcException, IOException, InstanceRepositoryException {
WorkflowInstancePage page = wm != null ? wm.getFirstPage() : rep
.getFirstPage();
while (page != null && page.getPageWorkflows() != null
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/util/CygwinScriptFile.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/CygwinScriptFile.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/CygwinScriptFile.java
index 038a12a..2427401 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/CygwinScriptFile.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/CygwinScriptFile.java
@@ -18,6 +18,8 @@
package org.apache.oodt.cas.workflow.util;
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -56,7 +58,7 @@ public class CygwinScriptFile extends ScriptFile {
/**
* Override writeScriptFile to ensure Windows (cygwin) compatibility for generated scripts
*/
- public void writeScriptFile(String filePath) throws Exception {
+ public void writeScriptFile(String filePath) throws WorkflowException {
PrintWriter pw = null;
try {
@@ -65,7 +67,7 @@ public class CygwinScriptFile extends ScriptFile {
pw.print(toString()); // Changed println to print for Cygwin compatibility
} catch (IOException e) {
e.printStackTrace();
- throw new Exception("Error writing script file!: " + e.getMessage());
+ throw new WorkflowException("Error writing script file!: " + e.getMessage());
} finally {
try {
pw.close();
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
index 871dc55..e850b6a 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
@@ -19,13 +19,16 @@
package org.apache.oodt.cas.workflow.util;
//JDK imports
-import java.util.List;
-import java.util.Vector;
+
+import org.apache.oodt.cas.workflow.exceptions.WorkflowException;
+
import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Vector;
/**
* @author mattmann
@@ -104,7 +107,7 @@ public class ScriptFile {
return rStr;
}
- public void writeScriptFile(String filePath) throws Exception {
+ public void writeScriptFile(String filePath) throws WorkflowException {
PrintWriter pw = null;
try {
@@ -113,7 +116,7 @@ public class ScriptFile {
pw.println(toString());
} catch (IOException e) {
e.printStackTrace();
- throw new Exception("Error writing script file!: " + e.getMessage());
+ throw new WorkflowException("Error writing script file!: " + e.getMessage());
} finally {
try {
pw.close();
http://git-wip-us.apache.org/repos/asf/oodt/blob/11e28571/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
index 90939a7..0305b43 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
@@ -17,26 +17,28 @@
package org.apache.oodt.cas.workflow.util;
-//JDK imports
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-import java.util.Vector;
-import java.util.HashMap;
-import java.util.logging.Logger;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-
-//OODT imports
import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
import org.apache.oodt.cas.metadata.util.PathUtils;
import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
import org.apache.oodt.cas.workflow.structs.WorkflowTask;
import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
-import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.commons.exceptions.CommonsException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.logging.Logger;
+
/**
* * A class for constructing Workflow Manager objects from XML {@link Node}s
@@ -231,7 +233,7 @@ public final class XmlStructFactory {
}
public static Metadata getConfigurationAsMetadata(Node configNode)
- throws Exception {
+ throws ParseException, CommonsException, CasMetadataException {
Metadata curMetadata = new Metadata();
NodeList curGrandChildren = configNode.getChildNodes();
for (int k = 0; k < curGrandChildren.getLength(); k++) {
[5/5] oodt git commit: OODT-909 create improved exceptions
Posted by ma...@apache.org.
OODT-909 create improved exceptions
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/0c67a330
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/0c67a330
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/0c67a330
Branch: refs/heads/master
Commit: 0c67a330500eead763869201a3541c52f215b787
Parents: 249931a
Author: Tom Barber <to...@analytical-labs.com>
Authored: Wed Oct 28 00:07:44 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Wed Oct 28 00:07:44 2015 +0000
----------------------------------------------------------------------
.../catalog/query/parser/SimpleCharStream.java | 2 +-
.../repository/SerializedCatalogRepository.java | 13 +-
.../system/impl/CatalogServiceLocal.java | 2 +-
.../crawl/action/FilemgrUniquenessChecker.java | 2 +-
.../apache/oodt/cas/crawl/action/MoveFile.java | 2 +-
.../crawl/action/WorkflowMgrStatusUpdate.java | 2 +-
.../cas/crawl/daemon/CrawlDaemonController.java | 24 +--
.../cas/filemgr/catalog/DataSourceCatalog.java | 47 +++--
.../catalog/LenientDataSourceCatalog.java | 14 +-
.../oodt/cas/filemgr/catalog/LuceneCatalog.java | 20 +-
.../cas/filemgr/catalog/ScienceDataCatalog.java | 14 +-
.../catalog/solr/DefaultProductSerializer.java | 2 +-
.../cas/filemgr/catalog/solr/SolrCatalog.java | 8 +-
.../oodt/cas/filemgr/ingest/CachedIngester.java | 4 +-
.../oodt/cas/filemgr/ingest/LocalCache.java | 10 +-
.../oodt/cas/filemgr/ingest/RmiCache.java | 6 +-
.../structs/exceptions/CacheException.java | 5 +
.../structs/exceptions/CatalogException.java | 5 +
.../exceptions/RepositoryManagerException.java | 6 +
.../cas/filemgr/system/XmlRpcFileManager.java | 48 ++---
.../filemgr/system/XmlRpcFileManagerClient.java | 182 +++++++++----------
.../validation/DataSourceValidationLayer.java | 24 +--
22 files changed, 229 insertions(+), 213 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
index 1fd645d..3872048 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
@@ -76,7 +76,7 @@ public class SimpleCharStream
}
catch (Throwable t)
{
- throw new Error(t.getMessage());
+ throw new Error(t.getMessage(),t);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
index 65465bb..21964a6 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
@@ -17,6 +17,12 @@
package org.apache.oodt.cas.catalog.repository;
//JDK imports
+import org.apache.commons.io.FileUtils;
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+import org.apache.oodt.cas.catalog.util.Serializer;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -28,13 +34,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
//APACHE imports
-import org.apache.commons.io.FileUtils;
-
//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.catalog.util.Serializer;
/**
* @author bfoster
@@ -56,6 +56,7 @@ public class SerializedCatalogRepository implements CatalogRepository {
new File(this.storageDir + "/classloaders").mkdirs();
}catch(Exception e) {
e.printStackTrace();
+ LOG.log(Level.SEVERE, e.getMessage());
throw new InstantiationException("Failed to instantiate SerializedCatalogRepository : " + e.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
index 07b816b..9832110 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
@@ -89,7 +89,7 @@ public class CatalogServiceLocal implements CatalogService {
this.disableIntersectingCrossCatalogQueries = disableIntersectingCrossCatalogQueries;
this.crossCatalogResultSortingThreshold = crossCatalogResultSortingThreshold;
}catch (Exception e) {
- e.printStackTrace();
+ LOG.log(Level.SEVERE,e.getMessage());
throw new InstantiationException(e.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FilemgrUniquenessChecker.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FilemgrUniquenessChecker.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FilemgrUniquenessChecker.java
index 96b6d5b..4c367d7 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FilemgrUniquenessChecker.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FilemgrUniquenessChecker.java
@@ -52,7 +52,7 @@ public class FilemgrUniquenessChecker extends CrawlerAction {
return !fmClient.hasProduct(productMetadata.getMetadata(PRODUCT_NAME));
} catch (Exception e) {
throw new CrawlerActionException("Product failed uniqueness check : ["
- + product + "] : " + e.getMessage());
+ + product + "] : " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
index 462d598..42809a0 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
@@ -76,7 +76,7 @@ public class MoveFile extends CrawlerAction {
return true; //File copied
} catch (Exception e) {
throw new CrawlerActionException("Failed to move file from " + mvFile
- + " to " + this.toDir + " : " + e.getMessage());
+ + " to " + this.toDir + " : " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/crawler/src/main/java/org/apache/oodt/cas/crawl/action/WorkflowMgrStatusUpdate.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/WorkflowMgrStatusUpdate.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/WorkflowMgrStatusUpdate.java
index 652a875..99d359e 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/WorkflowMgrStatusUpdate.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/WorkflowMgrStatusUpdate.java
@@ -57,7 +57,7 @@ public class WorkflowMgrStatusUpdate extends CrawlerAction implements
+ ingestSuffix, productMetadata);
} catch (Exception e) {
throw new CrawlerActionException(
- "Failed to update workflow manager : " + e.getMessage());
+ "Failed to update workflow manager : " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
index cf4ed40..d201d44 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
@@ -62,9 +62,9 @@ public class CrawlDaemonController {
avgCrawlTime = (Double) client.execute(
"crawldaemon.getAverageCrawlTime", argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
return avgCrawlTime;
@@ -79,9 +79,9 @@ public class CrawlDaemonController {
milisCrawling = (Integer) client.execute(
"crawldaemon.getMilisCrawling", argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
return milisCrawling;
@@ -96,9 +96,9 @@ public class CrawlDaemonController {
waitInterval = (Integer) client.execute(
"crawldaemon.getWaitInterval", argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
return waitInterval;
@@ -112,9 +112,9 @@ public class CrawlDaemonController {
numCrawls = (Integer) client.execute("crawldaemon.getNumCrawls",
argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
return numCrawls;
@@ -129,9 +129,9 @@ public class CrawlDaemonController {
running = (Boolean) client.execute("crawldaemon.isRunning",
argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
return running;
@@ -144,9 +144,9 @@ public class CrawlDaemonController {
try {
running = (Boolean) client.execute("crawldaemon.stop", argList);
} catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
} catch (IOException e) {
- throw new CrawlException(e.getMessage());
+ throw new CrawlException(e.getMessage(), e);
}
if (running) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
index 306d86f..b37e8aa 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
@@ -151,7 +151,7 @@ public class DataSourceCatalog implements Catalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
for (Element element : metadataTypes) {
@@ -206,7 +206,7 @@ public class DataSourceCatalog implements Catalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
for (Element element : metadataTypes) {
@@ -334,7 +334,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback addProduct transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -396,7 +396,6 @@ public class DataSourceCatalog implements Catalog {
updateReferences(product);
} catch (Exception e) {
- e.printStackTrace();
LOG.log(Level.WARNING, "Exception modifying product. Message: "
+ e.getMessage());
try {
@@ -407,7 +406,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback modifyProduct transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
@@ -481,7 +480,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback removeProduct transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -541,7 +540,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback setProductTransferStatus transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
@@ -620,7 +619,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback addProductReferences transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
@@ -682,7 +681,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback getProductById transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -755,7 +754,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback getProductByName transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -832,7 +831,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback getProductTypeById transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -909,7 +908,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback getProductstransaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -997,7 +996,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback getProductsByProductType transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -1058,7 +1057,7 @@ public class DataSourceCatalog implements Catalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
while (rs.next()) {
@@ -1078,7 +1077,7 @@ public class DataSourceCatalog implements Catalog {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception getting metadata. Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -1148,7 +1147,7 @@ public class DataSourceCatalog implements Catalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
while (rs.next()) {
@@ -1168,7 +1167,7 @@ public class DataSourceCatalog implements Catalog {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception getting metadata. Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -1282,7 +1281,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback get top N products. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(),e);
} finally {
if (rs != null) {
@@ -1372,7 +1371,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback add metadata value. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -1436,7 +1435,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback remove metadata value. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -1504,7 +1503,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback get num products. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -1827,7 +1826,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback get num results transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -2047,7 +2046,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback query transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -2191,7 +2190,7 @@ public class DataSourceCatalog implements Catalog {
"Unable to rollback updateProductReferences transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
index c2593fc..f9ff91d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
@@ -150,7 +150,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
} else {
@@ -234,7 +234,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception getting metadata. Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -283,7 +283,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
while (rs.next()) {
@@ -363,7 +363,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception getting metadata. Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
@@ -454,7 +454,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
"Unable to rollback add metadata value. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -522,7 +522,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
"Unable to rollback remove metadata value. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -718,7 +718,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
"Unable to rollback get num results transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
index fe49e42..a3cfc72 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
@@ -199,7 +199,7 @@ public class LuceneCatalog implements Catalog {
throw new CatalogException(
"ValidationLayerException when trying to obtain element list for product type: "
+ product.getProductType().getName()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e.getMessage(), e);
}
} else {
// remove all metadata
@@ -396,7 +396,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -445,7 +445,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -510,7 +510,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -567,7 +567,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -604,7 +604,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -689,7 +689,7 @@ public class LuceneCatalog implements Catalog {
"IOException when opening index directory: ["
+ indexFilePath + "] for search: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (searcher != null) {
try {
@@ -920,7 +920,7 @@ public class LuceneCatalog implements Catalog {
LOG.log(Level.WARNING,
"CatalogException when doing paged product query: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -940,7 +940,7 @@ public class LuceneCatalog implements Catalog {
LOG.log(Level.WARNING, "Exception removing product: ["
+ product.getProductName() + "] from index: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (reader != null) {
try {
@@ -981,7 +981,7 @@ public class LuceneCatalog implements Catalog {
+ e.getMessage(), e);
throw new CatalogException("Unable to index product: ["
+ cp.getProduct().getProductName() + "]: Message: "
- + e.getMessage());
+ + e.getMessage(), e);
} finally {
try {
if (writer != null) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java
index 075e89d..0948995 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java
@@ -200,7 +200,7 @@ public class ScienceDataCatalog implements Catalog {
LOG.log(Level.WARNING,
"Exception adding product metadata. Message: " + e.getMessage());
e.printStackTrace();
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -226,7 +226,7 @@ public class ScienceDataCatalog implements Catalog {
LOG.log(Level.WARNING,
"SQL Exception querying for granule existence. Last query was: "
+ queryExists + " , Message: " + e.getMessage());
- throw new SQLException(e.getMessage());
+ throw new SQLException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -252,7 +252,7 @@ public class ScienceDataCatalog implements Catalog {
String maxQuery = "SELECT MAX(granule_id) AS max_id FROM granule";
granuleId = this.commitQuery(new StringBuffer(query), maxQuery);
} catch (Exception e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -283,7 +283,7 @@ public class ScienceDataCatalog implements Catalog {
LOG.log(Level.WARNING,
"SQL Exception querying for parameter existence. Last query was: "
+ queryExists + " , Message: " + e.getMessage());
- throw new SQLException(e.getMessage());
+ throw new SQLException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -311,7 +311,7 @@ public class ScienceDataCatalog implements Catalog {
String maxQuery = "SELECT MAX(parameter_id) AS max_id FROM parameter";
parameterId = this.commitQuery(new StringBuffer(query), maxQuery);
} catch (Exception e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -357,7 +357,7 @@ public class ScienceDataCatalog implements Catalog {
"Unable to rollback addMetadata transaction. Message: "
+ e2.getMessage());
}
- throw new SQLException(e.getMessage());
+ throw new SQLException(e.getMessage(), e);
} finally {
if (statement != null) {
try {
@@ -983,7 +983,7 @@ public class ScienceDataCatalog implements Catalog {
LOG.log(Level.SEVERE, "Unable to rollback query transaction. Message: "
+ e2.getMessage());
}
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} finally {
if (rs != null) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
index 0b489be..796bf96 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
@@ -164,7 +164,7 @@ public class DefaultProductSerializer implements ProductSerializer {
} catch(Exception e) {
e.printStackTrace();
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
index 9812605..382b9e3 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
@@ -387,7 +387,7 @@ public class SolrCatalog implements Catalog {
return this.pagedQuery(new Query(), type, 1);
} catch(CatalogException e) {
- throw new RuntimeException(e.getMessage());
+ throw new RuntimeException(e.getMessage(), e);
}
}
@@ -406,7 +406,7 @@ public class SolrCatalog implements Catalog {
return pagedQuery(new Query(), type, numOfPages);
} catch(CatalogException e) {
- throw new RuntimeException(e.getMessage());
+ throw new RuntimeException(e.getMessage(), e);
}
}
@@ -421,7 +421,7 @@ public class SolrCatalog implements Catalog {
return this.pagedQuery(new Query(), type, currentPage.getPageNum()+1);
} catch(CatalogException e) {
- throw new RuntimeException(e.getMessage());
+ throw new RuntimeException(e.getMessage(), e);
}
}
@@ -436,7 +436,7 @@ public class SolrCatalog implements Catalog {
return this.pagedQuery(new Query(), type, prevPageNumber);
} catch(CatalogException e) {
- throw new RuntimeException(e.getMessage());
+ throw new RuntimeException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CachedIngester.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CachedIngester.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CachedIngester.java
index f82ef5e..efb6a40 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CachedIngester.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CachedIngester.java
@@ -127,13 +127,13 @@ public class CachedIngester extends StdIngester {
+ "]: Message: " + e.getMessage());
throw new CatalogException(
"Exception re-syncing cache to file manager: [" + fmUrl
- + "]: Message: " + e.getMessage());
+ + "]: Message: " + e.getMessage(), e);
}
return cache.contains(productName);
}
} catch (URISyntaxException e) {
LOG.log(Level.SEVERE, "Exception getting URI from URL");
- throw new CatalogException("Exception getting URL from URL: Message: " + e.getMessage());
+ throw new CatalogException("Exception getting URL from URL: Message: " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
index 8ea8634..dcdfa04 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
@@ -128,7 +128,7 @@ public class LocalCache implements Cache {
}
} catch (Exception e) {
throw new CacheException("Failed to sync with database : "
- + e.getMessage());
+ + e.getMessage(), e);
}
}
@@ -228,7 +228,7 @@ public class LocalCache implements Cache {
throw new CacheException(
"Unable to check for product reception from file manager: ["
+ fm.getFileManagerUrl() + "]: Message: "
- + e.getMessage());
+ + e.getMessage(), e);
}
}
@@ -280,7 +280,7 @@ public class LocalCache implements Cache {
} catch (Exception e) {
throw new CacheException("Failed to query for product via element "
+ elementName + " and range " + startOfQuery + " to "
- + endOfQuery + " : " + e.getMessage());
+ + endOfQuery + " : " + e.getMessage(), e);
}
return products;
@@ -292,7 +292,7 @@ public class LocalCache implements Cache {
return fm.query(query, fm.getProductTypeByName(productType));
} catch (Exception e) {
throw new CacheException("Failed to get product list for query "
- + query + " : " + e.getMessage());
+ + query + " : " + e.getMessage(), e);
}
}
@@ -302,7 +302,7 @@ public class LocalCache implements Cache {
return fm.getMetadata(product).getMetadata(metadataElementName);
} catch (Exception e) {
throw new CacheException("Failed to get metadata value for "
- + metadataElementName + " : " + e.getMessage());
+ + metadataElementName + " : " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java
index 702b537..f6df8a2 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java
@@ -113,7 +113,7 @@ public class RmiCache implements Cache {
try {
rmiCacheServer.sync(uniqueElementProductTypeNames);
} catch (RemoteException e) {
- throw new CacheException(e.getMessage());
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -129,7 +129,7 @@ public class RmiCache implements Cache {
try {
rmiCacheServer.sync(uniqueElementName, uniqueElementProductTypeNames);
} catch (RemoteException e) {
- throw new CacheException(e.getMessage());
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -158,7 +158,7 @@ public class RmiCache implements Cache {
try {
rmiCacheServer.sync();
} catch (RemoteException e) {
- throw new CacheException(e.getMessage());
+ throw new CacheException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CacheException.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CacheException.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CacheException.java
index e3278cb..e4912c2 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CacheException.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CacheException.java
@@ -33,4 +33,9 @@ public class CacheException extends Exception {
public CacheException(String msg) {
super(msg);
}
+
+ public CacheException(String msg, Throwable t) {
+ super(msg, t);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CatalogException.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CatalogException.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CatalogException.java
index 2ac74c0..4e1df88 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CatalogException.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/CatalogException.java
@@ -37,6 +37,11 @@ public class CatalogException extends Exception {
super(message);
}
+ public CatalogException(Throwable t){
+ super(t);
+
+ }
+
public CatalogException(String message, Throwable t) {
super(message, t);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/RepositoryManagerException.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/RepositoryManagerException.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/RepositoryManagerException.java
index e69ed11..2ca0ef6 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/RepositoryManagerException.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/exceptions/RepositoryManagerException.java
@@ -43,5 +43,11 @@ public class RepositoryManagerException extends Exception {
super(message);
}
+ public RepositoryManagerException(Throwable t){
+ super(t);
+ }
+ public RepositoryManagerException(String message, Throwable t) {
+ super(message,t);
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
index a2a0d9b..0be545d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
@@ -248,7 +248,7 @@ public class XmlRpcFileManager {
"Catalog exception performing paged query for product type: ["
+ type.getProductTypeId() + "] query: [" + query
+ "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
return XmlRpcStructFactory.getXmlRpcProductPage(prodPage);
@@ -351,7 +351,7 @@ public class XmlRpcFileManager {
LOG.log(Level.WARNING,
"Exception when getting num products: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
return numProducts;
@@ -369,7 +369,7 @@ public class XmlRpcFileManager {
LOG.log(Level.WARNING,
"Exception when getting topN products: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -389,7 +389,7 @@ public class XmlRpcFileManager {
"Exception when getting topN products by product type: ["
+ type.getProductTypeId() + "]: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -426,7 +426,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE,
"Unable to obtain product types from repository manager: Message: "
+ e.getMessage());
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e.getMessage(), e);
}
}
@@ -444,7 +444,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE, "Unable to obtain references for product: ["
+ product.getProductName() + "]: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -467,13 +467,13 @@ public class XmlRpcFileManager {
e.printStackTrace();
LOG.log(Level.SEVERE, "Unable to obtain product by id: ["
+ productId + "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} catch (RepositoryManagerException e) {
e.printStackTrace();
LOG.log(Level.SEVERE, "Unable to obtain product type by id: ["
+ product.getProductType().getProductTypeId()
+ "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -496,13 +496,13 @@ public class XmlRpcFileManager {
e.printStackTrace();
LOG.log(Level.SEVERE, "Unable to obtain product by name: ["
+ productName + "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
} catch (RepositoryManagerException e) {
e.printStackTrace();
LOG.log(Level.SEVERE, "Unable to obtain product type by id: ["
+ product.getProductType().getProductTypeId()
+ "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -521,7 +521,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE,
"Exception obtaining products by product type for type: ["
+ type.getName() + "]: Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(), e);
}
}
@@ -540,7 +540,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE,
"Exception obtaining elements for product type: ["
+ type.getName() + "]: Message: " + e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e.getMessage(), e);
}
}
@@ -556,7 +556,7 @@ public class XmlRpcFileManager {
e.printStackTrace();
LOG.log(Level.SEVERE, "exception retrieving element by id: ["
+ elementId + "]: Message: " + e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e.getMessage(), e);
}
}
@@ -572,7 +572,7 @@ public class XmlRpcFileManager {
e.printStackTrace();
LOG.log(Level.SEVERE, "exception retrieving element by name: ["
+ elementName + "]: Message: " + e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e.getMessage(), e);
}
}
@@ -631,7 +631,7 @@ public class XmlRpcFileManager {
} catch (Exception e) {
e.printStackTrace();
throw new CatalogException("Failed to perform complex query : "
- + e.getMessage());
+ + e.getMessage(), e);
}
}
@@ -664,7 +664,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE,
"Exception obtaining product type by id for product type: ["
+ productTypeId + "]: Message: " + e.getMessage());
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e.getMessage(), e);
}
}
@@ -770,7 +770,7 @@ public class XmlRpcFileManager {
} catch (Exception e) {
e.printStackTrace();
throw new CatalogException("Error ingesting product [" + p + "] : "
- + e.getMessage());
+ + e.getMessage(),e);
}
}
@@ -900,7 +900,7 @@ public class XmlRpcFileManager {
try {
this.dataTransfer.transferProduct(p);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
// now delete the original copy
@@ -913,7 +913,7 @@ public class XmlRpcFileManager {
} catch (URISyntaxException e) {
throw new DataTransferException(
"URI Syntax exception trying to remove original product ref: Message: "
- + e.getMessage());
+ + e.getMessage(), e);
}
// now save the updated reference
@@ -921,7 +921,7 @@ public class XmlRpcFileManager {
this.catalog.modifyProduct(p);
return true;
} catch (CatalogException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e.getMessage(),e);
}
} else
throw new UnsupportedOperationException(
@@ -1072,7 +1072,7 @@ public class XmlRpcFileManager {
"ingestProduct: General Exception when adding metadata "
+ metadata + " for product: " + p.getProductName()
+ ": Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(),e);
}
return metadata;
@@ -1169,7 +1169,7 @@ public class XmlRpcFileManager {
LOG.log(Level.SEVERE,
"Exception performing query against catalog for product type: ["
+ productType.getName() + "] Message: " + e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(),e);
}
}
@@ -1189,7 +1189,7 @@ public class XmlRpcFileManager {
"Exception obtaining metadata from catalog for product: ["
+ product.getProductId() + "]: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(),e);
}
}
@@ -1204,7 +1204,7 @@ public class XmlRpcFileManager {
"Exception obtaining metadata from catalog for product: ["
+ product.getProductId() + "]: Message: "
+ e.getMessage());
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e.getMessage(),e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
index eda060e..a4fdf78 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
@@ -232,9 +232,9 @@ public class XmlRpcFileManagerClient {
success = (Boolean) client.execute("filemgr.transferringProduct",
argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
return success;
@@ -253,9 +253,9 @@ public class XmlRpcFileManagerClient {
success = (Boolean) client.execute(
"filemgr.removeProductTransferStatus", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
return success;
@@ -274,9 +274,9 @@ public class XmlRpcFileManagerClient {
success = (Boolean) client.execute("filemgr.isTransferComplete",
argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
return success;
@@ -295,9 +295,9 @@ public class XmlRpcFileManagerClient {
try {
success = (Boolean) client.execute("filemgr.moveProduct", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
return success;
@@ -316,9 +316,9 @@ public class XmlRpcFileManagerClient {
success = (Boolean) client.execute("filemgr.modifyProduct",
argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return success;
@@ -338,9 +338,9 @@ public class XmlRpcFileManagerClient {
success = (Boolean) client.execute("filemgr.removeProduct",
argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return success;
@@ -359,9 +359,9 @@ public class XmlRpcFileManagerClient {
statusHash = (Hashtable<String, Object>) client.execute(
"filemgr.getCurrentFileTransfer", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
if (statusHash != null) {
@@ -384,9 +384,9 @@ public class XmlRpcFileManagerClient {
statusVector = (Vector<Hashtable<String, Object>>) client.execute(
"filemgr.getCurrentFileTransfers", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
if (statusVector != null) {
@@ -409,9 +409,9 @@ public class XmlRpcFileManagerClient {
pct = (Double) client.execute("filemgr.getProductPctTransferred",
argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
if (pct != null) {
@@ -433,9 +433,9 @@ public class XmlRpcFileManagerClient {
pct = (Double) client.execute("filemgr.getRefPctTransferred",
argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
if (pct != null) {
@@ -463,9 +463,9 @@ public class XmlRpcFileManagerClient {
pageHash = (Hashtable<String, Object>) client.execute(
"filemgr.pagedQuery", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
@@ -483,9 +483,9 @@ public class XmlRpcFileManagerClient {
pageHash = (Hashtable<String, Object>) client.execute(
"filemgr.getFirstPage", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (pageHash != null) {
@@ -508,9 +508,9 @@ public class XmlRpcFileManagerClient {
pageHash = (Hashtable<String, Object>) client.execute(
"filemgr.getLastPage", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (pageHash != null) {
@@ -534,9 +534,9 @@ public class XmlRpcFileManagerClient {
pageHash = (Hashtable<String, Object>) client.execute(
"filemgr.getNextPage", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (pageHash != null) {
@@ -560,9 +560,9 @@ public class XmlRpcFileManagerClient {
pageHash = (Hashtable<String, Object>) client.execute(
"filemgr.getPrevPage", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (pageHash != null) {
@@ -584,9 +584,9 @@ public class XmlRpcFileManagerClient {
productTypeId = (String) client.execute("filemgr.addProductType",
argList);
} catch (XmlRpcException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
} catch (IOException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
}
return productTypeId;
@@ -603,9 +603,9 @@ public class XmlRpcFileManagerClient {
hasProduct = (Boolean) client.execute("filemgr.hasProduct",
argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return hasProduct;
@@ -622,9 +622,9 @@ public class XmlRpcFileManagerClient {
numProducts = (Integer) client.execute("filemgr.getNumProducts",
argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return numProducts;
@@ -641,9 +641,9 @@ public class XmlRpcFileManagerClient {
topNProducts = (Vector<Hashtable<String, Object>>) client.execute(
"filemgr.getTopNProducts", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return XmlRpcStructFactory
@@ -665,9 +665,9 @@ public class XmlRpcFileManagerClient {
topNProducts = (Vector<Hashtable<String, Object>>) client.execute(
"filemgr.getTopNProducts", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return XmlRpcStructFactory
@@ -684,9 +684,9 @@ public class XmlRpcFileManagerClient {
try {
client.execute("filemgr.setProductTransferStatus", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
}
@@ -700,9 +700,9 @@ public class XmlRpcFileManagerClient {
try {
client.execute("filemgr.addProductReferences", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
}
@@ -716,9 +716,9 @@ public class XmlRpcFileManagerClient {
try {
client.execute("filemgr.addMetadata", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
}
@@ -733,9 +733,9 @@ public class XmlRpcFileManagerClient {
try {
result = (Boolean) client.execute("filemgr.updateMetadata", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return result;
@@ -752,9 +752,9 @@ public class XmlRpcFileManagerClient {
productId = (String) client.execute("filemgr.catalogProduct",
argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
return productId;
@@ -773,9 +773,9 @@ public class XmlRpcFileManagerClient {
metadata = (Hashtable<String, Object>) client.execute(
"filemgr.getMetadata", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
Metadata m = new Metadata();
@@ -799,9 +799,9 @@ public class XmlRpcFileManagerClient {
metadata = (Hashtable<String, Object>) client.execute(
"filemgr.getReducedMetadata", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
Metadata m = new Metadata();
@@ -819,9 +819,9 @@ public class XmlRpcFileManagerClient {
try {
success = (Boolean) client.execute("filemgr.removeFile", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
return success;
@@ -837,9 +837,9 @@ public class XmlRpcFileManagerClient {
try {
return (byte[]) client.execute("filemgr.retrieveFile", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
}
@@ -854,9 +854,9 @@ public class XmlRpcFileManagerClient {
try {
client.execute("filemgr.transferFile", argList);
} catch (XmlRpcException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
} catch (IOException e) {
- throw new DataTransferException(e.getMessage());
+ throw new DataTransferException(e);
}
}
@@ -874,9 +874,9 @@ public class XmlRpcFileManagerClient {
productVector = (Vector<Hashtable<String, Object>>) client.execute(
"filemgr.getProductsByProductType", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (productVector == null) {
@@ -901,9 +901,9 @@ public class XmlRpcFileManagerClient {
elementVector = (Vector<Hashtable<String, Object>>) client.execute(
"filemgr.getElementsByProductType", argList);
} catch (XmlRpcException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} catch (IOException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
}
if (elementVector == null) {
@@ -925,9 +925,9 @@ public class XmlRpcFileManagerClient {
elementHash = (Hashtable<String, Object>) client.execute(
"filemgr.getElementById", argList);
} catch (XmlRpcException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} catch (IOException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
}
if (elementHash == null) {
@@ -949,9 +949,9 @@ public class XmlRpcFileManagerClient {
elementHash = (Hashtable<String, Object>) client.execute(
"filemgr.getElementByName", argList);
} catch (XmlRpcException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} catch (IOException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
}
if (elementHash == null) {
@@ -974,9 +974,9 @@ public class XmlRpcFileManagerClient {
elementHash = (Hashtable<String, Object>) client.execute(
"filemgr.getElementByName", argList);
} catch (XmlRpcException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} catch (IOException e) {
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
}
if (elementHash == null) {
@@ -1000,7 +1000,7 @@ public class XmlRpcFileManagerClient {
.getQueryResultsFromXmlRpc(queryResultHashVector);
} catch (Exception e) {
e.printStackTrace();
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
}
@@ -1022,11 +1022,11 @@ public class XmlRpcFileManagerClient {
"filemgr.query", argList);
} catch (XmlRpcException e) {
e.printStackTrace();
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
e.printStackTrace();
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (productVector == null) {
@@ -1049,7 +1049,7 @@ public class XmlRpcFileManagerClient {
} catch (XmlRpcException e) {
throw new RepositoryManagerException(e.getLocalizedMessage());
} catch (IOException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
}
if (productTypeHash == null) {
@@ -1070,9 +1070,9 @@ public class XmlRpcFileManagerClient {
productTypeHash = (Hashtable<String, Object>) client.execute(
"filemgr.getProductTypeById", argList);
} catch (XmlRpcException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
} catch (IOException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
}
if (productTypeHash == null) {
@@ -1093,9 +1093,9 @@ public class XmlRpcFileManagerClient {
productTypeVector = (Vector<Hashtable<String, Object>>) client
.execute("filemgr.getProductTypes", argList);
} catch (XmlRpcException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
} catch (IOException e) {
- throw new RepositoryManagerException(e.getMessage());
+ throw new RepositoryManagerException(e);
}
if (productTypeVector == null) {
@@ -1120,9 +1120,9 @@ public class XmlRpcFileManagerClient {
productReferenceVector = (Vector<Hashtable<String, Object>>) client
.execute("filemgr.getProductReferences", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (productReferenceVector == null) {
@@ -1144,9 +1144,9 @@ public class XmlRpcFileManagerClient {
productHash = (Hashtable<String, Object>) client.execute(
"filemgr.getProductById", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (productHash == null) {
@@ -1167,9 +1167,9 @@ public class XmlRpcFileManagerClient {
productHash = (Hashtable<String, Object>) client.execute(
"filemgr.getProductByName", argList);
} catch (XmlRpcException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
} catch (IOException e) {
- throw new CatalogException(e.getMessage());
+ throw new CatalogException(e);
}
if (productHash == null) {
@@ -1236,7 +1236,7 @@ public class XmlRpcFileManagerClient {
+ "when adding Product References for Product : "
+ product.getProductName()
+ " to RepositoryManager: Message: "
- + e.getMessage());
+ + e);
throw e;
}
} else {
@@ -1259,14 +1259,14 @@ public class XmlRpcFileManagerClient {
"ingestProduct: RepositoryManagerException "
+ "when updating product transfer status for Product: "
+ product.getProductName()
- + " Message: " + e.getMessage());
+ + " Message: " + e);
throw e;
}
} catch (Exception e) {
LOG.log(Level.SEVERE,
"ingestProduct: DataTransferException when transfering Product: "
+ product.getProductName() + ": Message: "
- + e.getMessage());
+ + e);
throw new DataTransferException(e);
}
@@ -1280,7 +1280,7 @@ public class XmlRpcFileManagerClient {
"ingestProduct: VersioningException when versioning Product: "
+ product.getProductName() + " with Versioner "
+ product.getProductType().getVersioner()
- + ": Message: " + e.getMessage());
+ + ": Message: " + e);
throw new VersioningException(e);
} catch(XmlRpcException e2){
LOG.log(Level.SEVERE, "Failed to ingest product [ name:" +product.getProductName() + "] :" + e2.getMessage() + " -- rolling back ingest");
@@ -1298,7 +1298,7 @@ public class XmlRpcFileManagerClient {
}
catch (Exception e) {
LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + product.getProductId() +
- "/ name:" +product.getProductName() + "] :" + e.getMessage() + " -- rolling back ingest");
+ "/ name:" +product.getProductName() + "] :" + e + " -- rolling back ingest");
try {
Vector<Object> argList = new Vector<Object>();
Hashtable<String, Object> productHash = XmlRpcStructFactory
@@ -1307,10 +1307,10 @@ public class XmlRpcFileManagerClient {
client.execute("filemgr.removeProduct", argList);
} catch (Exception e1) {
LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
- + product + "] : " + e.getMessage());
+ + product + "] : " + e);
}
throw new FileManagerException("Failed to ingest product [" + product + "] : "
- + e.getMessage());
+ + e);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/0c67a330/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java
index 5103d19..189b0af 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java
@@ -122,7 +122,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback addElement transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
@@ -190,7 +190,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback modifyElement transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
@@ -249,7 +249,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback removeElement transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
try {
@@ -315,7 +315,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback addElementToProductType transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
try {
@@ -382,7 +382,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback removeElementFromProductType transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
try {
@@ -441,7 +441,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback addParentToProductType transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
try {
@@ -500,7 +500,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
"Unable to rollback removeParentFromProductType transaction. Message: "
+ e2.getMessage());
}
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (statement != null) {
try {
@@ -563,7 +563,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception reading elements. Message: "
+ e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
@@ -620,7 +620,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
LOG.log(Level.WARNING,
"Exception reading product parent. Message: "
+ e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
try {
@@ -683,7 +683,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception reading elements. Message: "
+ e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
@@ -747,7 +747,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception reading element. Message: "
+ e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
@@ -811,7 +811,7 @@ public class DataSourceValidationLayer implements ValidationLayer {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception reading element. Message: "
+ e.getMessage());
- throw new ValidationLayerException(e.getMessage());
+ throw new ValidationLayerException(e);
} finally {
if (rs != null) {
[4/5] oodt git commit: OODT-909 create improved exceptions
Posted by ma...@apache.org.
OODT-909 create improved exceptions
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/249931a0
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/249931a0
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/249931a0
Branch: refs/heads/master
Commit: 249931a0073a84b9479ca8da0d160c5ef45a9c72
Parents: 11e2857
Author: Tom Barber <to...@analytical-labs.com>
Authored: Tue Oct 27 22:28:56 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Tue Oct 27 22:28:56 2015 +0000
----------------------------------------------------------------------
.../channel/CommunicationChannelClient.java | 89 +++--
.../rmi/RmiCommunicationChannelClient.java | 94 ++---
.../XmlRpcCommunicationChannelClient.java | 390 ++++++++++++++++---
.../XmlRpcCommunicationChannelServer.java | 104 ++---
.../system/impl/CatalogServiceLocal.java | 2 +-
.../oodt/cas/catalog/util/SpringUtils.java | 15 +-
.../catalog/solr/DefaultProductSerializer.java | 2 +-
.../cas/filemgr/tools/ProductTypeDocTool.java | 2 +-
.../java/org/apache/oodt/cas/pge/PGETask.java | 17 +-
.../apache/oodt/cas/pge/PGETaskInstance.java | 156 ++++----
.../cas/pge/config/XmlFilePgeConfigBuilder.java | 46 +--
.../oodt/cas/pge/exceptions/PGEException.java | 16 +
.../cas/pge/staging/FileManagerFileStager.java | 4 +-
.../apache/oodt/cas/pge/staging/FileStager.java | 42 +-
.../cas/pge/util/GenericPgeObjectFactory.java | 13 +-
.../org/apache/oodt/cas/pge/util/XmlHelper.java | 132 +++----
.../cas/pge/writers/CsvConfigFileWriter.java | 21 +-
.../pge/writers/ExternExtractorMetWriter.java | 27 +-
.../pge/writers/FilenameExtractorWriter.java | 10 +-
.../MetadataKeyReplacerTemplateWriter.java | 10 +-
.../oodt/cas/pge/writers/PcsMetFileWriter.java | 25 +-
.../cas/pge/writers/TextConfigFileWriter.java | 18 +-
.../pge/writers/VelocityConfigFileWriter.java | 14 +-
.../metlist/MetadataListPcsMetFileWriter.java | 22 +-
.../system/XmlRpcWorkflowManagerClient.java | 16 +-
.../system/MockXmlRpcWorkflowManagerClient.java | 76 ++--
26 files changed, 814 insertions(+), 549 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
index 1d06251..ec9361f 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
@@ -17,12 +17,8 @@
package org.apache.oodt.cas.catalog.server.channel;
//JDK imports
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogException;
import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
import org.apache.oodt.cas.catalog.page.CatalogReceipt;
import org.apache.oodt.cas.catalog.page.Page;
@@ -37,6 +33,13 @@ import org.apache.oodt.cas.catalog.system.Catalog;
import org.apache.oodt.cas.catalog.util.PluginURL;
import org.apache.oodt.cas.metadata.Metadata;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+//OODT imports
+
/**
* @author bfoster
* @version $Revision$
@@ -47,13 +50,13 @@ import org.apache.oodt.cas.metadata.Metadata;
*/
public interface CommunicationChannelClient {
- void shutdown() throws Exception;
+ void shutdown() throws CatalogException;
- boolean isRestrictQueryPermissions() throws Exception;
+ boolean isRestrictQueryPermissions() throws CatalogException;
// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception;
- boolean isRestrictIngestPermissions() throws Exception;
+ boolean isRestrictIngestPermissions() throws CatalogException;
// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception;
@@ -62,92 +65,92 @@ public interface CommunicationChannelClient {
// public void setTransactionIdClass(Class<? extends TransactionId<?>> transactionIdClass) throws Exception;
//
- void addCatalog(Catalog catalog) throws Exception;
+ void addCatalog(Catalog catalog) throws CatalogException;
- void replaceCatalog(Catalog catalog) throws Exception;
+ void replaceCatalog(Catalog catalog) throws CatalogException;
- void addCatalog(String catalogId, Index index) throws Exception;
+ void addCatalog(String catalogId, Index index) throws CatalogException;
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception;
+ void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException;
void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws Exception;
+ boolean restrictIngestPermission) throws CatalogException;
- void addDictionary(String catalogId, Dictionary dictionary) throws Exception;
+ void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException;
- void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception;
+ void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException;
- void replaceIndex(String catalogId, Index index) throws Exception;
+ void replaceIndex(String catalogId, Index index) throws CatalogException;
- void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception;
+ void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException;
- void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception;
+ void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException;
- void removeCatalog(String catalogUrn) throws Exception;
+ void removeCatalog(String catalogUrn) throws CatalogException;
// public void removeCatalog(String catalogUrn, boolean preserveMapping) throws Exception;
- List<PluginURL> getPluginUrls() throws Exception;
+ List<PluginURL> getPluginUrls() throws CatalogException;
- void addPluginUrls(List<PluginURL> pluginUrls) throws Exception;
+ void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException;
- URL getPluginStorageDir() throws Exception;
+ URL getPluginStorageDir() throws CatalogException;
- void transferUrl(URL fromUrl, URL toUrl) throws Exception;
+ void transferUrl(URL fromUrl, URL toUrl) throws CatalogException;
// public Set<Catalog> getCurrentCatalogList() throws Exception;
//
// public Catalog getCatalog(String catalogUrn) throws Exception;
- Set<String> getCurrentCatalogIds() throws Exception;
+ Set<String> getCurrentCatalogIds() throws CatalogException;
- TransactionReceipt ingest(Metadata metadata) throws Exception;
+ TransactionReceipt ingest(Metadata metadata) throws CatalogException;
- void delete(Metadata metadata) throws Exception;
+ void delete(Metadata metadata) throws CatalogException;
- List<String> getProperty(String key) throws Exception;
+ List<String> getProperty(String key) throws CatalogException;
- Properties getCalalogProperties() throws Exception;
+ Properties getCalalogProperties() throws CatalogException;
- Properties getCalalogProperties(String catalogUrn) throws Exception;
+ Properties getCalalogProperties(String catalogUrn) throws CatalogException;
// public Page getFirstPage(QueryExpression queryExpression) throws Exception;
//
// public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
- Page getNextPage(Page page) throws Exception;
+ Page getNextPage(Page page) throws CatalogException;
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception;
+ Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException;
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
+ Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException;
// public Page getLastPage(QueryExpression queryExpression) throws Exception;
//
// public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
- List<TransactionalMetadata> getMetadata(Page page) throws Exception;
+ List<TransactionalMetadata> getMetadata(Page page) throws CatalogException;
- QueryPager query(QueryExpression queryExpression) throws Exception;
+ QueryPager query(QueryExpression queryExpression) throws CatalogException;
- QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
+ QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException;
// public QueryPager query(QueryExpression queryExpression, boolean sortResults) throws Exception;
- List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws Exception;
+ List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogException;
- List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws Exception;
+ List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws CatalogException;
- List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception;
+ List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException;
- List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws Exception;
+ List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogException;
- List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws Exception;
+ List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogException;
List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
- String catalogUrn) throws Exception;
+ String catalogUrn) throws CatalogException;
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws Exception;
+ TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogException;
- TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws Exception;
+ TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
index 43c1b90..3611cc9 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
@@ -17,14 +17,7 @@
package org.apache.oodt.cas.catalog.server.channel.rmi;
//JDK imports
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogException;
import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
import org.apache.oodt.cas.catalog.page.CatalogReceipt;
import org.apache.oodt.cas.catalog.page.Page;
@@ -40,6 +33,15 @@ import org.apache.oodt.cas.catalog.system.Catalog;
import org.apache.oodt.cas.catalog.util.PluginURL;
import org.apache.oodt.cas.metadata.Metadata;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+//OODT imports
+
/**
*
* @author bfoster
@@ -54,214 +56,214 @@ public class RmiCommunicationChannelClient extends UnicastRemoteObject implement
super();
}
- public void addCatalog(Catalog catalog) throws Exception {
+ public void addCatalog(Catalog catalog) throws CatalogException {
// TODO Auto-generated method stub
}
- public void addCatalog(String catalogId, Index index) throws Exception {
+ public void addCatalog(String catalogId, Index index) throws CatalogException {
// TODO Auto-generated method stub
}
public void addCatalog(String catalogId, Index index,
- List<Dictionary> dictionaries) throws Exception {
+ List<Dictionary> dictionaries) throws CatalogException {
// TODO Auto-generated method stub
}
public void addCatalog(String catalogId, Index index,
List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws Exception {
+ boolean restrictIngestPermission) throws CatalogException {
// TODO Auto-generated method stub
}
public void addDictionary(String catalogId, Dictionary dictionary)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
}
- public void addPluginUrls(List<PluginURL> pluginUrls) throws Exception {
+ public void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException {
// TODO Auto-generated method stub
}
- public void delete(Metadata metadata) throws Exception {
+ public void delete(Metadata metadata) throws CatalogException {
// TODO Auto-generated method stub
}
public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public Properties getCalalogProperties() throws Exception {
+ public Properties getCalalogProperties() throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public Properties getCalalogProperties(String catalogUrn) throws Exception {
+ public Properties getCalalogProperties(String catalogUrn) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public TransactionId<?> getCatalogServiceTransactionId(
TransactionId<?> catalogTransactionId, String catalogUrn)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public TransactionId<?> getCatalogServiceTransactionId(
CatalogReceipt catalogReceipt, boolean generateNew)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public List<TransactionId<?>> getCatalogServiceTransactionIds(
List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public Set<String> getCurrentCatalogIds() throws Exception {
+ public Set<String> getCurrentCatalogIds() throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
+ public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
- List<String> catalogServiceTransactionIdStrings) throws Exception {
+ List<String> catalogServiceTransactionIdStrings) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public List<TransactionalMetadata> getMetadataFromTransactionIds(
List<TransactionId<?>> catalogServiceTransactionIds)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public Page getNextPage(Page page) throws Exception {
+ public Page getNextPage(Page page) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
- throws Exception {
+ throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public Page getPage(PageInfo pageInfo, QueryExpression queryExpression,
- Set<String> catalogIds) throws Exception {
+ Set<String> catalogIds) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public URL getPluginStorageDir() throws Exception {
+ public URL getPluginStorageDir() throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public List<PluginURL> getPluginUrls() throws Exception {
+ public List<PluginURL> getPluginUrls() throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public List<String> getProperty(String key) throws Exception {
+ public List<String> getProperty(String key) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public List<TransactionId<?>> getTransactionIdsForAllPages(
- QueryPager queryPager) throws Exception {
+ QueryPager queryPager) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public TransactionReceipt ingest(Metadata metadata) throws Exception {
+ public TransactionReceipt ingest(Metadata metadata) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public boolean isRestrictIngestPermissions() throws Exception {
+ public boolean isRestrictIngestPermissions() throws CatalogException {
// TODO Auto-generated method stub
return false;
}
- public boolean isRestrictQueryPermissions() throws Exception {
+ public boolean isRestrictQueryPermissions() throws CatalogException {
// TODO Auto-generated method stub
return false;
}
public void modifyIngestPermission(String catalogId,
- boolean restrictIngestPermission) throws Exception {
+ boolean restrictIngestPermission) throws CatalogException {
// TODO Auto-generated method stub
}
public void modifyQueryPermission(String catalogId,
- boolean restrictQueryPermission) throws Exception {
+ boolean restrictQueryPermission) throws CatalogException {
// TODO Auto-generated method stub
}
- public QueryPager query(QueryExpression queryExpression) throws Exception {
+ public QueryPager query(QueryExpression queryExpression) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
public QueryPager query(QueryExpression queryExpression,
- Set<String> catalogIds) throws Exception {
+ Set<String> catalogIds) throws CatalogException {
// TODO Auto-generated method stub
return null;
}
- public void removeCatalog(String catalogUrn) throws Exception {
+ public void removeCatalog(String catalogUrn) throws CatalogException {
// TODO Auto-generated method stub
}
- public void replaceCatalog(Catalog catalog) throws Exception {
+ public void replaceCatalog(Catalog catalog) throws CatalogException {
// TODO Auto-generated method stub
}
public void replaceDictionaries(String catalogId,
- List<Dictionary> dictionaries) throws Exception {
+ List<Dictionary> dictionaries) throws CatalogException {
// TODO Auto-generated method stub
}
- public void replaceIndex(String catalogId, Index index) throws Exception {
+ public void replaceIndex(String catalogId, Index index) throws CatalogException {
// TODO Auto-generated method stub
}
- public void shutdown() throws Exception {
+ public void shutdown() throws CatalogException {
// TODO Auto-generated method stub
}
- public void transferUrl(URL fromUrl, URL toUrl) throws Exception {
+ public void transferUrl(URL fromUrl, URL toUrl) throws CatalogException {
// TODO Auto-generated method stub
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
index 0e2f26a..e5c8890 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
@@ -16,6 +16,7 @@
*/
package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
+import org.apache.oodt.cas.catalog.exception.CatalogException;
import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
import org.apache.oodt.cas.catalog.page.CatalogReceipt;
import org.apache.oodt.cas.catalog.page.Page;
@@ -32,9 +33,12 @@ import org.apache.oodt.cas.catalog.util.PluginURL;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.xmlrpc.CommonsXmlRpcTransportFactory;
import org.apache.xmlrpc.XmlRpcClient;
+import org.apache.xmlrpc.XmlRpcException;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.Properties;
@@ -63,100 +67,184 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann
this.chunkSize = chunkSize;
}
- public void shutdown() throws Exception {
+ public void shutdown() throws CatalogException {
Vector<Object> args = new Vector<Object>();
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_shutdown", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e);
+ }
}
- public void addCatalog(Catalog catalog) throws Exception {
+ public void addCatalog(Catalog catalog) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalog));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ }
}
- public void replaceCatalog(Catalog catalog) throws Exception {
+ public void replaceCatalog(Catalog catalog) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalog));
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args);
+ try {
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e);
+ }
}
- public void addCatalog(String catalogId, Index index) throws Exception {
+ public void addCatalog(String catalogId, Index index) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(index));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ }
}
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception {
+ public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(index));
args.add(this.serializer.serializeObject(dictionaries));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ }
}
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws Exception {
+ public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(index));
args.add(this.serializer.serializeObject(dictionaries));
args.add(restrictQueryPermission);
args.add(restrictIngestPermission);
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
+ }
}
- public void addDictionary(String catalogId, Dictionary dictionary) throws Exception {
+ public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(dictionary));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Dictionary: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Dictionary: "+ e.getMessage(), e);
+ }
}
- public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception {
+ public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(dictionaries));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e);
+ }
}
- public void replaceIndex(String catalogId, Index index) throws Exception {
+ public void replaceIndex(String catalogId, Index index) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(index));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceIndex", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e);
+ }
}
- public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception {
+ public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(restrictIngestPermission));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyIngestPermission", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e);
+ }
}
- public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception {
+ public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogId);
args.add(this.serializer.serializeObject(restrictQueryPermission));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyQueryPermission", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e);
+ }
}
- public List<PluginURL> getPluginUrls() throws Exception {
+ public List<PluginURL> getPluginUrls() throws CatalogException {
Vector<Object> args = new Vector<Object>();
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginUrls", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e);
+ }
}
- public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception {
+ public void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(pluginURLs));
+ try {
this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addPluginUrls", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e);
+ }
}
- public URL getPluginStorageDir() throws Exception {
+ public URL getPluginStorageDir() throws CatalogException {
Vector<Object> args = new Vector<Object>();
- return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args));
+ try {
+ return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e);
+ }
}
- public void transferUrl(URL fromUrl, URL toURL) throws Exception {
+ public void transferUrl(URL fromUrl, URL toURL) throws CatalogException {
System.out.println("Transfering '" + fromUrl + "' to '" + toURL + "'");
FileInputStream is = null;
try {
@@ -166,7 +254,11 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann
int numBytes;
while ((numBytes = is.read(buf, offset, chunkSize)) != -1)
this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes);
- } finally {
+ } catch (FileNotFoundException e) {
+ throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e);
+ } finally {
try {
is.close();
}catch(Exception ignored) {}
@@ -174,226 +266,400 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann
}
protected void transferFile(String filePath, byte[] fileData, int offset,
- int numBytes) throws Exception {
+ int numBytes) throws CatalogException {
Vector<Object> argList = new Vector<Object>();
argList.add(filePath);
argList.add(fileData);
argList.add(offset);
argList.add(numBytes);
- client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList);
- }
+ try {
+ client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e);
+ }
+ }
- public void delete(Metadata metadata) throws Exception {
+ public void delete(Metadata metadata) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(metadata));
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args);
+ try {
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Delete Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Delete Failed: "+ e.getMessage(), e);
+ }
}
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception {
+ public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryPager));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getAllPages", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e);
+ }
}
- public Properties getCalalogProperties() throws Exception {
+ public Properties getCalalogProperties() throws CatalogException {
+ try {
return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", new Vector<Object>()));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
+ }
}
public Properties getCalalogProperties(String catalogUrn)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogUrn);
+ try {
return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
+ }
}
-// public Catalog getCatalog(String catalogUrn) throws Exception {
+// public Catalog getCatalog(String catalogUrn) throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(catalogUrn);
// return this.serializer.deserializeObject(Catalog.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalog", args));
// }
// public CatalogRepository getCatalogRepository()
-// throws Exception {
+// throws CatalogException {
// return this.serializer.deserializeObject(CatalogRepository.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogRepository", new Vector<Object>()));
// }
public TransactionId<?> getCatalogServiceTransactionId(
TransactionId<?> catalogTransactionId, String catalogUrn)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalogTransactionId));
args.add(catalogUrn);
+ try {
return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e);
+ }
}
public TransactionId<?> getCatalogServiceTransactionId(
CatalogReceipt catalogReceipt,
- boolean generateNew) throws Exception {
+ boolean generateNew) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalogReceipt));
args.add(this.serializer.serializeObject(generateNew));
+ try {
return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId2", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e);
+ }
}
public List<TransactionId<?>> getCatalogServiceTransactionIds(
List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalogTransactionIds));
args.add(catalogUrn);
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e);
+ }
}
- public Set<String> getCurrentCatalogIds() throws Exception {
+ public Set<String> getCurrentCatalogIds() throws CatalogException {
+ try {
return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogIds", new Vector<Object>()));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Curent Catalog Ids Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Current Catalog Ids Failed: "+ e.getMessage(), e);
+ }
}
-// public Set<Catalog> getCurrentCatalogList() throws Exception {
+// public Set<Catalog> getCurrentCatalogList() throws CatalogException {
// return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogList", new Vector<Object>()));
// }
//
-// public IngestMapper getIngestMapper() throws Exception {
+// public IngestMapper getIngestMapper() throws CatalogException {
// return this.serializer.deserializeObject(IngestMapper.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getIngestMapper", new Vector<Object>()));
// }
public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
List<String> catalogServiceTransactionIdStrings)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalogServiceTransactionIdStrings));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIdStrings", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Metadata From Transaction Id Strings Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Metadata From Transaction Id String Failed: "+ e.getMessage(), e);
+ }
}
public List<TransactionalMetadata> getMetadataFromTransactionIds(
List<TransactionId<?>> catalogServiceTransactionIds)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(catalogServiceTransactionIds));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIds", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e);
+ }
}
public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryPager));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
+ }
}
- public List<String> getProperty(String key) throws Exception {
+ public List<String> getProperty(String key) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(key);
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getProperty", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Property Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Property Failed: "+ e.getMessage(), e);
+ }
}
- public Class<? extends TransactionId<?>> getTransactionIdClass() throws Exception {
+ public Class<? extends TransactionId<?>> getTransactionIdClass() throws CatalogException {
+ try {
return this.serializer.deserializeObject(Class.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdClass", new Vector<Object>()));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Transaction Id Class Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Transaction Id Calss Failed: "+ e.getMessage(), e);
+ }
}
public List<TransactionId<?>> getTransactionIdsForAllPages(
- QueryPager queryPager) throws Exception {
+ QueryPager queryPager) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryPager));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdsForAllPages", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e);
+ }
}
public TransactionReceipt ingest(Metadata metadata)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(metadata));
+ try {
return this.serializer.deserializeObject(TransactionReceipt.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_ingest", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Ingest Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Ingest Failed: "+ e.getMessage(), e);
+ }
}
- public boolean isRestrictIngestPermissions() throws Exception {
+ public boolean isRestrictIngestPermissions() throws CatalogException {
+ try {
return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictIngestPermissions", new Vector<Object>()));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e);
+ }
}
- public boolean isRestrictQueryPermissions() throws Exception {
+ public boolean isRestrictQueryPermissions() throws CatalogException {
+ try {
return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictQueryPermissions", new Vector<Object>()));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e);
+ }
}
- public Page getFirstPage(QueryExpression queryExpression) throws Exception {
+ public Page getFirstPage(QueryExpression queryExpression) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
+ public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
args.add(this.serializer.serializeObject(catalogIds));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getNextPage(Page page) throws Exception {
+ public Page getNextPage(Page page) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(page));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage2", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception {
+ public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(pageInfo));
args.add(this.serializer.serializeObject(queryExpression));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
+ public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(pageInfo));
args.add(this.serializer.serializeObject(queryExpression));
args.add(this.serializer.serializeObject(catalogIds));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getLastPage(QueryExpression queryExpression) throws Exception {
+ public Page getLastPage(QueryExpression queryExpression) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
+ }
}
- public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
+ public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
args.add(this.serializer.serializeObject(catalogIds));
+ try {
return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
+ }
}
- public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
+ public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(page));
+ try {
return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadata", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e);
+ }
}
public QueryPager query(QueryExpression queryExpression)
- throws Exception {
+ throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
+ try {
return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Query Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Query Failed: "+ e.getMessage(), e);
+ }
}
- public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
+ public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(this.serializer.serializeObject(queryExpression));
args.add(this.serializer.serializeObject(catalogIds));
+ try {
return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Query Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Query Failed: "+ e.getMessage(), e);
+ }
}
// public QueryPager query(QueryExpression queryExpression, boolean sortResults)
-// throws Exception {
+// throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(queryExpression));
// args.add(this.serializer.serializeObject(new Boolean(sortResults)));
// return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
// }
- public void removeCatalog(String catalogUrn) throws Exception {
+ public void removeCatalog(String catalogUrn) throws CatalogException {
Vector<Object> args = new Vector<Object>();
args.add(catalogUrn);
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args);
+ try {
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args);
+ } catch (XmlRpcException e) {
+ throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e);
+ }
}
// public void removeCatalog(String catalogUrn, boolean preserveMapping)
-// throws Exception {
+// throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(catalogUrn);
// args.add(this.serializer.serializeObject(new Boolean(preserveMapping)));
@@ -401,32 +667,32 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann
// }
// public void setCatalogRepository(CatalogRepository catalogRepository)
-// throws Exception {
+// throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(catalogRepository));
// this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setCatalogRepository", args);
// }
-// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception {
+// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(new Boolean(restrictIngestPermissions)));
// this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setHasIngestPermissions", args);
// }
-// public void setIngestMapper(IngestMapper ingestMapper) throws Exception {
+// public void setIngestMapper(IngestMapper ingestMapper) throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(ingestMapper));
// this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setIngestMapper", args);
// }
-// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception {
+// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(new Boolean(restrictQueryPermissions)));
// this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setRestrictQueryPermissions", args);
// }
// public void setTransactionIdClass(
-// Class<? extends TransactionId<?>> transactionIdClass) throws Exception {
+// Class<? extends TransactionId<?>> transactionIdClass) throws CatalogException {
// Vector<Object> args = new Vector<Object>();
// args.add(this.serializer.serializeObject(transactionIdClass));
// this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setTransactionIdClass", args);
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
index 7d5248d..4655bf4 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
@@ -17,6 +17,8 @@
package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
//JDK imports
+
+import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
import org.apache.oodt.cas.catalog.page.CatalogReceipt;
import org.apache.oodt.cas.catalog.page.Page;
import org.apache.oodt.cas.catalog.page.PageInfo;
@@ -32,6 +34,7 @@ import org.apache.xmlrpc.WebServer;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.List;
import java.util.Set;
@@ -59,82 +62,83 @@ public class XmlRpcCommunicationChannelServer extends
this.webServer.start();
}
- public boolean xmlrpc_shutdown() throws Exception {
+ public boolean xmlrpc_shutdown() throws CatalogServiceException {
this.shutdown();
this.webServer.shutdown();
this.webServer = null;
return true;
}
- public boolean xmlrpc_addCatalog(String catalogObject) throws Exception {
+ public boolean xmlrpc_addCatalog(String catalogObject) throws CatalogServiceException {
this.addCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
return true;
}
- public boolean xmlrpc_replaceCatalog(String catalogObject) throws Exception {
+ public boolean xmlrpc_replaceCatalog(String catalogObject) throws CatalogServiceException {
this.replaceCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
return true;
}
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws Exception {
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws CatalogServiceException {
this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
return true;
}
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws Exception {
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws CatalogServiceException {
this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject));
return true;
}
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws Exception {
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws CatalogServiceException {
this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject), this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject), this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
return true;
}
- public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws Exception {
+ public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws CatalogServiceException {
this.addDictionary(catalogId, this.serializer.deserializeObject(Dictionary.class, dictionaryObject));
return true;
}
- public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws Exception {
+ public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws CatalogServiceException {
this.replaceDictionaries(catalogId, this.serializer.deserializeObject(List.class, dictionariesObject));
return true;
}
- public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws Exception {
+ public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws CatalogServiceException {
this.replaceIndex(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
return true;
}
- public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws Exception {
+ public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws CatalogServiceException {
this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
return true;
}
- public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws Exception {
+ public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws CatalogServiceException {
this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject));
return true;
}
- public boolean xmlrpc_delete(String metadataObject) throws Exception {
+ public boolean xmlrpc_delete(String metadataObject) throws CatalogServiceException {
this.delete(this.serializer.deserializeObject(Metadata.class, metadataObject));
return true;
}
- public String xmlrpc_getPluginUrls() throws Exception {
+ public String xmlrpc_getPluginUrls() throws CatalogServiceException {
return this.serializer.serializeObject(this.getPluginUrls());
}
- public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws Exception {
+ public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws CatalogServiceException {
this.addPluginUrls(this.serializer.deserializeObject(List.class, pluginUrlsObject));
return true;
}
- public String xmlrpc_getPluginStorageDir() throws Exception {
+ public String xmlrpc_getPluginStorageDir() throws CatalogServiceException {
return this.serializer.serializeObject(this.getPluginStorageDir());
}
- public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes) throws Exception {
+ public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes)
+ throws CatalogServiceException, IOException {
FileOutputStream fOut = null;
try {
File outFile = new File(filePath);
@@ -152,158 +156,158 @@ public class XmlRpcCommunicationChannelServer extends
return true;
}
- public String xmlrpc_getAllPages(String queryPagerObject) throws Exception {
+ public String xmlrpc_getAllPages(String queryPagerObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
}
- public String xmlrpc_getCalalogProperties() throws Exception {
+ public String xmlrpc_getCalalogProperties() throws CatalogServiceException {
return this.serializer.serializeObject(this.getCalalogProperties());
}
public String xmlrpc_getCalalogProperties(String catalogUrn)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getCalalogProperties(catalogUrn));
}
-// public String xmlrpc_getCatalog(String catalogUrn) throws Exception {
+// public String xmlrpc_getCatalog(String catalogUrn) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getCatalog(catalogUrn));
// }
public String xmlrpc_getCatalogServiceTransactionId(
String catalogTransactionIdObject, String catalogUrn)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(TransactionId.class, catalogTransactionIdObject), catalogUrn));
}
public String xmlrpc_getCatalogServiceTransactionId2(
String catalogReceiptObject,
- String generateNewObject) throws Exception {
+ String generateNewObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(CatalogReceipt.class, catalogReceiptObject), this.serializer.deserializeObject(Boolean.class, generateNewObject)));
}
public String xmlrpc_getCatalogServiceTransactionIds(
String catalogTransactionIdsObject, String catalogUrn)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getCatalogServiceTransactionIds(this.serializer.deserializeObject(List.class, catalogTransactionIdsObject), catalogUrn));
}
- public String xmlrpc_getCurrentCatalogIds() throws Exception {
+ public String xmlrpc_getCurrentCatalogIds() throws CatalogServiceException {
return this.serializer.serializeObject(this.getCurrentCatalogIds());
}
-// public String xmlrpc_getCurrentCatalogList() throws Exception {
+// public String xmlrpc_getCurrentCatalogList() throws CatalogServiceException {
// return this.serializer.serializeObject(this.getCurrentCatalogList());
// }
public String xmlrpc_getMetadataFromTransactionIdStrings(
String catalogServiceTransactionIdStringsObject)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getMetadataFromTransactionIdStrings(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdStringsObject)));
}
public String xmlrpc_getMetadataFromTransactionIds(
String catalogServiceTransactionIdsObject)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getMetadataFromTransactionIds(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdsObject)));
}
public String xmlrpc_getNextPage(String queryPagerObject)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
}
- public String xmlrpc_getProperty(String key) throws Exception {
+ public String xmlrpc_getProperty(String key) throws CatalogServiceException {
return this.serializer.serializeObject(this.getProperty(key));
}
//
-// public String xmlrpc_getTransactionIdClass() throws Exception {
+// public String xmlrpc_getTransactionIdClass() throws CatalogServiceException {
// return this.serializer.serializeObject(this.getTransactionIdClass());
// }
// public String xmlrpc_getTransactionIdsForAllPages(
-// String queryPagerObject) throws Exception {
+// String queryPagerObject) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getTransactionIdsForAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
// }
public String xmlrpc_ingest(String metadataObject)
- throws Exception {
+ throws CatalogServiceException {
return this.serializer.serializeObject(this.ingest(this.serializer.deserializeObject(Metadata.class, metadataObject)));
}
- public String xmlrpc_isRestrictIngestPermissions() throws Exception {
+ public String xmlrpc_isRestrictIngestPermissions() throws CatalogServiceException {
return this.serializer.serializeObject(this.isRestrictIngestPermissions());
}
- public String xmlrpc_isRestrictQueryPermissions() throws Exception {
+ public String xmlrpc_isRestrictQueryPermissions() throws CatalogServiceException {
return this.serializer.serializeObject(this.isRestrictQueryPermissions());
}
- public String xmlrpc_query(String queryExpressionObject) throws Exception {
+ public String xmlrpc_query(String queryExpressionObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
}
- public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws Exception {
+ public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
}
-// public String xmlrpc_getFirstPage(String queryExpressionObject) throws Exception {
+// public String xmlrpc_getFirstPage(String queryExpressionObject) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
// }
//
-// public String xmlrpc_getFirstPage(String queryExpressionObject, String catalogIdsObject) throws Exception {
+// public String xmlrpc_getFirstPage(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
// }
- public String xmlrpc_getNextPage2(String pageObject) throws Exception {
+ public String xmlrpc_getNextPage2(String pageObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(Page.class, pageObject)));
}
- public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws Exception {
+ public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
}
- public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws Exception {
+ public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
}
-// public String xmlrpc_getLastPage(String queryExpressionObject) throws Exception {
+// public String xmlrpc_getLastPage(String queryExpressionObject) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
// }
//
-// public String xmlrpc_getLastPage(String queryExpressionObject, String catalogIdsObject) throws Exception {
+// public String xmlrpc_getLastPage(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
// return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
// }
- public String xmlrpc_getMetadata(String pageObject) throws Exception {
+ public String xmlrpc_getMetadata(String pageObject) throws CatalogServiceException {
return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(Page.class, pageObject)));
}
-// public String xmlrpc_query(String queryExpressionObject, String sortResultsObject) throws Exception {
+// public String xmlrpc_query(String queryExpressionObject, String sortResultsObject) throws CatalogServiceException {
// System.out.println(this.getClass().getClassLoader());
// return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Boolean.class, sortResultsObject)));
// }
- public boolean xmlrpc_removeCatalog(String catalogUrn) throws Exception {
+ public boolean xmlrpc_removeCatalog(String catalogUrn) throws CatalogServiceException {
this.removeCatalog(catalogUrn);
return true;
}
//
-// public boolean xmlrpc_removeCatalog(String catalogUrn, String preserveMappingObject) throws Exception {
+// public boolean xmlrpc_removeCatalog(String catalogUrn, String preserveMappingObject) throws CatalogServiceException {
// this.removeCatalog(catalogUrn, this.serializer.deserializeObject(Boolean.class, preserveMappingObject));
// return true;
// }
//
-// public boolean xmlrpc_setHasIngestPermissions(String restrictIngestPermissionsObject) throws Exception {
+// public boolean xmlrpc_setHasIngestPermissions(String restrictIngestPermissionsObject) throws CatalogServiceException {
// this.setHasIngestPermissions(this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionsObject));
// return true;
// }
//
-// public boolean xmlrpc_setRestrictQueryPermissions(String restrictQueryPermissionsObject) throws Exception {
+// public boolean xmlrpc_setRestrictQueryPermissions(String restrictQueryPermissionsObject) throws CatalogServiceException {
// this.setRestrictQueryPermissions(this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionsObject));
// return true;
// }
-// public boolean setTransactionIdClass(String transactionIdClassObject) throws Exception {
+// public boolean setTransactionIdClass(String transactionIdClassObject) throws CatalogServiceException {
// this.setTransactionIdClass(this.serializer.deserializeObject(Class.class, transactionIdClassObject));
// return true;
// }
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
index 9346255..07b816b 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
@@ -953,7 +953,7 @@ public class CatalogServiceLocal implements CatalogService {
}
// check if transaction id was specified by user, otherwise generate a new one
- protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws Exception {
+ protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws CatalogServiceException {
return this.getCatalogServiceTransactionId(metadata, true);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
index f9bbd55..f2d629d 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
@@ -16,17 +16,15 @@
*/
package org.apache.oodt.cas.catalog.util;
-//JDK imports
+import org.apache.oodt.cas.catalog.exception.CatalogException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
import java.util.HashSet;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-//OODT imports
-import org.apache.oodt.cas.catalog.system.Catalog;
-
-//Spring imports
-import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* @author bfoster
@@ -37,7 +35,7 @@ public class SpringUtils {
private static Logger LOG = Logger.getLogger(SpringUtils.class.getName());
- public static HashSet<Catalog> loadCatalogs(String catalogBeanRepo) throws Exception {
+ public static HashSet<Catalog> loadCatalogs(String catalogBeanRepo) throws CatalogException {
FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(catalogBeanRepo);
Map<String, Catalog> catalogsMap = appContext.getBeansOfType(Catalog.class);
HashSet<Catalog> catalogs = new HashSet<Catalog>();
@@ -45,7 +43,8 @@ public class SpringUtils {
Catalog curCatalog = catalogsMap.get(key);
LOG.log(Level.INFO, "Loading catalog configuration for Catalog: '" + curCatalog + "'");
if (catalogs.contains(curCatalog))
- throw new Exception("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. **NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>");
+ throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. "
+ + "**NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>");
catalogs.add(curCatalog);
}
return catalogs;
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
index a6b4eef..0b489be 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
@@ -478,7 +478,7 @@ public class DefaultProductSerializer implements ProductSerializer {
private Document parseXml(String xml) throws IOException, SAXException, ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factoriy.newDocumentBuilder();
+ DocumentBuilder parser = factory.newDocumentBuilder();
return parser.parse( new InputSource(new StringReader(xml)) );
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
index 2411f50..c8c8595 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
@@ -40,7 +40,7 @@ import org.apache.commons.io.FileUtils;
* <p>
* A tool to output HTML documentation for {@link ProductType} policy xml files.
* </p>.
- */o
+ */
public final class ProductTypeDocTool {
private String xslFilePath;
http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
index eb8242d..906b0e5 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
@@ -16,18 +16,17 @@
*/
package org.apache.oodt.cas.pge;
-//JDK static imports
-import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createPGETaskInstance;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.SerializableMetadata;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
-//JDK imports
import java.io.File;
+import java.io.IOException;
import java.util.logging.Logger;
-//OODT imports
-import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
-import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.SerializableMetadata;
+import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createPGETaskInstance;
+
/**
* Runs a {@link PGETaskInstance} given {@link Metadata} and a
@@ -57,7 +56,7 @@ public class PGETask {
pgeTaskInst.run(this.metadata, this.wftConfig);
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws InstantiationException, IOException, WorkflowTaskInstanceException {
String metadataFilePath = null, configPropertiesPath = null;
String pgeTaskInstanceClasspath = null;
String usage = "PGETask --instanceClass <PGETaskInstance> "