pluggable interface : Java Glossary

pluggable interface
Java’s interfaces and dynamic class loading make it easy to create pluggable interfaces such as LAF (Look And Feel), JCE (Java Cryptography Extension) and JDBC (Java Data Base Connectivity). Many vendors can supply different code to implement the same interface that all behaves the same way, and easily plugs into a framework library without requiring any recompilation or linking. One of the clues you are using a pluggable interface is the lack of public constructors. All objects must be created via factory methods. The other clue is nearly all methods return interfaces rather than concrete classes.

To create a pluggable interface you define a suite of interfaces that a vendor or other third party must implement with real classes. He bundles his implementation code into a jar. Typically there will be a special registration class in the jar that gives the names of the class to use to implement any given interface, and perhaps some factory classes to create various types of standard object. The registration class might customise the choices based on platform or user specifications.

To use the interface, the user specifies the vendor name whose implementation he wants. From them on he uses factory methods that look up the correct constructors, and via dynamic loading (Class. forName) or reflection call the vendor-specific methods. These methods return objects that the user then manipulates via their standard interface names, not their class names, though in theory you might use abstract class names too. The user is usually never aware of the vendor’s class names, (unless of course he cheats and peeks with Class. toString).


CMP homejump to top

available on the web at:

http://mindprod.com/jgloss/pluggableinterface.html
  

optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\pluggableinterface.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, especially when sending an ad-hominem attack, a rant composed mainly of obscenities or a death threat, please quote the offending passage and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. I can’t very well fix erroneous or ambiguous text if I can’t find it.
Blog
IP:[65.110.21.43]
Your face IP:[23.22.212.158]
You are visitor number 11.