Interface Driver

  • All Superinterfaces:
    Annotations
    All Known Implementing Classes:
    DefaultDriver

    public interface Driver
    extends Annotations
    Representation of a specific family of device drivers. Behaviour configuration data is stored using Annotations.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.Class<? extends Behaviour>> behaviours()
      Returns the set of behaviours supported by this driver.
      <T extends Behaviour>
      T
      createBehaviour​(DriverData data, java.lang.Class<T> behaviourClass)
      Creates an instance of behaviour primed with the specified driver data.
      <T extends Behaviour>
      T
      createBehaviour​(DriverHandler handler, java.lang.Class<T> behaviourClass)
      Creates an instance of behaviour primed with the specified driver handler.
      java.lang.String getProperty​(java.lang.String name)
      Gets the value of given property name.
      default java.lang.String getProperty​(java.lang.String name, java.lang.String defaultValue)
      Gets the value of given property name.
      boolean hasBehaviour​(java.lang.Class<? extends Behaviour> behaviourClass)
      Indicates whether or not the driver, or any of its parents, support the specified class of behaviour.
      java.lang.String hwVersion()
      Returns the device hardware version.
      java.lang.Class<? extends Behaviour> implementation​(java.lang.Class<? extends Behaviour> behaviour)
      Returns the implementation class for the specified behaviour.
      java.lang.String manufacturer()
      Returns the device manufacturer name.
      Driver merge​(Driver other)
      Merges the specified driver behaviours and properties into this one, giving preference to the other driver when dealing with conflicts.
      java.lang.String name()
      Returns the driver name.
      Driver parent()
      Deprecated.
      1.5.0 Falcon Release
      java.util.List<Driver> parents()
      Returns all the parent drivers from which this driver inherits behaviours and properties.
      java.util.Map<java.lang.String,​java.lang.String> properties()
      Returns the set of annotations as map of key/value properties.
      java.lang.String swVersion()
      Returns the device software version.
    • Method Detail

      • name

        java.lang.String name()
        Returns the driver name. This is expected to be a reverse-DNS, Java package-like name.
        Returns:
        driver name
      • parent

        @Deprecated
        Driver parent()
        Deprecated.
        1.5.0 Falcon Release
        Returns the parent driver from which this driver inherits behaviours and properties.
        Returns:
        parent driver; null if driver has no parent
      • parents

        java.util.List<Driver> parents()
        Returns all the parent drivers from which this driver inherits behaviours and properties.
        Returns:
        list of parent drivers
      • manufacturer

        java.lang.String manufacturer()
        Returns the device manufacturer name.
        Returns:
        manufacturer name
      • hwVersion

        java.lang.String hwVersion()
        Returns the device hardware version.
        Returns:
        hardware version
      • swVersion

        java.lang.String swVersion()
        Returns the device software version.
        Returns:
        software version
      • behaviours

        java.util.Set<java.lang.Class<? extends Behaviour>> behaviours()
        Returns the set of behaviours supported by this driver. It reflects behaviours of only this driver and not its parent.
        Returns:
        set of device driver behaviours
      • implementation

        java.lang.Class<? extends Behaviour> implementation​(java.lang.Class<? extends Behaviour> behaviour)
        Returns the implementation class for the specified behaviour. It reflects behaviours of only this driver and not its parent.
        Parameters:
        behaviour - behaviour interface
        Returns:
        implementation class
      • hasBehaviour

        boolean hasBehaviour​(java.lang.Class<? extends Behaviour> behaviourClass)
        Indicates whether or not the driver, or any of its parents, support the specified class of behaviour.
        Parameters:
        behaviourClass - behaviour class
        Returns:
        true if behaviour is supported
      • createBehaviour

        <T extends Behaviour> T createBehaviour​(DriverData data,
                                                java.lang.Class<T> behaviourClass)
        Creates an instance of behaviour primed with the specified driver data. If the current driver does not support the specified behaviour and the driver has parent, the request is delegated to the parent driver.
        Type Parameters:
        T - type of behaviour
        Parameters:
        data - driver data context
        behaviourClass - driver behaviour class
        Returns:
        behaviour instance
      • createBehaviour

        <T extends Behaviour> T createBehaviour​(DriverHandler handler,
                                                java.lang.Class<T> behaviourClass)
        Creates an instance of behaviour primed with the specified driver handler. If the current driver does not support the specified behaviour and the driver has parent, the request is delegated to the parent driver.
        Type Parameters:
        T - type of behaviour
        Parameters:
        handler - driver handler context
        behaviourClass - driver behaviour class
        Returns:
        behaviour instance
      • properties

        java.util.Map<java.lang.String,​java.lang.String> properties()
        Returns the set of annotations as map of key/value properties.
        Returns:
        map of properties
      • getProperty

        java.lang.String getProperty​(java.lang.String name)
        Gets the value of given property name. If the driver does not define the property, a BFS will be performed to search its ancestors.
        Parameters:
        name - property name
        Returns:
        the value of the property, or null if the property is not defined in this driver nor in any of its ancestors
      • getProperty

        default java.lang.String getProperty​(java.lang.String name,
                                             java.lang.String defaultValue)
        Gets the value of given property name. If the driver does not define the property, a BFS will be performed to search its ancestors.
        Parameters:
        name - property name
        defaultValue - to use if the property is not defined in this driver nor in any of its ancestors
        Returns:
        the value of the property, or defaultValue if the property is not defined in this driver nor in any of its ancestors
      • merge

        Driver merge​(Driver other)
        Merges the specified driver behaviours and properties into this one, giving preference to the other driver when dealing with conflicts.
        Parameters:
        other - other driver
        Returns:
        merged driver