atg.markers.droplet
Class MarkerDroplet

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.markers.droplet.MarkerDroplet
All Implemented Interfaces:
MarkerConstants, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
AddMarkerToItem, BusinessProcessDroplet, HasLastMarker, HasLastMarkerWithKey, HasMarker, OrderMarkerDroplet, RemoveAllMarkersFromItem, RemoveMarkersFromItem

public abstract class MarkerDroplet
extends DynamoServlet
implements MarkerConstants

This is the base class for marker droplets.

It provides the base input, output and oparam parameter names, as well as convenience methods for extracting the parameter and configurable property values.

The service method calls the abstract doService method which extensions must implement. doService is called within a transaction demarcation of the current transaction if there's one in place. Otherwise one is created.

This class defines a choice of several oparams to render upon successful completion of the marker operation in doService. The implemention of the doService should return the oparam name to render on success.

This class also defines several output params that can be provided on successful completion of the marker operation. The implementation of doService should set the appropriate output param values before returning.

Implementations of doService should throw exceptions when errors occurs. The service method of this class with catch those exceptions, set the error message output parameter to the text of the exception, and render the error oparam.

For marker droplets that do property comparisons to find matching markers, such as hasMarker or removeMarkers, a special token string can be used to indicate that a marker property can be any value. The token string is defined by the ANY_VALUE property. If this token string is provided as the comparison value, then the marker's value is not is included when finding matching markers.
For example,
param name="value" value="bean:HasMarker.ANY_VALUE"

See Also:
service(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), doService(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), getANY_VALUE()

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static ParameterName DATA_PARAM
          the input parameter name for the data parameter
static ParameterName DUPLICATION_MODE_PARAM
          the input parameter name for the duplicationMode parameter
static java.lang.String EMPTY_OPARAM
          the name for the empty output parameter.
static java.lang.String ERROR_MSG_PARAM
          the name for the errorMsg output parameter.
static java.lang.String ERROR_OPARAM
          the name for the error output parameter.
static java.lang.String FALSE_OPARAM
          the name for the false output parameter.
static ParameterName ITEM_ID_PARAM
          the input parameter name for the itemId parameter
static ParameterName ITEM_PARAM
          the input parameter name for the item parameter
static ParameterName KEY_PARAM
          the input parameter name for the key parameter
static ParameterName MARKED_ITEM_TYPE_PARAM
          the input parameter name for the markedItemType parameter
static java.lang.String MARKER_COUNT
          the name for the markerCount output parameter.
static java.lang.String MARKER_ELEMENT
          the name for the marker output parameter.
static ParameterName MARKER_EXTPROPS_PARAM
          the input parameter name for the extendedProperties parameter
static ParameterName MARKER_ITEM_TYPE_PARAM
          the input parameter name for the markerItemType parameter
static ParameterName MARKER_MANAGER_PARAM
          the input parameter name for the markerManager parameter
static ParameterName MARKER_PROPERTY_NAME_PARAM
          the input parameter name for the markerPropertyName parameter
static java.lang.String MARKERS_ELEMENT
          the name for the markers output parameter.
protected  RepositoryMarkerManager mRepositoryMarkerManager
           
protected  javax.transaction.TransactionManager mTransactionManager
           
static java.lang.String OUTPUT_OPARAM
          the name for the output output parameter.
static java.lang.String TRUE_OPARAM
          the name for the true output parameter.
static ParameterName VALUE_PARAM
          the input parameter name for the value parameter
 
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.markers.MarkerConstants
ALLOW_DUPLICATES, ANY_VALUE, DEFAULT_MARKER_ID_PROPERTY_NAME, DEFAULT_MARKER_ITEM_TYPE, DEFAULT_MARKER_PROPERTY_NAME, DEFAULT_MARKER_SORT_PROPERTY_NAME, MARKER_CREATIONDATE_PROPERTY_NAME, MARKER_DATA_PROPERTY_NAME, MARKER_DUPLICATIONMODE_PROPERTY_NAME, MARKER_KEY_PROPERTY_NAME, MARKER_OWNER_PROPERTY_NAME, MARKER_RESOURCE_NAME, MARKER_VALUE_PROPERTY_NAME, NO_DUPLICATES, PARAM_DATA, PARAM_DUPMODE, PARAM_EXTENDED_PROPERTIES, PARAM_ITEM, PARAM_ITEM_ID, PARAM_KEY, PARAM_MARKED_ITEM_TYPE, PARAM_MARKER_ITEM_TYPE, PARAM_MARKER_MANAGER, PARAM_MARKER_PROPERTY_NAME, PARAM_VALUE, REPLACE_DUPLICATES, sResourceBundle
 
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
MarkerDroplet()
           
 
Method Summary
abstract  java.lang.String doService(DynamoHttpServletRequest req, DynamoHttpServletResponse res)
          This method is called by the service method to perform the droplet's processing.
 java.lang.String getANY_VALUE()
          Returns the token string that indicates a property value can be anything.
