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 Detail

      • name

        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

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

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

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

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

        Set<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

        Class<? extends Behaviour> implementation​(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​(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,
                                                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,
                                                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

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

        String getProperty​(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 String getProperty​(String name,
                                   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