http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java index 465a181..3f022d2 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java @@ -182,7 +182,7 @@ public class LuceneCatalog implements Catalog { metadataTypes.add(element.getElementName()); } } catch (ValidationLayerException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException( "ValidationLayerException when trying to obtain element list for product type: " + product.getProductType().getName() @@ -901,7 +901,7 @@ public class LuceneCatalog implements Catalog { retPage.setPageProducts(paginateQuery(query, type, pageNum, retPage)); return retPage; } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "CatalogException when doing paged product query: Message: " + e.getMessage()); @@ -1312,7 +1312,7 @@ public class LuceneCatalog implements Catalog { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IOException when opening index directory: [" + indexFilePath + "] for search: Message: "
http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java index 0948995..c25f759 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ScienceDataCatalog.java @@ -17,6 +17,18 @@ package org.apache.oodt.cas.filemgr.catalog; //JDK imports +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.ProductPage; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.structs.Query; +import org.apache.oodt.cas.filemgr.structs.Reference; +import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; +import org.apache.oodt.cas.filemgr.util.DbStructFactory; +import org.apache.oodt.cas.filemgr.validation.ValidationLayer; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.commons.date.DateUtils; +import org.apache.oodt.commons.pagination.PaginationUtils; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -27,23 +39,13 @@ import java.util.Enumeration; import java.util.List; import java.util.Vector; import java.util.logging.Level; -import javax.sql.DataSource; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.sql.DataSource; + //OODT imports -import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.ProductPage; -import org.apache.oodt.cas.filemgr.structs.ProductType; -import org.apache.oodt.cas.filemgr.structs.Query; -import org.apache.oodt.cas.filemgr.structs.Reference; -import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; -import org.apache.oodt.cas.filemgr.util.DbStructFactory; -import org.apache.oodt.cas.filemgr.validation.ValidationLayer; -import org.apache.oodt.cas.metadata.Metadata; -import org.apache.oodt.commons.date.DateUtils; -import org.apache.oodt.commons.pagination.PaginationUtils; /** * @@ -199,7 +201,7 @@ public class ScienceDataCatalog implements Catalog { } catch (Exception e) { LOG.log(Level.WARNING, "Exception adding product metadata. Message: " + e.getMessage()); - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e.getMessage(), e); } } @@ -418,7 +420,7 @@ public class ScienceDataCatalog implements Catalog { numProducts = rs.getInt("num_products"); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -461,7 +463,7 @@ public class ScienceDataCatalog implements Catalog { product = DbStructFactory.toScienceDataProduct(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -505,7 +507,7 @@ public class ScienceDataCatalog implements Catalog { product = DbStructFactory.toScienceDataProduct(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -553,7 +555,7 @@ public class ScienceDataCatalog implements Catalog { products.add(DbStructFactory.toScienceDataProduct(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -598,7 +600,7 @@ public class ScienceDataCatalog implements Catalog { products.add(DbStructFactory.toScienceDataProduct(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -656,7 +658,7 @@ public class ScienceDataCatalog implements Catalog { products.add(DbStructFactory.toScienceDataProduct(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -704,7 +706,7 @@ public class ScienceDataCatalog implements Catalog { products.add(DbStructFactory.toScienceDataProduct(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -972,7 +974,7 @@ public class ScienceDataCatalog implements Catalog { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception performing query. Message: " + e.getMessage()); try { @@ -1033,7 +1035,7 @@ public class ScienceDataCatalog implements Catalog { size = rs.getInt("result_size"); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -1082,7 +1084,7 @@ public class ScienceDataCatalog implements Catalog { startDateTime = DateUtils.toString(cal); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -1131,7 +1133,7 @@ public class ScienceDataCatalog implements Catalog { endDateTime = DateUtils.toString(cal); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/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 2e9c53b..27c6eae 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 @@ -21,6 +21,7 @@ import org.apache.oodt.cas.filemgr.structs.ProductType; import org.apache.oodt.cas.filemgr.structs.Reference; import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import org.apache.oodt.cas.metadata.Metadata; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -35,6 +36,8 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -54,7 +57,8 @@ import javax.xml.parsers.ParserConfigurationException; * */ public class DefaultProductSerializer implements ProductSerializer { - + + private static Logger LOG = Logger.getLogger(DefaultProductSerializer.class.getName()); /** * {@inheritDoc} */ @@ -163,7 +167,7 @@ public class DefaultProductSerializer implements ProductSerializer { return queryResponse; } catch(Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e.getMessage(), e); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java index 38094c6..66f7673 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; /** @@ -95,7 +96,7 @@ public class SolrClient { return response; } catch(Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e.getMessage()); } @@ -125,7 +126,7 @@ public class SolrClient { return doPost(url, message, Parameters.MIME_TYPE_XML); } catch(Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e.getMessage()); } @@ -220,7 +221,7 @@ public class SolrClient { return this.doGet(url, parameters, mimeType); } catch(Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java index 53cbedb..f3db53d 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java @@ -17,6 +17,22 @@ package org.apache.oodt.cas.filemgr.cli.action; //OODT static imports + +import org.apache.commons.lang.Validate; +import org.apache.oodt.cas.cli.exception.CmdLineActionException; +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.metadata.SerializableMetadata; + +import com.google.common.collect.Lists; + +import java.io.File; +import java.net.URI; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + import static org.apache.oodt.cas.filemgr.structs.Product.STRUCTURE_HIERARCHICAL; import static org.apache.oodt.cas.filemgr.structs.Product.STRUCTURE_STREAM; import static org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory.getDataTransferServiceFromFactory; @@ -24,22 +40,9 @@ import static org.apache.oodt.cas.filemgr.versioning.VersioningUtils.addRefsFrom import static org.apache.oodt.cas.filemgr.versioning.VersioningUtils.getURIsFromDir; //JDK imports -import java.io.File; -import java.net.URI; -import java.util.List; - //Apache imports -import org.apache.commons.lang.Validate; - //OODT imports -import org.apache.oodt.cas.cli.exception.CmdLineActionException; -import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.ProductType; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; -import org.apache.oodt.cas.metadata.SerializableMetadata; - //Google imports -import com.google.common.collect.Lists; /** * A {@link CmdLineAction} which ingests a {@link Product}. @@ -47,7 +50,7 @@ import com.google.common.collect.Lists; * @author bfoster (Brian Foster) */ public class IngestProductCliAction extends FileManagerCliAction { - + private static Logger LOG = Logger.getLogger(IngestProductCliAction.class.getName()); private String productName; private String productStructure; private String productTypeName; @@ -115,7 +118,7 @@ public class IngestProductCliAction extends FileManagerCliAction { new SerializableMetadata(getUri(metadataFile).toURL() .openStream()), dataTransferer != null)); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CmdLineActionException("Failed to ingest product '" + productName + "' : " + e.getMessage(), e); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java index 5ea4edb..200813c 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java @@ -85,7 +85,7 @@ public class LocalDataTransferer implements DataTransfer { LOG.log(Level.INFO, "Local Data Transfer to: [" + client.getFileManagerUrl().toString() + "] enabled"); } catch (ConnectionException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -197,7 +197,7 @@ public class LocalDataTransferer implements DataTransfer { .create(System .getProperty("org.apache.oodt.cas.filemgr.mime.type.repository")); } catch (MimeTypeException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new IOException(e.getMessage()); } @@ -407,7 +407,7 @@ public class LocalDataTransferer implements DataTransfer { try { client.transferringProduct(p); } catch (DataTransferException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error notifying file manager of product transfer initiation for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); @@ -424,7 +424,7 @@ public class LocalDataTransferer implements DataTransfer { try { client.removeProductTransferStatus(p); } catch (DataTransferException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error notifying file manager of product transfer completion for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java index e873b8d..bf8b7e9 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java @@ -261,7 +261,7 @@ public class RemoteDataTransferer implements DataTransfer { try { client.transferringProduct(p); } catch (DataTransferException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error notifying file manager of product transfer initiation for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); @@ -272,7 +272,7 @@ public class RemoteDataTransferer implements DataTransfer { try { client.removeProductTransferStatus(p); } catch (DataTransferException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error notifying file manager of product transfer completion for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java index 95723bb..1371fa2 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java @@ -174,7 +174,7 @@ public class TransferStatusTracker { try { refs = catalog.getProductReferences(p); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error retreiving references for product: [" + p.getProductId() + "] from catalog in transfer status tracker: Message: " http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java index f6df8a2..7419304 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java @@ -18,13 +18,17 @@ package org.apache.oodt.cas.filemgr.ingest; //OODT imports + import org.apache.oodt.cas.filemgr.structs.exceptions.CacheException; -//JDK imports import java.net.URL; import java.rmi.Naming; import java.rmi.RemoteException; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @author mattmann @@ -37,14 +41,14 @@ import java.util.List; * </p>. */ public class RmiCache implements Cache { - + private static Logger LOG = Logger.getLogger(RmiCache.class.getName()); private RemoteableCache rmiCacheServer; public RmiCache(String rmiCacheServerUrn) throws InstantiationException { try { rmiCacheServer = (RemoteableCache) Naming.lookup(rmiCacheServerUrn); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new InstantiationException( "Unable to connect to Rmi Cache Server at: [" + rmiCacheServerUrn + "]"); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java index 8d4ab10..635ae4f 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java @@ -18,9 +18,9 @@ package org.apache.oodt.cas.filemgr.ingest; //OODT imports + import org.apache.oodt.cas.filemgr.structs.exceptions.CacheException; -//JDK imports import java.io.Serializable; import java.net.URL; import java.rmi.Naming; @@ -29,6 +29,10 @@ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @@ -40,6 +44,7 @@ import java.util.List; */ public class RmiCacheServer extends UnicastRemoteObject implements RemoteableCache, Serializable{ + private static Logger LOG = Logger.getLogger(RmiCacheServer.class.getName()); private static final long serialVersionUID = -538329403363156379L; private LocalCache cache; @@ -77,7 +82,7 @@ public class RmiCacheServer extends UnicastRemoteObject implements RemoteableCac Naming.unbind("rmi://localhost:" + port + "/RmiDatabaseServer"); UnicastRemoteObject.unexportObject(reg,true); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new RemoteException( "Unable to unbind Database Server: reason: " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java index 2ad6aef..b3da4e1 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java @@ -100,7 +100,7 @@ public class StdIngester implements Ingester, CoreMetKeys { try { met = extractor.extractMetadata(prodFile, metConfFile); } catch (MetExtractionException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new IngestException("Met extraction exception on product: [" + prodFile + "]: Message: " + e.getMessage(), e); } @@ -210,7 +210,7 @@ public class StdIngester implements Ingester, CoreMetKeys { try { productID = fmClient.ingestProduct(product, met, true); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "exception ingesting product: [" + productName + "]: Message: " + e.getMessage()); throw new IngestException("exception ingesting product: [" @@ -267,7 +267,7 @@ public class StdIngester implements Ingester, CoreMetKeys { .setDataTransfer(GenericFileManagerObjectFactory .getDataTransferServiceFromFactory(this.clientTransferServiceFactory)); } catch (ConnectionException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Unable to connect to file manager: [" + url + "]: message: " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java index e2c4e1d..9d415f2 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java @@ -18,6 +18,7 @@ package org.apache.oodt.cas.filemgr.metadata.extractors; //JDK imports + import org.apache.oodt.cas.filemgr.structs.Product; import org.apache.oodt.cas.filemgr.structs.Reference; import org.apache.oodt.cas.metadata.Metadata; @@ -28,6 +29,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; //OODT imports @@ -42,7 +45,7 @@ import java.util.Properties; */ public abstract class AbstractFilemgrMetExtractor implements FilemgrMetExtractor { - + private static Logger LOG = Logger.getLogger(AbstractFilemgrMetExtractor.class.getName()); protected Properties configuration; /* @@ -118,7 +121,7 @@ public abstract class AbstractFilemgrMetExtractor implements .getProductReferences(), product.getProductType() .getProductRepositoryPath())); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new MetExtractionException("URI exception parsing: [" + product.getRootRef().getOrigReference() + "]"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java index 6612acd..f714b43 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java @@ -124,7 +124,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception adding product type. Message: " + e.getMessage()); try { @@ -201,7 +201,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception modifying product type. Message: " + e.getMessage()); @@ -268,7 +268,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception removing product type. Message: " + e.getMessage()); try { @@ -331,7 +331,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception getting product type. Message: " + e.getMessage()); try { @@ -404,7 +404,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception getting product type. Message: " + e.getMessage()); try { @@ -481,7 +481,7 @@ public class DataSourceRepositoryManager implements RepositoryManager { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception getting product types. Message: " + e.getMessage()); try { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/ScienceDataRepositoryManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/ScienceDataRepositoryManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/ScienceDataRepositoryManager.java index a7d988a..3b037c0 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/ScienceDataRepositoryManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/ScienceDataRepositoryManager.java @@ -77,7 +77,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -122,7 +122,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { productType = DbStructFactory.toScienceDataProductType(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -174,7 +174,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { productType = DbStructFactory.toScienceDataProductType(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -223,7 +223,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { productTypes.add(DbStructFactory.toScienceDataProductType(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -272,7 +272,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -312,7 +312,7 @@ public class ScienceDataRepositoryManager implements RepositoryManager { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java index b041f5d..7811c70 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java @@ -18,6 +18,7 @@ package org.apache.oodt.cas.filemgr.structs; //OODT imports + import org.apache.oodt.cas.metadata.util.PathUtils; import org.apache.tika.Tika; import org.apache.tika.config.TikaConfig; @@ -26,9 +27,12 @@ import org.apache.tika.mime.MimeTypeException; import org.apache.tika.mime.MimeTypes; import org.apache.tika.mime.MimeTypesFactory; -//JDK imports import java.io.File; import java.io.FileInputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @author mattmann @@ -42,7 +46,7 @@ import java.io.FileInputStream; * */ public class Reference { - + private static Logger LOG = Logger.getLogger(Reference.class.getName()); /* the item's original location */ private String origReference = null; @@ -115,7 +119,7 @@ public class Reference { try { this.mimeType = mimeTypeRepository.forName(new Tika().detect(origRef)); } catch (MimeTypeException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -216,7 +220,7 @@ public class Reference { try { this.mimeType = mimeTypeRepository.forName(name); } catch (MimeTypeException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java index 3c2a17e..a8af882 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java @@ -150,7 +150,7 @@ public class XmlRpcFileManager { this.loadConfiguration(); status = true; } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG .log( Level.SEVERE, @@ -202,7 +202,7 @@ public class XmlRpcFileManager { try { pct = transferStatusTracker.getPctTransferred(reference); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception getting transfer percentage for ref: [" + reference.getOrigReference() + "]: Message: " @@ -245,7 +245,7 @@ public class XmlRpcFileManager { setProductType(prodPage.getPageProducts()); } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Catalog exception performing paged query for product type: [" + type.getProductTypeId() + "] query: [" + query @@ -349,7 +349,7 @@ public class XmlRpcFileManager { try { numProducts = catalog.getNumProducts(type); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception when getting num products: Message: " + e.getMessage()); @@ -367,7 +367,7 @@ public class XmlRpcFileManager { topNProducts = catalog.getTopNProducts(n); return XmlRpcStructFactory.getXmlRpcProductList(topNProducts); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception when getting topN products: Message: " + e.getMessage()); @@ -386,7 +386,7 @@ public class XmlRpcFileManager { topNProducts = catalog.getTopNProducts(n, type); return XmlRpcStructFactory.getXmlRpcProductList(topNProducts); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception when getting topN products by product type: [" + type.getProductTypeId() + "]: Message: " @@ -424,7 +424,7 @@ public class XmlRpcFileManager { return XmlRpcStructFactory .getXmlRpcProductTypeList(productTypeList); } catch (RepositoryManagerException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain product types from repository manager: Message: " + e.getMessage()); @@ -442,7 +442,7 @@ public class XmlRpcFileManager { referenceList = catalog.getProductReferences(product); return XmlRpcStructFactory.getXmlRpcReferences(referenceList); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain references for product: [" + product.getProductName() + "]: Message: " + e.getMessage()); @@ -466,12 +466,12 @@ public class XmlRpcFileManager { .getProductTypeId())); return XmlRpcStructFactory.getXmlRpcProduct(product); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain product by id: [" + productId + "]: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } catch (RepositoryManagerException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain product type by id: [" + product.getProductType().getProductTypeId() + "]: Message: " + e.getMessage()); @@ -495,12 +495,12 @@ public class XmlRpcFileManager { .getProductTypeId())); return XmlRpcStructFactory.getXmlRpcProduct(product); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain product by name: [" + productName + "]: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } catch (RepositoryManagerException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Unable to obtain product type by id: [" + product.getProductType().getProductTypeId() + "]: Message: " + e.getMessage()); @@ -519,7 +519,7 @@ public class XmlRpcFileManager { productList = catalog.getProductsByProductType(type); return XmlRpcStructFactory.getXmlRpcProductList(productList); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception obtaining products by product type for type: [" + type.getName() + "]: Message: " + e.getMessage()); @@ -538,7 +538,7 @@ public class XmlRpcFileManager { elementList = catalog.getValidationLayer().getElements(type); return XmlRpcStructFactory.getXmlRpcElementList(elementList); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception obtaining elements for product type: [" + type.getName() + "]: Message: " + e.getMessage()); @@ -555,7 +555,7 @@ public class XmlRpcFileManager { element = catalog.getValidationLayer().getElementById(elementId); return XmlRpcStructFactory.getXmlRpcElement(element); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "exception retrieving element by id: [" + elementId + "]: Message: " + e.getMessage()); throw new ValidationLayerException(e.getMessage(), e); @@ -571,7 +571,7 @@ public class XmlRpcFileManager { .getElementByName(elementName); return XmlRpcStructFactory.getXmlRpcElement(element); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "exception retrieving element by name: [" + elementName + "]: Message: " + e.getMessage()); throw new ValidationLayerException(e.getMessage(), e); @@ -633,7 +633,7 @@ public class XmlRpcFileManager { return XmlRpcStructFactory.getXmlRpcQueryResults(queryResults); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException("Failed to perform complex query : " + e.getMessage(), e); } @@ -664,7 +664,7 @@ public class XmlRpcFileManager { type = repositoryManager.getProductTypeById(productTypeId); return XmlRpcStructFactory.getXmlRpcProductType(type); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception obtaining product type by id for product type: [" + productTypeId + "]: Message: " + e.getMessage()); @@ -772,7 +772,7 @@ public class XmlRpcFileManager { // that's it! return p.getProductId(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException("Error ingesting product [" + p + "] : " + e.getMessage(),e); } @@ -820,7 +820,7 @@ public class XmlRpcFileManager { try { fOut = new FileOutputStream(outFile, true); } catch (FileNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "FileNotFoundException when trying to use RandomAccess file on " + filePath + ": Message: " + e.getMessage()); @@ -837,7 +837,7 @@ public class XmlRpcFileManager { try { fOut = new FileOutputStream(outFile, false); } catch (FileNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "FileNotFoundException when trying to use RandomAccess file on " + filePath + ": Message: " + e.getMessage()); @@ -849,7 +849,7 @@ public class XmlRpcFileManager { try { fOut.write(fileData, (int) offset, (int) numBytes); } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "IOException when trying to write file " + filePath + ": Message: " + e.getMessage()); success = false; @@ -1074,7 +1074,7 @@ public class XmlRpcFileManager { + ": Message: " + e.getMessage()); throw e; } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "ingestProduct: General Exception when adding metadata " + metadata + " for product: " + p.getProductName() @@ -1172,7 +1172,7 @@ public class XmlRpcFileManager { return new Vector<Product>(); // null values not supported by XML-RPC } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception performing query against catalog for product type: [" + productType.getName() + "] Message: " + e.getMessage()); @@ -1193,7 +1193,7 @@ public class XmlRpcFileManager { } return this.getOrigValues(m, product.getProductType()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception obtaining metadata from catalog for product: [" + product.getProductId() + "]: Message: " @@ -1210,7 +1210,7 @@ public class XmlRpcFileManager { } return this.getOrigValues(m, product.getProductType()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Exception obtaining metadata from catalog for product: [" + product.getProductId() + "]: Message: " http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java index 9bf6f1d..a1828c3 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java @@ -999,7 +999,7 @@ public class XmlRpcFileManagerClient { return XmlRpcStructFactory .getQueryResultsFromXmlRpc(queryResultHashVector); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e); } } @@ -1021,11 +1021,11 @@ public class XmlRpcFileManagerClient { productVector = (Vector<Hashtable<String, Object>>) client.execute( "filemgr.query", argList); } catch (XmlRpcException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e); } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new CatalogException(e); } @@ -1277,7 +1277,7 @@ public class XmlRpcFileManagerClient { // error versioning file } catch (VersioningException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "ingestProduct: VersioningException when versioning Product: " + product.getProductName() + " with Versioner " http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java index 79d0ab7..9ac780c 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java @@ -42,6 +42,8 @@ import java.io.InputStreamReader; import java.net.URL; import java.util.StringTokenizer; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -54,7 +56,7 @@ import java.util.Vector; * */ public class CatalogSearch { - + private static Logger LOG = Logger.getLogger(CatalogSearch.class.getName()); private static QueryParser parser; private static XmlRpcFileManagerClient client; @@ -74,7 +76,7 @@ public class CatalogSearch { } catch (RepositoryManagerException e) { System.out .println("Error getting available product types from the File Manager."); - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } for (Object product : products) { PostQuery(((ProductType) product).getProductTypeId(), @@ -98,7 +100,7 @@ public class CatalogSearch { results = (Vector) client.query(casQuery, productType); } catch (CatalogException ignore) { System.out.println("Error querying the File Manager"); - ignore.printStackTrace(); + LOG.log(Level.SEVERE, ignore.getMessage()); System.exit(-1); } @@ -138,7 +140,7 @@ public class CatalogSearch { } catch (RepositoryManagerException e) { System.out .println("Error getting available product types from the File Manager."); - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } for (Object product : products) { System.out.print(((ProductType) product).getProductTypeId() @@ -157,7 +159,7 @@ public class CatalogSearch { } catch (RepositoryManagerException e) { System.out .println("Error getting available product types from the File Manager."); - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -174,7 +176,7 @@ public class CatalogSearch { + prodID); } catch (ValidationLayerException e) { // TODO Auto-generated catch block - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } for (Object element : elements) { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java index 982c11b..28f6742 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java @@ -50,6 +50,7 @@ import java.util.logging.Logger; */ public class ExpImpCatalog { + /* the client to the source catalog to export */ private XmlRpcFileManagerClient sourceClient = null; @@ -435,7 +436,7 @@ public class ExpImpCatalog { try { return (destCatalog.getProductByName(productName) != null); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG .log(Level.WARNING, "Exceptiong checking for product type by name: [" @@ -447,7 +448,7 @@ public class ExpImpCatalog { try { return destClient.hasProduct(productName); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG .log(Level.WARNING, "Exceptiong checking for product type by name: [" http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/GenericFileManagerObjectFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/GenericFileManagerObjectFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/GenericFileManagerObjectFactory.java index 640cd80..747be50 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/GenericFileManagerObjectFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/GenericFileManagerObjectFactory.java @@ -18,17 +18,8 @@ package org.apache.oodt.cas.filemgr.util; //JDK imports -import java.util.logging.Level; -import java.util.logging.Logger; - - - - - - - - -//OODT imports +import org.apache.oodt.cas.filemgr.catalog.Catalog; +import org.apache.oodt.cas.filemgr.catalog.CatalogFactory; import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer; import org.apache.oodt.cas.filemgr.datatransfer.DataTransferFactory; import org.apache.oodt.cas.filemgr.ingest.Cache; @@ -39,12 +30,15 @@ import org.apache.oodt.cas.filemgr.repository.RepositoryManagerFactory; import org.apache.oodt.cas.filemgr.structs.query.conv.VersionConverter; import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor; import org.apache.oodt.cas.filemgr.structs.type.TypeHandler; -import org.apache.oodt.cas.filemgr.catalog.Catalog; -import org.apache.oodt.cas.filemgr.catalog.CatalogFactory; import org.apache.oodt.cas.filemgr.validation.ValidationLayer; import org.apache.oodt.cas.filemgr.validation.ValidationLayerFactory; import org.apache.oodt.cas.filemgr.versioning.Versioner; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports + /** * @author mattmann * @author bfoster @@ -89,17 +83,17 @@ public final class GenericFileManagerObjectFactory { dataTransferFactory = dataTransferFactoryClass.newInstance(); return dataTransferFactory.createDataTransfer(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading data transfer factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading data transfer factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading data transfer factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -130,17 +124,17 @@ public final class GenericFileManagerObjectFactory { factory = clazz.newInstance(); return factory.createRepositoryManager(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading data store factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading data store factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading data store factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -170,17 +164,17 @@ public final class GenericFileManagerObjectFactory { factory = clazz.newInstance(); return factory.createCatalog(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading metadata store factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading metadata store factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading metadata store factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -212,17 +206,17 @@ public final class GenericFileManagerObjectFactory { factory = clazz.newInstance(); return factory.createValidationLayer(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading validation layer factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading validation layer factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading validation layer factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -241,17 +235,17 @@ public final class GenericFileManagerObjectFactory { factory = clazz.newInstance(); return factory.createCache(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading cache factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading cache factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading cache factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -276,17 +270,17 @@ public final class GenericFileManagerObjectFactory { Class<Versioner> versionerClass = (Class<Versioner>) Class.forName(className); return versionerClass.newInstance(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading versioner class " + className + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading versioner class " + className + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading versioner class " + className + " Message: " + e.getMessage()); @@ -301,17 +295,17 @@ public final class GenericFileManagerObjectFactory { Class<FilemgrMetExtractor> extractorClass = (Class<FilemgrMetExtractor>) Class.forName(className); return extractorClass.newInstance(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading extractor class " + className + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading extractor class " + className + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading extractor class " + className + " Message: " + e.getMessage()); @@ -323,7 +317,7 @@ public final class GenericFileManagerObjectFactory { try { return (TypeHandler) Class.forName(className).newInstance(); }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Failed to load TypeHandler class '" + className + "' : " + e.getMessage()); } return null; @@ -333,7 +327,7 @@ public final class GenericFileManagerObjectFactory { try { return (FilterAlgor) Class.forName(className).newInstance(); }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Failed to load TypeHandler class '" + className + "' : " + e.getMessage()); } return null; @@ -343,7 +337,7 @@ public final class GenericFileManagerObjectFactory { try { return (VersionConverter) Class.forName(className).newInstance(); }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Failed to load TypeHandler class '" + className + "' : " + e.getMessage()); } return null; http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java index 37f9a24..0e1d35f 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java @@ -18,6 +18,7 @@ package org.apache.oodt.cas.filemgr.util; //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; @@ -27,15 +28,17 @@ import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; import org.apache.oodt.cas.filemgr.structs.query.QueryFilter; import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor; - -//JDK imports import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Stack; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +//JDK imports + /** * * @author bfoster @@ -72,7 +75,8 @@ import java.util.regex.Pattern; * </p> */ public class SqlParser { - + + private static Logger LOG = Logger.getLogger(SqlParser.class.getName()); private SqlParser() { } @@ -97,7 +101,7 @@ public class SqlParser { return complexQuery; }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new QueryFormulationException("Failed to parse SQL method : " + e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java index 71e76e5..dd0a68e 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java @@ -192,7 +192,7 @@ public final class XmlStructFactory { typeHandler.setElementName(elementName); handlers.add(typeHandler); }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Failed to load handler for ProductType [name = " + name + "] and element [name = " + elementName + "] : " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java index 189b0af..c0fc972 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/DataSourceValidationLayer.java @@ -108,7 +108,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG .log(Level.WARNING, "Exception adding element " + element.getElementName() + ". Message: " @@ -178,7 +178,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception modifying element. Message: " + e.getMessage()); try { @@ -237,7 +237,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception removing element. Message: " + e.getMessage()); try { @@ -302,7 +302,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception adding element " + element.getElementName() + " to product type " + type.getName() + " . Message: " + e.getMessage()); @@ -369,7 +369,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception removing element " + element.getElementName() + " from product type " + type.getName() + ". Message: " + e.getMessage()); @@ -428,7 +428,7 @@ public class DataSourceValidationLayer implements ValidationLayer { statement.execute(addParentInfoSql); conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception adding parent info to product type " + type.getName() + " . Message: " + e.getMessage()); @@ -487,7 +487,7 @@ public class DataSourceValidationLayer implements ValidationLayer { conn.commit(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception removing parent from product type " + type.getName() + ". Message: " + e.getMessage()); @@ -560,7 +560,7 @@ public class DataSourceValidationLayer implements ValidationLayer { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception reading elements. Message: " + e.getMessage()); throw new ValidationLayerException(e); @@ -616,7 +616,7 @@ public class DataSourceValidationLayer implements ValidationLayer { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception reading product parent. Message: " + e.getMessage()); @@ -680,7 +680,7 @@ public class DataSourceValidationLayer implements ValidationLayer { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception reading elements. Message: " + e.getMessage()); throw new ValidationLayerException(e); @@ -744,7 +744,7 @@ public class DataSourceValidationLayer implements ValidationLayer { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception reading element. Message: " + e.getMessage()); throw new ValidationLayerException(e); @@ -808,7 +808,7 @@ public class DataSourceValidationLayer implements ValidationLayer { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception reading element. Message: " + e.getMessage()); throw new ValidationLayerException(e); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/ScienceDataValidationLayer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/ScienceDataValidationLayer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/ScienceDataValidationLayer.java index 2a13c93..8f76091 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/ScienceDataValidationLayer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/ScienceDataValidationLayer.java @@ -19,21 +19,25 @@ package org.apache.oodt.cas.filemgr.validation; //OODT imports + import org.apache.oodt.cas.filemgr.structs.Element; import org.apache.oodt.cas.filemgr.structs.ProductType; import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException; import org.apache.oodt.cas.filemgr.util.DbStructFactory; -//JDK imports import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.List; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.sql.DataSource; +//JDK imports + /** * @@ -46,6 +50,7 @@ import javax.sql.DataSource; */ public class ScienceDataValidationLayer implements ValidationLayer { + private static Logger LOG = Logger.getLogger(ScienceDataValidationLayer.class.getName()); private DataSource ds; public ScienceDataValidationLayer(DataSource ds) { @@ -73,7 +78,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -112,7 +117,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -155,7 +160,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { element = DbStructFactory.toScienceDataElement(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -207,7 +212,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { element = DbStructFactory.toScienceDataElement(rs); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -255,7 +260,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { elements.add(DbStructFactory.toScienceDataElement(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -306,7 +311,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { elements.add(DbStructFactory.toScienceDataElement(rs)); } } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (rs != null) { try { @@ -355,7 +360,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -394,7 +399,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { @@ -436,7 +441,7 @@ public class ScienceDataValidationLayer implements ValidationLayer { statement = conn.createStatement(); statement.execute(sql); } catch (SQLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (statement != null) { try { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java index c3c211d..a13a2be 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java @@ -92,7 +92,7 @@ public final class VersioningUtils { r.setFileSize(dir.length()); references.add(r); } catch (MalformedURLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "MalformedURLException when generating reference for dir: " + dir); @@ -109,7 +109,7 @@ public final class VersioningUtils { r.setFileSize(file.length()); references.add(r); } catch (MalformedURLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "MalformedURLException when generating reference for file: " + file); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestDataSourceCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestDataSourceCatalog.java b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestDataSourceCatalog.java index 76ee6e3..766acd0 100644 --- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestDataSourceCatalog.java +++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestDataSourceCatalog.java @@ -19,8 +19,13 @@ package org.apache.oodt.cas.filemgr.catalog; //JDK imports + import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; -import org.apache.oodt.cas.filemgr.structs.*; +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.ProductPage; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.structs.Query; +import org.apache.oodt.cas.filemgr.structs.Reference; import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import org.apache.oodt.cas.filemgr.util.SqlParser; import org.apache.oodt.cas.metadata.Metadata; @@ -33,6 +38,8 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.sql.DataSource; @@ -52,6 +59,7 @@ import static org.junit.Assert.assertThat; */ public class TestDataSourceCatalog extends TestCase { + private static Logger LOG = Logger.getLogger(TestDataSourceCatalog.class.getName()); protected Catalog myCat; private String tmpDirPath = null; @@ -317,7 +325,7 @@ public class TestDataSourceCatalog extends TestCase { try { myCat.addProduct(testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -349,7 +357,7 @@ public class TestDataSourceCatalog extends TestCase { try { myCat.addMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -375,14 +383,14 @@ public class TestDataSourceCatalog extends TestCase { try { myCat.addMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } try { myCat.removeMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -410,7 +418,7 @@ public class TestDataSourceCatalog extends TestCase { try { myCat.addProductReferences(testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -518,7 +526,7 @@ public class TestDataSourceCatalog extends TestCase { try { myCat.addProduct(testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -573,7 +581,7 @@ public class TestDataSourceCatalog extends TestCase { coreSchemaScript.loadScript(); coreSchemaScript.execute(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestLuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestLuceneCatalog.java b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestLuceneCatalog.java index 4e30b40..545d6bf 100644 --- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestLuceneCatalog.java +++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/catalog/TestLuceneCatalog.java @@ -18,12 +18,19 @@ package org.apache.oodt.cas.filemgr.catalog; -import com.google.common.collect.Lists; - import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; -import org.apache.oodt.cas.filemgr.structs.*; +import org.apache.oodt.cas.filemgr.structs.BooleanQueryCriteria; +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.ProductPage; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.structs.Query; +import org.apache.oodt.cas.filemgr.structs.Reference; +import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria; import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import org.apache.oodt.cas.metadata.Metadata; + +import com.google.common.collect.Lists; + import org.hamcrest.CoreMatchers; import org.junit.Assert; @@ -33,6 +40,8 @@ import java.net.URL; import java.util.List; import java.util.Properties; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; import junit.framework.TestCase; @@ -47,7 +56,7 @@ import junit.framework.TestCase; * </p>. */ public class TestLuceneCatalog extends TestCase { - + private static Logger LOG = Logger.getLogger(TestLuceneCatalog.class.getName()); private LuceneCatalog myCat; private String tmpDirPath = null; @@ -446,7 +455,7 @@ public class TestLuceneCatalog extends TestCase { Product retProd = myCat.getTopNProducts(5).get(0); assertEquals("test", retProd.getProductName()); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -809,7 +818,7 @@ public class TestLuceneCatalog extends TestCase { Product retProd = myCat.getTopNProducts(5, type).get(0); assertEquals("test", retProd.getProductName()); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -825,7 +834,7 @@ public class TestLuceneCatalog extends TestCase { myCat.getTopNProducts(20); } catch(Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -837,7 +846,7 @@ public class TestLuceneCatalog extends TestCase { myCat.addProduct(testProduct); myCat.addMetadata(getTestMetadata("tempProduct"), testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -868,7 +877,7 @@ public class TestLuceneCatalog extends TestCase { myCat.addProduct(testProduct); myCat.addMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -894,14 +903,14 @@ public class TestLuceneCatalog extends TestCase { myCat.addProduct(testProduct); myCat.addMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } try { myCat.removeMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } @@ -910,7 +919,7 @@ public class TestLuceneCatalog extends TestCase { String retValue = retMet.getMetadata("Filename"); assertNull(retValue); } catch (CatalogException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -933,7 +942,7 @@ public class TestLuceneCatalog extends TestCase { myCat.addProduct(testProduct); myCat.addMetadata(met, testProduct); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -944,7 +953,7 @@ public class TestLuceneCatalog extends TestCase { try{ bqc.setOperator(BooleanQueryCriteria.AND); }catch (Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } TermQueryCriteria tqc = new TermQueryCriteria(); @@ -953,7 +962,7 @@ public class TestLuceneCatalog extends TestCase { try{ bqc.addTerm(tqc); }catch (Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } tqc = new TermQueryCriteria(); @@ -962,7 +971,7 @@ public class TestLuceneCatalog extends TestCase { try{ bqc.addTerm(tqc); }catch (Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } query.addCriterion(bqc); @@ -972,7 +981,7 @@ public class TestLuceneCatalog extends TestCase { try{ page = myCat.pagedQuery(query, testProduct.getProductType(), 1); }catch (Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } assertEquals(page.getPageProducts().size(), 1);
