Milyn-Tinak Version 0.6.1

org.milyn.device.ident
Class DeviceIdent

java.lang.Object
  extended byorg.milyn.device.ident.DeviceIdent

public final class DeviceIdent
extends java.lang.Object

Device identification class.

This class is used by adding IdentSet instances, preparing it for device matching through a call to prepare() and then using it through calls to the matchDevice(org.milyn.device.request.Request) method.

Author:
tfennelly

Constructor Summary
DeviceIdent()
           
 
Method Summary
 void addIdentSet(IdentSet identSet)
          Add a device identification set to this DeviceIdent object.
 java.lang.String[] getDeviceNames()
          Get the name list of matchable devices.
static DeviceIdent getInstance()
          Get the DeviceIdent instance for the VM.
 java.lang.String matchDevice(Request request)
          Match the device associated with the supplied request instance.
 void prepare()
          Prepare the DeviceIdent object for device matching.
static void setInstance(DeviceIdent deviceIdent)
          Set the DeviceIdent instance for the VM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceIdent

public DeviceIdent()
Method Detail

setInstance

public static void setInstance(DeviceIdent deviceIdent)
Set the DeviceIdent instance for the VM.

This method blocks all future calls to addIdentSet(org.milyn.device.ident.IdentSet) or prepare() throwing an IllegalStateException.

Parameters:
deviceIdent - The DeviceIdent instance for the VM.

getInstance

public static DeviceIdent getInstance()
Get the DeviceIdent instance for the VM.

Returns:
The DeviceIdent instance.

addIdentSet

public void addIdentSet(IdentSet identSet)
Add a device identification set to this DeviceIdent object.

All IdentSet instances must be added before the DeviceIdent instance is prepared through a call to the prepare() method.

Parameters:
identSet - Device identification set to be added.

prepare

public void prepare()
Prepare the DeviceIdent object for device matching.

This method must be called before attempting to perform any match operations.


matchDevice

public java.lang.String matchDevice(Request request)
                             throws UnknownDeviceException
Match the device associated with the supplied request instance.

Parameters:
request - The device request to be used to identify the requesting device.
Returns:
The name of the requesting device.
Throws:
UnknownDeviceException - Device cannot be matched from the supplied request.

getDeviceNames

public java.lang.String[] getDeviceNames()
Get the name list of matchable devices.

Returns:
List of matchable device names.

Milyn-Tinak Version 0.6.1