Package org.openmuc.jeebus.spine.api
Interface Feature
-
- All Known Subinterfaces:
NodeManagement
public interface Feature
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddBindingListener(BindingListener listener)voidaddFunction(FeatureFunction function)Adds the passed SPINE function to the feature.org.openmuc.jeebus.spine.xsd.v1.FeatureAddressTypegetAddress()Returns the address of this feature relative to the parent device.static FeatureBuildergetBuilder()The returned builder builds a SPINE feature which can be added to an existing SPINE entity at runtime withEntity.addFeature(Feature).java.lang.StringgetDescription()DevicegetDevice()java.lang.StringgetLabel()org.openmuc.jeebus.spine.xsd.v1.RoleTypegetRole()org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumTypegetType()booleanhasDescription()booleanhasLabel()voidnotifySubscribers(org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)Notifies subscribers of this SPINE feature that data contained in the given command has changed.voidnotifySubscribers(org.openmuc.jeebus.spine.xsd.v1.FunctionEnumType function, org.openmuc.jeebus.spine.xsd.v1.FilterType filter)Notifies subscribers of this SPINE feature that data contained in the given SPINE function has changed.voidreleaseBoundClient(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType clientAddress)Releases the binding of the client feature located at the given address to this feature.voidreleaseBoundServer(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType serverAddress)Releases the binding of this feature to the server feature located at the given address.voidreleaseSubscriber(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType clientAddress)Releases the subscription of the client feature located at the given address to this feature.voidreleaseSubscription(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType serverAddress)Releases the subscription of this feature to the server feature located at the given address.java.util.concurrent.CompletableFuture<RequestResult>requestBind(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType)Sends a binding request to the remote feature located at the given address.java.util.concurrent.CompletableFuture<RequestResult>requestRead(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)Sends a read request to the remote feature located at the given address.java.util.concurrent.CompletableFuture<RequestResult>requestSubscription(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType, SpineSubscription subscription)Sends a subscription request to the remote feature located at the given address.java.util.concurrent.CompletableFuture<RequestResult>requestWrite(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)Sends a write request to the remote feature located at the given address.default voidshutdown()Shut down the feature, stopping any associated threads and releasing any other held resources.
-
-
-
Method Detail
-
getBuilder
static FeatureBuilder getBuilder()
The returned builder builds a SPINE feature which can be added to an existing SPINE entity at runtime withEntity.addFeature(Feature).
This method shall not be used to set up an entity which was not added to a device yet. For this purposeEntityBuilder.addFeature()shall be used.- Returns:
- a new
FeatureBuilderobject to create a new SPINE feature
-
getRole
org.openmuc.jeebus.spine.xsd.v1.RoleType getRole()
- Returns:
- the role of this feature
-
getLabel
java.lang.String getLabel()
- Returns:
- the label set or the empty string if no label was set
-
hasLabel
boolean hasLabel()
- Returns:
- true if this feature has a label set and false otherwise
-
getDescription
java.lang.String getDescription()
- Returns:
- the description set or the empty string if no description was set
-
hasDescription
boolean hasDescription()
- Returns:
- true if this feature has a description set and false otherwise
-
addFunction
void addFunction(FeatureFunction function)
Adds the passed SPINE function to the feature. After the function was added theNodeManagementinstance notifies subscribers about the change.- Parameters:
function- the SPINE function to add
-
getDevice
Device getDevice()
- Returns:
- the device this feature belongs to
-
shutdown
default void shutdown()
Shut down the feature, stopping any associated threads and releasing any other held resources.
-
requestRead
java.util.concurrent.CompletableFuture<RequestResult> requestRead(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)
Sends a read request to the remote feature located at the given address. The returnedCompletableFutureis completed with the replied datagram on success and completed with aSpineExceptionon failure.- Parameters:
address- the address of the remote feature which shall be readcmd- the command containing the to be read function and optional filter- Returns:
- a
CompletableFuturewhich is completed with the answer
-
requestWrite
java.util.concurrent.CompletableFuture<RequestResult> requestWrite(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)
Sends a write request to the remote feature located at the given address. The returnedCompletableFutureis completed with the replied acknowledgment datagram on success and completed with aSpineExceptionon failure.- Parameters:
address- the address of the remote feature which shall be written tocmd- the command containing the to be written information and optional filter- Returns:
- a
CompletableFuturewhich is completed with the answer
-
requestSubscription
java.util.concurrent.CompletableFuture<RequestResult> requestSubscription(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType, SpineSubscription subscription)
Sends a subscription request to the remote feature located at the given address. The returnedCompletableFutureis completed with the replied acknowledgment datagram on success and completed with aSpineExceptionon failure.- Parameters:
address- the address of the remote feature which shall be subscribed tofeatureType- the type of the remote featuresubscription- the subscription which will be called with notifications- Returns:
- a
CompletableFuturewhich is completed with the acknowledgment
-
requestBind
java.util.concurrent.CompletableFuture<RequestResult> requestBind(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType address, org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType)
Sends a binding request to the remote feature located at the given address. The returnedCompletableFutureis completed with the replied acknowledgment datagram on success and completed with aSpineExceptionon failure.- Parameters:
address- the address of the remote feature which shall be boundfeatureType- the type of the remote feature- Returns:
- a
CompletableFuturewhich is completed with the acknowledgment
-
releaseSubscription
void releaseSubscription(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType serverAddress)
Releases the subscription of this feature to the server feature located at the given address.- Parameters:
serverAddress- the address of the server feature which this client is subscribed to
-
releaseSubscriber
void releaseSubscriber(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType clientAddress)
Releases the subscription of the client feature located at the given address to this feature.- Parameters:
clientAddress- the address of the client feature which is subscribed to this feature
-
releaseBoundClient
void releaseBoundClient(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType clientAddress)
Releases the binding of the client feature located at the given address to this feature.- Parameters:
clientAddress- the address of the client feature which is bound to this feature
-
releaseBoundServer
void releaseBoundServer(org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType serverAddress)
Releases the binding of this feature to the server feature located at the given address.- Parameters:
serverAddress- the address of the server feature which this client is bound to
-
notifySubscribers
void notifySubscribers(org.openmuc.jeebus.spine.xsd.v1.FunctionEnumType function, org.openmuc.jeebus.spine.xsd.v1.FilterType filter)Notifies subscribers of this SPINE feature that data contained in the given SPINE function has changed.
The passed filter should be equivalent to a filter of a partial read on the function, which would return only the changed data. If the filter isnullthe notification sends all function data.- Parameters:
function- the SPINE function on which a change occurredfilter- the filter with which a partial read on the feature returns the changed data
-
notifySubscribers
void notifySubscribers(org.openmuc.jeebus.spine.xsd.v1.CmdType cmd)
Notifies subscribers of this SPINE feature that data contained in the given command has changed. This method should be used, if partial notifications should be possible but partial read is not implemented at the related FeatureFunction or if data was deleted.- Parameters:
cmd- the complete notification command including the filter on restricted function exchange
-
getAddress
org.openmuc.jeebus.spine.xsd.v1.FeatureAddressType getAddress()
Returns the address of this feature relative to the parent device.
The list returned byEntityAddressType.getEntity()contains the address parts of all entity parents in order- Returns:
- the feature address
-
getType
org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType getType()
- Returns:
- the type of this feature
-
addBindingListener
void addBindingListener(BindingListener listener)
- Parameters:
listener- is called when a successful binding is established on this Feature
-
-