public class ConfigStatePersister
extends atg.repository.search.indexing.RepositoryLockingService
implements atg.nucleus.PostStartupAction
 A generation is merely a version number for a set of changes. The
 generation mechanism exists so that the incremental loader can queue up a
 set of changes (see IncrementalItemQueue), claim that generation
 and begin processing it, even as change events get queued up in the next
 generation.
 
Created: April 15 2005
| Modifier and Type | Class and Description | 
|---|---|
class  | 
ConfigStatePersister.ConfigState
Class which represents the configuration state. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CLASS_VERSION
Class version string 
 | 
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
ConfigStatePersister()  | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
claimAndIncrementGeneration(java.lang.String pConfigPath,
                           java.lang.String pContentId,
                           boolean pForIncrementalUpdate,
                           boolean pUseConfigurationClaims,
                           IndexingOutputConfig pIOC)
Claim the current generation, increment the generation count,
 and return the number for the generation we just claimed. 
 | 
void | 
completedFullIndex(java.lang.String pConfigPath,
                  java.lang.String pContentId,
                  int pGeneration,
                  boolean pCompletedSuccessfully,
                  boolean pUseConfigurationClaims)
Handle the completion of an full index of the specified
 generation. 
 | 
void | 
completedIncrementalIndex(java.lang.String pConfigPath,
                         java.lang.String pContentId,
                         int pGeneration,
                         boolean pCompletedSuccessfully,
                         boolean pUseConfigurationClaims)
Handle the completion of an incremental index of the specified
 generation. 
 | 
protected void | 
completedIndex(java.lang.String pConfigPath,
              java.lang.String pContentId,
              int pGeneration,
              boolean pCompletedSuccessfully,
              boolean pIncremental,
              boolean pUseConfigurationClaims)
Release any claim on that generation. 
 | 
protected ConfigStatePersister.ConfigState | 
createConfigState(RepositoryItem pItem)
Create a configuration state from the specified repository item. 
 | 
void | 
doStartService()
Start up the service... 
 | 
java.lang.String | 
encodeKey(java.lang.String pConfigPath,
         java.lang.String pContentId)
Create encoded key for config state item 
 | 
protected RepositoryItem[] | 
getClaimedConfigStateItems()
Return the configuration items claimed by some server. 
 | 
java.lang.String | 
getClaimedGenerationPropertyName()
Get the claimed generation property name. 
 | 
java.lang.String | 
getClaimedLockName()  | 
java.lang.String | 
getConfigPathPropertyName()  | 
protected RepositoryItem[] | 
getConfigStateItemsByUniqueServerId(java.lang.String pUniqueServerId)
Return the repository items that are owned by the specified
 server Id. 
 | 
RepositoryItem[] | 
getConfigStateItemsForConfig(java.lang.String pConfigPath)  | 
java.lang.Object | 
getConfigStateProperty(java.lang.String pConfigPath,
                      java.lang.String pContentId,
                      java.lang.String pPropertyName)
Return the specified property value of the configuration state. 
 | 
java.lang.String | 
getContentIdPropertyName()  | 
int | 
getCurrentGenerationForConfig(java.lang.String pConfigPath,
                             java.lang.String pContentId)
Get the current generation for the specified configuration. 
 | 
int | 
getGenerationForConfig(java.lang.String pConfigPath,
                      java.lang.String pContentId)
Get the generation for the specified config. 
 | 
int | 
getGenerationForIncremental(IndexingOutputConfig pOutputConfig,
                           java.lang.String pContentId)
Get the generation for the specified config. 
 | 
java.lang.String | 
getGenerationPropertyName()  | 
RepositoryItemDescriptor | 
getItemDescriptor()
Get the item descriptor used for storage. 
 | 
java.lang.String | 
getItemDescriptorName()  | 
protected RepositoryItem | 
getItemForConfig(java.lang.String pConfigPath,
                java.lang.String pContentId,
                boolean pMutable)
