com.ibm.commerce.programadapter

Class ProgramAdapter

  • java.lang.Object
    • com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
      • com.ibm.commerce.programadapter.ProgramAdapter
  • All Implemented Interfaces:
    com.ibm.commerce.adapter.DeviceFormatAdapter, com.ibm.commerce.adapter.nonhttp.NonHttpAdapter, com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory


    public class ProgramAdapter
    extends com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
    implements com.ibm.commerce.adapter.nonhttp.NonHttpAdapter, com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory
    The program adapter that can handle generic request objects.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String _STR_CreateAdapter
      Constant to represent the method name for logging purposes.
      static java.lang.String _STR_InitFactory
      Constant to represent the method name for logging purposes.
      static java.lang.String _STR_SetCommandProperties
      Constant to represent the method name for logging purposes.
      static java.lang.String _STR_ThisClass
      Constant to represent the class name for logging purposes.
      static java.lang.String _STR_ValidateDeviceFormat
      Constant to represent the method name for logging purposes.
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ProgramAdapter()
      Creates the program adapter object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean checkDeviceFormat(java.lang.Object req, TypedProperty prop)
      Return true if the input request can be processed by this adapter.
      com.ibm.commerce.adapter.nonhttp.NonHttpAdapter createAdapter(java.lang.Object request, java.lang.Object response, TypedProperty param)
      This method returns an instance of this adapter if the request has the format defined by this adapter.
      void initFactory(org.w3c.dom.Element node)
      Initialize the Adapter factory based on the information defined in the DOM XML node.
      boolean preInvokeCommand(CommandContext commandContext)
      This method checks if an exception occurs when validating the request session information.
      boolean processResponse(CommandContext commandContext, TypedProperty resProp)
      This method is called by the web controller after it has successfully finished the execution of the request.
      void setCommandProperties(CommandProperty cmdProp)
      Sets the CommandProperty of the adapter.
      CommandProperty validateDeviceFormat(java.lang.Object req)
      Returns a command property object if the device can be handled by this adapter, otherwise null will be returned.
      • Methods inherited from class com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl

        exceptionOccurred, getAdapterDesc, getDefaultDeviceFormatId, getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDeviceFormatTypeId, getDocumentPathName, getRequest, getRequestName, getRequestProperties, getResponse, getSessionContext, isEnabled, postInvokeCommand, preprocessRequest, processErrorResponse, processRequest, setAdapterDesc, setDefaultDeviceFormatId, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId, setRequest, setRequestProperties, setResponse
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.ibm.commerce.adapter.nonhttp.NonHttpAdapter

        exceptionOccurred, getAdapterDesc, getRequest, getRequestName, getResponse, preprocessRequest, processRequest, setAdapterDesc, setRequest, setRequestProperties, setResponse
      • Methods inherited from interface com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory

        getAdapterDesc, isEnabled
      • Methods inherited from interface com.ibm.commerce.adapter.DeviceFormatAdapter

        getDefaultDeviceFormatId, getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDeviceFormatTypeId, getDocumentPathName, getRequestProperties, getSessionContext, postInvokeCommand, processErrorResponse, setDefaultDeviceFormatId, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.String _STR_ThisClass
        Constant to represent the class name for logging purposes.
        See Also:
        Constant Field Values
      • _STR_CreateAdapter

        public static final java.lang.String _STR_CreateAdapter
        Constant to represent the method name for logging purposes.
        See Also:
        Constant Field Values
      • _STR_InitFactory

        public static final java.lang.String _STR_InitFactory
        Constant to represent the method name for logging purposes.
        See Also:
        Constant Field Values
      • _STR_SetCommandProperties

        public static final java.lang.String _STR_SetCommandProperties
        Constant to represent the method name for logging purposes.
        See Also:
        Constant Field Values
      • _STR_ValidateDeviceFormat

        public static final java.lang.String _STR_ValidateDeviceFormat
        Constant to represent the method name for logging purposes.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProgramAdapter

        public ProgramAdapter()
        Creates the program adapter object.
    • Method Detail

      • checkDeviceFormat

        public boolean checkDeviceFormat(java.lang.Object req,
                                         TypedProperty prop)
        Return true if the input request can be processed by this adapter.
        Specified by:
        checkDeviceFormat in interface com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory
        Parameters:
        req - the request object
        prop - the request properties created for this request
        Returns:
        Always will return false.
      • createAdapter

        public com.ibm.commerce.adapter.nonhttp.NonHttpAdapter createAdapter(java.lang.Object request,
                                                                             java.lang.Object response,
                                                                             TypedProperty param)
        This method returns an instance of this adapter if the request has the format defined by this adapter. This method should first call the checkDeviceFormat() method. If it returns true, then it will instantiate an instance of this adapter. The adapter instance returned will be initialized with request, response and request properties initialized.
        Specified by:
        createAdapter in interface com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory
        Parameters:
        request - the request object.
        response - the response object.
        param - the request parameters
        Returns:
        This method returns an instance of this adapter if the request can be processed by this adapter. It returns null if this request cannot be processed by this adapter.
      • initFactory

        public void initFactory(org.w3c.dom.Element node)
                         throws java.lang.Exception
        Initialize the Adapter factory based on the information defined in the DOM XML node. The initialization process creates a program adapter descriptor and passes the XML node to the descriptor for initialization.
        Specified by:
        initFactory in interface com.ibm.commerce.adapter.nonhttp.NonHttpAdapterFactory
        Overrides:
        initFactory in class com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
        Parameters:
        node - The XML configuration of the adapter.
        Throws:
        java.lang.Exception - if there is a problem initializing the adapter.
      • preInvokeCommand

        public boolean preInvokeCommand(CommandContext commandContext)
                                 throws ECException
        This method checks if an exception occurs when validating the request session information. If a session variable is incorrect, for example password, then the request will be redirect to an error response which indicates this. Because the session changes the request, the adapter does not know whether there is an error. It must consult the session to ensure whether an error occurred or not.
        Specified by:
        preInvokeCommand in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Overrides:
        preInvokeCommand in class com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
        Parameters:
        commandContext - the command context associated with the command.
        Returns:
        Always will return true.
        Throws:
        ECException - Whether there is a problem trying to determine whether an error occurred during the validating of the session.
      • processResponse

        public boolean processResponse(CommandContext commandContext,
                                       TypedProperty resProp)
                                throws ECException
        This method is called by the web controller after it has successfully finished the execution of the request. The web controller will execute the view task associated with the command if this method returns true.
        Specified by:
        processResponse in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Overrides:
        processResponse in class com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
        Parameters:
        commandContext - the command context of the command.
        resProp - the response properties returned by the command.
        Returns:
        Always will return true.
        Throws:
        ECException - if there is a problem determining whether an exception happened or not.
      • setCommandProperties

        public void setCommandProperties(CommandProperty cmdProp)
        Sets the CommandProperty of the adapter. When the command property is set, the command session is created. If there are any problems creating the session context for the request, the default session context will be used. This is DummyProgramAdapterSessionContext.
        Parameters:
        cmdProp - the command property for the adapter.
      • validateDeviceFormat

        public CommandProperty validateDeviceFormat(java.lang.Object req)
        Returns a command property object if the device can be handled by this adapter, otherwise null will be returned.
        Parameters:
        req - the request object.
        Returns:
        An instance of CommandProperty if this request can be processed by this adapter or null if this request cannot be processed by this adapter