atg.repository.search.indexing
Class Context

java.lang.Object
  extended by atg.repository.search.indexing.ItemAndSpecifierStack
      extended by atg.repository.search.indexing.Context
All Implemented Interfaces:
atg.repository.search.indexing.ContextStatus

public class Context
extends ItemAndSpecifierStack
implements atg.repository.search.indexing.ContextStatus

A context class used by the LoaderImpl and subclasses and passed to the various methods of PropertyAccessor. It contains a current list of parents (both specifiers and repository items), the current document URL (if any), the current collected output values (if any), and status information.

The Context class is also used (via the ContextStatus interface and ContextStatusImpl object) to provide status information to th HTML admin.

Created: February 07 2005


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
Context()
           
 
Method Summary
 void addDeletedDocumentURL(java.lang.String pURL)
          Add a deleted documnet URL to the list.
 void addGeneratedDocumentURL(java.lang.String pURL)
          Add a generated documnet URL to the list.
 TransactionDemarcation beginTransaction(javax.transaction.TransactionManager pTransactionManager)
           
 boolean containsAttribute(java.lang.String pName)
          Returns true if the context attributes contains a mapping for the specified attribute name.
 void copyFrom(ItemAndSpecifierStack pItemAndSpecifierStack)
          Copy property values from the specified Context.
 void endTransaction()
          End the current transaction.
 atg.repository.search.indexing.PropertyAccessor getAccessorForPropertyPath(java.lang.String pPropertyPath)
          Get the appropriate property accessor for the specified property path.
 java.lang.Object getAttribute(java.lang.String pName)
          Get a thread-specific attribute by name.
 java.util.Map getAttributes()
          Get a read-only representation of the thread-specific attributes map.
 int getClaimedGeneration()
          Get the change generation claimed by the current indexing update task.
 java.lang.String getCurrentBaseURL()
          The current base URL.
 java.util.Locale getCurrentDocumentLocale()
          Get the locale for the current document.
 java.lang.String getCurrentURL()
          Return the URL for the current document being generated.
 atg.repository.search.indexing.PropertyAccessor getDefaultAccessor()
          Return the default property.
 java.util.Map getDevelopmentLineItems()
           
 atg.repository.search.indexing.DevLineIndexInfo getDevLineIndexInfo()
           
 atg.repository.search.indexing.threading.ProcessItemDispatcher getDispatcher()
           
 java.lang.String getDocumentRepositoryId()
          Get the repository id of the repository item that corresponds to the document.
 atg.repository.search.indexing.DocumentSubmitterSession getDocumentSubmitterSession()
          Get the document submitter session.
 java.lang.Object getGlobalAttribute(java.lang.String pName)
          Get an attribute by name.
 java.util.Map getGlobalAttributes()
          Get a read-only representation of the attributes map.
 atg.search.index.IndexInfo getIndexInfo()
          Get the IndexInfo object provided by the Search Admin or null.
 java.lang.String getIndexingHashValue()
          The value to use for 'stringForHash' in the indexing commands.
 IndexingOutputConfig getIndexingOutputConfig()
          Get the indexing output config for which this context was create.
 java.lang.String getIndexingOutputConfigurationPath()
          Return the absolute Nucleus path for the indexing output configuration.
 java.util.Map getIterationUniqueParams()
          Get the iteration unique parameters...
 long getLastActivityPersistedTime()
          Get the time at which lastActivity time was persisted.
 LoaderImpl getLoader()
          The loader that created this Context.
 int getNumFailures()
          The number of failures.
 int getNumSuccesses()
          The number of successes.
 atg.repository.search.indexing.OutputDocumentContent getOutputDocumentContent()
          Get the output document content object.
 int getSplitValueIndex()
          The split value index.
 atg.repository.search.indexing.ContextStatusEnum getStatus()
          Get the status for this context.
 boolean hasDeletedDocumentURL(java.lang.String pURL)
          Return whether the document URL has already been deleted .
 boolean hasGeneratedDocumentURL(java.lang.String pURL)
          Return whether the document URL has already been generated .
 boolean hasTransactionDemarcation()
           
 void incrementFailures()
          Increment the number of failures.
 void incrementSuccesses()
          Increment the number of successes.
 boolean isAllowingMultipleSubmitsPerURL()
          Whether to allow multiple submits per document URL.
 boolean isBulkLoad()
          Whether we are currently doing a full/bulk load.
 boolean isDocumentInDevLine()
           
 boolean isOnlyNonDocumentItems()
          Get the onlyNonDocumentItems entry to true.
 boolean isRunningInSubThread()
          Whether this context is running in a sub-thread.
 java.lang.Object removeAttribute(java.lang.String pName)
          Remove a thread-specific attribute by name.
 java.lang.Object removeGlobalAttribute(java.lang.String pName)
          Remove an attribute by name.
 void setAllowingMultipleSubmitsPerURL(boolean pAllowingMultipleSubmitsPerURL)
          Whether to allow multiple submits per document URL.
 void setAttribute(java.lang.String pName, java.lang.Object pAttribute)
          Set a thread-specific attribute by name.
 void setBulkLoad(boolean pBulkLoad)
          Whether we are currently doing a full/bulk load.
 void setClaimedGeneration(int pClaimedGeneration)
          Set the change generation claimed by the current indexing update task.
 void setCurrentBaseURL(java.lang.String pCurrentBaseURL)
          The current base URL.
 void setCurrentDocumentLocale(java.util.Locale pCurrentDocumentLocale)
          Set the locale for the current document.
 void setCurrentURL(java.lang.String pURL)
          Set the URL for the current document being generated.
 void setDevelopmentLineItems(java.util.Map pItems)
           
 void setDevLineIndexInfo(atg.repository.search.indexing.DevLineIndexInfo pDevLineIndexInfo)
           
 void setDocumentInDevLine(boolean pInDevLine)
           
 void setDocumentRepositoryId(java.lang.String pDocumentRepositoryId)
          Set the repository id of the repository item that corresponds to the document.
 void setDocumentSubmitterSession(atg.repository.search.indexing.DocumentSubmitterSession pDocumentSubmitterSession)
          Set the document submitter session.
 void setGlobalAttribute(java.lang.String pName, java.lang.Object pGlobalAttribute)
          Set an attribute by name.
 void setIndexInfo(atg.search.index.IndexInfo pIndexInfo)
          Set the IndexInfo object provided by the Search Admin.
 void setIndexingHashValue(java.lang.String pValue)
          The value to use for 'stringForHash' in the indexing commands.
 void setIndexingOutputConfig(IndexingOutputConfig pIndexingOutputConfig)
          Set the indexing output config for which this context was create.
 void setIterationUniqueParams(java.util.Map pIterationUniqueParams)
          Set the iteration unique parameters...
 void setLastActivityPersistedTime(long pLastActivityPersistedTime)
          Set the time at which lastActivity time was persisted.
 void setLoader(LoaderImpl pLoader)
          The loader that created this Context.
 void setOnlyNonDocumentItems(boolean pOnlyNonDocumentItems)
          Set the onlyNonDocumentItems property.
 void setOutputDocumentContent(atg.repository.search.indexing.OutputDocumentContent pOutputDocumentContent)
          Set the output document content object.
 void setSplitValueIndex(int pSplitValueIndex)
          The split value index.
 void setStatus(atg.repository.search.indexing.ContextStatusEnum pStatus)
          Set the status for this context.
 boolean shouldUseDispatcher()
          Whether the sub-thread proces item dispatcher should be used.
 void updateLastActivityTime()
           
 
Methods inherited from class atg.repository.search.indexing.ItemAndSpecifierStack
clearParents, getAncestorCount, getNthAncestor, getNthAncestorItemAndSpecifier, getParent, isInDocument, popParent, pushParent, pushParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

Context

public Context()
Method Detail

isDocumentInDevLine

public boolean isDocumentInDevLine()

setDocumentInDevLine

public void setDocumentInDevLine(boolean pInDevLine)

setDevelopmentLineItems

public void setDevelopmentLineItems(java.util.Map pItems)

getDevelopmentLineItems

public java.util.Map getDevelopmentLineItems()

setDevLineIndexInfo

public void setDevLineIndexInfo(atg.repository.search.indexing.DevLineIndexInfo pDevLineIndexInfo)

getDevLineIndexInfo

public atg.repository.search.indexing.DevLineIndexInfo getDevLineIndexInfo()

getCurrentURL

public java.lang.String getCurrentURL()
Return the URL for the current document being generated.

Specified by:
getCurrentURL in interface atg.repository.search.indexing.ContextStatus

setCurrentURL

public void setCurrentURL(java.lang.String pURL)
Set the URL for the current document being generated.


setCurrentBaseURL

public void setCurrentBaseURL(java.lang.String pCurrentBaseURL)
The current base URL. This is the repository item URL without the iteration parameters (e.g. for different locales or different catalogs)


getCurrentBaseURL

public java.lang.String getCurrentBaseURL()
The current base URL. This is the repository item URL without the iteration parameters (e.g. for different locales or different catalogs)


getIndexingHashValue

public java.lang.String getIndexingHashValue()
The value to use for 'stringForHash' in the indexing commands.

Returns:
the value to use for 'stringForHash'

setIndexingHashValue

public void setIndexingHashValue(java.lang.String pValue)
The value to use for 'stringForHash' in the indexing commands.

Parameters:
pValue - the value to use for 'stringForHash'

setDocumentRepositoryId

public void setDocumentRepositoryId(java.lang.String pDocumentRepositoryId)
Set the repository id of the repository item that corresponds to the document.


getDocumentRepositoryId

public java.lang.String getDocumentRepositoryId()
Get the repository id of the repository item that corresponds to the document.


getDefaultAccessor

public atg.repository.search.indexing.PropertyAccessor getDefaultAccessor()
Return the default property.


getAccessorForPropertyPath

public atg.repository.search.indexing.PropertyAccessor getAccessorForPropertyPath(java.lang.String pPropertyPath)
Get the appropriate property accessor for the specified property path.


setOutputDocumentContent

public void setOutputDocumentContent(atg.repository.search.indexing.OutputDocumentContent pOutputDocumentContent)
Set the output document content object.


getOutputDocumentContent

public atg.repository.search.indexing.OutputDocumentContent getOutputDocumentContent()
Get the output document content object.


setDocumentSubmitterSession

public void setDocumentSubmitterSession(atg.repository.search.indexing.DocumentSubmitterSession pDocumentSubmitterSession)
Set the document submitter session. This is used for submitting document content.


getDocumentSubmitterSession

public atg.repository.search.indexing.DocumentSubmitterSession getDocumentSubmitterSession()
Get the document submitter session. This is used for submitting document content.


setOnlyNonDocumentItems

public void setOnlyNonDocumentItems(boolean pOnlyNonDocumentItems)
Set the onlyNonDocumentItems property. If true, this causes processItem to only process Non-document child items.


isOnlyNonDocumentItems

public boolean isOnlyNonDocumentItems()
Get the onlyNonDocumentItems entry to true. This causes processItem to only process Non-document child items.


isAllowingMultipleSubmitsPerURL

public boolean isAllowingMultipleSubmitsPerURL()
Whether to allow multiple submits per document URL.


setAllowingMultipleSubmitsPerURL

public void setAllowingMultipleSubmitsPerURL(boolean pAllowingMultipleSubmitsPerURL)
Whether to allow multiple submits per document URL.


setGlobalAttribute

public void setGlobalAttribute(java.lang.String pName,
                               java.lang.Object pGlobalAttribute)
Set an attribute by name.


getGlobalAttribute

public java.lang.Object getGlobalAttribute(java.lang.String pName)
Get an attribute by name.


removeGlobalAttribute

public java.lang.Object removeGlobalAttribute(java.lang.String pName)
Remove an attribute by name.


getGlobalAttributes

public java.util.Map getGlobalAttributes()
Get a read-only representation of the attributes map.


setAttribute

public void setAttribute(java.lang.String pName,
                         java.lang.Object pAttribute)
Set a thread-specific attribute by name.


getAttribute

public java.lang.Object getAttribute(java.lang.String pName)
Get a thread-specific attribute by name. A copy of this map is made for sub-threads, and any changes are not copied back to the main-thread version.


containsAttribute

public boolean containsAttribute(java.lang.String pName)
Returns true if the context attributes contains a mapping for the specified attribute name.

Returns:
true if attributes contains specified attribute name

removeAttribute

public java.lang.Object removeAttribute(java.lang.String pName)
Remove a thread-specific attribute by name. A copy of this map is made for sub-threads, and any changes are not copied back to the main-thread version.


getAttributes

public java.util.Map getAttributes()
Get a read-only representation of the thread-specific attributes map. A copy of this map is made for sub-threads, and any changes are not copied back to the main-thread version.


addGeneratedDocumentURL

public void addGeneratedDocumentURL(java.lang.String pURL)
Add a generated documnet URL to the list.


hasGeneratedDocumentURL

public boolean hasGeneratedDocumentURL(java.lang.String pURL)
Return whether the document URL has already been generated .

Parameters:
pURL - The URL to check for previous generation.

addDeletedDocumentURL

public void addDeletedDocumentURL(java.lang.String pURL)
Add a deleted documnet URL to the list.


hasDeletedDocumentURL

public boolean hasDeletedDocumentURL(java.lang.String pURL)
Return whether the document URL has already been deleted .

Parameters:
pURL - The URL to check for previous generation.

setLastActivityPersistedTime

public void setLastActivityPersistedTime(long pLastActivityPersistedTime)
Set the time at which lastActivity time was persisted.


getLastActivityPersistedTime

public long getLastActivityPersistedTime()
Get the time at which lastActivity time was persisted.

