So, I've been playing with ruby on and off now for about 2-3 months. After going through the pick axe book and a rails book I have pretty much set it down, mostly so I could focus on some Java issues at work.
After our last release the Java work has settled down and now my interest in Ruby has once again returned, not Rails so much (However, I do think that the Java Community has a lot to learn from Rails though). So here is the problem I had...
The company that I work for is completely in love with EJBs (2.1). We use them with Spring so it's not as bad as it might sound. Anyway to stub out an EJB it takes about an hour. That is without any methods that actually do something.
So just in the event that you 're working on an application server that doesn't support JEE 5 or higher (I think that is the write acronym - they keep changing) here are the things you need (this is the spring version so there are a few extra interfaces in there to make it more fun):
Server Side Components
- The implementation that does something. This should extend the interface in the client
- The EJB that implements the interface in the client and and Spring's AbstractStatelessSessionBean
Client Side Components
- The interface that defines what is supposed to happen
- The LocalHome interface this guy extends EJBLocalHome and simply has a create() method
- The Local interface this guy extends our interface and EJBLocalHome. Oddly enough he has no methods (spring takes care of it for us).
- The Remote interface he extends EJBObject and has the same method signatures as the interface (unless you don't want them exposed through remote objects)
- The RemoteHome interface that extends the EJBHome he has one method method called create()
So to hand code all of these things correctly takes me around an hour more or less depending on distractions. So here is a fancy little ruby script that will prompt you for package names implementation names and a few other things and generate those guys for you. Of course you will still need to configure the spring files and ejb-jar.xml file as well as whatever custom config files your appserver needs but it was a fun task to do with Ruby.
-Aaron
No comments:
Post a Comment