Package org.onosproject.net.driver
Class XmlDriverLoader
- java.lang.Object
-
- org.onosproject.net.driver.XmlDriverLoader
-
public class XmlDriverLoader extends java.lang.Object
Utility capable of reading driver configuration XML resources and producing a device driver provider as a result.The drivers stream structure is as follows:
<drivers> <driver name=“...” [manufacturer="..." hwVersion="..." swVersion="..."]> <behaviour api="..." impl="..."/> ... [<property name=“key”>value</key>] ... </driver> ... </drivers>
-
-
Constructor Summary
Constructors Constructor Description XmlDriverLoader(java.lang.ClassLoader classLoader, BehaviourClassResolver resolver)
Creates a new driver loader capable of loading drivers from the supplied class loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultDriver
loadDriver(org.apache.commons.configuration.HierarchicalConfiguration driverCfg, DriverResolver resolver)
Loads a driver from the supplied hierarchical configuration.DefaultDriverProvider
loadDrivers(java.io.InputStream driversStream, DriverResolver resolver)
Loads the specified drivers resource as an XML stream and parses it to produce a ready-to-register driver provider.DefaultDriverProvider
loadDrivers(org.apache.commons.configuration.HierarchicalConfiguration driversCfg, DriverResolver resolver)
Loads a driver provider from the supplied hierarchical configuration.
-
-
-
Constructor Detail
-
XmlDriverLoader
public XmlDriverLoader(java.lang.ClassLoader classLoader, BehaviourClassResolver resolver)
Creates a new driver loader capable of loading drivers from the supplied class loader.- Parameters:
classLoader
- class loader to useresolver
- behaviour class resolver
-
-
Method Detail
-
loadDrivers
public DefaultDriverProvider loadDrivers(java.io.InputStream driversStream, DriverResolver resolver) throws java.io.IOException
Loads the specified drivers resource as an XML stream and parses it to produce a ready-to-register driver provider.- Parameters:
driversStream
- stream containing the drivers definitionsresolver
- driver resolver- Returns:
- driver provider
- Throws:
java.io.IOException
- if issues are encountered reading the stream or parsing the driver definitions within
-
loadDrivers
public DefaultDriverProvider loadDrivers(org.apache.commons.configuration.HierarchicalConfiguration driversCfg, DriverResolver resolver)
Loads a driver provider from the supplied hierarchical configuration.- Parameters:
driversCfg
- hierarchical configuration containing the drivers definitionsresolver
- driver resolver- Returns:
- driver provider
-
loadDriver
public DefaultDriver loadDriver(org.apache.commons.configuration.HierarchicalConfiguration driverCfg, DriverResolver resolver)
Loads a driver from the supplied hierarchical configuration.- Parameters:
driverCfg
- hierarchical configuration containing the driver definitionresolver
- driver resolver- Returns:
- driver
-
-