Discovery -
Discovery: Service Discovery component
Last Published: 27 April 2011
Version: 0.6-SNAPSHOT
ApacheCon
Apache
Commons
Discovery
Overview
Release Notes (0.5)
Best practices
Guidelines
Development
Mailing Lists
Issue Tracking
Source Repository
Building
Javadoc (SVN latest)
Project Documentation
Project Information
About
Continuous Integration
Dependencies
Distribution Management
Issue Tracking
Mailing Lists
Plugin Management
Project License
Project Plugins
Project Summary
Project Team
Source Repository
Project Reports
Commons
License
Components
Sandbox
Dormant
General Information
Volunteering
Contributing Patches
Building Components
Releasing Components
Wiki
ASF
How the ASF works
Get Involved
Developer Resources
Sponsorship
Thanks
Commons Discovery: Service Discovery component
The Discovery component is about discovering, or finding,
implementations for pluggable interfaces.
It provides facilities for instantiating classes in general,
and for lifecycle management of singleton (factory) classes.
Fundamentally, Discovery locates classes that implement a given Java interface.
The discovery pattern, though not necessarily this package,
is used in many projects including JAXP (SaxParserFactory and others)
and commons-logging (LogFactory).
By extracting this pattern, other projects can (re)use it
and take advantage of improvements to the pattern as Discovery evolves.
Discovery improves over previous implementations
by establishing facilities for working within managed environments.
These allow configuration and property overrides without appealing
to the global System properties (which are scoped across an entire JVM).
Scope
This is not indended to be a replacement to be used strictly by the user, but rather
a replacement to be used directly by projects. Use by the user is also reasonable,
but limited due to 'keeping this simple'. In particular, there is no configuration
for this discovery service, it relies only on usage patterns.
Given a java.lang.Class parameter 'package.Class' that represents a
fundamental service as either an interface, an abstract class
(or even a regular class), find an implementation of that class:
Look for system property named 'package.Class', the value of which is the
name of an implementation.
Look for a 'local' property named 'package.Class'...
Attempt JDK 1.3+ style discovery
Attempt to load a default implementation
In all cases, verify that the discovered implementation
implements
'package.Class'.
The package aims to :
Have an API which should be as simple to use as possible
Be based on usage patterns, not specific configuration file
Represent proper discovery & class-loading principles
Be reasonably portable across JDK levels (1.1.8+?)
Copyright © 2002-2011
The Apache Software Foundation
Apache Commons, Apache Commons Discovery, Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation.
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
US