public class ComponentManagerImpl extends AbstractOpenemsComponent implements ComponentManager, OpenemsComponent, JsonApi, org.osgi.service.cm.ConfigurationListener
ComponentManager.ChannelId
Modifier and Type | Field and Description |
---|---|
protected org.osgi.framework.BundleContext |
bundleContext |
protected ClockProvider |
clockProvider |
protected org.osgi.service.cm.ConfigurationAdmin |
cm |
protected org.osgi.service.event.EventAdmin |
eventAdmin |
protected org.osgi.service.metatype.MetaTypeService |
metaTypeService |
protected org.osgi.service.component.runtime.ServiceComponentRuntime |
serviceComponentRuntime |
Constructor and Description |
---|
ComponentManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
configurationEvent(org.osgi.service.cm.ConfigurationEvent event) |
protected void |
deactivate()
Handles @Deactivate of implementations.
|
java.lang.String |
debugLog()
Gets some output that is suitable for a continuous Debug log.
|
java.util.List<OpenemsComponent> |
getAllComponents()
Gets all OpenEMS-Components.
|
java.time.Clock |
getClock()
Gets the OpenEMS Clock - either the real system clock or a mocked clock for
simulations.
|
EdgeConfig |
getEdgeConfig()
Gets the complete configuration of this OpenEMS Edge.
|
java.util.List<OpenemsComponent> |
getEnabledComponents()
Gets all enabled OpenEMS-Components.
|
<T extends OpenemsComponent> |
getEnabledComponentsOfType(java.lang.Class<T> clazz)
Gets all enabled OpenEMS-Components of the given Type.
|
protected org.osgi.service.cm.Configuration |
getExistingConfigForId(java.lang.String componentId)
Gets the ConfigAdmin Configuration for the OpenEMS Component with the given
Component-ID.
|
protected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> |
handleCreateComponentConfigRequest(User user,
CreateComponentConfigRequest request)
Handles a CreateComponentConfigRequest.
|
protected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> |
handleDeleteComponentConfigRequest(User user,
DeleteComponentConfigRequest request)
Handles a DeleteComponentConfigRequest.
|
java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> |
handleJsonrpcRequest(User user,
JsonrpcRequest request)
Handles a JSON-RPC Request.
|
protected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> |
handleUpdateComponentConfigRequest(User user,
UpdateComponentConfigRequest request)
Handles a UpdateComponentConfigRequest.
|
protected void |
logError(org.slf4j.Logger log,
java.lang.String message)
Log an error message including the Component ID.
|
protected void |
logInfo(org.slf4j.Logger log,
java.lang.String message)
Log an info message including the Component ID.
|
protected void |
logWarn(org.slf4j.Logger log,
java.lang.String message)
Log a warn message including the Component ID.
|
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, modified, removeChannel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
_setConfigNotActivated, _setDefaultConfigurationFailed, _setDuplicatedComponentId, _setWasOutOfMemory, getChannel, getComponent, getConfigNotActivated, getConfigNotActivatedChannel, getDefaultConfigurationFailed, getDefaultConfigurationFailedChannel, getDuplicatedComponentId, getDuplicatedComponentIdChannel, getPossiblyDisabledComponent, getWasOutOfMemory, getWasOutOfMemoryChannel
_channel, _getChannelAs, alias, channel, channel, channels, getComponentContext, getModbusSlaveNatureTable, getState, getStateChannel, hasFaults, id, isEnabled, logDebug, logError, logInfo, logWarn, serviceFactoryPid, servicePid, updateConfigurationProperty, updateReferenceFilter
protected org.osgi.framework.BundleContext bundleContext
protected volatile ClockProvider clockProvider
protected org.osgi.service.metatype.MetaTypeService metaTypeService
protected org.osgi.service.cm.ConfigurationAdmin cm
protected org.osgi.service.event.EventAdmin eventAdmin
protected org.osgi.service.component.runtime.ServiceComponentRuntime serviceComponentRuntime
protected void deactivate()
AbstractOpenemsComponent
deactivate
in class AbstractOpenemsComponent
public java.util.List<OpenemsComponent> getEnabledComponents()
ComponentManager
getEnabledComponents
in interface ComponentManager
public <T extends OpenemsComponent> java.util.List<T> getEnabledComponentsOfType(java.lang.Class<T> clazz)
ComponentManager
getEnabledComponentsOfType
in interface ComponentManager
T
- the given Type, subclass of OpenemsComponent
clazz
- the given Type, subclass of OpenemsComponent
public java.util.List<OpenemsComponent> getAllComponents()
ComponentManager
getAllComponents
in interface ComponentManager
public java.lang.String debugLog()
OpenemsComponent
debugLog
in interface OpenemsComponent
protected void logInfo(org.slf4j.Logger log, java.lang.String message)
AbstractOpenemsComponent
logInfo
in class AbstractOpenemsComponent
log
- the Logger instancemessage
- the messageprotected void logWarn(org.slf4j.Logger log, java.lang.String message)
AbstractOpenemsComponent
logWarn
in class AbstractOpenemsComponent
log
- the Logger instancemessage
- the messageprotected void logError(org.slf4j.Logger log, java.lang.String message)
AbstractOpenemsComponent
logError
in class AbstractOpenemsComponent
log
- the Logger instancemessage
- the messagepublic java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> handleJsonrpcRequest(User user, JsonrpcRequest request) throws OpenemsError.OpenemsNamedException
JsonApi
handleJsonrpcRequest
in interface JsonApi
user
- the authenticated Userrequest
- the JSON-RPC RequestOpenemsError.OpenemsNamedException
- on errorprotected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> handleCreateComponentConfigRequest(User user, CreateComponentConfigRequest request) throws OpenemsError.OpenemsNamedException
user
- the Userrequest
- the CreateComponentConfigRequestOpenemsError.OpenemsNamedException
- on errorprotected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> handleUpdateComponentConfigRequest(User user, UpdateComponentConfigRequest request) throws OpenemsError.OpenemsNamedException
user
- the Userrequest
- the UpdateComponentConfigRequestOpenemsError.OpenemsNamedException
- on errorprotected java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> handleDeleteComponentConfigRequest(User user, DeleteComponentConfigRequest request) throws OpenemsError.OpenemsNamedException
user
- the Userrequest
- the DeleteComponentConfigRequestOpenemsError.OpenemsNamedException
- on errorprotected org.osgi.service.cm.Configuration getExistingConfigForId(java.lang.String componentId) throws OpenemsError.OpenemsNamedException
componentId
- the Component-IDOpenemsError.OpenemsNamedException
- on errorpublic EdgeConfig getEdgeConfig()
ComponentManager
Internally updates the cache if necessary and publishes a CONFIG_UPDATE event on update.
getEdgeConfig
in interface ComponentManager
EdgeConfig
objectpublic void configurationEvent(org.osgi.service.cm.ConfigurationEvent event)
configurationEvent
in interface org.osgi.service.cm.ConfigurationListener
public java.time.Clock getClock()
ComponentManager
getClock
in interface ClockProvider
getClock
in interface ComponentManager