attrib4j
Class AttributeCompilerFactory

java.lang.Object
  |
  +--attrib4j.AttributeCompilerFactory

public abstract class AttributeCompilerFactory
extends java.lang.Object

Factory for creating AttributeCompiler instances, with discovery and configuration features similar to that employed by standard Java APIs such as JAXP. Current implementations are based on Javadoc and ??? libraries.

Implementation taken from the jakarata commons logging package.

TODO Put common impl in a base class.

Version:
$Revision: 1.1 $ $Date: 2003/04/10 03:36:16 $
Author:
Mark Pollack

Field Summary
protected static java.util.Hashtable factories
          The previously constructed AttributeCompilerFactory instances, keyed by the ClassLoader with which it was created.
static java.lang.String FACTORY_DEFAULT
          The fully qualified class name of the fallback AttributeCompilerFactory implementation class to use, if no other can be found.
static java.lang.String FACTORY_PROPERTIES
          The name of the properties file to search for.
static java.lang.String FACTORY_PROPERTY
          The name of the property used to identify the AttributeCompilerFactory implementation class name.
protected static java.lang.String SERVICE_ID
          JDK1.3+ 'Service Provider' specification ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )
 
Constructor Summary
protected AttributeCompilerFactory()
          Protected constructor that is not available for public use.
 
Method Summary
abstract  AttributeCompiler getAttributeCompiler()
          Method to return a AttributeCompiler.
protected static java.lang.ClassLoader getContextClassLoader()
          Return the thread context class loader if available.
static AttributeCompilerFactory getFactory()
          Construct (if necessary) and return a AttributeCompilerFactory instance, using the following ordered lookup procedure to determine the name of the implementation class to be loaded.
protected static AttributeCompilerFactory newFactory(java.lang.String factoryClass, java.lang.ClassLoader classLoader)
          Return a new instance of the specified AttributeCompilerFactory implementation class, loaded by the specified class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_PROPERTY

public static final java.lang.String FACTORY_PROPERTY
The name of the property used to identify the AttributeCompilerFactory implementation class name.

See Also:
Constant Field Values

FACTORY_DEFAULT

public static final java.lang.String FACTORY_DEFAULT
The fully qualified class name of the fallback AttributeCompilerFactory implementation class to use, if no other can be found.

See Also:
Constant Field Values

FACTORY_PROPERTIES

public static final java.lang.String FACTORY_PROPERTIES
The name of the properties file to search for.

See Also:
Constant Field Values

SERVICE_ID

protected static final java.lang.String SERVICE_ID
JDK1.3+ 'Service Provider' specification ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )

See Also:
Constant Field Values

factories

protected static java.util.Hashtable factories
The previously constructed AttributeCompilerFactory instances, keyed by the ClassLoader with which it was created.

Constructor Detail

AttributeCompilerFactory

protected AttributeCompilerFactory()
Protected constructor that is not available for public use.

Method Detail

getFactory

public static AttributeCompilerFactory getFactory()
                                           throws AttributeException

Construct (if necessary) and return a AttributeCompilerFactory instance, using the following ordered lookup procedure to determine the name of the implementation class to be loaded.

Throws:
AttributeException - if the implementation class is not available or cannot be instantiated.

getAttributeCompiler

public abstract AttributeCompiler getAttributeCompiler()
                                                throws AttributeException
Method to return a AttributeCompiler.

Throws:
AttributeException - if a suitable AttributeCompiler instance cannot be returned

getContextClassLoader

protected static java.lang.ClassLoader getContextClassLoader()
                                                      throws AttributeException
Return the thread context class loader if available. Otherwise return null. The thread context class loader is available for JDK 1.2 or later, if certain security conditions are met.

Throws:
AttributeException - if a suitable class loader cannot be identified.

newFactory

protected static AttributeCompilerFactory newFactory(java.lang.String factoryClass,
                                                     java.lang.ClassLoader classLoader)
                                              throws AttributeException
Return a new instance of the specified AttributeCompilerFactory implementation class, loaded by the specified class loader. If that fails, try the class loader used to load this (abstract) AttributeCompilerFactory.

Parameters:
factoryClass - Fully qualified name of the AttributeCompilerFactory implementation class
classLoader - ClassLoader from which to load this class
Throws:
AttributeException - if a suitable instance cannot be created


Copyright © 2002-2003 Mark Pollack. All Rights Reserved.