public class DatabaseIndexer extends neo.xredsys.api.services.AbstractServiceRegistry<IndexBeanProvider> implements Indexer
GenericService.StartCommand, GenericService.StopCommand
Indexer.IndexBoundary
Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.Logger |
mLogger |
state
Constructor and Description |
---|
DatabaseIndexer()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(IndexBean pBean)
Add a search object.
|
void |
cleanup()
Marks deleted content as deleted also in the search index.
|
void |
delete(IndexBean pBean)
Deletes a search object.
|
void |
delete(neo.dbaccess.Transaction pTransaction,
ProtectionDomain pProtectionDomain)
Deletes all index beans in the given
ProtectionDomain |
void |
delete(neo.dbaccess.Transaction pTransaction,
Section pSection)
Deletes all index beans in the given
Section and all it's subsections recursively. |
void |
doCleanup()
Deprecated.
Use
cleanup() instead |
neo.xredsys.acl.ACLManager |
getACLManager() |
neo.xredsys.content.ContentManager |
getContentManager() |
String |
getHistory() |
IndexBean |
getIndexBean(int pObjectId,
String pObjectType)
Retrieve
IndexBean |
Map<Integer,IndexBean> |
getIndexBeansForPool(int pStartRow,
int pRows,
Indexer.IndexBoundary pBoundary,
String pPoolType,
int pPoolId)
Returns index beans from persistent storage for a supplied pool id.
|
Map<Integer,IndexBean> |
getIndexBeansForProtectionDomain(int pStartRow,
int pRows,
Indexer.IndexBoundary pBoundary,
ProtectionDomain... pProtectionDomains)
Retrieves
beans from persistent storage such that it matches any one of
the supplied protection domains. |
Map<Integer,IndexBean> |
getIndexBeansForPublication(int pStartRow,
int pRows,
boolean pStructuralChanges,
Indexer.IndexBoundary pBoundary,
int pPublicationId)
Retrieves
beans from persistent storage such that it matches the supplied publicationid. |
Map<Integer,IndexBean> |
getIndexBeansForPublication(int pStartRow,
int pRows,
Indexer.IndexBoundary pBoundary,
int pPublicationId) |
int |
getMaxDelay() |
int |
getMaxDelayBetweenLockAttempts() |
int |
getMilliSecondsToWaitBetweenDrainingQueue() |
int |
getNumberOfDaysToKeepDeletedItemsInIndex() |
ResourceLockManager |
getResourceLockManager() |
int |
getSecondsToKeepBackgroundSync() |
int |
getSecondsToWaitBetweenSyncs() |
void |
indexMissingEntries()
Indexes all missing entries
|
void |
indexMissingEntries(Timestamp pTimestamp)
Indexes all missing entries that has been modified after the given timestamp
|
void |
insertSearchContent(List<IndexBean> pBeans)
Used internally to insert any content objects that does not exist.
|
String |
lock()
Locks the indexer.
|
void |
purgeDeletedItems()
Ensure all deleted items are removed from the index
|
void |
reIndex()
Build the index from scratch.
|
void |
reIndex(Section pSection)
Reindexes all content from the section in a separate thread
|
void |
reIndex(Section pSection,
boolean pOnlySameProtectionDomain)
Reindex the given section and all it's subsections.
|
void |
reIndexTag()
Build the index from scratch only for tag.
|
void |
release(String pLock)
Releases the lock on the indexer and makes it possible for other processes to be able to work with the index
|
void |
setACLManager(neo.xredsys.acl.ACLManager pACLManager) |
void |
setContentManager(neo.xredsys.content.ContentManager pContentManager) |
void |
setMaxDelay(int mMaxDelay) |
void |
setMaxDelayBetweenLockAttempts(int mMaxDelayBetweenLockAttempts) |
void |
setMilliSecondsToWaitBetweenDrainingQueue(int mMilliSecondsToWaitBetweenDrainingQueue) |
void |
setNumberOfDaysToKeepDeletedItemsInIndex(int mNumberOfDaysToKeepDeletedItemsInIndex) |
void |
setResourceLockManager(ResourceLockManager pResourceLockManager) |
void |
setSecondsToKeepBackgroundSync(int pSecondsToKeepBackgroundSync) |
void |
setSecondsToWaitBetweenSyncs(int pSecondsToWaitBetweenSyncs) |
protected void |
startRegistry()
Template method: Will be called from
AbstractServiceRegistry.startService() when we are starting this ServiceRegistry. |
protected void |
stopRegistry()
Template method: Will be called from
AbstractServiceRegistry.stopService() when we are to stop running this ServiceRegistry. |
Iterator<neo.util.bus.Payload> |
stream(int pLastEventId)
Retrieve all the payloads after the given eventId as an iterator.
|
void |
sync()
Synchronizes the index
|
void |
update(IndexBean pBean)
Update a search object.
|
void |
updateSearchIndex(IndexBean pIndexBean) |
addService, decorateService, getLastModified, getServices, iterator, loadServicesFromClasspath, startService, stopService
doStartService, doStopService, stopIdleService
assertServiceRunning, getServiceDescription, getServiceMessage, getServiceState, isServiceEnabled, isServiceFailed, isServiceIdle, isServiceRunning, isServiceShutdownFailed, isServiceStopped, setServiceDescription, setServiceEnabled, start, stop, validateIsTrue, validateNotNull
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DatabaseIndexer() throws URISyntaxException
URISyntaxException
public neo.xredsys.content.ContentManager getContentManager()
public void setContentManager(neo.xredsys.content.ContentManager pContentManager)
public int getMilliSecondsToWaitBetweenDrainingQueue()
public void setMilliSecondsToWaitBetweenDrainingQueue(int mMilliSecondsToWaitBetweenDrainingQueue)
public int getMaxDelayBetweenLockAttempts()
public void setMaxDelayBetweenLockAttempts(int mMaxDelayBetweenLockAttempts)
public String getHistory()
public int getSecondsToWaitBetweenSyncs()
public void setSecondsToWaitBetweenSyncs(int pSecondsToWaitBetweenSyncs)
public int getSecondsToKeepBackgroundSync()
public void setSecondsToKeepBackgroundSync(int pSecondsToKeepBackgroundSync)
public int getNumberOfDaysToKeepDeletedItemsInIndex()
public void setNumberOfDaysToKeepDeletedItemsInIndex(int mNumberOfDaysToKeepDeletedItemsInIndex)
public ResourceLockManager getResourceLockManager()
public void setResourceLockManager(ResourceLockManager pResourceLockManager)
public int getMaxDelay()
public void setMaxDelay(int mMaxDelay)
public neo.xredsys.acl.ACLManager getACLManager()
public void setACLManager(neo.xredsys.acl.ACLManager pACLManager)
protected void startRegistry()
neo.xredsys.api.services.AbstractServiceRegistry
Template method: Will be called from AbstractServiceRegistry.startService()
when we are starting this ServiceRegistry. Exceptions thrown from
this method will be handled by AbstractNurseryService.doStartService()
. It will be called after that the ServiceRegistry have been started, but before
service providers.
Subclasses might override this method to add bootstrap to the ServiceRegistry.
startRegistry
in class neo.xredsys.api.services.AbstractServiceRegistry<IndexBeanProvider>
AbstractServiceRegistry.startService()
protected void stopRegistry()
neo.xredsys.api.services.AbstractServiceRegistry
Template method: Will be called from AbstractServiceRegistry.stopService()
when we are to stop running this ServiceRegistry. Exceptions thrown
from this method will be logged by AbstractNurseryService.doStopService()
.
Subclasses might override this method to add shutdown logic to the ServiceRegistry.
stopRegistry
in class neo.xredsys.api.services.AbstractServiceRegistry<IndexBeanProvider>
AbstractServiceRegistry.stopService()
public void reIndex() throws PersistentStoreException
Indexer
reIndex
in interface Indexer
PersistentStoreException
- if something failspublic void sync() throws PersistentStoreException
Indexer
sync
in interface Indexer
PersistentStoreException
- if something failspublic void purgeDeletedItems() throws PersistentStoreException
Indexer
purgeDeletedItems
in interface Indexer
PersistentStoreException
- if something failspublic Map<Integer,IndexBean> getIndexBeansForProtectionDomain(int pStartRow, int pRows, Indexer.IndexBoundary pBoundary, ProtectionDomain... pProtectionDomains)
Indexer
beans
from persistent storage such that it matches any one of
the supplied protection domains.getIndexBeansForProtectionDomain
in interface Indexer
pStartRow
- The row place holder to start with relative topRows
- Maximum number of rows to fetchpBoundary
- Boundary condition to check against for placeholderpProtectionDomains
- The protection domains to get index beans for.beans
matching any of the
pProtectionDomainspublic Map<Integer,IndexBean> getIndexBeansForPublication(int pStartRow, int pRows, Indexer.IndexBoundary pBoundary, int pPublicationId)
public Map<Integer,IndexBean> getIndexBeansForPublication(int pStartRow, int pRows, boolean pStructuralChanges, Indexer.IndexBoundary pBoundary, int pPublicationId)
Indexer
beans
from persistent storage such that it matches the supplied publicationid.getIndexBeansForPublication
in interface Indexer
pStartRow
- The row place holder to start with relative topRows
- Maximum number of rows to fetchpStructuralChanges
- Include structural changes (or
incidental changes if you will) instead of changes to the content
items themselves. Structural changes are changes are for example if a
section is moved, then all sub sections and content items
belonging to that section will be included in the structural
changes result set.pBoundary
- Boundary condition to check against for placeholderpPublicationId
- The id of the publication to get index beans for.beans
matching any of the
pProtectionDomainspublic Map<Integer,IndexBean> getIndexBeansForPool(int pStartRow, int pRows, Indexer.IndexBoundary pBoundary, String pPoolType, int pPoolId)
Indexer
getIndexBeansForPool
in interface Indexer
pStartRow
- the row place holder to start with relative to.pRows
- the maximum number of rows to fetch.pBoundary
- the boundary condition to check against for place holder.pPoolType
- the type of the pool.pPoolId
- the id of the pool.public void cleanup()
Indexer
public void doCleanup()
cleanup()
insteadpublic void indexMissingEntries()
Indexer
indexMissingEntries
in interface Indexer
public void indexMissingEntries(Timestamp pTimestamp)
Indexer
indexMissingEntries
in interface Indexer
public void add(IndexBean pBean)
Indexer
public void update(IndexBean pBean)
Indexer
public void delete(IndexBean pBean)
Indexer
public void reIndex(Section pSection) throws PersistentStoreException
reIndex
in interface Indexer
pSection
- the section to reindexPersistentStoreException
public void reIndex(Section pSection, boolean pOnlySameProtectionDomain) throws PersistentStoreException
Indexer
reIndex
in interface Indexer
pSection
- the section to reindexpOnlySameProtectionDomain
- if true, the method will only reindex the section in the same protection domain as the given section.
Note that the section does not have to be a protection domain itselfPersistentStoreException
- if something failspublic void reIndexTag() throws PersistentStoreException
Indexer
reIndexTag
in interface Indexer
PersistentStoreException
- if something failspublic String lock()
Indexer
Indexer.release(String)
when they are done.public void release(String pLock)
Indexer
release
in interface Indexer
pLock
- the lock obtained by Indexer.lock()
public void insertSearchContent(List<IndexBean> pBeans) throws SQLException
Indexer
insertSearchContent
in interface Indexer
pBeans
- - the list of objects to insert.SQLException
- - if an error occurs while trying to insert the objectspublic void updateSearchIndex(IndexBean pIndexBean) throws SQLException
updateSearchIndex
in interface Indexer
SQLException
public IndexBean getIndexBean(int pObjectId, String pObjectType)
Indexer
IndexBean
getIndexBean
in interface Indexer
pObjectId
- object id to retrievepObjectType
- object type to retrieveIndexBean
public void delete(neo.dbaccess.Transaction pTransaction, ProtectionDomain pProtectionDomain) throws SQLException
Indexer
ProtectionDomain
delete
in interface Indexer
pTransaction
- - the transaction to participate inpProtectionDomain
- - the ProtectionDomain
to remove the beans fromSQLException
- if moving the beans failspublic void delete(neo.dbaccess.Transaction pTransaction, Section pSection) throws SQLException
Indexer
Section
and all it's subsections recursively. This method
will only remove index beans in section which has the same protection domain as the given section.delete
in interface Indexer
pTransaction
- - the transaction to participate inpSection
- - the Section
to remove the beans fromSQLException
- if moving the beans failspublic Iterator<neo.util.bus.Payload> stream(int pLastEventId) throws SQLException
Indexer
Iterator.hasNext()
will return falsestream
in interface Indexer
pLastEventId
- the id of the last eventSQLException
- if retrieving the payloads fail© 1998- 2018 Stibo DX