org.apache.oodt.cas.catalog.system.impl
Class CatalogServiceLocal

java.lang.Object
  extended by org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocal
All Implemented Interfaces:
CatalogService

public class CatalogServiceLocal
extends Object
implements CatalogService

Version:
$Revision$

A Calatog Service that manages Metadata via one or more underlying Catalogs

Author:
bfoster

Nested Class Summary
protected  class CatalogServiceLocal.QueryResult
           
protected  class CatalogServiceLocal.QueryResultGroup
           
 
Field Summary
protected  CatalogRepository catalogRepository
           
protected  Set<Catalog> catalogs
           
protected  ReadWriteLock catalogsLock
           
protected  int crossCatalogResultSortingThreshold
           
protected  boolean disableIntersectingCrossCatalogQueries
           
protected  IngestMapper ingestMapper
           
protected  ReadWriteLock ingestMapperLock
           
protected  boolean oneCatalogFailsAllFail
           
protected  File pluginStorageDir
           
protected  boolean restrictIngestPermissions
           
protected  boolean restrictQueryPermissions
           
protected  boolean simplifyQueries
           
protected  TransactionIdFactory transactionIdFactory
           
 
Fields inherited from interface org.apache.oodt.cas.catalog.system.CatalogService
CATALOG_ID_MET_KEY, CATALOG_IDS_MET_KEY, CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, CATALOG_TRANSACTION_ID_MET_KEY, ENABLE_UPDATE_MET_KEY
 
Constructor Summary
CatalogServiceLocal(CatalogRepository catalogRepository, IngestMapper ingestMapper, File pluginStorageDir, TransactionIdFactory transactionIdFactory, boolean restrictQueryPermissions, boolean restrictIngestPermissions, boolean oneCatalogFailsAllFail, boolean simplifyQueries, boolean disableIntersectingCrossCatalogQueries, int crossCatalogResultSortingThreshold)
           
 
Method Summary
 List<TransactionReceipt> _query(QueryExpression queryExpression, Set<String> catalogIds)
           
 void addCatalog(Catalog catalog)
          Ability to dynamically add a Catalog to this CatalogService for managing
 void addCatalog(String catalogId, Index index)
           
 void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries)
           
 void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission)
           
 void addDictionary(String catalogId, Dictionary dictionary)
           
 void addPluginUrls(List<PluginURL> urls)
           
protected  boolean containsCatalog(String catalogId)
           
protected  boolean containsTranactionReceipts(List<CatalogServiceLocal.QueryResult> queryResults)
           
protected  boolean containsUnbalancedCatalogInterest(List<CatalogServiceLocal.QueryResult> queryResults)
           
 void delete(Metadata metadata)
           
protected  boolean doReduce(Metadata metadata)
           
protected  TransactionId<?> generateNewUniqueTransactionId()
           
protected  TransactionId<?> generateTransactionId(String stringTransactionId)
           
 List<TransactionalMetadata> getAllPages(QueryPager queryPager)
           
 Properties getCalalogProperties()
           
 Properties getCalalogProperties(String catalogUrn)
           
protected  Catalog getCatalog(String catalogUrn)
           
 TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew)
           
protected  TransactionId<?> getCatalogServiceTransactionId(Metadata metadata)
           
protected  TransactionId<?> getCatalogServiceTransactionId(Metadata metadata, boolean generateNew)
           
 TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn)
           
 List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
           
 Set<String> getCurrentCatalogIds()
           
 Set<Catalog> getCurrentCatalogList()
           
protected  Set<Catalog> getFilteredCatalogList(Metadata metadata)
           
protected  HashSet<String> getInterestedCatalogs(QueryExpression queryExpression, Set<String> restrictToCatalogIds)
           
protected  List<CatalogReceipt> getIntersection(List<CatalogServiceLocal.QueryResult> queryResults)
           
 List<TransactionalMetadata> getMetadata(List<TransactionReceipt> transactionReceipts)
           
 List<TransactionalMetadata> getMetadata(Page page)
           
 List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds)
           
 List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings)
           
 Page getNextPage(Page page)
           
 List<TransactionalMetadata> getNextPage(QueryPager queryPager)
           
 Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
           
 Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds)
           
protected  Page getPage(QueryExpression queryExpression, Set<String> restrictToCatalogIds, QueryPager queryPager)
           
 URL getPluginStorageDir()
           
 List<PluginURL> getPluginUrls()
           
protected  List<TransactionReceipt> getPossiblyUnindexedTransactionReceipts(List<CatalogReceipt> catalogReceipts)
           
 List<String> getProperty(String key)
           
protected  List<TransactionReceipt> indexReceipts(List<TransactionReceipt> transactionReceipts)
           
 TransactionReceipt ingest(Metadata metadata)
           
 boolean isRestrictIngestPermissions()
          Returns true if this CatalogService is restricting any ingestions from being made to the Catalogs it is managing
 boolean isRestrictQueryPermissions()
          Returns true if this CatalogService is restricting any queries from being made to the Catalogs it is managing
protected  void modifyCatalog(String catalogId, List<Dictionary> dictionaries, Index index, Boolean restrictQueryPermission, Boolean restrictIngestPermission)
           
 void modifyIngestPermission(String catalogId, boolean restrictIngestPermission)
           
 void modifyQueryPermission(String catalogId, boolean restrictQueryPermission)
           
 QueryPager query(QueryExpression queryExpression)
           
 QueryPager query(QueryExpression queryExpression, Set<String> catalogIds)
           
protected  CatalogServiceLocal.QueryResult queryRecur(QueryExpression queryExpression, Set<String> restrictToCatalogIds)
           
protected  QueryExpression reduceToUnderstoodExpressions(Catalog catalog, QueryExpression queryExpression)
           
 void removeCatalog(String catalogUrn)
           
 void removeCatalog(String catalogId, boolean preserveMapping)
           
 void replaceCatalog(Catalog catalog)
          Ability to dynamically add a Catalog to this CatalogService for managing
 void replaceDictionaries(String catalogId, List<Dictionary> dictionaries)
           
 void replaceIndex(String catalogId, Index index)
           
protected  void setCatalogRepository(CatalogRepository catalogRepository)
          Set the CatalogRepository for this CatalogService, with replace existing CatalogRepository and immediately load all Catalogs from it.
protected  void setIngestMapper(IngestMapper ingestMapper)
           
 void setPluginStorageDir(File pluginStorageDir)
           
protected  void setRestrictIngestPermissions(boolean restrictIngestPermissions)
          Modify this CatalogServices ingest restriction, default is false.
protected  void setRestrictQueryPermissions(boolean restrictQueryPermissions)
          Modify this CatalogServices query restriction, default is false.
protected  void setTransactionIdFactory(TransactionIdFactory transactionIdFactory)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalogs

protected Set<Catalog> catalogs

catalogsLock

protected ReadWriteLock catalogsLock

catalogRepository

protected CatalogRepository catalogRepository

ingestMapper

protected IngestMapper ingestMapper

ingestMapperLock

protected ReadWriteLock ingestMapperLock

restrictQueryPermissions

protected boolean restrictQueryPermissions

restrictIngestPermissions

protected boolean restrictIngestPermissions

transactionIdFactory

protected TransactionIdFactory transactionIdFactory

pluginStorageDir

protected File pluginStorageDir

oneCatalogFailsAllFail

protected boolean oneCatalogFailsAllFail

simplifyQueries

protected boolean simplifyQueries

disableIntersectingCrossCatalogQueries

protected boolean disableIntersectingCrossCatalogQueries

crossCatalogResultSortingThreshold

protected int crossCatalogResultSortingThreshold
Constructor Detail

CatalogServiceLocal

public CatalogServiceLocal(CatalogRepository catalogRepository,
                           IngestMapper ingestMapper,
                           File pluginStorageDir,
                           TransactionIdFactory transactionIdFactory,
                           boolean restrictQueryPermissions,
                           boolean restrictIngestPermissions,
                           boolean oneCatalogFailsAllFail,
                           boolean simplifyQueries,
                           boolean disableIntersectingCrossCatalogQueries,
                           int crossCatalogResultSortingThreshold)
                    throws InstantiationException
Throws:
InstantiationException
Method Detail

setCatalogRepository

protected void setCatalogRepository(CatalogRepository catalogRepository)
                             throws CatalogServiceException
Set the CatalogRepository for this CatalogService, with replace existing CatalogRepository and immediately load all Catalogs from it.

Parameters:
repository - The CatalogRepository to be used by this CatalogService
Throws:
CatalogServiceException - On Error loading given CatalogRepository

setIngestMapper

protected void setIngestMapper(IngestMapper ingestMapper)

shutdown

public void shutdown()
              throws CatalogServiceException
Specified by:
shutdown in interface CatalogService
Throws:
CatalogServiceException

isRestrictQueryPermissions

public boolean isRestrictQueryPermissions()
Returns true if this CatalogService is restricting any queries from being made to the Catalogs it is managing

Specified by:
isRestrictQueryPermissions in interface CatalogService
Returns:
True is restricting queries, false if restriction is on a per Catalog bases.

setRestrictQueryPermissions

protected void setRestrictQueryPermissions(boolean restrictQueryPermissions)
Modify this CatalogServices query restriction, default is false.

Parameters:
restrictQueryPermissions - True to block all querys to managing Catalogs or false to leave it at a per Catalog bases.

isRestrictIngestPermissions

public boolean isRestrictIngestPermissions()
Returns true if this CatalogService is restricting any ingestions from being made to the Catalogs it is managing

Specified by:
isRestrictIngestPermissions in interface CatalogService
Returns:
True is restricting ingestions, false if restriction is on a per Catalog bases.

setRestrictIngestPermissions

protected void setRestrictIngestPermissions(boolean restrictIngestPermissions)
Modify this CatalogServices ingest restriction, default is false.

Parameters:
restrictIngestPermissions - True to block all ingestions to managing Catalogs or false to leave it at a per Catalog bases.

setTransactionIdFactory

protected void setTransactionIdFactory(TransactionIdFactory transactionIdFactory)
Parameters:
transactionIdClass -

addCatalog

public void addCatalog(String catalogId,
                       Index index)
                throws CatalogServiceException
Specified by:
addCatalog in interface CatalogService
Throws:
CatalogServiceException

addCatalog

public void addCatalog(String catalogId,
                       Index index,
                       List<Dictionary> dictionaries)
                throws CatalogServiceException
Specified by:
addCatalog in interface CatalogService
Throws:
CatalogServiceException

addCatalog

public void addCatalog(String catalogId,
                       Index index,
                       List<Dictionary> dictionaries,
                       boolean restrictQueryPermission,
                       boolean restrictIngestPermission)
                throws CatalogServiceException
Specified by:
addCatalog in interface CatalogService
Throws:
CatalogServiceException

addDictionary

public void addDictionary(String catalogId,
                          Dictionary dictionary)
                   throws CatalogServiceException
Specified by:
addDictionary in interface CatalogService
Throws:
CatalogServiceException

replaceDictionaries

public void replaceDictionaries(String catalogId,
                                List<Dictionary> dictionaries)
                         throws CatalogServiceException
Specified by:
replaceDictionaries in interface CatalogService
Throws:
CatalogServiceException

replaceIndex

public void replaceIndex(String catalogId,
                         Index index)
                  throws CatalogServiceException
Specified by:
replaceIndex in interface CatalogService
Throws:
CatalogServiceException

modifyIngestPermission

public void modifyIngestPermission(String catalogId,
                                   boolean restrictIngestPermission)
                            throws CatalogServiceException
Specified by:
modifyIngestPermission in interface CatalogService
Throws:
CatalogServiceException

modifyQueryPermission

public void modifyQueryPermission(String catalogId,
                                  boolean restrictQueryPermission)
                           throws CatalogServiceException
Specified by:
modifyQueryPermission in interface CatalogService
Throws:
CatalogServiceException

modifyCatalog

protected void modifyCatalog(String catalogId,
                             List<Dictionary> dictionaries,
                             Index index,
                             Boolean restrictQueryPermission,
                             Boolean restrictIngestPermission)
                      throws CatalogServiceException
Throws:
CatalogServiceException

containsCatalog

protected boolean containsCatalog(String catalogId)
                           throws CatalogServiceException
Throws:
CatalogServiceException

addCatalog

public void addCatalog(Catalog catalog)
                throws CatalogServiceException
Ability to dynamically add a Catalog to this CatalogService for managing

Specified by:
addCatalog in interface CatalogService
Parameters:
catalog - Catalog for this CatalogService to manage
Throws:
CatalogServiceException - If one of the adding Catalog URNs equals that of an existing Catalog.

replaceCatalog

public void replaceCatalog(Catalog catalog)
                    throws CatalogServiceException
Ability to dynamically add a Catalog to this CatalogService for managing

Specified by:
replaceCatalog in interface CatalogService
Parameters:
catalog - Catalog for this CatalogService to manage
allowOverride - True to allow adding Catalog to override existing Catalog with same URN
Throws:
CatalogServiceException - When allowOverride=false and one of the adding Catalog URNs equals that of an existing Catalog.

removeCatalog

public void removeCatalog(String catalogUrn)
                   throws CatalogServiceException
Specified by:
removeCatalog in interface CatalogService
Throws:
CatalogServiceException

removeCatalog

public void removeCatalog(String catalogId,
                          boolean preserveMapping)
                   throws CatalogServiceException
Parameters:
catalogUrn -
Throws:
CatalogServiceException

setPluginStorageDir

public void setPluginStorageDir(File pluginStorageDir)

getPluginStorageDir

public URL getPluginStorageDir()
                        throws CatalogServiceException
Specified by:
getPluginStorageDir in interface CatalogService
Throws:
CatalogServiceException

getPluginUrls

public List<PluginURL> getPluginUrls()
                              throws CatalogServiceException
Specified by:
getPluginUrls in interface CatalogService
Throws:
CatalogServiceException

addPluginUrls

public void addPluginUrls(List<PluginURL> urls)
                   throws CatalogServiceException
Specified by:
addPluginUrls in interface CatalogService
Throws:
CatalogServiceException

getCurrentCatalogList

public Set<Catalog> getCurrentCatalogList()
                                   throws CatalogServiceException
Returns:
Throws:
CatalogServiceException

getCatalog

protected Catalog getCatalog(String catalogUrn)
                      throws CatalogServiceException
Throws:
CatalogServiceException

getCurrentCatalogIds

public Set<String> getCurrentCatalogIds()
                                 throws CatalogServiceException
Specified by:
getCurrentCatalogIds in interface CatalogService
Returns:
Throws:
CatalogServiceException

ingest

public TransactionReceipt ingest(Metadata metadata)
                          throws CatalogServiceException
Specified by:
ingest in interface CatalogService
Throws:
CatalogServiceException

delete

public void delete(Metadata metadata)
            throws CatalogServiceException
Specified by:
delete in interface CatalogService
Parameters:
metadata -
Throws:
CatalogServiceException

doReduce

protected boolean doReduce(Metadata metadata)

getProperty

public List<String> getProperty(String key)
                         throws CatalogServiceException
Specified by:
getProperty in interface CatalogService
Throws:
CatalogServiceException

getCalalogProperties

public Properties getCalalogProperties()
                                throws CatalogServiceException
Specified by:
getCalalogProperties in interface CatalogService
Throws:
CatalogServiceException

getCalalogProperties

public Properties getCalalogProperties(String catalogUrn)
                                throws CatalogServiceException
Specified by:
getCalalogProperties in interface CatalogService
Throws:
CatalogServiceException

getNextPage

public Page getNextPage(Page page)
                 throws CatalogServiceException
Specified by:
getNextPage in interface CatalogService
Throws:
CatalogServiceException

getPage

public Page getPage(PageInfo pageInfo,
                    QueryExpression queryExpression)
             throws CatalogServiceException
Specified by:
getPage in interface CatalogService
Throws:
CatalogServiceException

getPage

public Page getPage(PageInfo pageInfo,
                    QueryExpression queryExpression,
                    Set<String> catalogIds)
             throws CatalogServiceException
Specified by:
getPage in interface CatalogService
Throws:
CatalogServiceException

query

public QueryPager query(QueryExpression queryExpression)
                 throws CatalogServiceException
Specified by:
query in interface CatalogService
Throws:
CatalogServiceException

getMetadata

public List<TransactionalMetadata> getMetadata(Page page)
                                        throws CatalogServiceException
Specified by:
getMetadata in interface CatalogService
Throws:
CatalogServiceException

getPage

protected Page getPage(QueryExpression queryExpression,
                       Set<String> restrictToCatalogIds,
                       QueryPager queryPager)
                throws CatalogServiceException
Throws:
CatalogServiceException

query

