You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Rodrigo Madera <ro...@gmail.com> on 2007/09/11 13:51:32 UTC

OSGi Best Practices

Hello community,

I see that OSGi has some lack of documentation out there when it comes to
best practices and examples (or I'm not knowing where to look).

Would any of you have a good book recommendation on practical OSGi?

Also, what is the recommended way of doing authentication and authorization?

Thanks for any input,
Rodrigo

Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
I'll take a look at your tips and I'll reply here.

About the book, of course you can always make some time for that!!
What do you currently do from midnight to six?

I would definitely buy a copy ;-)

Thanks,
Rodrigo

On 9/11/07, Marcel Offermans <ma...@luminis.nl> wrote:
>
> Hello Rodrigo,
>
> On Sep 11, 2007, at 18:08 , Rodrigo Madera wrote:
>
> > Thanks guys, but I still think that's not enough.
> > I believe you also agree.
>
> I agree, it's not enough, and to be honest I would love to have the
> time to write a book. :) Tom's suggestion about the white board
> pattern actually is a very valuable one, btw!
>
> > How would you guys recommend implementing i18n support for an
> > application
> > that is modularized? Create a service that translates? Like
> > MyAppInternationalization, with
> > methods such as getMessage(). Or do you have a better approach?
>
> There are two questions regarding modularization that come to mind:
> 1. Do individual modules have new strings that need translation, or
> is there only one module that contains all these strings?
> 2. Do you want to be able to plug in new languages or is the set of
> languages fixed?
>
> If you look at the OSGi specification, they use fragment bundles to
> add translations to modules that need translating. In general, that
> would be my advice.
>
> On the other hand, I've used a service in the past too (either one
> service, or multiple ones). A third option is to use a listener that
> listens to bundles and inspects their manifest to check if they have
> specific properties (something indicating this bundle contains
> property files with translations).
>
> > Also, where can I find more examples?
>
> I'm sure you already googled, there are quite a few articles and
> snippets of documentation around. Are you looking for anything specific?
>
> Greetings, Marcel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: OSGi Best Practices

Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Rodrigo,

On Sep 11, 2007, at 18:08 , Rodrigo Madera wrote:

> Thanks guys, but I still think that's not enough.
> I believe you also agree.

I agree, it's not enough, and to be honest I would love to have the  
time to write a book. :) Tom's suggestion about the white board  
pattern actually is a very valuable one, btw!

> How would you guys recommend implementing i18n support for an  
> application
> that is modularized? Create a service that translates? Like  
> MyAppInternationalization, with
> methods such as getMessage(). Or do you have a better approach?

There are two questions regarding modularization that come to mind:
1. Do individual modules have new strings that need translation, or  
is there only one module that contains all these strings?
2. Do you want to be able to plug in new languages or is the set of  
languages fixed?

If you look at the OSGi specification, they use fragment bundles to  
add translations to modules that need translating. In general, that  
would be my advice.

On the other hand, I've used a service in the past too (either one  
service, or multiple ones). A third option is to use a listener that  
listens to bundles and inspects their manifest to check if they have  
specific properties (something indicating this bundle contains  
property files with translations).

> Also, where can I find more examples?

I'm sure you already googled, there are quite a few articles and  
snippets of documentation around. Are you looking for anything specific?

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
Thanks guys, but I still think that's not enough.
I believe you also agree.

How would you guys recommend implementing i18n support for an application
that is modularized?
Create a service that translates? Like MyAppInternationalization, with
methods such as getMessage().

Or do you have a better approach?

Also, where can I find more examples?

Thanks,
Rodrigo


On 9/11/07, Tom Remoleur <to...@ulp.u-strasbg.fr> wrote:
>
> This document can be useful, it presents white board pattern and has
> exemples :
> http://www.osgi.org/documents/osgi_technology/whiteboard.pdf
>
> Regards,
> Tom
>
> On Tue, 11 Sep 2007 14:00:33 +0200, Marcel Offermans
> <ma...@luminis.nl> wrote:
>
> > On Sep 11, 2007, at 13:51 , Rodrigo Madera wrote:
> >
> >> I see that OSGi has some lack of documentation out there when it comes
> >> to
> >> best practices and examples (or I'm not knowing where to look).
> >
> > I'm sure you looked at the website, which does include an increasing
> > number of pages that document Felix and OSGi in general. It includes a
> > couple of examples (for example http://felix.apache.org/site/apache-
> > felix-application-demonstration.html). It also has the sheets of a
> > presentation I gave at ApacheCon in Dublin about OSGi best practices
> > (http://felix.apache.org/site/presentations.html).
> >
> >> Would any of you have a good book recommendation on practical OSGi?
> >
> > There are hardly any books available on OSGi. None I would particularly
> > recommend.
> >
> >> Also, what is the recommended way of doing authentication and
> >> authorization?
> >
> > I would definitely recommend looking at UserAdmin there. It defines a
> > basic API for setting up and using role based access control. Using this
> > standard service allows you to choose from different implementations
> > (either a self-contained, light weight one, or for example one backed up
> > by the Apache Directory Server). How to actually hook it up to the rest
> > of your application largely depends on that application, so if you want
> > further advice then tell us a bit more about what you're trying to do
> > here.
> >
> > Greetings, Marcel
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: OSGi Best Practices

Posted by Tom Remoleur <to...@ulp.u-strasbg.fr>.
This document can be useful, it presents white board pattern and has  
exemples :
http://www.osgi.org/documents/osgi_technology/whiteboard.pdf

Regards,
Tom

On Tue, 11 Sep 2007 14:00:33 +0200, Marcel Offermans  
<ma...@luminis.nl> wrote:

> On Sep 11, 2007, at 13:51 , Rodrigo Madera wrote:
>
>> I see that OSGi has some lack of documentation out there when it comes  
>> to
>> best practices and examples (or I'm not knowing where to look).
>
> I'm sure you looked at the website, which does include an increasing  
> number of pages that document Felix and OSGi in general. It includes a  
> couple of examples (for example http://felix.apache.org/site/apache- 
> felix-application-demonstration.html). It also has the sheets of a  
> presentation I gave at ApacheCon in Dublin about OSGi best practices  
> (http://felix.apache.org/site/presentations.html).
>
>> Would any of you have a good book recommendation on practical OSGi?
>
> There are hardly any books available on OSGi. None I would particularly  
> recommend.
>
>> Also, what is the recommended way of doing authentication and  
>> authorization?
>
> I would definitely recommend looking at UserAdmin there. It defines a  
> basic API for setting up and using role based access control. Using this  
> standard service allows you to choose from different implementations  
> (either a self-contained, light weight one, or for example one backed up  
> by the Apache Directory Server). How to actually hook it up to the rest  
> of your application largely depends on that application, so if you want  
> further advice then tell us a bit more about what you're trying to do  
> here.
>
> Greetings, Marcel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGi Best Practices

Posted by Marcel Offermans <ma...@luminis.nl>.
On Sep 11, 2007, at 13:51 , Rodrigo Madera wrote:

> I see that OSGi has some lack of documentation out there when it  
> comes to
> best practices and examples (or I'm not knowing where to look).

I'm sure you looked at the website, which does include an increasing  
number of pages that document Felix and OSGi in general. It includes  
a couple of examples (for example http://felix.apache.org/site/apache- 
felix-application-demonstration.html). It also has the sheets of a  
presentation I gave at ApacheCon in Dublin about OSGi best practices  
(http://felix.apache.org/site/presentations.html).

> Would any of you have a good book recommendation on practical OSGi?

There are hardly any books available on OSGi. None I would  
particularly recommend.

> Also, what is the recommended way of doing authentication and  
> authorization?

I would definitely recommend looking at UserAdmin there. It defines a  
basic API for setting up and using role based access control. Using  
this standard service allows you to choose from different  
implementations (either a self-contained, light weight one, or for  
example one backed up by the Apache Directory Server). How to  
actually hook it up to the rest of your application largely depends  
on that application, so if you want further advice then tell us a bit  
more about what you're trying to do here.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGi Best Practices

Posted by Marcel Offermans <ma...@luminis.nl>.
On Sep 14, 2007, at 23:36 , Rodrigo Madera wrote:

> Are you sure you can't manage to write a book?

At the moment, quite sure ;)

> Well, at least help me understand this OSGi jargon a little bit more:
>
> Fragments are bundles that are attached to a host bundle by the  
> Framework.
> Attaching is done as part of resolving: the Framework appends the  
> relevant
> definitions of the fragment bundles to the host's definitions  
> before the
> host
> is resolved. Fragments are therefore treated as part of the host,  
> including
> any
> permitted headers; they must not have their own class loader.  
> Fragments
> must have their own Protection Domain.
>
> Can you please clarify the portions in red?
>
> 1) Host Bundle. WT* is it?

The host bundle is the bundle you attach the fragment bundle to. For  
example, let's say you have a bundle that contains a Swing UI, and  
for this UI you want to provide several translations. The UI itself  
will be the "host bundle" and every language can be packaged as a  
"fragment bundle". You can attach zero or more fragments to this host.

> 2) Before the host is resolved? What do you mean?

Bundles have a life cycle. They first get installed, then resolved,  
starting, active, etc. In the example above, the host bundle and all  
fragments are effectively "merged into one bundle" and then that  
resulting bundle is resolved. Resolving means that all import package  
statements are evaluated and wired up. A bundle can only be resolved  
if all imports are actually available.

> 3) Part of the host... but what is a host in the first place?!?

as mentioned above... :)

> Thanks for saving me some hair, if possible,

lol :)

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
Are you sure you can't manage to write a book?

