Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.sdk.device
Interface IDeviceRegistry

All Superinterfaces:
IPersistable

public interface IDeviceRegistry
extends IPersistable

The device registry is the main entry point that is used to manage the devices that are currently supported on a MTJ installation. When a SDK is imported it will return a list of devices that must be added to the registry in order to have them available to MTJ.

Since:
1.0
See Also:
IDevice, IPreverifier
Restriction:
This interface is not intended to be implemented by clients.

Method Summary
 void addDevice(IDevice device)
          Add a new device instance to the device registry.
 void addRegistryListener(IDeviceRegistryListener listener)
          Add the specified listener to the list of listeners for changes in this registry.
 void clear()
          Clear the registry of all entries.
 void enableDeviceAddedEvent(boolean fire)
          Enable the DeviceAdded Event to be fired to all IDeviceRegistryListener instances registered using addRegistryListener(IDeviceRegistryListener) when the addDevice(IDevice) is invoked.
 List<IDevice> getAllDevices()
          Return a list of all of the devices in the registry.
 IDevice getDefaultDevice()
          Return the default device or null if one is not specified.
 IPreverifier getDefaultPreferifier()
          Return the default preverifier or null if one is not specified.
 IDevice getDevice(String groupName, String deviceName)
          Return the device with the specified key or null if no such device is found in the registry.
 int getDeviceCount()
          Return the number of devices registered.
 List<String> getDeviceGroups()
          Return the registered device groups.
 List<IDevice> getDevices(String groupName)
          Return the devices found in the specified group or null if the specified group cannot be found.
 boolean isDeviceAddedEventEnabled()
          Checks if the DeviceAdded Event will be fired to all IDeviceRegistryListener instances registered using addRegistryListener(IDeviceRegistryListener) or not when invoking addDevice(IDevice).
 void load()
          Load the contents of the device registry from the storage file in the plug-in state location.
 void removeDevice(IDevice device)
          Remove the specified device from the registry if it exists.
 void removeRegistryListener(IDeviceRegistryListener listener)
          Remove the specified listener to the list of listeners for changes in this registry.
 void setDefaultDevice(IDevice device)
          Set the default device.
 void setDefaultPreverifer(IPreverifier preverifier)
          Set the default preverifier.
 void store()
          Store out the contents of the registry into the standard device storage file in the plug-in state location.
 
Methods inherited from interface org.eclipse.mtj.core.persistence.IPersistable
loadUsing, storeUsing
 

Method Detail

addDevice

void addDevice(IDevice device)
               throws IllegalArgumentException,
                      PersistenceException
Add a new device instance to the device registry.

Parameters:
device - the device instance to be added to the device registry.
Throws:
IllegalArgumentException - if the device is not well formed.
PersistenceException - if there is a problem doing the initial registry load

addRegistryListener

void addRegistryListener(IDeviceRegistryListener listener)
Add the specified listener to the list of listeners for changes in this registry.

Parameters:
listener -

clear

void clear()
           throws PersistenceException
Clear the registry of all entries.

Throws:
PersistenceException - if there is a problem doing the initial registry load

enableDeviceAddedEvent

void enableDeviceAddedEvent(boolean fire)
Enable the DeviceAdded Event to be fired to all IDeviceRegistryListener instances registered using addRegistryListener(IDeviceRegistryListener) when the addDevice(IDevice) is invoked.

By default, this event is enabled. Use the isDeviceAddedEventEnabled() to get current event firing status.

Parameters:
fire - flag indicating if the DeviceAdded Event should be fired or not.

getAllDevices

List<IDevice> getAllDevices()
                            throws PersistenceException
Return a list of all of the devices in the registry.

Returns:
Throws:
PersistenceException - if there is a problem doing the initial registry load

getDefaultDevice

IDevice getDefaultDevice()
Return the default device or null if one is not specified.

Returns:

getDefaultPreferifier

IPreverifier getDefaultPreferifier()
Return the default preverifier or null if one is not specified.

Returns:

getDevice

IDevice getDevice(String groupName,
                  String deviceName)
                  throws PersistenceException
Return the device with the specified key or null if no such device is found in the registry.

Parameters:
groupName -
deviceName -
Returns:
Throws:
PersistenceException - if there is a problem doing the initial registry load

getDeviceCount

int getDeviceCount()
                   throws PersistenceException
Return the number of devices registered.

Returns:
Throws:
PersistenceException - if there is a problem doing the initial registry load

getDeviceGroups

List<String> getDeviceGroups()
                             throws PersistenceException
Return the registered device groups.

Returns:
Throws:
PersistenceException - if there is a problem doing the initial registry load

getDevices

List<IDevice> getDevices(String groupName)
                         throws PersistenceException
Return the devices found in the specified group or null if the specified group cannot be found.

Parameters:
groupName -
Returns:
Throws:
PersistenceException

isDeviceAddedEventEnabled

boolean isDeviceAddedEventEnabled()
Checks if the DeviceAdded Event will be fired to all IDeviceRegistryListener instances registered using addRegistryListener(IDeviceRegistryListener) or not when invoking addDevice(IDevice).

Returns:
true is DeviceAdded Event will be fired when addDevice(IDevice) is invoked, false otherwise.

load

void load()
          throws PersistenceException
Load the contents of the device registry from the storage file in the plug-in state location.

Throws:
PersistenceException

removeDevice

void removeDevice(IDevice device)
                  throws PersistenceException
Remove the specified device from the registry if it exists.

Parameters:
device -
Throws:
PersistenceException - if there is a problem doing the initial registry load

removeRegistryListener

void removeRegistryListener(IDeviceRegistryListener listener)
Remove the specified listener to the list of listeners for changes in this registry.

Parameters:
listener -

setDefaultDevice

void setDefaultDevice(IDevice device)
Set the default device.

Parameters:
device -

setDefaultPreverifer

void setDefaultPreverifer(IPreverifier preverifier)
Set the default preverifier.

Parameters:
device -

store

void store()
           throws PersistenceException,
                  TransformerException,
                  IOException
Store out the contents of the registry into the standard device storage file in the plug-in state location.

Throws:
PersistenceException
TransformerException
IOException

Mobile Tools for Java
Release 1.0