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

Galder Zamarreno galder.zamarreno at jboss.com
Tue Jul 17 18:16:49 EDT 2007


  User: gzamarreno
  Date: 07/07/17 18:16:49

  Modified:    src/org/jboss/cache/factories  XmlConfigurationParser.java
  Log:
  [JBCACHE-1134] singleton store cache loader class configuration added and changed the way SSCL is configured in the XML. Also migrated push state logic to use java.util.concurrent package. Still missing, changing user guide for the updated configuration and an XML example in etc/
  
  Revision  Changes    Path
  1.24      +39 -2     JBossCache/src/org/jboss/cache/factories/XmlConfigurationParser.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: XmlConfigurationParser.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/factories/XmlConfigurationParser.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -b -r1.23 -r1.24
  --- XmlConfigurationParser.java	11 Jun 2007 12:58:17 -0000	1.23
  +++ XmlConfigurationParser.java	17 Jul 2007 22:16:49 -0000	1.24
  @@ -12,6 +12,7 @@
   import org.jboss.cache.config.BuddyReplicationConfig;
   import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
   import org.jboss.cache.config.CacheLoaderConfig;
  +import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.ConfigurationException;
   import org.jboss.cache.config.EvictionConfig;
  @@ -48,6 +49,7 @@
    * or within {@link org.jboss.cache.CacheFactory} implementations for standalone JBoss Cache usage.
    *
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  + * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
    */
   public class XmlConfigurationParser
   {
  @@ -397,8 +399,13 @@
               {
                  throw new ConfigurationException("Problem loader cache loader properties", e);
               }
  -            iclc.setSingletonStore(XmlHelper.readBooleanContents(indivElement, "singletonStore", false));
  -            iclc.setPushStateWhenCoordinator(XmlHelper.readBooleanAttribute(indivElement, "singletonStore", "pushStateWhenCoordinator", false));
  +
  +            SingletonStoreConfig ssc = parseSingletonStoreConfig(indivElement);
  +            if (ssc != null)
  +            {
  +               iclc.setSingletonStoreConfig(ssc);
  +            }
  +
               clc.addIndividualCacheLoaderConfig(iclc);
            }
         }
  @@ -406,6 +413,36 @@
         return clc;
      }
   
  +   private static SingletonStoreConfig parseSingletonStoreConfig(Element cacheLoaderelement)
  +   {
  +      /* singletonStore element can only appear once in a cacheloader, so we just take the first one ignoring any
  +      subsequent definitions in cacheloader element*/
  +      Node singletonStoreNode = cacheLoaderelement.getElementsByTagName("singletonStore").item(0);
  +      if (singletonStoreNode!= null && singletonStoreNode.getNodeType() == Node.ELEMENT_NODE)
  +      {
  +         Element singletonStoreElement = (Element) singletonStoreNode;
  +         boolean singletonStoreEnabled = XmlHelper.readBooleanContents(singletonStoreElement, "enabled");
  +         String singletonStoreClass = XmlHelper.readStringContents(singletonStoreElement, "class");
  +         Properties singletonStoreproperties = null;
  +         try
  +         {
  +            singletonStoreproperties = XmlHelper.readPropertiesContents(singletonStoreElement, "properties");
  +         }
  +         catch (IOException e)
  +         {
  +            throw new ConfigurationException("Problem loading singleton store properties", e);
  +         }
  +         SingletonStoreConfig ssc = new SingletonStoreConfig();
  +         ssc.setSingletonStoreEnabled(singletonStoreEnabled);
  +         ssc.setSingletonStoreClass(singletonStoreClass);
  +         ssc.setSingletonStoreproperties(singletonStoreproperties);
  +
  +         return ssc;
  +      }
  +
  +      return null;
  +   }
  +
      public static EvictionConfig parseEvictionConfig(Element element)
      {
         EvictionConfig ec = new EvictionConfig();
  
  
  



More information about the jboss-cvs-commits mailing list