Package org.jboss.cache.config

Examples of org.jboss.cache.config.CacheLoaderConfig$IndividualCacheLoaderConfig$SingletonStoreConfig


{
   private LoadersElementParser loadersElementParser = new LoadersElementParser();

   private CacheLoaderConfig createCacheLoaderCfg(boolean passivation)
   {
      CacheLoaderConfig cfg = new CacheLoaderConfig();
      cfg.setPassivation(passivation);
      return cfg;
   }
View Full Code Here


   public void testSingleCacheLoader() throws Exception
   {
      // without async
      CacheLoaderManager mgr = new CacheLoaderManager();
      CacheLoaderConfig cfg = createCacheLoaderCfg(false);
      cfg.addIndividualCacheLoaderConfig(createIndividualCacheLoaderConfig(cfg, false, "org.jboss.cache.loader.FileCacheLoader"));

      mgr.setConfig(cfg, null, null);
      CacheLoader cl = mgr.getCacheLoader();

      assertEquals(FileCacheLoader.class, cl.getClass());

      // with async
      cfg = createCacheLoaderCfg(false);
      cfg.addIndividualCacheLoaderConfig(createIndividualCacheLoaderConfig(cfg, true, "org.jboss.cache.loader.FileCacheLoader"));

      mgr.setConfig(cfg, null, null);
      cl = mgr.getCacheLoader();

      assertEquals(AsyncCacheLoader.class, cl.getClass());
View Full Code Here

   private Configuration getConfiguration(int instance) throws Exception
   {
      Configuration c = new Configuration();
      c.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
      CacheLoaderConfig clc = getSingleCacheLoaderConfig("/", JDBCCacheLoader.class.getName(), "cache.jdbc.table.name=jbosscache\n" +
            "            cache.jdbc.table.create=true\n" +
            "            cache.jdbc.table.drop=true\n" +
            "            cache.jdbc.table.primarykey=jbosscache_pk\n" +
            "            cache.jdbc.fqn.column=fqn\n" +
            "            cache.jdbc.fqn.type=varchar(255)\n" +
            "            cache.jdbc.node.column=node\n" +
            "            cache.jdbc.node.type=blob\n" +
            "            cache.jdbc.parent.column=parent\n" +
            "            cache.jdbc.sql-concat=1 || 2\n" +
            "            cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver\n" +
            "            cache.jdbc.url=jdbc:derby:jbossdb"+instance+";create=true\n" +
            "            cache.jdbc.user=user1\n" +
            "            cache.jdbc.password=user1\n" +
            "            cache.jdbc.batch.enable=true\n" +
            "            cache.jdbc.batch.size=1000", false, true, false);
      clc.setPassivation(false);
      clc.getFirstCacheLoaderConfig().setPurgeOnStartup(true);     
      c.setCacheLoaderConfig(clc);
      c.setCacheMode(CacheMode.REPL_SYNC);
      return c;
   }
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
      CacheLoaderConfig clc = new CacheLoaderConfig();
      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      clc.addIndividualCacheLoaderConfig(iclc);
      cache.getConfiguration().setCacheLoaderConfig(clc);
      cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
      mockCacheLoader = createMock(CacheLoader.class);

      expect(mockCacheLoader.getConfig()).andReturn(null).anyTimes();
View Full Code Here

   private void configureCacheLoaders(Element element)
   {
      if (element == null) return; //null cache loaders are allowed
      LoadersElementParser clElementParser = new LoadersElementParser();
      CacheLoaderConfig cacheLoaderConfig = clElementParser.parseLoadersElement(element);
      config.setCacheLoaderConfig(cacheLoaderConfig);
   }
View Full Code Here

      this.buddyReplConfig = config;
   }

   public void setCacheLoaderConfig(Element cacheLoaderConfig)
   {
      CacheLoaderConfig clc = null;
      if (cacheLoaderConfig != null)
      {
         clc = loadersElementParser.parseLoadersElement(cacheLoaderConfig);
      }
      getConfiguration().setCacheLoaderConfig(clc);
View Full Code Here

            conf.setBuddyReplicationConfig(brc);
         }
         else if ("CacheLoaderConfiguration".equals(propname)
               || "CacheLoaderConfig".equals(propname))
         {
            CacheLoaderConfig clc = parseCacheLoaderConfig(entry.getValue());
            conf.setCacheLoaderConfig(clc);
         }
         else if ("EvictionPolicyConfiguration".equals(propname)
               || "EvictionPolicyConfig".equals(propname))
         {
View Full Code Here

      return brc;
   }

   private static CacheLoaderConfig parseCacheLoaderConfig(Element element)
   {
      CacheLoaderConfig clc = new CacheLoaderConfig();
      clc.setPassivation(XmlConfigHelper.readBooleanContents(element, "passivation"));
      String s = XmlConfigHelper.readStringContents(element, "preload");
      if (s != null && s.length() > 0) clc.setPreload(s);
      clc.setShared(XmlConfigHelper.readBooleanContents(element, "shared"));

      NodeList cacheLoaderNodes = element.getElementsByTagName("cacheloader");
      for (int i = 0; i < cacheLoaderNodes.getLength(); i++)
      {
         Node node = cacheLoaderNodes.item(i);
         if (node.getNodeType() == Node.ELEMENT_NODE)
         {
            Element indivElement = (Element) node;
            CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
            iclc.setAsync(XmlConfigHelper.readBooleanContents(indivElement, "async", false));
            iclc.setIgnoreModifications(XmlConfigHelper.readBooleanContents(indivElement, "ignoreModifications", false));
            iclc.setFetchPersistentState(XmlConfigHelper.readBooleanContents(indivElement, "fetchPersistentState", false));
            iclc.setPurgeOnStartup(XmlConfigHelper.readBooleanContents(indivElement, "purgeOnStartup", false));
            iclc.setClassName(XmlConfigHelper.readStringContents(indivElement, "class"));
            iclc.setProperties(XmlConfigHelper.readPropertiesContents(indivElement, "properties"));

            SingletonStoreConfig ssc = parseSingletonStoreConfig(indivElement);
            if (ssc != null)
            {
               iclc.setSingletonStoreConfig(ssc);
            }

            clc.addIndividualCacheLoaderConfig(iclc);
         }
      }
      return clc;
   }
View Full Code Here

*/
public class LoadersElementParser extends XmlParserBase
{
   public CacheLoaderConfig parseLoadersElement(Element element)
   {
      CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
      String passivation = getAttributeValue(element, "passivation");
      if (existsAttribute(passivation)) cacheLoaderConfig.setPassivation(getBoolean(passivation));
      String shared = getAttributeValue(element, "shared");
      if (existsAttribute(shared)) cacheLoaderConfig.setShared(getBoolean(shared));
      String preload = getPreloadString(getSingleElementInCoreNS("preload", element));
      if (preload != null) cacheLoaderConfig.setPreload(preload);

      NodeList cacheLoaderNodes = element.getElementsByTagName("loader");
      for (int i = 0; i < cacheLoaderNodes.getLength(); i++)
      {
         Element indivElement = (Element) cacheLoaderNodes.item(i);
         CacheLoaderConfig.IndividualCacheLoaderConfig iclc = parseIndividualCacheLoaderConfig(indivElement);
         cacheLoaderConfig.addIndividualCacheLoaderConfig(iclc);
      }
      return cacheLoaderConfig;
   }
View Full Code Here

public class PassivationToDummyInMemoryCacheLoaderTest extends PassivationTestsBase
{
   protected void configureCache() throws Exception
   {
      CacheSPI<Object, Object> cache = cacheTL.get();
      CacheLoaderConfig clc = new CacheLoaderConfig();
      cache.getConfiguration().setCacheLoaderConfig(clc);
      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      clc.setPassivation(true);
      clc.addIndividualCacheLoaderConfig(iclc);
      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
      iclc.setProperties("debug=true");
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.CacheLoaderConfig$IndividualCacheLoaderConfig$SingletonStoreConfig

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.