SoC – First Release – Eclipse Plugins in PHP
After six weeks I have a release to show, this is something I can really call alpha quality
. Keep on reading to get the details. Firstly how to get the plugin
- You must have Java 6 installed for the scripting support (I need to verify it works with < Eclipse 3.3)
- Update site url http://tom.jabber.ee/phpengine/update-site/
- SVN url http://eclipse-incub.svn.sourceforge.net/viewvc/eclipse-incub/plugins_in_php/
- Module org.eclipse.soc2007.phpscriptengine
- Module update-site
- The info is more up-to-date on my wikipage.
What can you do with the plugin?
Firstly map PHP functions to Java methods. The approach is to create an interface.
public interface HelloWorld extends Scriptable {
@ScriptableAnnotation(
fileName="helloWorld.php",
output="true")
String getHelloWorld(String rtrn);
}
Implement the interface with method stubs that return the argument (I’m invoking the methods with return values as arguments). Get a proxy for the object implementing the interface
HelloWorld helloWorld = (HelloWorld)ScriptUtil.registerProxy(
objectImplementingTheInterface,
HelloWorld.class,
classLoaderThatFindsThePath);
And using the interface as you would. Right now you have to read the source code for more comments. I’ve actually documented it to some extent. To get a quick and dirty example see the “Mapping PHP Functions to Java Methods” (step-by-step tutorial) wiki page.
Secondly using some simple PHP developing aids. See the “Facilities Provided by the Plugin” again on the wiki.
The plugin comes with the Quercus ScriptEngine jar inside the plugin. It is compiled from trunk and has the support for MySql (you still have to download the MySql JDBC connector yourself). I’ve proposed a solution/patch to the issue I was ranting about in the last post. No GD support yet but I’ll get around to that soon.
Hopefully next releases will come quicker. I’ve automated the building of the update-site. So it is easy to even produce pseudo releases
.
Where to now? Oh boy, there is so much more work to do:). Here is a list of ideas/problems that I will be dealing with to produce an actual integration plugin:
- Provide a cleaner API for users.
- Implement invoking PHP functions/methods/multiple arguments etc.
- As PHP is somewhat different (also thanks to Quercus) than other scripting languages also provide support for JavaScript
- Development aids (when writing interfaces autocomplete for PHP functions/methods/objects etc.)
- Work on Quercus source code to solve issues that are bugging me (GD, logging exception when certain J2EE classes missing, etc.)
- Sample plugin mostly in PHP
- See if and how much I duplicate with PDT Project
- Bugfixes, bugfixes & bugfixes
Any feedback is appreciated. Go download the plugin, update your J2SE instance and go wild
Permalink Comments off
. Sample is taken from