You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Daniel Fagerstrom <da...@nada.kth.se> on 2005/06/09 00:07:11 UTC

[osgi] Initial code

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


Re: [osgi] Initial code

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 9 juin 05, à 12:04, Daniel Fagerstrom a écrit :

> ...One can use the version in Cocoon trunk, it worked with ant 1.6.2, 
> we would just need to add the BCEL to the tools/lib. Still one need to 
> add ant to PATH. If would be nice if someone who is more knowledgable 
> than I in the Cocoon build system could create a build.sh or whatever 
> is most convenient for whiteboard/osgi...

FWIW, I've modified the trunk/build.sh so that it can be called from 
other directories, it's in SVN.
The aim was to use Cocoon's ant to build the osgi stuff, but I got 
sidetracked and didn't go further.

-Bertrand

Re: [osgi] Initial code

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Upayavira wrote:

> Daniel Fagerstrom wrote:
>
>> I have committed some initial osgi code in whiteboard (whiteboard/osgi) 
>
>
> <snip/>
>
>> 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.
>
>
> Could you put your version of Ant into the whiteboard? It'd be great 
> to be able to just svn update and then build.sh or whatever.

One can use the version in Cocoon trunk, it worked with ant 1.6.2, we 
would just need to add the BCEL to the tools/lib. Still one need to add 
ant to PATH. If would be nice if someone who is more knowledgable than I 
in the Cocoon build system could create a build.sh or whatever is most 
convenient for whiteboard/osgi.

> <snip/>
>
>>
>> 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.
>
> Assuming this doesn't take much time, I'll watch and test with 
> interest. I am very curious to see how this goes.

Great!

It shouldn't take that much time to start the OSGi framework.

/Daniel


Re: [osgi] Initial code

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Upayavira wrote:
> Daniel Fagerstrom wrote:
> 
>> I have committed some initial osgi code in whiteboard (whiteboard/osgi) 
> 
> 
> <snip/>
> 
>> 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.
> 
> 
> Could you put your version of Ant into the whiteboard? It'd be great to 
> be able to just svn update and then build.sh or whatever.
what I had to do up till now:

1. copy bcel.lib to anthome/lib
2. modify bundles/cocoon/build.xml to setup other cocoon.trunk directory 
(Daniel uses cocoon.home/trunk)
3. same as 2) but for bundles/cocoon-testcase/build.xml

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Re: [osgi] Initial code

Posted by Upayavira <uv...@odoko.co.uk>.
Daniel Fagerstrom wrote:
> I have committed some initial osgi code in whiteboard (whiteboard/osgi) 

<snip/>

> 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.

Could you put your version of Ant into the whiteboard? It'd be great to 
be able to just svn update and then build.sh or whatever.

<snip/>
> 
> 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.

Assuming this doesn't take much time, I'll watch and test with interest. 
I am very curious to see how this goes.

Regards, Upayavira

Re: [osgi] Initial code

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Leszek Gawron wrote:

> Daniel Fagerstrom wrote:
>
>> 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.
>
> <snip/>
> I find the subject very interesting so I'll look into that ASAP.

Great!

>> 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.
>
> How could I help?

First by following the instructions I gave and verify that it works that 
far.

Then it depends on what aspects you feel like working on. The main plan 
this far is in the link above. Things that needs to be done besides what 
I described there are:

* Integrate the build system with Cocoons build system and preferably 
the block build system so that it rebuilds the cocoon.jar etc if needed.

* The current build system from Knoplerfish configures everything in the 
build file, it would be better to base configuration from block.xml, 
that would require some aditions to block.xml (or some other 
configuration file), for handling package level export and import and 
the internal bundle classpath (used when the bundle contains library jars).

* Better development environment: remove current wrinkle and make it as 
easy to use as possible, test the desktop from Knoplerfish, find out how 
to develop bundles in Eclipse, etc.

Other things that would be interesting to start looking at:

* Component management under OSGi. Whithin blocks I guess we will 
continue to use our current set of mechanisms, but between the blocks it 
is better to publish component containers as OSGi services. Then e.g. 
the BlocksManager could connect to the component container services and 
make them available through the local ECM++ through the usual service 
mechanism. Here one could see if there already are some Spring, Hivemind 
etc bundles (or plugins) that we could use or get isnpiration from.

* Logging management, OSGi have some kind of standardised logging 
service, what does it do? would it be interesting to connect our logging 
system to the logging service?

* URL management, OSGi have a URL service that makes user defined 
schemes available though java.net.URL IIUC, could we connect our 
Excalibur Sources to this mechanism?

* Should we package some of the libreraries we use in core and at other 
places and import them through OSGi to the Cocoon core bundle etc. What 
about having API and interface bundles?

And numerous other things that we will find out when we start to work 
with it.

So it is up to you, what do you want to work on?

/Daniel


Re: [osgi] Initial code

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Daniel Fagerstrom wrote:
> 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.
<snip/>
I find the subject very interesting so I'll look into that ASAP.

> 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.
How could I help?

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Re: [osgi] Initial code

Posted by Sylvain Wallez <sy...@apache.org>.
Daniel Fagerstrom wrote:

> 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.


Great! Definitely interesting and I'll have a look at this as time permits.

Thanks!

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director