Get or create the repository item for the specified
 configuration and content set ID. 
 | 
java.lang.String | 
getLastActivityPropertyName()  | 
java.lang.String | 
getLastFullIndexPropertyName()  | 
java.util.Date | 
getLastFullIndexTime(java.lang.String pConfigPath,
                    java.lang.String pContentId)
Get the last full index time. 
 | 
java.lang.String | 
getLastIncrementalIndexPropertyName()  | 
java.util.Date | 
getLastIncrementalIndexTime(java.lang.String pConfigPath,
                           java.lang.String pContentId)
Get the last incremental index time from the assocaited
 "configState" item. 
 | 
java.net.InetAddress | 
getLocalHost()
Returns the InetAddress of this host 
 | 
java.lang.Integer | 
getNextIncrementalGeneration(java.lang.String pConfigPath,
                            java.lang.String pContentId)
Get the next incremental generation value from the configuration
 record. 
 | 
java.lang.String | 
getNextIncrementalGenerationPropertyName()  | 
long | 
getRefreshCurrentGenerationMsecs()
The number of seconds before cached information about
 the current generation for a configuration is considered stale. 
 | 
java.net.InetAddress | 
getSessionIdAddress()
Returns the IP address that will be stamped into generated session id's 
 | 
int | 
getSessionIdPort()
Returns the IP address that will be stamped into generated session id's 
 | 
long | 
getTimeOutMsecs()
Get the number of milliseconds of inactivity before
 a claimed index is considered timed out. 
 | 
protected RepositoryItem[] | 
getUnclaimedConfigStateItems()
Return the configuration items claimed by some server. 
 | 
ConfigStatePersister.ConfigState[] | 
getUnclaimedConfigStates()
Get the generation for the specified config. 
 | 
java.lang.String | 
getUniqueServerId()
This is a uniq id for each dyanmo server. 
 | 
java.lang.String | 
getUniqueServerIdPropertyName()  | 
protected boolean | 
hasTimedOut(long pLastActivity)
Whether the last activity time is considered timed out. 
 | 
protected boolean | 
hasTimedOut(RepositoryItem pItem)
Whether the lastActivity property on pItem is longer
 ago than timeOutMsecs. 
 | 
boolean | 
isUseConfigurationClaims()
Whether to use configuration claims. 
 | 
protected void | 
logReleseConfigrationMessage(MutableRepositoryItem pConfigStateItem)
Log a detailed warning message when releasing expired
 configuration claims. 
 | 
void | 
performAction()
Called after Nucleus starts, after this point it's safe to use
 the ClientLockManager and get actual global locks. 
 | 
void | 
releaseAllConfigurations()
Release all configurations claimed by this server. 
 | 
void | 
releaseTimedOutConfigurations()
Release all configurations claimed by this server. 
 | 
void | 
removedCachedValueForConfig(java.lang.String pConfigPath,
                           java.lang.String pContentId)
Remove cached information for the specified configuration path,
 so that it will be fetched anew next time it is needed. 
 | 
void | 
removeObsoleteConfigState(ConfigStatePersister.ConfigState pConfigState)
Remove config state represented by pConfigState. 
 | 
void | 
setClaimedGenerationPropertyName(java.lang.String pClaimedGenerationPropertyName)
Set the claimed generation property name. 
 | 
void | 
setConfigPathPropertyName(java.lang.String pConfigPathPropertyName)  | 
void | 
setConfigStateProperty(java.lang.String pConfigPath,
                      java.lang.String pContentId,
                      java.lang.String pPropertyName,
                      java.lang.Object pValue)
Set the specified property value of the configuration state. 
 | 
