com.ibm.commerce.pvcadapter

Class PVCAdapterImpl

  • java.lang.Object
    • com.ibm.commerce.adapter.AbstractHttpAdapter
      • com.ibm.commerce.pvcadapter.PVCAdapterImpl
  • All Implemented Interfaces:
    com.ibm.commerce.adapter.DeviceFormatAdapter, com.ibm.commerce.adapter.HttpAdapter, com.ibm.commerce.adapter.HttpAdapterFactory, PVCAdapter


    public abstract class PVCAdapterImpl
    extends com.ibm.commerce.adapter.AbstractHttpAdapter
    implements PVCAdapter
    Base implementation of the pervasive computing (PvC) adapter. Subclasses should implement the abstract method provided by PVCAdapterImpl.
    To install PvC adapters, insert the following tags into the XML configuration file. The tag HttpAdapters is located at the end of the configuration file.


    <HttpAdapters>
    <!-- All PvC adapter should be listed as a HttpAdapter in HttpAdapters tag -->
    <HttpAdapter
     name = "UniqueIdentifier"
     deviceFormatId = "DeviceFormatId"
     deviceFormatType = "DeviceFormatType"
     deviceFormatTypeId = "DeviceFormatTypeId"
     factoryClassname="ClassNameOfTheAdapter"
     enabled="true"
    >
    <!-- PvC adapters should provide following information -->
    <PVCAdapter
    registrationMode="RegistrationMode"
    preferredLogonTimeout="LogonTimeout"
    bufferTimeout="BufferTimeout"
    >
    <!-- The adapter accepts access from following address-->
    <IPCheck>    <!-- If you don't need address check, do not specify IPCheck tag -->
    <IP type="TypeOfTheAddress" value="Address"/>
    ...
    <IP type="TypeOfTheAddress" value="Address"/>
    </IPCheck>

    <!-- The adapter can excludes listed commands-->
    <ExcludeCommands>

    <!-- List commands the adapter should not execute-->
    <Command name="CommandName"/>
    ...
    <Command name="CommandName"/>
    </ExcludeCommands>

    <!-- The adapter can request user to reenter  password to execute commands -->
    <RelogonCommands>

    <!-- List commands the adapter needs password -->
    <Command name="CommandName"/>
    ...
    <Command name="CommandName"/>
    </RelogonCommands>
    </PVCAdapter>
    </HttpAdapter>

    <HttpAdapter>

    ...  <!-- You can install multiple adapters -->
    </HttpAdapter>
    </HttpAdapters>

    UniqueIdentifier

    Unique name to identify each adapters. Value must be shorter than length of the PVCSESSION.SESSIONTYPE column.
    DeviceFormatId
    Specify device format id of the adapter. The device format needs to be listed in the DEVICEFORMAT table.
    DeviceFormatType
    Specify name of the device format.
    DeviceFormatTypeId
    Specify the device format id of an adapter with which the adapter shares entries in the VIEWREG table. If you wish to separate entries in VIEWREG table with PC browser, you can specify same device format ID as PC browser.
    ClassNameOfTheAdapter
    Specify name of the adapter class.
    RegistrationMode
    Specify registration mode from followings.
    0: Unlimited
    1: Users need to register device information to login to WebSphere Commerce server using their device
    2: Users need to register device information to login to the WebSphere Commerce server using their device. One user can register only one device to login to WebSphere Commerce server.
    LogonTimeout
    Time to logon expires. Specify value in minutes
    BufferTimeout
    Time to buffered parameters are revoked. Specify value in minutes
    TypeOfTheAddress
    Type of the address. The value is net or host
    net: Specified Address is network address
    host: Specified Address is host address
    CommandName
    Name of a targetable command
     
     
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
      static java.lang.Integer STATUS_LOGOFF
      Value used in PVCSESSION to indicate that the PVC device user is logoff status.
      static java.lang.Integer STATUS_LOGON
      Value used in PVCSESSION to indicate that the PVC device user is logon status.
      • Fields inherited from interface com.ibm.commerce.adapter.HttpAdapter

        DEVFMTID_BROWSER, DEVFMTNAME_BROWSER, DEVFMTNAME_IMODE, DEVFMTTYP_BROWSER, DEVFMTTYP_PVCDEVICE, DEVFMTTYP_XMLFMT, DEVFMTTYPID_BROWSER, DEVFMTTYPID_PVC, DEVFMTTYPID_XML
    • Constructor Summary

      Constructors 
      Constructor and Description
      PVCAdapterImpl() 
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      com.ibm.commerce.adapter.HttpAdapter createAdapter(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, TypedProperty prop)
      Checks to see if the HttpServletRequest data is in this device format.
      com.ibm.commerce.adapter.HttpAdapterDesc getAdapterDesc()
      Return the descriptor of the adapter.
      java.lang.Integer getBufferTimeout()
      Gets buffer timeout value applied to the adapter from XML configuration file.
      abstract java.lang.String getDeviceModel()
      Gets the model name from the request.
      java.lang.String getDocumentPathName(java.lang.String name)
      Gets the actual output document name based on a base document name.
      java.lang.Integer getLogonTimeout()
      Gets the timeout value applied for the adapter from XML configuration file.
      PVCAdapterDesc getPVCAdapterDesc()
      Gets the descriptor of the PvC adapter
      PVCDeviceModelAccessBean getPVCDeviceModelAccessBean()
      Returns the access bean which contains model information of the device.
      PVCDeviceSpecAccessBean getPVCDeviceSpecAccessBean()
      Returns the access bean which contains spec information of the device.
      PVCSessionAccessBean getPVCSessionAccessBean()
      Returns the access bean which contains session information of the device.
      java.lang.Long getPvcSessionId()
      Returns session identifier used for session control using the adapter.
      java.lang.String getRegistrationMode()
      Returns retgistrationMode of the adapter in XML configuration file.
      com.ibm.commerce.adapter.SessionContext getSessionContext()
      Returns session context necessary for session control.
      java.lang.Integer getStoreId()
      Returns the store identifier in the request.
      abstract java.lang.String getTerminalId()
      Gets the terminal identifier sent by the wireless gateway.
      UserPVCDeviceAccessBean getUserPVCDeviceAccessBean()
      Returns access bean of the client's device information in USERPVCDEV table.
      boolean httpsRedirection()
      Checks to see if the adapter can support HTTP to HTTPS redirection.
      void initFactory(org.w3c.dom.Element node)
      Initialize the Adapter based on the information defined in the node.
      boolean isExcludeCommand(java.lang.String value)
      Returns true if the named command is excluded for this adapter.
      boolean isRelogonCommand(java.lang.String value)
      Returns true if the named command required a relogon for this adapter.
      void postInvokeCommand(CommandContext commandContext)
      Does necessary processes after invoking command.
      boolean preInvokeCommand(CommandContext commandContext)
      Does necessary process before invoking command.
      com.ibm.commerce.webcontroller.HttpControllerRequestObject preprocessRequest()
      This method preprocess the request and return a controller request object.
      void setDeviceModel(java.lang.String value)
      Sets the model name of the device.
      void setPVCAdapterDesc(PVCAdapterDesc value)
      Sets the descriptor of the PVCAdapter.
      void setPvcSessionId(java.lang.Long newPvcSessionId)
      Sets the session identifier necessary for session control using PvC adapter.
      void setStoreId(java.lang.Integer storeId)
      Sets the store identifier to the adapter.
      void setTerminalId(java.lang.String value)
      Sets the terminal identifier sent by the carrier to the adapter.
      boolean userHasTimedout()
      This method checks to see if a PvC user has timed out.
      • Methods inherited from class com.ibm.commerce.adapter.AbstractHttpAdapter

        displayGenericErrorView, getContextPath, getDefaultDeviceFormatId, getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDeviceFormatTypeId, getOrigReqName, getRequest, getRequestName, getRequestObject, getRequestProperties, getRequestURI, getResponse, getResponseObject, getUniqueIdentifier, httpRedirection, isDoubleClickHandlerEnabled, isEnabled, preInvokeAjaxCommand, preInvokeCommand, processErrorResponse, processRequest, processRequest, processResponse, setAdapterDesc, setDefaultDeviceFormatId, setDeviceFormatClass, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId, setOrigReqName, 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.HttpAdapter

        getContextPath, getRequest, getRequestName, getRequestObject, getRequestProperties, getRequestURI, getResponse, getResponseObject, getUniqueIdentifier, isDoubleClickHandlerEnabled, preInvokeAjaxCommand, preInvokeCommand, processRequest, processRequest, setRequest, setRequestProperties, setResponse
      • Methods inherited from interface com.ibm.commerce.adapter.DeviceFormatAdapter

        getDefaultDeviceFormatId, getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDeviceFormatTypeId, processErrorResponse, processResponse, setDefaultDeviceFormatId, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId
      • Methods inherited from interface com.ibm.commerce.adapter.HttpAdapterFactory

        checkDeviceFormat
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.Integer STATUS_LOGON
        Value used in PVCSESSION to indicate that the PVC device user is logon status.
      • STATUS_LOGOFF

        public static final java.lang.Integer STATUS_LOGOFF
        Value used in PVCSESSION to indicate that the PVC device user is logoff status.
    • Constructor Detail

      • PVCAdapterImpl

        public PVCAdapterImpl()
    • Method Detail

      • createAdapter

        public com.ibm.commerce.adapter.HttpAdapter createAdapter(javax.servlet.http.HttpServletRequest req,
                                                                  javax.servlet.http.HttpServletResponse resp,
                                                                  TypedProperty prop)
        Checks to see if the HttpServletRequest data is in this device format.
        Specified by:
        createAdapter in interface com.ibm.commerce.adapter.HttpAdapterFactory
        Parameters:
        request - the HTTP request.
        response - the HTTP response.
        requestProperties - the request properties.
        Returns:
        null if the session can't be handled by the adapter; instance of the adapter otherwise
      • getAdapterDesc

        public com.ibm.commerce.adapter.HttpAdapterDesc getAdapterDesc()
        Return the descriptor of the adapter.
        Specified by:
        getAdapterDesc in interface com.ibm.commerce.adapter.HttpAdapter
        Specified by:
        getAdapterDesc in interface com.ibm.commerce.adapter.HttpAdapterFactory
        Specified by:
        getAdapterDesc in interface PVCAdapter
        Overrides:
        getAdapterDesc in class com.ibm.commerce.adapter.AbstractHttpAdapter
        Returns:
        The descriptor of the adapter.
      • getBufferTimeout

        public java.lang.Integer getBufferTimeout()
        Gets buffer timeout value applied to the adapter from XML configuration file.
        Specified by:
        getBufferTimeout in interface PVCAdapter
        Returns:
        The buffer timeout.
      • getDeviceModel

        public abstract java.lang.String getDeviceModel()
        Gets the model name from the request.
        Specified by:
        getDeviceModel in interface PVCAdapter
        Returns:
        The model name of the client's device
      • getDocumentPathName

        public java.lang.String getDocumentPathName(java.lang.String name)
        Gets the actual output document name based on a base document name. The method gets content directory from the adapter, if the adapter has its device specification in the PVCDEVSPEC table. If the adapter returns an object by getPVCSessionAccessBean(), the method inserts value of CONTENTDIR in the PVCDEVSPEC table in front of requested document path.
        Specified by:
        getDocumentPathName in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Overrides:
        getDocumentPathName in class com.ibm.commerce.adapter.AbstractHttpAdapter
        Parameters:
        base - the base document name.
        Returns:
        The actual document name.
      • getLogonTimeout

        public java.lang.Integer getLogonTimeout()
        Gets the timeout value applied for the adapter from XML configuration file.
        Specified by:
        getLogonTimeout in interface PVCAdapter
        Returns:
        The logon timeout value.
      • getPVCDeviceSpecAccessBean

        public PVCDeviceSpecAccessBean getPVCDeviceSpecAccessBean()
        Returns the access bean which contains spec information of the device.
        Specified by:
        getPVCDeviceSpecAccessBean in interface PVCAdapter
        Returns:
        null if no suitable record for the client's device is found in the PVCDEVSPEC table; Otherwise returns specification of the client's device.
      • getPVCSessionAccessBean

        public PVCSessionAccessBean getPVCSessionAccessBean()
        Returns the access bean which contains session information of the device.
        Specified by:
        getPVCSessionAccessBean in interface PVCAdapter
        Returns:
        The session information of the device
      • getPvcSessionId

        public java.lang.Long getPvcSessionId()
        Returns session identifier used for session control using the adapter.
        Specified by:
        getPvcSessionId in interface PVCAdapter
        Returns:
        The Session identifier.
      • getRegistrationMode

        public java.lang.String getRegistrationMode()
        Returns retgistrationMode of the adapter in XML configuration file.
        Specified by:
        getRegistrationMode in interface PVCAdapter
        Returns:
        The values return will be as follows:
        0: If the adapter doesn't need device registration to allow user to login using the device.
        1: If the adapter requires device registration to allow user to login using the device.
        2: If the adapter requires device registration to allow user to login using the device and relationship between user and device is restricted to 1 to 1.
      • getSessionContext

        public com.ibm.commerce.adapter.SessionContext getSessionContext()
                                                                  throws ECException
        Returns session context necessary for session control.
        Specified by:
        getSessionContext in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Returns:
        The session context.
        Throws:
        ECException - if there is a problem getting the session context.
      • getStoreId

        public java.lang.Integer getStoreId()
        Returns the store identifier in the request.
        Returns:
        The store identifier.
      • getTerminalId

        public abstract java.lang.String getTerminalId()
        Gets the terminal identifier sent by the wireless gateway.
        Specified by:
        getTerminalId in interface PVCAdapter
        Returns:
        The terminal identifier.
      • getUserPVCDeviceAccessBean

        public UserPVCDeviceAccessBean getUserPVCDeviceAccessBean()
        Returns access bean of the client's device information in USERPVCDEV table. If the user is a registered user and has no recorded in USERPVCDEV table, the method inserts a new record automatically.
        Returns:
        The user's device.
      • httpsRedirection

        public boolean httpsRedirection()
        Checks to see if the adapter can support HTTP to HTTPS redirection.
        Specified by:
        httpsRedirection in interface com.ibm.commerce.adapter.HttpAdapter
        Returns:
        Always true.
      • initFactory

        public void initFactory(org.w3c.dom.Element node)
                         throws java.lang.Exception
        Initialize the Adapter based on the information defined in the node. Basically creates a descriptor object and initial that with the given configuration.
        Specified by:
        initFactory in interface com.ibm.commerce.adapter.HttpAdapterFactory
        Overrides:
        initFactory in class com.ibm.commerce.adapter.AbstractHttpAdapter
        Parameters:
        node - the adapter configuration.
        Throws:
        java.lang.Exception - if there is a problem initializing.
      • isExcludeCommand

        public final boolean isExcludeCommand(java.lang.String value)
        Returns true if the named command is excluded for this adapter.
        Specified by:
        isExcludeCommand in interface PVCAdapter
        Parameters:
        name - the name of the command
        Returns:
        true if this command is excluded; false if this command is not excluded.
      • isRelogonCommand

        public final boolean isRelogonCommand(java.lang.String value)
                                       throws ECException
        Returns true if the named command required a relogon for this adapter.
        Specified by:
        isRelogonCommand in interface PVCAdapter
        Parameters:
        name - the name of the command
        Returns:
        true if this command requires a relogon; false if this command does not requires a relogon.
        Throws:
        ECException - whether there is a problem validating the logon.
      • postInvokeCommand

        public void postInvokeCommand(CommandContext commandContext)
                               throws ECException
        Does necessary processes after invoking command.
        Specified by:
        postInvokeCommand in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Parameters:
        commandContext - Context of the command
        Throws:
        ECException - will never happen because this method does nothing.
      • preInvokeCommand

        public boolean preInvokeCommand(CommandContext commandContext)
                                 throws ECException
        Does necessary process before invoking command.
        Specified by:
        preInvokeCommand in interface com.ibm.commerce.adapter.DeviceFormatAdapter
        Parameters:
        commandContext - Context of the command
        Returns:
        true if the method is executed successfully; false otherwise.
        Throws:
        ECException - if there is a problem with the pre-invoke.
      • preprocessRequest

        public com.ibm.commerce.webcontroller.HttpControllerRequestObject preprocessRequest()
        This method preprocess the request and return a controller request object.
        Specified by:
        preprocessRequest in interface com.ibm.commerce.adapter.HttpAdapter
        Overrides:
        preprocessRequest in class com.ibm.commerce.adapter.AbstractHttpAdapter
      • setDeviceModel

        public final void setDeviceModel(java.lang.String value)
        Sets the model name of the device.
        Specified by:
        setDeviceModel in interface PVCAdapter
        Parameters:
        value - the model name.
      • setPVCAdapterDesc

        public final void setPVCAdapterDesc(PVCAdapterDesc value)
        Sets the descriptor of the PVCAdapter.
        Specified by:
        setPVCAdapterDesc in interface PVCAdapter
        Parameters:
        val - the descriptor of the PVCAdapter
      • setPvcSessionId

        public void setPvcSessionId(java.lang.Long newPvcSessionId)
        Sets the session identifier necessary for session control using PvC adapter.
        Specified by:
        setPvcSessionId in interface PVCAdapter
        Parameters:
        newPvcSessionId - the session identifier.
      • setStoreId

        public void setStoreId(java.lang.Integer storeId)
        Sets the store identifier to the adapter.
        Specified by:
        setStoreId in interface PVCAdapter
        Parameters:
        storeId - the store identifier.
      • setTerminalId

        public final void setTerminalId(java.lang.String value)
        Sets the terminal identifier sent by the carrier to the adapter.
        Specified by:
        setTerminalId in interface PVCAdapter
        Parameters:
        value - the terminal identifier.
      • userHasTimedout

        public boolean userHasTimedout()
        This method checks to see if a PvC user has timed out.
        Specified by:
        userHasTimedout in interface PVCAdapter
        Returns:
        true if a user has timed out; otherwise false.