Current Stratos Cartridge Agent is not truly extensible and it's not that easy to use it at the moment, with different different Cartridges (Cartridges have features that are specific to them and it's not correct to expect that every Cartridge opens up ports etc.).
So, I've come up with following design for the Cartridge Agent.
<please refer to the attached image>
Cartridge Agent's flow is fully customizable now and it is simply a collection of user defined collection of Phases.
- A Phase corresponds to a period between two life cycle states of the agent. eg: phase between started state to activated state would be activating phase.
- A Phase consists of a collection of ExtensionExecutors.
- An ExtensionExecutor can be used to implement different functions that agent should do within the Phase it belongs to.
- ExtensionExecutor can be a simple Java code, which is capable of executing script files, checking connections to ports etc.
- ScriptExtensionExecutor is an implementation of the ExtensionExecutor, which you can use to execute script files using Java's Process.exec command.
- You can write custom Phases by extending org.apache.stratos.cartridge.agent.phase.Phase abstract class and also you can write custom ExtensionExecutors by extending org.apache.stratos.cartridge.agent.executor.ExtensionExecutor abstract class.
How to define the Agent's work-flow?
I've introduced a configuration file to define Agent's work-flow and its structure is like this;
Path to the file should be set as a system property "agent.flow.file.path".
A sample is given below.