Class XmlDriverLoader


  • public class XmlDriverLoader
    extends 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 Detail

      • XmlDriverLoader

        public XmlDriverLoader​(ClassLoader classLoader,
                               BehaviourClassResolver resolver)
        Creates a new driver loader capable of loading drivers from the supplied class loader.
        Parameters:
        classLoader - class loader to use
        resolver - behaviour class resolver
    • Method Detail

      • loadDrivers

        public DefaultDriverProvider loadDrivers​(InputStream driversStream,
                                                 DriverResolver resolver)
                                          throws 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 definitions
        resolver - driver resolver
        Returns:
        driver provider
        Throws:
        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 definitions
        resolver - 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 definition
        resolver - driver resolver
        Returns:
        driver