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
      ________________________________________________________________________________________________

        Activity

        Hide
        nirmal Nirmal Fernando added a comment -

        Committed in series of commits that starts with 05627ecda2c2baea0a70cad519cf526dffdcf274

        Show
        nirmal Nirmal Fernando added a comment - Committed in series of commits that starts with 05627ecda2c2baea0a70cad519cf526dffdcf274
        Hide
        nirmal Nirmal Fernando added a comment -

        Community has decided that we do not require this much of flexibility in agent. So, I've reverted my above commit and committed a new implementation in ae7f9062df5b08b8ab37fa34ddaa5cb15911cb92.

        Now if you want to extend the Cartridge Agent, you should extend the org.apache.stratos.cartridge.agent.CartridgeAgent class and provide it as an argument to the CartridgeAgent's Main class.

        Show
        nirmal Nirmal Fernando added a comment - Community has decided that we do not require this much of flexibility in agent. So, I've reverted my above commit and committed a new implementation in ae7f9062df5b08b8ab37fa34ddaa5cb15911cb92. Now if you want to extend the Cartridge Agent, you should extend the org.apache.stratos.cartridge.agent.CartridgeAgent class and provide it as an argument to the CartridgeAgent's Main class.

          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:

              Development