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 will be added to
the registry in order to have them available to MTJ clients.
Clients may access the IDeviceRegistry implementation through the
MTJCore.getDeviceRegistry()
method.
-
Since:
- 1.0
-
See Also:
-
IDevice
,
IPreverifier
-
Restriction:
- This interface is not intended to be implemented by clients.
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)
- Adds the listener to the collection of listeners who will be notified
when the registry state changes. The listener is notified by invoking one
of methods defined in the
IDeviceRegistryListener
interface.
-
-
-
Parameters:
-
listener
- the listener that should be notified when the registry
state changes.
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 the list of all of the devices in the registry.
-
-
-
Returns:
- the list of all of the devices in the registry or an empty list
if no device is registered.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load
getDefaultDevice
IDevice getDefaultDevice()
- Return the device set as the default.
-
-
-
Returns:
- the device set as the default or
null
if none was
not specified.
getDefaultPreferifier
IPreverifier getDefaultPreferifier()
- Return the default preverifier to be used if no preverifier was available
in a given device.
-
-
-
Returns:
- the default preverifier or
null
if none was
specified.
getDevice
IDevice getDevice(
String sdkName,
String deviceName)
throws
PersistenceException
- Return the device from a given SDK with the specified name.
-
-
-
Parameters:
-
sdkName
- the SDK name. -
deviceName
- the device name.
-
Returns:
- the device from a given SDK with the specified name or
null
if no such device is found in the registry.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load.
getDeviceCount
int getDeviceCount()
throws
PersistenceException
- Return the number of the registered devices.
-
-
-
Returns:
- the number of the registered devices.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load.
getSDKNames
List<
String> getSDKNames()
throws
PersistenceException
- Return the list of identifiers of all registered SDKs.
-
-
-
Returns:
- the list of identifiers of all registered SDKs.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load.
getDevices
List<
IDevice> getDevices(
String sdkName)
throws
PersistenceException
- Return the list of devices associated to the given SDK name.
-
-
-
Parameters:
-
sdkName
- the SDK name.
-
Returns:
- the list of devices associated to the given SDK name or
null
if the specified group cannot be found.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load.
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
- if there is a problem doing the initial
registry load.
removeDevice
void removeDevice(
IDevice device)
throws
PersistenceException
- Remove the specified device from the registry if it exists.
-
-
-
Parameters:
-
device
- the device to be removed from the registry.
-
Throws:
-
PersistenceException
- if there is a problem doing the initial
registry load
removeRegistryListener
void removeRegistryListener(
IDeviceRegistryListener listener)
- Removes the listener from the collection of listeners who will be
notified when the registry state changes.
-
-
-
Parameters:
-
listener
- the listener that should no longer be notified when the
registry state changes.
setDefaultDevice
void setDefaultDevice(
IDevice device)
- Set the default device.
-
-
-
Parameters:
-
device
- the device to be set as default.
setDefaultPreverifer
void setDefaultPreverifer(
IPreverifier preverifier)
- Set the default preverifier.
-
-
-
Parameters:
-
preverifier
- the default preverifier.
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
- if any error occur while saving the
persistable information.
-
TransformerException
- if any error occur while saving the
persistable information.
-
IOException
- if any error occur while saving the persistable
information.