I'm interested in something of a plugin scheme. I'd like to be able
to add classes that implement a particular interface into a project
and have them automatically detected and used.
For example, let's say I have a web project running inside a servlet
container. I create an interface called PageObject. I then write a
few classes that implement PageObject. Let's say they're
HeaderPageObjec t, WeatherPageObje ct and FooterPageObjec t. I use a
servlet or jsp to build the page using page objects... call it
page.java.
I'd like to be able to: Add new classes that implement PageObject to a
project and have them automatically appear on the page.
How do I go about doing this?
Does my page.java code have any way of inspecting all classes
accessible to a project to find those that implement PageObject? If
so, isn't this going to take a long time?
What's the plugin model used in something like Winamp? A .dll is
dropped into a directory and code knows to search the directory for
..dll's and calls a pre-defined function.
Or is there some way to use the reflection classes? Or a JNDI lookup
scheme (remember that I want to be able to just add the class to the
project... no other configuration than that).
Clearly I'm a little lost but I think I have a valid requirement. Any
hints, directions, terminologies or links you can offer are greatly
appreciated.
Best,
Joe
to add classes that implement a particular interface into a project
and have them automatically detected and used.
For example, let's say I have a web project running inside a servlet
container. I create an interface called PageObject. I then write a
few classes that implement PageObject. Let's say they're
HeaderPageObjec t, WeatherPageObje ct and FooterPageObjec t. I use a
servlet or jsp to build the page using page objects... call it
page.java.
I'd like to be able to: Add new classes that implement PageObject to a
project and have them automatically appear on the page.
How do I go about doing this?
Does my page.java code have any way of inspecting all classes
accessible to a project to find those that implement PageObject? If
so, isn't this going to take a long time?
What's the plugin model used in something like Winamp? A .dll is
dropped into a directory and code knows to search the directory for
..dll's and calls a pre-defined function.
Or is there some way to use the reflection classes? Or a JNDI lookup
scheme (remember that I want to be able to just add the class to the
project... no other configuration than that).
Clearly I'm a little lost but I think I have a valid requirement. Any
hints, directions, terminologies or links you can offer are greatly
appreciated.
Best,
Joe