org.apache.oodt.cas.filemgr.catalog
Class ScienceDataCatalog

java.lang.Object
  extended by org.apache.oodt.cas.filemgr.catalog.ScienceDataCatalog
All Implemented Interfaces:
Catalog, Pagination

public class ScienceDataCatalog
extends Object
implements Catalog

Provides a Catalog implementation that facilitate large-scale ingest of observational data into a relational schema.

Author:
ahart, cgoodale, mattmann

Field Summary
protected  DataSource dataSource
           
protected  int pageSize
           
protected  ValidationLayer validationLayer
           
 
Fields inherited from interface org.apache.oodt.cas.filemgr.catalog.Catalog
X_POINT_ID
 
Constructor Summary
ScienceDataCatalog(DataSource dataSource, ValidationLayer validationLayer, int pageSize)
           
 
Method Summary
 void addMetadata(org.apache.oodt.cas.metadata.Metadata m, Product p)
           Ingests Metadata into the metadata store, and associates it with the given productId.
 void addProduct(Product product)
           Adds a Product to the Catalog.
 void addProductReferences(Product product)
           Adds the specified List of References to the Catalog, and associates them with this Product specified by its productId.
 int commitQuery(StringBuffer query, String maxQuery)
           
 int createGranule(int datasetId, String filename)
           
 int createParameter(int datasetId, String longName)
           
 ProductPage getFirstPage(ProductType type)
           
 ProductPage getLastProductPage(ProductType type)
           
 org.apache.oodt.cas.metadata.Metadata getMetadata(Product product)
           Gets the Metadata for a given Product.
 ProductPage getNextPage(ProductType type, ProductPage currentPage)
           
 int getNumProducts(ProductType productType)
           
 ProductPage getPrevPage(ProductType type, ProductPage currentPage)
           
 Product getProductById(String productId)
           Gets a Product, with the specified productId.
 Product getProductByName(String productName)
           Gets a Product with the specified productName.
 List<Reference> getProductReferences(Product product)
           Gets the References associated with this Product.
 List<Product> getProducts()
           Gets all the Products in the Catalog.
 List<Product> getProductsByProductType(ProductType productType)
           Gets the Products associated with the specified ProductType in the Catalog.
 org.apache.oodt.cas.metadata.Metadata getReducedMetadata(Product product, List<String> metList)
           Gets a reduced set of metadata for a give Product.
 List<Product> getTopNProducts(int num)
           Gets the top N most recent products that have been cataloged.
 List<Product> getTopNProducts(int num, ProductType productType)
           Gets the top N most recent products that have been cataloged for the given ProductType.
 ValidationLayer getValidationLayer()
           
 void modifyProduct(Product arg0)
           Modifies an existing Product within the Catalog.
 ProductPage pagedQuery(Query query, ProductType type, int pageNum)
           Performs a query against the underlying Catalog, and then properly formulates a page of results to send back to the user.
 List<String> query(Query arg0, ProductType arg1)
           Queries the Catalog with the specified Query
 void removeMetadata(org.apache.oodt.cas.metadata.Metadata arg0, Product arg1)
           Removes Metadata from the metadata store, and disassociates it from the given productId.
 void removeProduct(Product arg0)
           Removes a Product from the Catalog.
 void setProductTransferStatus(Product arg0)
           Persists the transferStatus attribute of the given Product to the Catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

protected DataSource dataSource

validationLayer

protected ValidationLayer validationLayer

pageSize

protected int pageSize
Constructor Detail

ScienceDataCatalog

public ScienceDataCatalog(DataSource dataSource,
                          ValidationLayer validationLayer,
                          int pageSize)
Method Detail

addMetadata

public void addMetadata(org.apache.oodt.cas.metadata.Metadata m,
                        Product p)
                 throws CatalogException
Description copied from interface: Catalog

Ingests Metadata into the metadata store, and associates it with the given productId.

Specified by:
addMetadata in interface Catalog
Parameters:
m - The Metadata to ingest.
p - The product to add the metadata for.
Throws:
CatalogException - If any general error occurs.

createGranule

public int createGranule(int datasetId,
                         String filename)
                  throws CatalogException,
                         SQLException
Throws:
CatalogException
SQLException

createParameter

public int createParameter(int datasetId,
                           String longName)
                    throws CatalogException,
                           SQLException
Throws:
CatalogException
SQLException

commitQuery

public int commitQuery(StringBuffer query,
                       String maxQuery)
                throws SQLException
Throws:
SQLException

addProduct

public void addProduct(Product product)
                throws CatalogException
Description copied from interface: Catalog

Adds a Product to the Catalog.

Specified by:
addProduct in interface Catalog
Parameters:
product - The Product to add.
Throws:
CatalogException - If any error occurs during the add.

addProductReferences

public void addProductReferences(Product product)
                          throws CatalogException
Description copied from interface: Catalog

Adds the specified List of References to the Catalog, and associates them with this Product specified by its productId.

Specified by:
addProductReferences in interface Catalog
Parameters:
product - The product to add references for. The references are read from the Products list of References.
Throws:
CatalogException - If anything goes wrong.

getMetadata

public org.apache.oodt.cas.metadata.Metadata getMetadata(Product product)
                                                  throws CatalogException
Description copied from interface: Catalog

Gets the Metadata for a given Product.

Specified by:
getMetadata in interface Catalog
Parameters:
product - The Product to obtain the Metadata for.
Returns:
The Metadata for the given productId.

Throws:
CatalogException - If any error occurs.

getNumProducts

public int getNumProducts(ProductType productType)
                   throws CatalogException
Specified by:
getNumProducts in interface Catalog
Parameters:
productType - The ProductType to count the number of products for.
Returns:
An integer count of the number of Products for the specified ProductType.
Throws:
CatalogException - If any error occurs.

getProductById

public Product getProductById(String productId)
                       throws CatalogException
Description copied from interface: Catalog

Gets a Product, with the specified productId.

Specified by:
getProductById in interface Catalog
Parameters:
productId - The unique ID of the Product to retrieve.
Returns:
A Product, with the given ID. The implementer of this method should ensure that the product References are populated as well.
Throws:
CatalogException - If any error occurs.

getProductByName

public Product getProductByName(String productName)
                         throws CatalogException
Description copied from interface: Catalog

Gets a Product with the specified productName.

Specified by:
getProductByName in interface Catalog
Parameters:
productName - The name of the Product to retrieve.
Returns:
A Product with the given name. The implementer of this method should ensure that the product References are populated as well.
Throws:
CatalogException

getProductReferences

public List<Reference> getProductReferences(Product product)
                                     throws CatalogException
Description copied from interface: Catalog

Gets the References associated with this Product.

Specified by:
getProductReferences in interface Catalog
Parameters:
product - The Product to obtain the References for.
Returns:
A List of References, associated with the specified Product.
Throws:
CatalogException

getProducts

public List<Product> getProducts()
                          throws CatalogException
Description copied from interface: Catalog

Gets all the Products in the Catalog.

Specified by:
getProducts in interface Catalog
Returns:
A List of Products in the Catalog.
Throws:
CatalogException - If any error occurs.

getProductsByProductType

public List<Product> getProductsByProductType(ProductType productType)
                                       throws CatalogException
Description copied from interface: Catalog

Gets the Products associated with the specified ProductType in the Catalog.

Specified by:
getProductsByProductType in interface Catalog
Parameters:
productType - The ProductType to obtain the Products for.
Returns:
A List of Products that are associated with the specified productType in the Catalog.
Throws:
CatalogException - If any error occurs.

getReducedMetadata

public org.apache.oodt.cas.metadata.Metadata getReducedMetadata(Product product,
                                                                List<String> metList)
                                                         throws CatalogException
Description copied from interface: Catalog

Gets a reduced set of metadata for a give Product.

Specified by:
getReducedMetadata in interface Catalog
Parameters:
product - The Product to obtain the Metadata for.
metList - The set of metadata elements of interest.
Returns:
The reduced Metadata for the given productId.
Throws:
CatalogException - If any error occurs.

getTopNProducts

public List<Product> getTopNProducts(int num)
                              throws CatalogException
Description copied from interface: Catalog

Gets the top N most recent products that have been cataloged.

Specified by:
getTopNProducts in interface Catalog
Parameters:
num - The amount of recent products to return.
Returns:
A List of Products that have been cataloged recently.
Throws:
CatalogException - If any error occurs.

getTopNProducts

public List<Product> getTopNProducts(int num,
                                     ProductType productType)
                              throws CatalogException
Description copied from interface: Catalog

Gets the top N most recent products that have been cataloged for the given ProductType.

