Nirmal Fernando created STRATOS-505:
---------------------------------------

             Summary: Make Stratos Cartridge Agent Truly Extensible
                 Key: STRATOS-505
                 URL: https://issues.apache.org/jira/browse/STRATOS-505
             Project: Stratos
          Issue Type: Improvement
          Components: Cartridge Agent
    Affects Versions: 4.0.0 Alpha
            Reporter: Nirmal Fernando
            Assignee: Nirmal Fernando
            Priority: Critical
             Fix For: 4.0.0 RC1


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;

[<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.InitializingPhase
org.apache.stratos.cartridge.agent.executor.impl.StartListenersExtensionExecutor
org.apache.stratos.cartridge.agent.executor.impl.ScriptExtensionExecutor=instance-started.sh,xxxxxxxxx.sh

[Starting]=org.apache.stratos.cartridge.agent.phase.impl.StartingPhase
org.apache.stratos.cartridge.agent.executor.impl.ScriptExtensionExecutor=start-servers.sh
org.apache.stratos.cartridge.agent.executor.impl.WaitTillActivateExtensionExecutor
org.apache.stratos.cartridge.agent.executor.impl.PersistenceVolumeExtensionExecutor

[WorkingPhase]=org.apache.stratos.cartridge.agent.phase.impl.WorkingPhase
org.apache.stratos.cartridge.agent.executor.impl.LogPublisherExtensionExecutor
org.apache.stratos.cartridge.agent.executor.impl.KeepAgentLiveExtensionExecutor

[CleanUpPhase]=org.apache.stratos.cartridge.agent.phase.impl.CleanUpPhase
________________________________________________________________________________________________




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to