public class DefaultDeviceDriverProvider extends AbstractDeviceDriverProvider
device driver provider
implementation,
which allows assembly of device driver using off-the-shelf implementations
via XML-encoded resources and/or files.
The XML configuration is expected to resemble the following format:
<deviceDriver description="..." [origin="..."]> <{type|abstractType} name="..." [alias="..."] [extends="..."] description="..."> [ <oid>...</oid> <oid>...</oid> ... ] [<fw>...</fw>] [<vendor>...</vendor>] [<family>...</family>] [<product>...</product>] [<model>...</model>] [<handler class="..." />] [<loader class="..." [platform="..."] />] <facet name="..." class="..." /> [<facet drop="..." />] <flag name="..." /> [<flag drop="..." />] [ <typeInfo> ... </typeInfo> <instanceInfo> ... </instanceInfo> ] [ <images path=".../someResourcePath"> <propertyPageImage>file.jpg</propertyPageImage> <topologyMapImage>file.gif</topologyMapImage> </path> ] [ <trafficCapabilities> ... </trafficCapabilities> ] </type> ... </deviceDriver>
Constructor and Description |
---|
DefaultDeviceDriverProvider(String platform)
Create a driver provider with the specified platform context.
|
Modifier and Type | Method and Description |
---|---|
void |
addDriver(File file)
Parses the XML-encoded device driver definition from the specified file.
|
void |
addDriver(org.apache.commons.configuration.HierarchicalConfiguration driverDefinition)
Parses the device driver definition from the specified hierarchical
configuration.
|
void |
addDriver(InputStream in)
Parses the XML-encoded data off the specified input stream into a
device type instance.
|
void |
addType(boolean isAbstract,
org.apache.commons.configuration.HierarchicalConfiguration typeDefinition,
String description,
String origin)
Processes the supplied hierarchical configuration, that contains device
type definition.
|
String |
getPlatform()
Get the platform context name.
|
protected void |
processFacets(org.apache.commons.configuration.HierarchicalConfiguration typeDefinition,
Map<Class<? extends Facet>,Class<? extends AbstractFacet>> facetBindings)
Processes the facet bindings and overrides specified in given type
definition to augment the provided facet bindings map.
|
protected void |
processFlags(org.apache.commons.configuration.HierarchicalConfiguration typeDefinition,
Set<String> flagSet)
Processes the flags and augments the provided set.
|
void |
removeType(String typeReference)
Removes support for the specified device type.
|
void |
setClassLoader(ClassLoader classLoader)
Override the default class loader
|
String |
toString() |
addType, addType, create, create, create, create, create, getBindingsCount, getDeviceType, getDeviceTypeNames, getTypesCount, removeType, switchType
public DefaultDeviceDriverProvider(String platform)
platform
- platform context namepublic String getPlatform()
public void setClassLoader(ClassLoader classLoader)
classLoader
- preferred class loaderpublic void addDriver(File file) throws DeviceException
file
- device driver definition fileDeviceException
- if problems reading or parsing the filepublic void addDriver(InputStream in) throws DeviceException
in
- input stream with XML-encoding of device type definitionDeviceException
- if problems parsing the input streampublic void addDriver(org.apache.commons.configuration.HierarchicalConfiguration driverDefinition) throws DeviceException
driverDefinition
- device driver definitionDeviceException
- if problems parsing the definitionpublic void removeType(String typeReference)
typeReference
- type name or type alias of the device type to be
removedpublic void addType(boolean isAbstract, org.apache.commons.configuration.HierarchicalConfiguration typeDefinition, String description, String origin) throws DeviceException
isAbstract
- true if the type is an abstract base typetypeDefinition
- hierarchical configuration of a type definitiondescription
- a description for the typeorigin
- an origin of the type (who wrote the device driver) @throws DeviceException if problemsDeviceException
- if issues processing the type definitionprotected void processFacets(org.apache.commons.configuration.HierarchicalConfiguration typeDefinition, Map<Class<? extends Facet>,Class<? extends AbstractFacet>> facetBindings)
typeDefinition
- device type configurationfacetBindings
- facet binding map to be augmentedprotected void processFlags(org.apache.commons.configuration.HierarchicalConfiguration typeDefinition, Set<String> flagSet)
typeDefinition
- device type configurationflagSet
- flag set to be augmentedpublic String toString()
toString
in class AbstractDeviceDriverProvider
Copyright © 2015. All Rights Reserved.