org.enhydra.barracuda.core.util.dom
Class DefaultDOMLoader

java.lang.Object
  |
  +--org.enhydra.barracuda.core.util.dom.DefaultDOMLoader
All Implemented Interfaces:
DOMLoader

public class DefaultDOMLoader
extends java.lang.Object
implements DOMLoader

Default implementation of a DOMLoader. TODO - what about thread safety?


Field Summary
protected  java.util.Map classmap
           
protected  DOMFactory defaultDOMFactory
           
protected  java.util.Map factories
           
protected static DefaultDOMLoader globalLoader
           
protected static org.apache.log4j.Logger logger
           
protected  java.lang.Object sync
           
 
Constructor Summary
DefaultDOMLoader()
           
 
Method Summary
 void deregisterDOMFactory(java.lang.Class cl)
          Deregister a DOMFactory for a given class of DOM object.
 org.w3c.dom.Document getDOM(java.lang.Class cl)
          Get a DOM associated with a given class of object.
 org.w3c.dom.Document getDOM(java.lang.Class cl, java.util.Locale locale)
          Get a DOM associated with a given class of object, based on the specified locale.
 org.w3c.dom.Document getDOM(java.lang.Class cl, ViewCapabilities vc)
          Get a DOM associated with a given class of object, based on the specified ViewCapabilities
static DOMLoader getGlobalInstance()
          Get the global instance of the DOMLoader
protected  java.lang.Class lookupClass(java.lang.String className)
           
 void registerDOMFactory(DOMFactory df, java.lang.Class cl)
          Register a DOMFactory for a given class of DOM object.
 void setDefaultDOMFactory(DOMFactory df)
          Specify the default DOM factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

globalLoader

protected static DefaultDOMLoader globalLoader

defaultDOMFactory

protected DOMFactory defaultDOMFactory

factories

protected java.util.Map factories

classmap

protected java.util.Map classmap

sync

protected java.lang.Object sync
Constructor Detail

DefaultDOMLoader

public DefaultDOMLoader()
Method Detail

getDOM

public org.w3c.dom.Document getDOM(java.lang.Class cl)
                            throws java.io.IOException
Get a DOM associated with a given class of object.

Specified by:
getDOM in interface DOMLoader
Parameters:
cl - the class of DOM object
Returns:
a DOM for the given class of object.
Throws:
java.io.IOException - if the underlying DOMFactory that services this request cannot handle this particular class

getDOM

public org.w3c.dom.Document getDOM(java.lang.Class cl,
                                   java.util.Locale locale)
                            throws java.io.IOException
Get a DOM associated with a given class of object, based on the specified locale.

Specified by:
getDOM in interface DOMLoader
Parameters:
cl - the class of DOM object
locale - the target locale
Returns:
a DOM for the given class of object.
Throws:
java.io.IOException - if the underlying DOMFactory that services this request cannot handle this particular class

getDOM

public org.w3c.dom.Document getDOM(java.lang.Class cl,
                                   ViewCapabilities vc)
                            throws java.io.IOException
Get a DOM associated with a given class of object, based on the specified ViewCapabilities

Specified by:
getDOM in interface DOMLoader
Parameters:
cl - the class of DOM object
vc - the clients ViewCapabilities (may be null)
Returns:
a DOM for the given class of object.
Throws:
java.io.IOException - if the underlying DOMFactory that services this request cannot handle this particular class

lookupClass

protected java.lang.Class lookupClass(java.lang.String className)

setDefaultDOMFactory

public void setDefaultDOMFactory(DOMFactory df)
Specify the default DOM factory.

Specified by:
setDefaultDOMFactory in interface DOMLoader
Parameters:
df - the DOMFactory

registerDOMFactory

public void registerDOMFactory(DOMFactory df,
                               java.lang.Class cl)
Register a DOMFactory for a given class of DOM object.

Specified by:
registerDOMFactory in interface DOMLoader
Parameters:
df - the DOMFactory
cl - the class of DOM object to be handled by this factory

deregisterDOMFactory

public void deregisterDOMFactory(java.lang.Class cl)
Deregister a DOMFactory for a given class of DOM object.

Specified by:
deregisterDOMFactory in interface DOMLoader
Parameters:
cl - the class of DOM object to be handled by this factory

getGlobalInstance

public static DOMLoader getGlobalInstance()
Get the global instance of the DOMLoader

Returns:
the global instance of the DOMLoader


Copyright © 2001 Enhydra.org