3

I've implemented "New Wizard" plug-in for my content-type. Tested it - it works.

Then I've found that neither Bundle-Activator was declared, nor the Activator class was defined.

The question is - when the Activator class is really needed in plug-in. And when it doesn't needed at all?

outmind
  • 759
  • 1
  • 10
  • 30

1 Answers1

7

You only need the Bundle-Activator when you need to to something at the start and / or stop of your bundle. If your bundle is only a lib that is exporting some packages, you don't need the activation.

If you didn't need one for your bundle to function as it is supposed to, then it probably doesn't need one :)

RaduK
  • 1,463
  • 10
  • 16
  • 4
    As a rule of thumb, avoid bundle activators. Even if you do need initialization logic, use standard java means to initialize on first use. Much better than bundle activators which can hang classloading if not carefully written. If you cannot think of a way to solve a problem without a bundle activator, do as little as possible in your bundle startup method. Start a thread, if you have significant amount of work to do. – Konstantin Komissarchik Jul 20 '11 at 16:55
  • +1 to @Konstantin Komissarchik - Repeat after me: "Avoid Acivators", "Avoid Acivators", "Avoid Acivators", "Avoid Acivators"... – Tonny Madsen Jul 20 '11 at 19:37
  • Thank you, Konstantin! Could you, please, provide some illustrative example of when we cannot avoid Bundle-Activator. Or some trivial example when we can avoid it? The code is unneeded - describe it by word of mouth, if it would be shorter, please. – outmind Jul 21 '11 at 09:01