Class ControllerApiWebsocketImpl
java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.controller.api.websocket.ControllerApiWebsocketImpl
- All Implemented Interfaces:
OpenemsComponent
,Controller
,ControllerApiWebsocket
,org.ops4j.pax.logging.spi.PaxAppender
,org.osgi.service.event.EventHandler
public class ControllerApiWebsocketImpl
extends AbstractOpenemsComponent
implements ControllerApiWebsocket, 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.Controller
Controller.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.websocket.ControllerApiWebsocket
ControllerApiWebsocket.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.common.component.OpenemsComponent
OpenemsComponent.ChannelId
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ApiWorker
protected ComponentManager
protected WebsocketServer
Stores valid session tokens for authentication via Cookie.protected UserService
Fields inherited from interface io.openems.edge.controller.api.websocket.ControllerApiWebsocket
DEFAULT_PORT, EDGE_COMMENT, EDGE_ID, EDGE_PRODUCT_TYPE, SUM_STATE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Handles @Deactivate of implementations.void
doAppend
(org.ops4j.pax.logging.spi.PaxLoggingEvent event) Gets the Timedata service.protected WsData
getWsDataForTokenOrError
(String token) Gets the WebSocket connection attachment for a UI token.void
handleEvent
(org.osgi.service.event.Event event) protected void
handleSubscribeSystemLogRequest
(String token, SubscribeSystemLogRequest request) Handles a SubscribeSystemLogRequest by forwarding it to the 'SystemLogHandler'.protected void
Log an error message including the Component ID.protected final void
Log an info message including the Component ID.protected final void
Log a warn message including the Component ID.void
run()
Executes the Controller logic.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.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
-
Field Details
-
sessionTokens
Stores valid session tokens for authentication via Cookie. -
apiWorker
-
componentManager
-
userService
-
server
-
-
Constructor Details
-
ControllerApiWebsocketImpl
public ControllerApiWebsocketImpl()
-
-
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
-
doAppend
public void doAppend(org.ops4j.pax.logging.spi.PaxLoggingEvent event) - Specified by:
doAppend
in interfaceorg.ops4j.pax.logging.spi.PaxAppender
-
getWsDataForTokenOrError
Gets the WebSocket connection attachment for a UI token.- Parameters:
token
- the UI token- Returns:
- the WsData
- Throws:
OpenemsError.OpenemsNamedException
- if there is no connection with this token
-
handleSubscribeSystemLogRequest
protected void handleSubscribeSystemLogRequest(String token, SubscribeSystemLogRequest request) throws OpenemsError.OpenemsNamedException Handles a SubscribeSystemLogRequest by forwarding it to the 'SystemLogHandler'.- Parameters:
token
- the UI tokenrequest
- the SubscribeSystemLogRequest- Throws:
OpenemsError.OpenemsNamedException
- on error
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event) - Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
-
getTimedata
Gets the Timedata service.- Returns:
- the service
- Throws:
OpenemsException
- if the timeservice is not available
-