Package org.jboss.cache.config

Examples of org.jboss.cache.config.BuddyReplicationConfig


      }
   }

   public static BuddyReplicationConfig parseBuddyReplicationConfig(Element element)
   {
      BuddyReplicationConfig brc = new BuddyReplicationConfig();
      brc.setEnabled(XmlConfigHelper.readBooleanContents(element, "buddyReplicationEnabled"));
      brc.setDataGravitationRemoveOnFind(XmlConfigHelper.readBooleanContents(element, "dataGravitationRemoveOnFind", true));
      brc.setDataGravitationSearchBackupTrees(XmlConfigHelper.readBooleanContents(element, "dataGravitationSearchBackupTrees", true));
      brc.setAutoDataGravitation(brc.isEnabled() && XmlConfigHelper.readBooleanContents(element, "autoDataGravitation", false));

      String strBuddyCommunicationTimeout = XmlConfigHelper.readStringContents(element, "buddyCommunicationTimeout");
      try
      {
         brc.setBuddyCommunicationTimeout(Integer.parseInt(strBuddyCommunicationTimeout));
      }
      catch (Exception e)
      {
         if (log.isTraceEnabled()) log.trace(e.getMessage());
      }
      finally
      {
         if (log.isDebugEnabled())
         {
            log.debug("Using buddy communication timeout of " + brc.getBuddyCommunicationTimeout() + " millis");
         }
      }
      String buddyPoolName = XmlConfigHelper.readStringContents(element, "buddyPoolName");
      if ("".equals(buddyPoolName))
      {
         buddyPoolName = null;
      }

      brc.setBuddyPoolName(buddyPoolName);

      // now read the buddy locator details

      String buddyLocatorClass = XmlConfigHelper.readStringContents(element, "buddyLocatorClass");
      if (buddyLocatorClass == null || buddyLocatorClass.length() == 0)
      {
         buddyLocatorClass = NextMemberBuddyLocator.class.getName();
      }
      Properties props = null;
      props = XmlConfigHelper.readPropertiesContents(element, "buddyLocatorProperties");
      BuddyLocatorConfig blc = new BuddyLocatorConfig();
      blc.setBuddyLocatorClass(buddyLocatorClass);
      blc.setBuddyLocatorProperties(props);
      brc.setBuddyLocatorConfig(blc);

      return brc;
   }
View Full Code Here


      return getConfiguration().isInactiveOnStartup();
   }

   public void setBuddyReplicationConfig(Element config)
   {
      BuddyReplicationConfig brc = null;
      if (config != null)
      {
         try
         {
            brc = buddyElementParser.parseBuddyElement(config);
View Full Code Here

      return getConfiguration().isInactiveOnStartup();
   }

   public void setBuddyReplicationConfig(Element config)
   {
      BuddyReplicationConfig brc = null;
      if (config != null)
      {
         try
         {
            brc = buddyElementParser.parseBuddyElement(config);
View Full Code Here

   public void testDisabledConfig() throws Exception
   {
      String xmlConfig = "<config><buddyReplicationEnabled>false</buddyReplicationEnabled></config>";
      Element element = XmlHelper.stringToElement(xmlConfig);
      BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
      cache.getConfiguration().setBuddyReplicationConfig(config);
      assertNull(cache.getBuddyManager());
   }
View Full Code Here

   public void testBasicConfig() throws Exception
   {
      String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled></config>";
      Element element = XmlHelper.stringToElement(xmlConfig);
      BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
      cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
      cache.getConfiguration().setBuddyReplicationConfig(config);
      cache.create();
      cache.start();
View Full Code Here

   public void testLocalModeConfig() throws Exception
   {
      String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled></config>";
      Element element = XmlHelper.stringToElement(xmlConfig);
      BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
      cache.getConfiguration().setBuddyReplicationConfig(config);
      cache.create();
      cache.start();
      assert cache.getBuddyManager() == null;
View Full Code Here

      {
         String propname = entry.getKey();
         if ("BuddyReplicationConfiguration".equals(propname)
               || "BuddyReplicationConfig".equals(propname))
         {
            BuddyReplicationConfig brc = parseBuddyReplicationConfig(entry.getValue());
            conf.setBuddyReplicationConfig(brc);
         }
         else if ("CacheLoaderConfiguration".equals(propname)
               || "CacheLoaderConfig".equals(propname))
         {
View Full Code Here

      }
   }

   public static BuddyReplicationConfig parseBuddyReplicationConfig(Element element)
   {
      BuddyReplicationConfig brc = new BuddyReplicationConfig();
      brc.setEnabled(XmlHelper.readBooleanContents(element, "buddyReplicationEnabled"));
      brc.setDataGravitationRemoveOnFind(XmlHelper.readBooleanContents(element, "dataGravitationRemoveOnFind", true));
      brc.setDataGravitationSearchBackupTrees(XmlHelper.readBooleanContents(element, "dataGravitationSearchBackupTrees", true));
      brc.setAutoDataGravitation(brc.isEnabled() && XmlHelper.readBooleanContents(element, "autoDataGravitation", false));

      String strBuddyCommunicationTimeout = XmlHelper.readStringContents(element, "buddyCommunicationTimeout");
      try
      {
         brc.setBuddyCommunicationTimeout(Integer.parseInt(strBuddyCommunicationTimeout));
      }
      catch (Exception e)
      {
      }
      finally
      {
         if (log.isDebugEnabled())
         {
            log.debug("Using buddy communication timeout of " + brc.getBuddyCommunicationTimeout() + " millis");
         }
      }
      String buddyPoolName = XmlHelper.readStringContents(element, "buddyPoolName");
      if ("".equals(buddyPoolName))
      {
         buddyPoolName = null;
      }

      brc.setBuddyPoolName(buddyPoolName);

      // 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);
      brc.setBuddyLocatorConfig(blc);

      return brc;
   }
View Full Code Here

   {
      String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
            "          <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
            "          <buddyPoolName>groupOne</buddyPoolName></config>";
      Element element = XmlHelper.stringToElement(xmlConfig);
      BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
      BuddyManager mgr = new BuddyManager(config);

      assertTrue(mgr.isEnabled());
      assertEquals("groupOne", mgr.getBuddyPoolName());
      assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
View Full Code Here

      String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
            "          <buddyLocatorClass>org.i.dont.exist.PhantomBuddyLocator</buddyLocatorClass>\n" +
            "          <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
            "          <buddyPoolName>groupOne</buddyPoolName></config>";
      Element element = XmlHelper.stringToElement(xmlConfig);
      BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
      BuddyManager mgr = new BuddyManager(config);

      assertTrue(mgr.isEnabled());
      assertEquals("groupOne", mgr.getBuddyPoolName());
      assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.BuddyReplicationConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.