OODT-890 clean up a few exceptions to make them relevant
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/4ed2a423 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/4ed2a423 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/4ed2a423 Branch: refs/heads/master Commit: 4ed2a4236efa5aae46a2d12c4a3264223384f6a9 Parents: fae02f9 Author: Tom Barber <[email protected]> Authored: Mon Oct 26 23:57:15 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Mon Oct 26 23:57:15 2015 +0000 ---------------------------------------------------------------------- .../catalog/mapping/InMemoryIngestMapper.java | 3 +- .../server/CatalogServiceCommandLineClient.java | 4 +- .../server/CatalogServiceServerLauncher.java | 4 +- .../AbstractCommunicationChannelServer.java | 234 ++++++++++--------- .../cli/action/DeleteProductByIdCliAction.java | 14 +- .../cli/action/GetProductByIdCliAction.java | 8 +- .../cli/action/GetProductByNameCliAction.java | 8 +- .../cli/action/LuceneQueryCliAction.java | 23 +- .../filemgr/cli/action/SqlQueryCliAction.java | 4 +- .../resource/queuerepo/XmlQueueRepository.java | 2 +- .../engine/processor/WorkflowProcessor.java | 2 +- 11 files changed, 164 insertions(+), 142 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java index dc04816..92daa04 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java @@ -21,6 +21,7 @@ import org.apache.oodt.commons.database.SqlScript; //JDK imports import java.io.File; +import java.io.IOException; /** * @author bfoster @@ -30,7 +31,7 @@ import java.io.File; public class InMemoryIngestMapper extends DataSourceIngestMapper { public InMemoryIngestMapper(String user, String pass, String driver, - String jdbcUrl, String tablesFile) throws Exception { + String jdbcUrl, String tablesFile) throws IOException { super(user, pass, driver, jdbcUrl); SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.dataSource); coreSchemaScript.loadScript(); http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java index 89135ed..df5b72b 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java @@ -18,6 +18,8 @@ package org.apache.oodt.cas.catalog.server; //JDK imports import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; //OODT imports import org.apache.oodt.cas.cli.CmdLineUtility; @@ -29,7 +31,7 @@ import org.apache.oodt.cas.cli.CmdLineUtility; */ public class CatalogServiceCommandLineClient { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { // Load Catalog Service properties. String propertiesFile = System .getProperty("org.apache.oodt.cas.catalog.properties.file"); http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java index 163bdca..20700f5 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java @@ -18,6 +18,8 @@ package org.apache.oodt.cas.catalog.server; //JDK imports import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; //OODT imports import org.apache.oodt.cas.cli.CmdLineUtility; @@ -34,7 +36,7 @@ public class CatalogServiceServerLauncher { private CatalogServiceServerLauncher() {} - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { // Load Catalog Service properties. String propertiesFile = System .getProperty("org.apache.oodt.cas.catalog.properties.file"); http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java index 3549d86..252ca96 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java @@ -17,14 +17,7 @@ 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; -import java.util.logging.Level; -import java.util.logging.Logger; - -//OODT imports +import org.apache.oodt.cas.catalog.exception.CatalogServiceException; import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; import org.apache.oodt.cas.catalog.page.CatalogReceipt; import org.apache.oodt.cas.catalog.page.Page; @@ -41,6 +34,15 @@ import org.apache.oodt.cas.catalog.util.PluginURL; import org.apache.oodt.cas.catalog.util.Serializer; import org.apache.oodt.cas.metadata.Metadata; +import java.net.URL; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports + /** * @author bfoster * @version $Revision$ @@ -73,23 +75,23 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio return this.port; } - public void shutdown() throws Exception { + public void shutdown() throws CatalogServiceException { try { this.catalogService.shutdown(); this.catalogService = null; System.gc(); // used to speed up shutdown process (gives java a boost-start at cleaning up everything so server will die) - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed to shutdown server : " + e.getMessage(), e); - throw new Exception("Failed to shutdown server : " + e.getMessage(), e); + throw e; } } - public boolean isRestrictQueryPermissions() throws Exception { + public boolean isRestrictQueryPermissions() throws CatalogServiceException { try { return this.catalogService.isRestrictQueryPermissions(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while checking server query permissions : " + e.getMessage(), e); - throw new Exception("Failed while checking server query permissions : " + e.getMessage(), e); + throw e; } } // @@ -97,12 +99,12 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // this.catalogService.setRestrictQueryPermissions(restrictQueryPermissions); // } // - public boolean isRestrictIngestPermissions() throws Exception { + public boolean isRestrictIngestPermissions() throws CatalogServiceException { try { return this.catalogService.isRestrictIngestPermissions(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while checking server ingest permissions : " + e.getMessage(), e); - throw new Exception("Failed while checking server ingest permissions : " + e.getMessage(), e); + throw e; } } // @@ -118,102 +120,102 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // this.catalogService.setTransactionIdClass(transactionIdClass); // } // - public void addCatalog(Catalog catalog) throws Exception { + public void addCatalog(Catalog catalog) throws CatalogServiceException { try { this.catalogService.addCatalog(catalog); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalog + "' to server : " + e.getMessage(), e); - throw new Exception("Failed while adding catalog '" + catalog + "' to server : " + e.getMessage(), e); + throw e; } } - public void replaceCatalog(Catalog catalog) throws Exception { + public void replaceCatalog(Catalog catalog) throws CatalogServiceException { try { this.catalogService.replaceCatalog(catalog); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while replacing catalog '" + catalog + "' to server : " + e.getMessage(), e); - throw new Exception("Failed while replacing catalog '" + catalog + "' to server : " + e.getMessage(), e); + throw e; } } - public void addCatalog(String catalogId, Index index) throws Exception { + public void addCatalog(String catalogId, Index index) throws CatalogServiceException { try { this.catalogService.addCatalog(catalogId, index); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' to server : " + e.getMessage(), e); - throw new Exception("Failed while adding catalog '" + catalogId + "' with index '" + index + "' to server : " + e.getMessage(), e); + throw e; } } - public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception { + public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException { try { this.catalogService.addCatalog(catalogId, index, dictionaries); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' to server : " + e.getMessage(), e); - throw new Exception("Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' to server : " + e.getMessage(), e); + throw 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 CatalogServiceException { try { this.catalogService.addCatalog(catalogId, index, dictionaries, restrictQueryPermission, restrictIngestPermission); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' and restrictQueryPermission '" + restrictQueryPermission + "' and restrictIngestPermission '" + restrictIngestPermission + "' to server : " + e.getMessage(), e); - throw new Exception("Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' and restrictQueryPermission '" + restrictQueryPermission + "' and restrictIngestPermission '" + restrictIngestPermission + "' to server : " + e.getMessage(), e); + throw e; } } - public void addDictionary(String catalogId, Dictionary dictionary) throws Exception { + public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogServiceException { try { this.catalogService.addDictionary(catalogId, dictionary); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding dictionary '" + dictionary + "' to catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while adding dictionary '" + dictionary + "' to catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } - public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception { + public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException { try { this.catalogService.replaceDictionaries(catalogId, dictionaries); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while replacing dictionaries '" + dictionaries + "' in catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while replacing dictionaries '" + dictionaries + "' in catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } - public void replaceIndex(String catalogId, Index index) throws Exception { + public void replaceIndex(String catalogId, Index index) throws CatalogServiceException { try { this.catalogService.replaceIndex(catalogId, index); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while replacing index '" + index + "' in catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while replacing index '" + index + "' in catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } - public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception { + public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogServiceException { try { this.catalogService.modifyIngestPermission(catalogId, restrictIngestPermission); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while changing ingest permissions for catalog '" + catalogId + "' to '" + restrictIngestPermission + "' : " + e.getMessage(), e); - throw new Exception("Failed while changing ingest permissions for catalog '" + catalogId + "' to '" + restrictIngestPermission + "' : " + e.getMessage(), e); + throw e; } } - public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception { + public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogServiceException { try { this.catalogService.modifyQueryPermission(catalogId, restrictQueryPermission); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while changing query permissions for catalog '" + catalogId + "' to '" + restrictQueryPermission + "' : " + e.getMessage(), e); - throw new Exception("Failed while changing query permissions for catalog '" + catalogId + "' to '" + restrictQueryPermission + "' : " + e.getMessage(), e); + throw e; } } - public void removeCatalog(String catalogId) throws Exception { + public void removeCatalog(String catalogId) throws CatalogServiceException { try { this.catalogService.removeCatalog(catalogId); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while removing catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while removing catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } @@ -221,31 +223,31 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // this.catalogService.removeCatalog(catalogUrn, preserveMapping); // } - public List<PluginURL> getPluginUrls() throws Exception { + public List<PluginURL> getPluginUrls() throws CatalogServiceException { try { return this.catalogService.getPluginUrls(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting plugin URLs : " + e.getMessage(), e); - throw new Exception("Failed while getting plugin URLs : " + e.getMessage(), e); + throw e; } } - public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception { + public void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogServiceException { try { this.catalogService.addPluginUrls(pluginURLs); this.serializer.refreshClassLoader(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while adding plugin URLs '" + pluginURLs + "' : " + e.getMessage(), e); - throw new Exception("Failed while adding plugin URLs '" + pluginURLs + "' : " + e.getMessage(), e); + throw e; } } - public URL getPluginStorageDir() throws Exception { + public URL getPluginStorageDir() throws CatalogServiceException { try { return this.catalogService.getPluginStorageDir(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting plugin storage directory : " + e.getMessage(), e); - throw new Exception("Failed while getting plugin storage directory : " + e.getMessage(), e); + throw e; } } @@ -257,57 +259,57 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // return this.catalogService.getCatalog(catalogUrn); // } - public Set<String> getCurrentCatalogIds() throws Exception { + public Set<String> getCurrentCatalogIds() throws CatalogServiceException { try { return this.catalogService.getCurrentCatalogIds(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting current catalog ids : " + e.getMessage(), e); - throw new Exception("Failed while getting current catalog ids : " + e.getMessage(), e); + throw e; } } - public TransactionReceipt ingest(Metadata metadata) throws Exception { + public TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException { try { return this.catalogService.ingest(metadata); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while performing ingest : " + e.getMessage(), e); - throw new Exception("Failed while performing ingest : " + e.getMessage(), e); + throw e; } } - public void delete(Metadata metadata) throws Exception { + public void delete(Metadata metadata) throws CatalogServiceException { try { this.catalogService.delete(metadata); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while performing deletion : " + e.getMessage(), e); - throw new Exception("Failed while performing deletion : " + e.getMessage(), e); + throw e; } } - public List<String> getProperty(String key) throws Exception { + public List<String> getProperty(String key) throws CatalogServiceException { try { return this.catalogService.getProperty(key); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting property '" + key + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting property '" + key + "' : " + e.getMessage(), e); + throw e; } } - public Properties getCalalogProperties() throws Exception { + public Properties getCalalogProperties() throws CatalogServiceException { try { return this.catalogService.getCalalogProperties(); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting catalog properties : " + e.getMessage(), e); - throw new Exception("Failed while getting catalog properties : " + e.getMessage(), e); + throw e; } } - public Properties getCalalogProperties(String catalogId) throws Exception { + public Properties getCalalogProperties(String catalogId) throws CatalogServiceException { try { return this.catalogService.getCalalogProperties(catalogId); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting catalog properties for catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting catalog properties for catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } @@ -319,30 +321,30 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // return this.catalogService.getFirstPage(queryExpression, catalogIds); // } - public Page getNextPage(Page page) throws Exception { + public Page getNextPage(Page page) throws CatalogServiceException { try { return this.catalogService.getNextPage(page); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting next page : " + e.getMessage(), e); - throw new Exception("Failed while getting next page : " + e.getMessage(), e); + throw e; } } - public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception { + public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException { try { return this.catalogService.getPage(pageInfo, queryExpression); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "'] : " + e.getMessage(), e); - throw new Exception("Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "'] : " + e.getMessage(), e); + throw e; } } - public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException { try { return this.catalogService.getPage(pageInfo, queryExpression, catalogIds); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "',catalogIds='" + catalogIds + "'] : " + e.getMessage(), e); - throw new Exception("Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "',catalogIds='" + catalogIds + "'] : " + e.getMessage(), e); + throw e; } } @@ -354,30 +356,30 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // return this.catalogService.getLastPage(queryExpression, catalogIds); // } - public List<TransactionalMetadata> getMetadata(Page page) throws Exception { + public List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException { try { return this.catalogService.getMetadata(page); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting metadata for page : " + e.getMessage(), e); - throw new Exception("Failed while getting metadata for page : " + e.getMessage(), e); + throw e; } } - public QueryPager query(QueryExpression queryExpression) throws Exception { + public QueryPager query(QueryExpression queryExpression) throws CatalogServiceException { try { return this.catalogService.query(queryExpression); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while performing query '" + queryExpression + "' : " + e.getMessage(), e); - throw new Exception("Failed while performing query '" + queryExpression + "' : " + e.getMessage(), e); + throw e; } } - public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException { try { return this.catalogService.query(queryExpression, catalogIds); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while performing query '" + queryExpression + "' to catalogs '" + catalogIds + "' : " + e.getMessage(), e); - throw new Exception("Failed while performing query '" + queryExpression + "' to catalogs '" + catalogIds + "' : " + e.getMessage(), e); + throw e; } } @@ -385,12 +387,12 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // return this.catalogService.query(queryExpression, sortResults); // } - public List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws Exception { + public List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogServiceException { try { return this.catalogService.getNextPage(queryPager); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while get next page from query pager : " + e.getMessage(), e); - throw new Exception("Failed while get next page from query pager : " + e.getMessage(), e); + throw e; } } @@ -398,57 +400,57 @@ public abstract class AbstractCommunicationChannelServer implements Communicatio // return this.catalogService.getTransactionIdsForAllPages(queryPager); // } - public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception { + public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogServiceException { try { return this.catalogService.getAllPages(queryPager); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while get all pages from query pager : " + e.getMessage(), e); - throw new Exception("Failed while get all pages from query pager : " + e.getMessage(), e); + throw e; } } - public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws Exception { + public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException { try { return this.catalogService.getMetadataFromTransactionIdStrings(catalogServiceTransactionIdStrings); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIdStrings + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIdStrings + "' : " + e.getMessage(), e); + throw e; } } - public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws Exception { + public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogServiceException { try { return this.catalogService.getMetadataFromTransactionIds(catalogServiceTransactionIds); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIds + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIds + "' : " + e.getMessage(), e); + throw e; } } - public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogId) throws Exception { + public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogId) throws CatalogServiceException { try { return this.catalogService.getCatalogServiceTransactionIds(catalogTransactionIds, catalogId); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting catalog service transaction ids for catalog transaction ids '" + catalogTransactionIds + "' from catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting catalog service transaction ids for catalog transaction ids '" + catalogTransactionIds + "' from catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } - public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogId) throws Exception { + public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogId) throws CatalogServiceException { try { return this.catalogService.getCatalogServiceTransactionId(catalogTransactionId, catalogId); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting catalog service transaction id for catalog transaction id '" + catalogTransactionId + "' from catalog '" + catalogId + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting catalog service transaction id for catalog transaction id '" + catalogTransactionId + "' from catalog '" + catalogId + "' : " + e.getMessage(), e); + throw e; } } - public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws Exception { + public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException { try { return this.catalogService.getCatalogServiceTransactionId(catalogReceipt, generateNew); - }catch (Exception e) { + }catch (CatalogServiceException e) { LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction id for catalog receipt '" + catalogReceipt + "' with generate new equal '" + generateNew + "' : " + e.getMessage(), e); - throw new Exception("Failed while getting metadata for catalog service transaction id for catalog receipt '" + catalogReceipt + "' with generate new equal '" + generateNew + "' : " + e.getMessage(), e); + throw e; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java index 49ab643..f28cf92 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java @@ -17,12 +17,18 @@ package org.apache.oodt.cas.filemgr.cli.action; //Apache imports -import org.apache.commons.lang.Validate; -//OODT imports +import org.apache.commons.lang.Validate; 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 org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import java.io.IOException; +import java.net.MalformedURLException; + +//OODT imports + /** * A {@link CmdLineAction} which deletes a {@link Product} by ID. * @@ -33,13 +39,13 @@ public class DeleteProductByIdCliAction extends AbstractDeleteProductCliAction { private String productId; @Override - public Product getProductToDelete() throws Exception { + public Product getProductToDelete() throws CatalogException, ConnectionException, MalformedURLException { Validate.notNull(productId, "Must specify productId"); XmlRpcFileManagerClient client = getClient(); Product p = client.getProductById(productId); if (p == null) { - throw new Exception("FileManager returned null for product '" + throw new CatalogException("FileManager returned null for product '" + productId + "'"); } return p; http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java index 567b9c4..20d0ba8 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java @@ -21,6 +21,10 @@ import org.apache.commons.lang.Validate; //OODT imports 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 gets information about a {@link Product} @@ -33,12 +37,12 @@ public class GetProductByIdCliAction extends AbstractGetProductCliAction { private String productId; @Override - public Product getProduct() throws Exception { + public Product getProduct() throws MalformedURLException, ConnectionException, CatalogException { Validate.notNull(productId, "Must specify productId"); Product p = getClient().getProductById(productId); if (p == null) { - throw new Exception("FileManager returned null product for id '" + throw new CatalogException("FileManager returned null product for id '" + productId + "'"); } return p; http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java index 23e5715..300643b 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java @@ -21,6 +21,10 @@ import org.apache.commons.lang.Validate; //OODT imports 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 gets information about a {@link Product} @@ -33,12 +37,12 @@ public class GetProductByNameCliAction extends AbstractGetProductCliAction { private String productName; @Override - public Product getProduct() throws Exception { + public Product getProduct() throws MalformedURLException, ConnectionException, CatalogException { Validate.notNull(productName, "Must specify productName"); Product p = getClient().getProductByName(productName); if (p == null) { - throw new Exception("FileManager returned null product for name '" + throw new CatalogException("FileManager returned null product for name '" + productName + "'"); } return p; http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/LuceneQueryCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/LuceneQueryCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/LuceneQueryCliAction.java index 6e87d28..f688478 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/LuceneQueryCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/LuceneQueryCliAction.java @@ -16,10 +16,9 @@ */ package org.apache.oodt.cas.filemgr.cli.action; -//JDK imports -import java.util.List; -//Apache imports +import com.google.common.collect.Lists; + import org.apache.commons.lang.Validate; import org.apache.lucene.index.Term; import org.apache.lucene.queryParser.ParseException; @@ -30,17 +29,17 @@ import org.apache.lucene.search.PhraseQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.RangeQuery; import org.apache.lucene.search.TermQuery; - -//OODT imports import org.apache.oodt.cas.filemgr.structs.BooleanQueryCriteria; import org.apache.oodt.cas.filemgr.structs.QueryCriteria; import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria; import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria; +import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; +import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException; import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; import org.apache.oodt.cas.filemgr.tools.CASAnalyzer; -//Google imports -import com.google.common.collect.Lists; +import java.util.List; + /** * A {@link CmdLineAction} which converts a Lucene-like query into a File @@ -61,7 +60,7 @@ public class LuceneQueryCliAction extends AbstractQueryCliAction { } @Override - public ComplexQuery getQuery() throws Exception { + public ComplexQuery getQuery() throws ParseException, CatalogException, QueryFormulationException { Validate.notNull(query, "Must specify query"); ComplexQuery complexQuery = new ComplexQuery(); @@ -90,18 +89,18 @@ public class LuceneQueryCliAction extends AbstractQueryCliAction { } private QueryCriteria generateCASQuery(Query luceneQuery) - throws Exception { + throws CatalogException, QueryFormulationException { if (luceneQuery instanceof TermQuery) { Term t = ((TermQuery) luceneQuery).getTerm(); if (t.field().equals(FREE_TEXT_BLOCK)) { - throw new Exception("Free text blocks not supported!"); + throw new CatalogException("Free text blocks not supported!"); } else { return new TermQueryCriteria(t.field(), t.text()); } } else if (luceneQuery instanceof PhraseQuery) { Term[] t = ((PhraseQuery) luceneQuery).getTerms(); if (t[0].field().equals(FREE_TEXT_BLOCK)) { - throw new Exception("Free text blocks not supported!"); + throw new CatalogException("Free text blocks not supported!"); } else { BooleanQueryCriteria bqc = new BooleanQueryCriteria(); bqc.setOperator(BooleanQueryCriteria.AND); @@ -128,7 +127,7 @@ public class LuceneQueryCliAction extends AbstractQueryCliAction { } return bqc; } else { - throw new Exception( + throw new CatalogException( "Error parsing query! Cannot determine clause type: [" + luceneQuery.getClass().getName() + "] !"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/SqlQueryCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/SqlQueryCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/SqlQueryCliAction.java index 280603f..a612b9a 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/SqlQueryCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/SqlQueryCliAction.java @@ -20,6 +20,8 @@ package org.apache.oodt.cas.filemgr.cli.action; import org.apache.commons.lang.Validate; //OODT imports +import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; +import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException; import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; import org.apache.oodt.cas.filemgr.util.SqlParser; @@ -38,7 +40,7 @@ public class SqlQueryCliAction extends AbstractQueryCliAction { } @Override - public ComplexQuery getQuery() throws Exception { + public ComplexQuery getQuery() throws QueryFormulationException { Validate.notNull(query, "Must specify query"); return SqlParser.parseSqlQuery(query); http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java index b8671cc..0c9917b 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java @@ -103,7 +103,7 @@ public class XmlQueueRepository implements QueueRepository { String nodeId = ((Element) nodeList.item(k)) .getAttribute("id"); Vector assignments = (Vector) XmlStructFactory - .getQueueAssignment(onodeList + .getQueueAssignment(nodeList .item(k)); for (Object assignment : assignments) { try { http://git-wip-us.apache.org/repos/asf/oodt/blob/4ed2a423/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java index 64031d2..3c4b086 100755 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java @@ -235,7 +235,7 @@ public abstract class WorkflowProcessor implements WorkflowProcessorListener, } } - } else if (this.iusDone().getName().equals("ResultsFailure")) { + } else if (this.isDone().getName().equals("ResultsFailure")) { // do nothing -- this workflow failed!!! } else if (this.isDone().getName().equals("ResultsBail")) { for (WorkflowProcessor subProcessor : this.getRunnableSubProcessors())
