com.ibm.commerce.adapter
Class DeviceFormatManager

java.lang.Object
  |
  +--com.ibm.commerce.adapter.DeviceFormatManager

public class DeviceFormatManager
extends java.lang.Object

This is an internal class responsible for initialization of all device format adapters and for returning the correct adapter to handle an incoming request


Constructor Summary
DeviceFormatManager()
          HttpDeviceFormatManager constructor.
 
Method Summary
protected  void addAdapterFactory(java.lang.String name, HttpAdapterFactory factory)
          This methods adds a new adapter factory to the list of adapters to be handled
 void addAdapterFactoryNode(java.lang.String name, com.ibm.commerce.adapter.Element node)
          This methods handle the adding of a new adapter factory node to the list of adapters to be handled.
 boolean deviceEnabled()
          Returns true if this device format adapter is enabled.
 HttpAdapterFactory getAdapterFactory(java.lang.String name)
          Returns the factory for an adapter given a adapter name.
 HttpAdapter getDeviceFormatAdapter(com.ibm.commerce.adapter.HttpServletRequest req, com.ibm.commerce.adapter.HttpServletResponse resp)
          Returns an instance of an adapter that will handle this request.
 void initialize()
          This method initialize the HttpDeviceFormatAdapter.
 void initializeAdapterFactory(com.ibm.commerce.adapter.Element node)
          This method initialized an adapter factory based on dom node that defines an adapter.
static DeviceFormatManager singleton()
          Returns a singleton object of a DeviceFormatManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceFormatManager

public DeviceFormatManager()
HttpDeviceFormatManager constructor.
Method Detail

addAdapterFactory

protected void addAdapterFactory(java.lang.String name,
                                 HttpAdapterFactory factory)
This methods adds a new adapter factory to the list of adapters to be handled

addAdapterFactoryNode

public void addAdapterFactoryNode(java.lang.String name,
                                  com.ibm.commerce.adapter.Element node)
This methods handle the adding of a new adapter factory node to the list of adapters to be handled.

Parameters:
name - String - name of adapter
node - Element - a dom node that describes this new adapter

deviceEnabled

public boolean deviceEnabled()
Returns true if this device format adapter is enabled. It returns false otherwise.

Returns:
boolean

getAdapterFactory

public HttpAdapterFactory getAdapterFactory(java.lang.String name)
Returns the factory for an adapter given a adapter name.

Returns:
HttpAdapterFactory - an instance of the factory

getDeviceFormatAdapter

public HttpAdapter getDeviceFormatAdapter(com.ibm.commerce.adapter.HttpServletRequest req,
                                          com.ibm.commerce.adapter.HttpServletResponse resp)
                                   throws ECException
Returns an instance of an adapter that will handle this request.

Parameters:
req - HttpServletRequest - the request to be handled
res - HttpServletResponse - the response object
Returns:
HttpAdapter - an instance of an Http adapter

initialize

public void initialize()
                throws java.lang.Exception
This method initialize the HttpDeviceFormatAdapter. The HttpDeviceFormatManager initializes itself by reading in the HttpAdapter node defines in the configuration xml file.

Throws:
java.lang.Exception - The exception description.

initializeAdapterFactory

public void initializeAdapterFactory(com.ibm.commerce.adapter.Element node)
                              throws java.lang.Exception
This method initialized an adapter factory based on dom node that defines an adapter.

Parameters:
node - Element

singleton

public static DeviceFormatManager singleton()
Returns a singleton object of a DeviceFormatManager.