You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Saminda Abeyruwan <sa...@gmail.com> on 2008/03/10 09:11:26 UTC

org.osgi.framework.system.packages and embedding Felix

Hi Devs,

I've recently asked the question that, if I wanted to add some packages to
system bundle, it should be added to "org.osgi.framework.system.packages"
Felix properties file. One problem I faced recently is that, during system
bundle start my custom auto activator init number of classes, where all the
packages that needed by this initialization needed to be added to prior
property.

I would like to know is it possible to produce my own classloader "proxy" to
OSGi environment without going through  "org.osgi.framework.system.packages".
i.e Is it possible to  programmatically add my classloader to OSGi when
system bundle is initiating via Embed Felix.

Thank you

Saminda

-- 
Saminda Abeyruwan

Senior Software Engineer
WSO2 Inc. - www.wso2.org

Re: org.osgi.framework.system.packages and embedding Felix

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Saminda Abeyruwan wrote:
> Hi Devs,
>
> I've recently asked the question that, if I wanted to add some packages to
> system bundle, it should be added to "org.osgi.framework.system.packages"
> Felix properties file. One problem I faced recently is that, during system
> bundle start my custom auto activator init number of classes, where all the
> packages that needed by this initialization needed to be added to prior
> property.
>   

I am somewhat confused. I would assume that your custom activator is 
being loaded from the application class loader (i.e., from the class 
path), thus it should automatically have access to any classes you have 
on the class path.

The classes you want to put on the system packages must be on the class 
path, otherwise the system bundle wouldn't be able to export them by 
delegating to parent.

-> richard

> I would like to know is it possible to produce my own classloader "proxy" to
> OSGi environment without going through  "org.osgi.framework.system.packages".
> i.e Is it possible to  programmatically add my classloader to OSGi when
> system bundle is initiating via Embed Felix.
>
> Thank you
>
> Saminda
>
>   

Re: org.osgi.framework.system.packages and embedding Felix

Posted by Karl Pauls <ka...@gmail.com>.
>  Can you direct me to a resource where I could find a sample on writing an
>  extension bundle. I am really appreciate this.

Well, have a look at the core spec 3.15

>  Is it possible to give a custom URLClassloader to an extension bundle.

no.

What you can do with an extension bundle are two things. First, you
can make accessible packages that are already available via the
framework classloader but not in the export list. Second, you can add
packages to the framework classloader which are inside of your bundle.

regards,

Karl


>  Thank you
>
>  Saminda
>
>
>
>  On Mon, Mar 10, 2008 at 2:18 PM, Karl Pauls <ka...@gmail.com> wrote:
>
>  > Well, there is the notion of an extension bundle. I've added support
>  > for extension bundles up to a point so assuming it works in your case
>  > you could use an empty extension bundle that exports the packages that
>  > you need. That would make said packages available from the system
>  > bundle. Another way to do it might be to use bootdelegation (assuming
>  > your bundle doesn't import the packages but still need to get access
>  > to the classes). However, I'd prefer the former if possible.
>  >
>  > regards,
>  >
>  > Karl
>  >
>  > On Mon, Mar 10, 2008 at 9:11 AM, Saminda Abeyruwan <sa...@gmail.com>
>  > wrote:
>  > > Hi Devs,
>  > >
>  > >  I've recently asked the question that, if I wanted to add some packages
>  > to
>  > >  system bundle, it should be added to "
>  > org.osgi.framework.system.packages"
>  > >  Felix properties file. One problem I faced recently is that, during
>  > system
>  > >  bundle start my custom auto activator init number of classes, where all
>  > the
>  > >  packages that needed by this initialization needed to be added to prior
>  > >  property.
>  > >
>  > >  I would like to know is it possible to produce my own classloader
>  > "proxy" to
>  > >  OSGi environment without going through  "
>  > org.osgi.framework.system.packages".
>  > >  i.e Is it possible to  programmatically add my classloader to OSGi when
>  > >  system bundle is initiating via Embed Felix.
>  > >
>  > >  Thank you
>  > >
>  > >  Saminda
>  > >
>  > >  --
>  > >  Saminda Abeyruwan
>  > >
>  > >  Senior Software Engineer
>  > >  WSO2 Inc. - www.wso2.org
>  > >
>  >
>  >
>  >
>  > --
>  > Karl Pauls
>  > karlpauls@gmail.com
>  >
>
>
>
>  --
>
>
> Saminda Abeyruwan
>
>  Senior Software Engineer
>  WSO2 Inc. - www.wso2.org
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: org.osgi.framework.system.packages and embedding Felix

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Hi Kari,

