com.free2be.dimensions.device
Class SessionDeviceFactory

java.lang.Object
  extended by com.free2be.dimensions.device.DeviceFactory
      extended by com.free2be.dimensions.device.SessionDeviceFactory
All Implemented Interfaces:
PersistentDeviceFactory

public class SessionDeviceFactory
extends DeviceFactory
implements PersistentDeviceFactory

Simply used to check for persistant devices in the session that have already been built.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.free2be.dimensions.device.DeviceFactory
DeviceFactory.ConfidenceLevel
 
Field Summary
static java.lang.String DEVICE_KEY
          A constant referring to the key which the channel is stored in the session.
 
Fields inherited from class com.free2be.dimensions.device.DeviceFactory
CONTENT, DEFAULT, DEVICE, MINIMUM_LEVEL_FOR_FINAL, MODEL, NONE, OVERRIDE, PRE_DETERMINED, STANDARD
 
Constructor Summary
SessionDeviceFactory()
           
 
Method Summary
protected  void assignDevice(Device device, java.lang.Object informationSource)
           
 void clearDevice(java.lang.Object informationSource)
          Remove the device from the session.
 DeviceFactory.ConfidenceLevel getConfidenceLevel()
          Retrieves the confidence level this factory has in fulfilling the request based on the information provided during intialization.
 Device getDevice()
          Retrieves a device to represent the calling client's device.
 DeviceFactory.ConfidenceLevel getHighestConfidenceLevel()
          Returns the highest confidence level the implementing device factory can provide.
protected  void initialize(java.lang.Object informationSource)
          initalizes a factory after default construction giving some object as the source of information to determine confidence and build devices.
 void notifyOfBestDevice(Device bestDevice, java.lang.Object informationSource)
          Used to notify any persistent device factories of the best device chosen.
 
Methods inherited from class com.free2be.dimensions.device.DeviceFactory
clearPersistantDevice, getDeviceFactory, getFactories, getPersistentFactories
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEVICE_KEY

public static final java.lang.String DEVICE_KEY
A constant referring to the key which the channel is stored in the session. The value is the name of the Channel class and may be accessed from the session directly.

See Also:
Constant Field Values
Constructor Detail

SessionDeviceFactory

public SessionDeviceFactory()
Method Detail

getDevice

public Device getDevice()
Retrieves a device to represent the calling client's device.

Specified by:
getDevice in class DeviceFactory

getConfidenceLevel

public DeviceFactory.ConfidenceLevel getConfidenceLevel()
Retrieves the confidence level this factory has in fulfilling the request based on the information provided during intialization.

Specified by:
getConfidenceLevel in class DeviceFactory

getHighestConfidenceLevel

public DeviceFactory.ConfidenceLevel getHighestConfidenceLevel()
Returns the highest confidence level the implementing device factory can provide. This method should be considered a static method and return a value upon empty construction.

Specified by:
getHighestConfidenceLevel in class DeviceFactory

initialize

protected void initialize(java.lang.Object informationSource)
initalizes a factory after default construction giving some object as the source of information to determine confidence and build devices. The majority of the work should be done during this method since this is the method that should determine the actual confidence of building a device. No exception should ever be thrown from this. Any internal exceptions should simply return a confidence level of NONE when asked.

Specified by:
initialize in class DeviceFactory
Parameters:
informationSource - any object that a factory may use to determine device (usually javax.servlet.HttpServletRequest).

notifyOfBestDevice

public void notifyOfBestDevice(Device bestDevice,
                               java.lang.Object informationSource)
Description copied from interface: PersistentDeviceFactory
Used to notify any persistent device factories of the best device chosen. The information source is given since that may lead to the knowledge or facilities to persist the device.

Specified by:
notifyOfBestDevice in interface PersistentDeviceFactory

clearDevice

public void clearDevice(java.lang.Object informationSource)
Remove the device from the session.

Specified by:
clearDevice in interface PersistentDeviceFactory

assignDevice

protected void assignDevice(Device device,
                            java.lang.Object informationSource)