Class DeviceBuilder


  • public class DeviceBuilder
    extends java.lang.Object
    • Constructor Detail

      • DeviceBuilder

        public DeviceBuilder()
    • Method Detail

      • withId

        public DeviceBuilder withId​(java.lang.String id)
        Sets the device address of the new SPINE device. This must be a unique address with the following pattern: d:_(i:[1-9][0-9]*|n:[a-zA-Z0-9-]+)_[^\p{Cc}\p{Cf}\p{Z}]+ see Chapter 7.1.1.1 in the Protocol Specification for more details.
        This method must be called before calling build()!
        Parameters:
        id - the device address identifying this unique SPINE device
        Returns:
        the updated DeviceBuilder
      • getId

        public java.lang.String getId()
        Returns:
        the device address of the new SPINE device.
      • withDeviceType

        public DeviceBuilder withDeviceType​(org.openmuc.jeebus.spine.xsd.v1.DeviceTypeEnumType deviceType)
        This method must be called before calling build()!
        Parameters:
        deviceType - the type of the SPINE device
        Returns:
        the updated DeviceBuilder
      • withCommunication

        public DeviceBuilder withCommunication​(Communication communication)
        This method must be called before calling build()!
        Parameters:
        communication - the communication protocol to use
        Returns:
        the updated DeviceBuilder
      • withDiscoverDevices

        public DeviceBuilder withDiscoverDevices​(boolean discoverDevices)
        Enables the automatic DetailedDiscovery of newly discovered SPINE devices. If disabled (default) the DetailedDiscovery must be executed manually via NodeManagement
        Parameters:
        discoverDevices - true if DetailedDiscovery should be started automatically, false otherwise
        Returns:
        the updated DeviceBuilder
      • addDeviceListener

        public DeviceBuilder addDeviceListener​(DeviceListener listener)
        Adds the given DeviceListener to the device.
        Parameters:
        listener - the DeviceListener to add
        Returns:
        the updated DeviceBuilder
      • addEntity

        public EntityBuilder addEntity()
        Creates a new EntityBuilder instance. The entity can then be fluently added to this device with EntityBuilder.applyToDevice().
        Returns:
        a new EntityBuilder instance
      • withDescription

        public DeviceBuilder withDescription​(java.lang.String description)
        Parameters:
        description - a string describing the new SPINE device
        Returns:
        the updated DeviceBuilder
      • withLabel

        public DeviceBuilder withLabel​(java.lang.String label)
        Parameters:
        label - a human-readable alias of the new SPINE device
        Returns:
        the updated DeviceBuilder
      • withAcknowledgmentEnabled

        public DeviceBuilder withAcknowledgmentEnabled​(boolean acknowledgmentEnabled)
        Parameters:
        acknowledgmentEnabled - true if acknowledgment messages shall be requested, false otherwise
        Returns:
        the updated DeviceBuilder
      • withCommunicationMode

        public DeviceBuilder withCommunicationMode​(org.openmuc.jeebus.spine.xsd.v1.NetworkManagementFeatureSetType mode)
        Controls if the device should support the enhanced communication mode, i.e. can forward messages.NetworkManagementFeatureSetType.SIMPLE means no forwarding is possible and is the default. With every other value this device maintains a list with known SPINE devices and is able to forward messages to them.
        Parameters:
        mode - the NetworkFeatureSet as which the device acts
        Returns:
        the updated DeviceBuilder
      • withAutomaticDestinationListDetection

        public DeviceBuilder withAutomaticDestinationListDetection​(boolean enabled)
      • withUseCases

        public DeviceBuilder withUseCases​(java.util.List<UseCase> useCases)
        Adds all given use cases using addUseCase(UseCase)
        Parameters:
        useCases - the use cases to add
        Returns:
        the updated DeviceBuilder
      • withUseCases

        public DeviceBuilder withUseCases​(UseCase... useCases)
        Adds all given use cases using addUseCase(UseCase)
        Parameters:
        useCases - the use cases to add
        Returns:
        the updated DeviceBuilder
      • addUseCase

        public DeviceBuilder addUseCase​(UseCase useCase)
        Adds the passed SPINE use case to this device. The use case is executed when this device is built.
        Parameters:
        useCase - the SPINE use case this device supports
        Returns:
        the updated DeviceBuilder
      • getLastAddedEntityAddress

        public org.openmuc.jeebus.spine.xsd.v1.EntityAddressType getLastAddedEntityAddress()
        Returns:
        the entity address of the last added entity