public final class DeviceRegistry extends java.lang.Object implements IOperation
| Modifier and Type | Field and Description |
|---|---|
static int |
EVENT_DEVICE_ADDED
The event constant used to signal that a remote device has been added.
|
static int |
EVENT_DEVICE_REMOVED
The event constant used to signal that a remote device has been removed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDeviceListener(int type,
IListener listener)
Adds a device listener to this device registry.
|
boolean |
containsDevice(SystemID id)
Determines whether the specified device is currently contained in the
set of devices.
|
DeviceDescription |
getDeviceDescription(SystemID id)
Returns the device description of the system with the specified id.
|
SystemID[] |
getDevices()
Returns an array of system id that has been discovered recently.
|
SystemID[] |
getDevices(ObjectID oid)
Returns an array of system ids that have been discovered recently
and that contain the specified well known service.
|
SystemID[] |
getDevices(ObjectID[] ids)
Returns an array of system ids that consists of systems that contain
the specified well known services.
|
PluginDescription[] |
getPluginDescriptions(SystemID systemID)
Returns a set of plug-in descriptions which have been registered for
a given system.
|
PluginDescription[] |
getPluginDescriptions(SystemID source,
SystemID target)
Returns the plug-in descriptions of the target system that are compatible
with the source system.
|
SystemID[] |
getRemoteDevices()
Returns an array of remote system id that has been discovered
recently.
|
SystemID[] |
getRemoteDevices(ObjectID oid)
Returns an array of remote system ids that have been discovered
recently and that contain the specified well known service.
|
SystemID[] |
getRemoteDevices(ObjectID[] ids)
Returns an array of remote system ids that consists of systems that
contain the specified well known services.
|
void |
perform(IMonitor monitor)
This operation continuously removes the devices and plug-ins from the
registry whose ttl has been run out.
|
void |
registerDevice(DeviceDescription device)
Registers the specified device description.
|
void |
registerDevice(DeviceDescription device,
long ttl)
Registers a device description that has been discovered from a remote device.
|
void |
registerPlugin(SystemID id,
PluginDescription plugin)
Registers the specified plug-in description of the specified device.
|
void |
registerPlugin(SystemID id,
PluginDescription plugin,
long ttl)
Registers the specified plug-in description of the specified device.
|
void |
removeDevice(SystemID id)
Removes the device description of the specified system from the list
of permanently registered device descriptions.
|
boolean |
removeDeviceListener(int type,
IListener listener)
Removes a device listener from this registry.
|
void |
removePlugin(SystemID id,
PluginDescription plugin)
Removes the specified plug-in from the set of permanently registered
plug-ins.
|
public static final int EVENT_DEVICE_ADDED
public static final int EVENT_DEVICE_REMOVED
public void addDeviceListener(int type,
IListener listener)
type - The types of events to register. Multiple types can
be added by concatenation.listener - The listener to register.public boolean removeDeviceListener(int type,
IListener listener)
type - The types of events to unregister.listener - The listener to unregister.public void registerDevice(DeviceDescription device, long ttl)
device - The device description of the device that announced the
descriptions.ttl - The time to live.public void registerDevice(DeviceDescription device)
device - The device description to register.public void removeDevice(SystemID id)
id - The id of the device to remove.public boolean containsDevice(SystemID id)
id - The system id of the device to lookup.public SystemID[] getDevices()
public SystemID[] getDevices(ObjectID oid)
oid - The well known object id to lookup.public SystemID[] getDevices(ObjectID[] ids)
ids - An array of ids to lookup.public SystemID[] getRemoteDevices()
public SystemID[] getRemoteDevices(ObjectID oid)
oid - The well known object id to lookup.public SystemID[] getRemoteDevices(ObjectID[] ids)
ids - An array of ids to lookup.public DeviceDescription getDeviceDescription(SystemID id)
id - The system id of the device description to lookup.public void registerPlugin(SystemID id, PluginDescription plugin, long ttl)
id - The id of the device.plugin - The plug-in description to register.ttl - The time to live.public void registerPlugin(SystemID id, PluginDescription plugin)
id - The system id of the plug-in to register.plugin - The plug-in description to register.public void removePlugin(SystemID id, PluginDescription plugin)
id - The id of the system.plugin - The plug-in description to remove.public PluginDescription[] getPluginDescriptions(SystemID source, SystemID target)
source - The system id of the source system.target - The system id of the target system.public PluginDescription[] getPluginDescriptions(SystemID systemID)
systemID - The system id of the system to lookup.public void perform(IMonitor monitor) throws java.lang.Exception
perform in interface IOperationmonitor - The monitor used to cancel the operation.java.lang.Exception - Should never happen.