Hi, Neil:

Thanks your advise. and I also tried some other mechanism. but they are not so 
good as OSGI service;
As you have said, "OSGi already provides excellent support for versioning and 
evolution of services and service APIs without needing to mess around with 
classloaders." 
Just because OSGI has such advantage, we want to use it as a service provider;

But our real  difficult is "how to share the service of OSGI from outside(the 
host application), when the interface of service is dynamical loaded, not 
pre-installed in the host-application"
The host application outside OSGI is a traditional j2ee container. It's hardly 
be transformed to a bundle.

Also some APPServer( etc: Glassfish) does support OSGI features, but we cannot 
migrate to such a server.

Is there any good advise?


----- Original Message ----- 
From: "Neil Bartlett" <[email protected]>
To: <[email protected]>
Sent: Tuesday, October 18, 2011 8:47 PM
Subject: Re: How to find a class of bundle from Host application?


> Hi xuhb,
> 
> Sorry but I am not convinced about your need to get the classes from the 
> bundles. OSGi already provides excellent support for versioning and evolution 
> of services and service APIs without needing to mess around with classloaders.
> 
> Other people on this thread have shown you how to do things the way you want 
> to do it. I can't stop you from following those pointers, but I strongly 
> advise you to rethink, learn more about how services work, and try to use 
> them in the way they were intended to be used.
> 
> Rgds,
> Neil
> 
> 
> 
> On Tuesday, 18 October 2011 at 06:27, xuhb wrote:
> 
>> We think highly of the "ligh weight service" usage of osgi; 
>> This is the real reason why we need resolve classes of osgi from 
>> host-application;
>> 
>> So we are hoping: if we can build a "light weight service" system based on 
>> OSGI, then we can not only achieve benefit of service-orient system, but 
>> also we can still using the valuable artifact provided by app-server(etc: 
>> web-container, ResourceAdaptor/JCA, TransactionManager, management..)
>> 
>> ----- Original Message ----- 
>> From: "xuhb" <[email protected] (mailto:[email protected])>
>> To: <[email protected] (mailto:[email protected])>
>> Sent: Tuesday, October 18, 2011 12:35 PM
>> Subject: Re: How to find a class of bundle from Host application?
>> 
>> 
>> > 
>> > ----- Original Message ----- 
>> > From: "Neil Bartlett" <[email protected] (mailto:[email protected])>
>> > To: <[email protected] (mailto:[email protected])>
>> > Sent: Monday, October 17, 2011 3:46 PM
>> > Subject: Re: How to find a class of bundle from Host application?
>> > 
>> > 
>> > > Could you please explain a little more why you want to do this.
>> > > 
>> > > What you're asking for may be possible, but these kinds of problems can 
>> > > nearly always be solved better using OSGi Services. For example, do you 
>> > > *really* need a class, or do you just need an instance of an object of a 
>> > > particular type?
>> > 
>> > Previously, our application are based on a app-server, business module is 
>> > implements as Spring/EJB; 
>> > But we have encounter such difficult:
>> > 
>> > 1) When a new version application is update, the user always don't ask for 
>> > the the new version to replace the old version, but ask for the new and 
>> > old version system both run for a while simultaneously; Because the 
>> > different organize of the customer cannot migrate the new version 
>> > simultaneously;
>> > 
>> > 2) In our application there are always some business logical which should 
>> > be extract as shared service, but these services also must be versioned;
>> > 
>> > To resolve our practical problem , we need a plugin system, which can 
>> > contribute services of different version; and the application could choose 
>> > which one it can use; That's why we need first resolve a classes from osgi 
>> > before using the osgi service; 
>> > 
>> > If we doesn't just limited in our practical problem, then we want to treat 
>> > the osgi to act as a "light weight service" system. 
>> > Here "ligh weight service" composed of two part : 1) contract: the java 
>> > interface; 2) implementation: the osgi service object;
>> > That's to say, we wants:
>> > 
>> > 1) A new "ligh weight service" could be installed at run time and is 
>> > discovered by client (exist in host-application);
>> >  etc: A jsp could resolve to the java interface of a "light weight 
>> > service", and invoke the osgi service;
>> > 2) The implementation of "light weight service" can be un-aware to client 
>> > (exit in host-application). and could be updated dynamically;
>> > 
>> > This is osgi's natual;
>> > 
>> > 3) The update of "light weight service"' could be awared by the client, 
>> > and re-resolve to it.
>> > This is only used for failure test, becuase updating of contract( the java 
>> > interface) can cause un-reasonable problem; 
>> > Actually, we just need to know: "contract is update, the client may 
>> > corrupt" ,and give a report. that's enough;
>> > 
>> > > Rgds
>> > > Neil
>> > > 
>> > > 
>> > > 
>> > > On Monday, 17 October 2011 at 07:44, xuhb wrote:
>> > > 
>> > > > Sorry, I expressed my requirement un-correctly;
>> > > > 
>> > > > Actually, the host application just know the name of class and want to 
>> > > > choose such class from embedded osgi environment ?
>> > > > Could I? 
>> > > > Must I create a bundle (which import such class) dynamically and 
>> > > > retrive class from the dynamic created bundle? Is there other 
>> > > > facilitate method?
>> > > > 
>> > > > Thanks any suggestion
>> > > > ----- Original Message ----- 
>> > > > From: "xuhb" <[email protected] (mailto:[email protected])>
>> > > > To: <[email protected] (mailto:[email protected])>
>> > > > Sent: Monday, October 17, 2011 2:32 PM
>> > > > Subject: How to find a class of bundle from Host application?
>> > > > 
>> > > > 
>> > > > > Hi:
>> > > > >  I am using osgi environment (felix) embedded in a Host Application; 
>> > > > >  Now the host application want to use a class from a specified osgi 
>> > > > > bundle, 
>> > > > >  Could standard osgi support such usage? 
>> > > > >  or felix support such extension usage?
>> > > > > Thanks any suggestion
> 
>

Reply via email to