public abstract class AbstractContextImpl extends java.lang.Object implements Context, ContextSPI
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
SER_VALUE_SEP
The delimiter used in context string representation.
|
Constructor and Description |
---|
AbstractContextImpl()
The do-nothing zero-argument constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
This method resets this context's instance variables to their uninitialized values.
|
abstract void |
clearContext()
This method resets the attributes specific to this context.
|
ActivityToken |
getActivityToken()
This method gets the token that represents this context's activity.
|
abstract java.lang.Object[] |
getContextAttributes()
This method gets the attributes to include in the string representation of this context.
|
java.lang.String |
getContextSerializedString()
This method returns the string representation of this context.
|
void |
initialize(ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData initData)
This method initializes this context with the given initialization data.
|
void |
initialize(ActivityToken oldToken,
ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData initData)
This method initializes this context based on a given existing activity's context and updates it based on the given
initialization data.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData)
This method initializes this context with the given initialization data.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
Context ctx)
This method initializes this context based on a given existing context and updates it based on the given
initialization data.
|
boolean |
isDirty()
This method checks whether this context is dirty.
|
void |
postInvoke()
This method is called by the
endRequest() method of the business context service
after request execution for any necessary cleanup. |
void |
postInvokeContext()
This method performs context-specific tasks after request execution.
|
void |
preInvoke(com.ibm.commerce.component.contextservice.ActivityData sessionData)
This method updates this context based on the given session data.
|
abstract void |
preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData)
This method performs context-specific tasks before request execution.
|
void |
recalibrate()
Reserved for IBM internal use.
|
void |
recalibrateContext()
This method recalibrates this context.
|
void |
reset()
This method is called by the
rollbackRequest() method of the business context service
when a request is rolled back. |
void |
resetContext()
This method performs context-specific tasks when a request is rolled back.
|
abstract void |
setContextAttributes(java.lang.String[] ctxAttrs)
This method populates this context from a given array of context attributes.
|
void |
setContextSerializedString(ActivityToken token,
java.lang.String serValue)
This method populates this context from a given string representation.
|
void |
setDirty(boolean value)
This method sets whether this context is dirty.
|
java.lang.String |
toString()
This method returns the string representation of the object.
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
copyContext, getContextName, validate
public static final java.lang.String COPYRIGHT
public static final java.lang.String SER_VALUE_SEP
public AbstractContextImpl()
public ActivityToken getActivityToken()
getActivityToken
in interface Context
public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextException
initData
- the initialization dataBusinessContextException
- on any error encounteredinitializeContext(ActivityData)
public final void initialize(ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextException
token
.initializeContext(ActivityData)
method, which each concrete context should implement.begin()
method of the business context service when an activity is created.initialize
in interface ContextSPI
token
- the activity token that this context is to be associated withinitData
- the initialization dataBusinessContextException
- on any error encounteredpublic abstract void preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextException
sessionData
- the map of name-value pairs for the parameters that are passed in the requestBusinessContextException
- on any error encounteredpreInvoke(ActivityData)
public final void preInvoke(com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextException
startRequest()
method of the business context service
before request execution.
This method calls the preInvokeContext(ActivityData)
method,
which each concrete context should implement.preInvoke
in interface ContextSPI
sessionData
- the map of name-value pairs for the parameters that are passed in the requestBusinessContextException
- on any error encounteredpublic void postInvokeContext() throws BusinessContextException
BusinessContextException
- on any error encounteredpostInvoke()
public final void postInvoke() throws BusinessContextException
endRequest()
method of the business context service
after request execution for any necessary cleanup.
This method calls the postInvokeContext()
method,
which each concrete context should implement.postInvoke
in interface ContextSPI
BusinessContextException
- on any error encounteredpublic void resetContext() throws BusinessContextException
BusinessContextException
- on any error encounteredreset()
public final void reset() throws BusinessContextException
rollbackRequest()
method of the business context service
when a request is rolled back.
This method calls the resetContext()
method,
which each concrete context should implement.
After this method is run, the state of the context reverts to the state at the beginning of the request.reset
in interface ContextSPI
BusinessContextException
- on any error encounteredpublic void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData, Context ctx) throws BusinessContextException
initData
- the initialization datactx
- the given existing contextBusinessContextException
- on any error encounteredpublic final void initialize(ActivityToken oldToken, ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextException
token
.initializeContext(ActivityData, Context)
method, which each concrete context should implement.copyActivity()
method of the business context service when
a user switches from one store to another.initialize
in interface ContextSPI
oldToken
- the activity token for the given existing activity that this context is to be based upontoken
- the activity token that this context is to be associated withinitData
- the initialization dataBusinessContextException
- on any error encounteredpublic boolean isDirty()
isDirty
in interface ContextSPI
true
if the context is dirty; false
otherwisepublic void setDirty(boolean value)
value
- true
if the context is dirty; false
otherwisepublic abstract java.lang.Object[] getContextAttributes() throws BusinessContextException
BusinessContextException
- on any error encounteredgetContextSerializedString()
public final java.lang.String getContextSerializedString() throws BusinessContextException
getContextAttributes()
method (which each concrete context should implement),
to get the list of attributes to include in the string representation.getContextSerializedString
in interface ContextSPI
BusinessContextException
- on any error encounteredpublic abstract void setContextAttributes(java.lang.String[] ctxAttrs) throws BusinessContextException
ctxAttrs
- given array of context attributesBusinessContextException
- on any error encounteredpublic final void setContextSerializedString(ActivityToken token, java.lang.String serValue) throws BusinessContextException
setContextAttributes(String[])
method (which each concrete context must implement),
to populate the context from an array of attributes.setContextSerializedString
in interface ContextSPI
token
- the token that identifies this context's activityserValue
- the string representation of a contextBusinessContextException
- on any error encounteredpublic void recalibrateContext() throws BusinessContextException
BusinessContextException
- on any error encounteredrecalibrate()
public final void recalibrate() throws BusinessContextException
synchronizeContexts()
method of the business context service
in response to changes to the base context.
This method, in turn, calls the recalibrateContext()
method,
which each concrete context should implement.recalibrate
in interface ContextSPI
BusinessContextException
- on any error encounteredpublic abstract void clearContext()
clear()
public final void clear()
null
and the dirty bit to false
.clearContext()
method, which each concrete context should implement.clear
in interface ContextSPI
public java.lang.String toString()
toString
in class java.lang.Object