Class AbstractRestApi
java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.controller.api.rest.AbstractRestApi
- All Implemented Interfaces:
OpenemsComponent
,Controller
,RestApi
- Direct Known Subclasses:
ControllerApiRestReadOnlyImpl
,ControllerApiRestReadWriteImpl
public abstract class AbstractRestApi
extends AbstractOpenemsComponent
implements RestApi, Controller, OpenemsComponent
-
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.common.component.OpenemsComponent
OpenemsComponent.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.rest.RestApi
RestApi.ChannelId
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAbstractRestApi
(String implementationName, ChannelId[] firstInitialChannelIds, ChannelId[]... furtherInitialChannelIds) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate
(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, boolean isDebugModeEnabled, int apiTimeout, int port, int connectionlimit) Activate theAbstractRestApi
.protected void
Handles @Deactivate of implementations.protected abstract AccessMode
Gets the AccessMode.protected abstract ComponentManager
Gets the ComponentManager.protected abstract Timedata
Gets the Timedata service.protected abstract UserService
Gets the UserService.protected boolean
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.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
Methods inherited from interface io.openems.edge.controller.api.rest.RestApi
_setUnableToStart, getUnableToStart, getUnableToStartChannel
-
Field Details
-
DEFAULT_DEBUG_MODE
public static final boolean DEFAULT_DEBUG_MODE- See Also:
-
apiWorker
-
-
Constructor Details
-
AbstractRestApi
-
-
Method Details
-
activate
protected void activate(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, boolean isDebugModeEnabled, int apiTimeout, int port, int connectionlimit) Activate theAbstractRestApi
.- Parameters:
context
- theComponentContext
id
- the IDalias
- the Aliasenabled
- enable component?isDebugModeEnabled
- enable debug mode?apiTimeout
- the API timeoutport
- the port; if '0', the port is automatically assignedconnectionlimit
- the connection limit
-
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
-
isDebugModeEnabled
protected boolean isDebugModeEnabled() -
getTimedata
Gets the Timedata service.- Returns:
- the service
- Throws:
OpenemsException
- if the timeservice is not available
-
getUserService
Gets the UserService.- Returns:
- the service
-
getComponentManager
Gets the ComponentManager.- Returns:
- the service
-
getAccessMode
Gets the AccessMode.- Returns:
- the
AccessMode
-