public class DefaultDeviceType extends Object implements DeviceType
device type
implementation, which allows
assembly of device driver using off-the-shelf facet implementations via
XML-encoded resources and/or files.Modifier | Constructor and Description |
---|---|
protected |
DefaultDeviceType(DefaultDeviceType type)
Copy constructor
|
|
DefaultDeviceType(DeviceDriverProvider provider,
DefaultDeviceType parentType,
String typeName,
String vendor,
String family,
String product,
String model,
Set<String> oids,
String fw,
String typeData,
String instanceData,
com.hp.device.PresentationResources presRes,
Map<Class<? extends Facet>,Class<? extends AbstractFacet>> facetBindings,
Set<String> flags,
Class<? extends DeviceHandler> handlerClass,
Class<? extends DeviceLoader> loaderClass,
String description,
String origin)
Creates a base device type associated with the given originating
provider.
|
protected |
DefaultDeviceType(DeviceDriverProvider provider,
String typeName)
Convenience constructor for unit tests that produces a device type that has a name and nothing else.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBinding(Class<? extends Facet> facetClass,
Class<? extends AbstractFacet> facetImplementationClass)
Allows subclasses to register a facet implementation binding.
|
boolean |
addChild(DeviceType child)
Adds a device type as a direct child of this device type.
|
DeviceHandler |
createHandler(DeviceInfo info,
IpAddress ip)
Return a device handler appropriate for this device type.
|
DeviceLoader |
createLoader(DeviceInfo info,
String uid)
Return a device handler appropriate for this device type.
|
DeviceInfo |
evolve(DeviceInfo deviceInfo)
Return an evolved device info context.
|
Set<? extends DeviceType> |
getChildTypes()
Returns the device types that extend this device type directly.
|
String |
getDescription()
Returns the description of this device type.
|
protected Map<Class<? extends Facet>,Class<? extends AbstractFacet>> |
getFacetBindings(boolean isHandler)
Gets a read-only map of the facet bindings.
|
String |
getFamily()
Returns the product family to which this device type belongs.
|
Set<String> |
getFlags()
Returns a view of our set of flags.
|
String |
getFw()
Returns the firmware version qualifier.
|
String |
getInstanceData()
Returns the instance data to be stamped onto newly created DeviceInfo instances.
|
String |
getModel()
Gets the model number associated with this type belongs.
|
Set<String> |
getOids()
Returns a view of our set of OIDs.
|
String |
getOrigin()
Returns the origin of this device type (i.e.
|
DeviceType |
getParentType()
Returns the device type that this type extends (or null if no parent).
|
com.hp.device.PresentationResources |
getPresentationResources()
Returns the presentation resources associated with this type.
|
String |
getProduct()
Returns the product number associated with this device type.
|
DeviceDriverProvider |
getProvider()
Returns the provider instance that created this device type.
|
String |
getTypeData()
Returns the meta data associated with the type.
|
String |
getTypeName()
Returns the name of this device type.
|
String |
getVendor()
Returns the vendor of the device represented by this type.
|
protected void |
removeBinding(Class<? extends Facet> facetClass)
Allows subclasses to unregister a facet implementation binding.
|
boolean |
removeChild(DeviceType child)
Removes a device type from the list of direct children for this type.
|
String |
toDebugString()
Produce multi-line debug output for this type instance.
|
String |
toDebugString(int indent)
Produce multi-line debug output for this type instance.
|
String |
toShortDebugString() |
String |
toString() |
public DefaultDeviceType(DeviceDriverProvider provider, DefaultDeviceType parentType, String typeName, String vendor, String family, String product, String model, Set<String> oids, String fw, String typeData, String instanceData, com.hp.device.PresentationResources presRes, Map<Class<? extends Facet>,Class<? extends AbstractFacet>> facetBindings, Set<String> flags, Class<? extends DeviceHandler> handlerClass, Class<? extends DeviceLoader> loaderClass, String description, String origin)
provider
- device info provider from whence we comeparentType
- parent type that we extendtypeName
- device type namevendor
- the vendorfamily
- the product familyproduct
- product number stringmodel
- model number stringoids
- the set of OIDsfw
- firmware versiontypeData
- optional device type meta datainstanceData
- optional device info initialization (via importData())presRes
- presentation resources (images)facetBindings
- map of facet bindings supported by the device typeflags
- a set of flags for this device typehandlerClass
- class of the device handlerloaderClass
- class of the device loaderdescription
- a description for this device typeorigin
- the origin of this device typeprotected DefaultDeviceType(DefaultDeviceType type)
type
- device type to copyprotected DefaultDeviceType(DeviceDriverProvider provider, String typeName)
provider
- the provider of this typetypeName
- the type namepublic String getTypeName()
DeviceType
getTypeName
in interface DeviceType
public String getDescription()
DeviceType
getDescription
in interface DeviceType
public String getOrigin()
DeviceType
getOrigin
in interface DeviceType
public String getProduct()
DeviceType
getProduct
in interface DeviceType
public String getModel()
DeviceType
getModel
in interface DeviceType
public DeviceType getParentType()
DeviceType
getParentType
in interface DeviceType
public Set<? extends DeviceType> getChildTypes()
DeviceType
getChildTypes
in interface DeviceType
public String getVendor()
public String getFamily()
public Set<String> getOids()
public String getFw()
public String getTypeData()
public String getInstanceData()
public com.hp.device.PresentationResources getPresentationResources()
public Set<String> getFlags()
public boolean addChild(DeviceType child)
child
- the child type to addpublic boolean removeChild(DeviceType child)
child
- the child type to removepublic DeviceDriverProvider getProvider()
DeviceType
getProvider
in interface DeviceType
protected Map<Class<? extends Facet>,Class<? extends AbstractFacet>> getFacetBindings(boolean isHandler)
isHandler
- true for handler bindings; false for info bindingsprotected void addBinding(Class<? extends Facet> facetClass, Class<? extends AbstractFacet> facetImplementationClass)
facetClass
- supported facet interface classfacetImplementationClass
- corresponding facet interface implementation
classprotected void removeBinding(Class<? extends Facet> facetClass)
facetClass
- unsupported facet interface classpublic DeviceInfo evolve(DeviceInfo deviceInfo)
Note: implementations should use DeviceDriverProvider.switchType(com.hp.device.MutableDeviceInfo, java.lang.String)
if it is determined that the device type needs to change.
This implementation does not perform any evolution and simply returns back the original device info instance.
evolve
in interface DeviceType
deviceInfo
- the info to evolvepublic DeviceHandler createHandler(DeviceInfo info, IpAddress ip)
This implementation uses reflection to instantiate a new handler for the specified arguments.
createHandler
in interface DeviceType
info
- the device info contextip
- the IP address to bind topublic DeviceLoader createLoader(DeviceInfo info, String uid)
This implementation uses reflection to instantiate a new handler for the specified arguments.
createLoader
in interface DeviceType
info
- the device info contextuid
- the unique identifier to bind topublic String toShortDebugString()
public String toDebugString()
public String toDebugString(int indent)
indent
- number of spaces to indentCopyright © 2016. All Rights Reserved.