public interface BusinessContextService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Modifier and Type | Method and Description |
---|---|
ActivityToken |
begin(com.ibm.commerce.component.contextservice.ActivityData initData)
This method creates an activity with the given initialization data.
|
ActivityToken |
begin(java.lang.String logonId,
java.lang.String pwd,
com.ibm.commerce.component.contextservice.ActivityData initData)
This method returns an activity for a given valid user logon ID and password.
|
ActivityToken |
begin(java.lang.String logonId,
java.lang.String pwd,
ActivityDataNameValuePairs initDataNVPs)
This method is the same as
begin(String, String, ActivityData) , but accepts initialization data as an
ActivityDataNameValuePairs object, as per Web service requirements. |
void |
complete(ActivityToken token)
This method completes a given activity.
|
ActivityToken |
copyActivity(ActivityToken currentToken,
com.ibm.commerce.component.contextservice.ActivityData sessionData)
This method creates a new activity based on the contexts associated with a given token and session data.
|
ActivityToken |
copyActivity(ActivityToken currentToken,
ActivityDataNameValuePairs initDataNVPs)
This method is the same as
copyActivity(ActivityToken, ActivityData) , but accepts session data as an
ActivityDataNameValuePairs object, as per Web service requirements. |
ActivityToken |
createTransientClonedActivity(ActivityToken oldToken)
Reserved for IBM internal use.
|
void |
endRequest(ActivityToken token)
Reserved for IBM internal use.
|
void |
expire(ActivityToken token)
Reserved for IBM internal use.
|
ActivityToken |
findActivityTokenById(java.lang.Long activityTokenId)
Reserved for IBM internal use.
|
ActivityToken |
findActivityTokenForUserAndStore(java.lang.Long callerId,
java.lang.Integer storeId)
Reserved for IBM internal use.
|
Context |
findContext(ActivityToken token,
java.lang.String strContextName)
This method finds the context with a given name that is associated with a given activity.
|
void |
flushCache()
Reserved for IBM internal use.
|
java.util.Map |
getContextMap(ActivityToken token)
Reserved for IBM internal use.
|
java.util.List |
getContextSPIs(ActivityToken token)
Reserved for IBM internal use.
|
boolean |
isContextDirty(ActivityToken token)
Reserved for IBM internal use.
|
boolean |
isValidToken(ActivityToken token)
This method checks the validity of a given token.
|
ActivityToken |
resolveActivity(ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData initData)
Reserved for IBM internal use.
|
void |
rollbackRequest(ActivityToken token)
Reserved for IBM internal use.
|
void |
setContextMap(ActivityToken token,
java.util.Map ctxMap)
Reserved for IBM internal use.
|
void |
startRequest(ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData sessionData)
Reserved for IBM internal use.
|
void |
stopActivities(java.lang.Long nUserId)
Reserved for IBM internal use.
|
void |
stopActivity(ActivityToken token)
Stop the activity.
|
void |
synchronizeContexts(ActivityToken token,
boolean bRequestStarted)
Reserved for IBM internal use.
|
static final java.lang.String COPYRIGHT
ActivityToken begin(com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException
initialize(ActivityToken, ActivityData)
method of
each business context, where all the required parameters are extracted and used to populate the context.
This method is called by a local client to indicate the beginning of an activity.initData
- the initialization dataBusinessContextServiceException
- on any error encounteredActivityToken begin(java.lang.String logonId, java.lang.String pwd, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException, BusinessContextServiceAuthenticationException
logonId
- the logon ID of the user who is trying to initiate an activitypwd
- the user's passwordinitData
- the initialization dataBusinessContextServiceException
- on any other error encounteredBusinessContextServiceAuthenticationException
- if the user cannot be authenticatedActivityToken begin(java.lang.String logonId, java.lang.String pwd, ActivityDataNameValuePairs initDataNVPs) throws ServiceException
begin(String, String, ActivityData)
, but accepts initialization data as an
ActivityDataNameValuePairs
object, as per Web service requirements.
This method is called by a remote client if user ID and password are available to begin an activity.logonId
- the logon ID of the user who is trying to initiate an activitypwd
- the user's passwordinitDataNVPs
- the initialization dataServiceException
- whenever begin(String, String, ActivityData)
throws an exceptionContext findContext(ActivityToken token, java.lang.String strContextName) throws BusinessContextServiceException, BusinessContextNotFoundException
token
- the activity tokenstrContextName
- the context namenull
if not foundBusinessContextServiceException
- if any generic error occursBusinessContextNotFoundException
- if the specified context can not be loaded from the databasevoid complete(ActivityToken token) throws ServiceException
T
in the CTXMGMT table
to indicate that the activity is no longer active.token
- the activity tokenServiceException
- on any error encounteredvoid expire(ActivityToken token) throws BusinessContextServiceException
This method marks a given activity as expired.
Changes the status of the activity to E
in the CTXMGMT table
to indicate that the activity has expired.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredvoid startRequest(ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextServiceException
This method is called before request execution for any necessary setup.
The implementation of this method will pass the session data down to the preInvoke(ActivityData)
method of each business context associated with the given activity.
Next, all the required parameters are extracted and used to update the context.
This method is called by a local client before the processing of a request.
token
- the activity tokensessionData
- the map of name-value pairs for the parameters that are passed in the requestBusinessContextServiceException
- on any error encounteredvoid endRequest(ActivityToken token) throws BusinessContextServiceException
This method is called after request execution for any necessary cleanup.
The implementation of this method will, in turn, call the postInvoke(ActivityData)
method of each business context associated with
the given activity.
This method is called by a local client after the processing of a request.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredvoid rollbackRequest(ActivityToken token) throws BusinessContextServiceException
This method is called when a request is rolled back.
The implementation of this method will, in turn, call the reset()
method of each business context associated with
the given activity.
This method is called by a local client to indicate when a request is rolled back.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredActivityToken copyActivity(ActivityToken currentToken, com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextServiceException
initialize(ActivityToken, ActivityToken, ActivityData)
method of
each business context, where the context is first initialized based on the input activity's context and then
updated based on the session data.
This method is called when it is required to switch to another activity under the following circumstances:
currentToken
- the activity token of the input activitysessionData
- the name-value pairs for the parameters that are passed in the requestBusinessContextServiceException
- on any error encounteredActivityToken copyActivity(ActivityToken currentToken, ActivityDataNameValuePairs initDataNVPs) throws ServiceException
copyActivity(ActivityToken, ActivityData)
, but accepts session data as an
ActivityDataNameValuePairs
object, as per Web service requirements.
This method is called by a remote client.currentToken
- the activity token of the input activityinitDataNVPs
- the name-value pairs for the parameters that are passed in the requestServiceException
- on any error encounteredActivityToken resolveActivity(ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException
This method gets the valid activity token that is associated with a particular user and store. This method is mainly used when a user switches from one store to another. The implementation of this method will iterate through all existing activities and return an active one if possible.
token
- an activity token that identifies the userinitData
- initialization data that identifies the storenull
otherwiseBusinessContextServiceException
- on any error encounteredActivityToken findActivityTokenForUserAndStore(java.lang.Long callerId, java.lang.Integer storeId) throws BusinessContextServiceException
This method finds an activity token for a particular caller and store.
callerId
- the caller IDstoreId
- the store IDnull
otherwiseBusinessContextServiceException
- on any error encounteredActivityToken findActivityTokenById(java.lang.Long activityTokenId) throws BusinessContextServiceException
This method finds an activity token by the specified activity token id.
activityTokenId
- The activity token IDnull
otherwiseBusinessContextServiceException
- on any error encounteredboolean isValidToken(ActivityToken token) throws InvalidActivityTokenException
token
- the tokentrue
if the token is validInvalidActivityTokenException
- if the token is not validjava.util.Map getContextMap(ActivityToken token) throws BusinessContextServiceException
This method gets a map of string representations of all the contexts associated with a given activity. This method is provided for generic user support where contexts persist in a cookie instead of in a database.
token
- the token that identifies the activityBusinessContextServiceException
- on any error encounteredvoid setContextMap(ActivityToken token, java.util.Map ctxMap) throws BusinessContextServiceException
This method initializes the contexts of a given activity based on a map of string representations of all of the activity's contexts. This method is provided for generic user support where contexts are persisted in cookie instead of database.
token
- the token that identifies the activityctxMap
- the map of string representations of all the contexts associated with the activityBusinessContextServiceException
- on any error encounteredboolean isContextDirty(ActivityToken token)
This method checks whether any of the contexts associated with a given token are dirty. The implementation of this method will iterate through all the business contexts of the activity and check whether each of them is dirty. This method is used by a local client.
token
- the tokentrue
if any of the contexts are dirty; false
otherwiseActivityToken createTransientClonedActivity(ActivityToken oldToken)
This method creates a transient cloned token from a given token. The resulting token is a transient object to be used within a request and will not be persisted. Its contexts are copies of the input token's contexts. This method is used when a temporary change is required to the business context. Changes will not affect the original copies of the business context.
oldToken
- the token to be clonedvoid stopActivities(java.lang.Long nUserId)
This method stops all activities for a given user. The implementation of this method will change the status of all active activities related to the user to 'T'. Once the status is moved from 'A' to 'T', the activity can no longer be used. This method is used to ensure that only one activity related to the given user can be active.
nUserId
- the ID of the user for whom all activities are to be stoppedvoid stopActivity(ActivityToken token)
token
- The token of the activity to stop.void flushCache()
This method flushes all activities from the activity cache for the current thread. Business contexts of an activity are cached in the Business Context Service for performance reason to save on context initialization. Activities are stored in the cache in a per thread basis. This method is called to clear the cache for the current thread at the exit point of a request.
java.util.List getContextSPIs(ActivityToken token)
This method gets all the context service provider interface objects that are associated with a given activity. This is similar to the getContextMap(ActivityToken) method, but this method returns the business context in its context service provider interface objects instead of string representations.
token
- the token that identifies the activityvoid synchronizeContexts(ActivityToken token, boolean bRequestStarted) throws BusinessContextServiceException
This method is called by the base context in response to various changes therein.
This method, in turn, calls the recalibrate()
method of each context that depends on the base context
so that they can recalibrate themselves accordingly.
token
- the token that identifies the activitybRequestStarted
- true
if startRequest(ActivityToken, ActivityData)
has been called;
false
otherwiseBusinessContextServiceException
- on any error encountered