void | 
setContentIdPropertyName(java.lang.String pContentIdPropertyName)  | 
void | 
setGenerationPropertyName(java.lang.String pGenerationPropertyName)  | 
void | 
setItemDescriptorName(java.lang.String pItemDescriptorName)  | 
void | 
setLastActivityPropertyName(java.lang.String pLastActivityPropertyName)  | 
void | 
setLastFullIndexPropertyName(java.lang.String pLastFullIndexPropertyName)  | 
void | 
setLastIncrementalIndexPropertyName(java.lang.String pLastIncrementalIndexPropertyName)  | 
protected void | 
setNextIncrementalGeneration(java.lang.String pConfigPath,
                            java.lang.String pContentId,
                            int pGeneration)
Set the next incremental version to a spcific value. 
 | 
void | 
setNextIncrementalGenerationPropertyName(java.lang.String pNextIncrementalGenerationPropertyName)  | 
void | 
setRefreshCurrentGenerationMsecs(long pRefreshCurrentGenerationMsecs)
The number of seconds before cached information about
 the current generation for a configuration is considered stale. 
 | 
void | 
setSessionIdAddress(java.net.InetAddress pSessionIdAddress)
Sets the IP address that will be stamped into generated session id's 
 | 
void | 
setSessionIdPort(int pSessionIdPort)
Sets the IP address that will be stamped into generated session id's 
 | 
void | 
setTimeOutMsecs(long pTimeOutMsecs)
Set the number of milliseconds of inactivity before
 a claimed index is considered timed out. 
 | 
void | 
setUniqueServerIdPropertyName(java.lang.String pUniqueServerIdPropertyName)  | 
void | 
setUseConfigurationClaims(boolean pUseConfigurationClaims)
Whether to use configuration claims. 
 | 
void | 
updateLastActivityTime(java.lang.String pConfigPath,
                      java.lang.String pContentId,
                      int pGeneration)
Update the activity time for the specified generation. 
 | 
void | 
updateLastActivityTime(java.lang.String pConfigPath,
                      java.lang.String pContentId,
                      int pGeneration,
                      long pLastActivityTime)
Update the activity time for the specified generation in the
 appropriate "searchConfig" item. 
 | 
getAcquireLockTimeoutMs, getClientLockManager, getRepository, getTransactionManager, isAlwaysAcquireWriteLock, isRequireGlobalLock, setAcquireLockTimeoutMs, setAlwaysAcquireWriteLock, setClientLockManager, setRepository, setRequireGlobalLock, setTransactionManageraddLogListener, createAdminServlet, doStopService, 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, toStringvlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic void setItemDescriptorName(java.lang.String pItemDescriptorName)
public java.lang.String getItemDescriptorName()
public RepositoryItemDescriptor getItemDescriptor()
public void setConfigPathPropertyName(java.lang.String pConfigPathPropertyName)
public java.lang.String getConfigPathPropertyName()
public void setContentIdPropertyName(java.lang.String pContentIdPropertyName)
public java.lang.String getContentIdPropertyName()
public void setGenerationPropertyName(java.lang.String pGenerationPropertyName)
public java.lang.String getGenerationPropertyName()
public void setUniqueServerIdPropertyName(java.lang.String pUniqueServerIdPropertyName)
public java.lang.String getUniqueServerIdPropertyName()
public void setLastActivityPropertyName(java.lang.String pLastActivityPropertyName)
public java.lang.String getLastActivityPropertyName()
public void setLastFullIndexPropertyName(java.lang.String pLastFullIndexPropertyName)
public java.lang.String getLastFullIndexPropertyName()
public void setLastIncrementalIndexPropertyName(java.lang.String pLastIncrementalIndexPropertyName)
public java.lang.String getLastIncrementalIndexPropertyName()
public void setTimeOutMsecs(long pTimeOutMsecs)
public long getTimeOutMsecs()
public void setRefreshCurrentGenerationMsecs(long pRefreshCurrentGenerationMsecs)
public long getRefreshCurrentGenerationMsecs()
public void setClaimedGenerationPropertyName(java.lang.String pClaimedGenerationPropertyName)
public java.lang.String getClaimedGenerationPropertyName()
public void setNextIncrementalGenerationPropertyName(java.lang.String pNextIncrementalGenerationPropertyName)
public java.lang.String getNextIncrementalGenerationPropertyName()
public java.lang.String getUniqueServerId()
public java.net.InetAddress getSessionIdAddress()
public void setSessionIdAddress(java.net.InetAddress pSessionIdAddress)
public int getSessionIdPort()
public void setSessionIdPort(int pSessionIdPort)
public java.net.InetAddress getLocalHost()
public void setUseConfigurationClaims(boolean pUseConfigurationClaims)
pUseConfigurationClaims - true to use configuration claimspublic boolean isUseConfigurationClaims()
public java.lang.String encodeKey(java.lang.String pConfigPath,
                                  java.lang.String pContentId)
                           throws RepositoryException
