org.ozoneDB.xml.dom4j.o3impl
Class NamespaceCacheImpl

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
      extended byorg.ozoneDB.xml.dom4j.o3impl.NamespaceCacheImpl
All Implemented Interfaces:
org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, OzoneNamespaceCache, org.ozoneDB.OzoneRemote, java.io.Serializable
Direct Known Subclasses:
O3NamespaceCache

public class NamespaceCacheImpl
extends org.ozoneDB.OzoneObject
implements OzoneNamespaceCache

NamespaceCacheImpl caches instances of AbstractNamespace for reuse both across documents and within documents.

Version:
$Revision$
Author:
James Strachan, Per Nyfelt
See Also:
Serialized Form

Field Summary
protected static java.util.Map cache
          Cache of Map instances indexed by URI which contain caches of Namespace impolementation instances for each prefix
static Namespace NO_NAMESPACE
           
protected static java.util.Map noPrefixCache
          Cache of AbstractNamespace instances indexed by URI for default namespaces with no prefixes
static Namespace XML_NAMESPACE
           
 
Constructor Summary
NamespaceCacheImpl()
           
 
Method Summary
protected  Namespace createNamespace(java.lang.String prefix, java.lang.String uri)
          A factory method to create AbstractNamespace instance
protected  java.util.Map createPrefixMap()
          A factory method to create prefix caches
protected  java.util.Map createURIMap()
          A factory method to create URI caches
 Namespace get(java.lang.String uri)
           
 Namespace get(java.lang.String prefix, java.lang.String uri)
           
static OzoneNamespaceCache getInstance(org.ozoneDB.OzoneInterface db)
           
 Namespace getNoNamespace()
           
protected  java.util.Map getURICache(java.lang.String uri)
           
 Namespace getXmlNamespace()
           
 void onCreate()
           
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, equals, getHandle, getObjectID, handle, hashCode, onActivate, onDelete, onPassivate, requireWriteLocking, self, setContainer, toString, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 

Field Detail

cache

protected static java.util.Map cache
Cache of Map instances indexed by URI which contain caches of Namespace impolementation instances for each prefix


noPrefixCache

protected static java.util.Map noPrefixCache
Cache of AbstractNamespace instances indexed by URI for default namespaces with no prefixes


XML_NAMESPACE

public static Namespace XML_NAMESPACE

NO_NAMESPACE

public static Namespace NO_NAMESPACE
Constructor Detail

NamespaceCacheImpl

public NamespaceCacheImpl()
Method Detail

getInstance

public static OzoneNamespaceCache getInstance(org.ozoneDB.OzoneInterface db)

onCreate

public void onCreate()
Specified by:
onCreate in interface org.ozoneDB.OzoneCompatible

get

public Namespace get(java.lang.String prefix,
                     java.lang.String uri)
Specified by:
get in interface OzoneNamespaceCache
Returns:
the name model for the given name and namepsace

get

public Namespace get(java.lang.String uri)
Specified by:
get in interface OzoneNamespaceCache
Returns:
the name model for the given name and namepsace

getXmlNamespace

public Namespace getXmlNamespace()
Specified by:
getXmlNamespace in interface OzoneNamespaceCache

getNoNamespace

public Namespace getNoNamespace()
Specified by:
getNoNamespace in interface OzoneNamespaceCache

getURICache

protected java.util.Map getURICache(java.lang.String uri)
Returns:
the cache for the given namespace URI. If one does not currently exist it is created.

createNamespace

protected Namespace createNamespace(java.lang.String prefix,
                                    java.lang.String uri)
A factory method to create AbstractNamespace instance

Returns:
a newly created Namespace instance.

createPrefixMap

protected java.util.Map createPrefixMap()
A factory method to create prefix caches

Returns:
a newly created Map instance.

createURIMap

protected java.util.Map createURIMap()
A factory method to create URI caches

Returns:
a newly created Map instance.


Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.