Author: bfoster
Date: Wed Apr  6 04:40:47 2011
New Revision: 1089295

URL: http://svn.apache.org/viewvc?rev=1089295&view=rev
Log:

- introduced TemporalProduct

-------------------

Added:
    
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java
   (with props)
Modified:
    
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ColumnBasedDataSourceCatalog.java
    
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/CatalogServiceUtils.java
    
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/FilemgrCatalogIndex.java
    
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java

Modified: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ColumnBasedDataSourceCatalog.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ColumnBasedDataSourceCatalog.java?rev=1089295&r1=1089294&r2=1089295&view=diff
==============================================================================
--- 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ColumnBasedDataSourceCatalog.java
 (original)
+++ 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/ColumnBasedDataSourceCatalog.java
 Wed Apr  6 04:40:47 2011
@@ -24,6 +24,7 @@ import org.apache.oodt.cas.filemgr.struc
 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.TemporalProduct;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.util.SqlParser;
 import org.apache.oodt.cas.filemgr.validation.ValidationLayer;
@@ -614,7 +615,7 @@ public class ColumnBasedDataSourceCatalo
             rs = statement.executeQuery(getProductSql);
 
             if (rs.next()) {
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductId(rs.getString("ProductId"));
                product.setProductName(rs.getString("ProductName"));
                product.setProductStructure(rs.getString("ProductStructure"));
@@ -670,7 +671,7 @@ public class ColumnBasedDataSourceCatalo
             rs = statement.executeQuery(getProductSql);
 
             if (rs.next()) {
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductId(rs.getString("ProductId"));
                product.setProductName(rs.getString("ProductName"));
                product.setProductStructure(rs.getString("ProductStructure"));
@@ -778,7 +779,7 @@ public class ColumnBasedDataSourceCatalo
             products = new Vector<Product>();
 
             while (rs.next()) {
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductId(rs.getString("ProductId"));
                product.setProductName(rs.getString("ProductName"));
                product.setProductStructure(rs.getString("ProductStructure"));
@@ -833,7 +834,7 @@ public class ColumnBasedDataSourceCatalo
             
             Vector<Product> products = new Vector<Product>();
             while (rs.next()) {
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductId(rs.getString("ProductId"));
                product.setProductName(rs.getString("ProductName"));
                product.setProductStructure(rs.getString("ProductStructure"));
@@ -1171,7 +1172,7 @@ public class ColumnBasedDataSourceCatalo
             
             Vector<Product> products = new Vector<Product>();
             while (rs.next()) {
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductId(rs.getString("ProductId"));
                product.setProductName(rs.getString("ProductName"));
                product.setProductStructure(rs.getString("ProductStructure"));

Modified: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/CatalogServiceUtils.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/CatalogServiceUtils.java?rev=1089295&r1=1089294&r2=1089295&view=diff
==============================================================================
--- 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/CatalogServiceUtils.java
 (original)
+++ 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/CatalogServiceUtils.java
 Wed Apr  6 04:40:47 2011
@@ -39,6 +39,7 @@ import org.apache.oodt.cas.filemgr.struc
 import org.apache.oodt.cas.filemgr.structs.QueryCriteria;
 import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria;
 import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.TemporalProduct;
 import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria;
 import 
org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException;
 import org.apache.oodt.cas.filemgr.structs.mime.MimeType;
@@ -137,7 +138,7 @@ public class CatalogServiceUtils {
                                
rootRef.setFileSize(Long.parseLong(termBucket.getTermByName(CoreMetKeys.PRODUCT_ROOT_REF_FILE_SIZE).getFirstValue()));
                        rootRef.setMimeType(safeReadTermValue(termBucket, 
CoreMetKeys.PRODUCT_ROOT_REF_MIME_TYPE));
                }
-               Product product = new Product();
+               TemporalProduct product = new TemporalProduct();
                product.setProductName(productName);
                product.setProductType(productType);
                product.setProductId(productId);
@@ -201,8 +202,8 @@ public class CatalogServiceUtils {
                        metadata.replaceMetadata(CoreMetKeys.PRODUCT_STRUCTURE, 
product.getProductStructure());
                if (product.getTransferStatus() != null)
                        metadata.replaceMetadata(CoreMetKeys.PRODUCT_STATUS, 
product.getTransferStatus());
-               if (product.getProductReceivedTime() != null)
-                       
metadata.replaceMetadata(CoreMetKeys.PRODUCT_RECEVIED_TIME, 
DateConvert.isoFormat(product.getProductReceivedTime()));
+               if (product instanceof TemporalProduct && ((TemporalProduct) 
product).getProductReceivedTime() != null)
+                       
metadata.replaceMetadata(CoreMetKeys.PRODUCT_RECEVIED_TIME, 
DateConvert.isoFormat(((TemporalProduct) product).getProductReceivedTime()));
                metadata.replaceMetadata(CoreMetKeys.PRODUCT_TYPE, 
product.getProductType().getName());
                if (product.getRootRef() != null) {
                        
metadata.replaceMetadata(CoreMetKeys.PRODUCT_ROOT_REF_ORIG, 
product.getRootRef().getOrigReference());

Modified: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/FilemgrCatalogIndex.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/FilemgrCatalogIndex.java?rev=1089295&r1=1089294&r2=1089295&view=diff
==============================================================================
--- 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/FilemgrCatalogIndex.java
 (original)
+++ 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/catalogservice/FilemgrCatalogIndex.java
 Wed Apr  6 04:40:47 2011
@@ -49,6 +49,7 @@ import org.apache.oodt.cas.filemgr.catal
 import org.apache.oodt.cas.filemgr.catalog.CatalogFactory;
 import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
 import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.TemporalProduct;
 import org.apache.oodt.cas.filemgr.structs.ProductPage;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.Query;
@@ -300,7 +301,7 @@ public class FilemgrCatalogIndex impleme
 //                     if (productReceivedTime == null)
 //                             
metadata.replaceMetadata(CoreMetKeys.PRODUCT_RECEVIED_TIME, 
DateConvert.isoFormat(new Date()));
 //                     metadata.replaceMetadata(CoreMetKeys.PRODUCT_ID, 
product.getProductId());
-                       return new 
IngestReceipt(this.generateTransactionId(product.getProductId()), 
product.getProductReceivedTime());
+                       return new 
IngestReceipt(this.generateTransactionId(product.getProductId()), (product 
instanceof TemporalProduct ? ((TemporalProduct) 
product).getProductReceivedTime() : new Date()));
                }catch (Exception e) {
                        throw new IngestServiceException("Failed to Ingest 
Product for TransactionId: " + transactionId, e);
                }
@@ -446,7 +447,7 @@ public class FilemgrCatalogIndex impleme
 //                     for (Metadata metadata : metadatas) 
 //                             ingestReceipts.add(generateReceipt(metadata));
                        for (Product product : products)
-                               ingestReceipts.add(new 
IngestReceipt(this.generateTransactionId(product.getProductId()), 
product.getProductReceivedTime()));
+                               ingestReceipts.add(new 
IngestReceipt(this.generateTransactionId(product.getProductId()), (product 
instanceof TemporalProduct ? ((TemporalProduct) 
product).getProductReceivedTime() : new Date())));
                        return ingestReceipts;
                }catch (Exception e) {
                        throw new QueryServiceException("Failed to perform 
CatalogQuery '" + queryExpression + "' : " + e.getMessage(), e);
@@ -523,7 +524,7 @@ public class FilemgrCatalogIndex impleme
 
                        List<IngestReceipt> ingestReceipts = new 
Vector<IngestReceipt>();
                        for (Product product : products)
-                               ingestReceipts.add(new 
IngestReceipt(this.generateTransactionId(product.getProductId()), 
product.getProductReceivedTime()));
+                               ingestReceipts.add(new 
IngestReceipt(this.generateTransactionId(product.getProductId()), (product 
instanceof TemporalProduct ? ((TemporalProduct) 
product).getProductReceivedTime() : new Date())));
                        return ingestReceipts;
                }catch (Exception e) {
                        throw new QueryServiceException("Failed to perform 
CatalogQuery '" + queryExpression + "' : " + e.getMessage(), e);

Modified: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java?rev=1089295&r1=1089294&r2=1089295&view=diff
==============================================================================
--- 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
 (original)
+++ 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
 Wed Apr  6 04:40:47 2011
@@ -63,8 +63,6 @@ public class Product {
 
     /* our product structure: can be Heirarchical, or Flat */
     private String productStructure = null;
-
-    private Date productReceivedTime = null;
     
     /* a set of {@link References} to the items that make up this product */
     private List<Reference> references = null;
@@ -142,12 +140,11 @@ public class Product {
      *            A {@link List} of {@link Reference}s pointing to the items
      *            that make up this product.
      */
-    public Product(String name, ProductType pType, String structure, Date 
productReceivedTime,
+    public Product(String name, ProductType pType, String structure,
             String transferStatus, List<Reference> refs) {
         productName = name;
         productType = pType;
         productStructure = structure;
-        this.productReceivedTime = productReceivedTime;
         references = refs;
     }
 
@@ -181,14 +178,6 @@ public class Product {
         this.productStructure = productStructure;
     }
 
-    public Date getProductReceivedTime() {
-               return productReceivedTime;
-       }
-
-       public void setProductReceivedTime(Date productReceivedTime) {
-               this.productReceivedTime = productReceivedTime;
-       }
-
        /**
      * @return Returns the references.
      */

Added: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java?rev=1089295&view=auto
==============================================================================
--- 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java
 (added)
+++ 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java
 Wed Apr  6 04:40:47 2011
@@ -0,0 +1,28 @@
+package org.apache.oodt.cas.filemgr.structs;
+
+import java.util.Date;
+import java.util.List;
+
+public class TemporalProduct extends Product {
+
+    private Date productReceivedTime = null;
+
+    public TemporalProduct() {
+       super();
+    }
+    
+    public TemporalProduct(String name, ProductType pType, String structure, 
Date productReceivedTime,
+            String transferStatus, List<Reference> refs) {
+       super(name, pType, structure, transferStatus, refs);
+        this.productReceivedTime = productReceivedTime;
+    }
+    
+    public Date getProductReceivedTime() {
+               return productReceivedTime;
+       }
+
+       public void setProductReceivedTime(Date productReceivedTime) {
+               this.productReceivedTime = productReceivedTime;
+       }
+       
+}

Propchange: 
oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/TemporalProduct.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to