X_POINT_ID
Constructor and Description |
---|
LuceneCatalog(String idxFilePath,
ValidationLayer vLayer,
int pgSize,
long commitTimeout,
long writeTimeout,
int mergeFactor) |
Modifier and Type | Method and Description |
---|---|
void |
addMetadata(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)
|
ProductPage |
getFirstPage(ProductType type) |
ProductPage |
getLastProductPage(ProductType type) |
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()
|
List<Product> |
getProductsByProductType(ProductType type)
|
Metadata |
getReducedMetadata(Product product,
List<String> elements)
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(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. |
public LuceneCatalog(String idxFilePath, ValidationLayer vLayer, int pgSize, long commitTimeout, long writeTimeout, int mergeFactor)
idxFilePath
- A file path pointing to the lucene index directory for this
catalog.vLayer
- The validation layer to be used for this catalog.pgSize
- The size of pages to be used when doing pagination of the
catalog.commitTimeout
- The amount of time (in seconds) that should be flowed down to
the Lucene IndexReader and IndexWriters for their commit lock
timeout property.writeTimeout
- The amount of time (in seconds) that should be flowed down to
the Lucene IndexWriters for their commit lock timeout
property.mergeFactor
- The merge factor to use when writing to the index.public void addMetadata(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(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
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
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 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 Metadata getReducedMetadata(Product product, List<String> elements) 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.elements
- 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()
getValidationLayer
in interface Catalog
ValidationLayer
that is used by this Catalog.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.Copyright © 1999–2017 Apache OODT. All rights reserved.