Specified by:
getTopNProducts in interface Catalog
Parameters:
num - The amount of recent products to return.
productType - The ProductType to limit the query to.
Returns:
A List of Products that have been cataloged recently.
Throws:
CatalogException - If any error occurs.

getValidationLayer

public ValidationLayer getValidationLayer()
                                   throws CatalogException
Specified by:
getValidationLayer in interface Catalog
Returns:
The ValidationLayer that is used by this Catalog.
Throws:
CatalogException - If any error occurs (e.g., the layer isn't initialized).

modifyProduct

public void modifyProduct(Product arg0)
                   throws CatalogException
Description copied from interface: Catalog

Modifies an existing Product within the Catalog.

Specified by:
modifyProduct in interface Catalog
Parameters:
arg0 - The new Product information to modify the existing Product with.
Throws:
CatalogException - If any error occurs.

query

public List<String> query(Query arg0,
                          ProductType arg1)
                   throws CatalogException
Description copied from interface: Catalog

Queries the Catalog with the specified Query

.

Specified by:
query in interface Catalog
Parameters:
arg0 - The set of criteria by which to query the Catalog.
arg1 - The ProductType that should be queried.
Returns:
A List of String product IDs that can be used to retrieve products that match the query.
Throws:
CatalogException - If any error occurs.

removeMetadata

public void removeMetadata(org.apache.oodt.cas.metadata.Metadata arg0,
                           Product arg1)
                    throws CatalogException
Description copied from interface: Catalog

Removes Metadata from the metadata store, and disassociates it from the given productId.

Specified by:
removeMetadata in interface Catalog
Parameters:
arg0 - The Metadata to remove.
arg1 - The product for which the metadata is to be removed.
Throws:
CatalogException - If any general error occurs.

removeProduct

public void removeProduct(Product arg0)
                   throws CatalogException
Description copied from interface: Catalog

Removes a Product from the Catalog.

Specified by:
removeProduct in interface Catalog
Parameters:
arg0 - The product to remove.
Throws:
CatalogException - If any error occurs.

setProductTransferStatus

public void setProductTransferStatus(Product arg0)
                              throws CatalogException
Description copied from interface: Catalog

Persists the transferStatus attribute of the given Product to the Catalog.

Specified by:
setProductTransferStatus in interface Catalog
Parameters:
arg0 - The Product whose transfer status will be persisted. The caller should make sure that the product ID field is set.
Throws:
CatalogException

getFirstPage

public ProductPage getFirstPage(ProductType type)
Specified by:
getFirstPage in interface Pagination
Parameters:
type - The ProductType to obtain the first ProductPage for.
Returns:
The first page of products for a particular ProductType.

getLastProductPage

public ProductPage getLastProductPage(ProductType type)
Specified by:
getLastProductPage in interface Pagination
Parameters:
type - The ProductType to obtain the last ProductPage for.
Returns:
The last page of products for a particular ProductType.

getNextPage

public ProductPage getNextPage(ProductType type,
                               ProductPage currentPage)
Specified by:
getNextPage in interface Pagination
Parameters:
type - The ProductType to obtain the next page for, given the currentPage.
currentPage - The current page that tells the function what the next page to obtain is.
Returns:
The next page in the ProductType product list, given the currentPage.

getPrevPage

public ProductPage getPrevPage(ProductType type,
                               ProductPage currentPage)
Specified by:
getPrevPage in interface Pagination
Parameters:
type - The ProductType to obtain the previous page for, given the currentPage.
currentPage - The currentPage that tells the function what the previous page to obtain is.
Returns:
The previous page in the ProductType product list, given the currentPage.

pagedQuery

public ProductPage pagedQuery(Query query,
                              ProductType type,
                              int pageNum)
                       throws CatalogException
Description copied from interface: Catalog

Performs a query against the underlying Catalog, and then properly formulates a page of results to send back to the user. This method is useful when you would like to conserve memory and not send back the entire list of results, nor load them into memory. Of course, this method assumes that queries are deterministic, i.e., the same query issued 2x within a paginating session will produce the same set of results to paginate.

Specified by:
pagedQuery in interface Catalog
Parameters:
query - The query to perform against the underlying Catalog.
type - The ProductType that you are querying for.
pageNum - The number of the ProductPage to return back to the user.
Returns:
The requested ProductPage of results.
Throws:
CatalogException - If any error occurs.


Copyright © 1999-2011 Apache OODT. All Rights Reserved.