Class EdgeConfig

java.lang.Object
io.openems.common.types.EdgeConfig

public class EdgeConfig extends Object
Holds the configuration of an Edge.
  • Method Details

    • empty

      public static EdgeConfig empty()
      Creates an empty EdgeConfig.
      Returns:
      EdgeConfig
    • fromJson

      public static EdgeConfig fromJson(com.google.gson.JsonObject json)
      Creates an EdgeConfig from a JsonObject.
      Parameters:
      json - the JsonObject
      Returns:
      EdgeConfig
    • getComponent

      public Optional<EdgeConfig.Component> getComponent(String componentId)
      Gets a EdgeConfig.Component by its Component-ID.
      Parameters:
      componentId - the Component-ID
      Returns:
      the EdgeConfig.Component as Optional
    • getComponentOrError

      public EdgeConfig.Component getComponentOrError(String componentId) throws InvalidValueException
      Gets the EdgeConfig.Component or throws an Exception if it does not exist.
      Parameters:
      componentId - the Component-ID
      Returns:
      the EdgeConfig.Component
      Throws:
      InvalidValueException - on error
    • getComponents

      public com.google.common.collect.ImmutableSortedMap<String,EdgeConfig.Component> getComponents()
      Returns:
      the EdgeConfig.Components
    • getFactories

      public com.google.common.collect.ImmutableSortedMap<String,EdgeConfig.Factory> getFactories()
      Returns:
      the EdgeConfig.Factorys
    • getComponentIdsByFactory

      public List<String> getComponentIdsByFactory(String factoryId)
      Get Component-IDs of Component instances by the given Factory.
      Parameters:
      factoryId - the given Factory.
      Returns:
      a List of Component-IDs.
    • getComponentsByFactory

      public List<EdgeConfig.Component> getComponentsByFactory(String factoryId)
      Get Component instances by the given Factory.
      Parameters:
      factoryId - the given Factory PID.
      Returns:
      a List of Components.
    • toJson

      public com.google.gson.JsonObject toJson()
      Returns the configuration as a JSON Object.
       {
         components: { toJson() },
         factories: {
           [: string]: {
             natureIds: string[]
           }
         }
       }
       
      Returns:
      configuration as a JSON Object
    • componentsToJson

      public com.google.gson.JsonObject componentsToJson(EdgeConfig.Component.JsonFormat jsonFormat)
      Returns the configuration Components as a JSON Object.
       {
         toJson()
       }
       
      Parameters:
      jsonFormat - the EdgeConfig.Component.JsonFormat
      Returns:
      Components as a JSON Object
    • factoriesToJson

      public com.google.gson.JsonObject factoriesToJson()
      Returns the configuration Factories as a JSON Object.
       {
         [id: string]: {
           natureIds: string[]
         }
       }
       
      Returns:
      Factories as a JSON Object
    • getStateChannel

      public Optional<EdgeConfig.Component.Channel> getStateChannel(ChannelAddress channelAddress)
      Get the StateChannel with the given Channel-Address.
      Parameters:
      channelAddress - the ChannelAddress
      Returns:
      the Channel; or empty if the Channel does not exist or is not a StateChannel.
    • ignorePropertyKey

      public static boolean ignorePropertyKey(String key)
      Internal Method to decide whether a configuration property should be ignored.
      Parameters:
      key - the property key
      Returns:
      true if it should get ignored
    • ignoreComponentPropertyKey

      public static boolean ignoreComponentPropertyKey(String componentId, String key)
      Internal Method to decide whether a configuration property should be ignored.
      Parameters:
      componentId - the Component-ID
      key - the property key
      Returns:
      true if it should get ignored