Interface ComponentManager
-
- All Superinterfaces:
ClockProvider
,JsonApi
,OpenemsComponent
- All Known Implementing Classes:
ComponentManagerImpl
,DummyComponentManager
public interface ComponentManager extends OpenemsComponent, JsonApi, ClockProvider
A Service that provides access to OpenEMS-Components.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ComponentManager.ChannelId
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SINGLETON_COMPONENT_ID
static java.lang.String
SINGLETON_SERVICE_PID
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
_setConfigNotActivated(java.lang.Boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.CONFIG_NOT_ACTIVATED
Channel.default void
_setDefaultConfigurationFailed(boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.DEFAULT_CONFIGURATION_FAILED
Channel.default void
_setDuplicatedComponentId(java.lang.Boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.DUPLICATED_COMPONENT_ID
Channel.default void
_setWasOutOfMemory(boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.WAS_OUT_OF_MEMORY
Channel.java.util.List<OpenemsComponent>
getAllComponents()
Gets all OpenEMS-Components.default <T extends Channel<?>>
TgetChannel(ChannelAddress channelAddress)
Gets a Channel by its Channel-Address.java.time.Clock
getClock()
Gets the OpenEMS Clock - either the real system clock or a mocked clock for simulations.<T extends OpenemsComponent>
TgetComponent(java.lang.String componentId)
Gets a OpenEMS-Component by its Component-ID.default Value<java.lang.Boolean>
getConfigNotActivated()
Gets the Config Not Activated Warning State.default StateChannel
getConfigNotActivatedChannel()
Gets the Channel forComponentManager.ChannelId.CONFIG_NOT_ACTIVATED
.default Value<java.lang.Boolean>
getDefaultConfigurationFailed()
Gets the Default Configuration Failed State.default StateChannel
getDefaultConfigurationFailedChannel()
Gets the Channel forComponentManager.ChannelId.DEFAULT_CONFIGURATION_FAILED
.default Value<java.lang.Boolean>
getDuplicatedComponentId()
Gets the Duplicated Component-ID Fault State.default StateChannel
getDuplicatedComponentIdChannel()
Gets the Channel forComponentManager.ChannelId.DUPLICATED_COMPONENT_ID
.EdgeConfig
getEdgeConfig()
Gets the complete configuration of this OpenEMS Edge.java.util.List<OpenemsComponent>
getEnabledComponents()
Gets all enabled OpenEMS-Components.<T extends OpenemsComponent>
java.util.List<T>getEnabledComponentsOfType(java.lang.Class<T> clazz)
Gets all enabled OpenEMS-Components of the given Type.<T extends OpenemsComponent>
TgetPossiblyDisabledComponent(java.lang.String componentId)
Gets a OpenEMS-Component by its Component-ID.default Value<java.lang.Boolean>
getWasOutOfMemory()
Gets the Was Out of Memory Fault State.default StateChannel
getWasOutOfMemoryChannel()
Gets the Channel forComponentManager.ChannelId.WAS_OUT_OF_MEMORY
.-
Methods inherited from interface io.openems.edge.common.jsonapi.JsonApi
handleJsonrpcRequest
-
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
-
-
-
-
Field Detail
-
SINGLETON_SERVICE_PID
static final java.lang.String SINGLETON_SERVICE_PID
- See Also:
- Constant Field Values
-
SINGLETON_COMPONENT_ID
static final java.lang.String SINGLETON_COMPONENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getConfigNotActivatedChannel
default StateChannel getConfigNotActivatedChannel()
Gets the Channel forComponentManager.ChannelId.CONFIG_NOT_ACTIVATED
.- Returns:
- the Channel
-
getConfigNotActivated
default Value<java.lang.Boolean> getConfigNotActivated()
Gets the Config Not Activated Warning State. SeeComponentManager.ChannelId.CONFIG_NOT_ACTIVATED
.- Returns:
- the Channel
Value
-
_setConfigNotActivated
default void _setConfigNotActivated(java.lang.Boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.CONFIG_NOT_ACTIVATED
Channel.- Parameters:
value
- the next value
-
getDuplicatedComponentIdChannel
default StateChannel getDuplicatedComponentIdChannel()
Gets the Channel forComponentManager.ChannelId.DUPLICATED_COMPONENT_ID
.- Returns:
- the Channel
-
getDuplicatedComponentId
default Value<java.lang.Boolean> getDuplicatedComponentId()
Gets the Duplicated Component-ID Fault State. SeeComponentManager.ChannelId.DUPLICATED_COMPONENT_ID
.- Returns:
- the Channel
Value
-
_setDuplicatedComponentId
default void _setDuplicatedComponentId(java.lang.Boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.DUPLICATED_COMPONENT_ID
Channel.- Parameters:
value
- the next value
-
getWasOutOfMemoryChannel
default StateChannel getWasOutOfMemoryChannel()
Gets the Channel forComponentManager.ChannelId.WAS_OUT_OF_MEMORY
.- Returns:
- the Channel
-
getWasOutOfMemory
default Value<java.lang.Boolean> getWasOutOfMemory()
Gets the Was Out of Memory Fault State. SeeComponentManager.ChannelId.WAS_OUT_OF_MEMORY
.- Returns:
- the Channel
Value
-
_setWasOutOfMemory
default void _setWasOutOfMemory(boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.WAS_OUT_OF_MEMORY
Channel.- Parameters:
value
- the next value
-
getDefaultConfigurationFailedChannel
default StateChannel getDefaultConfigurationFailedChannel()
Gets the Channel forComponentManager.ChannelId.DEFAULT_CONFIGURATION_FAILED
.- Returns:
- the Channel
-
getDefaultConfigurationFailed
default Value<java.lang.Boolean> getDefaultConfigurationFailed()
Gets the Default Configuration Failed State. SeeComponentManager.ChannelId.DEFAULT_CONFIGURATION_FAILED
.- Returns:
- the Channel
Value
-
_setDefaultConfigurationFailed
default void _setDefaultConfigurationFailed(boolean value)
Internal method to set the 'nextValue' onComponentManager.ChannelId.DEFAULT_CONFIGURATION_FAILED
Channel.- Parameters:
value
- the next value
-
getClock
java.time.Clock getClock()
Gets the OpenEMS Clock - either the real system clock or a mocked clock for simulations.- Specified by:
getClock
in interfaceClockProvider
- Returns:
- the Clock
-
getEnabledComponents
java.util.List<OpenemsComponent> getEnabledComponents()
Gets all enabled OpenEMS-Components.Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See
BundleContext.getService(org.osgi.framework.ServiceReference)
). Make sure to use the references as shortly as possible.- Returns:
- a List of OpenEMS-Components
- Throws:
java.lang.IllegalArgumentException
- if the Component was not found
-
getEnabledComponentsOfType
<T extends OpenemsComponent> java.util.List<T> getEnabledComponentsOfType(java.lang.Class<T> clazz)
Gets all enabled OpenEMS-Components of the given Type.Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See
BundleContext.getService(org.osgi.framework.ServiceReference)
). Make sure to use the references as shortly as possible.- Type Parameters:
T
- the given Type, subclass ofOpenemsComponent
- Parameters:
clazz
- the given Type, subclass ofOpenemsComponent
- Returns:
- a List of OpenEMS-Components
-
getAllComponents
java.util.List<OpenemsComponent> getAllComponents()
Gets all OpenEMS-Components.Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See
BundleContext.getService(org.osgi.framework.ServiceReference)
). Make sure to use the references as shortly as possible.- Returns:
- a List of OpenEMS-Components
- Throws:
java.lang.IllegalArgumentException
- if the Component was not found
-
getComponent
<T extends OpenemsComponent> T getComponent(java.lang.String componentId) throws OpenemsError.OpenemsNamedException
Gets a OpenEMS-Component by its Component-ID. The Component is guaranteed to be enabled.Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See
BundleContext.getService(org.osgi.framework.ServiceReference)
). Make sure to use the references as shortly as possible.- Type Parameters:
T
- the typed Component- Parameters:
componentId
- the Component-ID (e.g. "_sum")- Returns:
- the OpenEMS-Component
- Throws:
OpenemsError.OpenemsNamedException
- if the Component was not found
-
getPossiblyDisabledComponent
<T extends OpenemsComponent> T getPossiblyDisabledComponent(java.lang.String componentId) throws OpenemsError.OpenemsNamedException
Gets a OpenEMS-Component by its Component-ID. Be careful, that the Component might not be 'enabled'. If in doubt, usegetComponent(String)
instead.Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See
BundleContext.getService(org.osgi.framework.ServiceReference)
). Make sure to use the references as shortly as possible.- Type Parameters:
T
- the typed Component- Parameters:
componentId
- the Component-ID (e.g. "_sum")- Returns:
- the OpenEMS-Component
- Throws:
OpenemsError.OpenemsNamedException
- if the Component was not found
-
getChannel
default <T extends Channel<?>> T getChannel(ChannelAddress channelAddress) throws java.lang.IllegalArgumentException, OpenemsError.OpenemsNamedException
Gets a Channel by its Channel-Address.- Type Parameters:
T
- the typed Channel- Parameters:
channelAddress
- the Channel-Address- Returns:
- the Channel
- Throws:
java.lang.IllegalArgumentException
- if the Channel is not availableOpenemsError.OpenemsNamedException
- on error
-
getEdgeConfig
EdgeConfig getEdgeConfig()
Gets the complete configuration of this OpenEMS Edge.Internally updates the cache if necessary and publishes a CONFIG_UPDATE event on update.
- Returns:
- the
EdgeConfig
object
-
-