it.eng.geo.map
Class DocumentLoader

java.lang.Object
  extended by it.eng.geo.map.DocumentLoader

public class DocumentLoader
extends java.lang.Object

This class is responsible on loading an SVG document and maintaining a cache.

Version:
$Id: DocumentLoader.java,v 1.23 2005/01/03 10:48:05 deweese Exp $
Author:
Thierry Kormann

Nested Class Summary
private  class DocumentLoader.DocumentState
          A simple class that contains a Document and its number of nodes.
 
Field Summary
protected  java.util.HashMap cacheMap
          The map that contains the Document indexed by the URI.
protected  org.apache.batik.dom.svg.SVGDocumentFactory documentFactory
          The document factory used to create the document according a DOM implementation.
protected  org.apache.batik.bridge.UserAgent userAgent
          The user agent.
 
Constructor Summary
protected DocumentLoader()
          Constructs a new DocumentLoader.
  DocumentLoader(org.apache.batik.bridge.UserAgent userAgent)
          Constructs a new DocumentLoader with the specified XML parser.
 
Method Summary
 org.w3c.dom.Document checkCache(java.lang.String uri)
           
 void dispose()
          Disposes and releases all resources allocated by this document loader.
 int getLineNumber(org.w3c.dom.Element e)
          Returns the line in the source code of the specified element or -1 if not found.
 org.apache.batik.bridge.UserAgent getUserAgent()
          Returns the userAgent used by this DocumentLoader
 org.w3c.dom.Document loadDocument(java.lang.String uri)
          Returns a document from the specified uri.
 org.w3c.dom.Document loadDocument(java.lang.String uri, java.io.InputStream is)
          Returns a document from the specified uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentFactory

protected org.apache.batik.dom.svg.SVGDocumentFactory documentFactory
The document factory used to create the document according a DOM implementation.


cacheMap

protected java.util.HashMap cacheMap
The map that contains the Document indexed by the URI. WARNING: tagged private as no element of this Map should be referenced outise of this class


userAgent

protected org.apache.batik.bridge.UserAgent userAgent
The user agent.

Constructor Detail

DocumentLoader

protected DocumentLoader()
Constructs a new DocumentLoader.


DocumentLoader

public DocumentLoader(org.apache.batik.bridge.UserAgent userAgent)
Constructs a new DocumentLoader with the specified XML parser.

Parameters:
userAgent - the user agent to use
Method Detail

checkCache

public org.w3c.dom.Document checkCache(java.lang.String uri)

loadDocument

public org.w3c.dom.Document loadDocument(java.lang.String uri)
                                  throws java.io.IOException
Returns a document from the specified uri.

Parameters:
uri - the uri of the document
Throws:
java.io.IOException - if an I/O error occured while loading the document

loadDocument

public org.w3c.dom.Document loadDocument(java.lang.String uri,
                                         java.io.InputStream is)
                                  throws java.io.IOException
Returns a document from the specified uri.

Parameters:
uri - the uri of the document
Throws:
java.io.IOException - if an I/O error occured while loading the document

getUserAgent

public org.apache.batik.bridge.UserAgent getUserAgent()
Returns the userAgent used by this DocumentLoader


dispose

public void dispose()
Disposes and releases all resources allocated by this document loader.


getLineNumber

public int getLineNumber(org.w3c.dom.Element e)
Returns the line in the source code of the specified element or -1 if not found.

Parameters:
e - the element
Returns:
-1 the document has been removed from the cache or has not been loaded by this document loader.