Thank you for the quick response.

Can you direct me to a resource where I could find a sample on writing an
extension bundle. I am really appreciate this.

Is it possible to give a custom URLClassloader to an extension bundle.

Thank you

Saminda

On Mon, Mar 10, 2008 at 2:18 PM, Karl Pauls <ka...@gmail.com> wrote:

> Well, there is the notion of an extension bundle. I've added support
> for extension bundles up to a point so assuming it works in your case
> you could use an empty extension bundle that exports the packages that
> you need. That would make said packages available from the system
> bundle. Another way to do it might be to use bootdelegation (assuming
> your bundle doesn't import the packages but still need to get access
> to the classes). However, I'd prefer the former if possible.
>
> regards,
>
> Karl
>
> On Mon, Mar 10, 2008 at 9:11 AM, Saminda Abeyruwan <sa...@gmail.com>
> wrote:
> > Hi Devs,
> >
> >  I've recently asked the question that, if I wanted to add some packages
> to
> >  system bundle, it should be added to "
> org.osgi.framework.system.packages"
> >  Felix properties file. One problem I faced recently is that, during
> system
> >  bundle start my custom auto activator init number of classes, where all
> the
> >  packages that needed by this initialization needed to be added to prior
> >  property.
> >
> >  I would like to know is it possible to produce my own classloader
> "proxy" to
> >  OSGi environment without going through  "
> org.osgi.framework.system.packages".
> >  i.e Is it possible to  programmatically add my classloader to OSGi when
> >  system bundle is initiating via Embed Felix.
> >
> >  Thank you
> >
> >  Saminda
> >
> >  --
> >  Saminda Abeyruwan
> >
> >  Senior Software Engineer
> >  WSO2 Inc. - www.wso2.org
> >
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>



-- 
Saminda Abeyruwan

Senior Software Engineer
WSO2 Inc. - www.wso2.org

Re: org.osgi.framework.system.packages and embedding Felix

Posted by Karl Pauls <ka...@gmail.com>.
Well, there is the notion of an extension bundle. I've added support
for extension bundles up to a point so assuming it works in your case
you could use an empty extension bundle that exports the packages that
you need. That would make said packages available from the system
bundle. Another way to do it might be to use bootdelegation (assuming
your bundle doesn't import the packages but still need to get access
to the classes). However, I'd prefer the former if possible.

regards,

Karl

On Mon, Mar 10, 2008 at 9:11 AM, Saminda Abeyruwan <sa...@gmail.com> wrote:
> Hi Devs,
>
>  I've recently asked the question that, if I wanted to add some packages to
>  system bundle, it should be added to "org.osgi.framework.system.packages"
>  Felix properties file. One problem I faced recently is that, during system
>  bundle start my custom auto activator init number of classes, where all the
>  packages that needed by this initialization needed to be added to prior
>  property.
>
>  I would like to know is it possible to produce my own classloader "proxy" to
>  OSGi environment without going through  "org.osgi.framework.system.packages".
>  i.e Is it possible to  programmatically add my classloader to OSGi when
>  system bundle is initiating via Embed Felix.
>
>  Thank you
>
>  Saminda
>
>  --
>  Saminda Abeyruwan
>
>  Senior Software Engineer
>  WSO2 Inc. - www.wso2.org
>



-- 
Karl Pauls
karlpauls@gmail.com