|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.topicmap.TopicMapProviderFactory
Abstract class to be extended by implementations which allow access
to TopicMap
s using the TopicMapProvider
interface.
This class enables an application to retrieve a
TopicMapProvider
.
TM4J applications retrieve
instances of this class using the newInstance()
method, which
selects, instantiates and returns the appropriate concrete implementation
as determined by the following algorithm (listed here in descending
order of precedence):
org.tm4j.topicmap.TopicMapProviderFactory
; if found,
it is expected to contain the fully-qualified class name of the concrete,
back end-dependent implementing class. If that system property is
found, but the corresponding class cannot be loaded or
instantiated, this is considered an error condition and newInstance()
will throw a
TopicMapProviderFactoryConfigurationError
.provider
,
handle it equivalently. This is purely for reasons of backwards
compatibility and will go away in future releases.META-INF/services/org.tm4j.topicmap.TopicMapProviderFactory
;
if found, it is expected to contain a single line of text denoting the
fully-qualified class name of the concrete implementation class.
This in line with the "Service Provider" section
of the
JAR
File Specification. If that resource is
found, but cannot be read, or the corresponding class cannot be loaded or
instantiated, this is considered an error condition and newInstance()
will throw a
TopicMapProviderFactoryConfigurationError
.After the class has been properly instantiated,
TopicMapProvider
s may be created using
newTopicMapProvider()
or newTopicMapProvider(Properties)
.
The implementing subclass will ensure that the returned
TopicMapProvider
s are appropriate for the underlying back-end
implementation.
This approach enables TM4J application developers to write their applications in a back end-independent manner, leaving it up to the users to select the appropriate back-end implementation that best fits their requirements.
Constructor Summary | |
protected |
TopicMapProviderFactory()
The default constructor is protected on purpose. |
Method Summary | |
TopicMapProvider |
createTopicMapProvider(java.util.Properties props)
Deprecated. as of 0.8.4, this method only invokes newTopicMapProvider(Properties) , by which it will be replaced
in the future. |
static TopicMapProviderFactory |
newInstance()
Creates and returns a new instance of this class. |
TopicMapProvider |
newTopicMapProvider()
Creates and returns a TopicMapProvider which may be used
to retrieve one or more topic maps from the implementation's
underlying store. |
abstract TopicMapProvider |
newTopicMapProvider(java.util.Properties props)
Creates and returns a TopicMapProvider which may be used
to retrieve one or more topic maps from the implementation's
underlying store. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected TopicMapProviderFactory()
newInstance()
method.
Method Detail |
public TopicMapProvider createTopicMapProvider(java.util.Properties props) throws TopicMapProviderException
newTopicMapProvider(Properties)
, by which it will be replaced
in the future.
props
- The configuration properties for the provider.
TopicMapProviderException
public TopicMapProvider newTopicMapProvider() throws TopicMapProviderException
TopicMapProvider
which may be used
to retrieve one or more topic maps from the implementation's
underlying store. The default implementation
initializes the newly created TopicMapProvider
with an empty set of configuration properties.
TopicMapProviderException
public abstract TopicMapProvider newTopicMapProvider(java.util.Properties props) throws TopicMapProviderException
TopicMapProvider
which may be used
to retrieve one or more topic maps from the implementation's
underlying store.
props
- The configuration properties for the provider.
TopicMapProviderException
public static TopicMapProviderFactory newInstance()
TopicMapProviderFactoryConfigurationError
- if the new instance
could not be created. This may be due to the implementing subclass
not being found by the class loader, a failure in class instantiation,
or failure to read a service provider configuration file. The
original exception is passed to the
TopicMapProviderFactoryConfigurationError
as its root cause.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |