[ 
https://issues.apache.org/jira/browse/STRATOS-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14326999#comment-14326999
 ] 

ASF GitHub Bot commented on STRATOS-1180:
-----------------------------------------

GitHub user chamilad opened a pull request:

    https://github.com/apache/stratos/pull/234

    [STRATOS-1180] - Yapsy based plugin architecture for PCA

    A basic plugin system where <PCA_HOME>/plugins folder can be used to drop 
plugins to be picked up by the PCA. For this I've used Yapsy[1] plugin 
framework.Yapsy is both simple and effective in enabling a plugin structure in 
Python. It is BSD licensed so there is no conflict in licensing for 
incorporating it, if the need arises. 
    
    Implementing a plugin for the PCA is simple. The plugin contract is defined 
in <PCA_HOME>/plugins/contracts.py module. To write a plugin 
contracts.ICartridgeAgentPlugin has to be extended. Additionally a plugin 
descriptor (with yapsy-plugin extension) has to be included which will describe 
and point to the plugin module file, when queried by the Yapsy framework. To 
map a plugin for a certain event, the event name has to be specified in the 
Description field. By this approach, it is possible to map more than one plugin 
to a single event and one plugin to several events. Each plugin is run in a 
separate thread, therefore, it will not be blocking the main execution.
    
    A plugin gets a dictionary with the payload parameters and any additional 
values included for specific events. This is more effective than the 
environment variables approach we had for bash scripts. 
    
    A test plugin can be found in the <PCA_HOME>/plugins which demonstrates the 
plugin architecture. This plugin is mapped to the MemberInitializedEvent and 
the ArtifactUpdatedEvent.
    
    PCA was tested in an OpenStack deployment for regression and functionality. 
    
    [1] - http://yapsy.sourceforge.net/

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/chamilad/stratos stratos-1180-01

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/stratos/pull/234.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #234
    
----
commit f4be9ce8b37f4121b461d55fd9aa0b3daf773516
Author: Chamila de Alwis <chami...@wso2.com>
Date:   2015-02-14T11:21:03Z

    PCA plugin architecture with Yapsy
    Dockerfile updated to install Yapsy
    Refactored Exceptions
    Refactored event handling
    PEP style related changes

commit 6b938f65a09c082dd6ba95830e120a2832fdc020
Author: Chamila de Alwis <chami...@wso2.com>
Date:   2015-02-14T15:19:36Z

    PCA -
    Fixed issues in plugin execution
    Added test plugin
    PEP style related changes
    Fixed import errors

commit 4c253ea2251d012f04e49e870087d08c17fe1803
Author: Chamila de Alwis <chami...@wso2.com>
Date:   2015-02-14T15:21:39Z

    PCA - fixed PEP style hints in constants module

commit 2cb93ca72e1606859fadb40d7daa968a1afeed35
Author: Chamila de Alwis <chami...@wso2.com>
Date:   2015-02-14T19:08:20Z

    PCA - A single plugin can be mapped to multiple events

commit 3528415ebc118b777837ee03e7e13647f869dd05
Author: Chamila de Alwis <chami...@wso2.com>
Date:   2015-02-19T04:58:44Z

    PCA - Yapsy based plugins - Added yapsy pip install to PCA puppet module

----


> Modify extension execution structure in Python Cartridge Agent
> --------------------------------------------------------------
>
>                 Key: STRATOS-1180
>                 URL: https://issues.apache.org/jira/browse/STRATOS-1180
>             Project: Stratos
>          Issue Type: Task
>          Components: Cartridge Agent
>            Reporter: Chamila de Alwis
>             Fix For: 4.1.0 RC1
>
>
> Currently we have bash scripts as extensions however if we could introduce a 
> python extension layer in between that would make it much easier to implement 
> extension logic.
> The current extension setup is as follows. A set of bash scripts are 
> available in the <PCA_HOME>/extensions. The file name of the extension that 
> should be executed for each event is defined in the agent configuration 
> (agent.conf in PCA, stratos.sh in JCA). The event handler executes these bash 
> scripts as new shell commands when the respective events are received.
> We can introduce a layer between the bash scripts and the python code that 
> calls them. The names of the python scripts corresponding to each event can 
> be defined as before. 
> Additionally we can extend this behavior to the Git artifact management 
> component of the PCA. The contract that the artifact management component 
> should adhere to is "checkout" and "push". We can separate the current python 
> code relating to these two operations in to two extension scripts.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to