I have an application where I have a set of core features.
The application itself HAS to work in core only mode.
I would also want to make the application extensible such that, when certain jar/plugin files exist in the classpath/installation location, additional features would be available, things would just be there. This is OPTIONAL.
The way I would do it is using the factory pattern with a modification. In the core package, I have an extension point (implemented by either a public static variable or a singleton, or other extension point model from my framework - Eclipse RCP). The extension jars/plugins get this extension point and registers its factory object to this extension point. (This is best done with RCP plugin/feature activation mechanism, or it can just be anything that causes a load of the extension jar/plugin factory class)
When the application runs, the core factory would produce objects from the extension factory if one has been registered or use its core factory otherwise. This is how the application goes from core mode to extension mode if an extension jar exists.
I wonder if this is a decent way to do what I wanted to do or this is just a hack, anti-pattern, etc... Please propose a better solution if you can. Thanks.