org.apache.jackrabbit.core.nodetype
Class EffectiveNodeTypeCacheImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.nodetype.EffectiveNodeTypeCacheImpl
All Implemented Interfaces:
Cloneable, EffectiveNodeTypeCache, Dumpable

public class EffectiveNodeTypeCacheImpl
extends Object
implements EffectiveNodeTypeCache

EffectiveNodeTypeCache implementation that uses an array of node type names as key for caching the effective node types.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.jackrabbit.core.nodetype.EffectiveNodeTypeCache
EffectiveNodeTypeCache.Key
 
Method Summary
 Object clone()
          
 boolean contains(EffectiveNodeTypeCache.Key key)
          Checks if the effective node type for the given key exists.
 void dump(PrintStream ps)
          Dumps the state of this instance in a human readable format for diagnostic purposes.
 EffectiveNodeTypeCache.Key findBest(EffectiveNodeTypeCache.Key key)
          Searches the best key k for which the given key is a super set, i.e. for which EffectiveNodeTypeCache.contains(Key)} returns true.
 EffectiveNodeType get(EffectiveNodeTypeCache.Key key)
          Returns the effective node type for the given key or null if the desired node type is not cached.
 EffectiveNodeTypeCache.Key getKey(Name[] ntNames)
          Returns a key for an effective node type that consists of the given node type names.
 void invalidate(Name name)
          Removes all effective node types that are aggregated with the node type of the given name.
 void put(EffectiveNodeType ent)
          Puts an effective node type to the cache.
 void put(EffectiveNodeTypeCache.Key key, EffectiveNodeType ent)
          Puts an effective node type to the cache for the given key.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getKey

public EffectiveNodeTypeCache.Key getKey(Name[] ntNames)
Returns a key for an effective node type that consists of the given node type names.

Specified by:
getKey in interface EffectiveNodeTypeCache
Parameters:
ntNames - the array of node type names for the effective node type
Returns:
the key to an effective node type.

put

public void put(EffectiveNodeType ent)
Puts an effective node type to the cache. The key is internally generated from the set of merged node types.

Specified by:
put in interface EffectiveNodeTypeCache
Parameters:
ent - the effective node type to put to the cache

put

public void put(EffectiveNodeTypeCache.Key key,
                EffectiveNodeType ent)
Puts an effective node type to the cache for the given key.

Specified by:
put in interface EffectiveNodeTypeCache
Parameters:
key - the key for the effective node type
ent - the effective node type to put to the cache

contains

public boolean contains(EffectiveNodeTypeCache.Key key)
Checks if the effective node type for the given key exists.

Specified by:
contains in interface EffectiveNodeTypeCache
Parameters:
key - the key to check
Returns:
true if the effective node type is cached; false otherwise.

get

public EffectiveNodeType get(EffectiveNodeTypeCache.Key key)
Returns the effective node type for the given key or null if the desired node type is not cached.

Specified by:
get in interface EffectiveNodeTypeCache
Parameters:
key - the key for the effective node type.
Returns:
the effective node type or null

invalidate

public void invalidate(Name name)
Removes all effective node types that are aggregated with the node type of the given name.

Specified by:
invalidate in interface EffectiveNodeTypeCache
Parameters:
name - the name of the node type.

findBest

public EffectiveNodeTypeCache.Key findBest(EffectiveNodeTypeCache.Key key)
Description copied from interface: EffectiveNodeTypeCache
Searches the best key k for which the given key is a super set, i.e. for which EffectiveNodeTypeCache.contains(Key)} returns true. If an already cached effective node type matches the key it is returned.

Specified by:
findBest in interface EffectiveNodeTypeCache
Parameters:
key - the key for which the subkey is to be searched
Returns:
the best key or null if no key could be found.

clone

public Object clone()

Specified by:
clone in interface EffectiveNodeTypeCache
Overrides:
clone in class Object

dump

public void dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes.

Specified by:
dump in interface Dumpable
Parameters:
ps - stream to dump state to


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.