Hi All, 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. [image: Inline image 1] 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; *[<id-of-the-phase>]=<full-qualified-class-name-of-phase>* *<full-qualified-class-name-of-extension-executor>* *<full-qualified-class-name-of-extension-executor>=<comma-separated-list-of-values>* *.....* *[<id-of-the-phase>]=<full-qualified-class-name-of-phase>* *.....* Path to the file should be set as a system property "*agent.flow.file.path* ". *A sample is given below.* _______________________________________________________________________________________________ *[Initializing]=org.apache.stratos.cartridge.agent.phase.impl.InitializingPhaseorg.apache.stratos.cartridge.agent.executor.impl.StartListenersExtensionExecutororg.apache.stratos.cartridge.agent.executor.impl.ScriptExtensionExecutor=instance-started.sh,xxxxxxxxx.sh[Starting]=org.apache.stratos.cartridge.agent.phase.impl.StartingPhaseorg.apache.stratos.cartridge.agent.executor.impl.ScriptExtensionExecutor=start-servers.shorg.apache.stratos.cartridge.agent.executor.impl.WaitTillActivateExtensionExecutororg.apache.stratos.cartridge.agent.executor.impl.PersistenceVolumeExtensionExecutor[WorkingPhase]=org.apache.stratos.cartridge.agent.phase.impl.WorkingPhaseorg.apache.stratos.cartridge.agent.executor.impl.LogPublisherExtensionExecutororg.apache.stratos.cartridge.agent.executor.impl.KeepAgentLiveExtensionExecutor[CleanUpPhase]=org.apache.stratos.cartridge.agent.phase.impl.CleanUpPhase* ________________________________________________________________________________________________ I'll be committing these changes soon. Let me know your thoughts too. -- Best Regards, Nirmal Nirmal Fernando. PPMC Member & Committer of Apache Stratos, Senior Software Engineer, WSO2 Inc. Blog: http://nirmalfdo.blogspot.com/
<<inline: Cartridge Agent Design.png>>
