public abstract class AbstractDeviceDriverProvider extends Object implements DeviceDriverProvider
Constructor and Description |
---|
AbstractDeviceDriverProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
addType(DefaultDeviceType type)
Convenience method that calls
addType(String, DefaultDeviceType) using the
type name returned from the type. |
protected void |
addType(String typeName,
DefaultDeviceType type)
Adds the specified device type to the type bindings under the given name.
|
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.
|
int |
getBindingsCount()
Returns the number of entries in the type bindings map
|
protected DefaultDeviceType |
getDeviceType(String typeName)
Gets the device type for the specified name, or null if no such binding exists.
|
Set<String> |
getDeviceTypeNames()
Returns a set of device type names for which this provider can create instances of
DeviceInfo , DeviceHandler and DeviceLoader . |
int |
getTypesCount()
Returns the number of different types in the bindings map
|
protected void |
removeType(DefaultDeviceType type)
Removes the specified device type and all its name bindings.
|
void |
switchType(MutableDeviceInfo mutableDeviceInfo,
String newTypeName)
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 Set<String> getDeviceTypeNames()
DeviceDriverProvider
DeviceInfo
, DeviceHandler
and DeviceLoader
.getDeviceTypeNames
in interface DeviceDriverProvider
protected void addType(String typeName, DefaultDeviceType type)
typeName
- device type name or alias (binding key)type
- device type instanceIllegalArgumentException
- if the provider declared by the type is not this providerIllegalStateException
- if a binding already exists for the given type nameprotected void addType(DefaultDeviceType type)
addType(String, DefaultDeviceType)
using the
type name returned from the type.type
- device type instance to addprotected void removeType(DefaultDeviceType type)
type
- device type instance to removeIllegalStateException
- if attempting to remove a type for which there is no bindingprotected DefaultDeviceType getDeviceType(String typeName)
typeName
- requested device type namepublic int getBindingsCount()
public int getTypesCount()
public DeviceInfo create(String typeName)
DeviceDriverProvider
create
in interface DeviceDriverProvider
typeName
- the name of the required 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 storepublic void switchType(MutableDeviceInfo mutableDeviceInfo, String newTypeName)
This implementation checks that the given type name exists in the type bindings, and switches the type if it does. If the type is not bound, then an exception is thrown.
switchType
in interface DeviceDriverProvider
mutableDeviceInfo
- the device info to be adjustednewTypeName
- the name of the replacement device typeIllegalStateException
- if the specified type is not bound in this providerCopyright © 2016. All Rights Reserved.