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

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

public class MappedDataSourceCatalog
extends DataSourceCatalog

Version:
$Revision$

An extension to the DataSourceCatalog where product type names are mapped to the table names in the database (to deal with large product type names, which Oracle doesn't like)

.
Author:
mattmann

Field Summary
 
Fields inherited from class org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog
dataSource, fieldIdStringFlag, orderedValues, pageSize
 
Fields inherited from interface org.apache.oodt.cas.filemgr.catalog.Catalog
X_POINT_ID
 
Constructor Summary
MappedDataSourceCatalog(DataSource ds, ValidationLayer valLayer, boolean fieldId, int pageSize, long cacheUpdateMin, Properties typeMap)
          Constructs a new MappedDataSourceCatalog.
 
Method Summary
 void addMetadata(Metadata metadata, Product product)
           Ingests Metadata into the metadata store, and associates it with the given productId.
 void addProductReferences(Product product)
           Adds the specified List of References to the Catalog, and associates them with this Product specified by its productId.
 Metadata getMetadata(Product product)
           Gets the Metadata for a given Product.
 List<Reference> getProductReferences(Product product)
           Gets the References associated with this Product.
protected  String getProductTypeTableName(String origName)
           
 void modifyProduct(Product product)
           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 query, ProductType type)
           Queries the Catalog with the specified Query
 void removeMetadata(Metadata metadata, Product product)
           Removes Metadata from the metadata store, and disassociates it from the given productId.
 void removeProduct(Product product)
           Removes a Product from the Catalog.
 
Methods inherited from class org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog
addProduct, getFirstPage, getLastProductPage, getNextPage, getNumProducts, getPrevPage, getProductById, getProductByName, getProducts, getProductsByProductType, getReducedMetadata, getResultListSize, getSqlQuery, getTopNProducts, getTopNProducts, getValidationLayer, quoteIt, setProductTransferStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappedDataSourceCatalog

public MappedDataSourceCatalog(DataSource ds,
                               ValidationLayer valLayer,
                               boolean fieldId,
                               int pageSize,
                               long cacheUpdateMin,
                               Properties typeMap)
Constructs a new MappedDataSourceCatalog.

Parameters:
ds - The DataSource connection to a DBMS catalog.
valLayer - The ValidationLayer storign the element policy.
fieldId - Whether or not field ids should be quoted.
pageSize - The page size of returned products via Pagination API.
cacheUpdateMin - The amount of minutes inbetween cache updates (if needed).
typeMap - The mapping properties mapping product type names to table name.
Method Detail

addMetadata

public void addMetadata(Metadata metadata,
                        Product product)
                 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
Overrides:
addMetadata in class DataSourceCatalog
Parameters:
metadata - The Metadata to ingest.
product - The product to add the metadata for.
Throws:
CatalogException - If any general error occurs.

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
Overrides:
addProductReferences in class DataSourceCatalog
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 Metadata getMetadata(Product product)
                     throws CatalogException
Description copied from interface: Catalog

Gets the Metadata for a given Product.

Specified by:
getMetadata in interface Catalog
Overrides:
getMetadata in class DataSourceCatalog
Parameters:
product - The Product to obtain the Metadata for.
Returns:
The Metadata for the given productId.
Throws:
CatalogException - If any error occurs.

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
Overrides:
getProductReferences in class DataSourceCatalog
Parameters:
product - The Product to obtain the References for.
Returns:
A List of References, associated with the specified Product.
Throws:
CatalogException

modifyProduct

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

Modifies an existing Product within the Catalog.

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

removeMetadata

public void removeMetadata(Metadata metadata,
                           Product product)
                    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
Overrides:
removeMetadata in class DataSourceCatalog
Parameters:
metadata - The Metadata to remove.
product - The product for which the metadata is to be removed.
Throws:
CatalogException - If any general error occurs.

removeProduct

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

Removes a Product from the Catalog.

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

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
Overrides:
pagedQuery in class DataSourceCatalog
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.

query

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

Queries the Catalog with the specified Query

.

Specified by:
query in interface Catalog
Overrides:
query in class DataSourceCatalog
Parameters:
query - The set of criteria by which to query the Catalog.
type - 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.

getProductTypeTableName

protected String getProductTypeTableName(String origName)


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