Class ObjectFactory

java.lang.Object
org.java.plugin.ObjectFactory
Direct Known Subclasses:
StandardObjectFactory

public abstract class ObjectFactory extends Object
Factory class to help creating base Framework objects: plug-in registry, path resolver and plug-in manager.
Version:
$Id$
  • Constructor Details

    • ObjectFactory

      public ObjectFactory()
  • Method Details

    • newInstance

      public static ObjectFactory newInstance()
      Creates and configures new instance of object factory.
      Returns:
      configured instance of object factory
      See Also:
    • 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 be null
      Returns:
      configured instance of object factory
    • configure

      protected abstract void configure(ExtendedProperties config)
      Configures this factory instance. This method is called from newInstance(ExtendedProperties).
      Parameters:
      config - factory configuration data, may be null
    • 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:
    • 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