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 / March 2007

Tip: Looking for answers? Try searching our database.

Discovering subclasses or implementations of an interface

Thread view: 
Chris - 15 Mar 2007 01:01 GMT
We've got an app that has connectors to external systems. We allow our
customers to subclass our main Connector class to implement their own
connector. If a customer puts a Connector implementation on the
classpath, is it possible for our app to discover it automatically?

What I want to do is show the full list of all available connectors in
the user interface of our app, without forcing the customer to manually
add the connector. I'd like to avoid adding yet another configuration file.

It's possible for us to have the customer implement an interface rather
than subclass a main class, if necessary.
Joshua Cranmer - 15 Mar 2007 01:28 GMT
> We've got an app that has connectors to external systems. We allow our
> customers to subclass our main Connector class to implement their own
[quoted text clipped - 7 lines]
> It's possible for us to have the customer implement an interface rather
> than subclass a main class, if necessary.

java.util.ServiceProvider sounds like what you want. If not, you'll have
to do some ugly messing around with class loaders to detect classes that
subclass Connector.
Chris - 15 Mar 2007 19:42 GMT
>> We've got an app that has connectors to external systems. We allow our
>> customers to subclass our main Connector class to implement their own
[quoted text clipped - 12 lines]
> to do some ugly messing around with class loaders to detect classes that
> subclass Connector.

I did not find that class, but I did find this:

http://weblogs.java.net/blog/enicholas/archive/2006/04/creating_a_serv.html

Looks like there's enough here to get started.


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.