RepositoryExceptionprotected RepositoryItem getItemForConfig(java.lang.String pConfigPath, java.lang.String pContentId, boolean pMutable) throws RepositoryException
pConfigPath - The absolute nucleus component path of the IOCpContentId - The ID of the content set or null if not
 used.pMutable - If true, return a mutable itemRepositoryExceptionpublic int getGenerationForConfig(java.lang.String pConfigPath,
                                  java.lang.String pContentId)
                           throws IndexingException
IndexingExceptionpublic int getGenerationForIncremental(IndexingOutputConfig pOutputConfig, java.lang.String pContentId)
public void updateLastActivityTime(java.lang.String pConfigPath,
                                   java.lang.String pContentId,
                                   int pGeneration)
                            throws IndexingException
IndexingExceptionpublic void updateLastActivityTime(java.lang.String pConfigPath,
                                   java.lang.String pContentId,
                                   int pGeneration,
                                   long pLastActivityTime)
                            throws IndexingException
pConfigPath - the configuration path for the config statuspGeneration - the generation claimed whose last activity
 time needs to be updatedpLastActivityTime - the new last activity time to be writtenIndexingExceptionpublic int claimAndIncrementGeneration(java.lang.String pConfigPath,
                                       java.lang.String pContentId,
                                       boolean pForIncrementalUpdate,
                                       boolean pUseConfigurationClaims,
                                       IndexingOutputConfig pIOC)
                                throws IndexingException,
                                       ConfigurationClaimedIndexingException
pConfigPath - The configuration path of the configuration to
  claim.pContentId - The ID of the content set or null if not
 used.pForIncrementalUpdate - pUseConfigurationClaims - If true, use and enforce
 configruation claims by throwing
 ConfigurationClaimedIndexingException if configuration has been
 claimed by another process. Otherwise, claim configuration and
 warn if exception would have been thrown.IndexingExceptionConfigurationClaimedIndexingExceptionpublic void completedFullIndex(java.lang.String pConfigPath,
                               java.lang.String pContentId,
                               int pGeneration,
                               boolean pCompletedSuccessfully,
                               boolean pUseConfigurationClaims)
                        throws IndexingException
pConfigPath - The path of the configuration.pContentId - The ID of the content set or null if not
 used.pGeneration - The generation we completed indexing.pCompletedSuccessfully - If incremental indexing completed
 successfully.pUseConfigurationClaims - If true, release configuration
 claim lock obtained at initializationIndexingExceptionpublic void completedIncrementalIndex(java.lang.String pConfigPath,
                                      java.lang.String pContentId,
                                      int pGeneration,
                                      boolean pCompletedSuccessfully,
                                      boolean pUseConfigurationClaims)
                               throws IndexingException
pConfigPath - The path of the configuration.pContentId - The ID of the content set or null if not
 used.pGeneration - The generation we completed indexing.pCompletedSuccessfully - If incremental indexing completed
 successfullypUseConfigurationClaims - If true, release configuration
 claim lock obtained at initializationIndexingExceptionpublic java.lang.Integer getNextIncrementalGeneration(java.lang.String pConfigPath,
                                                      java.lang.String pContentId)
                                               throws IndexingException
