org.flexiblepower.ral.ext
RS
- The type of the ResourceState
RCP
- The type of the ResourceControlParameters
public abstract class AbstractResourceManager<RS extends ResourceState,RCP extends ResourceControlParameters> extends java.lang.Object implements ResourceManager
ResourceManager
which does simple translation, possible while keeping
state information.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger
The logger that should be used by any subclass.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractResourceManager()
Creates a new instance for the specific driver class type and the control space class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
allocationStatusUpdate(AllocationStatusUpdate allocationStatusUpdate)
Send status update to attached controller.
|
protected abstract ControlSpaceRevoke |
createRevokeMessage()
This method is called when a revoke message is needed (e.g.
|
protected boolean |
isConnectedWithResourceController()
Indicate if this
ResourceManager is currently connected to a ControllerManager . |
protected boolean |
isConnectedWithResourceDriver()
Indicate if this
ResourceManager is currently connected to a ResourceDriver . |
org.flexiblepower.messaging.MessageHandler |
onConnect(org.flexiblepower.messaging.Connection connection) |
protected abstract RCP |
receivedAllocation(ResourceMessage message)
This method is called when a message has been received from the controller.
|
protected void |
sendControlParameters(ResourceControlParameters controlParameters)
Send control parameters to attached driver.
|
protected abstract java.util.List<? extends ResourceMessage> |
startRegistration(RS state)
This method is called when the first state has been received from the driver and a registration is needed.
|
protected void |
unconnectedStateUpdate(RS state)
This method is called when a state update from the driver has been received, but this manager is not connected.
|
protected abstract java.util.List<? extends ResourceMessage> |
updatedState(RS state)
This method is called when the state is updated and the
startRegistration(ResourceState) has already
been called previously. |
protected final org.slf4j.Logger logger
protected AbstractResourceManager()
protected void unconnectedStateUpdate(RS state)
state
- The state of the driverprotected abstract java.util.List<? extends ResourceMessage> startRegistration(RS state)
ResourceMessage
s that should at least contain a registration message.state
- The state of the driverResourceMessage
s that will be sent to the controller.protected abstract java.util.List<? extends ResourceMessage> updatedState(RS state)
startRegistration(ResourceState)
has already
been called previously.state
- The state of the driverResourceMessage
s that will be sent to the controller.protected abstract RCP receivedAllocation(ResourceMessage message)
Allocation
object, but could also be of another type, depending on the used message type.message
- The received messageResourceControlParameters
that should be sent to the driver.protected abstract ControlSpaceRevoke createRevokeMessage()
ControlSpaceRevoke
that will be sent to the controller.public org.flexiblepower.messaging.MessageHandler onConnect(org.flexiblepower.messaging.Connection connection)
onConnect
in interface org.flexiblepower.messaging.Endpoint
protected boolean isConnectedWithResourceController()
ResourceManager
is currently connected to a ControllerManager
.ResourceManager
is currently connected to a ControllerManager
protected boolean isConnectedWithResourceDriver()
ResourceManager
is currently connected to a ResourceDriver
.ResourceManager
is currently connected to a ResourceDriver
protected void allocationStatusUpdate(AllocationStatusUpdate allocationStatusUpdate)
allocationStatusUpdate
- The AllocationStatusUpdate
that is to be sent to the controller.protected void sendControlParameters(ResourceControlParameters controlParameters)
controlParameters
- The parameters that have to be sent to the driver