Class EdgeConfig.Component

  • Enclosing class:
    EdgeConfig

    public static class EdgeConfig.Component
    extends java.lang.Object
    Represents an instance of an OpenEMS Component.
    • Constructor Detail

      • Component

        public Component​(java.lang.String servicePid,
                         java.lang.String id,
                         java.lang.String alias,
                         java.lang.String factoryId,
                         java.util.SortedMap<java.lang.String,​com.google.gson.JsonElement> properties,
                         java.util.SortedMap<java.lang.String,​EdgeConfig.Component.Channel> channels)
      • Component

        public Component​(java.lang.String id,
                         java.lang.String alias,
                         java.lang.String factoryId,
                         java.util.SortedMap<java.lang.String,​com.google.gson.JsonElement> properties,
                         java.util.SortedMap<java.lang.String,​EdgeConfig.Component.Channel> channels)
        Constructor with NO_SERVICE_PID.
        Parameters:
        id - the Component-ID
        alias - the Alias
        factoryId - the Factory-ID
        properties - the configuration properties
        channels - the channels
      • Component

        public Component​(java.lang.String id,
                         java.lang.String alias,
                         java.lang.String factoryId,
                         com.google.gson.JsonObject properties)
        Constructor with NO_SERVICE_PID, properties as JsonObject and no channels.
        Parameters:
        id - the Component-ID
        alias - the Alias
        factoryId - the Factory-ID
        properties - the configuration properties
    • Method Detail

      • getPid

        public java.lang.String getPid()
        Gets the PID of the EdgeConfig.Component.
        Returns:
        the PID
      • getId

        public java.lang.String getId()
        Gets the ID of the EdgeConfig.Component, e.g. 'ctrlDebugLog0'.
        Returns:
        the Component-ID
      • getAlias

        public java.lang.String getAlias()
        Gets the Alias of the EdgeConfig.Component.
        Returns:
        the Alias
      • getFactoryId

        public java.lang.String getFactoryId()
        Gets the Factory-ID of the EdgeConfig.Component, e.g. 'Controller.Debug.Log'.
        Returns:
        the Factory-ID
      • getProperties

        public java.util.Map<java.lang.String,​com.google.gson.JsonElement> getProperties()
        Gets the Properties of the EdgeConfig.Component.
        Returns:
        the Properties
      • getProperty

        public java.util.Optional<com.google.gson.JsonElement> getProperty​(java.lang.String propertyId)
        Gets the Property with the given ID.
        Parameters:
        propertyId - the Property-ID
        Returns:
        the Property as Optional
      • getPropertyOrError

        public com.google.gson.JsonElement getPropertyOrError​(java.lang.String propertyId)
                                                       throws InvalidValueException
        Gets the Property with the given ID or throws an Exception if it does not exist.
        Parameters:
        propertyId - the Property-ID
        Returns:
        the Property
        Throws:
        InvalidValueException
      • getStateChannels

        public java.util.Map<java.lang.String,​EdgeConfig.Component.Channel> getStateChannels()
        Gets the StateChannels.
        Returns:
        the StateChannels
      • isStateChannel

        public boolean isStateChannel​(java.lang.String channelId)
        Is the given Channel-ID a StateChannel?.
        Parameters:
        channelId - the Channel-ID
        Returns:
        true if it is a StateChannel
      • getStateChannel

        public java.util.Optional<EdgeConfig.Component.Channel> getStateChannel​(java.lang.String channelId)
        Get the StateChannel with the given Channel-ID.
        Parameters:
        channelId - the Channel-ID
        Returns:
        the Channel; or empty if the Channel does not exist or is not a StateChannel.
      • toJson

        public com.google.gson.JsonObject toJson​(EdgeConfig.Component.JsonFormat jsonFormat)
        Returns the Component configuration as a JSON Object.
         {
           alias: string,
           factoryId: string,
                 properties: {
             [key: string]: value
           },
           channels: {
             [channelId: string]: {}
           }
         }
         
        Parameters:
        jsonFormat - the EdgeConfig.Component.JsonFormat
        Returns:
        configuration as a JSON Object