Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.DiskStoreConfiguration


      // factory.setPropertySeparator(",");
      // configuration.addCacheManagerPeerListenerFactory(factory);

      // Configuration is required for EHCache CacheManager
      Configuration ehCacheManagerConfiguration = new Configuration();
      DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration();
      if (diskPath != null) {
        diskStoreConfiguration.setPath(diskPath);
      }
      // use the ehCacheConfiguration as default but change the name
      ehCacheConfiguration.setName(SCCacheFactory.DEFAULT_CACHE_NAME);
      ehCacheManagerConfiguration.addDiskStore(diskStoreConfiguration);
      ehCacheManagerConfiguration.setName(SCCacheFactory.DEFAULT_CACHE_NAME);
View Full Code Here


        final URL configURL = anchorClass.getResource("/ehcache.xml");
        assertNotNull("Cannot find configuration file URL");

        final File testDir = FileUtil.detectTargetFolder(anchorClass), testStore = new File(testDir, "ehcache-store");
        final Configuration config = ConfigurationFactory.parseConfiguration(configURL);
        final DiskStoreConfiguration diskStore = config.getDiskStoreConfiguration();
        diskStore.setPath(testStore.getAbsolutePath());

        manager = CacheManager.create(config);
        cache = manager.getCache(TEST_CACHE_NAME);
        assertNotNull("Test cache not found", cache);
        cache.registerCacheWriter(new TestCacheWriter(cache));
View Full Code Here

      // factory.setPropertySeparator(",");
      // configuration.addCacheManagerPeerListenerFactory(factory);

      // Configuration is required for EHCache CacheManager
      Configuration ehCacheManagerConfiguration = new Configuration();
      DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration();
      if (diskPath != null) {
        diskStoreConfiguration.setPath(diskPath);
      }
      // use the ehCacheConfiguration as default but change the name
      ehCacheConfiguration.setName(SCCacheFactory.DEFAULT_CACHE_NAME);
      ehCacheManagerConfiguration.addDiskStore(diskStoreConfiguration);
      ehCacheManagerConfiguration.setName(SCCacheFactory.DEFAULT_CACHE_NAME);
View Full Code Here

        } else {
            Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
           
            if (bus != null) {
                conf.setName(bus.getId());
                DiskStoreConfiguration dsc = conf.getDiskStoreConfiguration();
                if (dsc != null && "java.io.tmpdir".equals(dsc.getOriginalPath())) {
                    String path = conf.getDiskStoreConfiguration().getPath() + File.separator
                        + bus.getId();
                    conf.getDiskStoreConfiguration().setPath(path);
                }
            }
View Full Code Here

    Configuration config = null;
    if (this.configLocation != null) {
      config = ConfigurationFactory
          .parseConfiguration(this.configLocation.getInputStream());
      if (this.diskStoreLocation != null) {
        DiskStoreConfiguration dc = new DiskStoreConfiguration();
        dc.setPath(this.diskStoreLocation.getFile().getAbsolutePath());
        try {
          config.addDiskStore(dc);
        } catch (ObjectExistsException e) {
          log.warn("if you want to config distStore in spring,"
              + " please remove diskStore in config file!", e);
View Full Code Here

    try {
      if (configLocation != null) {
        config = ConfigurationFactory.parseConfiguration(configLocation
            .getInputStream());
        if (this.diskStoreLocation != null) {
          DiskStoreConfiguration dc = new DiskStoreConfiguration();
          dc.setPath(this.diskStoreLocation.getFile()
              .getAbsolutePath());
          try {
            config.addDiskStore(dc);
          } catch (ObjectExistsException e) {
            String s = "if you want to config distStore in spring,"
View Full Code Here

        } else {
            Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
           
            if (bus != null) {
                conf.setName(bus.getId());
                DiskStoreConfiguration dsc = conf.getDiskStoreConfiguration();
                if (dsc != null && "java.io.tmpdir".equals(dsc.getOriginalPath())) {
                    String path = conf.getDiskStoreConfiguration().getPath() + File.separator
                        + bus.getId();
                    conf.getDiskStoreConfiguration().setPath(path);
                }
            }
View Full Code Here

  public void afterPropertiesSet() throws IOException, CacheException {
    logger.info("Initializing EHCache CacheManager");
    this.configuration = ConfigurationFactory.parseConfiguration(this.configLocation.getInputStream());
    if (this.diskStorePath != null) {
      logger.info("diskStorePath=" + this.diskStorePath);
      DiskStoreConfiguration dsConfig = new DiskStoreConfiguration();
      dsConfig.setPath(this.diskStorePath);
      logger.info("diskStorePath (translated)=" + dsConfig.getPath());
      configuration.addDiskStore(dsConfig);
    }
    if (this.terracottaUrl != null) {
      logger.info("terracottaUrl=" + this.terracottaUrl);
      TerracottaClientConfiguration tcConfig = new TerracottaClientConfiguration();
View Full Code Here

      File loc = site.resolve(config.getString("cache", null, "directory"));
      if (loc == null) {
      } else if (loc.exists() || loc.mkdirs()) {
        if (loc.canWrite()) {
          final DiskStoreConfiguration c = new DiskStoreConfiguration();
          c.setPath(loc.getAbsolutePath());
          mgr.addDiskStore(c);
          log.info("Enabling disk cache " + loc.getAbsolutePath());
        } else {
          log.warn("Can't write to disk cache: " + loc.getAbsolutePath());
        }
View Full Code Here

                String.valueOf(Configuration.DEFAULT_DYNAMIC_CONFIG)));
        addAttribute(new SimpleNodeAttribute("defaultTransactionTimeoutInSeconds", configuration.getDefaultTransactionTimeoutInSeconds())
                .optional(true).defaultValue(String.valueOf(Configuration.DEFAULT_TRANSACTION_TIMEOUT)));

        // add the child elements
        DiskStoreConfiguration diskStoreConfiguration = configuration.getDiskStoreConfiguration();
        if (diskStoreConfiguration != null) {
            addChildElement(new DiskStoreConfigurationElement(this, diskStoreConfiguration));
        }
        FactoryConfiguration transactionManagerLookupConfiguration = configuration.getTransactionManagerLookupConfiguration();
        if (transactionManagerLookupConfiguration != null
View Full Code Here

TOP

Related Classes of net.sf.ehcache.config.DiskStoreConfiguration

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.