Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

plugin base application

Thread view: 
sebek - 26 Jul 2005 13:55 GMT
Hi,
can someone write me, how write plugin base application like eclipse

Thanks
Ingo R. Homann - 26 Jul 2005 14:18 GMT
Hi,

> Hi,
> can someone write me, how write plugin base application like eclipse

Pouh, that question is not very specific! And it may be a very complex
thing to do.

In short (and easy):

Define an interface (or abstract class) that declares all methods you
will need:

interface Plugin {
  void doSomething();
}

Now, the spcific plugin is an implementation of that interface:

class MyPlugin implements Plugin {
  void doSomthing() {
    System.out.println("Hello World!");
  }
}

Put all plugins/classes in a certain directory (or another resource you
can "list") and which is included in your classpath.

Let your application scan the specific plugin-directory and instantiate
the classes as follows:

String[] files=pluginDir.list();
for(String file:files) {
  Plugin p=(Plugin)Class.forName(file).newInstance();
  // do whatever you want with the plugin, e.g.:
  p.doSomething();
}

That's the basics. The difficult thing is the definition of the
interface and how to interact between the application and the plugin.
(keywords: event listener, callback, visitor-pattern, ...)

Hth,
Ingo
sebek - 26 Jul 2005 14:29 GMT
thanks, and do you know how it is in eclipse? there are xml files
Ingo R. Homann - 26 Jul 2005 15:03 GMT
Hi,

> thanks, and do you know how it is in eclipse? there are xml files

Well, you can use XML files as well if you want so! ;-)

Sorry, but your question is very vague!

Although I do not know *exactly* how eclipse does this (whatever you
mean with "this"), but of course the plugins can be implemented in the
way that they can be configured using XML files. They may also have an
interface that defines more specifics of this configuration.

Ciao,
Ingo
joel1di1@gmail.com - 27 Jul 2005 14:04 GMT
Hy, why don't you use eclipse RCP projet to make your own application ?
Eclipse team has work a lot and nicely, so "don't re-invent the
wheel...".
++
Joe
Ingo R. Homann - 27 Jul 2005 14:23 GMT
Hi,

> Hy, why don't you use eclipse RCP projet to make your own application ?
> Eclipse team has work a lot and nicely, so "don't re-invent the
> wheel...".
> ++
> Joe

Because for some very simple solutions, the existing frameworks are
often completely oversized.

Ciao,
Ingo


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.