net.sf.jolene.factories
Class DocumentFactory

java.lang.Object
  extended by net.sf.jolene.factories.DocumentFactory

public class DocumentFactory
extends java.lang.Object

DocumentFactory is a Singleton used to perform cacheing of documents. Documents added to the cache are not parsed again. Instead they are cloned which is faster.

Author:
Dan Howard

Method Summary
 Document getDocument(java.lang.String docFileName)
          Returns a new document instance using the full filename + timestamp as the factory key.
 Document getDocument(java.lang.String docFileName, java.lang.String contextPath, java.lang.String uri)
          Returns a new document instance using the full filename + timestamp as the factory key.
static DocumentFactory getInstance()
          Gets the factory instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DocumentFactory getInstance()
Gets the factory instance.

Returns:
DocumentFactory instance.

getDocument

public Document getDocument(java.lang.String docFileName)
                     throws java.io.IOException
Returns a new document instance using the full filename + timestamp as the factory key.

Parameters:
docFileName - full path and name to the file to get.
Returns:
Document the document object from the cache.
Throws:
java.io.IOException - if any IOException occurs.

getDocument

public Document getDocument(java.lang.String docFileName,
                            java.lang.String contextPath,
                            java.lang.String uri)
                     throws java.io.IOException
Returns a new document instance using the full filename + timestamp as the factory key.

Parameters:
docFileName - full path and name to the file to get.
contextPath - aids in finding the document's real path from the uri.
uri - uri to the document.
Returns:
Document the document object from the cache.
Throws:
java.io.IOException - if ever an IOException occurs.