Package org.infinispan.manager

Examples of org.infinispan.manager.DefaultCacheManager


    public DistributedMapPeristenceService() {
        GlobalConfiguration globalConf = GlobalConfiguration.getClusteredDefault();
        Configuration cfg = new Configuration();
        cfg.setCacheMode(Configuration.CacheMode.DIST_SYNC);
        cfg.setNumOwners(3);
        cacheManager = new DefaultCacheManager(globalConf, cfg);
        contextTracking = ContextTrackingProvider.getTrackingService();

    }
View Full Code Here


    assertTrue(storeConfiguration instanceof JpaStoreConfiguration);
    JpaStoreConfiguration jpaCacheLoaderConfig = (JpaStoreConfiguration) storeConfiguration;
    assertEquals(PERSISTENCE_UNIT_NAME, jpaCacheLoaderConfig.persistenceUnitName());
    assertEquals(User.class, jpaCacheLoaderConfig.entityClass());

    EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

    cacheManager.defineConfiguration("userCache", cacheConfig);

    cacheManager.start();
    Cache<String, User> userCache = cacheManager.getCache("userCache");
    User user = new User();
    user.setUsername("rtsang");
    user.setFirstName("Ray");
    user.setLastName("Tsang");
    userCache.put(user.getUsername(), user);
    userCache.stop();
    cacheManager.stop();
  }
View Full Code Here

      assertEquals(Vehicle.class, jpaConfig.entityClass());
      assertEquals(PERSISTENCE_UNIT_NAME, jpaConfig.persistenceUnitName());
  }
 
  public void testXmlConfig60() throws IOException {
    EmbeddedCacheManager cacheManager = new DefaultCacheManager("config/jpa-config-60.xml");
   
    Cache<VehicleId, Vehicle> vehicleCache = cacheManager.getCache("vehicleCache");
    validateConfig(vehicleCache);
   
    Vehicle v = new Vehicle();
    v.setId(new VehicleId("NC", "123456"));
    v.setColor("BLUE");
    vehicleCache.put(v.getId(), v);

    vehicleCache.stop();
    cacheManager.stop();
  }
View Full Code Here

          DEFAULT_INFINISPAN_CONFIGURATION_RESOURCENAME
      );
      try {
        InfinispanConfigurationParser ispnConfiguration = new InfinispanConfigurationParser( CacheManagerServiceProvider.class.getClassLoader() );
        ConfigurationBuilderHolder configurationBuilderHolder = ispnConfiguration.parseFile( cfgName );
        cacheManager = new DefaultCacheManager( configurationBuilderHolder, true );
        manageCacheManager = true;
      }
      catch ( IOException e ) {
        throw new SearchException(
            "Could not start Infinispan CacheManager using as configuration file: " + cfgName, e
View Full Code Here

   }

   protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
      try {
         String configLoc = ConfigurationHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
         EmbeddedCacheManager manager = new DefaultCacheManager(configLoc, false);
         String globalStats = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
         if (globalStats != null) {
            manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));
         }
         manager.start();
         return manager;
      } catch (IOException e) {
         throw new CacheException("Unable to create default cache manager", e);
      }
   }
View Full Code Here

      final ConfigurationContainer templateConfiguration = createTemplateConfiguration();

      this.globalConfigurationOverrides.applyOverridesTo(templateConfiguration.globalConfiguration);
      this.configurationOverrides.applyOverridesTo(templateConfiguration.defaultConfiguration);

      final EmbeddedCacheManager nativeEmbeddedCacheManager = new DefaultCacheManager(
               templateConfiguration.globalConfiguration,
               templateConfiguration.defaultConfiguration);
      for (final Map.Entry<String, Configuration> namedCacheConfig : templateConfiguration.namedCaches
               .entrySet()) {
         nativeEmbeddedCacheManager.defineConfiguration(namedCacheConfig.getKey(),
                  namedCacheConfig.getValue());
      }

      return nativeEmbeddedCacheManager;
   }
View Full Code Here

      String cfgName = properties.getProperty(
          INFINISPAN_CONFIGURATION_RESOURCENAME,
          DEFAULT_INFINISPAN_CONFIGURATION_RESOURCENAME
      );
      try {
        cacheManager = new DefaultCacheManager( cfgName );
        cacheManager.start();
        manageCacheManager = true;
      }
      catch ( IOException e ) {
        throw new SearchException(
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);
         CacheManager manager = new DefaultCacheManager(configLoc, false);
         String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
         if (globalStats != null) {
            manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));
         }
         manager.start();
         return manager;
      } catch (IOException e) {
         throw new CacheException("Unable to create default cache manager", e);
      }
   }
View Full Code Here

    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    TransactionManagerLookupDelegator transactionManagerLookupDelegator = new TransactionManagerLookupDelegator( platform );
    try {
      InputStream configurationFile = FileLookupFactory.newInstance().lookupFileStrict( cfgName, contextClassLoader );
      try {
        cacheManager = new DefaultCacheManager( configurationFile, false );
        // override the named cache configuration defined in the configuration file to
        // inject the platform TransactionManager
        for (String cacheName : cacheManager.getCacheNames() ) {
          Configuration originalCfg = cacheManager.getCacheConfiguration( cacheName );
          Configuration newCfg = new ConfigurationBuilder()
View Full Code Here

    private final String defaultCache;

    @SuppressWarnings("deprecation")
    public DefaultEmbeddedCacheManager(GlobalConfiguration global, String defaultCache) {
        this(new DefaultCacheManager(adapt(global), false), defaultCache);
    }
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.