Package org.infinispan.manager

Examples of org.infinispan.manager.DefaultCacheManager


        this(new DefaultCacheManager(adapt(global), false), defaultCache);
    }

    @SuppressWarnings("deprecation")
    public DefaultEmbeddedCacheManager(GlobalConfiguration global, Configuration config, String defaultCache) {
        this(new DefaultCacheManager(adapt(global), LegacyConfigurationAdaptor.adapt(config), false), defaultCache);
    }
View Full Code Here


   }

   protected CacheManager createCacheManager(Properties properties) throws CacheException {
      try {
         String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
         return new DefaultCacheManager(configLoc);
      } catch (IOException e) {
         throw new CacheException("Unable to create default cache manager", e);
      }
   }
View Full Code Here

   /**
    * Transforms and tests the transformation of a complex file.
    */
   private void testAllFile(String ehCacheFile) throws Exception {
      ClassLoader existingCl = currentThread().getContextClassLoader();
      DefaultCacheManager dcm = null;
      Cache<Object, Object> sampleDistributedCache2 = null;
      try {
         ClassLoader delegatingCl = new Jbc2InfinispanTransformerTest.TestClassLoader(existingCl);
         currentThread().setContextClassLoader(delegatingCl);
         String fileName = getFileName(ehCacheFile);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         convertor.parse(fileName, baos, ConfigFilesConvertor.TRANSFORMATIONS.get(ConfigFilesConvertor.EHCACHE_CACHE1X), Thread.currentThread().getContextClassLoader());

         //System.out.println("Output file is:\n" + baos.toString());

         dcm = (DefaultCacheManager) TestCacheManagerFactory.fromStream(new ByteArrayInputStream(baos.toByteArray()));
         Cache<Object,Object> defaultCache = dcm.getCache();
         defaultCache.put("key", "value");
         Configuration configuration = defaultCache.getCacheConfiguration();

         assertEquals(configuration.eviction().maxEntries(),10000);
         assertEquals(configuration.expiration().maxIdle(), 121);
         assertEquals(configuration.expiration().lifespan(), 122);
         LoadersConfiguration loaders = configuration.loaders();
         assert loaders.cacheLoaders().get(0) instanceof FileCacheStoreConfiguration;

         assertEquals(configuration.expiration().wakeUpInterval(), 119000);
         assertEquals(configuration.eviction().strategy(), EvictionStrategy.LRU);

         String definedCacheNames = dcm.getDefinedCacheNames();
         assert definedCacheNames.contains("sampleCache1");
         assert definedCacheNames.contains("sampleCache2");
         assert definedCacheNames.contains("sampleCache3");
         assert definedCacheNames.contains("sampleDistributedCache1");
         assert definedCacheNames.contains("sampleDistributedCache2");
         assert definedCacheNames.contains("sampleDistributedCache3");

         sampleDistributedCache2 = dcm.getCache("sampleDistributedCache2");
         Configuration configuration2 = sampleDistributedCache2.getCacheConfiguration();
         assert configuration2.loaders().cacheLoaders().size() == 1;
         assert configuration2.expiration().lifespan() == 101;
         assert configuration2.expiration().maxIdle() == 102;
         assertEquals(configuration2.clustering().cacheMode(), CacheMode.INVALIDATION_SYNC);
View Full Code Here

            xmlFile, Thread.currentThread().getContextClassLoader());
      return fromStream(is, keepJmxDomainName);
   }

   public static EmbeddedCacheManager fromXml(String globalXmlFile, String defaultXmlFile, String namedXmlFile) throws IOException {
      return new DefaultCacheManager(globalXmlFile, defaultXmlFile, namedXmlFile, true);
   }
View Full Code Here

         }
      }
   }

   private static DefaultCacheManager newDefaultCacheManager(boolean start, GlobalConfiguration gc, Configuration c) {
      DefaultCacheManager defaultCacheManager = new DefaultCacheManager(gc, c, start);
      return addThreadCacheManager(defaultCacheManager);
   }
View Full Code Here

      DefaultCacheManager defaultCacheManager = new DefaultCacheManager(gc, c, start);
      return addThreadCacheManager(defaultCacheManager);
   }

   private static DefaultCacheManager newDefaultCacheManager(boolean start, GlobalConfigurationBuilder gc, ConfigurationBuilder c) {
      DefaultCacheManager defaultCacheManager = new DefaultCacheManager(gc.build(), c.build(), start);
      return addThreadCacheManager(defaultCacheManager);
   }
View Full Code Here

      DefaultCacheManager defaultCacheManager = new DefaultCacheManager(gc.build(), c.build(), start);
      return addThreadCacheManager(defaultCacheManager);
   }

   private static DefaultCacheManager newDefaultCacheManager(boolean start, ConfigurationBuilderHolder holder) {
      DefaultCacheManager defaultCacheManager = new DefaultCacheManager(holder, start);
      return addThreadCacheManager(defaultCacheManager);
   }
View Full Code Here

      Properties properties = globalConfiguration.getTransportProperties();
      properties.put(CHANNEL_FACTORY, this.channelFactory);
      properties.setProperty(CHANNEL_ID, globalConfiguration.getClusterName());
      properties.setProperty(JGroupsTransport.CHANNEL_LOOKUP, ChannelFactoryChannelLookup.class.getName());

      EmbeddedCacheManager manager = new DefaultCacheManager(globalConfiguration, configuration.getDefaultConfiguration(), false);

      // Add named configurations
      for (Configuration config: configuration.getNamedConfigurations())
      {
         manager.defineConfiguration(config.getName(), config);
      }
     
      return manager;
   }
View Full Code Here

               if (cacheManager == null) {
                  // update config file display
                  InputStream stream = resource.openStream();
                  try {
                     cacheManager = new DefaultCacheManager(stream);
                  } finally {
                     Util.close(stream);
                  }
               }
               cache = cacheManager.getCache();   
View Full Code Here

    EmbeddedCacheManager manager;
    Cache<String,byte[]> cache;


    public void start() throws Exception {
      manager = new DefaultCacheManager(GlobalConfigurationBuilder.defaultClusteredBuilder().build());     
      manager.defineConfiguration("dirCache",
               new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_ASYNC).clustering()
                        .hash().numOwners(1).clustering().l1().enable().build());
      cache = manager.getCache("dirCache");
View Full Code Here

TOP

Related Classes of org.infinispan.manager.DefaultCacheManager

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.