|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.repository.search.indexing.ConfigStatePersister
public class ConfigStatePersister
Handles persisting information about the state of the indexing configuration stored in the 'searchConfig' item descriptor. Specifically, persists such information as:
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
Nested Class Summary | |
---|---|
class |
ConfigStatePersister.ConfigState
Class which represents the configuration state. |
static class |
ConfigStatePersister.IndexingReadLockedTransactionAction
An inner class to do a transaction with the CLAIMED read lock. |
static class |
ConfigStatePersister.IndexingWriteLockedTransactionAction
An inner class to do a transaction with the CLAIMED write lock. |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
ConfigStatePersister()
|
Method Summary | |
---|---|
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. |
ClientLockManager |
getClientLockManager()
The client lock manager... |
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 path. |
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. |
java.lang.String |
getGenerationPropertyName()
|
atg.adapter.gsa.GSARepository |
getGSARepository()
Get the repository as a GSA repository |
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. |
MutableRepository |
getRepository()
The repository to store items. |
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. |
javax.transaction.TransactionManager |
getTransactionManager()
Get the transaction manager used to manager transactions. |
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 |
isAlwaysAcquireWriteLock()
Whether to always acquire a write lock from the lock manager. |
boolean |
isRequireGlobalLock()
Whether to ensure that global locks are acquired when the ClientLockManager's useLockServer property is 'true'. |
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 Nuclues 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 |
setAlwaysAcquireWriteLock(boolean pAlwaysAcquireWriteLock)
Whether to always acquire a write lock from the lock manager. |
void |
setClaimedGenerationPropertyName(java.lang.String pClaimedGenerationPropertyName)
Set the claimed generation property name. |
void |
setConfigPathPropertyName(java.lang.String pConfigPathPropertyName)
|
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 |
setRepository(MutableRepository pRepository)
The repository to store items. |
void |
setRequireGlobalLock(boolean pRequre)
Whether to ensure that global locks are acquired when the ClientLockManager's useLockServer property is 'true'. |
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. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public ConfigStatePersister()
Method Detail |
---|
public void setRepository(MutableRepository pRepository)
public MutableRepository getRepository()
public atg.adapter.gsa.GSARepository getGSARepository()
public void setItemDescriptorName(java.lang.String pItemDescriptorName)
public java.lang.String getItemDescriptorName()
public javax.transaction.TransactionManager getTransactionManager()
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 ClientLockManager getClientLockManager()
public void setAlwaysAcquireWriteLock(boolean pAlwaysAcquireWriteLock)
public boolean isAlwaysAcquireWriteLock()
public void setUseConfigurationClaims(boolean pUseConfigurationClaims)
pUseConfigurationClaims
- true to use configuration claimspublic boolean isUseConfigurationClaims()
public void setRequireGlobalLock(boolean pRequre)
pRequire
- true to require global lockpublic boolean isRequireGlobalLock()
public java.lang.String encodeKey(java.lang.String pConfigPath, java.lang.String pContentId) throws RepositoryException
RepositoryException
protected 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 item
RepositoryException
public int getGenerationForConfig(java.lang.String pConfigPath, java.lang.String pContentId) throws IndexingException
IndexingException
public void updateLastActivityTime(java.lang.String pConfigPath, java.lang.String pContentId, int pGeneration) throws IndexingException
IndexingException
public 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 written
IndexingException
public 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.
IndexingException
ConfigurationClaimedIndexingException
public 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 initialization
IndexingException
public 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 initialization
IndexingException
public java.lang.Integer getNextIncrementalGeneration(java.lang.String pConfigPath, java.lang.String pContentId) throws IndexingException
pConfigPath
- the configpath
IndexingException
protected void setNextIncrementalGeneration(java.lang.String pConfigPath, java.lang.String pContentId, int pGeneration) throws IndexingException
pConfigPath
- the IOC config pathpGeneration
- the new, next incremental generation number
IndexingException
protected 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
successfully
IndexingException
public java.util.Date getLastFullIndexTime(java.lang.String pConfigPath, java.lang.String pContentId) throws IndexingException
IndexingException
public java.util.Date getLastIncrementalIndexTime(java.lang.String pConfigPath, java.lang.String pContentId) throws IndexingException
pConfigPath
- pContentId
-
IndexingException
public 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.
IndexingException
protected RepositoryItem[] getConfigStateItemsByUniqueServerId(java.lang.String pUniqueServerId) throws RepositoryException
RepositoryException
protected RepositoryItem[] getClaimedConfigStateItems() throws RepositoryException
RepositoryException
public RepositoryItem[] getConfigStateItemsForConfig(java.lang.String pConfigPath) throws IndexingException
IndexingException
protected RepositoryItem[] getUnclaimedConfigStateItems() throws RepositoryException
RepositoryException
public ConfigStatePersister.ConfigState[] getUnclaimedConfigStates() throws IndexingException
IndexingException
protected 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
IndexingException
protected void logReleseConfigrationMessage(MutableRepositoryItem pConfigStateItem)
pConfigStateItem
- The config state item being released.public void releaseTimedOutConfigurations() throws IndexingException
IndexingException
public 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 used
IndexingException
public void removedCachedValueForConfig(java.lang.String pConfigPath, java.lang.String pContentId)
public void removeObsoleteConfigState(ConfigStatePersister.ConfigState pConfigState) throws RepositoryException
pConfigState
- The state to remove
RepositoryException
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void performAction()
performAction
in interface atg.nucleus.PostStartupAction
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |