org.jboss.cache
Class UnversionedNode<K,V>

java.lang.Object
  extended by org.jboss.cache.AbstractNode<K,V>
      extended by org.jboss.cache.UnversionedNode<K,V>
Direct Known Subclasses:
VersionedNode

public class UnversionedNode<K,V>
extends AbstractNode<K,V>

Basic data node class. Throws UnsupportedOperationException for version-specific methods like getVersion() and setVersion(org.jboss.cache.optimistic.DataVersion), defined in NodeSPI.

Since:
2.0.0
Author:
Manik Surtani (manik@jboss.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.cache.AbstractNode
AbstractNode.NodeFlags
 
Field Summary
protected  NodeSPI delegate
           
protected  IdentityLock lock_
          Lock manager that manages locks to be acquired when accessing the node inside a transaction.
protected static org.apache.commons.logging.Log log
          Debug log.
protected static boolean trace
           
 
Fields inherited from class org.jboss.cache.AbstractNode
children, flags, fqn
 
Constructor Summary
  UnversionedNode()
          Constructs a new node with an FQN of Root.
protected UnversionedNode(Object child_name, Fqn fqn, Map data, boolean mapSafe, CacheSPI cache)
          Constructs a new node with a name, etc.
 
Method Summary
 void addChild(Object child_name, Node n)
           
 NodeSPI addChildDirect(Fqn f)
           
 NodeSPI addChildDirect(Fqn f, boolean notify)
           
 void addChildDirect(NodeSPI child)
           
 NodeSPI addChildDirect(Object childName, boolean notify)
           
 void clearDataDirect()
           
 Object get(Object key)
           
 CacheSPI getCache()
           
 NodeSPI getChildDirect(Fqn fqn)
           
 NodeSPI getChildDirect(Object childName)
           
 Set<NodeSPI> getChildrenDirect()
           
 Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
           
 Map<Object,Node<K,V>> getChildrenMapDirect()
           
 Set<Object> getChildrenNamesDirect()
           
 Map getDataDirect()
           
 NodeSPI getDelegate()
           
 Object getDirect(Object key)
           
 Fqn getFqn()
          Returns the name of this node.
 Map getInternalState(boolean onlyInternalState)
           
 Set<Object> getKeysDirect()
           
 IdentityLock getLock()
           
 NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify)
           
 NodeSPI getParent()
          Returns a parent by checking the TreeMap by name.
 DataVersion getVersion()
           
 boolean hasChildrenDirect()
           
protected  void initFlags()
          This method initialises flags on the node, by setting DATA_LOADED to true and VALID to true and all other flags to false.
protected  void initLock()
           
 void injectDependencies(CacheSPI spi, TransactionTable transactionTable, CommandsFactory commandsFactory)
           
 boolean isChildrenLoaded()
           
 boolean isDataLoaded()
          Returns true if the data was loaded from the cache loader.
 boolean isLockForChildInsertRemove()
           
 boolean isValid()
           
 void printDetails(StringBuffer sb, int indent)
           
 Object put(Object key, Object value)
           
 void putAll(Map data)
           
 void putAllDirect(Map data)
           
 Object putDirect(Object key, Object value)
           
 void releaseObjectReferences(boolean recursive)
           
 Object remove(Object key)
           
 boolean removeChildDirect(Fqn f)
           
 boolean removeChildDirect(Object childName)
           
 void removeChildrenDirect()
           
 Object removeDirect(Object key)
           
 void setChildrenLoaded(boolean childrenLoaded)
           
 void setChildrenMapDirect(Map<Object,Node<K,V>> children)
           
 void setDataLoaded(boolean dataLoaded)
          Sets if the data was loaded from the cache loader.
 void setDelegate(NodeSPI delegate)
           
 void setFqn(Fqn fqn)
           
 void setInternalState(Map state)
           
 void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
           
 void setValid(boolean valid, boolean recursive)
           
 void setVersion(DataVersion version)
           
 String toString()
          Returns a debug string.
 
Methods inherited from class org.jboss.cache.AbstractNode
equals, hashCode, isDeleted, isResident, markAsDeleted, markAsDeleted, setFlag, setResident
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Debug log.


trace

protected static final boolean trace

lock_

protected transient IdentityLock lock_
Lock manager that manages locks to be acquired when accessing the node inside a transaction. Lazy set just in case locking is not needed.


delegate

protected NodeSPI delegate
Constructor Detail

UnversionedNode

public UnversionedNode()
Constructs a new node with an FQN of Root.


UnversionedNode

protected UnversionedNode(Object child_name,
                          Fqn fqn,
                          Map data,
                          boolean mapSafe,
                          CacheSPI cache)
Constructs a new node with a name, etc.

Parameters:
mapSafe - true if param data can safely be directly assigned to this object's data field; false if param data's contents should be copied into this object's data field.
Method Detail

initFlags

protected void initFlags()
This method initialises flags on the node, by setting DATA_LOADED to true and VALID to true and all other flags to false. The flags are defined in the NodeFlags enum.


getDelegate

public NodeSPI getDelegate()

setDelegate

public void setDelegate(NodeSPI delegate)

injectDependencies

public void injectDependencies(CacheSPI spi,
                               TransactionTable transactionTable,
                               CommandsFactory commandsFactory)

getParent

public NodeSPI getParent()
Returns a parent by checking the TreeMap by name.


initLock

protected void initLock()

getCache

public CacheSPI getCache()

isChildrenLoaded

public boolean isChildrenLoaded()

setChildrenLoaded

public void setChildrenLoaded(boolean childrenLoaded)

get

public Object get(Object key)

getDirect

public Object getDirect(Object key)

getLock

public IdentityLock getLock()

getDataDirect

public Map getDataDirect()

put

public Object put(Object key,
                  Object value)

putDirect

public Object putDirect(Object key,
                        Object value)

getOrCreateChild

public NodeSPI getOrCreateChild(Object child_name,
                                GlobalTransaction gtx,
                                boolean notify)

remove

public Object remove(Object key)

removeDirect

public Object removeDirect(Object key)

printDetails

public void printDetails(StringBuffer sb,
                         int indent)

toString

public String toString()
Returns a debug string.

Overrides:
toString in class Object

addChildDirect

public void addChildDirect(NodeSPI child)

addChildDirect

public NodeSPI addChildDirect(Fqn f)

addChildDirect

public NodeSPI addChildDirect(Fqn f,
                              boolean notify)

addChildDirect

public NodeSPI addChildDirect(Object childName,
                              boolean notify)

clearDataDirect

public void clearDataDirect()

getChildDirect

public NodeSPI getChildDirect(Fqn fqn)

getChildrenNamesDirect

public Set<Object> getChildrenNamesDirect()

getKeysDirect

public Set<Object> getKeysDirect()

removeChildDirect

public boolean removeChildDirect(Object childName)

removeChildDirect

public boolean removeChildDirect(Fqn f)

getChildrenMapDirect

public Map<Object,Node<K,V>> getChildrenMapDirect()

setChildrenMapDirect

public void setChildrenMapDirect(Map<Object,Node<K,V>> children)

putAll

public void putAll(Map data)

putAllDirect

public void putAllDirect(Map data)

removeChildrenDirect

public void removeChildrenDirect()

setVersion

public void setVersion(DataVersion version)

getVersion

public DataVersion getVersion()

addChild

public void addChild(Object child_name,
                     Node n)

getFqn

public Fqn getFqn()
Returns the name of this node.


setFqn

public void setFqn(Fqn fqn)

getChildDirect

public NodeSPI getChildDirect(Object childName)

getChildrenDirect

public Set<NodeSPI> getChildrenDirect()

hasChildrenDirect

public boolean hasChildrenDirect()

getChildrenDirect

public Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)

isDataLoaded

public boolean isDataLoaded()
Returns true if the data was loaded from the cache loader.


setDataLoaded

public void setDataLoaded(boolean dataLoaded)
Sets if the data was loaded from the cache loader.


isValid

public boolean isValid()

setValid

public void setValid(boolean valid,
                     boolean recursive)

isLockForChildInsertRemove

public boolean isLockForChildInsertRemove()

setLockForChildInsertRemove

public void setLockForChildInsertRemove(boolean lockForChildInsertRemove)

setInternalState

public void setInternalState(Map state)

getInternalState

public Map getInternalState(boolean onlyInternalState)

releaseObjectReferences

public void releaseObjectReferences(boolean recursive)


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.