Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Container or Framework to launch classes

 
Sean Riley
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking for a framework like application, which I can plug in selected classes to. These classes will have different jobs.

E.g. MyMainApp will run all the time (controlling the plug-ins??). Plug-in A, B or C or a combination of the three can be configured to start up with MyMainApp.

All my searching has turned up nothing yet, I fear it is because I am not using the correct terminology. Please could some-one help me with the correct words to use in my search.

Many Thanks
Sean
 
Sean Riley
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As it always happens while I was gathering my thoughts about how to post this request, I came up with more terms to use in my search.

I have stumbled upon Java Plugin Framework. I will continue down this road for a while.

Has any-one any experience with this framework? Are there any others like it?

Many Thanks
Sean
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on the type of application, you might consider using the Eclipse platform (www.eclipse.org) which is designed for doing this kind of thing in a desktop app, or an "application server" (Tomcat, JBoss, etc.) Servlets and EJBs are really just another way to look at plug-ins.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me the breakthrough to plugins was the "Dependency Inversion Principle". It means that the engine is calling the plugins, but the compile-time dependency is inverted - the plugins must reference the engine to compile.

So the engine package might have the Engine class and the IPlugin interface. You can compile this, bundle it up in a jar and sell it on EBay.

You build the plugin package later. Maybe folks who bought your jar on EBay build their own plugins to work with your Engine, kind of like people write plugins for Eclipse. Plugin packages have classes that implement the Plugin interface.

We glue them together with configuration and some form "Dependency Injection". The Engine winds up with code like:

The factory can return new plugins that the Engine authors never heard of. The factory might say

Does that sound fun? If so, Google for more good stuff on Dependency Inversion and Dependency Injection.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic