Hi Sanjiva, On Mar 11, 2014 4:19 AM, "Sanjiva Weerawarana" <[email protected]> wrote: > > Why do we need to make it so complicated?
Hmmm... it's not complicated... by default you can simply use the default flow. Do you still feel it's complicated. Can u give an example of using this power? > As an example, earlier the Cartridge Agent was always expecting that Cartridges opens up ports and depending on that only agent decides whether the member is activated or not. AFAIK there are some applications which does not deal with ports eg: nodejs by default doesn't open any ports, but you could deploy an app which opens up a listener port. (Correct me if I am wrong.) Hence, we need to customize the flow based on the Cartridge. > Also, I assume this is not for 4.0.0 right? Its a bad idea to make changes like this at this stage give (IIRC) we're done with alpha? In fact alpha is supposed to be feature complete ... This is an improvement to an existing feature (cartridge agent). Mainly a refactoring effort. > > Sanjiva. > > > On Mon, Mar 10, 2014 at 8:19 PM, Nirmal Fernando <[email protected]> wrote: >> >> Hi Paul, >> >> The configuration file I have sent in the first email, is a sample on how you build the Agent's work-flow. Hope that helps. >> >> >> On Mon, Mar 10, 2014 at 6:03 PM, Paul Fremantle <[email protected]> wrote: >>> >>> It would be useful if you could give some examples of how this would be configured for existing cartridges to give an idea of how the plug points are. >>> >>> Paul >>> >>> >>> On 10 March 2014 08:55, Nirmal Fernando <[email protected]> wrote: >>>> >>>> Another important thing I missed in the previous email is the execution order. Cartridge Agent is fully respect the order you specify in the configuration file. >>>> >>>> As an example; in the Initializing phase of the sample configuration, StartListenersExtensionExecutor will run before ScriptExtensionExecutor. >>>> >>>> Also, in the ScriptExtensionExecutor scripts will be executed in the order you specify. >>>> >>>> >>>> On Mon, Mar 10, 2014 at 2:20 PM, Nirmal Fernando < [email protected]> wrote: >>>>> >>>>> 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. >>>>> >>>>> >>>>> >>>>> 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 >>>>> >>>>> ________________________________________________________________________________________________ >>>>> >>>>> >>>>> 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/ >>>> >>>> >>>> >>>> >>>> -- >>>> Best Regards, >>>> Nirmal >>>> >>>> Nirmal Fernando. >>>> PPMC Member & Committer of Apache Stratos, >>>> Senior Software Engineer, WSO2 Inc. >>>> >>>> Blog: http://nirmalfdo.blogspot.com/ >>> >>> >>> >>> >>> -- >>> Paul Fremantle >>> CTO and Co-Founder, WSO2 >>> OASIS WS-RX TC Co-chair, Apache Member >>> >>> UK: +44 207 096 0336 >>> US: +1 646 595 7614 >>> >>> blog: http://pzf.fremantle.org >>> twitter.com/pzfreo >>> [email protected] >>> >>> wso2.com Lean Enterprise Middleware >>> >>> Disclaimer: This communication may contain privileged or other confidential information and is intended exclusively for the addressee/s. If you are not the intended recipient/s, or believe that you may have received this communication in error, please reply to the sender indicating that fact and delete the copy you received and in addition, you should not print, copy, retransmit, disseminate, or otherwise use the information contained in this communication. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. >> >> >> >> >> -- >> Best Regards, >> Nirmal >> >> Nirmal Fernando. >> PPMC Member & Committer of Apache Stratos, >> Senior Software Engineer, WSO2 Inc. >> >> Blog: http://nirmalfdo.blogspot.com/ > > > > > -- > Sanjiva Weerawarana, Ph.D. > Founder, Chairman & CEO; WSO2, Inc.; http://wso2.com/ > email: [email protected]; office: (+1 650 745 4499 | +94 11 214 5345) x5700; cell: +94 77 787 6880 | +1 408 466 5099; voip: +1 650 265 8311 > blog: http://sanjiva.weerawarana.org/; twitter: @sanjiva > Lean . Enterprise . Middleware