public QueryPager query(QueryExpression queryExpression,
                        Set<String> catalogIds)
                 throws CatalogServiceException
Specified by:
query in interface CatalogService
Throws:
CatalogServiceException

_query

public List<TransactionReceipt> _query(QueryExpression queryExpression,
                                       Set<String> catalogIds)
                                throws CatalogServiceException
Parameters:
queryExpression -
indexPage -
Returns:
Throws:
CatalogServiceException

getPossiblyUnindexedTransactionReceipts

protected List<TransactionReceipt> getPossiblyUnindexedTransactionReceipts(List<CatalogReceipt> catalogReceipts)
                                                                    throws CatalogServiceException
Throws:
CatalogServiceException

indexReceipts

protected List<TransactionReceipt> indexReceipts(List<TransactionReceipt> transactionReceipts)
                                          throws CatalogServiceException
Throws:
CatalogServiceException

getNextPage

public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
                                        throws CatalogServiceException
Specified by:
getNextPage in interface CatalogService
Throws:
CatalogServiceException

getAllPages

public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
                                        throws CatalogServiceException
Specified by:
getAllPages in interface CatalogService
Throws:
CatalogServiceException

getMetadataFromTransactionIdStrings

public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings)
                                                                throws CatalogServiceException
Specified by:
getMetadataFromTransactionIdStrings in interface CatalogService
Throws:
CatalogServiceException

getMetadata

public List<TransactionalMetadata> getMetadata(List<TransactionReceipt> transactionReceipts)
                                        throws CatalogServiceException
Throws:
CatalogServiceException

getMetadataFromTransactionIds

public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds)
                                                          throws CatalogServiceException
Specified by:
getMetadataFromTransactionIds in interface CatalogService
Throws:
CatalogServiceException

getCatalogServiceTransactionIds

public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
                                                              String catalogUrn)
                                                       throws CatalogServiceException
Specified by:
getCatalogServiceTransactionIds in interface CatalogService
Throws:
CatalogServiceException

getCatalogServiceTransactionId

public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId,
                                                       String catalogUrn)
                                                throws CatalogServiceException
Specified by:
getCatalogServiceTransactionId in interface CatalogService
Throws:
CatalogServiceException

getCatalogServiceTransactionId

public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt,
                                                       boolean generateNew)
                                                throws CatalogServiceException
Specified by:
getCatalogServiceTransactionId in interface CatalogService
Throws:
CatalogServiceException

generateNewUniqueTransactionId

protected TransactionId<?> generateNewUniqueTransactionId()

generateTransactionId

protected TransactionId<?> generateTransactionId(String stringTransactionId)

getCatalogServiceTransactionId

protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata)
                                                   throws Exception
Throws:
Exception

getCatalogServiceTransactionId

protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata,
                                                          boolean generateNew)
                                                   throws CatalogServiceException
Throws:
CatalogServiceException

getFilteredCatalogList

protected Set<Catalog> getFilteredCatalogList(Metadata metadata)
                                       throws CatalogServiceException
Throws:
CatalogServiceException

queryRecur

protected CatalogServiceLocal.QueryResult queryRecur(QueryExpression queryExpression,
                                                     Set<String> restrictToCatalogIds)
                                              throws CatalogServiceException,
                                                     CatalogException
Throws:
CatalogServiceException
CatalogException

getIntersection

protected List<CatalogReceipt> getIntersection(List<CatalogServiceLocal.QueryResult> queryResults)

reduceToUnderstoodExpressions

protected QueryExpression reduceToUnderstoodExpressions(Catalog catalog,
                                                        QueryExpression queryExpression)
                                                 throws CatalogDictionaryException,
                                                        CatalogException
Throws:
CatalogDictionaryException
CatalogException

containsTranactionReceipts

protected boolean containsTranactionReceipts(List<CatalogServiceLocal.QueryResult> queryResults)

containsUnbalancedCatalogInterest

protected boolean containsUnbalancedCatalogInterest(List<CatalogServiceLocal.QueryResult> queryResults)

getInterestedCatalogs

protected HashSet<String> getInterestedCatalogs(QueryExpression queryExpression,
                                                Set<String> restrictToCatalogIds)
                                         throws CatalogException,
                                                CatalogServiceException
Throws:
CatalogException
CatalogServiceException


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