atg.targeting
Class RepositoryLookup

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.targeting.RepositoryLookup
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class RepositoryLookup
extends DynamoServlet

This servlet looks for a RepositoryItem by its id from within a Repository or by its url. If the item is found, output is rendered. If the item is not found or a parameter is not supplied, empty is rendered.

The input paramters for this servlet are:

repository
The repository within which to look for the item
id
The id of the item to lookup
itemDescriptor
The name of the Item Descriptor to use to load the item
url
The JNDI url for the repository item. This may be used instead of the repository/id/itemDescriptor triplet
elementName
The optional parameter that should be used for the name of the element which is bound into the scope of the output oparam.
fireContentEvent
If true or unset, and the RepositoryItem is a ContentRepositoryItem, we fire a content viewed event
fireContentEventItemDescriptor
This optional parameter should contain the name of the item type used when firing a content viewed event. The name specified must be either a super type name or the exact type name of the item being viewed. For example, if your item type is 'shorts' which extends from the super type 'clothing' then this parameter may be set to 'short' or 'clothing'.
fireContentTypeEvent
If true or unset, and the RepositoryItem is a ContentRepositoryItem, we fire a content type event

The output parameters for this servlet are:

element
Set to the RepositoryItem corresponding to the id supplied
output
Rendered if the item was found in the repository
empty
Rendered in all other cases, e.g. item not found, user did not specify a required parameter.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
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
RepositoryLookup()
           
 
Method Summary
protected  void commitTransaction(javax.transaction.Transaction pTransaction)
          Commits the supplied transaction
 void doStartService()
          Resolve the global Dynamo transaction manager and assign it to the transactionManager property for use in the service method.
protected  javax.transaction.Transaction ensureTransaction()
          This method ensures that a transaction exists before returning.
 void fireViewItemEvent(DynamoHttpServletRequest pRequest, java.lang.Object pTarget, RepositoryItem pProfile, boolean pFireContentTypeEvent, boolean pFireContentEvent, boolean pFireViewItemEvent, java.lang.String pFireContentEventItemDescriptor)
          Sends a View Content event to its listeners.
 void fireViewItemEvent(DynamoHttpServletRequest pRequest, java.lang.Object pTarget, RepositoryItem pProfile, boolean pFireContentTypeEvent, boolean pFireContentEvent, java.lang.String pFireContentEventItemDescriptor)
          Sends a View Content event to its listeners.
 atg.service.event.EventDistributor getDistributor()
          The EventDistributor to send fired events to.
 JNDIInitialContextPool getInitialContextPool()
           
 atg.userprofiling.dms.DPSMessageSource getMessageSource()
          The class responsible for publishing messages.
 java.lang.String getProfilePath()
          The full name of the Profile component for every request.
 javax.transaction.TransactionManager getTransactionManager()
          Returns property TransactionManager.
 boolean isEnsureTransaction()
          Returns property EnsureTransaction
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Take the repository and id parameters and try to find the repository item.
 void setDistributor(atg.service.event.EventDistributor pValue)
          The EventDistributor to send fired events to.
 void setEnsureTransaction(boolean pEnsureTransaction)
          Sets property EnsureTransaction
 void setInitialContextPool(JNDIInitialContextPool pInitialContextPool)
           
 void setMessageSource(atg.userprofiling.dms.DPSMessageSource pMessageSource)
          The class responsible for publishing messages.
 void setProfilePath(java.lang.String pValue)
          The full name of the Profile component for every request.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets property TransactionManager
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, init, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
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, reResolveThis, 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

Constructor Detail

RepositoryLookup

public RepositoryLookup()
Method Detail

setDistributor

public void setDistributor(atg.service.event.EventDistributor pValue)
The EventDistributor to send fired events to.


getDistributor

public atg.service.event.EventDistributor getDistributor()
The EventDistributor to send fired events to.


setMessageSource

public void setMessageSource(atg.userprofiling.dms.DPSMessageSource pMessageSource)
The class responsible for publishing messages.


getMessageSource

public atg.userprofiling.dms.DPSMessageSource getMessageSource()
The class responsible for publishing messages.


setProfilePath

public void setProfilePath(java.lang.String pValue)
The full name of the Profile component for every request.


getProfilePath

public java.lang.String getProfilePath()
The full name of the Profile component for every request.


setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property TransactionManager


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns property TransactionManager. If the internal transaction manager reference is null, it will be retrieved from the Repository if possible


setEnsureTransaction

public void setEnsureTransaction(boolean pEnsureTransaction)
Sets property EnsureTransaction


isEnsureTransaction

public boolean isEnsureTransaction()
Returns property EnsureTransaction


setInitialContextPool

public void setInitialContextPool(JNDIInitialContextPool pInitialContextPool)

getInitialContextPool

public JNDIInitialContextPool getInitialContextPool()

doStartService

public void doStartService()
                    throws ServiceException
Resolve the global Dynamo transaction manager and assign it to the transactionManager property for use in the service method.

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

fireViewItemEvent

public void fireViewItemEvent(DynamoHttpServletRequest pRequest,
                              java.lang.Object pTarget,
                              RepositoryItem pProfile,
                              boolean pFireContentTypeEvent,
                              boolean pFireContentEvent,
                              java.lang.String pFireContentEventItemDescriptor)
                       throws javax.servlet.ServletException
Sends a View Content event to its listeners.

Parameters:
pRequest - the servlet request which generated the event
pTarget - expected to be a ContentRepositoryItem
pProfile - the profile
pFireContentTypeEvent - whether to fire a "ContentType" event
pFireContentEvent - whether to fire a "Content" event
Throws:
javax.servlet.ServletException - if firing the event on the D4 distribution channel was unable to find the repository view.

fireViewItemEvent

public void fireViewItemEvent(DynamoHttpServletRequest pRequest,
                              java.lang.Object pTarget,
                              RepositoryItem pProfile,
                              boolean pFireContentTypeEvent,
                              boolean pFireContentEvent,
                              boolean pFireViewItemEvent,
                              java.lang.String pFireContentEventItemDescriptor)
                       throws javax.servlet.ServletException
Sends a View Content event to its listeners.

Parameters:
pRequest - the servlet request which generated the event
pTarget - expected to be a ContentRepositoryItem
pProfile - the profile
pFireContentTypeEvent - whether to fire a "ContentType" event
pFireContentEvent - whether to fire a "Content" event
pFireViewItemEvent - whether to fire a ViewItem event
Throws:
javax.servlet.ServletException - if firing the event on the D4 distribution channel was unable to find the repository view.

ensureTransaction

protected javax.transaction.Transaction ensureTransaction()
This method ensures that a transaction exists before returning. If there is no transaction, a new one is started and returned. In this case, you must call commitTransaction when the transaction completes.


commitTransaction

protected void commitTransaction(javax.transaction.Transaction pTransaction)
Commits the supplied transaction


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Take the repository and id parameters and try to find the repository item. If found, service output. Otherwise service empty.

Overrides:
service in class DynamoServlet
Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - an application specific error occurred processing this request
java.io.IOException - an error occurred reading data from the request or writing data to the response.