How to bundle a Sevlet in OpenAnzo

5 views
Skip to first unread message

Busa

unread,
Jun 29, 2009, 4:27:11 AM6/29/09
to OpenAnzo
Hi all Open Anzo.
My question this time is if there's a guide or tutorial on how to keep
a servlets as bundle in the osgi framework of OpenAnzo.
In other worrds...what are the steps to follow to add a bundle to
OpenAnzo? In specific at the moment I'm interecsted in adding a
servlet version of some command line interface ....

Thanx again.

Busa.

Simon Martin

unread,
Jun 29, 2009, 5:59:21 AM6/29/09
to open...@googlegroups.com
Hi Busa,

I can answer this in more detail when I get time but I thought I would
point out the Binary Store Servlet in the openanzo source (look at the
org.openanzo.binarystore project) as it might help you get started more
quickly. This is a servlet we have added in order to add binary data to
the server - I think it would be a good template to follow for what you
want as it is a reasonably self contained project providing services to
the osgi server and also uses an anzo client in the servlets
implementation. I would think that the activator
(org.openanzo.binarystore.server.Activator) is pretty much a boiler
plate for what you want to do and
org.openanzo.binarystore.server.BinaryStoreServlet is just a regular
servlet instantiated with a pool of Anzo clients which can be used to
access the store. The other thing to point out would be the manifest.mf
which has a property in it pointing at the Activator class (this is
standard osgi) - so that the osgi server knows what class in the bundle
to activate on startup.

We generally use eclipse as our development environment which make
setting up the osgi bundles very easy. Each osgi bundle is an eclipse
project. There are also launchers in eclipse which launch an sogi server
with all of the configured required bundles. All of the porjetcs in our
open source svn server are set up as osgi project bundles and can be
imported into eclipse.

Once you have looked at it let me know if you have any specific
questions about it .

Simon.

Busa

unread,
Jun 29, 2009, 7:06:38 AM6/29/09
to OpenAnzo
Thanx Simon!
I think that some documentation about that will be very useful to let
extending Anzo Middleware and taking real advanteages from this kind
of platform!
I look to this project as the main starting point for building
semantical enterprise application...therefore ease extending the
middleware is a main point of interects, I think! :-)

For the moment I'll follow your suggestion and I'll take a look
toorg.openanzo.binarystore project using Eclipse (that is my favorite
IDE).
So...just one question about importing the osgy project or creating a
new one in eclipse: I need a particular plugin to create osgi project
and setting up osgi servers?
If yes can tell me what's the right one?

Thax again,
Busa.

Matthew Roy

unread,
Jun 29, 2009, 10:02:28 AM6/29/09
to open...@googlegroups.com
Hi Busa,
You can look at the updated wiki at
http://www.openanzo.org/projects/openanzo/wiki/OpenAnzoFromSource which
explains how to setup an eclipse workspace to develop OpenAnzo. If you
follow these instructions, I would highly recommend creating a new
workspace specifically for OpenAnzo, since it depends on using a target
platform, which may affect other projects you may already have in your
current workspace. Once you have the new workspace setup for OpenAnzo,
I would look org.openanzo.servlet.sparql project as an example of a
basic servlet that uses an anzoclient to run sparql queries. I don't
have a formal document on how to create a new project, but I can explain
how I create new projects when I need them:
* copy an existing project, say org.openanzo.servlet.sparql to org.openanzo.servlet.busa.
* Delete all the .svn subdirectories within that new project, (in linux I do
cd rg.openanzo.servlet.busa
find -iname ".svn" -exec rm -rf {} \;
windows I think you would just have to do threw explorer.
)
* Edit the .project file and change the project name from sparql to busa
* edit the pom.xml file and change sparql to busa
* Import as existing project into eclipse

I will try to generate a generic pom.xml that will work independent from
the overall OpenAnzo maven build process, but if you want to build you
would need to add your new project into the openanzo-maven/pom.xml and
then you can build openanzo including your new project with maven using:
mvn package, which will create the distribution files.

Hope that provides some pointers for getting started.
Matt

Busa

unread,
Jun 29, 2009, 10:09:37 AM6/29/09
to OpenAnzo
This is really helpful for me! I'll follow this teps...

But just let me another question. A t the momento there's no way to
build a bundle without having to rebuil all the Anzo project? In this
way a could build in Eclipse the single bundle and "deploy" it on my
Anzo Server OSGI framework...didn't it?

Thax,
Busa.

Matthew Roy ha scritto:

Jordi Albornoz Mulligan

unread,
Jun 29, 2009, 10:11:47 AM6/29/09
to open...@googlegroups.com
Matthew Roy wrote:
...

> I don't
> have a formal document on how to create a new project, but I can explain
> how I create new projects when I need them:
> * copy an existing project, say org.openanzo.servlet.sparql to org.openanzo.servlet.busa.
> * Delete all the .svn subdirectories within that new project, (in linux I do
> cd rg.openanzo.servlet.busa
> find -iname ".svn" -exec rm -rf {} \;
> windows I think you would just have to do threw explorer.
> )

Just a tip. If you use SVN "export" to copy the project, then you won't
have any .svn directories to remove. In the Eclipse SVN Team Provider
plugin (formerly called Subversive), you can do an export by
right-clicking on the project and choosing Team -> Export....

--
Jordi Albornoz Mulligan
Founding Engineer - Cambridge Semantics
jo...@cambridgesemantics.com
(617) 401-7321

Matthew Roy

unread,
Jun 29, 2009, 10:28:41 AM6/29/09
to open...@googlegroups.com
It is possible to export a bundle from eclipse as a bundle I think. You
would goto export, go to the Plugin-Development section and choose
Deployable plug-ins and fragments and choose the bundle to export. You
may get an error dialog that says there were errors in a log file, but
that should be ok. That will result in bundle, and you can copy that
exported bundle into the openanzo/plugins/addons directory.

Matt
Reply all
Reply to author
Forward
0 new messages