org.barracudamvc.core.util.dom
Class JivanDOMFactory

java.lang.Object
  extended byorg.barracudamvc.core.util.dom.JivanDOMFactory
All Implemented Interfaces:
DOMFactory

public class JivanDOMFactory
extends Object
implements DOMFactory

Jivan implementation of a DOMFactory. This class will load a DOM using the Jivan DocumentFactory.


Field Summary
protected  boolean initialized
          used for flagging whether the jivanFactory has been initialized and avoiding unnecessary synchronization.
protected  org.jivan.html.document.DocumentFactory jivanFactory
          Jivan DocumentFactory instance, stored so that it isn't re-created on every request.
protected static org.apache.log4j.Logger logger
          used for logging
protected  javax.servlet.ServletContext servletContext
          optional, used to load resources from oa servlet context
protected  Object sync
          arbitrary object used to synchronize upon
 
Constructor Summary
JivanDOMFactory()
           
 
Method Summary
 Document getInstance(Class clazz)
          This method is not supported by this dom factory and will immediately throw an IOException if called!
 Document getInstance(String docPath)
          Load a document directly from file using Jivan.
 void setServletContext(javax.servlet.ServletContext iservletContext)
          Optional method to set the current servlet context.
 
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
used for logging


servletContext

protected javax.servlet.ServletContext servletContext
optional, used to load resources from oa servlet context

See Also:
setServletContext(ServletContext)

sync

protected final Object sync
arbitrary object used to synchronize upon


initialized

protected boolean initialized
used for flagging whether the jivanFactory has been initialized and avoiding unnecessary synchronization.


jivanFactory

protected org.jivan.html.document.DocumentFactory jivanFactory
Jivan DocumentFactory instance, stored so that it isn't re-created on every request.

Constructor Detail

JivanDOMFactory

public JivanDOMFactory()
Method Detail

getInstance

public Document getInstance(Class clazz)
                     throws IOException
This method is not supported by this dom factory and will immediately throw an IOException if called!

Jivan does not use a wrapper class for documents like XMLC. If you already have a Jivan DocumentManager, just use that directly.

Specified by:
getInstance in interface DOMFactory
Parameters:
clazz - the class to be loaded as a Document object
Returns:
a Document object
Throws:
IOException

getInstance

public Document getInstance(String docPath)
                     throws IOException
Load a document directly from file using Jivan.

The docPath can be provided in one of two forms: a path relative to a servlet context such as "/WEB-INF/templates/foo.html", in which case one would have to call setServletContext(javax.servlet.ServletContext) before the first call to this method, or a fully qualified URL (or URI) such as that returned by URL.toExternalForm().

Specified by:
getInstance in interface DOMFactory
Parameters:
docPath - the path to the document to be loaded as a Document object
Returns:
a Document object
Throws:
IOException
See Also:
DOMFactory.getInstance(String)

setServletContext

public void setServletContext(javax.servlet.ServletContext iservletContext)
Optional method to set the current servlet context. Allows for a docPath such as "/WEB-INF/templates/foo.html". If the servlet context is not set, a docPath of this type will fail resulting in getInstance() returning an IOException. Must be set before getInstance() is first called in order to be used.

Parameters:
iservletContext - the current servlet context


Copyright © 2004 BarracudaMVC.org All Rights Reserved.