Package org.java.plugin
Class ObjectFactory
- java.lang.Object
-
- org.java.plugin.ObjectFactory
-
- Direct Known Subclasses:
StandardObjectFactory
public abstract class ObjectFactory extends java.lang.Object
Factory class to help creating base Framework objects: plug-in registry, path resolver and plug-in manager.- Version:
- $Id$
-
-
Constructor Summary
Constructors Constructor Description ObjectFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
configure(ExtendedProperties config)
Configures this factory instance.PluginManager
createManager()
Creates new instance of plug-in manager using new instances of registry and path resolver.abstract PluginManager
createManager(PluginRegistry registry, PathResolver pathResolver)
Creates new instance of plug-in manager.abstract PathResolver
createPathResolver()
Creates new instance of path resolver implementation class using standard discovery algorithm to determine which resolver implementation class should be instantiated.abstract PluginRegistry
createRegistry()
Creates new instance of plug-in registry implementation class using standard discovery algorithm to determine which registry implementation class should be instantiated.static ObjectFactory
newInstance()
Creates and configures new instance of object factory.static ObjectFactory
newInstance(ExtendedProperties config)
Creates and configures new instance of object factory.
-
-
-
Method Detail
-
newInstance
public static ObjectFactory newInstance()
Creates and configures new instance of object factory.- Returns:
- configured instance of object factory
- See Also:
newInstance(ExtendedProperties)
-
newInstance
public static ObjectFactory newInstance(ExtendedProperties config)
Creates and configures new instance of object factory. Factory implementation class discovery procedure is following:- Use the
org.java.plugin.ObjectFactory
property from the given properties collection (if it is provided). - Use the
org.java.plugin.ObjectFactory
system property. - Use the properties file "jpf.properties" in the JRE "lib" directory
or in the CLASSPATH. This configuration file is in standard
java.util.Properties
format and contains among others the fully qualified name of the implementation class with the key being the system property defined above. - Use the Services API (as detailed in the JAR specification), if
available, to determine the class name. The Services API will look for a
class name in the file
META-INF/services/org.java.plugin.ObjectFactory
in jars available to the runtime. - Framework default
ObjectFactory
implementation.
- Parameters:
config
- factory configuration data, may benull
- Returns:
- configured instance of object factory
- Use the
-
configure
protected abstract void configure(ExtendedProperties config)
Configures this factory instance. This method is called fromnewInstance(ExtendedProperties)
.- Parameters:
config
- factory configuration data, may benull
-
createManager
public final PluginManager createManager()
Creates new instance of plug-in manager using new instances of registry and path resolver.- Returns:
- new plug-in manager instance
- See Also:
createRegistry()
,createPathResolver()
-
createManager
public abstract PluginManager createManager(PluginRegistry registry, PathResolver pathResolver)
Creates new instance of plug-in manager.- Parameters:
registry
-pathResolver
-- Returns:
- new plug-in manager instance
-
createRegistry
public abstract PluginRegistry createRegistry()
Creates new instance of plug-in registry implementation class using standard discovery algorithm to determine which registry implementation class should be instantiated.- Returns:
- new registry instance
-
createPathResolver
public abstract PathResolver createPathResolver()
Creates new instance of path resolver implementation class using standard discovery algorithm to determine which resolver implementation class should be instantiated.- Returns:
- new path resolver instance
-
-