Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Some random thoughts after browsing the e4 code base

1. Why is e4 still using an (empty) Activator in almost every project?
Shouldn't it be a good OSGi citizen and use the
FramworkUtil.getBundle(Class) whenever the current Bundle/ BundleContext
is needed? Also the Activator.ID is error prone to refactoring, thats
why I never use it in my own projects.
A similar problem has the NLS feature of Eclipse PDE, when it creates the Messages class and puts the BUNDLE into a string rather to have
NLS.initialize(Messages.class.getPackage().getName() + ".messages",
Messages.class)

Yes, setting up good OSGi programming practices from the beginning would be great. IMHO this actually means NOT using OSGi types wherever possible. Through DS and other means we should be able to avoid referencing BundeContexts in normal Eclipse code yet still use OSGi services to structure things.

The use of string constants for getting bundle ids does have the brittleness mentioned and IMHO should be avoided. The frameworkUtil method you mention is a fine way to do this. Not that if you really want to use constants (for this and other purposes) there is no need to use an Activator for that. BundleActivators are OSGi specific and are there for lifecycle. Historically the Plugin class was the place where we dumped all manner of stuff but best practice would have your random domain constants etc wherever you would normally put them if not using OSGi and just putting the OSGi-related code (what? why?) in OSGi-related types.

Jeff



Back to the top