Chris-
Why does this design require that these classes be exported? As long as the
bundle registering them as services has access to the dynamic classes, no
other bundle needs to.

Alternatively, you could register a special Classloader as a service which
could be used to load them.

Justin

On Sun, Mar 18, 2012 at 5:07 PM, <[email protected]> wrote:

> Hello all,
>
> I am working on a design which involves generating new classes at runtime,
> so that afterwards I can create one or more instances which will be
> registered as services.  Generating the class files (or byte arrays) goes
> fine, introducing them into the environment is less obvious; I need to
> somehow persuade some bundle classloader to read in my hand-crafted bytes
> and pass them to defineClass().  The best I have been able to come up with
> so far is to wrap up the generated class in a bundle fragment and ask the
> framework to install this - which seems a little baroque, so I am just
> wondering if there is some API I've missed which would do this more
> naturally?
>
> If I wanted to modify the original class I could of course use weaving
> hooks, but I would really prefer to create a new class.
>
> Thanks,
>
> Chris
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to