com.ibm.commerce.context.baseimpl

Class AbstractContextImpl

  • java.lang.Object
    • com.ibm.commerce.context.baseimpl.AbstractContextImpl
    • Field Summary

      Fields 
      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 Summary

      Constructors 
      Constructor and Description
      AbstractContextImpl()
      The do-nothing zero-argument constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • SER_VALUE_SEP

        public static final java.lang.String SER_VALUE_SEP
        The delimiter used in context string representation.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractContextImpl

        public AbstractContextImpl()
        The do-nothing zero-argument constructor.
    • Method Detail

      • getActivityToken

        public ActivityToken getActivityToken()
        This method gets the token that represents this context's activity.
        Specified by:
        getActivityToken in interface Context
        Returns:
        this context's activity token
      • initialize

        public final void initialize(ActivityToken token,
                                     com.ibm.commerce.component.contextservice.ActivityData initData)
                              throws BusinessContextException
        This method initializes this context with the given initialization data.
        1. It sets the context activity token instance variable to token.
        2. This method calls the initializeContext(ActivityData) method, which each concrete context should implement.
        This method is called by the begin() method of the business context service when an activity is created.
        Specified by:
        initialize in interface ContextSPI
        Parameters:
        token - the activity token that this context is to be associated with
        initData - the initialization data
        Throws:
        BusinessContextException - on any error encountered
      • preInvokeContext

        public abstract void preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData)
                                       throws BusinessContextException
        This method performs context-specific tasks before request execution.
        Parameters:
        sessionData - the map of name-value pairs for the parameters that are passed in the request
        Throws:
        BusinessContextException - on any error encountered
        See Also:
        preInvoke(ActivityData)
      • preInvoke

        public final void preInvoke(com.ibm.commerce.component.contextservice.ActivityData sessionData)
                             throws BusinessContextException
        This method updates this context based on the given session data. This method is called by the startRequest() method of the business context service before request execution. This method calls the preInvokeContext(ActivityData) method, which each concrete context should implement.
        Specified by:
        preInvoke in interface ContextSPI
        Parameters:
        sessionData - the map of name-value pairs for the parameters that are passed in the request
        Throws:
        BusinessContextException - on any error encountered
      • resetContext

        public void resetContext()
                          throws BusinessContextException
        This method performs context-specific tasks when a request is rolled back. The default behavior for all contexts is to do nothing.
        Throws:
        BusinessContextException - on any error encountered
        See Also:
        reset()
      • reset

        public final void reset()
                         throws BusinessContextException
        This method is called by the 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.
        Specified by:
        reset in interface ContextSPI
        Throws:
        BusinessContextException - on any error encountered
      • initializeContext

        public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
                                      Context ctx)
                               throws BusinessContextException
        This method initializes this context based on a given existing context and updates it based on the given initialization data. The default behavior for all contexts is to ignore the given existing context and initialize themselves based solely on the given initialization data.
        Parameters:
        initData - the initialization data
        ctx - the given existing context
        Throws:
        BusinessContextException - on any error encountered
      • initialize

        public final void initialize(ActivityToken oldToken,
                                     ActivityToken token,
                                     com.ibm.commerce.component.contextservice.ActivityData initData)
                              throws BusinessContextException
        This method initializes this context based on a given existing activity's context and updates it based on the given initialization data.
        1. It sets the context activity token instance variable to token.
        2. This method calls the initializeContext(ActivityData, Context) method, which each concrete context should implement.
        This method is called by the copyActivity() method of the business context service when a user switches from one store to another.
        Specified by:
        initialize in interface ContextSPI
        Parameters:
        oldToken - the activity token for the given existing activity that this context is to be based upon
        token - the activity token that this context is to be associated with
        initData - the initialization data
        Throws:
        BusinessContextException - on any error encountered
      • isDirty

        public boolean isDirty()
        This method checks whether this context is dirty.
        Specified by:
        isDirty in interface ContextSPI
        Returns:
        true if the context is dirty; false otherwise
      • setDirty

        public void setDirty(boolean value)
        This method sets whether this context is dirty.
        Parameters:
        value - true if the context is dirty; false otherwise
      • getContextAttributes

        public abstract java.lang.Object[] getContextAttributes()
                                                         throws BusinessContextException
        This method gets the attributes to include in the string representation of this context.
        Returns:
        the array of attributes to include in the string representation of this context
        Throws:
        BusinessContextException - on any error encountered
        See Also:
        getContextSerializedString()
      • getContextSerializedString

        public final java.lang.String getContextSerializedString()
                                                          throws BusinessContextException
        This method returns the string representation of this context.
        1. Ensures that all of this context's attributes are valid.
        2. This method calls the getContextAttributes() method (which each concrete context should implement), to get the list of attributes to include in the string representation.
        Specified by:
        getContextSerializedString in interface ContextSPI
        Returns:
        the string representation of this context
        Throws:
        BusinessContextException - on any error encountered
      • setContextAttributes

        public abstract void setContextAttributes(java.lang.String[] ctxAttrs)
                                           throws BusinessContextException
        This method populates this context from a given array of context attributes.
        Parameters:
        ctxAttrs - given array of context attributes
        Throws:
        BusinessContextException - on any error encountered
      • recalibrateContext

        public void recalibrateContext()
                                throws BusinessContextException
        This method recalibrates this context. The default behavior for all contexts is to do nothing. Note that this method can be overridden by new business context implementation. However, it is reserved to be called by internal WebSphere Commerce runtime, not by any other application logic.
        Throws:
        BusinessContextException - on any error encountered
        See Also:
        recalibrate()
      • recalibrate

        public final void recalibrate()
                               throws BusinessContextException
        Reserved for IBM internal use. This method recalibrates this context. This method is called by the 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.
        Specified by:
        recalibrate in interface ContextSPI
        Throws:
        BusinessContextException - on any error encountered
      • clearContext

        public abstract void clearContext()
        This method resets the attributes specific to this context.
        See Also:
        clear()
      • clear

        public final void clear()
        This method resets this context's instance variables to their uninitialized values.
        1. It sets the context activity token instance variable to null and the dirty bit to false.
        2. This method calls the clearContext() method, which each concrete context should implement.
        Specified by:
        clear in interface ContextSPI
      • toString

        public java.lang.String toString()
        This method returns the string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of the object.