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

Brian Stansberry brian.stansberry at jboss.com
Wed Oct 25 00:50:20 EDT 2006


  User: bstansberry
  Date: 06/10/25 00:50:20

  Modified:    src/org/jboss/cache/config       EvictionConfig.java
                        Configuration.java CacheLoaderConfig.java
                        BuddyReplicationConfig.java
  Added:       src/org/jboss/cache/config       EvictionRegionConfig.java
                        MissingPolicyException.java
  Log:
  Handle parsing of config XML in XmlConfigurationParser 
  
  Revision  Changes    Path
  1.3       +22 -220   JBossCache/src/org/jboss/cache/config/EvictionConfig.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EvictionConfig.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/config/EvictionConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- EvictionConfig.java	23 Oct 2006 17:39:00 -0000	1.2
  +++ EvictionConfig.java	25 Oct 2006 04:50:20 -0000	1.3
  @@ -1,16 +1,30 @@
  +/*
  + * JBoss, Home of Professional Open Source.
  + * Copyright 2006, 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.config;
   
  -import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
   
  -import org.apache.commons.logging.LogFactory;
  -import org.jboss.cache.Fqn;
   import org.jboss.cache.eviction.EvictionConfiguration;
  -import org.jboss.cache.eviction.EvictionPolicy;
  -import org.jboss.cache.xml.XmlHelper;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.NodeList;
   
   public class EvictionConfig extends ConfigurationComponent
   {
  @@ -29,60 +43,9 @@
         setDefaultEvictionPolicyClass(defaultEvictionClass);
      }
      
  -   public EvictionConfig(Element element, String defaultEvictionClass)
  -   {
  -      setDefaultEvictionPolicyClass(defaultEvictionClass);
  -      
  -      if (element != null)
  -      {
  -         String temp = XmlHelper.getTagContents(element,
  -                 EvictionConfiguration.WAKEUP_INTERVAL_SECONDS, EvictionConfiguration.ATTR, EvictionConfiguration.NAME);
  -   
  -         if (temp != null)
  -         {
  -            
  -            wakeupIntervalSeconds = Integer.parseInt(temp);
  -         }
  -   
  -         if (wakeupIntervalSeconds <= 0)
  -            wakeupIntervalSeconds = EvictionConfiguration.WAKEUP_DEFAULT;
  -
  -
  -         temp = XmlHelper.getTagContents(element,
  -                 EvictionConfiguration.EVENT_QUEUE_SIZE, EvictionConfiguration.ATTR, EvictionConfiguration.NAME);
  -
  -         if (temp != null)
  -         {
  -            eventQueueSize = Integer.parseInt(temp);
  -         }
  -
  -         if (eventQueueSize <= 0) eventQueueSize = EvictionConfiguration.EVENT_QUEUE_SIZE_DEFAULT;
  -
  -   
  -         NodeList list = element.getElementsByTagName(EvictionConfiguration.REGION);
  -         List regionConfigs = new ArrayList(list.getLength());
  -         for (int i = 0; i < list.getLength(); i++)
  -         {
  -            org.w3c.dom.Node node = list.item(i);
  -            if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
  -               continue;
  -            try
  -            {
  -               regionConfigs.add(new EvictionRegionConfig((Element) node, defaultEvictionClass));
  -            }
  -            catch (MissingPolicyException ignored)
  -            {
  -               LogFactory.getLog(getClass()).warn(ignored.getLocalizedMessage());
  -            }
  -         }
  -         
  -         setEvictionRegionConfigs(regionConfigs);
  -      }
  -   }
  -   
      public boolean isValidConfig()
      {
  -      return defaultEvictionPolicyClass != null 
  +      return (defaultEvictionPolicyClass != null && defaultEvictionPolicyClass.length() > 0) 
                  || (evictionRegionConfigs != null && evictionRegionConfigs.size() > 0);
      }
   
  @@ -168,165 +131,4 @@
         result = 37 * result + (evictionRegionConfigs == null ? 0 : evictionRegionConfigs.hashCode());
         return result;
      }
  -
  -   public static class EvictionRegionConfig extends ConfigurationComponent
  -   {
  -      /** The serialVersionUID */
  -      private static final long serialVersionUID = 8384302335667342493L;
  -      
  -      private Fqn regionFqn;
  -      private String evictionPolicyClass;
  -      private EvictionConfiguration evictionConfiguration;
  -      
  -      public EvictionRegionConfig() {}
  -      
  -      public EvictionRegionConfig(Element element, String defaultEvictionClass)
  -      {
  -         setEvictionPolicyClass(defaultEvictionClass);
  -         setRegionName(element.getAttribute(EvictionConfiguration.NAME));
  -         String evictionClass = element.getAttribute(EvictionConfiguration.REGION_POLICY_CLASS);
  -         if (evictionClass == null || evictionClass.length() == 0)
  -         {
  -            evictionClass = defaultEvictionClass;
  -            // if it's still null... what do we configure?
  -            if (evictionClass == null || evictionClass.length() == 0)
  -            {
  -               throw new MissingPolicyException(
  -                       "There is no Eviction Policy Class specified on the region or for the entire cache!");
  -            }
  -         }
  -
  -         EvictionPolicy policy = null;
  -         try
  -         {
  -            policy = (EvictionPolicy) loadClass(evictionClass).newInstance();
  -         }
  -         catch (RuntimeException e)
  -         {
  -            throw e;
  -         }
  -         catch (Exception e)
  -         {
  -            throw new RuntimeException("Eviction class is not properly loaded in classloader", e);
  -         }
  -         
  -         setEvictionPolicyClass(evictionClass);
  -         EvictionConfiguration evc = null;
  -         try
  -         {
  -            evc = (EvictionConfiguration) policy.getEvictionConfigurationClass().newInstance();
  -         }
  -         catch (RuntimeException e)
  -         {
  -            throw e;
  -         }
  -         catch (Exception e)
  -         {
  -            throw new RuntimeException("Failed to instantiate EvictionConfiguration of class " + 
  -                                       policy.getEvictionConfigurationClass(), e);
  -         }
  -         
  -         evc.parseXMLConfig(element);
  -         setEvictionConfiguration(evc);
  -      }
  -      
  -      public EvictionConfiguration getEvictionConfiguration()
  -      {
  -         return evictionConfiguration;
  -      }
  -      
  -      public void setEvictionConfiguration(EvictionConfiguration config)
  -      {
  -         testImmutability("evictionConfiguration");
  -         if (this.evictionConfiguration instanceof ConfigurationComponent)
  -         {
  -            removeChildConfig((ConfigurationComponent) this.evictionConfiguration);
  -         }
  -         if (config instanceof ConfigurationComponent)
  -         {
  -            addChildConfig((ConfigurationComponent) this.evictionConfiguration);
  -         }
  -         this.evictionConfiguration = config;
  -      }
  -      
  -      public String getEvictionPolicyClass()
  -      {
  -         return evictionPolicyClass;
  -      }
  -      
  -      public void setEvictionPolicyClass(String evictionPolicyClass)
  -      {
  -         testImmutability("evictionPolicyClass");
  -         this.evictionPolicyClass = evictionPolicyClass;
  -      }
  -      
  -      public Fqn getRegionFqn()
  -      {
  -         return regionFqn;
  -      }
  -      
  -      public void setRegionFqn(Fqn regionFqn)
  -      {
  -         testImmutability("regionFqn");
  -         this.regionFqn = regionFqn;
  -      }
  -      public String getRegionName()
  -      {
  -         return regionFqn == null ? null : regionFqn.toString();
  -      }
  -      
  -      public void setRegionName(String name)
  -      {
  -         setRegionFqn(name == null ? null : Fqn.fromString(name));
  -      }
  -
  -      @Override
  -      public boolean equals(Object obj)
  -      {
  -         if (this == obj)
  -            return true;
  -         
  -         if (obj instanceof EvictionRegionConfig)
  -         {
  -            EvictionRegionConfig other = (EvictionRegionConfig) obj;
  -            return safeEquals(this.regionFqn, other.regionFqn)
  -                     && safeEquals(this.evictionPolicyClass, other.evictionPolicyClass)
  -                     && safeEquals(this.evictionConfiguration, other.evictionConfiguration);
  -         }
  -         return false;
  -      }
  -
  -      @Override
  -      public int hashCode()
  -      {
  -         int result = 17;
  -         result = 31 * result + (regionFqn == null ? 0 : regionFqn.hashCode());
  -         result = 31 * result + (evictionPolicyClass == null ? 0 : evictionPolicyClass.hashCode());
  -         result = 31 * result + (evictionConfiguration == null ? 0 : evictionConfiguration.hashCode());
  -         
  -         return result;
  -      }
  -      
  -      
  -      
  -   }
  -   
  -   private static class MissingPolicyException extends RuntimeException
  -   {
  -      /** The serialVersionUID */
  -      private static final long serialVersionUID = -1054460763043849473L;
  -
  -      public MissingPolicyException(String message)
  -      {
  -         super(message);
  -      }
  -   }
  -
  -   private static Class loadClass(String classname) throws ClassNotFoundException
  -   {
  -      ClassLoader cl = Thread.currentThread().getContextClassLoader();
  -      if (cl == null)
  -         cl = ClassLoader.getSystemClassLoader();
  -      return cl.loadClass(classname);
  -   }
   }
  
  
  
  1.23      +6 -103    JBossCache/src/org/jboss/cache/config/Configuration.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Configuration.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/config/Configuration.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -b -r1.22 -r1.23
  --- Configuration.java	23 Oct 2006 05:46:39 -0000	1.22
  +++ Configuration.java	25 Oct 2006 04:50:20 -0000	1.23
  @@ -63,24 +63,20 @@
      private long lockAcquisitionTimeout = 10000;
      @Dynamic
      private long syncReplTimeout = 15000;
  -   private String evictionPolicyClass = null;
      private CacheMode cacheMode = CacheMode.LOCAL;
      private boolean inactiveOnStartup = false;
      private String serviceName;
      private long initialStateRetrievalTimeout = 10000;
      private IsolationLevel isolationLevel = IsolationLevel.REPEATABLE_READ;
      @Dynamic
  -   private Element evictionPolicyConfig = null;
      private EvictionConfig evictionConfig = null;
      private boolean useRegionBasedMarshalling = false;
      private String transactionManagerLookupClass = null;
  -   private Element cacheLoaderConfiguration = null;
      private CacheLoaderConfig cacheLoaderConfig = null;
      @Dynamic
      private boolean syncCommitPhase = false;
      @Dynamic
      private boolean syncRollbackPhase = false;
  -   private Element buddyReplicationElement;
      private BuddyReplicationConfig buddyReplicationConfig;
      private boolean nodeLockingOptimistic = false;
      private NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
  @@ -180,16 +176,6 @@
         this.syncReplTimeout = syncReplTimeout;
      }
   
  -   public void setEvictionPolicyClass(String evictionPolicyClass)
  -   {
  -      testImmutability("evictionPolicyClass");
  -      this.evictionPolicyClass = evictionPolicyClass;
  -      if (evictionPolicyConfig != null && evictionConfig == null)
  -      {
  -         createEvictionConfig();
  -      }
  -   }
  -
      public void setCacheMode(CacheMode cacheModeInt)
      {
         testImmutability("cacheMode");
  @@ -224,22 +210,8 @@
         this.inactiveOnStartup = inactiveOnStartup;
      }
   
  -   public void setEvictionPolicyConfig(Element evictionPolicyConfig)
  -   {
  -      testImmutability("evictionPolicyConfig");
  -      this.evictionPolicyConfig = evictionPolicyConfig;
  -      if (evictionPolicyClass != null && evictionConfig == null)
  -      {
  -         createEvictionConfig();
  -      }
  -   }
  -   
      public EvictionConfig getEvictionConfig()
      {
  -      if (evictionConfig == null)
  -      {
  -         createEvictionConfig();
  -      }
         return evictionConfig;
      }
      
  @@ -249,14 +221,6 @@
         this.evictionConfig = config;
      }
      
  -   private void createEvictionConfig()
  -   {
  -      if (evictionPolicyConfig != null || evictionPolicyClass != null)
  -      {
  -         evictionConfig = new EvictionConfig(evictionPolicyConfig, evictionPolicyClass);
  -      }
  -   }
  -
      public void setUseRegionBasedMarshalling(boolean useRegionBasedMarshalling)
      {
         testImmutability("useRegionBasedMarshalling");
  @@ -269,29 +233,11 @@
         this.transactionManagerLookupClass = transactionManagerLookupClass;
      }
   
  -   public void setCacheLoaderConfiguration(Element cacheLoaderConfiguration)
  -   {
  -      testImmutability("cacheLoaderConfiguration");
  -      if (cacheLoaderConfiguration == null)
  -      {
  -         setCacheLoaderConfig(null);
  -      }
  -      else
  -      {
  -         setCacheLoaderConfig(new CacheLoaderConfig(cacheLoaderConfiguration));
  -      }
  -      // cache the element *after* the config, as the call to cache 
  -      // the config nulls the element field
  -      this.cacheLoaderConfiguration = cacheLoaderConfiguration;
  -   }
  -   
      public void setCacheLoaderConfig(CacheLoaderConfig config)
      {
         testImmutability("cacheLoaderConfig");
         replaceChildConfig(this.cacheLoaderConfig, config);
         this.cacheLoaderConfig = config;
  -      // null out the element
  -      this.cacheLoaderConfiguration = null;
      }
   
      public void setSyncCommitPhase(boolean syncCommitPhase)
  @@ -306,29 +252,11 @@
         this.syncRollbackPhase = syncRollbackPhase;
      }
   
  -   public void setBuddyReplicationConfig(Element buddyReplicationElement)
  -   {
  -      testImmutability("buddyReplicationConfig");
  -      if (buddyReplicationElement == null)
  -      {
  -         setBuddyReplicationConfiguration(null);
  -      }
  -      else
  -      {
  -         setBuddyReplicationConfiguration(new BuddyReplicationConfig(buddyReplicationElement));
  -      }
  -      // cache the element *after* the config, as the call to cache 
  -      // the config nulls the element field
  -      this.buddyReplicationElement = buddyReplicationElement;
  -   }
  -   
  -   public void setBuddyReplicationConfiguration(BuddyReplicationConfig config)
  +   public void setBuddyReplicationConfig(BuddyReplicationConfig config)
      {
         testImmutability("buddyReplicationConfig");
         replaceChildConfig(this.buddyReplicationConfig, config);
         this.buddyReplicationConfig = config;
  -      // null out the element as it may be out of sync
  -      buddyReplicationElement = null;
      }
   
      public void setNodeLockingScheme(NodeLockingScheme nodeLockingScheme)
  @@ -501,11 +429,6 @@
         return syncReplTimeout;
      }
   
  -   public String getEvictionPolicyClass()
  -   {
  -      return evictionPolicyClass;
  -   }
  -
      public CacheMode getCacheMode()
      {
         return cacheMode;
  @@ -521,11 +444,6 @@
         return isolationLevel;
      }
   
  -   public Element getEvictionPolicyConfig()
  -   {
  -      return evictionPolicyConfig;
  -   }
  -
      public boolean isUseRegionBasedMarshalling()
      {
         return useRegionBasedMarshalling;
  @@ -536,11 +454,6 @@
         return transactionManagerLookupClass;
      }
   
  -   public Element getCacheLoaderConfiguration()
  -   {
  -      return cacheLoaderConfiguration;
  -   }
  -   
      public CacheLoaderConfig getCacheLoaderConfig()
      {
         return cacheLoaderConfig;
  @@ -556,12 +469,7 @@
         return syncRollbackPhase;
      }
   
  -   public Element getBuddyReplicationConfig()
  -   {
  -      return buddyReplicationElement;
  -   }
  -   
  -   public BuddyReplicationConfig getBuddyReplicationConfiguration()
  +   public BuddyReplicationConfig getBuddyReplicationConfig()
      {
         return buddyReplicationConfig;
      }
  @@ -677,22 +585,18 @@
         if (useMbean != that.useMbean) return false;
         if (useRegionBasedMarshalling != that.useRegionBasedMarshalling) return false;
         if (useReplQueue != that.useReplQueue) return false;
  -      if (buddyReplicationConfig != null ? !buddyReplicationConfig.equals(that.buddyReplicationConfig) : that.buddyReplicationElement != null)
  +      if (buddyReplicationConfig != null ? !buddyReplicationConfig.equals(that.buddyReplicationConfig) : that.buddyReplicationConfig != null)
         {
            return false;
         }
  -      if (cacheLoaderConfig != null ? !cacheLoaderConfig.equals(that.cacheLoaderConfig) : that.cacheLoaderConfiguration != null)
  +      if (cacheLoaderConfig != null ? !cacheLoaderConfig.equals(that.cacheLoaderConfig) : that.cacheLoaderConfig != null)
         {
            return false;
         }
         if (cacheMode != that.cacheMode) return false;
         if (clusterConfig != null ? !clusterConfig.equals(that.clusterConfig) : that.clusterConfig != null) return false;
         if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
  -      if (evictionPolicyClass != null ? !evictionPolicyClass.equals(that.evictionPolicyClass) : that.evictionPolicyClass != null)
  -      {
  -         return false;
  -      }
  -      if (evictionPolicyConfig != null ? !evictionPolicyConfig.equals(that.evictionPolicyConfig) : that.evictionPolicyConfig != null)
  +      if (evictionConfig != null ? !evictionConfig.equals(that.evictionConfig) : that.evictionConfig != null)
         {
            return false;
         }
  @@ -724,12 +628,11 @@
         result = 29 * result + (int) replicationVersion;
         result = 29 * result + (int) (lockAcquisitionTimeout ^ (lockAcquisitionTimeout >>> 32));
         result = 29 * result + (int) (syncReplTimeout ^ (syncReplTimeout >>> 32));
  -      result = 29 * result + (evictionPolicyClass != null ? evictionPolicyClass.hashCode() : 0);
         result = 29 * result + (cacheMode != null ? cacheMode.hashCode() : 0);
         result = 29 * result + (inactiveOnStartup ? 1 : 0);
         result = 29 * result + (int) (initialStateRetrievalTimeout ^ (initialStateRetrievalTimeout >>> 32));
         result = 29 * result + (isolationLevel != null ? isolationLevel.hashCode() : 0);
  -      result = 29 * result + (evictionPolicyConfig != null ? evictionPolicyConfig.hashCode() : 0);
  +      result = 29 * result + (evictionConfig != null ? evictionConfig.hashCode() : 0);
         result = 29 * result + (useRegionBasedMarshalling ? 1 : 0);
         result = 29 * result + (transactionManagerLookupClass != null ? transactionManagerLookupClass.hashCode() : 0);
         result = 29 * result + (cacheLoaderConfig != null ? cacheLoaderConfig.hashCode() : 0);
  
  
  
  1.17      +0 -36     JBossCache/src/org/jboss/cache/config/CacheLoaderConfig.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderConfig.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/config/CacheLoaderConfig.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- CacheLoaderConfig.java	23 Oct 2006 05:46:39 -0000	1.16
  +++ CacheLoaderConfig.java	25 Oct 2006 04:50:20 -0000	1.17
  @@ -13,9 +13,6 @@
   import java.util.Properties;
   
   import org.jboss.cache.xml.XmlHelper;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
   
   /**
    * Holds the configuration of the cache loader chain.  ALL cache loaders should be defined using this class, adding
  @@ -38,39 +35,6 @@
       {          
       }
       
  -    public CacheLoaderConfig(Element cacheLoaderConfig)
  -    {
  -       setPassivation(XmlHelper.readBooleanContents(cacheLoaderConfig, "passivation"));
  -       setPreload(XmlHelper.readStringContents(cacheLoaderConfig, "preload"));
  -       setShared(XmlHelper.readBooleanContents(cacheLoaderConfig, "shared"));
  -       NodeList cacheLoaderNodes = cacheLoaderConfig.getElementsByTagName("cacheloader");
  -       for (int i = 0; i < cacheLoaderNodes.getLength(); i++)
  -       {
  -          Node node = cacheLoaderNodes.item(i);
  -          if (node.getNodeType() == Node.ELEMENT_NODE)
  -          {
  -             Element element = (Element) node;
  -             CacheLoaderConfig.IndividualCacheLoaderConfig clc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
  -             clc.setAsync(XmlHelper.readBooleanContents(element, "async", false));
  -             clc.setIgnoreModifications(XmlHelper.readBooleanContents(element, "ignoreModifications", false));
  -             clc.setFetchPersistentState(XmlHelper.readBooleanContents(element, "fetchPersistentState", false));
  -             clc.setPurgeOnStartup(XmlHelper.readBooleanContents(element, "purgeOnStartup", false));
  -             clc.setClassName(XmlHelper.readStringContents(element, "class"));
  -             try
  -             {
  -                clc.setProperties(XmlHelper.readPropertiesContents(element, "properties"));
  -             }
  -             catch (IOException e)
  -             {
  -                throw new ConfigurationException("Problem loader cache loader properties", e);
  -             }
  -             clc.setSingletonStore(XmlHelper.readBooleanContents(element, "singletonStore", false));
  -             clc.setPushStateWhenCoordinator(XmlHelper.readBooleanAttribute(element, "singletonStore", "pushStateWhenCoordinator", false));
  -             addIndividualCacheLoaderConfig(clc);
  -          }
  -       }       
  -    }
  -    
       public String getPreload()
       {
           return preload;
  
  
  
  1.2       +0 -48     JBossCache/src/org/jboss/cache/config/BuddyReplicationConfig.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyReplicationConfig.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/config/BuddyReplicationConfig.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- BuddyReplicationConfig.java	23 Oct 2006 05:46:39 -0000	1.1
  +++ BuddyReplicationConfig.java	25 Oct 2006 04:50:20 -0000	1.2
  @@ -21,12 +21,9 @@
    */
   package org.jboss.cache.config;
   
  -import java.io.IOException;
   import java.util.Properties;
   
   import org.jboss.cache.buddyreplication.NextMemberBuddyLocator;
  -import org.jboss.cache.xml.XmlHelper;
  -import org.w3c.dom.Element;
   
   
   public class BuddyReplicationConfig extends ConfigurationComponent
  @@ -54,51 +51,6 @@
      {      
      }
      
  -   public BuddyReplicationConfig(Element element)
  -   {
  -      enabled = XmlHelper.readBooleanContents(element, "buddyReplicationEnabled");
  -      dataGravitationRemoveOnFind = XmlHelper.readBooleanContents(element, "dataGravitationRemoveOnFind", true);
  -      dataGravitationSearchBackupTrees = XmlHelper.readBooleanContents(element, "dataGravitationSearchBackupTrees", true);
  -      autoDataGravitation = enabled && XmlHelper.readBooleanContents(element, "autoDataGravitation", false);
  -
  -      String strBuddyCommunicationTimeout = XmlHelper.readStringContents(element, "buddyCommunicationTimeout");
  -      try
  -      {
  -         buddyCommunicationTimeout = Integer.parseInt(strBuddyCommunicationTimeout);
  -      }
  -      catch (Exception e)
  -      {
  -      }
  -      finally
  -      {
  -         if (log.isDebugEnabled())
  -            log.debug("Using buddy communication timeout of " + buddyCommunicationTimeout + " millis");
  -      }
  -      buddyPoolName = XmlHelper.readStringContents(element, "buddyPoolName");
  -      if ("".equals(buddyPoolName))
  -         buddyPoolName = null;
  -
  -      // now read the buddy locator details
  -
  -      String buddyLocatorClass = XmlHelper.readStringContents(element, "buddyLocatorClass");
  -      if (buddyLocatorClass == null || buddyLocatorClass.length() == 0)
  -         buddyLocatorClass = NextMemberBuddyLocator.class.getName();
  -      Properties props = null;
  -      try
  -      {
  -         props = XmlHelper.readPropertiesContents(element, "buddyLocatorProperties");
  -      }
  -      catch (IOException e)
  -      {
  -         log.warn("Caught exception reading buddyLocatorProperties", e);
  -         log.error("Unable to read buddyLocatorProperties specified!  Using defaults for [" + buddyLocatorClass + "]");
  -      }
  -      BuddyLocatorConfig blc = new BuddyLocatorConfig();
  -      blc.setBuddyLocatorClass(buddyLocatorClass);
  -      blc.setBuddyLocatorProperties(props);
  -      setBuddyLocatorConfig(blc);
  -   }
  -   
      public boolean isAutoDataGravitation()
      {
         return autoDataGravitation;
  
  
  
  1.1      date: 2006/10/25 04:50:20;  author: bstansberry;  state: Exp;JBossCache/src/org/jboss/cache/config/EvictionRegionConfig.java
  
  Index: EvictionRegionConfig.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2006, 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.config;
  
  import org.jboss.cache.Fqn;
  import org.jboss.cache.eviction.EvictionConfiguration;
  
  public class EvictionRegionConfig extends ConfigurationComponent
  {
     /** The serialVersionUID */
     private static final long serialVersionUID = 8384302335667342493L;
     
     private Fqn regionFqn;
     private String evictionPolicyClass;
     private EvictionConfiguration evictionConfiguration;
     
     public EvictionRegionConfig() {}
     
     public EvictionConfiguration getEvictionConfiguration()
     {
        return evictionConfiguration;
     }
     
     public void setEvictionConfiguration(EvictionConfiguration config)
     {
        testImmutability("evictionConfiguration");
        if (this.evictionConfiguration instanceof ConfigurationComponent)
        {
           removeChildConfig((ConfigurationComponent) this.evictionConfiguration);
        }
        if (config instanceof ConfigurationComponent)
        {
           addChildConfig((ConfigurationComponent) this.evictionConfiguration);
        }
        this.evictionConfiguration = config;
     }
     
     public String getEvictionPolicyClass()
     {
        return evictionPolicyClass;
     }
     
     public void setEvictionPolicyClass(String evictionPolicyClass)
     {
        testImmutability("evictionPolicyClass");
        this.evictionPolicyClass = evictionPolicyClass;
     }
     
     public Fqn getRegionFqn()
     {
        return regionFqn;
     }
     
     public void setRegionFqn(Fqn regionFqn)
     {
        testImmutability("regionFqn");
        this.regionFqn = regionFqn;
     }
     public String getRegionName()
     {
        return regionFqn == null ? null : regionFqn.toString();
     }
     
     public void setRegionName(String name)
     {
        setRegionFqn(name == null ? null : Fqn.fromString(name));
     }
  
     @Override
     public boolean equals(Object obj)
     {
        if (this == obj)
           return true;
        
        if (obj instanceof EvictionRegionConfig)
        {
           EvictionRegionConfig other = (EvictionRegionConfig) obj;
           return EvictionConfig.safeEquals(this.regionFqn, other.regionFqn)
                    && EvictionConfig.safeEquals(this.evictionPolicyClass, other.evictionPolicyClass)
                    && EvictionConfig.safeEquals(this.evictionConfiguration, other.evictionConfiguration);
        }
        return false;
     }
  
     @Override
     public int hashCode()
     {
        int result = 17;
        result = 31 * result + (regionFqn == null ? 0 : regionFqn.hashCode());
        result = 31 * result + (evictionPolicyClass == null ? 0 : evictionPolicyClass.hashCode());
        result = 31 * result + (evictionConfiguration == null ? 0 : evictionConfiguration.hashCode());
        
        return result;
     }
     
     
     
  }
  
  
  1.1      date: 2006/10/25 04:50:20;  author: bstansberry;  state: Exp;JBossCache/src/org/jboss/cache/config/MissingPolicyException.java
  
  Index: MissingPolicyException.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2006, 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.config;
  
  public class MissingPolicyException extends RuntimeException
  {
  
     /** The serialVersionUID */
     private static final long serialVersionUID = 6107098975617303157L;
  
     public MissingPolicyException(String message)
     {
        super(message);
     }
  }
  
  



More information about the jboss-cvs-commits mailing list