Specified by:
getLastActivityPersistedTime in interface atg.repository.search.indexing.ContextStatus

setClaimedGeneration

public void setClaimedGeneration(int pClaimedGeneration)
Set the change generation claimed by the current indexing update task.


getClaimedGeneration

public int getClaimedGeneration()
Get the change generation claimed by the current indexing update task.

Specified by:
getClaimedGeneration in interface atg.repository.search.indexing.ContextStatus

setIndexingOutputConfig

public void setIndexingOutputConfig(IndexingOutputConfig pIndexingOutputConfig)
Set the indexing output config for which this context was create.


getIndexingOutputConfig

public IndexingOutputConfig getIndexingOutputConfig()
Get the indexing output config for which this context was create.


setIterationUniqueParams

public void setIterationUniqueParams(java.util.Map pIterationUniqueParams)
Set the iteration unique parameters... these are the parameters that make this iteration unique.


getIterationUniqueParams

public java.util.Map getIterationUniqueParams()
Get the iteration unique parameters... these are the parameters that make this iteration unique.


setSplitValueIndex

public void setSplitValueIndex(int pSplitValueIndex)
The split value index. For unsplit values, will be zero.


getSplitValueIndex

public int getSplitValueIndex()
The split value index. For unsplit values, will be zero.


setCurrentDocumentLocale

public void setCurrentDocumentLocale(java.util.Locale pCurrentDocumentLocale)
Set the locale for the current document. Null means use the default Locale.


getCurrentDocumentLocale

public java.util.Locale getCurrentDocumentLocale()
Get the locale for the current document. Null means use the default Locale.


getNumSuccesses

public int getNumSuccesses()
The number of successes.

Specified by:
getNumSuccesses in interface atg.repository.search.indexing.ContextStatus

incrementSuccesses

public void incrementSuccesses()
Increment the number of successes.


getNumFailures

public int getNumFailures()
The number of failures.

Specified by:
getNumFailures in interface atg.repository.search.indexing.ContextStatus

incrementFailures

public void incrementFailures()
Increment the number of failures.


setStatus

public void setStatus(atg.repository.search.indexing.ContextStatusEnum pStatus)
Set the status for this context.


getStatus

public atg.repository.search.indexing.ContextStatusEnum getStatus()
Get the status for this context.

Specified by:
getStatus in interface atg.repository.search.indexing.ContextStatus

setBulkLoad

public void setBulkLoad(boolean pBulkLoad)
Whether we are currently doing a full/bulk load.


isBulkLoad

public boolean isBulkLoad()
Whether we are currently doing a full/bulk load.


setLoader

public void setLoader(LoaderImpl pLoader)
The loader that created this Context.


getLoader

public LoaderImpl getLoader()
The loader that created this Context.


getIndexingOutputConfigurationPath

public java.lang.String getIndexingOutputConfigurationPath()
Return the absolute Nucleus path for the indexing output configuration.

Specified by:
getIndexingOutputConfigurationPath in interface atg.repository.search.indexing.ContextStatus

updateLastActivityTime

public void updateLastActivityTime()
                            throws IndexingException
Throws:
IndexingException

getIndexInfo

public atg.search.index.IndexInfo getIndexInfo()
Get the IndexInfo object provided by the Search Admin or null.

Specified by:
getIndexInfo in interface atg.repository.search.indexing.ContextStatus
Returns:
the object or null if no value is available

setIndexInfo

public void setIndexInfo(atg.search.index.IndexInfo pIndexInfo)
Set the IndexInfo object provided by the Search Admin.


hasTransactionDemarcation

public boolean hasTransactionDemarcation()

beginTransaction

public TransactionDemarcation beginTransaction(javax.transaction.TransactionManager pTransactionManager)
                                        throws TransactionDemarcationException
Throws:
TransactionDemarcationException

endTransaction

public void endTransaction()
                    throws TransactionDemarcationException
End the current transaction. Throws an exception if the transaction is not in place. Always clears the current TransactionDemarcation.

Throws:
TransactionDemarcationException

isRunningInSubThread

public boolean isRunningInSubThread()
Whether this context is running in a sub-thread.


shouldUseDispatcher

public boolean shouldUseDispatcher()
Whether the sub-thread proces item dispatcher should be used.


getDispatcher

public atg.repository.search.indexing.threading.ProcessItemDispatcher getDispatcher()

copyFrom

public void copyFrom(ItemAndSpecifierStack pItemAndSpecifierStack)
Copy property values from the specified Context.

Overrides:
copyFrom in class ItemAndSpecifierStack
Parameters:
pItemAndSpecifierStack - the object from which to copy. Must be an instance of Context.