atg.epub.search.indexing
Class ProjectPropertyAccessor

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.epub.search.indexing.ProjectPropertyAccessor
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, atg.repository.search.indexing.PropertyAccessor, java.util.EventListener

public class ProjectPropertyAccessor
extends GenericService
implements atg.repository.search.indexing.PropertyAccessor

A DAF.Search.Indexing PropertyAccessor class that provides publishing project related properties.

To configure this property accessor, the name attribute of the property tag in the output specifier should specifiy a name using dot notation. For example, name="project.id". The first value in the dot notated name is a symbolic name that refers to the project object. This value can be any alphabetical string, so if 'project' conflicts with property of an item being indexed, you can simply use something else, name="TheProject.id".

Special properties: This acessor provides values for the following special property names:

  1. Project.$ACL An array of roles with access to this project's data. By default, a given role's access to project data is granted if the role has the read and list access rights on the project repository item. The list of access rights required for access to project data may be changed via the projectAccessRights property.

    Note that the $ACL values by themselves offer no security for project data. Security must be implemented by constraining queries on user's role against project.$ACL values.


Field Summary
static java.lang.String ATTEMPTED_LOAD_ATTR_NAME
           
static java.lang.String CACHE_ATTR_NAME
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CONTEXT_ATTR_PREFIX
           
static java.lang.String[] DEFAULT_PROJECT_ACCESS_RIGHTS
           
static java.lang.String DEVLINE_ATTR_NAME
           
static java.lang.String PROJECT_ATTR_NAME
           
static java.lang.String PROP_ACL
           
static java.lang.String RESOURCES
           
 
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
ProjectPropertyAccessor()
           
 
Method Summary
protected  java.lang.Object getCachedPropertyValue(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName, atg.repository.search.indexing.specifier.PropertyTypeEnum pType)
          Get a property value.
 java.lang.Object getMetaPropertyValue(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName, atg.repository.search.indexing.specifier.PropertyTypeEnum pType)
          Get the meta property value.
 atg.repository.search.indexing.specifier.SecurityConstraints getMetaSecurityConstraint(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName, atg.repository.search.indexing.specifier.PropertyTypeEnum pType, java.lang.Object pPropertyValue, atg.repository.search.indexing.specifier.SecurityConstraints pSecurityConstraints)
          Get the security constraint for the specified meta property.
 java.lang.String[] getProjectAccessRights()
          Get the list of the names of access rights required for access to the project.
protected  java.lang.Object getProjectPropertyValue(atg.repository.search.indexing.Context pContext, RepositoryItem pProject, RepositoryItem pItem, java.lang.String pPropertyName)
          Read a property value from the project object.
protected  java.util.Map getPropertyValueCache(atg.repository.search.indexing.Context pContext)
          Get a map of cached project property values for the current development line.
protected  java.lang.String[] getRolesWithRights(RepositoryItem pProject)
          Get a list of security role names with appropriate rights to access this project.
 java.lang.Object getSubItemPropertyValue(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName)
          Sub item property accessor.
 java.lang.Object getTextPropertyValue(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName)
          Get the text property value.
 atg.repository.search.indexing.specifier.SecurityConstraints getTextSecurityConstraint(atg.repository.search.indexing.Context pContext, RepositoryItem pItem, java.lang.String pPropertyName, java.lang.Object pPropertyValue, atg.repository.search.indexing.specifier.SecurityConstraints pSecurityConstraints)
          Get the security constraint for the specified text property.
protected  RepositoryItem getWorkspaceProject(atg.repository.search.indexing.Context pContext, java.lang.String pWorkspaceName)
          Return true if named workspace has an associated publishing project.
protected  boolean hasNamedAccessRight(AccessRight[] pRights, java.lang.String pRightsName)
          Check the array of access rights for an access right matching the specified name.
protected  boolean hasNamedAccessRights(AccessRight[] pRights, java.lang.String[] pRightsNames)
          Check the array of access rights names against the array of access rights, return true if all named access rights are matched with an AccessRight.
 void onIndexingInitialization(atg.repository.search.indexing.IndexingOutputConfig pIndexingOutputConfig, java.util.Set<java.lang.String> pPropertyNames)
          Called for custom-set property accessors before each bulk or incremental indexing process runs.
 void onIndexingTermination(atg.repository.search.indexing.IndexingOutputConfig pIndexingOutputConfig, java.util.Set<java.lang.String> pPropertyNames)
          Called for custom-set property accessors after each bulk or incremental indexing process runs.
protected  void resetCachedValues(atg.repository.search.indexing.Context pContext)
          Clear the cache of project property values.
 void setProjectAccessRights(java.lang.String[] pProjectAccessRights)
          Set the array of access right names required by a given role for access to project data.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


CONTEXT_ATTR_PREFIX

public static final java.lang.String CONTEXT_ATTR_PREFIX
See Also:
Constant Field Values

CACHE_ATTR_NAME

public static final java.lang.String CACHE_ATTR_NAME
See Also:
Constant Field Values

ATTEMPTED_LOAD_ATTR_NAME

public static final java.lang.String ATTEMPTED_LOAD_ATTR_NAME
See Also:
Constant Field Values

PROJECT_ATTR_NAME

public static final java.lang.String PROJECT_ATTR_NAME
See Also:
Constant Field Values

DEVLINE_ATTR_NAME

public static final java.lang.String DEVLINE_ATTR_NAME
See Also:
Constant Field Values

RESOURCES

public static final java.lang.String RESOURCES
See Also:
Constant Field Values

PROP_ACL

public static final java.lang.String PROP_ACL
See Also:
Constant Field Values

DEFAULT_PROJECT_ACCESS_RIGHTS

public static final java.lang.String[] DEFAULT_PROJECT_ACCESS_RIGHTS
Constructor Detail

ProjectPropertyAccessor

public ProjectPropertyAccessor()
Method Detail

setProjectAccessRights

public void setProjectAccessRights(java.lang.String[] pProjectAccessRights)
Set the array of access right names required by a given role for access to project data. This value controls which roles will be listed in the special $acl property.

Note that this is not a security mechanism, it does not provide any access restrictions on indexed data. Instead, it is intended to be used in building access control constraints in query interfaces.

Parameters:
pProjectAccessRights - an array of access right names required for access to project data.

getProjectAccessRights

public java.lang.String[] getProjectAccessRights()
Get the list of the names of access rights required for access to the project.

Note that this is not a security mechanism, it does not provide any access restrictions on indexed data. Instead, it is intended to be used in building access control constraints in query interfaces.

Returns:
the list of access rights names

getTextPropertyValue

public java.lang.Object getTextPropertyValue(atg.repository.search.indexing.Context pContext,
                                             RepositoryItem pItem,
                                             java.lang.String pPropertyName)
Get the text property value. Text property values correspond to properties contained in "text-property" elements in the XML definition file and result in "div" elements in the output XHTML document.

Specified by:
getTextPropertyValue in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pContext - The current context. Contains the current URL, the stack of parent items, etc.
pItem - The repository item whose property to get
pPropertyName - The name of the property to get

getMetaPropertyValue

public java.lang.Object getMetaPropertyValue(atg.repository.search.indexing.Context pContext,
                                             RepositoryItem pItem,
                                             java.lang.String pPropertyName,
                                             atg.repository.search.indexing.specifier.PropertyTypeEnum pType)
Get the meta property value. Property values correspond to properties contained in the meta-property" elements in the XML definition file and result in "meta" elements in the output document.

Specified by:
getMetaPropertyValue in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pContext - The current context. Contains the current URL, the stack of parent items, etc.
pItem - The repository item whose property to get
pPropertyName - The name of the property to get
pType - the type of the property. See the PROP_TYPE_ constants in OutputItemSpecifier.

onIndexingInitialization

public void onIndexingInitialization(atg.repository.search.indexing.IndexingOutputConfig pIndexingOutputConfig,
                                     java.util.Set<java.lang.String> pPropertyNames)
                              throws atg.repository.search.indexing.IndexingException
Called for custom-set property accessors before each bulk or incremental indexing process runs.

Specified by:
onIndexingInitialization in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pIndexingOutputConfig - The IndexingOutputConfig component initaiting the index
pPropertyNames - The set of property names which this property accessor is associated with in the definition file.
Throws:
atg.repository.search.indexing.IndexingException

onIndexingTermination

public void onIndexingTermination(atg.repository.search.indexing.IndexingOutputConfig pIndexingOutputConfig,
                                  java.util.Set<java.lang.String> pPropertyNames)
                           throws atg.repository.search.indexing.IndexingException
Called for custom-set property accessors after each bulk or incremental indexing process runs.

Specified by:
onIndexingTermination in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pIndexingOutputConfig - The IndexingOutputConfig component initaiting the index
pPropertyNames - The set of property names which this property accessor is associated with in the definition file.
Throws:
atg.repository.search.indexing.IndexingException

getSubItemPropertyValue

public java.lang.Object getSubItemPropertyValue(atg.repository.search.indexing.Context pContext,
                                                RepositoryItem pItem,
                                                java.lang.String pPropertyName)
Sub item property accessor. This class does not support subitem properties, so this method always returns null.

Specified by:
getSubItemPropertyValue in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pContext - The current context. Contains the current URL, the stack of parent items, etc.
pItem - The repository item whose property to get
pPropertyName - The name of the property to get
Returns:
null

getMetaSecurityConstraint