pConfigPath - the configpathIndexingExceptionprotected void setNextIncrementalGeneration(java.lang.String pConfigPath,
                                            java.lang.String pContentId,
                                            int pGeneration)
                                     throws IndexingException
pConfigPath - the IOC config pathpGeneration - the new, next incremental generation numberIndexingExceptionprotected void completedIndex(java.lang.String pConfigPath,
                              java.lang.String pContentId,
                              int pGeneration,
                              boolean pCompletedSuccessfully,
                              boolean pIncremental,
                              boolean pUseConfigurationClaims)
                       throws IndexingException
pCompletedSuccessfully - If incremental indexing completed
 successfullyIndexingExceptionpublic java.util.Date getLastFullIndexTime(java.lang.String pConfigPath,
                                           java.lang.String pContentId)
                                    throws IndexingException
IndexingExceptionpublic java.util.Date getLastIncrementalIndexTime(java.lang.String pConfigPath,
                                                  java.lang.String pContentId)
                                           throws IndexingException
pConfigPath - pContentId - IndexingExceptionpublic java.lang.Object getConfigStateProperty(java.lang.String pConfigPath,
                                               java.lang.String pContentId,
                                               java.lang.String pPropertyName)
                                        throws IndexingException
pConfigPath - the path of the configurationpPropertyName - the property name. If null, return
   a ConfigState object.IndexingExceptionpublic void setConfigStateProperty(java.lang.String pConfigPath,
                                   java.lang.String pContentId,
                                   java.lang.String pPropertyName,
                                   java.lang.Object pValue)
                            throws IndexingException
pConfigPath - the path of the configurationpContentId - the content IDpPropertyName - the property name. If null, return
   a ConfigState object.pValue - the the new value for the ConfigState property.IndexingExceptionprotected RepositoryItem[] getConfigStateItemsByUniqueServerId(java.lang.String pUniqueServerId) throws RepositoryException
RepositoryExceptionprotected RepositoryItem[] getClaimedConfigStateItems() throws RepositoryException
RepositoryExceptionpublic RepositoryItem[] getConfigStateItemsForConfig(java.lang.String pConfigPath) throws IndexingException
IndexingExceptionprotected RepositoryItem[] getUnclaimedConfigStateItems() throws RepositoryException
RepositoryExceptionpublic ConfigStatePersister.ConfigState[] getUnclaimedConfigStates() throws IndexingException
IndexingExceptionprotected ConfigStatePersister.ConfigState createConfigState(RepositoryItem pItem)
protected boolean hasTimedOut(RepositoryItem pItem)
pItem - the item whose lastActivity property
   will be consulted to look at timeout.protected boolean hasTimedOut(long pLastActivity)
pLastActivity - The last activity time expressed
    in milliseconds.public void releaseAllConfigurations()
                              throws IndexingException
IndexingExceptionprotected void logReleseConfigrationMessage(MutableRepositoryItem pConfigStateItem)
pConfigStateItem - The config state item being released.public void releaseTimedOutConfigurations()
                                   throws IndexingException
IndexingExceptionpublic int getCurrentGenerationForConfig(java.lang.String pConfigPath,
                                         java.lang.String pContentId)
                                  throws IndexingException
pConfigPath - The absolute nucleus component path of the IOCpContentId - The content set ID or null if not usedIndexingExceptionpublic void removedCachedValueForConfig(java.lang.String pConfigPath,
                                        java.lang.String pContentId)
public void removeObsoleteConfigState(ConfigStatePersister.ConfigState pConfigState) throws RepositoryException
pConfigState - The state to removeRepositoryExceptionpublic void doStartService()
                    throws ServiceException
doStartService in class atg.repository.search.indexing.RepositoryLockingServiceServiceException - if the Service had a problem starting uppublic void performAction()
performAction in interface atg.nucleus.PostStartupActionpublic java.lang.String getClaimedLockName()
getClaimedLockName in class atg.repository.search.indexing.RepositoryLockingService