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:03 UTC
[3/5] oodt git commit: OODT-909 create improved exceptions
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());