public atg.repository.search.indexing.specifier.SecurityConstraints getMetaSecurityConstraint(atg.repository.search.indexing.Context pContext,
                                                                                              RepositoryItem pItem,
                                                                                              java.lang.String pPropertyName,
                                                                                              atg.repository.search.indexing.specifier.PropertyTypeEnum pType,
                                                                                              java.lang.Object pPropertyValue,
                                                                                              atg.repository.search.indexing.specifier.SecurityConstraints pSecurityConstraints)
Get the security constraint for the specified meta property. Implementations of this method may simply return the specified pSecurityConstraints object (which may be null), or may create an return a new SecurityConstraints object.

Specified by:
getMetaSecurityConstraint in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pContext - The current context. Contains the current URL, the stack of parent items, etc.
pItem - The repository item whose constraints to get
pPropertyName - The name of the property whose contraints to get
pType - the type of the property. See the PROP_TYPE_ constants in OutputItemSpecifier.
pPropertyValue - The property value returned by getMetaPropertyValue.
pSecurityConstraints - The static security constraints from from the definition file. May be null.
Returns:
the new security constraints, or null.

getTextSecurityConstraint

public atg.repository.search.indexing.specifier.SecurityConstraints getTextSecurityConstraint(atg.repository.search.indexing.Context pContext,
                                                                                              RepositoryItem pItem,
                                                                                              java.lang.String pPropertyName,
                                                                                              java.lang.Object pPropertyValue,
                                                                                              atg.repository.search.indexing.specifier.SecurityConstraints pSecurityConstraints)
Get the security constraint for the specified text property. Implementations of this method may simply return the specified pSecurityConstraints object (which may be null), or may create an return a new SecurityConstraints object.

Specified by:
getTextSecurityConstraint in interface atg.repository.search.indexing.PropertyAccessor
Parameters:
pContext - The current context. Contains the current URL, the stack of parent items, etc.
pItem - The repository item whose constraints to get
pPropertyName - The name of the property whose constraints to get
pPropertyValue - The property value returned by getMetaPropertyValue.
pSecurityConstraints - The static security constraints from from the definition file. May be null.
Returns:
the new security constraints, or null.

getPropertyValueCache

protected java.util.Map getPropertyValueCache(atg.repository.search.indexing.Context pContext)
Get a map of cached project property values for the current development line.

Returns:
the current project's property value cache

resetCachedValues

protected void resetCachedValues(atg.repository.search.indexing.Context pContext)
Clear the cache of project property values.

Parameters:
pContext - the context object where values are cached

getCachedPropertyValue

protected java.lang.Object getCachedPropertyValue(atg.repository.search.indexing.Context pContext,
                                                  RepositoryItem pItem,
                                                  java.lang.String pPropertyName,
                                                  atg.repository.search.indexing.specifier.PropertyTypeEnum pType)
Get a property value. This method caches values it returns, clearing the cache when the current development line changes.

Parameters:
pContext - the indexing context
pItem - the repository item being indexed
pPropertyName - the property name to retrieve
pType - the type or null
Returns:
the project property value or null

getWorkspaceProject

protected RepositoryItem getWorkspaceProject(atg.repository.search.indexing.Context pContext,
                                             java.lang.String pWorkspaceName)
Return true if named workspace has an associated publishing project. The first time this method is invoked this method will attempt to fetch the project associated with the named workspace from the repository. Subsequent invocations will simply test the project property for null or non-null.

Parameters:
pWorkspaceName - the name of the workspace
Returns:
true if there is a project associated with the named workspace, false otherwise

getProjectPropertyValue

protected java.lang.Object getProjectPropertyValue(atg.repository.search.indexing.Context pContext,
                                                   RepositoryItem pProject,
                                                   RepositoryItem pItem,
                                                   java.lang.String pPropertyName)
                                            throws RepositoryException
Read a property value from the project object. Values returned from this method are cached, so this method will be called at most once per project/development line.

Parameters:
pContext - the indexing context
pProject - the project repository item
pItem - the repository item being indexed (probably not needed)
pPropertyName - the name of the property in the project
Throws:
RepositoryException

getRolesWithRights

protected java.lang.String[] getRolesWithRights(RepositoryItem pProject)
Get a list of security role names with appropriate rights to access this project. Appropriate rights are those specified in the projectAccessRights property.

Returns:
a list of security roles with access to this project
See Also:
projectAccessRights

hasNamedAccessRights

protected boolean hasNamedAccessRights(AccessRight[] pRights,
                                       java.lang.String[] pRightsNames)
Check the array of access rights names against the array of access rights, return true if all named access rights are matched with an AccessRight.

Parameters:
pRights - the access rights object array
pRightsNames - the names of access rights to match
Returns:
true if all name rights matched rights objects, false if not all matched or if named rights are empty or null

hasNamedAccessRight

protected boolean hasNamedAccessRight(AccessRight[] pRights,
                                      java.lang.String pRightsName)
Check the array of access rights for an access right matching the specified name. Return true if match found.

Parameters:
pRights - the access rights object array
pRightsName - the access right name
Returns:
true if found