atg.targeting
Class TargetingSourceMap

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.targeting.TargetingSourceMap
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class TargetingSourceMap
extends GenericService

Represents a mapping between source names used in a targeting operation and their Nucleus paths. For example, if the sourceMap property of this service contains a mapping of "Profile" to "/atg/profiler/ProfileBean," then a rules file employed by a rule-based Targeter can use these two lines interchangeably:

 <valueof property="Profile.email">
 <valueof property="/atg/profiler/ProfileBean.email">
 

A TargetingSourceMap is supplied as a parameter to all the targeting droplets. The droplet uses the source map to obtain a NameResolver object and passes it on to the Targeter, which uses the NameResolver to resolve the names of source objects associated with a targeting operation.

See Also:
Targeter, NameResolver

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.util.Properties mSourceMap
          The map of source names to their Nucleus paths
 
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
TargetingSourceMap()
           
 
Method Summary
 void addSourceMapping(java.lang.String pName, java.lang.String pPath)
          Adds a new mapping between a source name and its Nucleus path.
 void doStartService()
          Called after the service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 ComponentNameResolver getNameResolver()
          Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map.
 ComponentNameResolver getNameResolver(ComponentNameResolver pResolver)
          Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map.
 ComponentNameResolver getNameResolver(DynamoHttpServletRequest pRequest)
          Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map.
 NameResolver getNameResolver(NameResolver pResolver)
          Returns a NameResolver which can be used to resolve names which have been added to the source map.
 java.util.Properties getSourceMap()
          Gets the map of source names to their Nucleus paths.
 void removeSourceMapping(java.lang.String pName)
          Removes the mapping associated with the given source name.
 void setSourceMap(java.util.Properties pSourceMap)
          Sets the map of source names to their Nucleus paths.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mSourceMap

protected java.util.Properties mSourceMap
The map of source names to their Nucleus paths

Constructor Detail

TargetingSourceMap

public TargetingSourceMap()
Method Detail

getSourceMap

public java.util.Properties getSourceMap()
Gets the map of source names to their Nucleus paths.


setSourceMap

public void setSourceMap(java.util.Properties pSourceMap)
Sets the map of source names to their Nucleus paths.


addSourceMapping

public void addSourceMapping(java.lang.String pName,
                             java.lang.String pPath)
Adds a new mapping between a source name and its Nucleus path. If the mapping for this source name already exists, its value is overwritten with the new path.


removeSourceMapping

public void removeSourceMapping(java.lang.String pName)
Removes the mapping associated with the given source name. If the mapping is not found, this method does nothing.


getNameResolver

public ComponentNameResolver getNameResolver()
Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map. If the name is not found in the source map, the underlying GenericService's resolveName method is used for resolution.

See Also:
ComponentNameResolver

getNameResolver

public ComponentNameResolver getNameResolver(DynamoHttpServletRequest pRequest)
Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map. If the name is not found in the source map, and if the passed in request is not null, the name is passed on to the request for resolution. If the request is null, this is equivalent to calling getNameResolver().

See Also:
atg.nucleus.naming.NameResolver

getNameResolver

public ComponentNameResolver getNameResolver(ComponentNameResolver pResolver)
Returns a ComponentNameResolver which can be used to resolve names which have been added to the source map. If the name is not found in the source map, the name is passed on to the embedded resolver for resolution.

See Also:
ComponentNameResolver

getNameResolver

public NameResolver getNameResolver(NameResolver pResolver)
Returns a NameResolver which can be used to resolve names which have been added to the source map. If the name is not found in the source map, the name is passed on to the embedded resolver for resolution.

See Also:
NameResolver

doStartService

public void doStartService()
                    throws ServiceException
Called after the service has been created, placed into the naming hierarchy, and initialized with its configured property values. If the sourceMap property is not set in the properties file, this method initializes it.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the service had a problem starting up