Class BackendApiImpl
- java.lang.Object
-
- io.openems.edge.common.component.AbstractOpenemsComponent
-
- io.openems.edge.controller.api.backend.BackendApiImpl
-
- All Implemented Interfaces:
OpenemsComponent
,BackendApi
,Controller
,org.ops4j.pax.logging.spi.PaxAppender
,org.osgi.service.event.EventHandler
public class BackendApiImpl extends AbstractOpenemsComponent implements BackendApi, Controller, OpenemsComponent, org.ops4j.pax.logging.spi.PaxAppender, org.osgi.service.event.EventHandler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.backend.BackendApi
BackendApi.ChannelId
-
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.Controller
Controller.ChannelId
-
Nested classes/interfaces inherited from interface io.openems.edge.common.component.OpenemsComponent
OpenemsComponent.ChannelId
-
-
Field Summary
Fields Modifier and Type Field Description protected ApiWorker
apiWorker
protected static java.lang.String
COMPONENT_NAME
protected ComponentManager
componentManager
protected io.openems.edge.controller.api.backend.Config
config
protected Cycle
cycle
protected SendChannelValuesWorker
sendChannelValuesWorker
protected WebsocketClient
websocket
-
Constructor Summary
Constructors Constructor Description BackendApiImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
deactivate()
Handles @Deactivate of implementations.void
doAppend(org.ops4j.pax.logging.spi.PaxLoggingEvent event)
protected void
execute(java.lang.Runnable command)
Execute a command using theScheduledExecutorService
.void
handleEvent(org.osgi.service.event.Event event)
boolean
isConnected()
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.void
run()
Executes the Controller logic.java.util.concurrent.ScheduledFuture<?>
scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
Schedules a command using theScheduledExecutorService
.protected void
setSystemLogSubscribed(boolean isSystemLogSubscribed)
Activates/deactivates subscription to System-Log.-
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, modified, removeChannel
-
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.controller.api.backend.BackendApi
getApiWorkerLogChannel, getUnableToSendChannel
-
Methods inherited from interface io.openems.edge.controller.api.Controller
_setRunFailed, getRunFailed, getRunFailedChannel
-
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
-
COMPONENT_NAME
protected static final java.lang.String COMPONENT_NAME
- See Also:
- Constant Field Values
-
sendChannelValuesWorker
protected final SendChannelValuesWorker sendChannelValuesWorker
-
apiWorker
protected final ApiWorker apiWorker
-
websocket
protected WebsocketClient websocket
-
config
protected io.openems.edge.controller.api.backend.Config config
-
componentManager
protected ComponentManager componentManager
-
cycle
protected Cycle cycle
-
-
Method Detail
-
deactivate
protected void deactivate()
Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
run
public void run() throws OpenemsError.OpenemsNamedException
Description copied from interface:Controller
Executes the Controller logic.- Specified by:
run
in interfaceController
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
logInfo
protected void logInfo(org.slf4j.Logger log, java.lang.String message)
Description copied from class:AbstractOpenemsComponent
Log an info message including the Component ID.- Overrides:
logInfo
in classAbstractOpenemsComponent
- Parameters:
log
- the Logger instancemessage
- the message
-
logWarn
protected void logWarn(org.slf4j.Logger log, java.lang.String message)
Description copied from class:AbstractOpenemsComponent
Log a warn message including the Component ID.- Overrides:
logWarn
in classAbstractOpenemsComponent
- Parameters:
log
- the Logger instancemessage
- the message
-
logError
protected void logError(org.slf4j.Logger log, java.lang.String message)
Description copied from class:AbstractOpenemsComponent
Log an error message including the Component ID.- Overrides:
logError
in classAbstractOpenemsComponent
- Parameters:
log
- the Logger instancemessage
- the message
-
setSystemLogSubscribed
protected void setSystemLogSubscribed(boolean isSystemLogSubscribed)
Activates/deactivates subscription to System-Log.If activated, all System-Log events are sent via
SystemLogNotification
s.- Parameters:
isSystemLogSubscribed
- true to activate
-
doAppend
public void doAppend(org.ops4j.pax.logging.spi.PaxLoggingEvent event)
- Specified by:
doAppend
in interfaceorg.ops4j.pax.logging.spi.PaxAppender
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event)
- Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
-
isConnected
public boolean isConnected()
-
execute
protected void execute(java.lang.Runnable command)
Execute a command using theScheduledExecutorService
.- Parameters:
command
- aRunnable
-
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
Schedules a command using theScheduledExecutorService
.- Parameters:
command
- aRunnable
initialDelay
- the initial delaydelay
- the delayunit
- theTimeUnit
- Returns:
- a
ScheduledFuture
, or null if Executor is shutting down
-
-