protected  java.lang.String getData(DynamoHttpServletRequest req)
          Returns the data parameter value from the request
 java.lang.String getDefaultDuplicationMode()
          Returns the default duplication mode
 java.lang.String getDefaultMarkedItemType()
          Returns the default marked item type used when referencing a marked item by id
 java.lang.String getDefaultMarkerItemType()
          Returns the default marker item type used when creating new markers
 java.lang.String getDefaultMarkerPropertyName()
          Returns the default property name for storing markers on an item
protected  java.lang.String getDuplicationMode(DynamoHttpServletRequest req)
          Returns either the duplicationMode parameter value or the defaultDuplicationMode
 java.util.Map getExtendedProperties(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method can be extended to provide the extended property map.
protected  RepositoryItem getItem(DynamoHttpServletRequest req)
          Returns the item param from the request.
protected  java.lang.String getItemId(DynamoHttpServletRequest req)
          Returns the item id param from the request
protected  java.lang.String getKey(DynamoHttpServletRequest req)
          Returns the key parameter value from the request
protected  java.lang.String getMarkedItemType(DynamoHttpServletRequest req)
          Returns either the markedItemType parameter value or the defaultMarkedItemType
protected  java.lang.String getMarkerItemType(DynamoHttpServletRequest req)
          Returns either the markerItemType parameter value or the defaultMarkerItemType
protected  RepositoryMarkerManager getMarkerManager(DynamoHttpServletRequest req)
          Returns either the markerManager param value or the configured RepositoryMarkerManager.
protected  java.lang.String getMarkerPropertyName(DynamoHttpServletRequest req)
          Returns either the markerPropertyName parameter value or the defaultMarkerPropertyName
 RepositoryMarkerManager getRepositoryMarkerManager()
          Returns the marker manager used by the droplet
 javax.transaction.TransactionManager getTransactionManager()
          Returns the transaction manager used by the droplet
protected  java.lang.String getValue(DynamoHttpServletRequest req)
          Returns the value parameter value from the request
 void service(DynamoHttpServletRequest req, DynamoHttpServletResponse res)
          This method first calls the validateInput method, followed by the doService method.
 void setDefaultDuplicationMode(java.lang.String pDefaultDuplicationMode)
          Sets the default duplication mode.
 void setDefaultMarkedItemType(java.lang.String pDefaultMarkedItemType)
          Sets the default marked item type used when referencing a marked item by id
 void setDefaultMarkerItemType(java.lang.String pDefaultMarkerItemType)
          Sets the default marker item type used when creating new markers
 void setDefaultMarkerPropertyName(java.lang.String pDefaultMarkerPropertyName)
          Sets the default property name for storing markers on an item
 void setRepositoryMarkerManager(RepositoryMarkerManager pRepositoryMarkerManager)
          Sets the marker manager used by the droplet
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets the transaction manager used by the droplet
protected  void validateInput(DynamoHttpServletRequest req, DynamoHttpServletResponse res)
          Validates the input parameters.
- verifies that there's an item or itemid.
- verifies that there's a repository marker manager.
 
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, doStartService, 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


ITEM_PARAM

public static final ParameterName ITEM_PARAM
the input parameter name for the item parameter


ITEM_ID_PARAM

public static final ParameterName ITEM_ID_PARAM
the input parameter name for the itemId parameter


DUPLICATION_MODE_PARAM

public static final ParameterName DUPLICATION_MODE_PARAM
the input parameter name for the duplicationMode parameter


KEY_PARAM

public static final ParameterName KEY_PARAM
the input parameter name for the key parameter


VALUE_PARAM

public static final ParameterName VALUE_PARAM
the input parameter name for the value parameter


DATA_PARAM

public static final ParameterName DATA_PARAM
the input parameter name for the data parameter


MARKER_PROPERTY_NAME_PARAM

public static final ParameterName MARKER_PROPERTY_NAME_PARAM
the input parameter name for the markerPropertyName parameter


MARKER_ITEM_TYPE_PARAM

public static final ParameterName MARKER_ITEM_TYPE_PARAM
the input parameter name for the markerItemType parameter


MARKED_ITEM_TYPE_PARAM

public static final ParameterName MARKED_ITEM_TYPE_PARAM
the input parameter name for the markedItemType parameter


MARKER_MANAGER_PARAM

public static final ParameterName MARKER_MANAGER_PARAM
the input parameter name for the markerManager parameter


MARKER_EXTPROPS_PARAM

public static final ParameterName MARKER_EXTPROPS_PARAM
the input parameter name for the extendedProperties parameter


ERROR_MSG_PARAM

public static final java.lang.String ERROR_MSG_PARAM
the name for the errorMsg output parameter. automatically set with the markerexecption text.

See Also:
Constant Field Values

MARKER_COUNT

public static final java.lang.String MARKER_COUNT
the name for the markerCount output parameter. use to return a count of markers

See Also:
Constant Field Values

MARKER_ELEMENT

public static final java.lang.String MARKER_ELEMENT
the name for the marker output parameter. use to return a single marker.

See Also:
Constant Field Values

MARKERS_ELEMENT

public static final java.lang.String MARKERS_ELEMENT
the name for the markers output parameter. use to return a collection of markers

See Also:
Constant Field Values

ERROR_OPARAM

public static final java.lang.String ERROR_OPARAM
the name for the error output parameter. automatically rendered for marker exceptions

See Also:
Constant Field Values

OUTPUT_OPARAM

public static final java.lang.String OUTPUT_OPARAM
the name for the output output parameter. use to render the output oparam upon successful completion

See Also:
Constant Field Values

TRUE_OPARAM

public static final java.lang.String TRUE_OPARAM
the name for the true output parameter. use to render the true oparam upon successful completion

See Also:
Constant Field Values

FALSE_OPARAM

public static final java.lang.String FALSE_OPARAM
the name for the false output parameter. use to render the false oparam upon successful completion

See Also:
Constant Field Values

EMPTY_OPARAM

public static final java.lang.String EMPTY_OPARAM
the name for the empty output parameter. use to render the empty oparam upon successful completion

See Also:
Constant Field Values

mRepositoryMarkerManager

protected RepositoryMarkerManager mRepositoryMarkerManager

mTransactionManager

protected javax.transaction.TransactionManager mTransactionManager
Constructor Detail

MarkerDroplet

public MarkerDroplet()
Method Detail

setRepositoryMarkerManager

public void setRepositoryMarkerManager(RepositoryMarkerManager pRepositoryMarkerManager)
Sets the marker manager used by the droplet


getRepositoryMarkerManager

public RepositoryMarkerManager getRepositoryMarkerManager()
Returns the marker manager used by the droplet


setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets the transaction manager used by the droplet


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns the transaction manager used by the droplet


getExtendedProperties

public java.util.Map getExtendedProperties(DynamoHttpServletRequest pRequest,
                                           DynamoHttpServletResponse pResponse)
This method can be extended to provide the extended property map. In the base implementations, this method returns the map provided as a droplet parameter


getItem

protected RepositoryItem getItem(DynamoHttpServletRequest req)
                          throws MarkerException
Returns the item param from the request.

Throws:
MarkerException

getItemId

protected java.lang.String getItemId(DynamoHttpServletRequest req)
                              throws MarkerException
Returns the item id param from the request

Throws:
MarkerException

getMarkerManager

protected RepositoryMarkerManager getMarkerManager(DynamoHttpServletRequest req)
                                            throws MarkerException
Returns either the markerManager param value or the configured RepositoryMarkerManager.

Throws:
MarkerException

getKey

protected java.lang.String getKey(DynamoHttpServletRequest req)
                           throws MarkerException
Returns the key parameter value from the request

Throws:
MarkerException

getValue

protected java.lang.String getValue(DynamoHttpServletRequest req)
                             throws MarkerException
Returns the value parameter value from the request

Throws:
MarkerException

getData

protected java.lang.String getData(DynamoHttpServletRequest req)
                            throws MarkerException
Returns the data parameter value from the request

Throws:
MarkerException

getMarkedItemType

protected java.lang.String getMarkedItemType(DynamoHttpServletRequest req)
                                      throws MarkerException
Returns either the markedItemType parameter value or the defaultMarkedItemType

Throws:
MarkerException

getMarkerItemType

protected java.lang.String getMarkerItemType(DynamoHttpServletRequest req)
                                      throws MarkerException
Returns either the markerItemType parameter value or the defaultMarkerItemType

Throws:
MarkerException

getMarkerPropertyName

protected java.lang.String getMarkerPropertyName(DynamoHttpServletRequest req)
                                          throws MarkerException
Returns either the markerPropertyName parameter value or the defaultMarkerPropertyName

Throws:
MarkerException

getDuplicationMode

protected java.lang.String getDuplicationMode(DynamoHttpServletRequest req)
                                       throws MarkerException
Returns either the duplicationMode parameter value or the defaultDuplicationMode

Throws:
MarkerException

getANY_VALUE

public java.lang.String getANY_VALUE()
Returns the token string that indicates a property value can be anything. This property value cab be used for hasMarker and removeMarker droplets by specifying it as the parameter value.

For example,


setDefaultMarkerPropertyName

public void setDefaultMarkerPropertyName(java.lang.String pDefaultMarkerPropertyName)
Sets the default property name for storing markers on an item


getDefaultMarkerPropertyName

public java.lang.String getDefaultMarkerPropertyName()
Returns the default property name for storing markers on an item


setDefaultMarkerItemType

public void setDefaultMarkerItemType(java.lang.String pDefaultMarkerItemType)
Sets the default marker item type used when creating new markers


getDefaultMarkerItemType

public java.lang.String getDefaultMarkerItemType()
Returns the default marker item type used when creating new markers


setDefaultMarkedItemType

public void setDefaultMarkedItemType(java.lang.String pDefaultMarkedItemType)
Sets the default marked item type used when referencing a marked item by id


getDefaultMarkedItemType

public java.lang.String getDefaultMarkedItemType()
Returns the default marked item type used when referencing a marked item by id


setDefaultDuplicationMode

public void setDefaultDuplicationMode(java.lang.String pDefaultDuplicationMode)
Sets the default duplication mode.


getDefaultDuplicationMode

public java.lang.String getDefaultDuplicationMode()
Returns the default duplication mode


validateInput

protected void validateInput(DynamoHttpServletRequest req,
                             DynamoHttpServletResponse res)
                      throws MarkerException
Validates the input parameters.
- verifies that there's an item or itemid.
- verifies that there's a repository marker manager.

Throws:
on - validation error
MarkerException

doService

public abstract java.lang.String doService(DynamoHttpServletRequest req,
                                           DynamoHttpServletResponse res)
                                    throws MarkerException,
                                           javax.servlet.ServletException,
                                           java.io.IOException
This method is called by the service method to perform the droplet's processing.

MarkerExeceptions should be thrown for errors in processing, which will cause the errorMsg parameter to be set with the exception text, and the error oparam to be rendered.

Implementations should set the necessary output parameters for rendering after successful processing, and return the name of the oparam name to render on success.

Returns:
the name of the oparam to render after successful completion.
Throws:
MarkerException
javax.servlet.ServletException
java.io.IOException
See Also:
OUTPUT_OPARAM, TRUE_OPARAM, FALSE_OPARAM, EMPTY_OPARAM

service

public void service(DynamoHttpServletRequest req,
                    DynamoHttpServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
This method first calls the validateInput method, followed by the doService method. The entire process is contained within a single transaction demarcation.

The error output param is rendered for any Exceptions thrown by validateInput or doService.

If an error occurs, this method will set the error message output parameter based on the the exception's text, and render the error oparam.

If doService completes successfully the oparam name returned by that method is rendered.

This class statically defines the oparam names for successful completion.

Overrides:
service in class DynamoServlet
Parameters:
req - the request to be processed
res - 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.
See Also:
validateInput(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), doService(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), ERROR_MSG_PARAM, ERROR_OPARAM