public abstract class SystemComponent
extends java.lang.Object
Constructor and Description |
---|
SystemComponent(LifeCycleManager manager,
java.util.HashMap<java.lang.String,java.lang.String> configuration)
Creates a new
SystemComponent . |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
configure()
Performs custom configuration-tasks (e.g. creating connections to
databases, etc.).
|
boolean |
configureComponent()
Configures the component.
|
protected void |
disableMeasuring()
Disables the ability to enter
State.MEASURING . |
protected void |
enableMeasuring()
Enables the ability to enter
State.MEASURING . |
LifeCycleManager |
getLifeCycleManager()
Returns the
LifeCycleManager the SystemComponent is
registered to. |
State |
getState()
Returns the current
State of the component. |
abstract void |
initConnector()
Initiates a
SystemComponent 's Connector s. |
boolean |
isReadyToMeasure()
Returns whether the component still requires time for training.
|
protected abstract void |
measure()
Called to indicate the component to start measuring, that is sending,
respectively processing data, that is valid for the studie's results.
|
boolean |
measureComponent()
Starts the measuring-phase of the component.
|
protected abstract void |
stop()
Performs custom stopping-tasks (e.g. releasing connections etc).
|
boolean |
stopComponent()
Stops the component.
|
protected abstract void |
train()
Indicates that the System is now in
State.TRAINING . |
boolean |
trainComponent()
Starts the component.
|
public SystemComponent(LifeCycleManager manager, java.util.HashMap<java.lang.String,java.lang.String> configuration) throws InstantiationException
SystemComponent
.LifeCycleManager
to register itself to in order to be
managed (that is controlled in its life-cycle) and a HashMap
containing information about the component's configuration.manager
- LifeCycleManager
the component will register itself
to.configuration
- HashMap
containing information about the component's
configuration.InstantiationException
- if given configuration or manager are not valid.public boolean configureComponent()
State.INIT
. On configuring, the
abstract methods configure()
is called to allow
custom configuration-tasks.public boolean trainComponent()
State.CONFIG
. On starting, the
abstract method train()
is called.public boolean measureComponent()
State.TRAINING
. On
starting measuring, the abstract method measure()
is called.public boolean stopComponent()
stop()
is called to
allow custom stopping-tasks (e.g. releasing connections).public boolean isReadyToMeasure()
protected void disableMeasuring()
State.MEASURING
.SystemComponent
requires time for training. Note
that no SystemComponent
is allowed to measure as long as
any component blocked measuring. Remember to enable measuring again after
the need to train expired in order to unblock the system.isReadyToMeasure
,
enableMeasuring
protected void enableMeasuring()
State.MEASURING
.SystemComponent
previously disabled measuring in
disableMeasuring()
and finished training.isReadyToMeasure
,
enableMeasuring
public State getState()
State
of the component.State
of the component.public LifeCycleManager getLifeCycleManager()
LifeCycleManager
the SystemComponent
is
registered to.LifeCycleManager
the SystemComponent
is
registered to.protected abstract void configure()
State.CONFIG
.protected abstract void train()
State.TRAINING
.SystemComponent
s are supposed to start producing data as soon as
they enter this state, for a lot of data is timed relative to the entry
of State.TRAINING
. The produced data does not have to be valid,
though it should be reasonable to enable SystemComponent
s
following in the dispatching-chain to train themselves to the form of
incoming data.protected abstract void measure()
State.MEASURING
, which follows the
State.TRAINING
.protected abstract void stop()
SystemComponent
's
life-cycle.public abstract void initConnector()
SystemComponent
's Connector
s.