org.enhydra.xml.xmlc
Class XMLCStdFactory

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.XMLCStdFactory
All Implemented Interfaces:
XMLCFactory
Direct Known Subclasses:
XMLCDeferredParsingFactory

public class XMLCStdFactory
extends Object
implements XMLCFactory

XMLC standard factory class. Used for creating instances of XMLC-generated classes. This is a default factory used when no special support, such as auto-recompilation is required.


Constructor Summary
XMLCStdFactory(ClassLoader classLoader, XMLCLogger logger)
          Constructor.
 
Method Summary
 XMLObject create(Class xmlcBasedClass)
          Create an instance of a XMLC-generated class or a class derived from one, given the name of the class, using the associated classloader
 XMLObject create(String xmlcClassName)
          Create an instance of a XMLC-generated class or a class derived from one, given either a class or an interface object, using the associated classloader
protected  XMLObject doCreate(Class xmlcBasedClass)
          Do actualy work of creating a new object.
protected  XMLObject doCreate(String xmlcClassName, ClassLoader classLoader)
          Do actualy work of creating a new object given a name.
protected  ClassLoader getDefaultClassLoader()
          Get the default class loader
 XMLCLogger getLogger()
          Get the logger.
protected  Error handleError(String className, Throwable except)
          Handle all errors, logging if enabled.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLCStdFactory

public XMLCStdFactory(ClassLoader classLoader,
                      XMLCLogger logger)
Constructor.
Parameters:
classLoader - Classloader used to load classes when a class name is specified. If null, the system classload is used.
logger - XMLC logger or null for no logging.
Method Detail

handleError

protected Error handleError(String className,
                            Throwable except)
Handle all errors, logging if enabled. Also handles logging error output of the compiler.
Parameters:
className - Class being loaded.
except - Can be any error or exception.
Returns:
Returns runtime exceptions to be rethrown. Could throw everything, but catch blocks appear to fall through to the compiler so we would have to put in dummy returns.

doCreate

protected XMLObject doCreate(Class xmlcBasedClass)
                      throws ClassNotFoundException,
                             IllegalAccessException,
                             InstantiationException
Do actualy work of creating a new object.

doCreate

protected XMLObject doCreate(String xmlcClassName,
                             ClassLoader classLoader)
                      throws ClassNotFoundException,
                             IllegalAccessException,
                             InstantiationException
Do actualy work of creating a new object given a name.

create

public XMLObject create(String xmlcClassName)
Create an instance of a XMLC-generated class or a class derived from one, given either a class or an interface object, using the associated classloader
Specified by:
create in interface XMLCFactory
Following copied from interface: org.enhydra.xml.xmlc.XMLCFactory
Parameters:
xmlcClassName - The name of the XMLC class or derived class.
Returns:
The new object.
See Also:
XMLCFactory.create(Class)

create

public XMLObject create(Class xmlcBasedClass)
Create an instance of a XMLC-generated class or a class derived from one, given the name of the class, using the associated classloader
Specified by:
create in interface XMLCFactory
Following copied from interface: org.enhydra.xml.xmlc.XMLCFactory
Parameters:
xmlcBasedClass - The Class object for the class or interface.
Returns:
The new object.

getDefaultClassLoader

protected ClassLoader getDefaultClassLoader()
Get the default class loader

getLogger

public XMLCLogger getLogger()
Get the logger.


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