public class DeviceDriverFactory extends Object implements DeviceDriverBroker
DeviceInfo
, DeviceHandler
and DeviceLoader
instances,
by delegation to pre-registered providers.Constructor and Description |
---|
DeviceDriverFactory() |
Modifier and Type | Method and Description |
---|---|
void |
addProvider(DeviceDriverProvider provider)
Adds the given provider to the collection of providers tracked by this broker.
|
DeviceHandler |
create(DeviceInfo info,
IpAddress ip)
Creates an instance of DeviceHandler, bound to the specified device target, and associated with
the specified instance of DeviceInfo.
|
DeviceLoader |
create(DeviceInfo info,
String uid)
Creates an instance of DeviceLoader, bound to the specified device UID, and associated with
the specified instance of DeviceInfo.
|
DeviceInfo |
create(String typeName)
Creates an instance of DeviceInfo backed by the specified device type and void of any specific device
information.
|
DeviceHandler |
create(String typeName,
IpAddress ip)
Creates an instance of DeviceHandler, bound to the specified device target, and associated with
a new instance of DeviceInfo backed by the specified device type and void of any specific device information.
|
DeviceLoader |
create(String typeName,
String uid)
Creates an instance of DeviceLoader, bound to the specified device UID, and associated with
a new instance of DeviceInfo backed by the specified device type.
|
Set<String> |
getDeviceTypeNames()
Returns a set of device type names for which this provider can create instances of
DeviceInfo , DeviceHandler and DeviceLoader . |
DeviceDriverProvider |
getProvider(String typeName)
Returns a reference to the provider associated with the specified device type.
|
void |
removeProvider(DeviceDriverProvider provider)
Removes the given provider from the collection tracked by this broker.
|
void |
switchType(MutableDeviceInfo mutableDeviceInfo,
String typeName)
Given a device info instance and a type name, replace the backing device type in that instance,
with the named device type.
|
String |
toString() |
public void addProvider(DeviceDriverProvider provider)
DeviceDriverBroker
addProvider
in interface DeviceDriverBroker
provider
- the provider to addpublic void removeProvider(DeviceDriverProvider provider)
DeviceDriverBroker
removeProvider
in interface DeviceDriverBroker
provider
- the provider to removepublic DeviceDriverProvider getProvider(String typeName)
DeviceDriverBroker
getProvider
in interface DeviceDriverBroker
typeName
- the device type namepublic Set<String> getDeviceTypeNames()
DeviceDriverProvider
DeviceInfo
, DeviceHandler
and DeviceLoader
.getDeviceTypeNames
in interface DeviceDriverProvider
public DeviceInfo create(String typeName)
DeviceDriverProvider
create
in interface DeviceDriverProvider
typeName
- the name of the required device typepublic void switchType(MutableDeviceInfo mutableDeviceInfo, String typeName)
DeviceDriverProvider
switchType
in interface DeviceDriverProvider
mutableDeviceInfo
- the device info to be adjustedtypeName
- the name of the replacement device typepublic DeviceHandler create(String typeName, IpAddress ip)
DeviceDriverProvider
create
in interface DeviceDriverProvider
typeName
- the name of the required device typeip
- the device IP addresspublic DeviceHandler create(DeviceInfo info, IpAddress ip)
DeviceDriverProvider
create
in interface DeviceDriverProvider
info
- the device info instanceip
- the device IP addresspublic DeviceLoader create(String typeName, String uid)
DeviceDriverProvider
create
in interface DeviceDriverProvider
typeName
- the name of the required device typeuid
- the key by which the set of information describing the device can be looked up
in the persistence storepublic DeviceLoader create(DeviceInfo info, String uid)
DeviceDriverProvider
create
in interface DeviceDriverProvider
info
- the device info instanceuid
- the key by which the set of information describing the device can be looked up
in the persistence storeCopyright © 2015. All Rights Reserved.