Package org.onosproject.net.driver
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 usingAnnotations
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Set<Class<? extends Behaviour>>
behaviours()
Returns the set of behaviours supported by this driver.<T extends Behaviour>
TcreateBehaviour(DriverData data, Class<T> behaviourClass)
Creates an instance of behaviour primed with the specified driver data.<T extends Behaviour>
TcreateBehaviour(DriverHandler handler, Class<T> behaviourClass)
Creates an instance of behaviour primed with the specified driver handler.String
getProperty(String name)
Gets the value of given property name.default String
getProperty(String name, String defaultValue)
Gets the value of given property name.boolean
hasBehaviour(Class<? extends Behaviour> behaviourClass)
Indicates whether or not the driver, or any of its parents, support the specified class of behaviour.String
hwVersion()
Returns the device hardware version.Class<? extends Behaviour>
implementation(Class<? extends Behaviour> behaviour)
Returns the implementation class for the specified behaviour.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.String
name()
Returns the driver name.Driver
parent()
Deprecated.1.5.0 Falcon ReleaseList<Driver>
parents()
Returns all the parent drivers from which this driver inherits behaviours and properties.Map<String,String>
properties()
Returns the set of annotations as map of key/value properties.String
swVersion()
Returns the device software version.-
Methods inherited from interface org.onosproject.net.Annotations
keys, value
-
-
-
-
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 ReleaseReturns 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 contextbehaviourClass
- 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 contextbehaviourClass
- 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 namedefaultValue
- 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
-
-