OODT-909 create improved exceptions
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/249931a0 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/249931a0 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/249931a0 Branch: refs/heads/master Commit: 249931a0073a84b9479ca8da0d160c5ef45a9c72 Parents: 11e2857 Author: Tom Barber <[email protected]> Authored: Tue Oct 27 22:28:56 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Tue Oct 27 22:28:56 2015 +0000 ---------------------------------------------------------------------- .../channel/CommunicationChannelClient.java | 89 +++-- .../rmi/RmiCommunicationChannelClient.java | 94 ++--- .../XmlRpcCommunicationChannelClient.java | 390 ++++++++++++++++--- .../XmlRpcCommunicationChannelServer.java | 104 ++--- .../system/impl/CatalogServiceLocal.java | 2 +- .../oodt/cas/catalog/util/SpringUtils.java | 15 +- .../catalog/solr/DefaultProductSerializer.java | 2 +- .../cas/filemgr/tools/ProductTypeDocTool.java | 2 +- .../java/org/apache/oodt/cas/pge/PGETask.java | 17 +- .../apache/oodt/cas/pge/PGETaskInstance.java | 156 ++++---- .../cas/pge/config/XmlFilePgeConfigBuilder.java | 46 +-- .../oodt/cas/pge/exceptions/PGEException.java | 16 + .../cas/pge/staging/FileManagerFileStager.java | 4 +- .../apache/oodt/cas/pge/staging/FileStager.java | 42 +- .../cas/pge/util/GenericPgeObjectFactory.java | 13 +- .../org/apache/oodt/cas/pge/util/XmlHelper.java | 132 +++---- .../cas/pge/writers/CsvConfigFileWriter.java | 21 +- .../pge/writers/ExternExtractorMetWriter.java | 27 +- .../pge/writers/FilenameExtractorWriter.java | 10 +- .../MetadataKeyReplacerTemplateWriter.java | 10 +- .../oodt/cas/pge/writers/PcsMetFileWriter.java | 25 +- .../cas/pge/writers/TextConfigFileWriter.java | 18 +- .../pge/writers/VelocityConfigFileWriter.java | 14 +- .../metlist/MetadataListPcsMetFileWriter.java | 22 +- .../system/XmlRpcWorkflowManagerClient.java | 16 +- .../system/MockXmlRpcWorkflowManagerClient.java | 76 ++-- 26 files changed, 814 insertions(+), 549 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java index 1d06251..ec9361f 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java @@ -17,12 +17,8 @@ package org.apache.oodt.cas.catalog.server.channel; //JDK imports -import java.net.URL; -import java.util.List; -import java.util.Properties; -import java.util.Set; -//OODT imports +import org.apache.oodt.cas.catalog.exception.CatalogException; import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; import org.apache.oodt.cas.catalog.page.CatalogReceipt; import org.apache.oodt.cas.catalog.page.Page; @@ -37,6 +33,13 @@ import org.apache.oodt.cas.catalog.system.Catalog; import org.apache.oodt.cas.catalog.util.PluginURL; import org.apache.oodt.cas.metadata.Metadata; +import java.net.URL; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +//OODT imports + /** * @author bfoster * @version $Revision$ @@ -47,13 +50,13 @@ import org.apache.oodt.cas.metadata.Metadata; */ public interface CommunicationChannelClient { - void shutdown() throws Exception; + void shutdown() throws CatalogException; - boolean isRestrictQueryPermissions() throws Exception; + boolean isRestrictQueryPermissions() throws CatalogException; // public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception; - boolean isRestrictIngestPermissions() throws Exception; + boolean isRestrictIngestPermissions() throws CatalogException; // public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception; @@ -62,92 +65,92 @@ public interface CommunicationChannelClient { // public void setTransactionIdClass(Class<? extends TransactionId<?>> transactionIdClass) throws Exception; // - void addCatalog(Catalog catalog) throws Exception; + void addCatalog(Catalog catalog) throws CatalogException; - void replaceCatalog(Catalog catalog) throws Exception; + void replaceCatalog(Catalog catalog) throws CatalogException; - void addCatalog(String catalogId, Index index) throws Exception; + void addCatalog(String catalogId, Index index) throws CatalogException; - void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception; + void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException; void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, - boolean restrictIngestPermission) throws Exception; + boolean restrictIngestPermission) throws CatalogException; - void addDictionary(String catalogId, Dictionary dictionary) throws Exception; + void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException; - void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception; + void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException; - void replaceIndex(String catalogId, Index index) throws Exception; + void replaceIndex(String catalogId, Index index) throws CatalogException; - void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception; + void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException; - void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception; + void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException; - void removeCatalog(String catalogUrn) throws Exception; + void removeCatalog(String catalogUrn) throws CatalogException; // public void removeCatalog(String catalogUrn, boolean preserveMapping) throws Exception; - List<PluginURL> getPluginUrls() throws Exception; + List<PluginURL> getPluginUrls() throws CatalogException; - void addPluginUrls(List<PluginURL> pluginUrls) throws Exception; + void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException; - URL getPluginStorageDir() throws Exception; + URL getPluginStorageDir() throws CatalogException; - void transferUrl(URL fromUrl, URL toUrl) throws Exception; + void transferUrl(URL fromUrl, URL toUrl) throws CatalogException; // public Set<Catalog> getCurrentCatalogList() throws Exception; // // public Catalog getCatalog(String catalogUrn) throws Exception; - Set<String> getCurrentCatalogIds() throws Exception; + Set<String> getCurrentCatalogIds() throws CatalogException; - TransactionReceipt ingest(Metadata metadata) throws Exception; + TransactionReceipt ingest(Metadata metadata) throws CatalogException; - void delete(Metadata metadata) throws Exception; + void delete(Metadata metadata) throws CatalogException; - List<String> getProperty(String key) throws Exception; + List<String> getProperty(String key) throws CatalogException; - Properties getCalalogProperties() throws Exception; + Properties getCalalogProperties() throws CatalogException; - Properties getCalalogProperties(String catalogUrn) throws Exception; + Properties getCalalogProperties(String catalogUrn) throws CatalogException; // public Page getFirstPage(QueryExpression queryExpression) throws Exception; // // public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception; - Page getNextPage(Page page) throws Exception; + Page getNextPage(Page page) throws CatalogException; - Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception; + Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException; - Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception; + Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException; // public Page getLastPage(QueryExpression queryExpression) throws Exception; // // public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception; - List<TransactionalMetadata> getMetadata(Page page) throws Exception; + List<TransactionalMetadata> getMetadata(Page page) throws CatalogException; - QueryPager query(QueryExpression queryExpression) throws Exception; + QueryPager query(QueryExpression queryExpression) throws CatalogException; - QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception; + QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException; // public QueryPager query(QueryExpression queryExpression, boolean sortResults) throws Exception; - List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws Exception; + List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogException; - List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws Exception; + List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws CatalogException; - List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception; + List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException; - List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws Exception; + List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogException; - List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws Exception; + List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogException; List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, - String catalogUrn) throws Exception; + String catalogUrn) throws CatalogException; - TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws Exception; + TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogException; - TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws Exception; + TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogException; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java index 43c1b90..3611cc9 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java @@ -17,14 +17,7 @@ package org.apache.oodt.cas.catalog.server.channel.rmi; //JDK imports -import java.net.URL; -import java.rmi.RemoteException; -import java.rmi.server.UnicastRemoteObject; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -//OODT imports +import org.apache.oodt.cas.catalog.exception.CatalogException; import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; import org.apache.oodt.cas.catalog.page.CatalogReceipt; import org.apache.oodt.cas.catalog.page.Page; @@ -40,6 +33,15 @@ import org.apache.oodt.cas.catalog.system.Catalog; import org.apache.oodt.cas.catalog.util.PluginURL; import org.apache.oodt.cas.metadata.Metadata; +import java.net.URL; +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +//OODT imports + /** * * @author bfoster @@ -54,214 +56,214 @@ public class RmiCommunicationChannelClient extends UnicastRemoteObject implement super(); } - public void addCatalog(Catalog catalog) throws Exception { + public void addCatalog(Catalog catalog) throws CatalogException { // TODO Auto-generated method stub } - public void addCatalog(String catalogId, Index index) throws Exception { + public void addCatalog(String catalogId, Index index) throws CatalogException { // TODO Auto-generated method stub } public void addCatalog(String catalogId, Index index, - List<Dictionary> dictionaries) throws Exception { + List<Dictionary> dictionaries) throws CatalogException { // TODO Auto-generated method stub } public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, - boolean restrictIngestPermission) throws Exception { + boolean restrictIngestPermission) throws CatalogException { // TODO Auto-generated method stub } public void addDictionary(String catalogId, Dictionary dictionary) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub } - public void addPluginUrls(List<PluginURL> pluginUrls) throws Exception { + public void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException { // TODO Auto-generated method stub } - public void delete(Metadata metadata) throws Exception { + public void delete(Metadata metadata) throws CatalogException { // TODO Auto-generated method stub } public List<TransactionalMetadata> getAllPages(QueryPager queryPager) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } - public Properties getCalalogProperties() throws Exception { + public Properties getCalalogProperties() throws CatalogException { // TODO Auto-generated method stub return null; } - public Properties getCalalogProperties(String catalogUrn) throws Exception { + public Properties getCalalogProperties(String catalogUrn) throws CatalogException { // TODO Auto-generated method stub return null; } public TransactionId<?> getCatalogServiceTransactionId( TransactionId<?> catalogTransactionId, String catalogUrn) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } public TransactionId<?> getCatalogServiceTransactionId( CatalogReceipt catalogReceipt, boolean generateNew) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } public List<TransactionId<?>> getCatalogServiceTransactionIds( List<TransactionId<?>> catalogTransactionIds, String catalogUrn) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } - public Set<String> getCurrentCatalogIds() throws Exception { + public Set<String> getCurrentCatalogIds() throws CatalogException { // TODO Auto-generated method stub return null; } - public List<TransactionalMetadata> getMetadata(Page page) throws Exception { + public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException { // TODO Auto-generated method stub return null; } public List<TransactionalMetadata> getMetadataFromTransactionIdStrings( - List<String> catalogServiceTransactionIdStrings) throws Exception { + List<String> catalogServiceTransactionIdStrings) throws CatalogException { // TODO Auto-generated method stub return null; } public List<TransactionalMetadata> getMetadataFromTransactionIds( List<TransactionId<?>> catalogServiceTransactionIds) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } - public Page getNextPage(Page page) throws Exception { + public Page getNextPage(Page page) throws CatalogException { // TODO Auto-generated method stub return null; } public List<TransactionalMetadata> getNextPage(QueryPager queryPager) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) - throws Exception { + throws CatalogException { // TODO Auto-generated method stub return null; } public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, - Set<String> catalogIds) throws Exception { + Set<String> catalogIds) throws CatalogException { // TODO Auto-generated method stub return null; } - public URL getPluginStorageDir() throws Exception { + public URL getPluginStorageDir() throws CatalogException { // TODO Auto-generated method stub return null; } - public List<PluginURL> getPluginUrls() throws Exception { + public List<PluginURL> getPluginUrls() throws CatalogException { // TODO Auto-generated method stub return null; } - public List<String> getProperty(String key) throws Exception { + public List<String> getProperty(String key) throws CatalogException { // TODO Auto-generated method stub return null; } public List<TransactionId<?>> getTransactionIdsForAllPages( - QueryPager queryPager) throws Exception { + QueryPager queryPager) throws CatalogException { // TODO Auto-generated method stub return null; } - public TransactionReceipt ingest(Metadata metadata) throws Exception { + public TransactionReceipt ingest(Metadata metadata) throws CatalogException { // TODO Auto-generated method stub return null; } - public boolean isRestrictIngestPermissions() throws Exception { + public boolean isRestrictIngestPermissions() throws CatalogException { // TODO Auto-generated method stub return false; } - public boolean isRestrictQueryPermissions() throws Exception { + public boolean isRestrictQueryPermissions() throws CatalogException { // TODO Auto-generated method stub return false; } public void modifyIngestPermission(String catalogId, - boolean restrictIngestPermission) throws Exception { + boolean restrictIngestPermission) throws CatalogException { // TODO Auto-generated method stub } public void modifyQueryPermission(String catalogId, - boolean restrictQueryPermission) throws Exception { + boolean restrictQueryPermission) throws CatalogException { // TODO Auto-generated method stub } - public QueryPager query(QueryExpression queryExpression) throws Exception { + public QueryPager query(QueryExpression queryExpression) throws CatalogException { // TODO Auto-generated method stub return null; } public QueryPager query(QueryExpression queryExpression, - Set<String> catalogIds) throws Exception { + Set<String> catalogIds) throws CatalogException { // TODO Auto-generated method stub return null; } - public void removeCatalog(String catalogUrn) throws Exception { + public void removeCatalog(String catalogUrn) throws CatalogException { // TODO Auto-generated method stub } - public void replaceCatalog(Catalog catalog) throws Exception { + public void replaceCatalog(Catalog catalog) throws CatalogException { // TODO Auto-generated method stub } public void replaceDictionaries(String catalogId, - List<Dictionary> dictionaries) throws Exception { + List<Dictionary> dictionaries) throws CatalogException { // TODO Auto-generated method stub } - public void replaceIndex(String catalogId, Index index) throws Exception { + public void replaceIndex(String catalogId, Index index) throws CatalogException { // TODO Auto-generated method stub } - public void shutdown() throws Exception { + public void shutdown() throws CatalogException { // TODO Auto-generated method stub } - public void transferUrl(URL fromUrl, URL toUrl) throws Exception { + public void transferUrl(URL fromUrl, URL toUrl) throws CatalogException { // TODO Auto-generated method stub } http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java index 0e2f26a..e5c8890 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java @@ -16,6 +16,7 @@ */ package org.apache.oodt.cas.catalog.server.channel.xmlrpc; +import org.apache.oodt.cas.catalog.exception.CatalogException; import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; import org.apache.oodt.cas.catalog.page.CatalogReceipt; import org.apache.oodt.cas.catalog.page.Page; @@ -32,9 +33,12 @@ import org.apache.oodt.cas.catalog.util.PluginURL; import org.apache.oodt.cas.metadata.Metadata; import org.apache.xmlrpc.CommonsXmlRpcTransportFactory; import org.apache.xmlrpc.XmlRpcClient; +import org.apache.xmlrpc.XmlRpcException; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; import java.net.URL; import java.util.List; import java.util.Properties; @@ -63,100 +67,184 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann this.chunkSize = chunkSize; } - public void shutdown() throws Exception { + public void shutdown() throws CatalogException { Vector<Object> args = new Vector<Object>(); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_shutdown", args); + } catch (XmlRpcException e) { + throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e); + } } - public void addCatalog(Catalog catalog) throws Exception { + public void addCatalog(Catalog catalog) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalog)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } } - public void replaceCatalog(Catalog catalog) throws Exception { + public void replaceCatalog(Catalog catalog) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalog)); - this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args); + try { + this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e); + } } - public void addCatalog(String catalogId, Index index) throws Exception { + public void addCatalog(String catalogId, Index index) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(index)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } } - public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception { + public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(index)); args.add(this.serializer.serializeObject(dictionaries)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } } - public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws Exception { + public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(index)); args.add(this.serializer.serializeObject(dictionaries)); args.add(restrictQueryPermission); args.add(restrictIngestPermission); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e); + } } - public void addDictionary(String catalogId, Dictionary dictionary) throws Exception { + public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(dictionary)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Dictionary: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Dictionary: "+ e.getMessage(), e); + } } - public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception { + public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(dictionaries)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args); + } catch (XmlRpcException e) { + throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e); + } } - public void replaceIndex(String catalogId, Index index) throws Exception { + public void replaceIndex(String catalogId, Index index) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(index)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceIndex", args); + } catch (XmlRpcException e) { + throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e); + } } - public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception { + public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(restrictIngestPermission)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyIngestPermission", args); + } catch (XmlRpcException e) { + throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e); + } } - public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception { + public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogId); args.add(this.serializer.serializeObject(restrictQueryPermission)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyQueryPermission", args); + } catch (XmlRpcException e) { + throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e); + } } - public List<PluginURL> getPluginUrls() throws Exception { + public List<PluginURL> getPluginUrls() throws CatalogException { Vector<Object> args = new Vector<Object>(); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginUrls", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e); + } } - public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception { + public void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(pluginURLs)); + try { this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addPluginUrls", args); + } catch (XmlRpcException e) { + throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e); + } } - public URL getPluginStorageDir() throws Exception { + public URL getPluginStorageDir() throws CatalogException { Vector<Object> args = new Vector<Object>(); - return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args)); + try { + return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e); + } } - public void transferUrl(URL fromUrl, URL toURL) throws Exception { + public void transferUrl(URL fromUrl, URL toURL) throws CatalogException { System.out.println("Transfering '" + fromUrl + "' to '" + toURL + "'"); FileInputStream is = null; try { @@ -166,7 +254,11 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann int numBytes; while ((numBytes = is.read(buf, offset, chunkSize)) != -1) this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes); - } finally { + } catch (FileNotFoundException e) { + throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e); + } finally { try { is.close(); }catch(Exception ignored) {} @@ -174,226 +266,400 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann } protected void transferFile(String filePath, byte[] fileData, int offset, - int numBytes) throws Exception { + int numBytes) throws CatalogException { Vector<Object> argList = new Vector<Object>(); argList.add(filePath); argList.add(fileData); argList.add(offset); argList.add(numBytes); - client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList); - } + try { + client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList); + } catch (XmlRpcException e) { + throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e); + } + } - public void delete(Metadata metadata) throws Exception { + public void delete(Metadata metadata) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(metadata)); - this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args); + try { + this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args); + } catch (XmlRpcException e) { + throw new CatalogException("Delete Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Delete Failed: "+ e.getMessage(), e); + } } - public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception { + public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryPager)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getAllPages", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e); + } } - public Properties getCalalogProperties() throws Exception { + public Properties getCalalogProperties() throws CatalogException { + try { return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", new Vector<Object>())); + } catch (XmlRpcException e) { + throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e); + } } public Properties getCalalogProperties(String catalogUrn) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogUrn); + try { return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e); + } } -// public Catalog getCatalog(String catalogUrn) throws Exception { +// public Catalog getCatalog(String catalogUrn) throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(catalogUrn); // return this.serializer.deserializeObject(Catalog.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalog", args)); // } // public CatalogRepository getCatalogRepository() -// throws Exception { +// throws CatalogException { // return this.serializer.deserializeObject(CatalogRepository.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogRepository", new Vector<Object>())); // } public TransactionId<?> getCatalogServiceTransactionId( TransactionId<?> catalogTransactionId, String catalogUrn) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalogTransactionId)); args.add(catalogUrn); + try { return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e); + } } public TransactionId<?> getCatalogServiceTransactionId( CatalogReceipt catalogReceipt, - boolean generateNew) throws Exception { + boolean generateNew) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalogReceipt)); args.add(this.serializer.serializeObject(generateNew)); + try { return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId2", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e); + } } public List<TransactionId<?>> getCatalogServiceTransactionIds( List<TransactionId<?>> catalogTransactionIds, String catalogUrn) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalogTransactionIds)); args.add(catalogUrn); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e); + } } - public Set<String> getCurrentCatalogIds() throws Exception { + public Set<String> getCurrentCatalogIds() throws CatalogException { + try { return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogIds", new Vector<Object>())); + } catch (XmlRpcException e) { + throw new CatalogException("Get Curent Catalog Ids Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Current Catalog Ids Failed: "+ e.getMessage(), e); + } } -// public Set<Catalog> getCurrentCatalogList() throws Exception { +// public Set<Catalog> getCurrentCatalogList() throws CatalogException { // return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogList", new Vector<Object>())); // } // -// public IngestMapper getIngestMapper() throws Exception { +// public IngestMapper getIngestMapper() throws CatalogException { // return this.serializer.deserializeObject(IngestMapper.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getIngestMapper", new Vector<Object>())); // } public List<TransactionalMetadata> getMetadataFromTransactionIdStrings( List<String> catalogServiceTransactionIdStrings) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalogServiceTransactionIdStrings)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIdStrings", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Metadata From Transaction Id Strings Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Metadata From Transaction Id String Failed: "+ e.getMessage(), e); + } } public List<TransactionalMetadata> getMetadataFromTransactionIds( List<TransactionId<?>> catalogServiceTransactionIds) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(catalogServiceTransactionIds)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIds", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e); + } } public List<TransactionalMetadata> getNextPage(QueryPager queryPager) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryPager)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e); + } } - public List<String> getProperty(String key) throws Exception { + public List<String> getProperty(String key) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(key); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getProperty", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Property Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Property Failed: "+ e.getMessage(), e); + } } - public Class<? extends TransactionId<?>> getTransactionIdClass() throws Exception { + public Class<? extends TransactionId<?>> getTransactionIdClass() throws CatalogException { + try { return this.serializer.deserializeObject(Class.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdClass", new Vector<Object>())); + } catch (XmlRpcException e) { + throw new CatalogException("Get Transaction Id Class Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Transaction Id Calss Failed: "+ e.getMessage(), e); + } } public List<TransactionId<?>> getTransactionIdsForAllPages( - QueryPager queryPager) throws Exception { + QueryPager queryPager) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryPager)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdsForAllPages", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e); + } } public TransactionReceipt ingest(Metadata metadata) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(metadata)); + try { return this.serializer.deserializeObject(TransactionReceipt.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_ingest", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Ingest Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Ingest Failed: "+ e.getMessage(), e); + } } - public boolean isRestrictIngestPermissions() throws Exception { + public boolean isRestrictIngestPermissions() throws CatalogException { + try { return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictIngestPermissions", new Vector<Object>())); + } catch (XmlRpcException e) { + throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e); + } } - public boolean isRestrictQueryPermissions() throws Exception { + public boolean isRestrictQueryPermissions() throws CatalogException { + try { return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictQueryPermissions", new Vector<Object>())); + } catch (XmlRpcException e) { + throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e); + } } - public Page getFirstPage(QueryExpression queryExpression) throws Exception { + public Page getFirstPage(QueryExpression queryExpression) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e); + } } - public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); args.add(this.serializer.serializeObject(catalogIds)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e); + } } - public Page getNextPage(Page page) throws Exception { + public Page getNextPage(Page page) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(page)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage2", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e); + } } - public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception { + public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(pageInfo)); args.add(this.serializer.serializeObject(queryExpression)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Page Failed: "+ e.getMessage(), e); + } } - public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(pageInfo)); args.add(this.serializer.serializeObject(queryExpression)); args.add(this.serializer.serializeObject(catalogIds)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Page Failed: "+ e.getMessage(), e); + } } - public Page getLastPage(QueryExpression queryExpression) throws Exception { + public Page getLastPage(QueryExpression queryExpression) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e); + } } - public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); args.add(this.serializer.serializeObject(catalogIds)); + try { return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e); + } } - public List<TransactionalMetadata> getMetadata(Page page) throws Exception { + public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(page)); + try { return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadata", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e); + } } public QueryPager query(QueryExpression queryExpression) - throws Exception { + throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); + try { return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Query Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Query Failed: "+ e.getMessage(), e); + } } - public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception { + public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(this.serializer.serializeObject(queryExpression)); args.add(this.serializer.serializeObject(catalogIds)); + try { return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args)); + } catch (XmlRpcException e) { + throw new CatalogException("Query Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Query Failed: "+ e.getMessage(), e); + } } // public QueryPager query(QueryExpression queryExpression, boolean sortResults) -// throws Exception { +// throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(queryExpression)); // args.add(this.serializer.serializeObject(new Boolean(sortResults))); // return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args)); // } - public void removeCatalog(String catalogUrn) throws Exception { + public void removeCatalog(String catalogUrn) throws CatalogException { Vector<Object> args = new Vector<Object>(); args.add(catalogUrn); - this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args); + try { + this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args); + } catch (XmlRpcException e) { + throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e); + } catch (IOException e) { + throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e); + } } // public void removeCatalog(String catalogUrn, boolean preserveMapping) -// throws Exception { +// throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(catalogUrn); // args.add(this.serializer.serializeObject(new Boolean(preserveMapping))); @@ -401,32 +667,32 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann // } // public void setCatalogRepository(CatalogRepository catalogRepository) -// throws Exception { +// throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(catalogRepository)); // this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setCatalogRepository", args); // } -// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception { +// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(new Boolean(restrictIngestPermissions))); // this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setHasIngestPermissions", args); // } -// public void setIngestMapper(IngestMapper ingestMapper) throws Exception { +// public void setIngestMapper(IngestMapper ingestMapper) throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(ingestMapper)); // this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setIngestMapper", args); // } -// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception { +// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(new Boolean(restrictQueryPermissions))); // this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setRestrictQueryPermissions", args); // } // public void setTransactionIdClass( -// Class<? extends TransactionId<?>> transactionIdClass) throws Exception { +// Class<? extends TransactionId<?>> transactionIdClass) throws CatalogException { // Vector<Object> args = new Vector<Object>(); // args.add(this.serializer.serializeObject(transactionIdClass)); // this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setTransactionIdClass", args); http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java index 7d5248d..4655bf4 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java @@ -17,6 +17,8 @@ package org.apache.oodt.cas.catalog.server.channel.xmlrpc; //JDK imports + +import org.apache.oodt.cas.catalog.exception.CatalogServiceException; import org.apache.oodt.cas.catalog.page.CatalogReceipt; import org.apache.oodt.cas.catalog.page.Page; import org.apache.oodt.cas.catalog.page.PageInfo; @@ -32,6 +34,7 @@ import org.apache.xmlrpc.WebServer; import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.util.List; import java.util.Set; @@ -59,82 +62,83 @@ public class XmlRpcCommunicationChannelServer extends this.webServer.start(); } - public boolean xmlrpc_shutdown() throws Exception { + public boolean xmlrpc_shutdown() throws CatalogServiceException { this.shutdown(); this.webServer.shutdown(); this.webServer = null; return true; } - public boolean xmlrpc_addCatalog(String catalogObject) throws Exception { + public boolean xmlrpc_addCatalog(String catalogObject) throws CatalogServiceException { this.addCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject)); return true; } - public boolean xmlrpc_replaceCatalog(String catalogObject) throws Exception { + public boolean xmlrpc_replaceCatalog(String catalogObject) throws CatalogServiceException { this.replaceCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject)); return true; } - public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws Exception { + public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws CatalogServiceException { this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject)); return true; } - public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws Exception { + public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws CatalogServiceException { this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject)); return true; } - public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws Exception { + public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws CatalogServiceException { this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject), this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject), this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject)); return true; } - public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws Exception { + public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws CatalogServiceException { this.addDictionary(catalogId, this.serializer.deserializeObject(Dictionary.class, dictionaryObject)); return true; } - public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws Exception { + public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws CatalogServiceException { this.replaceDictionaries(catalogId, this.serializer.deserializeObject(List.class, dictionariesObject)); return true; } - public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws Exception { + public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws CatalogServiceException { this.replaceIndex(catalogId, this.serializer.deserializeObject(Index.class, indexObject)); return true; } - public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws Exception { + public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws CatalogServiceException { this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject)); return true; } - public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws Exception { + public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws CatalogServiceException { this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject)); return true; } - public boolean xmlrpc_delete(String metadataObject) throws Exception { + public boolean xmlrpc_delete(String metadataObject) throws CatalogServiceException { this.delete(this.serializer.deserializeObject(Metadata.class, metadataObject)); return true; } - public String xmlrpc_getPluginUrls() throws Exception { + public String xmlrpc_getPluginUrls() throws CatalogServiceException { return this.serializer.serializeObject(this.getPluginUrls()); } - public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws Exception { + public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws CatalogServiceException { this.addPluginUrls(this.serializer.deserializeObject(List.class, pluginUrlsObject)); return true; } - public String xmlrpc_getPluginStorageDir() throws Exception { + public String xmlrpc_getPluginStorageDir() throws CatalogServiceException { return this.serializer.serializeObject(this.getPluginStorageDir()); } - public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes) throws Exception { + public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes) + throws CatalogServiceException, IOException { FileOutputStream fOut = null; try { File outFile = new File(filePath); @@ -152,158 +156,158 @@ public class XmlRpcCommunicationChannelServer extends return true; } - public String xmlrpc_getAllPages(String queryPagerObject) throws Exception { + public String xmlrpc_getAllPages(String queryPagerObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject))); } - public String xmlrpc_getCalalogProperties() throws Exception { + public String xmlrpc_getCalalogProperties() throws CatalogServiceException { return this.serializer.serializeObject(this.getCalalogProperties()); } public String xmlrpc_getCalalogProperties(String catalogUrn) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getCalalogProperties(catalogUrn)); } -// public String xmlrpc_getCatalog(String catalogUrn) throws Exception { +// public String xmlrpc_getCatalog(String catalogUrn) throws CatalogServiceException { // return this.serializer.serializeObject(this.getCatalog(catalogUrn)); // } public String xmlrpc_getCatalogServiceTransactionId( String catalogTransactionIdObject, String catalogUrn) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(TransactionId.class, catalogTransactionIdObject), catalogUrn)); } public String xmlrpc_getCatalogServiceTransactionId2( String catalogReceiptObject, - String generateNewObject) throws Exception { + String generateNewObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(CatalogReceipt.class, catalogReceiptObject), this.serializer.deserializeObject(Boolean.class, generateNewObject))); } public String xmlrpc_getCatalogServiceTransactionIds( String catalogTransactionIdsObject, String catalogUrn) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getCatalogServiceTransactionIds(this.serializer.deserializeObject(List.class, catalogTransactionIdsObject), catalogUrn)); } - public String xmlrpc_getCurrentCatalogIds() throws Exception { + public String xmlrpc_getCurrentCatalogIds() throws CatalogServiceException { return this.serializer.serializeObject(this.getCurrentCatalogIds()); } -// public String xmlrpc_getCurrentCatalogList() throws Exception { +// public String xmlrpc_getCurrentCatalogList() throws CatalogServiceException { // return this.serializer.serializeObject(this.getCurrentCatalogList()); // } public String xmlrpc_getMetadataFromTransactionIdStrings( String catalogServiceTransactionIdStringsObject) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getMetadataFromTransactionIdStrings(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdStringsObject))); } public String xmlrpc_getMetadataFromTransactionIds( String catalogServiceTransactionIdsObject) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getMetadataFromTransactionIds(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdsObject))); } public String xmlrpc_getNextPage(String queryPagerObject) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPager.class, queryPagerObject))); } - public String xmlrpc_getProperty(String key) throws Exception { + public String xmlrpc_getProperty(String key) throws CatalogServiceException { return this.serializer.serializeObject(this.getProperty(key)); } // -// public String xmlrpc_getTransactionIdClass() throws Exception { +// public String xmlrpc_getTransactionIdClass() throws CatalogServiceException { // return this.serializer.serializeObject(this.getTransactionIdClass()); // } // public String xmlrpc_getTransactionIdsForAllPages( -// String queryPagerObject) throws Exception { +// String queryPagerObject) throws CatalogServiceException { // return this.serializer.serializeObject(this.getTransactionIdsForAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject))); // } public String xmlrpc_ingest(String metadataObject) - throws Exception { + throws CatalogServiceException { return this.serializer.serializeObject(this.ingest(this.serializer.deserializeObject(Metadata.class, metadataObject))); } - public String xmlrpc_isRestrictIngestPermissions() throws Exception { + public String xmlrpc_isRestrictIngestPermissions() throws CatalogServiceException { return this.serializer.serializeObject(this.isRestrictIngestPermissions()); } - public String xmlrpc_isRestrictQueryPermissions() throws Exception { + public String xmlrpc_isRestrictQueryPermissions() throws CatalogServiceException { return this.serializer.serializeObject(this.isRestrictQueryPermissions()); } - public String xmlrpc_query(String queryExpressionObject) throws Exception { + public String xmlrpc_query(String queryExpressionObject) throws CatalogServiceException { return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject))); } - public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws Exception { + public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException { return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject))); } -// public String xmlrpc_getFirstPage(String queryExpressionObject) throws Exception { +// public String xmlrpc_getFirstPage(String queryExpressionObject) throws CatalogServiceException { // return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject))); // } // -// public String xmlrpc_getFirstPage(String queryExpressionObject, String catalogIdsObject) throws Exception { +// public String xmlrpc_getFirstPage(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException { // return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject))); // } - public String xmlrpc_getNextPage2(String pageObject) throws Exception { + public String xmlrpc_getNextPage2(String pageObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(Page.class, pageObject))); } - public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws Exception { + public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject))); } - public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws Exception { + public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject))); } -// public String xmlrpc_getLastPage(String queryExpressionObject) throws Exception { +// public String xmlrpc_getLastPage(String queryExpressionObject) throws CatalogServiceException { // return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject))); // } // -// public String xmlrpc_getLastPage(String queryExpressionObject, String catalogIdsObject) throws Exception { +// public String xmlrpc_getLastPage(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException { // return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject))); // } - public String xmlrpc_getMetadata(String pageObject) throws Exception { + public String xmlrpc_getMetadata(String pageObject) throws CatalogServiceException { return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(Page.class, pageObject))); } -// public String xmlrpc_query(String queryExpressionObject, String sortResultsObject) throws Exception { +// public String xmlrpc_query(String queryExpressionObject, String sortResultsObject) throws CatalogServiceException { // System.out.println(this.getClass().getClassLoader()); // return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Boolean.class, sortResultsObject))); // } - public boolean xmlrpc_removeCatalog(String catalogUrn) throws Exception { + public boolean xmlrpc_removeCatalog(String catalogUrn) throws CatalogServiceException { this.removeCatalog(catalogUrn); return true; } // -// public boolean xmlrpc_removeCatalog(String catalogUrn, String preserveMappingObject) throws Exception { +// public boolean xmlrpc_removeCatalog(String catalogUrn, String preserveMappingObject) throws CatalogServiceException { // this.removeCatalog(catalogUrn, this.serializer.deserializeObject(Boolean.class, preserveMappingObject)); // return true; // } // -// public boolean xmlrpc_setHasIngestPermissions(String restrictIngestPermissionsObject) throws Exception { +// public boolean xmlrpc_setHasIngestPermissions(String restrictIngestPermissionsObject) throws CatalogServiceException { // this.setHasIngestPermissions(this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionsObject)); // return true; // } // -// public boolean xmlrpc_setRestrictQueryPermissions(String restrictQueryPermissionsObject) throws Exception { +// public boolean xmlrpc_setRestrictQueryPermissions(String restrictQueryPermissionsObject) throws CatalogServiceException { // this.setRestrictQueryPermissions(this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionsObject)); // return true; // } -// public boolean setTransactionIdClass(String transactionIdClassObject) throws Exception { +// public boolean setTransactionIdClass(String transactionIdClassObject) throws CatalogServiceException { // this.setTransactionIdClass(this.serializer.deserializeObject(Class.class, transactionIdClassObject)); // return true; // } http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java index 9346255..07b816b 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java @@ -953,7 +953,7 @@ public class CatalogServiceLocal implements CatalogService { } // check if transaction id was specified by user, otherwise generate a new one - protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws Exception { + protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws CatalogServiceException { return this.getCatalogServiceTransactionId(metadata, true); } http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java index f9bbd55..f2d629d 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java @@ -16,17 +16,15 @@ */ package org.apache.oodt.cas.catalog.util; -//JDK imports +import org.apache.oodt.cas.catalog.exception.CatalogException; +import org.apache.oodt.cas.catalog.system.Catalog; +import org.springframework.context.support.FileSystemXmlApplicationContext; + import java.util.HashSet; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -//OODT imports -import org.apache.oodt.cas.catalog.system.Catalog; - -//Spring imports -import org.springframework.context.support.FileSystemXmlApplicationContext; /** * @author bfoster @@ -37,7 +35,7 @@ public class SpringUtils { private static Logger LOG = Logger.getLogger(SpringUtils.class.getName()); - public static HashSet<Catalog> loadCatalogs(String catalogBeanRepo) throws Exception { + public static HashSet<Catalog> loadCatalogs(String catalogBeanRepo) throws CatalogException { FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(catalogBeanRepo); Map<String, Catalog> catalogsMap = appContext.getBeansOfType(Catalog.class); HashSet<Catalog> catalogs = new HashSet<Catalog>(); @@ -45,7 +43,8 @@ public class SpringUtils { Catalog curCatalog = catalogsMap.get(key); LOG.log(Level.INFO, "Loading catalog configuration for Catalog: '" + curCatalog + "'"); if (catalogs.contains(curCatalog)) - throw new Exception("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. **NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>"); + throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. " + + "**NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>"); catalogs.add(curCatalog); } return catalogs; http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java index a6b4eef..0b489be 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java @@ -478,7 +478,7 @@ public class DefaultProductSerializer implements ProductSerializer { private Document parseXml(String xml) throws IOException, SAXException, ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder parser = factoriy.newDocumentBuilder(); + DocumentBuilder parser = factory.newDocumentBuilder(); return parser.parse( new InputSource(new StringReader(xml)) ); } http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java index 2411f50..c8c8595 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java @@ -40,7 +40,7 @@ import org.apache.commons.io.FileUtils; * <p> * A tool to output HTML documentation for {@link ProductType} policy xml files. * </p>. - */o + */ public final class ProductTypeDocTool { private String xslFilePath; http://git-wip-us.apache.org/repos/asf/oodt/blob/249931a0/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java ---------------------------------------------------------------------- diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java index eb8242d..906b0e5 100644 --- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java +++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java @@ -16,18 +16,17 @@ */ package org.apache.oodt.cas.pge; -//JDK static imports -import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createPGETaskInstance; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.SerializableMetadata; +import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration; +import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException; -//JDK imports import java.io.File; +import java.io.IOException; import java.util.logging.Logger; -//OODT imports -import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration; -import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException; -import org.apache.oodt.cas.metadata.Metadata; -import org.apache.oodt.cas.metadata.SerializableMetadata; +import static org.apache.oodt.cas.pge.util.GenericPgeObjectFactory.createPGETaskInstance; + /** * Runs a {@link PGETaskInstance} given {@link Metadata} and a @@ -57,7 +56,7 @@ public class PGETask { pgeTaskInst.run(this.metadata, this.wftConfig); } - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws InstantiationException, IOException, WorkflowTaskInstanceException { String metadataFilePath = null, configPropertiesPath = null; String pgeTaskInstanceClasspath = null; String usage = "PGETask --instanceClass <PGETaskInstance> "
