Purpose
The Appcelerator framework allows for the extension of the build and deployment process so that you can add components and modify the behavior of your service implementations. It is quite powerful and not only restricted to services, plugins for example could span across to the modification of applications and the entire build and deployment process for that matter. For simplicity, this article will identify how to create a new component added to our java service for monitoring performance.
Install Appcelerator
I’ve assumed that you’ve successfully downloaded and installed Appcelerator from http://www.appcelerator.org/products. Once you’ve gone through the installer you can get the java service
1 | app install:service java |
You may want to get an existing plugin (I needed the java:spring plugin to implement my plugin):
1 | app install:plugin java:spring |
Plugin Creation
Lets assume that our plugin is going to be called java:perf, to create the plugin project:
1 2 | cd $HOME/workspace app create:plugin . java:perf |
This will create a sub directory named java_perf, now you will want to create a proper license entry in your build.yml for example check out build.yml. You now have the opportunity to modify the entry points in your java_perf.rb. I personally wanted to setup my install script so that:
- it dynamically builds the jar when we add the plugin to a project
- modifies the spring.xml to include the bean entries for my component
All of this is in before_add_plugin(event) callback. If you want to see where this is called, check out add_plugin.rb. Once my coding is complete (added my source files to java_perf/src), I created the plugin distribution:
1 | rake zip |
Install the plugin
As you noticed, I haven’t covered debugging the plugin just yet, this is because I want to first set up the plugin for installation and then work with it in my install directory. Lets install it to the local machine:
1 | app install:plugin java_perf.zip |
Add the plugin to my project
I thought that I’d create a blank java project real quick
1 2 | cd workspace app create:project . myproject java |
now we can add the spring plugin and our new java:perf plugin to our project
1 2 3 | cd myproject app add:plugin java:spring app add:plugin java:perf |
You can now directly modify the java_perf.rb file in your install directory
- windows: c:/Program Files/Appcelerator/releases/plugin/java_perf/1.0
- unix: /usr/local/Appcelerator/releases/plugin/java_perf/1.0
- mac os: /Library/Appcelerator/releases/plugin/java_perf/1.0
I suggest that you continue to modify the java_perf.rb this way to debug it and then finalize by copying back over to $HOME/workspace/java_perf
Next Steps
As a final parting you can release your new plugin so that others may be able to leverage it
1 2 | cd $HOME/workspace/java_perf app release java_perf.zip |
-andrew
this article is cross posted at:
http://zuerchtech.com/2008/3/4/implementing-an-appcelerator-plugin
Popularity: 5% [?]












{ 2 trackbacks }
{ 3 comments… read them below or add one }
What I love about the plugin framework is that:
* the commandline tool is SUPER fast
* writing build scripts in Ruby is a perfect fit for the build and deployment process (interpreted and powerful)
* the power of extension – hooks exist in a lot of places
* its a truly component framework allowing for packaging
* a developer community to help share the wealth
I’m really geared up to see what plugins the community develops
As a note for the next steps, internet based distribution is not enabled, this will be available in the next release. This means that if you choose to share your plugins you must find a way to provide someone with the zip or have them build it themselves and install locally with
app install:plugin java_perf.zip
As identified above
Note that you may want to check out the discussion group for more details:
Plugin Developers