org.enhydra.xml.lazydom.html
Class ObjectFactory

java.lang.Object
  |
  +--org.enhydra.xml.lazydom.html.ObjectFactory

final class ObjectFactory
extends Object

This class is duplicated for each JAXP subpackage so keep it in sync. It is package private and therefore is not exposed as part of the JAXP API.

This code is designed to implement the JAXP 1.1 spec pluggability feature and is designed to run on JDK version 1.1 and later, and to compile on JDK 1.2 and onward. The code also runs both as part of an unbundled jar file and when bundled as part of the JDK.

Version:
$Id: ObjectFactory.java,v 1.1 2006/01/21 16:50:14 jkjome Exp $

Inner Class Summary
(package private) static class ObjectFactory.ConfigurationError
          A configuration error.
 
Constructor Summary
(package private) ObjectFactory()
           
 
Method Summary
(package private) static Object createObject(String factoryId, String fallbackClassName)
          Finds the implementation Class object in the specified order.
(package private) static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName)
          Finds the implementation Class object in the specified order.
(package private) static ClassLoader findClassLoader()
          Figure out which ClassLoader to use.
(package private) static Class findProviderClass(String className, ClassLoader cl, boolean doFallback)
          Find a Class using the specified ClassLoader
(package private) static Object newInstance(String className, ClassLoader cl, boolean doFallback)
          Create an instance of a class using the specified ClassLoader
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectFactory

ObjectFactory()
Method Detail

createObject

static Object createObject(String factoryId,
                           String fallbackClassName)
                    throws ObjectFactory.ConfigurationError
Finds the implementation Class object in the specified order. The specified order is the following:
  1. query the system property using System.getProperty
  2. read META-INF/services/factoryId file
  3. use fallback classname
Parameters:
factoryId - Name of the factory to find, same as a property name
fallbackClassName - Implementation class name, if nothing else is found. Use null to mean no fallback.
Returns:
Class object of factory, never null
Throws:
ObjectFactory.ConfigurationError -  

createObject

static Object createObject(String factoryId,
                           String propertiesFilename,
                           String fallbackClassName)
                    throws ObjectFactory.ConfigurationError
Finds the implementation Class object in the specified order. The specified order is the following:
  1. query the system property using System.getProperty
  2. read $java.home/lib/propertiesFilename file
  3. read META-INF/services/factoryId file
  4. use fallback classname
Parameters:
factoryId - Name of the factory to find, same as a property name
propertiesFilename - The filename in the $java.home/lib directory of the properties file. If none specified, ${java.home}/lib/xerces.properties will be used.
fallbackClassName - Implementation class name, if nothing else is found. Use null to mean no fallback.
Returns:
Class object of factory, never null
Throws:
ObjectFactory.ConfigurationError -  

findClassLoader

static ClassLoader findClassLoader()
                            throws ObjectFactory.ConfigurationError
Figure out which ClassLoader to use. For JDK 1.2 and later use the context ClassLoader.

newInstance

static Object newInstance(String className,
                          ClassLoader cl,
                          boolean doFallback)
                   throws ObjectFactory.ConfigurationError
Create an instance of a class using the specified ClassLoader

findProviderClass

static Class findProviderClass(String className,
                               ClassLoader cl,
                               boolean doFallback)
                        throws ClassNotFoundException,
                               ObjectFactory.ConfigurationError
Find a Class using the specified ClassLoader


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.