public abstract class AbstractRestApi extends AbstractOpenemsComponent implements RestApi, Controller, OpenemsComponent
RestApi.ChannelId
Controller.ChannelId
Modifier and Type | Field and Description |
---|---|
protected ApiWorker |
apiWorker |
static boolean |
DEFAULT_DEBUG_MODE |
Constructor and Description |
---|
AbstractRestApi(java.lang.String implementationName,
ChannelId[] firstInitialChannelIds,
ChannelId[]... furtherInitialChannelIds) |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(org.osgi.service.component.ComponentContext context,
java.lang.String id,
java.lang.String alias,
boolean enabled,
boolean isDebugModeEnabled,
int apiTimeout,
int port,
int connectionlimit) |
protected void |
deactivate()
Handles @Deactivate of implementations.
|
protected abstract AccessMode |
getAccessMode()
Gets the AccessMode.
|
protected abstract ComponentManager |
getComponentManager()
Gets the ComponentManager.
|
protected abstract Timedata |
getTimedata()
Gets the Timedata service.
|
protected abstract UserService |
getUserService()
Gets the UserService.
|
protected boolean |
isDebugModeEnabled() |
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.
|
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, modified, removeChannel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
_setUnableToStart, getUnableToStart, getUnableToStartChannel
_setRunFailed, getModbusSlaveNatureTable, getRunFailed, getRunFailedChannel
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, logDebug, logError, logInfo, logWarn, serviceFactoryPid, servicePid, updateConfigurationProperty, updateReferenceFilter
public static final boolean DEFAULT_DEBUG_MODE
protected final ApiWorker apiWorker
protected void activate(org.osgi.service.component.ComponentContext context, java.lang.String id, java.lang.String alias, boolean enabled, boolean isDebugModeEnabled, int apiTimeout, int port, int connectionlimit)
protected void deactivate()
AbstractOpenemsComponent
deactivate
in class AbstractOpenemsComponent
public void run() throws OpenemsError.OpenemsNamedException
Controller
run
in interface Controller
OpenemsError.OpenemsNamedException
- on errorprotected 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 messageprotected boolean isDebugModeEnabled()
protected abstract Timedata getTimedata() throws OpenemsException
OpenemsException
- if the timeservice is not availableprotected abstract UserService getUserService()
protected abstract ComponentManager getComponentManager()
protected abstract AccessMode getAccessMode()
AccessMode