public class SimpleIndexingAdmin extends GenericService implements Schedulable
The indexing job is defined via the phaseToPriorityAndTasks property. An indexing job is made up of indexing phases, which in turn create indexing tasks.
Created: November 23 2011
IndexingJob
,
IndexingPhase
,
IndexingTask
Modifier and Type | Class and Description |
---|---|
protected class |
SimpleIndexingAdmin.IndexingJobShutdownHook
A shutdown hook that will cancel any running indexing job on
server shutdown
|
static class |
SimpleIndexingAdmin.IndexingStatusInfo
A simple bean to hold information about the indexing status
and history.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected java.lang.Object |
JOB_CONTROL_LOCK
Used when starting a job.
|
protected ScheduledJob |
mBaselineScheduledJob |
protected ScheduledJob |
mPartialScheduledJob |
protected long |
mRetryInMs |
protected java.lang.Object |
SCHEDULE_LOCK
A lock for stopping/starting the schedule.
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
SimpleIndexingAdmin() |
Modifier and Type | Method and Description |
---|---|
protected void |
addShutdownHook(java.lang.Thread hook)
Add a shutdown hook to run time
|
void |
cleanAllHistoryItems()
Clean out all history items.
|
void |
clearAffectedByCADeploymentFlag()
Clears property affectedByCADeployment.
|
protected void |
clearQueue()
remove from the indexing queue all jobs where owner
is /atg/commerce/endeca/index/ProductCatalogSimpleIndexingAdmin
|
protected IndexingJob |
constructIndexingJob(boolean pBaseline)
Construct an indexing job, including adding subtasks.
|
protected javax.servlet.Servlet |
createAdminServlet()
Creates and returns a new Servlet that will administer this
service.
|
protected atg.endeca.index.events.IndexingMessage |
createIndexingMessage(IndexingJob pIndexingJob)
Creates an
IndexingMessage from an indexing job. |
protected SimpleIndexingAdmin.IndexingStatusInfo |
createIndexingStatusInfo()
Create a new IndexingStatusInfo (or subclass).
|
boolean |
doesIndexIndexingOutputConfigPath(java.lang.String pPath)
Return whether this simple admin indexes the specified indexing output
config path.
|
void |
doStartService()
Parse our definition now, and validate after Nucleus start.
|
void |
doStopService()
This is called when a Service is required to shut down.
|
boolean |
executeOrQueueIndexingJob(boolean pBaseline)
Either execute or queue an indexing job.
|
java.lang.Thread |
getActiveIndexingThread()
Returns property activeIndexingThread.
|
int |
getAdminAutoRefreshSeconds()
Returns property adminAutoRefreshSeconds.
|
Schedule |
getBaselineSchedule()
Returns property baselineSchedule.
|
ScheduledJob |
getBaselineScheduledJob()
Returns property partialScheduledJob.
|
java.lang.String |
getBaselineScheduledJobName()
Returns property baselineScheduledJobName.
|
Indexable[] |
getIndexables()
Returns property indexables.
|
IndexingJob |
getIndexingJob()
Returns property indexingJob.
|
atg.endeca.index.admin.IndexingJobDefinition |
getIndexingJobDefinition()
Returns property getIndexingJobDefinition.
|
RepositoryItem[] |
getIndexingJobHistory(int pStartingIndex,
int pEndingIndex)
Get the repository items representing the indexing job history.
|
int |
getIndexingJobHistoryCount()
Get the repository items representing the indexing job history.
|
atg.endeca.index.events.IndexingMessageSource |
getIndexingMessageSource()
Returns property indexingMessageSource.
|
java.util.Set<java.lang.String> |
getIndexingOutputConfigPaths()
Returns property indexingOutputConfigPaths.
|
atg.endeca.index.admin.IndexingStatePersister |
getIndexingStatePersister()
Returns property indexingStatePersister.
|
SimpleIndexingAdmin.IndexingStatusInfo |
getIndexingStatusInfo()
Return the indexing status info.
|
SimpleIndexingAdmin.IndexingStatusInfo |
getIndexingStatusInfo(int pStartingIndex,
int pEndingIndex,
java.util.Locale pLocale)
Return the indexing status info.
|
int |
getJobHistoryPageSize()
Returns property jobHistoryPageSize.
|
JobQueue |
getJobQueue()
Returns property jobQueue.
|
java.lang.String |
getLocalSynchronizationInvokerPath()
Returns property localSynchronizationInvokerPath.
|
Schedule |
getPartialSchedule()
Returns property partialSchedule.
|
ScheduledJob |
getPartialScheduledJob()
Returns property partialScheduledJob.
|
java.lang.String |
getPartialScheduledJobName()
Returns property partialScheduledJobName.
|
java.lang.String[] |
getPhaseToPrioritiesAndTasks()
Returns property phaseToPrioritiesAndTasks.
|
long |
getRetryInMs()
Returns property retryInMs.
|
Scheduler |
getScheduler()
Returns property scheduler.
|
int |
getScheduleThreadMethod()
Returns property scheduleThreadMethod.
|
javax.transaction.TransactionManager |
getTransactionManager()
Returns property transactionManager.
|
boolean |
indexBaseline()
Do a full, baseline index.
|
protected boolean |
indexBaseline(IndexingJob pJob,
boolean pUseJobQueue)
Do a full, baseline index.
|
boolean |
indexPartial()
Do a partial, incremental index.
|
protected boolean |
indexPartial(IndexingJob pJob,
boolean pUseJobQueue)
Do a partial, incremental index.
|
boolean |
isActivelyIndexing()
Whether we are actively indexing.
|
boolean |
isAffectedByCADeployment()
Returns property affectedByCADeployment.
|
boolean |
isDeferRunningJobsOnCADeploymentStarts()
Returns property deferRunningJobsOnCADeploymentStarts.
|
boolean |
isEnableScheduledIndexing()
Returns property enableScheduledIndexing.
|
boolean |
isOnCADeploymentChangesIndexInBackground()
Returns property onCADeploymentChangesIndexInBackground.
|
protected boolean |
isQueueNotEmpty() |
boolean |
isRunTasksWithinPhaseInParallel()
Returns property runTasksWithinPhaseInParallel.
|
void |
onCADeploymentChanges(java.util.Set<java.lang.String> pAffectedIOCPaths)
This is invoked by the LocalSynchronizationInvokerService when the
IndexingDeploymentListener invokes.
|
void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
This is called when a scheduled job tied to this object occurs.
|
void |
queueIndexingJob(boolean pBaseline)
Queue an indexing job to our JobQueue.
|
protected void |
removeShutdownHook(java.lang.Thread hook)
Remove a shutdown hook from Runtime
|
protected void |
sendIndexingMessage(IndexingJob pJob)
Sends an indexing message using the indexingMessageSource
|
void |
setActiveIndexingThread(java.lang.Thread pActiveIndexingThread)
Sets property activeIndexingThread.
|
void |
setAdminAutoRefreshSeconds(int pAdminAutoRefreshSeconds)
Sets property adminAutoRefreshSeconds.
|
void |
setBaselineSchedule(Schedule pBaselineSchedule)
Sets property baselineSchedule.
|
void |
setBaselineScheduledJobName(java.lang.String pBaselineScheduledJobName)
Sets property baselineScheduledJobName.
|
void |
setDeferRunningJobsOnCADeploymentStarts(boolean pDeferRunningJobsOnCADeploymentStarts)
Sets property deferRunningJobsOnCADeploymentStarts.
|
void |
setEnableScheduledIndexing(boolean pEnableScheduledIndexing)
Sets property enableScheduledIndexing.
|
protected void |
setIndexables(Indexable[] pIndexables)
Sets property indexables.
|
void |
setIndexingJob(IndexingJob pIndexingJob)
Sets property indexingJob.
|
void |
setIndexingJobDefinition(atg.endeca.index.admin.IndexingJobDefinition pIndexingJobDefinition)
Sets property getIndexingJobDefinition.
|
void |
setIndexingMessageSource(atg.endeca.index.events.IndexingMessageSource pIndexingMessageSource)
Sets property indexingMessageSource.
|
void |
setIndexingStatePersister(atg.endeca.index.admin.IndexingStatePersister pIndexingStatePersister)
Sets property indexingStatePersister.
|
void |
setJobHistoryPageSize(int pJobHistoryPageSize)
Sets property jobHistoryPageSize.
|
void |
setJobQueue(JobQueue pJobQueue)
Sets property jobQueue.
|
void |
setLocalSynchronizationInvokerPath(java.lang.String pLocalSynchronizationInvokerPath)
Sets property localSynchronizationInvokerPath.
|
void |
setOnCADeploymentChangesIndexInBackground(boolean pOnCADeploymentChangesIndexInBackground)
Sets property onCADeploymentChangesIndexInBackground.
|
void |
setPartialSchedule(Schedule pPartialSchedule)
Sets property partialSchedule.
|
void |
setPartialScheduledJobName(java.lang.String pPartialScheduledJobName)
Sets property partialScheduledJobName.
|
void |
setPhaseToPrioritiesAndTasks(java.lang.String[] pPhaseToPrioritiesAndTasks)
Sets property phaseToPrioritiesAndTasks.
|
void |
setRetryInMs(long pRetryInMs)
Sets property mRetryInMs.
|
void |
setRunTasksWithinPhaseInParallel(boolean pRunTasksWithinPhaseInParallel)
Sets property runTasksWithinPhaseInParallel.
|
void |
setScheduler(Scheduler pScheduler)
Sets property scheduler.
|
void |
setScheduleThreadMethod(int pScheduleThreadMethod)
Sets property scheduleThreadMethod.
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property transactionManager.
|
java.lang.Thread |
startIndexingJobInBackground(boolean pBaseline)
Start an indexing job in its own thread.
|
protected void |
startScheduledJobs()
Start any scheduled jobs, if configured to do so.
|
protected void |
stopScheduledJob(ScheduledJob pJob)
Stop the specified scheduled job and log any exception.
|
protected void |
stopScheduledJobs()
Stop any scheduled jobs by removing them from the scheduler.
|
protected void |
updateIndexingOutputConfigPaths(IndexingJob pIndexingJob)
Update the indexingOutputConfigPaths property based on the passed
in IndexingJob.
|
addLogListener, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
protected java.lang.Object JOB_CONTROL_LOCK
protected java.lang.Object SCHEDULE_LOCK
protected ScheduledJob mBaselineScheduledJob
protected ScheduledJob mPartialScheduledJob
protected long mRetryInMs
public void setIndexingStatePersister(atg.endeca.index.admin.IndexingStatePersister pIndexingStatePersister)
public atg.endeca.index.admin.IndexingStatePersister getIndexingStatePersister()
protected void setIndexables(Indexable[] pIndexables)
public Indexable[] getIndexables()
public void setIndexingJobDefinition(atg.endeca.index.admin.IndexingJobDefinition pIndexingJobDefinition)
public atg.endeca.index.admin.IndexingJobDefinition getIndexingJobDefinition()
public void setActiveIndexingThread(java.lang.Thread pActiveIndexingThread)
public java.lang.Thread getActiveIndexingThread()
public boolean isActivelyIndexing()
public void setPhaseToPrioritiesAndTasks(java.lang.String[] pPhaseToPrioritiesAndTasks)
public java.lang.String[] getPhaseToPrioritiesAndTasks()
public void setIndexingJob(IndexingJob pIndexingJob)
public IndexingJob getIndexingJob()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setRunTasksWithinPhaseInParallel(boolean pRunTasksWithinPhaseInParallel)
public boolean isRunTasksWithinPhaseInParallel()
public void setAdminAutoRefreshSeconds(int pAdminAutoRefreshSeconds)
public int getAdminAutoRefreshSeconds()
public void setLocalSynchronizationInvokerPath(java.lang.String pLocalSynchronizationInvokerPath)
public java.lang.String getLocalSynchronizationInvokerPath()
public java.util.Set<java.lang.String> getIndexingOutputConfigPaths()
public void setOnCADeploymentChangesIndexInBackground(boolean pOnCADeploymentChangesIndexInBackground)
public boolean isOnCADeploymentChangesIndexInBackground()
public void setScheduler(Scheduler pScheduler)
public Scheduler getScheduler()
public void setScheduleThreadMethod(int pScheduleThreadMethod)
REUSE_THREAD
.public int getScheduleThreadMethod()
REUSE_THREAD
.public void setBaselineSchedule(Schedule pBaselineSchedule)
public Schedule getBaselineSchedule()
public void setBaselineScheduledJobName(java.lang.String pBaselineScheduledJobName)
public java.lang.String getBaselineScheduledJobName()
public ScheduledJob getBaselineScheduledJob()
public void setPartialSchedule(Schedule pPartialSchedule)
public Schedule getPartialSchedule()
public void setPartialScheduledJobName(java.lang.String pPartialScheduledJobName)
public java.lang.String getPartialScheduledJobName()
public ScheduledJob getPartialScheduledJob()
public void setEnableScheduledIndexing(boolean pEnableScheduledIndexing)
public boolean isEnableScheduledIndexing()
public long getRetryInMs()
public void setRetryInMs(long pRetryInMs)
public void setJobQueue(JobQueue pJobQueue)
public JobQueue getJobQueue()
public void setIndexingMessageSource(atg.endeca.index.events.IndexingMessageSource pIndexingMessageSource)
public atg.endeca.index.events.IndexingMessageSource getIndexingMessageSource()
public void setDeferRunningJobsOnCADeploymentStarts(boolean pDeferRunningJobsOnCADeploymentStarts)
pDeferRunningJobsOnCADeploymentStarts
- true
means that a running indexing job should be deferred (canceled and queued) when a CA deployment starts;
false
a running indexing process should be finished independently of CA deployments.public boolean isDeferRunningJobsOnCADeploymentStarts()
true
means that a running indexing job should be deferred (canceled and queued) when a CA deployment starts;
false
a running indexing process will be finished independently of CA deployments.public void setJobHistoryPageSize(int pJobHistoryPageSize)
public int getJobHistoryPageSize()
public boolean isAffectedByCADeployment()
public void clearAffectedByCADeploymentFlag()
public void onCADeploymentChanges(java.util.Set<java.lang.String> pAffectedIOCPaths)
pAffectedIOCPaths
- the array of affected indexing output config
paths.public boolean indexBaseline() throws IndexingException
IndexingException
protected boolean indexBaseline(IndexingJob pJob, boolean pUseJobQueue) throws IndexingException
IndexingException
public boolean indexPartial() throws IndexingException
IndexingException
protected boolean indexPartial(IndexingJob pJob, boolean pUseJobQueue) throws IndexingException
IndexingException
protected atg.endeca.index.events.IndexingMessage createIndexingMessage(IndexingJob pIndexingJob)
IndexingMessage
from an indexing job. Sets
ownerName, ownerPath, startTime, finishTime and statuspIndexingJob
- relevant indexing jobprotected void sendIndexingMessage(IndexingJob pJob)
pJob
- the indexing jobprotected void clearQueue()
protected boolean isQueueNotEmpty()
protected IndexingJob constructIndexingJob(boolean pBaseline) throws IndexingException
pBaseline
- whether this is a baseline index.IndexingException
protected void startScheduledJobs()
protected void stopScheduledJob(ScheduledJob pJob)
pJob
- the scheduled job to stop.protected void stopScheduledJobs()
public void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- calling the jobpJob
- the ScheduledJobpublic void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void doStopService() throws ServiceException
GenericService
doStopService
in class GenericService
ServiceException
- if the Service had a problem shutting downprotected void updateIndexingOutputConfigPaths(IndexingJob pIndexingJob)
pIndexingJob
- the IndexingJob whose tasks should be consulted
when updating the the indexingOutputConfigPaths property.public boolean doesIndexIndexingOutputConfigPath(java.lang.String pPath)
pPath
- the absolute Nucleus path of the IndexingOutputConfig in
question.public java.lang.Thread startIndexingJobInBackground(boolean pBaseline)
pBaseline
- whether this is a baseline index.public boolean executeOrQueueIndexingJob(boolean pBaseline) throws IndexingException
pBaseline
- whether to perform a baseline index. False means
incremental, true means baseline.IndexingException
public void queueIndexingJob(boolean pBaseline) throws IndexingException
pBaseline
- a true value means queue a baseline index, a false
value means an incremental index.IndexingException
protected void addShutdownHook(java.lang.Thread hook)
hook
- the shutdown hookprotected void removeShutdownHook(java.lang.Thread hook)
hook
- the shutdown hookpublic RepositoryItem[] getIndexingJobHistory(int pStartingIndex, int pEndingIndex) throws IndexingException
pStartingIndex
- the starting index (as supported by
RepositoryView.executeQuery())EndingIndex
- the ending index (as supported by
RepositoryView.executeQuery())IndexingException
public int getIndexingJobHistoryCount() throws IndexingException
pStartingIndex
- the starting index (as supported by
RepositoryView.executeQuery())EndingIndex
- the ending index (as supported by
RepositoryView.executeQuery())IndexingException
public void cleanAllHistoryItems() throws IndexingException
IndexingException
protected javax.servlet.Servlet createAdminServlet()
GenericService
createAdminServlet
in class GenericService
public SimpleIndexingAdmin.IndexingStatusInfo getIndexingStatusInfo() throws IndexingException
pStartingIndex
- the starting index of history items to return.pEndingIndex
- the ending index of history items to return.IndexingException
public SimpleIndexingAdmin.IndexingStatusInfo getIndexingStatusInfo(int pStartingIndex, int pEndingIndex, java.util.Locale pLocale) throws IndexingException
pStartingIndex
- the starting index of history items to return.pEndingIndex
- the ending index of history items to return.pLocale
- the locale to get the info in.IndexingException
protected SimpleIndexingAdmin.IndexingStatusInfo createIndexingStatusInfo()