org.barracudamvc.core.util.dom
Class DefaultDOMLoader

java.lang.Object
  extended by org.barracudamvc.core.util.dom.DefaultDOMLoader
All Implemented Interfaces:
DOMLoader

public class DefaultDOMLoader
extends Object
implements DOMLoader

Default implementation of a DOMLoader

See Also:
DOMLoader

Field Summary
protected  Map classmap
           
protected  DOMFactory defaultDOMFactory
           
protected  Map factories
           
protected static DefaultDOMLoader globalLoader
           
protected static boolean initialized
          used for flagging whether the globalLoader has been initialized and avoiding unnecessary instantiation and synchronization.
protected static org.apache.log4j.Logger logger
           
protected static Object sync
          arbitrary object used to synchronize upon
 
Method Summary
 void deregisterDOMFactory(String key)
          Deregister a DOMFactory keyed against a fully qualified class name or a document path
 Document getDOM(Class clazz)
          Get the DOM associated with the provided class, based on the default locale
 Document getDOM(Class clazz, Locale locale)
          Get the DOM associated with the provided class, based on the specified locale
 Document getDOM(String docPath)
          Note: the default locale is currently ignored in this implementation
 Document getDOM(String docPath, Locale locale)
          Note: the specified locale is currently ignored in this implementation
static DefaultDOMLoader getGlobalInstance()
          Get the global instance of the DefaultDOMLoader
protected  Class lookupClass(String className)
          Find a stored reference to a class.
 void registerDOMFactory(DOMFactory df, String key)
          Register a DOMFactory keyed against a fully qualified class name or a document path
 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 final org.apache.log4j.Logger logger

globalLoader

protected static DefaultDOMLoader globalLoader
See Also:
getGlobalInstance()

sync

protected static final Object sync
arbitrary object used to synchronize upon


initialized

protected static boolean initialized
used for flagging whether the globalLoader has been initialized and avoiding unnecessary instantiation and synchronization.


defaultDOMFactory

protected DOMFactory defaultDOMFactory
See Also:
setDefaultDOMFactory(DOMFactory)

factories

protected Map factories
See Also:
registerDOMFactory(DOMFactory, String), deregisterDOMFactory(String)

classmap

protected Map classmap
See Also:
lookupClass(String)
Method Detail

getDOM

public Document getDOM(Class clazz)
                throws IOException
Description copied from interface: DOMLoader
Get the DOM associated with the provided class, based on the default locale

Specified by:
getDOM in interface DOMLoader
Parameters:
clazz - the class to be loaded as a Document object
Returns:
the document that most closely corresponds with the requested class/locale combination
Throws:
IOException
See Also:
DOMLoader.getDOM(Class)

getDOM

public Document getDOM(Class clazz,
                       Locale locale)
                throws IOException
Description copied from interface: DOMLoader
Get the DOM associated with the provided class, based on the specified locale

Specified by:
getDOM in interface DOMLoader
Parameters:
clazz - the class to be loaded as a Document object
locale - the target Locale (may be null)
Returns:
the document that most closely corresponds with the requested class/locale combination
Throws:
IOException
See Also:
DOMLoader.getDOM(Class, Locale)

getDOM

public Document getDOM(String docPath)
                throws IOException
Note: the default locale is currently ignored in this implementation

Specified by:
getDOM in interface DOMLoader
Parameters:
docPath - the path to the document to be loaded as a Document object
Returns:
the document that most closely corresponds with the requested docPath/locale combination
Throws:
IOException
See Also:
DOMLoader.getDOM(String)

getDOM

public Document getDOM(String docPath,
                       Locale locale)
                throws IOException
Note: the specified locale is currently ignored in this implementation

Specified by:
getDOM in interface DOMLoader
Parameters:
docPath - the path to the document to be loaded as a Document object
locale - the target Locale (may be null)
Returns:
the document that most closely corresponds with the requested docPath/locale combination
Throws:
IOException
See Also:
DOMLoader.getDOM(String, Locale)

lookupClass

protected Class lookupClass(String className)
Find a stored reference to a class. If not found, instantiate it and store it for later reference and faster retrieval.

Parameters:
className - the fully qualified name of a class
Returns:
the instantiated class

setDefaultDOMFactory

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

Parameters:
df - the DOMFactory to be used by default

registerDOMFactory

public void registerDOMFactory(DOMFactory df,
                               String key)
Register a DOMFactory keyed against a fully qualified class name or a document path

Parameters:
df - the DOMFactory
key - the string which key's a particular DOMFactory to be used

deregisterDOMFactory

public void deregisterDOMFactory(String key)
Deregister a DOMFactory keyed against a fully qualified class name or a document path

Parameters:
key - the string which key's a particular DOMFactory to be removed

getGlobalInstance

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

Returns:
the global instance of the DefaultDOMLoader


Copyright © 2006 BarracudaMVC.org All Rights Reserved.