I have committed some initial osgi code in whiteboard (whiteboard/osgi) so that we can start experiment with a microkernel based Cocoon, http://marc.theaimsgroup.com/?t=111659646800003&r=1&w=2.

This far we have the following:

OSGi
====

I decided to use the OSGi framework from http://www.knopflerfish.org/ because it seemed easy to get going with and lightweight. It would have been nice to use the OSGi framework from Eclipse, but I didn't find any good documentaion and I wanted to start doing something. This is not such a big deal anyway, most of our work will be on the bundles, and we should make them work in any OSGi container.

Use
---

For testing it you should check out https://svn.apache.org/repos/asf/cocoon/whiteboard/osgi in the same directory as the Cocoon trunk. The OSGi kernel is started by cd to the osgi directory and:

$ java -jar framework.jar

The first time you execute this the commands in init.xargs will be executed. It will download a minimal set of bundles for getting a tty console so that one can interact with the framework. Take a look at http://www.knopflerfish.org/download.html for more details. I wanted a rather minimal environment, you can download a more complete distro from knopflerfish and use a init scripts that install and start a gui and some other stuff as well.

My start script also install and start a JUnit bundle. I put it in the SVN to be able to refer to classes in it. When the framework is started next time it will use restart.xargs instead and continue where you stoped it. If you want to start from scartch you either remove the directory fwdir or use the swithch -init, (-help for other options).

Write "help" in the console to get a command listing and https://www.knopflerfish.org/svn/knopflerfish.org/trunk/osgi/bundles/console/readme.txt and http://www.knopflerfish.org/programming.html for more info.

I sat file:jars/ as current directory in init.xargs so bundle URLs is relative to that, but it can be changed by cd.

Build system
============

I just copied the build system from knopflerfish and changed some default params, take a look in the ant directory and read http://www.knopflerfish.org/programming.html for more info. To use it you need a rather new ant (don't know which is the minimal version) with http://jakarta.apache.org/bcel in $ANT_HOME/lib.

You can build all the bundles by using ant in the top directory or compile then individually in the bundles/* directories.

I used the knopflerfish build system to get something that worked without to much work. But we should replace it with something that is better integrated with Cocoon's build system and the block build system ASAP.

Bundles
=======

The source code is in bundles, take a look at the build file for configuration info. When build the bundle will be placed in jars and the manifest file can be seen in out.

test
----

A "hello world" bundle.

> enter framework
framework> install test/test-1.0.0.jar
framework> start test
framework> stop test
( > update test - if you change the bundle and start it again)
framework> uninstall test

cocoon
------

The cocoon bundle is a passive library bundle (see http://marc.theaimsgroup.com/?t=111659646800003&r=1&w=2 for the design I aim at). It contains cocoon.jar and all libraries in lib/core and lib/endorsed. I just manually exported the packages I needed.

Puting everything in one bundle is not such a great idea. We should have separate bundles for many of the jars in core and endorsed.

Install the bundle with:

framework> install cocoon/cocoon_all-1.0.0.jar

cocoon_testcase
---------------

Here I try to use the cocoon bundle and run the block manager test cases from cocoon-test.jar. This bundle also depend on the junit bundle, see https://www.knopflerfish.org/svn/knopflerfish.org/trunk/osgi/bundles_opt/junit/readme.txt for details. It installs a test service when started.

framework> install cocoon_testcase/cocoon_testcase-1.0.0.jar
framework> start cocoon_testcase
framework> enter junit
junit> help
...
junit> run org.apache.cocoon.test.components.blocks.BlocksManagerTestCase
...

But it doesn't work yet, I do some tricks in the base class of the BlocksManagerTestCase, SitemapTestCase, to get the context URL for the test sitemap and files. And there are some subtilities with loading resources from bundles that I don't understand all the details of yet.

                 --- o0o ---

My plan is to continue along whats outlined in http://marc.theaimsgroup.com/?t=111659646800003&r=1&w=2. It would be more fun to work together on this, I would apprciate any involvement.

/Daniel

Reply via email to