Well, at least help me understand this OSGi jargon a little bit more:

Fragments are bundles that are attached to a host bundle by the Framework.
Attaching is done as part of resolving: the Framework appends the relevant
definitions of the fragment bundles to the host's definitions before the
host
is resolved. Fragments are therefore treated as part of the host, including
any
permitted headers; they must not have their own class loader. Fragments
must have their own Protection Domain.

Can you please clarify the portions in red?

1) Host Bundle. WT* is it?

2) Before the host is resolved? What do you mean?

3) Part of the host... but what is a host in the first place?!?

Thanks for saving me some hair, if possible,
Rodrigo

On 9/14/07, Marcel Offermans <ma...@luminis.nl> wrote:
>
> On Sep 14, 2007, at 23:23 , Rodrigo Madera wrote:
>
> > I have the core and modules specification version 4.
> > In fact, I have some PDFs on the subject.
> >
> > But those words are too "RFCty"... if you know what I mean...
> > It get's hard for starting up in the "ways of the OSGi".
> >
> > I guess I'll have to get a strong cup of coffee and go over it again.
>
> Sometimes, there is no other way! :)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
If Jack Bauer had been a Spartan, the movie would have been called "1".

Re: OSGi Best Practices

Posted by Marcel Offermans <ma...@luminis.nl>.
On Sep 14, 2007, at 23:23 , Rodrigo Madera wrote:

> I have the core and modules specification version 4.
> In fact, I have some PDFs on the subject.
>
> But those words are too "RFCty"... if you know what I mean...
> It get's hard for starting up in the "ways of the OSGi".
>
> I guess I'll have to get a strong cup of coffee and go over it again.

Sometimes, there is no other way! :)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
I have the core and modules specification version 4.
In fact, I have some PDFs on the subject.

But those words are too "RFCty"... if you know what I mean...
It get's hard for starting up in the "ways of the OSGi".

I guess I'll have to get a strong cup of coffee and go over it again.

Thanks,
Rodrigo

On 9/14/07, Marcel Offermans <ma...@luminis.nl> wrote:
>
> Hello Rodrigo,
>
> On Sep 14, 2007, at 19:42 , Rodrigo Madera wrote:
>
> > Do you have an example on i18n using Fragment Bundles?
> > Also, what is their exact definition?
>
> For both the definition and an example of using fragment bundles, I
> would like to refer you to the OSGi R4.1 core specification. You can
> download that on the http://www.osgi.org/ website and chapter 3.14
> both defines fragment bundles and explains the i18n use case.
>
> To quote a few lines from that chapter: "Fragments are bundles that
> are attached to a host bundle by the Framework. Attaching is done as
> part of resolving: the Framework appends the relevant definitions of
> the fragment bundles to the host's definitions before the host is
> resolved. Fragments are therefore treated as part of the host,
> including any permitted headers; they must not have their own class
> loader. Fragments must have their own Protection Domain.
>
> A key use case for fragments is providing translation files for
> different locales. This allows the translation files to be treated
> and shipped independently from the main application bundle."
>
> Greetings, Marcel
>
>


-- 
If Jack Bauer had been a Spartan, the movie would have been called "1".

Re: OSGi Best Practices

Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Rodrigo,

On Sep 14, 2007, at 19:42 , Rodrigo Madera wrote:

> Do you have an example on i18n using Fragment Bundles?
> Also, what is their exact definition?

For both the definition and an example of using fragment bundles, I  
would like to refer you to the OSGi R4.1 core specification. You can  
download that on the http://www.osgi.org/ website and chapter 3.14  
both defines fragment bundles and explains the i18n use case.

