Class ControllerApiBackendImpl
java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.controller.api.backend.ControllerApiBackendImpl
- All Implemented Interfaces:
OpenemsComponent
,JsonApi
,ControllerApiBackend
,Controller
,org.ops4j.pax.logging.spi.PaxAppender
,org.osgi.service.event.EventHandler
public class ControllerApiBackendImpl
extends AbstractOpenemsComponent
implements ControllerApiBackend, Controller, JsonApi, 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.Controller
Controller.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.backend.ControllerApiBackend
ControllerApiBackend.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.common.component.OpenemsComponent
OpenemsComponent.ChannelId
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ApiWorker
protected static final String
protected ComponentManager
protected io.openems.edge.controller.api.backend.Config
protected Cycle
protected ResendHistoricDataWorker
protected final SendChannelValuesWorker
protected WebsocketClient
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Handles @Deactivate of implementations.void
doAppend
(org.ops4j.pax.logging.spi.PaxLoggingEvent event) protected void
Execute a command using theScheduledExecutorService
.void
handleEvent
(org.osgi.service.event.Event event) CompletableFuture
<? extends JsonrpcResponseSuccess> handleJsonrpcRequest
(User user, JsonrpcRequest request) Handles a JSON-RPC Request.boolean
Gets if the edge is currently connected to the backend.protected void
Log an error message including the Component ID.protected void
Log an info message including the Component ID.protected void
Log a warn message including the Component ID.void
run()
Executes the Controller logic.scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, 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.Controller
_setRunFailed, getRunFailed, getRunFailedChannel
Methods inherited from interface io.openems.edge.controller.api.backend.ControllerApiBackend
getApiWorkerLogChannel, getLastSuccessFulResendChannel, getUnableToSendChannel
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 Details
-
COMPONENT_NAME
- See Also:
-
sendChannelValuesWorker
-
apiWorker
-
resendHistoricDataWorker
-
componentManager
-
cycle
-
websocket
-
config
protected io.openems.edge.controller.api.backend.Config config
-
-
Constructor Details
-
ControllerApiBackendImpl
public ControllerApiBackendImpl()
-
-
Method Details
-
deactivate
protected void deactivate()Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
run
Description copied from interface:Controller
Executes the Controller logic.- Specified by:
run
in interfaceController
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
logInfo
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
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
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()Description copied from interface:ControllerApiBackend
Gets if the edge is currently connected to the backend.- Specified by:
isConnected
in interfaceControllerApiBackend
- Returns:
- true if it is connected
-
execute
Execute a command using theScheduledExecutorService
.- Parameters:
command
- aRunnable
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, 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
-
handleJsonrpcRequest
public CompletableFuture<? extends 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
-