1

Can i use a service in the class file which is generated using javaassist. how can i achieve that?? and as this class is created dynamically how can i register that this class is using the provided service of another class?

Lakshmi
  • 81
  • 2
  • 8

1 Answers1

0

I've asked a similar question here.

The smallest unit of 'installation' would be a bundle. You could generate a sort of 'virtual bundle' around your class file, including a OSGI-INF/componentX.xml descriptor, and install that into OSGi.

If it changes, regenerate the bundle and update OSGi.

I didn't go down this path as I have a lot of generated code (about 4500 different scripts that all have dependencies) and I fear that I'd get into problems if I'd generate that many bundles.

I also got a tip about the Felix Dependency manager, but I haven't thoroughly checked that out yet, it might do the things we need.

Community
  • 1
  • 1
Frank Lee
  • 2,728
  • 19
  • 30
  • Oh, and I assumed you are familiar with Declarative Services (or Blueprint, for that matter). If the OSGI-INF part makes no sense, read up on that. – Frank Lee Jul 03 '12 at 15:27