javapns.devices.implementations.basic
Class BasicDeviceFactory

java.lang.Object
  extended by javapns.devices.implementations.basic.BasicDeviceFactory
All Implemented Interfaces:
DeviceFactory

Deprecated.

@Deprecated
public class BasicDeviceFactory
extends Object
implements DeviceFactory

This class implements an in-memory DeviceFactory (backed by a Map). Since this class does not persist Device objects, it should not be used in a production environment. NB : Future Improvement : - Add a method to find a device knowing his token - Add a method to update a device (timestamp or token) - method to compare two devices, and replace when the device token has changed

Author:
Maxime Peron

Constructor Summary
BasicDeviceFactory()
          Deprecated. Constructs a VolatileDeviceFactory
 
Method Summary
 Device addDevice(String id, String token)
          Deprecated. Add a device to the map
 Device getDevice(String id)
          Deprecated. Get a device according to his id
 void removeDevice(String id)
          Deprecated. Remove a device
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDeviceFactory

public BasicDeviceFactory()
Deprecated. 
Constructs a VolatileDeviceFactory

Method Detail

addDevice

public Device addDevice(String id,
                        String token)
                 throws DuplicateDeviceException,
                        NullIdException,
                        NullDeviceTokenException,
                        Exception
Deprecated. 
Add a device to the map

Specified by:
addDevice in interface DeviceFactory
Parameters:
id - The device id
token - The device token
Returns:
The device created
Throws:
DuplicateDeviceException
NullIdException
NullDeviceTokenException
Exception

getDevice

public Device getDevice(String id)
                 throws UnknownDeviceException,
                        NullIdException
Deprecated. 
Get a device according to his id

Specified by:
getDevice in interface DeviceFactory
Parameters:
id - The device id
Returns:
The device
Throws:
UnknownDeviceException
NullIdException

removeDevice

public void removeDevice(String id)
                  throws UnknownDeviceException,
                         NullIdException
Deprecated. 
Remove a device

Specified by:
removeDevice in interface DeviceFactory
Parameters:
id - The device id
Throws:
UnknownDeviceException
NullIdException