|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.oodt.cas.filemgr.catalog.DataSourceCatalog
public class DataSourceCatalog
Implementation of a Catalog
that is backed by a DataSource
front-end to a SQL DBMS.
Field Summary | |
---|---|
protected DataSource |
dataSource
|
protected boolean |
fieldIdStringFlag
|
protected int |
pageSize
|
Fields inherited from interface org.apache.oodt.cas.filemgr.catalog.Catalog |
---|
X_POINT_ID |
Constructor Summary | |
---|---|
DataSourceCatalog(DataSource ds,
ValidationLayer valLayer,
boolean fieldId,
int pageSize,
long cacheUpdateMin)
Default Constructor |
Method Summary | |
---|---|
void |
addMetadata(org.apache.oodt.cas.metadata.Metadata m,
Product product)
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 Reference s to the
Catalog , and associates them with this Product specified
by its productId . |
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 type)
|
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 Reference s associated with this Product. |
List<Product> |
getProducts()
Gets all the Product s in the Catalog . |
List<Product> |
getProductsByProductType(ProductType type)
Gets the Product s associated with the specified ProductType in
the Catalog . |
org.apache.oodt.cas.metadata.Metadata |
getReducedMetadata(Product product,
List<String> elems)
Gets a reduced set of metadata for a give Product. |
List<Product> |
getTopNProducts(int n)
Gets the top N most recent products that have been
cataloged. |
List<Product> |
getTopNProducts(int n,
ProductType type)
Gets the top N most recent products that have been
cataloged for the given ProductType . |
ValidationLayer |
getValidationLayer()
|
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(org.apache.oodt.cas.metadata.Metadata m,
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. |
void |
setProductTransferStatus(Product product)
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 |
---|
protected DataSource dataSource
protected boolean fieldIdStringFlag
protected int pageSize
Constructor Detail |
---|
public DataSourceCatalog(DataSource ds, ValidationLayer valLayer, boolean fieldId, int pageSize, long cacheUpdateMin)
Default Constructor
.
Method Detail |
---|
public void addMetadata(org.apache.oodt.cas.metadata.Metadata m, Product product) throws CatalogException
Catalog
Ingests Metadata
into the metadata store, and associates it with
the given productId
.
addMetadata
in interface Catalog
m
- The Metadata
to ingest.product
- The product to add the metadata for.
CatalogException
- If any general error occurs.public void removeMetadata(org.apache.oodt.cas.metadata.Metadata m, Product product) throws CatalogException
Catalog
Removes Metadata
from the metadata store, and disassociates it
from the given productId
.
removeMetadata
in interface Catalog
m
- The Metadata
to remove.product
- The product for which the metadata is to be removed.
CatalogException
- If any general error occurs.public void addProduct(Product product) throws CatalogException
Catalog
Adds a Product to the Catalog.
addProduct
in interface Catalog
product
- The Product
to add.
CatalogException
- If any error occurs during the add.public void modifyProduct(Product product) throws CatalogException
Catalog
Modifies an existing Product within the Catalog.
modifyProduct
in interface Catalog
product
- The new Product
information to modify the existing
Product with.
CatalogException
- If any error occurs.public void removeProduct(Product product) throws CatalogException
Catalog
Removes a Product
from the Catalog.
removeProduct
in interface Catalog
product
- The product to remove.
CatalogException
- If any error occurs.public void setProductTransferStatus(Product product) throws CatalogException
Catalog
Persists the transferStatus
attribute of the given
Product
to the Catalog.
setProductTransferStatus
in interface Catalog
product
- The Product whose transfer status will be persisted. The
caller should make sure that the product ID field is set.
CatalogException
public void addProductReferences(Product product) throws CatalogException
Catalog
Adds the specified List
of Reference
s to the
Catalog
, and associates them with this Product
specified
by its productId
.
addProductReferences
in interface Catalog
product
- The product to add references for. The references are read
from the Products list of References.
CatalogException
- If anything goes wrong.public Product getProductById(String productId) throws CatalogException
Catalog
Gets a Product
, with the specified productId
.
getProductById
in interface Catalog
productId
- The unique ID of the Product to retrieve.
Product
, with the given ID. The implementer of this
method should ensure that the product Reference
s are
populated as well.
CatalogException
- If any error occurs.public Product getProductByName(String productName) throws CatalogException
Catalog
Gets a Product
with the specified productName
.
getProductByName
in interface Catalog
productName
- The name of the Product to retrieve.
Product
with the given name. The implementer of this
method should ensure that the product Reference
s are
populated as well.
CatalogException
public List<Reference> getProductReferences(Product product) throws CatalogException
Catalog
Gets the Reference
s associated with this Product.
getProductReferences
in interface Catalog
product
- The Product
to obtain the References for.
List
of Reference
s, associated with the
specified Product.
CatalogException
public List<Product> getProducts() throws CatalogException
Catalog
Gets all the Product
s in the Catalog
.
getProducts
in interface Catalog
List
of Product
s in the Catalog
.
CatalogException
- If any error occurs.public List<Product> getProductsByProductType(ProductType type) throws CatalogException
Catalog
Gets the Product
s associated with the specified ProductType in
the Catalog
.
getProductsByProductType
in interface Catalog
type
- The ProductType
to obtain the Product
s for.
List
of Product
s that are associated with the
specified productType in the Catalog
.
CatalogException
- If any error occurs.public org.apache.oodt.cas.metadata.Metadata getMetadata(Product product) throws CatalogException
Catalog
Gets the Metadata for a given Product.
getMetadata
in interface Catalog
product
- The Product
to obtain the Metadata for.
Metadata
for the given productId
.
CatalogException
- If any error occurs.public org.apache.oodt.cas.metadata.Metadata getReducedMetadata(Product product, List<String> elems) throws CatalogException
Catalog
Gets a reduced set of metadata for a give Product.
getReducedMetadata
in interface Catalog
product
- The Product
to obtain the Metadata for.elems
- The set of metadata elements of interest.
Metadata
for the given productId
.
CatalogException
- If any error occurs.public List<String> query(Query query, ProductType type) throws CatalogException
Catalog
Queries the Catalog with the specified Query
query
in interface Catalog
query
- The set of criteria by which to query the Catalog.type
- The ProductType
that should be queried.
List
of String product IDs that can be used to retrieve
products that match the query.
CatalogException
- If any error occurs.public List<Product> getTopNProducts(int n) throws CatalogException
Catalog
Gets the top N
most recent products that have been
cataloged.
getTopNProducts
in interface Catalog
n
- The amount of recent products to return.
List
of Product
s that have been cataloged
recently.
CatalogException
- If any error occurs.public List<Product> getTopNProducts(int n, ProductType type) throws CatalogException
Catalog
Gets the top N
most recent products that have been
cataloged for the given ProductType
.
getTopNProducts
in interface Catalog
n
- The amount of recent products to return.type
- The ProductType to limit the query to.
List
of Product
s that have been cataloged
recently.
CatalogException
- If any error occurs.public ValidationLayer getValidationLayer() throws CatalogException
getValidationLayer
in interface Catalog
ValidationLayer
that is used by this Catalog.
CatalogException
- If any error occurs (e.g., the layer isn't initialized).public int getNumProducts(ProductType type) throws CatalogException
getNumProducts
in interface Catalog
type
- The ProductType to count the number of products for.
Product
s for the
specified ProductType
.
CatalogException
- If any error occurs.public ProductPage getFirstPage(ProductType type)
getFirstPage
in interface Pagination
type
- The ProductType to obtain the first ProductPage
for.
ProductType
.public ProductPage getLastProductPage(ProductType type)
getLastProductPage
in interface Pagination
type
- The ProductType to obtain the last ProductPage
for.
ProductType
.public ProductPage getNextPage(ProductType type, ProductPage currentPage)
getNextPage
in interface Pagination
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.
public ProductPage getPrevPage(ProductType type, ProductPage currentPage)
getPrevPage
in interface Pagination
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.
public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException
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.
pagedQuery
in interface Catalog
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.
ProductPage
of results.
CatalogException
- If any error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |