Class DummyComponentManager
- All Implemented Interfaces:
ClockProvider
,ComponentManager
,OpenemsComponent
,JsonApi
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openems.edge.common.component.ComponentManager
ComponentManager.ChannelId
-
Field Summary
Fields inherited from interface io.openems.edge.common.component.ComponentManager
SINGLETON_COMPONENT_ID, SINGLETON_SERVICE_PID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionChannel
<?> Deprecated.addComponent
(OpenemsComponent component) Specific for this Dummy implementation.alias()
Returns a human-readable name of this Component..Collection
<Channel<?>> channels()
Returns all Channels.Gets all OpenEMS-Components.getClock()
Gets the OpenEMS Clock - either the real system clock or a mocked clock for simulations.<T extends OpenemsComponent>
TgetComponent
(String componentId) Gets a OpenEMS-Component by its Component-ID.org.osgi.service.component.ComponentContext
Returns the ComponentContext.Gets the complete configuration of this OpenEMS Edge.Gets all enabled OpenEMS-Components.<T extends OpenemsComponent>
List<T> getEnabledComponentsOfType
(Class<T> clazz) Gets all enabled OpenEMS-Components of the given Type.<T extends OpenemsComponent>
TgetPossiblyDisabledComponent
(String componentId) Gets a OpenEMS-Component by its Component-ID.handleJsonrpcRequest
(User user, JsonrpcRequest request) Handles a JSON-RPC Request.id()
Returns a unique ID for this OpenEMS component.boolean
Returns whether this component is enabled.void
setConfigJson
(com.google.gson.JsonObject json) Sets aEdgeConfig
json.void
setConfigurationAdmin
(org.osgi.service.cm.ConfigurationAdmin configurationAdmin) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.edge.common.component.ComponentManager
_setConfigNotActivated, _setDefaultConfigurationFailed, _setDuplicatedComponentId, _setWasOutOfMemory, getChannel, getConfigNotActivated, getConfigNotActivatedChannel, getDefaultConfigurationFailed, getDefaultConfigurationFailedChannel, getDuplicatedComponentId, getDuplicatedComponentIdChannel, getWasOutOfMemory, getWasOutOfMemoryChannel
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_getChannelAs, channel, channel, debugLog, getState, getStateChannel, hasFaults, serviceFactoryPid, servicePid
-
Constructor Details
-
DummyComponentManager
public DummyComponentManager() -
DummyComponentManager
-
-
Method Details
-
getEnabledComponents
Description copied from interface:ComponentManager
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.- Specified by:
getEnabledComponents
in interfaceComponentManager
- Returns:
- a List of OpenEMS-Components
-
getAllComponents
Description copied from interface:ComponentManager
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.- Specified by:
getAllComponents
in interfaceComponentManager
- Returns:
- a List of OpenEMS-Components
-
getEnabledComponentsOfType
Description copied from interface:ComponentManager
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.- Specified by:
getEnabledComponentsOfType
in interfaceComponentManager
- Type Parameters:
T
- the given Type, subclass ofOpenemsComponent
- Parameters:
clazz
- the given Type, subclass ofOpenemsComponent
- Returns:
- a List of OpenEMS-Components
-
getComponent
public <T extends OpenemsComponent> T getComponent(String componentId) throws OpenemsError.OpenemsNamedException Description copied from interface:ComponentManager
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.- Specified by:
getComponent
in interfaceComponentManager
- 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
public <T extends OpenemsComponent> T getPossiblyDisabledComponent(String componentId) throws OpenemsError.OpenemsNamedException Description copied from interface:ComponentManager
Gets a OpenEMS-Component by its Component-ID. Be careful, that the Component might not be 'enabled'. If in doubt, useComponentManager.getComponent(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.- Specified by:
getPossiblyDisabledComponent
in interfaceComponentManager
- 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
-
addComponent
Specific for this Dummy implementation.- Parameters:
component
- the component that should be added- Returns:
- this
-
setConfigJson
public void setConfigJson(com.google.gson.JsonObject json) Sets aEdgeConfig
json.- Parameters:
json
- theEdgeConfig
json
-
getEdgeConfig
Description copied from interface:ComponentManager
Gets the complete configuration of this OpenEMS Edge.Internally updates the cache if necessary and publishes a CONFIG_UPDATE event on update.
- Specified by:
getEdgeConfig
in interfaceComponentManager
- Returns:
- the
EdgeConfig
object
-
id
Description copied from interface:OpenemsComponent
Returns a unique ID for this OpenEMS component.- Specified by:
id
in interfaceOpenemsComponent
- Returns:
- the unique ID
-
alias
Description copied from interface:OpenemsComponent
Returns a human-readable name of this Component..- Specified by:
alias
in interfaceOpenemsComponent
- Returns:
- the human-readable name
-
isEnabled
public boolean isEnabled()Description copied from interface:OpenemsComponent
Returns whether this component is enabled.- Specified by:
isEnabled
in interfaceOpenemsComponent
- Returns:
- true if the component is enabled
-
getComponentContext
public org.osgi.service.component.ComponentContext getComponentContext()Description copied from interface:OpenemsComponent
Returns the ComponentContext.- Specified by:
getComponentContext
in interfaceOpenemsComponent
- Returns:
- the OSGi ComponentContext
-
_channel
Deprecated.Description copied from interface:OpenemsComponent
Returns an undefined Channel defined by its ChannelId string representation.Note: It is preferred to use the typed channel()-method, that's why it is marked as @Deprecated.
- Specified by:
_channel
in interfaceOpenemsComponent
- Parameters:
channelName
- the Channel-ID as a string- Returns:
- the Channel or null
-
channels
Description copied from interface:OpenemsComponent
Returns all Channels.- Specified by:
channels
in interfaceOpenemsComponent
- Returns:
- a Collection of Channels
-
handleJsonrpcRequest
public CompletableFuture<JsonrpcResponseSuccess> handleJsonrpcRequest(User user, JsonrpcRequest request) throws OpenemsError.OpenemsNamedException Description copied from interface:JsonApi
Handles a JSON-RPC Request.- Specified by:
handleJsonrpcRequest
in interfaceJsonApi
- Parameters:
user
- the authenticatedUser
request
- the JSON-RPC Request- Returns:
- a Future JSON-RPC Success Response; null response results in a OpenemsError.JSONRPC_UNHANDLED_METHOD
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
getClock
Description copied from interface:ComponentManager
Gets the OpenEMS Clock - either the real system clock or a mocked clock for simulations.- Specified by:
getClock
in interfaceClockProvider
- Specified by:
getClock
in interfaceComponentManager
- Returns:
- the Clock
-
setConfigurationAdmin
public void setConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin configurationAdmin)
-