[jboss-cvs] JBossCache/src/org/jboss/cache ...

Manik Surtani msurtani at jboss.com
Wed Jul 19 17:34:45 EDT 2006


  User: msurtani
  Date: 06/07/19 17:34:45

  Modified:    src/org/jboss/cache          Cache.java CacheSPI.java
                        Fqn.java Node.java RPCManager.java
                        TransactionEntry.java TreeCache.java
                        TreeCacheProxyImpl.java TreeCacheView.java
  Log:
  JBCACHE-657
  JBCACHE-594
  
  Revision  Changes    Path
  1.3       +1 -0      JBossCache/src/org/jboss/cache/Cache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Cache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Cache.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- Cache.java	18 Jul 2006 10:50:46 -0000	1.2
  +++ Cache.java	19 Jul 2006 21:34:45 -0000	1.3
  @@ -105,4 +105,5 @@
        * Lifecycle method
        */
       void destroy();
  +
   }
  
  
  
  1.4       +44 -1     JBossCache/src/org/jboss/cache/CacheSPI.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheSPI.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheSPI.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- CacheSPI.java	19 Jul 2006 08:29:18 -0000	1.3
  +++ CacheSPI.java	19 Jul 2006 21:34:45 -0000	1.4
  @@ -10,10 +10,16 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.interceptors.Interceptor;
   import org.jboss.cache.loader.CacheLoader;
  +import org.jboss.cache.loader.CacheLoaderManager;
  +import org.jboss.cache.eviction.RegionManager;
   import org.jgroups.Address;
  +import org.jgroups.blocks.MethodCall;
   
   import javax.management.ObjectName;
  +import javax.transaction.TransactionManager;
  +import javax.transaction.Transaction;
   import java.util.List;
  +import java.util.Map;
   
   /**
    * A more detailed interface to {@link Cache}, which is used when writing plugins for or extending JBoss Cache.
  @@ -100,5 +106,42 @@
        */
       ObjectName getServiceName();
   
  -    Object getTransactionManager();
  +    TransactionManager getTransactionManager();
  +
  +    ReplicationQueue getReplQueue();
  +
  +    int getNumberOfAttributes();
  +
  +    int getNumberOfNodes();
  +
  +    CacheLoaderManager getCacheLoaderManager();
  +
  +    void addUndoOperation(GlobalTransaction tx, MethodCall undo_op);
  +
  +    RegionManager getEvictionRegionManager();
  +
  +    Map getLockTable();
  +
  +    // TODO: Figure out how we deal with these:
  +    DataNode peek(Fqn fqn);
  +
  +    void _evict(Fqn fqn);
  +
  +    void notifyNodeLoaded(Fqn fqn);
  +
  +
  +    void notifyNodeCreated(Fqn fqn);
  +
  +    Node _get(Fqn fqn);
  +
  +    void notifyNodeActivate(Fqn fqn, boolean b);
  +
  +    void notifyNodePassivate(Fqn fqn, boolean b);
  +
  +    org.jboss.cache.marshall.RegionManager getRegionManager();
  +
  +    List _gravitateData(Fqn fqn, boolean b, boolean b1);
  +
  +    GlobalTransaction getCurrentTransaction(Transaction tx);
  +
   }
  
  
  
  1.34      +3 -4      JBossCache/src/org/jboss/cache/Fqn.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Fqn.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Fqn.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -b -r1.33 -r1.34
  --- Fqn.java	18 Jul 2006 16:32:48 -0000	1.33
  +++ Fqn.java	19 Jul 2006 21:34:45 -0000	1.34
  @@ -39,7 +39,7 @@
    * The latter will result in 3 Fqns, called "a", "b" and "c", where "c" is a child of "b", "b" is a child of "a", and "a" hangs off Fqn.ROOT.
    * <p />
    * Another way to look at it is that the "/" separarator is only parsed when it form sa  part of a String passed in to Fqn.fromString() and not otherwise.
  - * @version $Revision: 1.33 $
  + * @version $Revision: 1.34 $
    */
   public class Fqn implements Cloneable, Externalizable {
   
  @@ -313,12 +313,11 @@
       */
      public String toString()
      {
  -      if (isRoot())
  -         return TreeCache.SEPARATOR;
  +      if (isRoot()) return SEPARATOR;
         StringBuffer sb = new StringBuffer();
         for (Iterator it = elements.iterator(); it.hasNext();)
         {
  -         sb.append(TreeCache.SEPARATOR).append(it.next());
  +         sb.append(SEPARATOR).append(it.next());
         }
         return sb.toString();
      }
  
  
  
  1.42      +16 -0     JBossCache/src/org/jboss/cache/Node.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Node.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Node.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -b -r1.41 -r1.42
  --- Node.java	18 Jul 2006 10:50:46 -0000	1.41
  +++ Node.java	19 Jul 2006 21:34:45 -0000	1.42
  @@ -6,6 +6,8 @@
    */
   package org.jboss.cache;
   
  +import org.jboss.cache.lock.IdentityLock;
  +
   import java.util.Collection;
   import java.util.Map;
   import java.util.Set;
  @@ -180,4 +182,18 @@
        * @param newParent new location under which to attach the current node.
        */
       void move(Node newParent);
  +
  +    /**
  +     * @param f {@link Fqn} relative to the current node of the child you are testing the existence of.
  +     * @return Returns true if the child node denoted by the {@link Fqn} passed in exists.
  +     */
  +    boolean hasChild(Fqn f);
  +
  +    // TODO: Think about what we need to do here regarding locking on Nodes
  +    boolean acquire(Object owner, long lock_timeout, int lockTypeWrite);
  +
  +    IdentityLock getLock();
  +
  +    Set acquireAll(Object owner, long lock_timeout, int lock_type);
  +    
   }
  
  
  
  1.2       +10 -4     JBossCache/src/org/jboss/cache/RPCManager.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RPCManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RPCManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- RPCManager.java	19 Jul 2006 08:29:18 -0000	1.1
  +++ RPCManager.java	19 Jul 2006 21:34:45 -0000	1.2
  @@ -10,6 +10,7 @@
   import org.jgroups.blocks.MethodCall;
   
   import java.util.List;
  +import java.lang.reflect.Method;
   
   /**
    * Manager that handles all RPC calls between JBoss Cache instances
  @@ -34,9 +35,9 @@
   
       // for now, we delegate RPC calls to deprecated methods in TreeCache.
   
  -    public List callRemoteMethods(List<Address> mbrs, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
  +    public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
       {
  -        return c.callRemoteMethods(mbrs, methodCall, mode, excludeSelf, timeout);
  +        return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
       }
   
       public boolean isCoordinator()
  @@ -49,8 +50,13 @@
           return c.getCoordinator();
       }
   
  -    public List callRemoteMethods(List<Address> members, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
  +    public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
       {
  -        return c.callRemoteMethods(members, methodCall, synchronous, excludeSelf, timeout);
  +        return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
  +    }
  +
  +    public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
  +    {
  +        return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
       }
   }
  
  
  
  1.9       +7 -7      JBossCache/src/org/jboss/cache/TransactionEntry.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TransactionEntry.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TransactionEntry.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- TransactionEntry.java	12 Jun 2006 20:24:32 -0000	1.8
  +++ TransactionEntry.java	19 Jul 2006 21:34:45 -0000	1.9
  @@ -31,7 +31,7 @@
    * </ul>
    *
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a> Apr 14, 2003
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public class TransactionEntry {
   
  @@ -46,8 +46,8 @@
      /**
       * List<MethodCall> of modifications ({@link MethodCall}). They will be replicated on TX commit
       */
  -   protected List modification_list=new LinkedList();
  -   protected List cl_mod_list = new LinkedList();
  +   protected List<MethodCall> modification_list=new LinkedList<MethodCall>();
  +   protected List<MethodCall> cl_mod_list = new LinkedList<MethodCall>();
   
      /**
       * List<MethodCall>. List of compensating {@link org.jgroups.blocks.MethodCall} objects
  @@ -91,11 +91,11 @@
      /**
       * Returns all modifications.
       */
  -   public List getModifications() {
  +   public List<MethodCall> getModifications() {
         return modification_list;
      }
   
  -   public List getCacheLoaderModifications()
  +   public List<MethodCall> getCacheLoaderModifications()
      {
          return cl_mod_list;
      }
  @@ -224,7 +224,7 @@
      /**
       * Posts all undo operations to the TreeCache.
       */
  -   public void undoOperations(TreeCache cache) {
  +   public void undoOperations(CacheSPI cache) {
         ArrayList l;
         synchronized (undo_list) {
           l = new ArrayList(undo_list);
  @@ -235,7 +235,7 @@
         }
      }
   
  -   private void undo(MethodCall undo_op, TreeCache cache) {
  +   private void undo(MethodCall undo_op, CacheSPI cache) {
         try {
            Object retval = undo_op.invoke(cache);
             if (retval instanceof Throwable)
  
  
  
  1.204     +95 -1128  JBossCache/src/org/jboss/cache/TreeCache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
  retrieving revision 1.203
  retrieving revision 1.204
  diff -u -b -r1.203 -r1.204
  --- TreeCache.java	19 Jul 2006 18:54:07 -0000	1.203
  +++ TreeCache.java	19 Jul 2006 21:34:45 -0000	1.204
  @@ -12,20 +12,20 @@
   import org.jboss.cache.buddyreplication.BuddyGroup;
   import org.jboss.cache.buddyreplication.BuddyManager;
   import org.jboss.cache.config.CacheLoaderConfig;
  -import org.jboss.cache.config.Option;
   import org.jboss.cache.config.Configuration;
  -import org.jboss.cache.eviction.EvictionPolicy;
  +import org.jboss.cache.config.Option;
   import org.jboss.cache.factories.InterceptorChainFactory;
   import org.jboss.cache.factories.NodeFactory;
   import org.jboss.cache.interceptors.Interceptor;
  +import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.loader.CacheLoaderManager;
   import org.jboss.cache.loader.NodeData;
  -import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.lock.IdentityLock;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.lock.LockingException;
   import org.jboss.cache.lock.TimeoutException;
  +import org.jboss.cache.marshall.JBCMethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
   import org.jboss.cache.marshall.Region;
  @@ -34,7 +34,6 @@
   import org.jboss.cache.marshall.RegionNotFoundException;
   import org.jboss.cache.marshall.TreeCacheMarshaller;
   import org.jboss.cache.marshall.VersionAwareMarshaller;
  -import org.jboss.cache.marshall.JBCMethodCall;
   import org.jboss.cache.optimistic.DataVersion;
   import org.jboss.cache.statetransfer.StateTransferFactory;
   import org.jboss.cache.statetransfer.StateTransferGenerator;
  @@ -49,10 +48,7 @@
   import org.jgroups.stack.IpAddress;
   import org.jgroups.util.Rsp;
   import org.jgroups.util.RspList;
  -import org.w3c.dom.Attr;
   import org.w3c.dom.Element;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.NodeList;
   
   import javax.management.MBeanOperationInfo;
   import javax.management.MBeanServer;
  @@ -62,7 +58,6 @@
   import javax.transaction.SystemException;
   import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
  -
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
   import java.io.NotSerializableException;
  @@ -79,19 +74,15 @@
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author Brian Stansberry
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Id: TreeCache.java,v 1.203 2006/07/19 18:54:07 msurtani Exp $
  + * @version $Id: TreeCache.java,v 1.204 2006/07/19 21:34:45 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  -public class TreeCache extends ServiceMBeanSupport implements Cloneable, MembershipListener, TreeCacheMBean
  +public class TreeCache extends ServiceMBeanSupport implements Cloneable, MembershipListener//, TreeCacheMBean
   {
      private static final String CREATE_MUX_CHANNEL = "createMultiplexerChannel";
      private static final String[] MUX_TYPES = {"java.lang.String", "java.lang.String"};
      private static final String JBOSS_SERVER_DOMAIN = "jboss";
  -   /**
  -    * Default replication version, from {@link Version#getVersionShort}.
  -    */
  -   public static final short DEFAULT_REPLICATION_VERSION = Version.getVersionShort();
   
      // Quite poor, but for now, root may be re-initialised when setNodeLockingOptimistic() is called.
      // this is because if node locking is optimistic, we need to use OptimisticTreeNodes rather than TreeNodes.
  @@ -151,21 +142,9 @@
      protected final static Log log = LogFactory.getLog(TreeCache.class);
   
      /**
  -    * Default cluster name.
  -    */
  -   protected String cluster_name = "TreeCache-Group";
  -
  -   /**
  -    * Default cluster properties.
  -    *
  -    * @see #getClusterProperties
  -    */
  -   protected String cluster_props = null;
  -
  -   /**
       * List of cluster group members.
       */
  -   protected final Vector members = new Vector();
  +   protected final Vector<Address> members = new Vector<Address>();
   
      /**
       * JGroups RpcDispatcher in use.
  @@ -178,28 +157,6 @@
      protected MessageListener ml = new MessageListenerAdaptor(log);
   
      /**
  -    * True if replication is queued.
  -    */
  -   protected boolean use_repl_queue = false;
  -
  -   /**
  -    * Maximum number of replicated elements to queue.
  -    */
  -   protected int repl_queue_max_elements = 1000;
  -
  -   /**
  -    * Replicated element queue interval.
  -    */
  -   protected long repl_queue_interval = 5000;
  -
  -   /**
  -    * True if MBean interceptors are used.
  -    *
  -    * @see #getUseInterceptorMbeans
  -    */
  -   protected boolean use_interceptor_mbeans = true;
  -
  -   /**
       * Maintains mapping of transactions (keys) and Modifications/Undo-Operations
       */
      private final TransactionTable tx_table = new TransactionTable();
  @@ -209,23 +166,8 @@
       */
      private final Map lock_table = Collections.synchronizedMap(new HashMap());
   
  -   protected boolean fetchInMemoryState = true;
  -
      protected boolean usingEviction = false;
   
  -   // These are private as the setters ensure consistency between them
  -   // - Brian
  -   private short replication_version = DEFAULT_REPLICATION_VERSION;
  -   private String repl_version_string = Version.getVersionString(DEFAULT_REPLICATION_VERSION);
  -
  -   protected long lock_acquisition_timeout = 10000;
  -   protected long state_fetch_timeout = lock_acquisition_timeout + 5000;
  -   protected long sync_repl_timeout = 15000;
  -   protected String eviction_policy_class = null;
  -   protected int cache_mode = LOCAL;
  -   protected boolean inactiveOnStartup = false;
  -   protected boolean isStandalone = false;
  -
      /**
       * Set<Fqn> of Fqns of the topmost node of internal regions that should
       * not included in standard state transfers.
  @@ -243,31 +185,15 @@
      protected Exception setStateException;
      private final Object stateLock = new Object();
   
  -   /**
  -    * Isolation level in use, default is {@link IsolationLevel#REPEATABLE_READ}.
  -    */
  -   protected IsolationLevel isolationLevel = IsolationLevel.REPEATABLE_READ;
  -
  -   /**
  -    * Eviction policy configuration in xml Element
  -    */
  -   protected Element evictConfig_ = null;
  -
  -
      protected String evictionInterceptorClass = "org.jboss.cache.interceptors.EvictionInterceptor";
   
      /**
  -    * True if we use region based marshalling.  Defaults to false.
  -    */
  -   protected boolean useRegionBasedMarshalling = false;
  -
  -   /**
       * Marshaller if register to handle marshalling
       */
      protected VersionAwareMarshaller marshaller_ = null;
   
      /**
  -    * RegionManager used by marshaller and ExtendedCacheLoader
  +    * RegionManager used by marshaller
       */
      protected RegionManager regionManager_ = null;
   
  @@ -288,20 +214,12 @@
       */
      protected TransactionManagerLookup tm_lookup = null;
   
  -   /**
  -    * Class of the implementation of TransactionManagerLookup
  -    */
  -   protected String tm_lookup_class = null;
   
      /**
       * Used to get the Transaction associated with the current thread
       */
      protected TransactionManager tm = null;
   
  -   /**
  -    * The XML Element from which to configure the CacheLoader
  -    */
  -   protected Element cacheLoaderConfig = null;
   
      protected CacheLoaderManager cacheLoaderManager;
      /**
  @@ -309,20 +227,6 @@
       */
      protected CacheLoaderConfig cloaderConfig;
   
  -   /**
  -    * True if there is a synchronous commit phase, otherwise asynchronous commit.
  -    */
  -   protected boolean sync_commit_phase = false;
  -
  -   /**
  -    * True if there is a synchronous rollback phase, otherwise asynchronous rollback.
  -    */
  -   protected boolean sync_rollback_phase = false;
  -
  -   /**
  -    * @deprecated DO NOT USE THIS. IT IS HERE FOR EJB3 COMPILATION COMPATIBILITY WITH JBOSSCACHE1.3
  -    */
  -   protected EvictionPolicy eviction_policy_provider;
   
      /**
       * Queue used to replicate updates when mode is repl-async
  @@ -330,38 +234,6 @@
      protected ReplicationQueue repl_queue = null;
   
      /**
  -    * @deprecated use {@link Fqn#SEPARATOR}.
  -    */
  -   public static final String SEPARATOR = Fqn.SEPARATOR;
  -
  -   /**
  -    * Entries in the cache are by default local and not replicated.
  -    */
  -   public static final int LOCAL = 1;
  -
  -   /**
  -    * Entries in the cache are by default replicated asynchronously.
  -    */
  -   public static final int REPL_ASYNC = 2;
  -
  -   /**
  -    * Entries in the cache are by default replicated synchronously.
  -    */
  -   public static final int REPL_SYNC = 3;
  -
  -   /**
  -    * Cache sends {@link #evict} calls to remote caches when a node is changed.
  -    * {@link #evict} calls are asynchronous.
  -    */
  -   public static final int INVALIDATION_ASYNC = 4;
  -
  -   /**
  -    * Cache sends {@link #evict} calls to remote caches when a node is changed.
  -    * {@link #evict} calls are synchronous.
  -    */
  -   public static final int INVALIDATION_SYNC = 5;
  -
  -   /**
       * Uninitialized node key.
       */
      static public final String UNINITIALIZED = "jboss:internal:uninitialized";
  @@ -377,15 +249,14 @@
      protected boolean useCreateService = false;
   
       /**
  -     * Buddy replication configuration XML element
  -     */
  -   protected Element buddyReplicationConfig;
  -
  -    /**
        * Buddy Manager
        */
      protected BuddyManager buddyManager;
   
  +   private boolean isStandalone = false;
  +
  +    private long stateFetchTimeout;
  +
      /**
       * Set of Fqns of nodes that are currently being processed by
       * activateReqion or inactivateRegion.  Requests for these fqns
  @@ -402,15 +273,11 @@
       private Configuration configuration;
   
       /**
  -     * Creates a channel with the given cluster name, properties, and state fetch timeout.
  +     * Creates a TreeCache with a given configuration
        */
  -    public TreeCache(String cluster_name, String props, long state_fetch_timeout) throws Exception
  +    public TreeCache(Configuration configuration) throws Exception
       {
  -       if (cluster_name != null)
  -          this.cluster_name = cluster_name;
  -       if (props != null)
  -          this.cluster_props = props;
  -       this.state_fetch_timeout = state_fetch_timeout;
  +        this.configuration = configuration;
       }
   
      /**
  @@ -456,7 +323,7 @@
      /**
       * Returns the members as a Vector.
       */
  -   public Vector getMembers()
  +   public Vector<Address> getMembers()
      {
         return members;
      }
  @@ -469,43 +336,6 @@
         return coordinator;
      }
   
  -   /**
  -    * Returns the name of the replication cluster group.
  -    */
  -   public String getClusterName()
  -   {
  -      return cluster_name;
  -   }
  -
  -   /**
  -    * Sets the name of the replication cluster group.
  -    */
  -   public void setClusterName(String name)
  -   {
  -      cluster_name = name;
  -   }
  -
  -   /**
  -    * Returns the cluster properties as a String.
  -    * In the case of JGroups, returns the JGroup protocol stack specification.
  -    */
  -   public String getClusterProperties()
  -   {
  -      return cluster_props;
  -   }
  -
  -   /**
  -    * Sets the cluster properties.
  -    * To use the new properties, the cache must be restarted using
  -    * {@link #stop} and {@link #start}.
  -    *
  -    * @param cluster_props The properties for the cluster (JGroups)
  -    */
  -   public void setClusterProperties(String cluster_props)
  -   {
  -      this.cluster_props = cluster_props;
  -   }
  -
      public String getMultiplexerService()
      {
         return mux_serviceName;
  @@ -515,7 +345,6 @@
      {
         log.warn("Cache multiplexer support not enabled yet.  " +
                  "MultiplexerService attribute will be ignored.");
  -      //mux_serviceName = serviceName;
      }
   
      public String getMultiplexerStack()
  @@ -602,24 +431,6 @@
      }
   
      /**
  -    * Returns the cache loader configuration element.
  -    */
  -   public Element getCacheLoaderConfiguration()
  -   {
  -      return cacheLoaderConfig;
  -   }
  -
  -   /**
  -    * Sets the cache loader configuration element.
  -    */
  -   public void setCacheLoaderConfiguration(Element cache_loader_config)
  -   {
  -      if (cloaderConfig != null)
  -         log.warn("Specified CacheLoaderConfig XML block will be ignored, because deprecated setters are used!");
  -      this.cacheLoaderConfig = cache_loader_config;
  -   }
  -
  -   /**
       * Returns the underlying cache loader in use.
       */
      public CacheLoader getCacheLoader()
  @@ -652,81 +463,6 @@
         return ml;
      }
   
  -   /**
  -    * Returns whether the entire tree is inactive upon startup, only responding
  -    * to replication messages after {@link #activateRegion(String)} is called
  -    * to activate one or more parts of the tree.
  -    * <p/>
  -    * This property is only relevant if {@link #getUseMarshalling()} is
  -    * <code>true</code>.
  -    */
  -   public boolean isInactiveOnStartup()
  -   {
  -      return inactiveOnStartup;
  -   }
  -
  -   /**
  -    * Sets whether the entire tree is inactive upon startup, only responding
  -    * to replication messages after {@link #activateRegion(String)} is
  -    * called to activage one or more parts of the tree.
  -    * <p/>
  -    * This property is only relevant if {@link #getUseMarshalling()} is
  -    * <code>true</code>.
  -    */
  -   public void setInactiveOnStartup(boolean inactiveOnStartup)
  -   {
  -      this.inactiveOnStartup = inactiveOnStartup;
  -   }
  -
  -   /**
  -    * Returns if sync commit phase is used.
  -    */
  -   public boolean getSyncCommitPhase()
  -   {
  -      return sync_commit_phase;
  -   }
  -
  -   /**
  -    * Sets if sync commit phase is used.
  -    */
  -   public void setSyncCommitPhase(boolean sync_commit_phase)
  -   {
  -      this.sync_commit_phase = sync_commit_phase;
  -   }
  -
  -   /**
  -    * Returns if sync rollback phase is used.
  -    */
  -   public boolean getSyncRollbackPhase()
  -   {
  -      return sync_rollback_phase;
  -   }
  -
  -   /**
  -    * Sets if sync rollback phase is used.
  -    */
  -   public void setSyncRollbackPhase(boolean sync_rollback_phase)
  -   {
  -      this.sync_rollback_phase = sync_rollback_phase;
  -   }
  -
  -   /**
  -    * Sets the eviction policy configuration element.
  -    */
  -   public void setEvictionPolicyConfig(Element config)
  -   {
  -      evictConfig_ = config;
  -      log.info("setEvictionPolicyConfig(): " + config);
  -   }
  -
  -   /**
  -    * Returns the eviction policy configuration element.
  -    */
  -   public Element getEvictionPolicyConfig()
  -   {
  -      return evictConfig_;
  -   }
  -
      public String getEvictionInterceptorClass()
      {
         return this.evictionInterceptorClass;
  @@ -742,416 +478,44 @@
         this.usingEviction = usingEviction;
      }
   
  -   /**
  -    * Converts a list of elements to a Java Groups property string.
  -    */
  -   public void setClusterConfig(Element config)
  +   private void setUseReplQueue(boolean flag)
      {
  -      StringBuffer buffer = new StringBuffer();
  -      NodeList stack = config.getChildNodes();
  -      int length = stack.getLength();
  -
  -      for (int s = 0; s < length; s++)
  -      {
  -         org.w3c.dom.Node node = stack.item(s);
  -         if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
  -            continue;
  -
  -         Element tag = (Element) node;
  -         String protocol = tag.getTagName();
  -         buffer.append(protocol);
  -         NamedNodeMap attrs = tag.getAttributes();
  -         int attrLength = attrs.getLength();
  -         if (attrLength > 0)
  -            buffer.append('(');
  -         for (int a = 0; a < attrLength; a++)
  -         {
  -            Attr attr = (Attr) attrs.item(a);
  -            String name = attr.getName();
  -            String value = attr.getValue();
  -            buffer.append(name);
  -            buffer.append('=');
  -            buffer.append(value);
  -            if (a < attrLength - 1)
  -               buffer.append(';');
  -         }
  -         if (attrLength > 0)
  -            buffer.append(')');
  -         buffer.append(':');
  -      }
  -      // Remove the trailing ':'
  -      buffer.setLength(buffer.length() - 1);
  -      setClusterProperties(buffer.toString());
  -      log.info("setting cluster properties from xml to: " + cluster_props);
  -   }
  -
  -
  -   /**
  -    * Returns the max time to wait until the initial state is retrieved.
  -    * This is used in a replicating cache: when a new cache joins the cluster,
  -    * it needs to acquire the (replicated) state of the other members to
  -    * initialize itself. If no state has been received within <tt>timeout</tt>
  -    * milliseconds, the map will be not be initialized.
  -    *
  -    * @return long milliseconds to wait for the state; 0 means to wait forever
  -    */
  -   public long getInitialStateRetrievalTimeout()
  -   {
  -      return state_fetch_timeout;
  -   }
  -
  -   /**
  -    * Sets the initial state transfer timeout.
  -    * see #getInitialStateRetrievalTimeout()
  -    */
  -   public void setInitialStateRetrievalTimeout(long timeout)
  -   {
  -      state_fetch_timeout = timeout;
  -   }
  -
  -   /**
  -    * Returns the current caching mode. String values returned are:
  -    * <ul>
  -    * <li>LOCAL
  -    * <li>REPL_ASYNC
  -    * <li>REPL_SYNC
  -    * <li>INVALIDATION_ASYNC
  -    * <li>INVALIDATION_SYNC
  -    * <ul>
  -    *
  -    * @return the caching mode
  -    */
  -   public String getCacheMode()
  -   {
  -      return mode2String(cache_mode);
  -   }
  -
  -   /**
  -    * Returns the internal caching mode as an integer.
  -    */
  -   public int getCacheModeInternal()
  -   {
  -      return cache_mode;
  -   }
  -
  -   private String mode2String(int mode)
  -   {
  -      switch (mode)
  -      {
  -         case LOCAL:
  -            return "LOCAL";
  -         case REPL_ASYNC:
  -            return "REPL_ASYNC";
  -         case REPL_SYNC:
  -            return "REPL_SYNC";
  -         case INVALIDATION_ASYNC:
  -            return "INVALIDATION_ASYNC";
  -         case INVALIDATION_SYNC:
  -            return "INVALIDATION_SYNC";
  -         default:
  -            throw new RuntimeException("setCacheMode(): caching mode " + mode + " is invalid");
  -      }
  -   }
  -
  -   /**
  -    * Sets the node locking scheme as a string.
  -    * If the scheme is <code>OPTIMISTIC</code>, uses optimistic locking.
  -    */
  -   public void setNodeLockingScheme(String s)
  -   {
  -      if (s != null)
  -         setNodeLockingOptimistic(s.trim().equalsIgnoreCase("OPTIMISTIC"));
  -   }
  -
  -   /**
  -    * Returns the node locking scheme as a string.
  -    * Either <code>OPTIMISTIC</code> or <code>PESSIMISTIC</code>.
  -    */
  -   public String getNodeLockingScheme()
  -   {
  -      return nodeLockingOptimistic ? "OPTIMISTIC" : "PESSIMISTIC";
  -   }
  -
  -   /**
  -    * Sets whether to use optimistic locking on the nodes.
  -    */
  -   protected void setNodeLockingOptimistic(boolean b)
  -   {
  -      nodeLockingOptimistic = b;
  -      if (b)
  -      {
  -         root = NodeFactory.getInstance().createRootDataNode(NodeFactory.NODE_TYPE_OPTIMISTIC_NODE, this);
  -         // ignore any isolation levels set
  -         isolationLevel = null;
  -      }
  -   }
  -
  -   /**
  -    * Returns true if the node locking is optimistic.
  -    */
  -   public boolean isNodeLockingOptimistic()
  -   {
  -      return nodeLockingOptimistic;
  -   }
  -
  -   /**
  -    * Sets the default caching mode.
  -    * One of:
  -    * <ul>
  -    * <li> local
  -    * <li> repl-async
  -    * <li> repl-sync
  -    * <li> invalidation-async
  -    * <li> invalidation-sync
  -    * </ul>
  -    */
  -   public void setCacheMode(String mode) throws Exception
  -   {
  -      int m = string2Mode(mode);
  -      setCacheMode(m);
  -   }
  -
  -
  -   /**
  -    * Sets the default cache mode. Valid arguments are
  -    * <ol>
  -    * <li>TreeCache.LOCAL
  -    * <li>TreeCache.REPL_ASYNC
  -    * <li>TreeCache.REPL_SYNC
  -    * </ol>
  -    *
  -    * @param mode
  -    */
  -   public void setCacheMode(int mode)
  -   {
  -      if (mode == LOCAL || mode == REPL_ASYNC || mode == REPL_SYNC || mode == INVALIDATION_ASYNC || mode == INVALIDATION_SYNC)
  -         this.cache_mode = mode;
  -      else
  -         throw new IllegalArgumentException("setCacheMode(): caching mode " + mode + " is invalid");
  -   }
  -
  -
  -   /**
  -    * Returns the default max timeout after which synchronous replication calls return.
  -    *
  -    * @return long Number of milliseconds after which a sync repl call must return. 0 means to wait forever
  -    */
  -   public long getSyncReplTimeout()
  -   {
  -      return sync_repl_timeout;
  -   }
  -
  -   /**
  -    * Sets the default maximum wait time for synchronous replication to receive all results
  -    */
  -   public void setSyncReplTimeout(long timeout)
  -   {
  -      sync_repl_timeout = timeout;
  -   }
  -
  -   /**
  -    * Returns true if the replication queue is being used.
  -    */
  -   public boolean getUseReplQueue()
  -   {
  -      return use_repl_queue;
  -   }
  -
  -   /**
  -    * Sets if the replication queue should be used.
  -    * If so, it is started.
  -    */
  -   public void setUseReplQueue(boolean flag)
  -   {
  -      use_repl_queue = flag;
         if (flag)
         {
  -         if (repl_queue == null)
  -         {
  -            repl_queue = new ReplicationQueue(this, repl_queue_interval, repl_queue_max_elements);
  -            if (repl_queue_interval >= 0)
  -               repl_queue.start();
  -         }
  -      }
  -      else
  -      {
  -         if (repl_queue != null)
  -         {
  -            repl_queue.stop();
  -            repl_queue = null;
  -         }
  -      }
  -   }
  -
  -   /**
  -    * Returns the replication queue interval.
  -    */
  -   public long getReplQueueInterval()
  -   {
  -      return repl_queue_interval;
  -   }
  -
  -   /**
  -    * Sets the replication queue interval.
  -    */
  -   public void setReplQueueInterval(long interval)
  -   {
  -      this.repl_queue_interval = interval;
  -      if (repl_queue != null)
  -         repl_queue.setInterval(interval);
  -   }
  -
  -   /**
  -    * Returns the replication queue max elements size.
  -    */
  -   public int getReplQueueMaxElements()
  -   {
  -      return repl_queue_max_elements;
  -   }
  -
  -   /**
  -    * Sets the replication queue max elements size.
  -    */
  -   public void setReplQueueMaxElements(int max_elements)
  -   {
  -      this.repl_queue_max_elements = max_elements;
  -      if (repl_queue != null)
  -         repl_queue.setMax_elements(max_elements);
  -   }
  -
  -   /**
  -    * Returns the replication queue.
  -    */
  -   public ReplicationQueue getReplQueue()
  -   {
  -      return repl_queue;
  -   }
  -
  -   /**
  -    * Returns the transaction isolation level.
  -    */
  -   public String getIsolationLevel()
  -   {
  -      return isolationLevel.toString();
  -   }
  -
  -   /**
  -    * Set the transaction isolation level. This determines the locking strategy to be used
  -    */
  -   public void setIsolationLevel(String level)
  -   {
  -      IsolationLevel tmp_level = IsolationLevel.stringToIsolationLevel(level);
  -
  -      if (tmp_level == null)
  -      {
  -         throw new IllegalArgumentException("TreeCache.setIsolationLevel(): level \"" + level + "\" is invalid");
  -      }
  -      setIsolationLevel(tmp_level);
  -   }
  -
  -   /**
  -    * @param level
  -    */
  -   public void setIsolationLevel(IsolationLevel level)
  -   {
  -      isolationLevel = level;
  -      LockStrategyFactory.setIsolationLevel(level);
  -   }
  -
  -   public IsolationLevel getIsolationLevelClass()
  -   {
  -      return isolationLevel;
  -   }
  -
  -
  -   public boolean getFetchStateOnStartup()
  -   {
  -      return !inactiveOnStartup && buddyManager == null
  -         && (fetchInMemoryState || getFetchPersistentState());
  -   }
  -
  -
  -   public void setFetchStateOnStartup(boolean flag)
  -   {
  -      log.warn("Calls to setFetchStateOnStartup are ignored; configure state " +
  -         "transfer using setFetchInMemoryState and any cache loader's " +
  -         "FetchPersistentState property");
  -   }
  -
  -   public void setFetchInMemoryState(boolean flag)
  -   {
  -      fetchInMemoryState = flag;
  -   }
  -
  -   public boolean getFetchInMemoryState()
  -   {
  -      return fetchInMemoryState;
  -   }
  -
  -   /**
  -    * Gets whether persistent state should be included in any state transfer.
  -    *
  -    * @return <code>true</code> if there is a cache loader that has its
  -    *         <code>FetchPersistentState</code> property set to <code>true</code>
  -    */
  -   public boolean getFetchPersistentState()
  -   {
  -      // Removed shared flag on the cache loader (as it originally was) since,
  -      // from a conversation with Brian S.:
  -      // "The <shared> and <fetchPersistentState> elements are largely redundant.  If shared is true, we ignore fetchPersistentState.
  -      // If shared is false, we only transfer persistent state if fetchPersistentState is true, but I can't think of a use cache where
  -      // you'd use a non-shared cache loader and not fetchPersistentState.  So maybe we can get rid of <fetchPersistentState> and just
  -      // use <shared>"
  -      // - Manik, 9 Nov 05
  -
  -      return cacheLoaderManager != null && cacheLoaderManager.isFetchPersistentState();
  -   }
  -
  -   /**
  -    * Default max time to wait for a lock. If the lock cannot be acquired within this time, a LockingException will be thrown.
  -    *
  -    * @return long Max number of milliseconds to wait for a lock to be acquired
  -    */
  -   public long getLockAcquisitionTimeout()
  +         if (repl_queue == null)
  +         {
  +            repl_queue = new ReplicationQueue(this, configuration.getReplQueueInterval(), configuration.getReplQueueMaxElements());
  +            if (configuration.getReplQueueInterval() >= 0)
      {
  -      return lock_acquisition_timeout;
  +               repl_queue.start();
      }
  -
  -   /**
  -    * Set the max time for lock acquisition. A value of 0 means to wait forever (not recomended).
  -    * Note that lock acquisition timeouts may be removed in the future when we have deadlock detection.
  -    *
  -    * @param timeout
  -    */
  -   public void setLockAcquisitionTimeout(long timeout)
  +         }
  +      }
  +      else
  +      {
  +         if (repl_queue != null)
      {
  -      this.lock_acquisition_timeout = timeout;
  +            repl_queue.stop();
  +            repl_queue = null;
  +         }
  +      }
      }
   
   
      /**
  -    * Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)
  -    *
  -    * @return Fully qualified name of a class implementing the EvictionPolicy interface
  +    * Returns the replication queue.
       */
  -   public String getEvictionPolicyClass()
  +   public ReplicationQueue getReplQueue()
      {
  -      return eviction_policy_class;
  +      return repl_queue;
      }
   
      /**
  -    * Sets the classname of the eviction policy
  +    * @param level
       */
  -   public void setEvictionPolicyClass(String eviction_policy_class)
  +   private void setIsolationLevel(IsolationLevel level)
      {
  -      /*
  -      if (eviction_policy_class == null || eviction_policy_class.length() == 0)
  -      {
  -         return;
  -      }
  -      */
  -
  -      this.eviction_policy_class = eviction_policy_class;
  +      LockStrategyFactory.setIsolationLevel(level);
      }
   
      /**
  @@ -1173,26 +537,6 @@
         this.tm_lookup = l;
      }
   
  -
  -   /**
  -    */
  -   public String getTransactionManagerLookupClass()
  -   {
  -      return tm_lookup_class;
  -   }
  -
  -   /**
  -    * Sets the class of the TransactionManagerLookup impl. This will attempt to create an
  -    * instance, and will throw an exception if this fails.
  -    *
  -    * @param cl
  -    * @throws Exception
  -    */
  -   public void setTransactionManagerLookupClass(String cl) throws Exception
  -   {
  -      this.tm_lookup_class = cl;
  -   }
  -
      /**
       */
      public TransactionManager getTransactionManager()
  @@ -1201,30 +545,6 @@
      }
   
      /**
  -    * Returns true if interceptor MBeans are in use.
  -    */
  -   public boolean getUseInterceptorMbeans()
  -   {
  -      return use_interceptor_mbeans;
  -   }
  -
  -   /**
  -    * Sets if interceptor MBeans are in use.
  -    */
  -   public void setUseInterceptorMbeans(boolean useMbeans)
  -   {
  -      use_interceptor_mbeans = useMbeans;
  -   }
  -
  -   /**
  -    * Returns <code>this</code>.
  -    */
  -   public TreeCache getInstance()
  -   {
  -      return this;
  -   }
  -
  -   /**
       * Fetches the group state from the current coordinator. If successful, this
       * will trigger JChannel setState() call.
       */
  @@ -1301,9 +621,13 @@
   
      protected void _createService() throws Exception
      {
  -      if (this.tm_lookup == null && this.tm_lookup_class != null)
  +       stateFetchTimeout = configuration.getLockAcquisitionTimeout() + 5000;
  +       if (configuration.isNodeLockingOptimistic()) root = NodeFactory.getInstance().createRootDataNode(NodeFactory.NODE_TYPE_OPTIMISTIC_NODE, this);
  +       setUseReplQueue(configuration.isUseReplQueue());
  +       setIsolationLevel(configuration.getIsolationLevel());
  +      if (this.tm_lookup == null && configuration.getTransactionManagerLookupClass() != null)
         {
  -         Class clazz = Thread.currentThread().getContextClassLoader().loadClass(this.tm_lookup_class);
  +         Class clazz = Thread.currentThread().getContextClassLoader().loadClass(configuration.getTransactionManagerLookupClass());
            this.tm_lookup = (TransactionManagerLookup) clazz.newInstance();
         }
   
  @@ -1320,7 +644,7 @@
         }
   
         // create cache loader
  -      if ((cacheLoaderConfig != null || cloaderConfig != null) && cacheLoaderManager == null)
  +      if ((configuration.getCacheLoaderConfig() != null || cloaderConfig != null) && cacheLoaderManager == null)
         {
            initialiseCacheLoaderManager();
         }
  @@ -1331,14 +655,14 @@
         interceptor_chain = new InterceptorChainFactory().buildInterceptorChain(this);
         // register interceptor mbeans
         isStandalone = (this.getServiceName() == null);
  -      if (use_interceptor_mbeans)
  +      if (configuration.isUseInterceptorMbeans())
         {
            MBeanServer mbserver = getMBeanServer();
            if (mbserver != null)
               MBeanConfigurator.registerInterceptors(mbserver, this, isStandalone);
         }
   
  -      switch (cache_mode)
  +      switch (configuration.getCacheModeInt())
         {
            case LOCAL:
               log.info("cache mode is local, will not create the channel");
  @@ -1347,7 +671,7 @@
            case REPL_ASYNC:
            case INVALIDATION_ASYNC:
            case INVALIDATION_SYNC:
  -            log.info("cache mode is " + mode2String(cache_mode));
  +            log.info("cache mode is " + configuration.getCacheModeInt());
               if (channel != null)
               { // already started
                  log.info("channel is already running");
  @@ -1359,20 +683,20 @@
               }
               if (channel != null)
               { // mux channel
  -               log.info("Created Multiplexer Channel for cache cluster " + cluster_name +
  +               log.info("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() +
                        " using stack " + getMultiplexerStack());
               }
               else
               {
  -               if (cluster_props == null)
  +               if (configuration.getClusterConfig() == null)
                  {
  -                  cluster_props = getDefaultProperties();
  +                  configuration.setClusterConfig(getDefaultProperties());
                     log.debug("setting cluster properties to default value");
                  }
  -               channel = new JChannel(cluster_props);
  +               channel = new JChannel(configuration.getClusterConfig());
                  channel.setOpt(Channel.GET_STATE_EVENTS, Boolean.TRUE);
                  if (log.isTraceEnabled())
  -                  log.trace("cache properties: " + cluster_props);
  +                  log.trace("cache properties: " + configuration.getClusterConfig());
               }
               channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE);
               channel.setOpt(Channel.AUTO_GETSTATE, Boolean.TRUE);
  @@ -1387,9 +711,11 @@
   */
               disp = new RpcDispatcher(channel, ml, this, this);
               disp.setMarshaller(getMarshaller());
  +
  +            setBuddyReplicationConfig(configuration.getBuddyReplicationConfig());
               break;
            default:
  -            throw new IllegalArgumentException("cache mode " + cache_mode + " is invalid");
  +            throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
         }
   
         useCreateService = true;
  @@ -1414,7 +740,7 @@
            cacheLoaderManager.startCacheLoader();
         }
   
  -      switch (cache_mode)
  +      switch (configuration.getCacheModeInt())
         {
            case LOCAL:
               break;
  @@ -1422,27 +748,27 @@
            case REPL_ASYNC:
            case INVALIDATION_ASYNC:
            case INVALIDATION_SYNC:
  -            channel.connect(cluster_name);
  +            channel.connect(configuration.getClusterName());
   
               if (log.isInfoEnabled())
                  log.info("TreeCache local address is " + channel.getLocalAddress());
  -            if (getFetchStateOnStartup())
  +            if (configuration.isFetchInMemoryState())
               {
                  fetchStateOnStartup();
               }
               if (buddyManager != null)
               {
                   buddyManager.init(this);
  -                if (use_repl_queue)
  +                if (configuration.isUseReplQueue())
                   {
                       log.warn("Replication queue not supported when using buddy replication.  Disabling repliction queue.");
  -                    use_repl_queue = false;
  +                    configuration.setUseReplQueue(false);
                       repl_queue = null;
                   }
               }
               break;
            default:
  -            throw new IllegalArgumentException("cache mode " + cache_mode + " is invalid");
  +            throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
         }
   
         //now attempt to preload the cache from the loader - Manik
  @@ -1462,7 +788,7 @@
      public void destroyService()
      {
         // unregister interceptor mbeans
  -      if (use_interceptor_mbeans)
  +      if (configuration.isUseInterceptorMbeans())
         {
            MBeanServer mbserver = getMBeanServer();
            if (mbserver != null)
  @@ -1527,11 +853,10 @@
        * Sets the buddy replication configuration element
        * @param config
        */
  -    public void setBuddyReplicationConfig(Element config)
  +    private void setBuddyReplicationConfig(Element config)
       {
           if (config != null)
           {
  -            buddyReplicationConfig = config;
               buddyManager = new BuddyManager(config);
               if (!buddyManager.isEnabled())
                  buddyManager = null;
  @@ -1541,15 +866,6 @@
       }
   
       /**
  -     * Retrieves the buddy replication cofiguration element
  -     * @return config
  -     */
  -    public Element getBuddyReplicationConfig()
  -    {
  -        return buddyReplicationConfig;
  -    }
  -
  -    /**
        * Retrieves the Buddy Manager configured.
        * @return null if buddy replication is not enabled.
        */
  @@ -1577,8 +893,8 @@
      {
         // Configure if eviction policy is set (we test the old style 1.2.x style config and 1.3 style config.
         evictionRegionManager_ = new org.jboss.cache.eviction.RegionManager();
  -      if ((eviction_policy_class != null && eviction_policy_class.length() > 0) ||
  -         (org.jboss.cache.eviction.RegionManager.isUsingNewStyleConfiguration(this.getEvictionPolicyConfig())))
  +      if ((configuration.getEvictionPolicyClass() != null && configuration.getEvictionPolicyClass().length() > 0) ||
  +         (org.jboss.cache.eviction.RegionManager.isUsingNewStyleConfiguration(configuration.getEvictionPolicyConfig())))
         {
            evictionRegionManager_.configure(this);
            this.usingEviction = true;
  @@ -1591,66 +907,6 @@
      }
   
      /**
  -    * @deprecated DO NOT USE THIS METHOD. IT IS PROVIDED FOR FULL JBCACHE 1.2 API BACKWARDS COMPATIBILITY
  -    */
  -   public void setEvictionPolicyProvider(EvictionPolicy policy)
  -   {
  -      log.warn("Using deprecated configuration element 'EvictionPolicyProvider'.  This is only provided for 1.2.x backward compatibility and may disappear in future releases.");
  -      this.eviction_policy_provider = policy;
  -   }
  -
  -   /**
  -    * Sets if the TreeCache will use marshalling.
  -    * <p/>
  -    * Will ALWAYS use marshalling now.  This is now synonymous with setRegionBasedMarshalling
  -    *
  -    * @see #setUseRegionBasedMarshalling(boolean)
  -    * @deprecated
  -    */
  -   public void setUseMarshalling(boolean isTrue)
  -   {
  -      log.warn("Using deprecated configuration element 'UseMarshalling'.  See 'UseRegionBasedMarshalling' instead.");
  -      useRegionBasedMarshalling = isTrue;
  -   }
  -
  -   /**
  -    * Returns true if the TreeCache will use marshalling.
  -    * <p/>
  -    * Will ALWAYS use marshalling now.  This is now synonymous with setRegionBasedMarshalling
  -    *
  -    * @see #getUseRegionBasedMarshalling()
  -    * @deprecated
  -    */
  -   public boolean getUseMarshalling()
  -   {
  -      return useRegionBasedMarshalling;
  -   }
  -
  -   /**
  -    * Sets whether marshalling uses scoped class loaders on a per region basis.
  -    * <p/>
  -    * This property must be set to <code>true</code> before any call to
  -    * {@link #registerClassLoader(String, ClassLoader)} or
  -    * {@link #activateRegion(String)}
  -    *
  -    * @param isTrue
  -    */
  -   public void setUseRegionBasedMarshalling(boolean isTrue)
  -   {
  -      this.useRegionBasedMarshalling = isTrue;
  -   }
  -
  -   /**
  -    * Tests whether region based marshaling s used.
  -    *
  -    * @return true if region based marshalling is used.
  -    */
  -   public boolean getUseRegionBasedMarshalling()
  -   {
  -      return useRegionBasedMarshalling;
  -   }
  -
  -   /**
       * Loads the indicated Fqn, plus all parents recursively from the
       * CacheLoader. If no CacheLoader is present, this is a no-op
       *
  @@ -1725,13 +981,12 @@
       * @param cl  The class loader to use
       * @throws RegionNameConflictException If there is a conflict in existing registering for the fqn.
       * @throws IllegalStateException       if marshalling is not being used
  -    * @see #getUseMarshalling
       * @see #getMarshaller
       */
      public void registerClassLoader(String fqn, ClassLoader cl)
         throws RegionNameConflictException
      {
  -      if (!useRegionBasedMarshalling)
  +      if (!configuration.isUseRegionBasedMarshalling())
            throw new IllegalStateException("useRegionBasedMarshalling is false; cannot use this method");
   
         // Use the getter method here, as it will create the marshaller
  @@ -1745,11 +1000,10 @@
       * @param fqn The fqn region.
       * @throws RegionNotFoundException If there is a conflict in fqn specification.
       * @throws IllegalStateException   if marshalling is not being used
  -    * @see #getUseMarshalling
       */
      public void unregisterClassLoader(String fqn) throws RegionNotFoundException
      {
  -      if (!useRegionBasedMarshalling)
  +      if (!configuration.isUseRegionBasedMarshalling())
            throw new IllegalStateException("useRegionBasedMarshalling is false; cannot use this method");
   
         // Use the getter method here, as it will create the marshaller
  @@ -1772,12 +1026,12 @@
       *                   portion of the tree that should be activated.
       * @throws RegionNotEmptyException if the node <code>subtreeFqn</code>
       *                                 exists and has either data or children
  -    * @throws IllegalStateException   if {@link #getUseMarshalling() useMarshalling} is <code>false</code>
  +    * @throws IllegalStateException   if {@link Configuration#useRegionBasedMarshalling} is <code>false</code>
       */
      public void activateRegion(String subtreeFqn)
         throws RegionNotEmptyException, RegionNameConflictException, CacheException
      {
  -      if (!useRegionBasedMarshalling)
  +      if (!configuration.isUseRegionBasedMarshalling())
            throw new IllegalStateException("TreeCache.activateRegion(). useRegionBasedMarshalling flag is not set!");
   
         Fqn fqn = Fqn.fromString(subtreeFqn);
  @@ -1977,7 +1231,7 @@
               targets.add(target);
   
               List responses = callRemoteMethods(targets, replPsmc, true,
  -               true, sync_repl_timeout);
  +               true, configuration.getSyncReplTimeout());
               Object rsp = null;
               if (responses != null && responses.size() > 0)
               {
  @@ -2048,7 +1302,7 @@
         Object owner = getOwnerForLock();
         Object name = null;
         NodeFactory factory = NodeFactory.getInstance();
  -      byte type = isNodeLockingOptimistic()
  +      byte type = configuration.isNodeLockingOptimistic()
            ? NodeFactory.NODE_TYPE_OPTIMISTIC_NODE
            : NodeFactory.NODE_TYPE_TREENODE;
   
  @@ -2061,7 +1315,7 @@
               // Lock the parent, create and add the child
               try
               {
  -               parent.acquire(owner, state_fetch_timeout, DataNode.LOCK_TYPE_WRITE);
  +               parent.acquire(owner, configuration.getSyncReplTimeout(), DataNode.LOCK_TYPE_WRITE);
               }
               catch (InterruptedException e)
               {
  @@ -2109,11 +1363,11 @@
       *                                     managed (either by activate/inactiveRegion()
       *                                     or by registerClassLoader())
       * @throws CacheException              if there is a problem evicting nodes
  -    * @throws IllegalStateException       if {@link #getUseMarshalling() useMarshalling} is <code>false</code>
  +    * @throws IllegalStateException       if  is <code>false</code>
       */
      public void inactivateRegion(String subtreeFqn) throws RegionNameConflictException, CacheException
      {
  -      if (!useRegionBasedMarshalling)
  +      if (!configuration.isUseRegionBasedMarshalling())
            throw new IllegalStateException("TreeCache.inactivate(). useRegionBasedMarshalling flag is not set!");
   
         Fqn fqn = Fqn.fromString(subtreeFqn);
  @@ -2158,14 +1412,14 @@
               {
                  // Acquire locks
                  Object owner = getOwnerForLock();
  -               subtreeRoot.acquireAll(owner, state_fetch_timeout, DataNode.LOCK_TYPE_WRITE);
  +               subtreeRoot.acquireAll(owner, stateFetchTimeout, DataNode.LOCK_TYPE_WRITE);
                  subtreeLocked = true;
   
                  // Lock the parent, as we're about to write to it
                  parent = (DataNode) subtreeRoot.getParent();
                  if (parent != null)
                  {
  -                  parent.acquire(owner, state_fetch_timeout, DataNode.LOCK_TYPE_WRITE);
  +                  parent.acquire(owner, stateFetchTimeout, DataNode.LOCK_TYPE_WRITE);
                     parentLocked = true;
                  }
   
  @@ -2359,7 +1613,7 @@
            {
               call.invoke(this);
            }
  -         catch (Exception e) // TODO maybe just catch ISE thrown by ReplInterceptor
  +         catch (Exception e)
            {
   
               if (!forgive)
  @@ -2421,8 +1675,8 @@
         if (rootNode == null)
            return null;
   
  -      boolean fetchTransientState  = getFetchInMemoryState();
  -      boolean fetchPersistentState = getFetchPersistentState();
  +      boolean fetchTransientState  = configuration.isFetchInMemoryState();
  +      boolean fetchPersistentState = cacheLoaderManager !=null && cacheLoaderManager.isFetchPersistentState();
   
         Object owner = getOwnerForLock();
   
  @@ -2511,7 +1765,7 @@
         try
         {
            // Acquire a lock on the root node
  -         acquireLocksForStateTransfer(targetRoot, owner, state_fetch_timeout,
  +         acquireLocksForStateTransfer(targetRoot, owner, stateFetchTimeout,
               true, true);
   
            // 1. Unserialize the states into transient and persistent state
  @@ -2542,66 +1796,6 @@
      }
   
      /**
  -    * Returns the replication version.
  -    */
  -   public String getReplicationVersion()
  -   {
  -      return repl_version_string;
  -   }
  -
  -   /**
  -    * Sets the replication version from a string.
  -    *
  -    * @see Version#getVersionShort
  -    */
  -   public void setReplicationVersion(String versionString)
  -   {
  -      short version = Version.getVersionShort(versionString);
  -      this.replication_version = version;
  -      // Hold onto the string, so in case they passed in 1.0.1.RC1,
  -      // they can get back RC1 instead of 1.0.1.GA
  -      this.repl_version_string = versionString;
  -
  -      // If we're are using 123 or earlier, Fqn externalization
  -      // should be 123 compatible as well
  -      // TODO find a better way to do this than setting a static variable
  -      if (Version.isBefore124(version))
  -      {
  -         Fqn.REL_123_COMPATIBLE = true;
  -      }
  -   }
  -
  -   /**
  -    * Returns the replication version as a short.
  -    */
  -   public short getReplicationVersionShort()
  -   {
  -      return replication_version;
  -   }
  -
  -   /**
  -    * Calls {@link #getReplicationVersionShort}.
  -    * @deprecated
  -    */
  -   public short getStateTransferVersion()
  -   {
  -      // This method is deprecated; just call the correct method
  -      return getReplicationVersionShort();
  -   }
  -
  -   /**
  -    * Calls {@link #setReplicationVersion} with the version string
  -    * from {@link Version#getVersionString}.
  -    * @deprecated
  -    */
  -   public void setStateTransferVersion(short version)
  -   {
  -      // This method is deprecated; just convert the short to a String
  -      // and pass it through the correct method
  -      setReplicationVersion(Version.getVersionString(version));
  -   }
  -
  -   /**
       * Acquires locks on a root node for an owner for state transfer.
       */
      protected void acquireLocksForStateTransfer(DataNode root,
  @@ -2692,7 +1886,7 @@
   
            // If no more write locks, but we haven't acquired, see if we
            // need to break read locks as well
  -         if (!acquired && isolationLevel == IsolationLevel.SERIALIZABLE)
  +         if (!acquired && configuration.getIsolationLevel() == IsolationLevel.SERIALIZABLE)
            {
               Iterator it = lock.getReaderOwners().iterator();
               if (it.hasNext())
  @@ -3025,7 +2219,7 @@
         long start, stop;
         isStateSet = false;
         start = System.currentTimeMillis();
  -      boolean rc = channel.getState(null, state_fetch_timeout);
  +      boolean rc = channel.getState(null, stateFetchTimeout);
         if (rc)
         {
            synchronized (stateLock)
  @@ -5114,7 +4308,7 @@
   //               true);
               // Until flush is in place, use the old mechanism
               // where we wait the full state retrieval timeout
  -            return _getState(Fqn.ROOT, getInitialStateRetrievalTimeout(), true, true);
  +            return _getState(Fqn.ROOT, configuration.getInitialStateRetrievalTimeout(), true, true);
            }
            catch (Throwable t)
            {
  @@ -5330,7 +4524,7 @@
            Address addr = (Address) getLocalAddress();
            gtx = GlobalTransaction.create(addr);
            tx_table.put(tx, gtx);
  -         TransactionEntry ent = isNodeLockingOptimistic() ? new OptimisticTransactionEntry() : new TransactionEntry();
  +         TransactionEntry ent = configuration.isNodeLockingOptimistic() ? new OptimisticTransactionEntry() : new TransactionEntry();
            ent.setTransaction(tx);
            tx_table.put(gtx, ent);
            if (log.isTraceEnabled())
  @@ -5487,7 +4681,7 @@
      {
         if (marshaller_ == null)
         {
  -          marshaller_ = new VersionAwareMarshaller(getRegionManager(), inactiveOnStartup, useRegionBasedMarshalling, getReplicationVersion());
  +          marshaller_ = new VersionAwareMarshaller(getRegionManager(), configuration.isInactiveOnStartup(), configuration.isUseRegionBasedMarshalling(), configuration.getReplVersionString());
         }
         return marshaller_;
      }
  @@ -5758,156 +4952,13 @@
            "pbcast.STATE_TRANSFER";
      }
   
  -   /**
  -    * Converts a replication, such as <code>repl-async</code> mode to an
  -    * integer.
  -    */
  -   protected int string2Mode(String mode)
  -   {
  -      if (mode == null) return -1;
  -      String m = mode.toLowerCase().trim().replace('_', '-');
  -      if (m.equals("local"))
  -         return LOCAL;
  -      else if (m.equals("repl-async"))
  -         return REPL_ASYNC;
  -      else if (m.equals("repl-sync"))
  -         return REPL_SYNC;
  -      else if (m.equals("invalidation-async"))
  -         return INVALIDATION_ASYNC;
  -      else if (m.equals("invalidation-sync"))
  -         return INVALIDATION_SYNC;
  -
  -      return -1;
  -   }
  -
      private void initialiseCacheLoaderManager() throws Exception
      {
         if (cacheLoaderManager == null)
         {
            cacheLoaderManager = new CacheLoaderManager();
         }
  -      if (cacheLoaderConfig != null)
  -      {
  -         // use the newer XML based config.
  -         cacheLoaderManager.setConfig(cacheLoaderConfig, this);
  -      }
  -      else
  -      {
  -         // use a legacy config as someone has used one of the legacy methods to set this.
  -         cacheLoaderManager.setConfig(cloaderConfig, this);
  -      }
  -   }
  -   // ---------------------------------------------------------------
  -   // START: Methods to provide backward compatibility with older cache loader config settings
  -   // ---------------------------------------------------------------
  -
  -   /**
  -    * Sets the cache loader class name.
  -    *
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderClass(String cache_loader_class)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderClass.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.getFirstCacheLoaderConfig().setClassName(cache_loader_class);
  -   }
  -
  -   /**
  -    * Sets the cache loader configuration.
  -    *
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderConfig(Properties cache_loader_config)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderConfig(Properties).  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.getFirstCacheLoaderConfig().setProperties(cache_loader_config);
  -   }
  -
  -   /**
  -    * Sets the cache loader shared state.
  -    *
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderShared(boolean shared)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderShared.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.setShared(shared);
  -   }
  -
  -   /**
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderPassivation(boolean passivate)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderPassivation.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.setPassivation(passivate);
  -   }
  -
  -   /**
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderPreload(String list)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderPreload.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.setPreload(list);
  -   }
  -
  -   /**
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderAsynchronous(boolean b)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderAsynchronous.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.getFirstCacheLoaderConfig().setAsync(b);
  -   }
  -
  -   /**
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element)
  -    * @deprecated
  -    */
  -   public void setCacheLoaderFetchPersistentState(boolean flag)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderFetchPersistentState.  This element will be removed in future, please use CacheLoaderConfiguration instead.");
  -      initDeprecatedCacheLoaderConfig();
  -      cloaderConfig.getFirstCacheLoaderConfig().setFetchPersistentState(flag);
  -   }
  -
  -   /**
  -    * @see #setCacheLoaderConfiguration(org.w3c.dom.Element) 
  -    * @deprecated
  -    */
  -   public void setCacheLoaderFetchTransientState(boolean flag)
  -   {
  -      log.warn("Using deprecated config element CacheLoaderFetchTransientState.  This element will be removed in future, replaced with FetchInMemoryState.");
  -      setFetchInMemoryState(flag);
  -   }
  -
  -   private void initDeprecatedCacheLoaderConfig()
  -   {
  -      // legacy config will only use a single cache loader.
  -      if (cloaderConfig == null)
  -      {
  -         cloaderConfig = new CacheLoaderConfig();
  -         log.warn("Using legacy cache loader config mechanisms.");
  -         if (cacheLoaderConfig != null) log.warn("Specified CacheLoaderConfiguration XML block will be ignored!");
  -      }
  -      if (cloaderConfig.getIndividualCacheLoaderConfigs().size() == 0)
  -      {
  -         CacheLoaderConfig.IndividualCacheLoaderConfig first = new CacheLoaderConfig.IndividualCacheLoaderConfig();
  -         cloaderConfig.addIndividualCacheLoaderConfig(first);
  -      }
  +      cacheLoaderManager.setConfig(configuration.getCacheLoaderConfig(), this);
      }
   
      /**
  @@ -5933,90 +4984,6 @@
      }
   
      /**
  -    * Returns the cache loader class name.
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public String getCacheLoaderClass()
  -   {
  -      return cacheLoaderManager == null ? null : cacheLoaderManager.getCacheLoaderConfig().getFirstCacheLoaderConfig().getClassName();
  -   }
  -
  -   /**
  -    * Returns false always.
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public boolean getCacheLoaderShared()
  -   {
  -      return false;
  -   }
  -
  -   /**
  -    * Returns true if passivation is on.
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public boolean getCacheLoaderPassivation()
  -   {
  -      return cacheLoaderManager != null && cacheLoaderManager.getCacheLoaderConfig().isPassivation();
  -   }
  -
  -   /**
  -    * Returns true if the cache loader is asynchronous.
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public boolean getCacheLoaderAsynchronous()
  -   {
  -      return cacheLoaderManager != null && cacheLoaderManager.getCacheLoaderConfig().getFirstCacheLoaderConfig().isAsync();
  -   }
  -
  -   /**
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public String getCacheLoaderPreload()
  -   {
  -      return cacheLoaderManager == null ? null : cacheLoaderManager.getCacheLoaderConfig().getPreload();
  -   }
  -
  -   /**
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public boolean getCacheLoaderFetchPersistentState()
  -   {
  -      return cacheLoaderManager != null && cacheLoaderManager.getCacheLoaderConfig().getFirstCacheLoaderConfig().isFetchPersistentState();
  -   }
  -
  -   /**
  -    * Provided for backward compatibility.  Use {@link #getCacheLoaderConfiguration} instead.
  -    *
  -    * @deprecated
  -    */
  -   public boolean getCacheLoaderFetchTransientState()
  -   {
  -      return getFetchInMemoryState();
  -   }
  -
  -   /**
  -    * Returns the properties in the cache loader configuration.
  -    */
  -   public Properties getCacheLoaderConfig()
  -   {
  -      if (cacheLoaderManager == null)
  -         return null;
  -      return cacheLoaderManager.getCacheLoaderConfig().getFirstCacheLoaderConfig().getProperties();
  -   }
  -
  -   /**
        * Purges the contents of all configured {@link CacheLoader}s
        */
      public void purgeCacheLoaders() throws Exception
  @@ -6037,7 +5004,7 @@
         if (mbserver == null)
         {
            log.warn("Multiplexer service specified but MBean server not found." +
  -                  "  Multiplexer will not be used for cache cluster " + cluster_name + ".");
  +                  "  Multiplexer will not be used for cache cluster " + configuration.getClusterName() + ".");
            return null;
         }
         
  @@ -6049,7 +5016,7 @@
            if (!mbserver.isRegistered(muxName))
            {
               log.warn("Multiplexer service specified but '" + serviceName + "' not registered." + 
  -                     "  Multiplexer will not be used for cache cluster " + cluster_name + ".");
  +                     "  Multiplexer will not be used for cache cluster " + configuration.getClusterName() + ".");
               return null;
            }
            
  @@ -6068,19 +5035,19 @@
            if (!muxFound)
            {
               log.warn("Multiplexer service registered but method '" + CREATE_MUX_CHANNEL + "' not found." + 
  -                     "  Multiplexer will not be used for cache cluster " + cluster_name + "." +
  +                     "  Multiplexer will not be used for cache cluster " + configuration.getClusterName() + "." +
                        "  Ensure that you are using JGroups version 2.3 or later.");
               return null;
            }
   
            // create the multiplexer channel and return as a JChannel instance
  -         Object[] params = {stackName, cluster_name};
  +         Object[] params = {stackName, configuration.getClusterName()};
            return (JChannel)mbserver.invoke(muxName, CREATE_MUX_CHANNEL, params, MUX_TYPES);
          }
         catch (Exception e)
         {
            log.error("Multiplexer channel creation failed." +
  -                  "  Multiplexer will not be used for cache cluster " + cluster_name + ".", e);
  +                  "  Multiplexer will not be used for cache cluster " + configuration.getClusterName() + ".", e);
            return null;
         }
      }
  
  
  
  1.4       +127 -8    JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheProxyImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- TreeCacheProxyImpl.java	19 Jul 2006 08:29:18 -0000	1.3
  +++ TreeCacheProxyImpl.java	19 Jul 2006 21:34:45 -0000	1.4
  @@ -9,10 +9,15 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.interceptors.Interceptor;
   import org.jboss.cache.loader.CacheLoader;
  +import org.jboss.cache.loader.CacheLoaderManager;
   import org.jboss.cache.lock.IdentityLock;
  +import org.jboss.cache.eviction.RegionManager;
   import org.jgroups.Address;
  +import org.jgroups.blocks.MethodCall;
   
   import javax.management.ObjectName;
  +import javax.transaction.TransactionManager;
  +import javax.transaction.Transaction;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
  @@ -85,7 +90,7 @@
   
       public String getClusterName()
       {
  -        return treeCache.getClusterName();
  +        return treeCache.getConfiguration().getClusterName();
       }
   
       public String getVersion()
  @@ -98,11 +103,46 @@
           return treeCache.getServiceName();
       }
   
  -    public Object getTransactionManager()
  +    public TransactionManager getTransactionManager()
       {
           return treeCache.getTransactionManager();
       }
   
  +    public ReplicationQueue getReplQueue()
  +    {
  +        return treeCache.getReplQueue();
  +    }
  +
  +    public int getNumberOfAttributes()
  +    {
  +        return treeCache.getNumberOfAttributes();
  +    }
  +
  +    public int getNumberOfNodes()
  +    {
  +        return treeCache.getNumberOfNodes();
  +    }
  +
  +    public CacheLoaderManager getCacheLoaderManager()
  +    {
  +        return treeCache.getCacheLoaderManager();
  +    }
  +
  +    public void addUndoOperation(GlobalTransaction tx, MethodCall undo_op)
  +    {
  +        treeCache.addUndoOperation(tx, undo_op);
  +    }
  +
  +    public RegionManager getEvictionRegionManager()
  +    {
  +        return treeCache.getEvictionRegionManager();
  +    }
  +
  +    public Map getLockTable()
  +    {
  +        return treeCache.getLockTable();
  +    }
  +
       public Node getRoot()
       {
           NodeImpl root = treeCache.get(Fqn.ROOT);
  @@ -240,7 +280,7 @@
   
       public Node getChild(Fqn f)
       {
  -        return new TreeCacheProxyImpl(treeCache, (NodeImpl) treeCache.get(currentNode.getFqn(), f));
  +        return new TreeCacheProxyImpl(treeCache, treeCache.get(new Fqn(currentNode.getFqn(), f)));
       }
   
       public void put(Object k, Object v)
  @@ -283,6 +323,11 @@
           move(currentNode, currentNode.getParent().getFqn(), newParent.getFqn());
       }
   
  +    public boolean hasChild(Fqn f)
  +    {
  +        return treeCache.exists(new Fqn(currentNode.getFqn(), f));
  +    }
  +
       private void move(NodeImpl node, Fqn oldRoot, Fqn newRoot)
       {
           // recursive
  @@ -298,11 +343,6 @@
           treeCache.remove(oldRoot);
       }
   
  -    public IdentityLock getLock()
  -    {
  -        return currentNode.getLock();
  -    }
  -
       public boolean isLocked()
       {
           return currentNode.isLocked();
  @@ -317,4 +357,83 @@
       {
           return currentNode.isWriteLocked();
       }
  +
  +    public boolean isStarted()
  +    {
  +        return treeCache.started;
  +    }
  +
  +
  +    // -----------
  +
  +    // TODO: Think about what we need to do here regarding locking on Nodes
  +    public boolean acquire(Object owner, long lock_timeout, int lockTypeWrite)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public IdentityLock getLock()
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public Set acquireAll(Object owner, long lock_timeout, int lock_type)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    // TODO: Figure out how we deal with these:
  +    public DataNode peek(Fqn fqn)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public void _evict(Fqn fqn)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public void notifyNodeLoaded(Fqn fqn)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public void notifyNodeCreated(Fqn fqn)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public Node _get(Fqn fqn)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public void notifyNodeActivate(Fqn fqn, boolean b)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public void notifyNodePassivate(Fqn fqn, boolean b)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public org.jboss.cache.marshall.RegionManager getRegionManager()
  +    {
  +    throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public List _gravitateData(Fqn fqn, boolean b, boolean b1)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +    public GlobalTransaction getCurrentTransaction(Transaction tx)
  +    {
  +        throw new RuntimeException("TODO: Need to figure out how to deal with these.");
  +    }
  +
  +
  +
  +
   }
  
  
  
  1.12      +31 -40    JBossCache/src/org/jboss/cache/TreeCacheView.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheView.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheView.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- TreeCacheView.java	18 Jul 2006 10:50:46 -0000	1.11
  +++ TreeCacheView.java	19 Jul 2006 21:34:45 -0000	1.12
  @@ -8,36 +8,17 @@
   package org.jboss.cache;
   
   
  -import java.awt.BorderLayout;
  -import java.awt.event.ActionEvent;
  -import java.awt.event.MouseAdapter;
  -import java.awt.event.MouseEvent;
  -import java.awt.event.MouseListener;
  -import java.awt.event.WindowEvent;
  -import java.awt.event.WindowListener;
  -import java.io.File;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Set;
  -import java.util.StringTokenizer;
  -import java.util.Vector;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.jboss.cache.config.Configuration;
  +import org.jboss.mx.util.MBeanProxyExt;
  +import org.jboss.system.ServiceMBeanSupport;
  +import org.jgroups.View;
   
   import javax.management.MBeanServer;
   import javax.management.MBeanServerFactory;
   import javax.management.ObjectName;
  -import javax.swing.AbstractAction;
  -import javax.swing.JFrame;
  -import javax.swing.JMenu;
  -import javax.swing.JMenuBar;
  -import javax.swing.JOptionPane;
  -import javax.swing.JPanel;
  -import javax.swing.JPopupMenu;
  -import javax.swing.JScrollPane;
  -import javax.swing.JTable;
  -import javax.swing.JTextField;
  -import javax.swing.JTree;
  +import javax.swing.*;
   import javax.swing.event.TableModelEvent;
   import javax.swing.event.TableModelListener;
   import javax.swing.event.TreeSelectionEvent;
  @@ -49,12 +30,21 @@
   import javax.swing.tree.TreeNode;
   import javax.swing.tree.TreePath;
   import javax.swing.tree.TreeSelectionModel;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.jboss.mx.util.MBeanProxyExt;
  -import org.jboss.system.ServiceMBeanSupport;
  -import org.jgroups.View;
  +import java.awt.*;
  +import java.awt.event.ActionEvent;
  +import java.awt.event.MouseAdapter;
  +import java.awt.event.MouseEvent;
  +import java.awt.event.MouseListener;
  +import java.awt.event.WindowEvent;
  +import java.awt.event.WindowListener;
  +import java.io.File;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.Set;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
   
   
   /**
  @@ -65,7 +55,7 @@
    * The view itself caches only the nodes, but doesn't cache any of the data (HashMap) associated with it. When
    * data needs to be displayed, the underlying tree will be accessed directly.
    *
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    * @author<a href="mailto:bela at jboss.org">Bela Ban</a> March 27 2003
    */
   public class TreeCacheView extends ServiceMBeanSupport implements TreeCacheViewMBean {
  @@ -226,15 +216,16 @@
   
   
            tree=new TreeCache();
  -         tree.setClusterName("TreeCacheGroup");
  -         tree.setClusterProperties(props);
  -         tree.setInitialStateRetrievalTimeout(10000);
  -         tree.setCacheMode(TreeCache.REPL_ASYNC);
  +         Configuration c = new Configuration();
  +         c.setClusterName("TreeCacheGroup");
  +         c.setClusterConfig(props);
  +         c.setInitialStateRetrievalTimeout(10000);
  +         c.setCacheMode("REPL_ASYNC");
   
            if(use_queue) {
  -            tree.setUseReplQueue(true);
  -            tree.setReplQueueInterval(queue_interval);
  -            tree.setReplQueueMaxElements(queue_max_elements);
  +            c.setUseReplQueue(true);
  +            c.setReplQueueInterval(queue_interval);
  +            c.setReplQueueMaxElements(queue_max_elements);
            }
   
            tree.addTreeCacheListener(new MyListener());
  
  
  



More information about the jboss-cvs-commits mailing list