tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Deryck" <deryck.br...@ziebel.biz>
Subject RE: Dynamically deploying to an embedded OpenEJB server within an Eclipse RCP application
Date Wed, 04 Feb 2009 09:52:55 GMT
Hi David and Donatas,

I've been working some more on creating an OpenEJB plug-in that would
allow applications held in other plug-ins to be deployed when their
plug-in is activated.

This is based on a single OpenEJB server plug-in that contains all of
the OpenEJB libraries and some additional classes to activate and manage
the deployment of other applications.

I've managed to get some examples working, and thought it would be good
to share my efforts with you so far.

The attached Zip file contains three Eclipse projects, the server
plug-in and a simple EchoServer stateless bean application and a client.

The server plug-in I've created allows for deployment when a plug-in
registers a new OpenEjbApplication as a service. The OpenEJB server
plug-in listens for service requests and automatically deploys and
undeploys an application when the service starts and stops.

The only problem with this approach is making sure the application
plug-in is activated before the client tries to use it (e.g., by making
a context lookup). This is handled in the activation code of the client
by forcing the application plug-in to start.

The code I've written allows additional application properties to be
included as part of the normal Eclipse service creation. You can get the
OpenEJB server plug-in to load properties from files included in the
application plug-in and any fragments (I use META-INF/openejb.properties
in my EJB plug-in). Because of the Eclipse plug-in/fragment arrangement,
if you include a file with the same name in a fragment, its properties
will override those found in the host plug-in. However, the order of
fragment processing is undefined, and so you cannot reliably override
properties between fragments.

Also, the properties are processed using the Eclipse variables API to
handle string substitution, so that, for example, a property can include
${user.home} and get this expanded before it is passed to the OpenEJB
server. I automatically add all System.getProperties() to the variables
available, as well as any properties added by the application.

I need this overriding and substitution to allow my test fragment
project to override the database URL of the main EJB plug-in to use a
different test database, and to have the database location depend on the
user's home directory.

To get the example working, you will need to create a folder in the
openejb.server project that is a link to the OpenEJB 3.1 lib folder in
the distribution. Also, make sure that all of the OpenEJB libraries are
included in the project build path and exported by the project.

You are likely to have many more questions about this code than I've
provided answers to in this short email, but I thought it was time share
where I have reached so far.

Regards,
Deryck

-- 
Dr Deryck F Brown
Software Engineer
Ziebel UK Ltd
Unit A, Broadfold Road,
Bridge of Don,
Aberdeen AB23 8EE
 
Tel: 01224 227227 (X143)
Fax: 01224 703146
Skype: ziebel-deryckb
Web: www.ziebel.biz 


Mime
View raw message