This page contains information about the BlueprintEngine and how blueprints are defined and can be combined.
Definitions
Behaviour
A Behaviour
is the most generic component in the system and defines a set of ModelActions
, ModelStates
and ModelAttributes
. A Blueprint
can choose to implement any Behaviour
it whishes (which is done via a Model
), but then also must implement all the ModelActions
, ModelStates
and ModelAttributes
of that Behaviour
.
The actual implementation of a Behaviour
is done via a BehaviourDefinition
which is a special form of a Model
.
BaseBehaviour
Behaviours
form a hierarchy tree, however unlike a real tree where one Behaviour
can derive from multiple other Behaviours
(similar to multiple inheritance in programming languages like C++). This chain starts at a common single root that is called BaseBehaviour
.
In other words, the BaseBehaviour
defines the most common ModelActions
and ModelStates
for all other Behaviours
(the BaseBehaviour
does not defines any ModelAttributes
).
ModelState
-
A
ModelState
describe an instantiatedModel
while at rest. An instance in any givenModelState
does not change until aModelAction
is invoked on that instance. -
Each
ModelState
has a name which must be unique throughout the whole state machine. -
Each
ModelState
must be part of aTransistion
, which means it must have at least aModelAction
leading to it or aModelAction
leading from it.
ModelAction
-
A
ModelAction
is a means (and the only means) for aModel
to transit from an arbitrary sourceModelState
to arbitrary destinationModelState
(where the destinationModelState
can also be the sourceModelState
, effectively creating a loop). -
A
ModelAction
can define zero or moreModelAttributes
in order to be able to be invoked. Of theseModelAttributes
zero or moreModelAttributes
may have additional constraints (such as beingRequired
). -
~~Each
ModelAction
in aModel
may only appear once in anyTransition
, which means that the name of theModelAction
must be unique throughout the whole state machine.~~
In other words. Given an arbitrary Action
(name) we also know the associated source and destination of it (which forms a Transition
).
ModelAttribute
-
A
ModelAttribute
basically is a Name/Value pair with additional constraints in form of annotations. The name of anyModelAttribute
is unique throughout the whole system and always consists of a dot-notation starting with reversed top level domain name (such ascom.example.Appclusive.Blueprint.Name
). -
Any
Model
can override or redefine anyModelAttributes
(or its constraints) that it derives from its ancestorModel
chain. -
Any
ModelAttribute
constraints directly derived from its ancestorModels
are also present on the currentModel
. AnyModelAttributes
that aModel
implements via one of itsBehaviours
must be re-defined on theModel
.
Model
-
Models
- in contrast toBehaviours
- provide actual implementations that can be used alone to provide functionality of any kind. Ablueprint
must always reference at least oneModel
explicitly (whereas never aBehaviour
directly) and aModel
can be instantiated whereas aBehaviour
cannot. -
A
Model
must always derive from another single parentModel
and multipleModels
can derive from the parentModel
(making them siblings). This effectively forms a single-parent hierarchy tree ofModels
eventually starting withBaseModel
. -
A
Model
can choose not be the parent for any otherModels
which is then considered to besealed
.
BehaviourDefinition
Every time a Behaviour
is defined, its actual implementation is done via a BehaviourDefinition
(which is a special form of a Model
). This means that this BehaviourDefinition
contains all the ModelActions
, ModelStates
and ModelAttributes
the Behaviour
whishes to expose.
BaseModel
The BaseModel
is a special BehaviourDefinition
(and thus also a Model
) as it serves as the root Model
for all other BehaviourDefinitions
and thus all other Models
.
BaseModelStates
The following lists the minimum set of States
that every Model
and Behaviour
in the system must expose:
- InitialState
This is the first or starting point (which is in fact a ModelState
) of every Model
to be instantiated. From there an instance of a Model
will traverse from ModelState
to ModelState
via its exposed Actions
.
From this ModelState
a ModelAction
called Initialise
will be executed to allow the Model
to povision its instance.
- DecommissionedState
Before a instance of a Model
is disposed it must transit through a ModelState
that is called the DecommissionedState
. An instance of a Model
in this ModelState
must prepare itself to get disposed, but also may offer an option to get re-activated (via one of its exposed ModelAction
).
Instances in this State
are periodically called by the system via the Finalise
ModelAction
to check if they can be safely disposed.
- FinalState
With the InitialState
being the first ModelState
of every instantiated Model
, the FinalState
is the last ModelState
of every instantiated Model
. In fact this is the ModelState
where an instance of a Model
is disposed and removed from the [[Inventory]].
- ErrorState
The ErrorState
is reserved for situations where an instantiated model experienced an unforseen error condition and could not continue execution otherwise (such as a corrupt state). The Blueprint
designer can use this state for remediation ModelActions
(such as the Remedy
ModelAction
).
BaseModelActions
The following lists the minimum set of ModelActions
that every Model
and Behaviour
in the system must expose:
- Initialise
This ModelAction
is automatically invoked by the system when an instance of any Model
is created.
- Finalise
This ModelAction
is automatically called by the system when an instance of a Model
is in the DecommissionedState
and going to be disposed. The Model
may choose to deny the request for disposal effectively staying in the DecommissionedState
.
- Remedy
An instance of a Model
in the ErrorState
may choose to perform a reconciliation task with the aim to place that instance in a defined and stable ModelState
. This default ModelAction
is called Remedy
. A Blueprint
desginer may choose to add additional remediation ModelActions
where required.
BaseModel StateMachine and Transitions
The following illustrates the transitions of the state machine of the BaseModel
:
InitialState -- > Initialise -- > DecommissionedState
DecommissionedState -- > Finalise -- > FinalState
ErrorState` -- > Remedy -- > ErrorState
Item
An instantiated (or instance of a) Model
becomes an Item
in the [[Inventory]].