net.wgen.op.logging
Class TraceTrigger

java.lang.Object
  extended bynet.wgen.op.logging.TraceTrigger
All Implemented Interfaces:
ParamTriggerListener, TriggerInitializer

public class TraceTrigger
extends java.lang.Object
implements TriggerInitializer, ParamTriggerListener

Version:
$Id: TraceTrigger.html,v 1.2 2007/01/28 04:09:37 paulfeuer Exp $
Author:
Paul Feuer, Wireless Generation, Inc.

Field Summary
private  java.lang.String _loggerPath
           
static java.lang.String DEFAULT_TRIGGER_PARAM
           
static java.lang.String INIT_PARAM_LOGGER_PATH
           
static java.lang.String INIT_PARAM_TRIGGER_PARAM
           
private static org.apache.log4j.Logger LOG
           
static java.lang.String REQUEST_ATTRIB__TRACE_OUTPUT
           
static java.lang.String REQUEST_ATTRIB__TRACE_STATE
           
static java.lang.String SESSION_ATTRIB__REDIRECT_TRACE
           
static java.lang.String VALUE_OFF
           
static java.lang.String VALUE_ON
           
 
Constructor Summary
TraceTrigger()
           
 
Method Summary
static boolean applyTraceToJSONObject(TraceKey traceKey, TraceState traceState, org.json.JSONObject responseObj)
          Applies the captured trace to the JSONObject so that ajax requests can pass traces back down to the client even though the page is not bein redrawn.
static void applyTraceToRedirect(javax.servlet.http.HttpServletRequest request)
          Capture the trace to a String and temporarily store it in the session for retrieval by a subsequent redirected request.
static void applyTraceToRequest(javax.servlet.http.HttpServletRequest request)
          Capture the trace to a String and put it in the output, either in __trace__ in the request attributes, or in the case of an ajax call with a JSONObject output, in a __trace__ member of the returned JSONObject.
 void handleFilterCompletion(ParamTrigger trigger, ParamTriggerState triggerState, javax.servlet.http.HttpServletRequest request)
          Finish the behavior after the body of the Action is executed, but before returning to the client.
 void handleTriggerValue(ParamTrigger trigger, java.lang.String parameterName, java.lang.Object value, ParamTriggerState triggerState)
          Handles a trigger fire.
 void registerTriggersInFilter(ParamTriggerFilter filter)
          Register triggers in the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

REQUEST_ATTRIB__TRACE_OUTPUT

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

REQUEST_ATTRIB__TRACE_STATE

public static final java.lang.String REQUEST_ATTRIB__TRACE_STATE

SESSION_ATTRIB__REDIRECT_TRACE

public static final java.lang.String SESSION_ATTRIB__REDIRECT_TRACE

INIT_PARAM_LOGGER_PATH

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

INIT_PARAM_TRIGGER_PARAM

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

DEFAULT_TRIGGER_PARAM

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

VALUE_ON

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

VALUE_OFF

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

_loggerPath

private java.lang.String _loggerPath
Constructor Detail

TraceTrigger

public TraceTrigger()
Method Detail

registerTriggersInFilter

public void registerTriggersInFilter(ParamTriggerFilter filter)
Register triggers in the filter.

Specified by:
registerTriggersInFilter in interface TriggerInitializer
Parameters:
filter - the filter object in which the triggers should be registered.

handleTriggerValue

public void handleTriggerValue(ParamTrigger trigger,
                               java.lang.String parameterName,
                               java.lang.Object value,
                               ParamTriggerState triggerState)
Handles a trigger fire.

Specified by:
handleTriggerValue in interface ParamTriggerListener
Parameters:
trigger - the trigger that fired
parameterName - the trigger parameterName that caused the trigger to fire
value - the value of the trigger
triggerState - the traceKey identifying the request that caused the trigger to fire

handleFilterCompletion

public void handleFilterCompletion(ParamTrigger trigger,
                                   ParamTriggerState triggerState,
                                   javax.servlet.http.HttpServletRequest request)
Finish the behavior after the body of the Action is executed, but before returning to the client. Called by the ParamTrigger once the request has returned from the filterChain.

Specified by:
handleFilterCompletion in interface ParamTriggerListener
Parameters:
trigger -
triggerState -
request -

applyTraceToRequest

public static void applyTraceToRequest(javax.servlet.http.HttpServletRequest request)
Capture the trace to a String and put it in the output, either in __trace__ in the request attributes, or in the case of an ajax call with a JSONObject output, in a __trace__ member of the returned JSONObject.

Parameters:
request -

applyTraceToRedirect

public static void applyTraceToRedirect(javax.servlet.http.HttpServletRequest request)
Capture the trace to a String and temporarily store it in the session for retrieval by a subsequent redirected request.

Parameters:
request -

applyTraceToJSONObject

public static boolean applyTraceToJSONObject(TraceKey traceKey,
                                             TraceState traceState,
                                             org.json.JSONObject responseObj)
Applies the captured trace to the JSONObject so that ajax requests can pass traces back down to the client even though the page is not bein redrawn.

Parameters:
traceKey - the traceKey
traceState - the filter state being evaluated
responseObj - a non-null JSONObject response
Returns:
whether or not the trace was able to be applied to the argument