To quote a few lines from that chapter: "Fragments are bundles that  
are attached to a host bundle by the Framework. Attaching is done as  
part of resolving: the Framework appends the relevant definitions of  
the fragment bundles to the host’s definitions before the host is  
resolved. Fragments are therefore treated as part of the host,  
including any permitted headers; they must not have their own class  
loader. Fragments must have their own Protection Domain.

A key use case for fragments is providing translation files for  
different locales. This allows the translation files to be treated  
and shipped independently from the main application bundle."

Greetings, Marcel


Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
Marcel,

Do you have an example on i18n using Fragment Bundles?
Also, what is their exact definition?

Thanks,
Rodrigo

On 9/13/07, Rodrigo Madera <ro...@gmail.com> wrote:
>
> Can you provide an example (very simple one) on UserAdmin?
>
> I have the specifications (and probably every other PDF and PPS Google
> knows of), and my doubt is in terms of checking the authorization. What kind
> of boilerplate code is normally done?
>
> Again, my intention is to do things the OSGi way. So pure JAAS is out of
> the question (I read on the definition papers that they decided this because
> JAAS requires SE 1.3).
>
> Thanks for any input,
> Rodrigo
>
>
> On 9/12/07, Christian van Spaandonk <ch...@luminis.nl>
> wrote:
> >
> > Rodrigo Madera wrote:
> > > Hello community,
> > >
> > > I see that OSGi has some lack of documentation out there when it comes
> > to
> > > best practices and examples (or I'm not knowing where to look).
> > >
> > > Would any of you have a good book recommendation on practical OSGi?
> > >
> > > Also, what is the recommended way of doing authentication and
> > authorization?
> > >
> > > Thanks for any input,
> > > Rodrigo
> > >
> > >
> > In addition to the resources mentioned in other replies there is also a
> > presentation on OSGi best practices given by BJ Hargrave and Peter
> > Kriens at the OSGi Community Event in Munich and also at Java One. You
> > can find it at:
> >
> > http://www2.osgi.org/wiki/uploads/Conference/OSGiBestPractices.pdf
> > http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-1419.pdf
> >
> > friendly,
> > Christian
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
>
> --
> If Jack Bauer had been a Spartan, the movie would have been called "1".




-- 
If Jack Bauer had been a Spartan, the movie would have been called "1".

Re: OSGi Best Practices

Posted by Rodrigo Madera <ro...@gmail.com>.
Can you provide an example (very simple one) on UserAdmin?

I have the specifications (and probably every other PDF and PPS Google knows
of), and my doubt is in terms of checking the authorization. What kind of
boilerplate code is normally done?

Again, my intention is to do things the OSGi way. So pure JAAS is out of the
question (I read on the definition papers that they decided this because
JAAS requires SE 1.3).

Thanks for any input,
Rodrigo


On 9/12/07, Christian van Spaandonk <ch...@luminis.nl>
wrote:
>
> Rodrigo Madera wrote:
> > Hello community,
> >
> > I see that OSGi has some lack of documentation out there when it comes
> to
> > best practices and examples (or I'm not knowing where to look).
> >
> > Would any of you have a good book recommendation on practical OSGi?
> >
> > Also, what is the recommended way of doing authentication and
> authorization?
> >
> > Thanks for any input,
> > Rodrigo
> >
> >
> In addition to the resources mentioned in other replies there is also a
> presentation on OSGi best practices given by BJ Hargrave and Peter
> Kriens at the OSGi Community Event in Munich and also at Java One. You
> can find it at:
>
> http://www2.osgi.org/wiki/uploads/Conference/OSGiBestPractices.pdf
> http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-1419.pdf
>
> friendly,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
If Jack Bauer had been a Spartan, the movie would have been called "1".

Re: OSGi Best Practices

Posted by Christian van Spaandonk <ch...@luminis.nl>.
Rodrigo Madera wrote:
> Hello community,
>
> I see that OSGi has some lack of documentation out there when it comes to
> best practices and examples (or I'm not knowing where to look).
>
> Would any of you have a good book recommendation on practical OSGi?
>
> Also, what is the recommended way of doing authentication and authorization?
>
> Thanks for any input,
> Rodrigo
>
>   
In addition to the resources mentioned in other replies there is also a 
presentation on OSGi best practices given by BJ Hargrave and Peter 
Kriens at the OSGi Community Event in Munich and also at Java One. You 
can find it at:

http://www2.osgi.org/wiki/uploads/Conference/OSGiBestPractices.pdf
http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-1419.pdf

friendly,
 Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org