Package io.openems.common.types
Class EdgeConfig
java.lang.Object
io.openems.common.types.EdgeConfig
Holds the configuration of an Edge.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Represents an instance of an OpenEMS Component.static class
Represents an OpenEMS Component Factory. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObject
componentsToJson
(EdgeConfig.Component.JsonFormat jsonFormat) Returns the configuration Components as a JSON Object.static EdgeConfig
empty()
Creates an emptyEdgeConfig
.com.google.gson.JsonObject
Returns the configuration Factories as a JSON Object.static EdgeConfig
fromJson
(com.google.gson.JsonObject json) Creates anEdgeConfig
from aJsonObject
.getComponent
(String componentId) Gets aEdgeConfig.Component
by its Component-ID.getComponentIdsByFactory
(String factoryId) Get Component-IDs of Component instances by the given Factory.getComponentOrError
(String componentId) Gets theEdgeConfig.Component
or throws an Exception if it does not exist.com.google.common.collect.ImmutableSortedMap<String,
EdgeConfig.Component> Gets theEdgeConfig.Component
s.getComponentsByFactory
(String factoryId) Get Component instances by the given Factory.com.google.common.collect.ImmutableSortedMap<String,
EdgeConfig.Factory> Gets theEdgeConfig.Factory
s.getStateChannel
(ChannelAddress channelAddress) Get the StateChannel with the given Channel-Address.static boolean
ignorePropertyKey
(String key) Internal Method to decide whether a configuration property should be ignored.com.google.gson.JsonObject
toJson()
Returns the configuration as a JSON Object.
-
Method Details
-
empty
Creates an emptyEdgeConfig
.- Returns:
EdgeConfig
-
fromJson
Creates anEdgeConfig
from aJsonObject
.- Parameters:
json
- theJsonObject
- Returns:
EdgeConfig
-
getComponent
Gets aEdgeConfig.Component
by its Component-ID.- Parameters:
componentId
- the Component-ID- Returns:
- the
EdgeConfig.Component
asOptional
-
getComponentOrError
Gets theEdgeConfig.Component
or throws an Exception if it does not exist.- Parameters:
componentId
- the Component-ID- Returns:
- the
EdgeConfig.Component
- Throws:
InvalidValueException
- on error
-
getComponents
Gets theEdgeConfig.Component
s.- Returns:
- the
EdgeConfig.Component
s
-
getFactories
Gets theEdgeConfig.Factory
s.- Returns:
- the
EdgeConfig.Factory
s
-
getComponentIdsByFactory
Get Component-IDs of Component instances by the given Factory.- Parameters:
factoryId
- the given Factory.- Returns:
- a List of Component-IDs.
-
getComponentsByFactory
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
Returns the configuration Components as a JSON Object.{
toJson()
}- Parameters:
jsonFormat
- theEdgeConfig.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
Get the StateChannel with the given Channel-Address.- Parameters:
channelAddress
- theChannelAddress
- Returns:
- the Channel; or empty if the Channel does not exist or is not a StateChannel.
-
ignorePropertyKey
Internal Method to decide whether a configuration property should be ignored.- Parameters:
key
- the property key- Returns:
- true if it should get ignored
-