Uploaded image for project: 'Stratos'
  1. Stratos
  2. STRATOS-505

Make Stratos Cartridge Agent Truly Extensible

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Won't Fix
    • Affects Version/s: 4.0.0 Alpha
    • Fix Version/s: 4.0.0
    • Component/s: Cartridge Agent
    • Labels:
      None

      Description

      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
      ________________________________________________________________________________________________

        Attachments

          Activity

            People

            • Assignee:
              nirmal Nirmal Fernando
              Reporter:
              nirmal Nirmal Fernando
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: