/*
* JBoss, Home of Professional Open Source.
* Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache;
import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
/**
* An internal node interface, that represents nodes that directly form the tree structure in the cache. This is as opposed
* to {@link Node} and its {@link NodeSPI} sub-interface, which are typically implemented by delegates which then delegate calls
* to internal nodes, potentially after passing the call up an interceptor chain.
*
* All calls on an InternalNode are executed directly on the data structure. Usually, XXXDirect() calls on {@link NodeSPI}
* delegate to calls on an InternalNode, for example, {@link NodeSPI#putDirect(Object, Object)} delegating to {@link #put(Object, Object)}.
*
*
* @author Manik Surtani (manik AT jboss DOT org)
* @since 3.0
*/
public interface InternalNode
{
// --------------- basic access to he internal state of the node. -------------------------
V get(K key);
Map getData();
V put(K key, V value);
void putAll(Map extends K, ? extends V> data);
V remove(K key);
void clear();
Set getKeys();
boolean containsKey(K key);
void setInternalState(Map state);
Map getInternalState(boolean onlyInternalState);
void releaseObjectReferences(boolean recursive);
// --------------- node naming and tree structure ---------------------
/**
* @return the node's Fqn
*/
Fqn getFqn();
/**
* Sets the node's Fqn
*
* @param fqn Fqn to set to
*/
void setFqn(Fqn fqn);
boolean hasChildren();
// ***************** Old legacy methods that assume that the child map maintained contains NodeSPIs. These are still retained to support Optimistic and Pessimistic Locking ***************
@Deprecated
NodeSPI getChildDirect(Fqn fqn);
@Deprecated
NodeSPI getChildDirect(Object childName);
@Deprecated
Set> getChildrenDirect();
@Deprecated
Set> getChildrenDirect(boolean includeMarkedForRemoval);
@Deprecated
Map