public class CatalogServiceLocal extends Object implements CatalogService
A Calatog Service that manages Metadata via one or more underlying Catalogs
Modifier and Type | Class and Description |
---|---|
protected class |
CatalogServiceLocal.QueryResult |
protected class |
CatalogServiceLocal.QueryResultGroup |
Modifier and Type | Field and Description |
---|---|
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 |
CATALOG_ID_MET_KEY, CATALOG_IDS_MET_KEY, CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, CATALOG_TRANSACTION_ID_MET_KEY, ENABLE_UPDATE_MET_KEY
Constructor and Description |
---|
CatalogServiceLocal(CatalogRepository catalogRepository,
IngestMapper ingestMapper,
File pluginStorageDir,
TransactionIdFactory transactionIdFactory,
boolean restrictQueryPermissions,
boolean restrictIngestPermissions,
boolean oneCatalogFailsAllFail,
boolean simplifyQueries,
boolean disableIntersectingCrossCatalogQueries,
int crossCatalogResultSortingThreshold) |
Modifier and Type | Method and Description |
---|---|
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() |
protected ReadWriteLock catalogsLock
protected CatalogRepository catalogRepository
protected IngestMapper ingestMapper
protected ReadWriteLock ingestMapperLock
protected boolean restrictQueryPermissions
protected boolean restrictIngestPermissions
protected TransactionIdFactory transactionIdFactory
protected File pluginStorageDir
protected boolean oneCatalogFailsAllFail
protected boolean simplifyQueries
protected boolean disableIntersectingCrossCatalogQueries
protected int crossCatalogResultSortingThreshold
public CatalogServiceLocal(CatalogRepository catalogRepository, IngestMapper ingestMapper, File pluginStorageDir, TransactionIdFactory transactionIdFactory, boolean restrictQueryPermissions, boolean restrictIngestPermissions, boolean oneCatalogFailsAllFail, boolean simplifyQueries, boolean disableIntersectingCrossCatalogQueries, int crossCatalogResultSortingThreshold) throws InstantiationException
InstantiationException
protected void setCatalogRepository(CatalogRepository catalogRepository) throws CatalogServiceException
repository
- The CatalogRepository to be used by this CatalogServiceCatalogServiceException
- On Error loading given CatalogRepositoryprotected void setIngestMapper(IngestMapper ingestMapper)
public void shutdown() throws CatalogServiceException
shutdown
in interface CatalogService
CatalogServiceException
public boolean isRestrictQueryPermissions()
isRestrictQueryPermissions
in interface CatalogService
protected void setRestrictQueryPermissions(boolean restrictQueryPermissions)
restrictQueryPermissions
- True to block all querys to managing
Catalogs or false to leave it at a per Catalog bases.public boolean isRestrictIngestPermissions()
isRestrictIngestPermissions
in interface CatalogService
protected void setRestrictIngestPermissions(boolean restrictIngestPermissions)
restrictIngestPermissions
- True to block all ingestions to managing
Catalogs or false to leave it at a per Catalog bases.protected void setTransactionIdFactory(TransactionIdFactory transactionIdFactory)
transactionIdClass
- public void addCatalog(String catalogId, Index index) throws CatalogServiceException
addCatalog
in interface CatalogService
CatalogServiceException
public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException
addCatalog
in interface CatalogService
CatalogServiceException
public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogServiceException
addCatalog
in interface CatalogService
CatalogServiceException
public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogServiceException
addDictionary
in interface CatalogService
CatalogServiceException
public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException
replaceDictionaries
in interface CatalogService
CatalogServiceException
public void replaceIndex(String catalogId, Index index) throws CatalogServiceException
replaceIndex
in interface CatalogService
CatalogServiceException
public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogServiceException
modifyIngestPermission
in interface CatalogService
CatalogServiceException
public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogServiceException
modifyQueryPermission
in interface CatalogService
CatalogServiceException
protected void modifyCatalog(String catalogId, List<Dictionary> dictionaries, Index index, Boolean restrictQueryPermission, Boolean restrictIngestPermission) throws CatalogServiceException
CatalogServiceException
protected boolean containsCatalog(String catalogId) throws CatalogServiceException
CatalogServiceException
public void addCatalog(Catalog catalog) throws CatalogServiceException
addCatalog
in interface CatalogService
catalog
- Catalog for this CatalogService to manageCatalogServiceException
- If one of the adding Catalog
URNs equals that of an existing Catalog.public void replaceCatalog(Catalog catalog) throws CatalogServiceException
replaceCatalog
in interface CatalogService
catalog
- Catalog for this CatalogService to manageallowOverride
- True to allow adding Catalog to override existing Catalog with same URNCatalogServiceException
- When allowOverride=false and one of the adding Catalog
URNs equals that of an existing Catalog.public void removeCatalog(String catalogUrn) throws CatalogServiceException
removeCatalog
in interface CatalogService
CatalogServiceException
public void removeCatalog(String catalogId, boolean preserveMapping) throws CatalogServiceException
catalogUrn
- CatalogServiceException
public void setPluginStorageDir(File pluginStorageDir)
public URL getPluginStorageDir() throws CatalogServiceException
getPluginStorageDir
in interface CatalogService
CatalogServiceException
public List<PluginURL> getPluginUrls() throws CatalogServiceException
getPluginUrls
in interface CatalogService
CatalogServiceException
public void addPluginUrls(List<PluginURL> urls) throws CatalogServiceException
addPluginUrls
in interface CatalogService
CatalogServiceException
public Set<Catalog> getCurrentCatalogList() throws CatalogServiceException
CatalogServiceException
protected Catalog getCatalog(String catalogUrn) throws CatalogServiceException
CatalogServiceException
public Set<String> getCurrentCatalogIds() throws CatalogServiceException
getCurrentCatalogIds
in interface CatalogService
CatalogServiceException
public TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException
ingest
in interface CatalogService
CatalogServiceException
public void delete(Metadata metadata) throws CatalogServiceException
delete
in interface CatalogService
metadata
- CatalogServiceException
protected boolean doReduce(Metadata metadata)
public List<String> getProperty(String key) throws CatalogServiceException
getProperty
in interface CatalogService
CatalogServiceException
public Properties getCalalogProperties() throws CatalogServiceException
getCalalogProperties
in interface CatalogService
CatalogServiceException
public Properties getCalalogProperties(String catalogUrn) throws CatalogServiceException
getCalalogProperties
in interface CatalogService
CatalogServiceException
public Page getNextPage(Page page) throws CatalogServiceException
getNextPage
in interface CatalogService
CatalogServiceException
public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException
getPage
in interface CatalogService
CatalogServiceException
public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException
getPage
in interface CatalogService
CatalogServiceException
public QueryPager query(QueryExpression queryExpression) throws CatalogServiceException
query
in interface CatalogService
CatalogServiceException
public List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException
getMetadata
in interface CatalogService
CatalogServiceException
protected Page getPage(QueryExpression queryExpression, Set<String> restrictToCatalogIds, QueryPager queryPager) throws CatalogServiceException
CatalogServiceException
public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException
query
in interface CatalogService
CatalogServiceException
public List<TransactionReceipt> _query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException
queryExpression
- indexPage
- CatalogServiceException
protected List<TransactionReceipt> getPossiblyUnindexedTransactionReceipts(List<CatalogReceipt> catalogReceipts) throws CatalogServiceException
CatalogServiceException
protected List<TransactionReceipt> indexReceipts(List<TransactionReceipt> transactionReceipts) throws CatalogServiceException
CatalogServiceException
public List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogServiceException
getNextPage
in interface CatalogService
CatalogServiceException
public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogServiceException
getAllPages
in interface CatalogService
CatalogServiceException
public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException
getMetadataFromTransactionIdStrings
in interface CatalogService
CatalogServiceException
public List<TransactionalMetadata> getMetadata(List<TransactionReceipt> transactionReceipts) throws CatalogServiceException
CatalogServiceException
public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogServiceException
getMetadataFromTransactionIds
in interface CatalogService
CatalogServiceException
public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogUrn) throws CatalogServiceException
getCatalogServiceTransactionIds
in interface CatalogService
CatalogServiceException
public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogServiceException
getCatalogServiceTransactionId
in interface CatalogService
CatalogServiceException
public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException
getCatalogServiceTransactionId
in interface CatalogService
CatalogServiceException
protected TransactionId<?> generateNewUniqueTransactionId()
protected TransactionId<?> generateTransactionId(String stringTransactionId)
protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws Exception
Exception
protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata, boolean generateNew) throws CatalogServiceException
CatalogServiceException
protected Set<Catalog> getFilteredCatalogList(Metadata metadata) throws CatalogServiceException
CatalogServiceException
protected CatalogServiceLocal.QueryResult queryRecur(QueryExpression queryExpression, Set<String> restrictToCatalogIds) throws CatalogServiceException, CatalogException
protected List<CatalogReceipt> getIntersection(List<CatalogServiceLocal.QueryResult> queryResults)
protected QueryExpression reduceToUnderstoodExpressions(Catalog catalog, QueryExpression queryExpression) throws CatalogDictionaryException, CatalogException
protected boolean containsTranactionReceipts(List<CatalogServiceLocal.QueryResult> queryResults)
protected boolean containsUnbalancedCatalogInterest(List<CatalogServiceLocal.QueryResult> queryResults)
protected HashSet<String> getInterestedCatalogs(QueryExpression queryExpression, Set<String> restrictToCatalogIds) throws CatalogException, CatalogServiceException
Copyright © 1999-2014 Apache OODT. All Rights Reserved.