Package org.exoplatform.services.jcr.config

Examples of org.exoplatform.services.jcr.config.CacheEntry


      String currentIterationParameterName;
      String repositoryName = manageableRepository.getConfiguration().getName();
      for (int j = 0; j < 3; j++)
      {
         WorkspaceEntry workspaceEntry = helper.createWorkspaceEntry(DatabaseStructureType.SINGLE, null);
         CacheEntry cacheEntry = workspaceEntry.getCache();
         String workspacesUniqueName = repositoryName + "_" + workspaceEntry.getName();

         List<String> systemPropertyPrefixes =
            forced ? SystemParametersTestConfigurationHelper.generateForcedAndDefaultPropertiesPrefixes(repositoryName,
               workspacesUniqueName) : SystemParametersTestConfigurationHelper.generateDefaultPropertiesPrefixes(
               repositoryName, workspacesUniqueName);

         currentIterationParameterName = baseParameterName + j;
         List<String> systemProperties =
            SystemParametersTestConfigurationHelper.generateForcedAndDefaultProperties(systemPropertyPrefixes,
               currentIterationParameterName);

         if (forced)
         {
            cacheEntry.putParameterValue(currentIterationParameterName, "wrongValue");
         }

         for (int i = 0; i < systemProperties.size(); i++)
         {
            setProperty(systemProperties.get(i), String.valueOf(i));
         }

         helper.addWorkspace(manageableRepository, workspaceEntry);

         parameterValue = cacheEntry.getParameterValue(currentIterationParameterName);
         assertEquals("0", parameterValue);

         if (forced)
         {
            cacheEntry.putParameterValue(currentIterationParameterName, "wrongValue");
            parameterValue = cacheEntry.getParameterValue(currentIterationParameterName);
            assertEquals("0", parameterValue);
         }

         for (String propertyName : systemProperties)
         {
View Full Code Here


   {
      ManageableRepository manageableRepository = null;
      try
      {
         manageableRepository = helper.createRepository(container, DatabaseStructureType.SINGLE, false, false);
         CacheEntry cacheEntry = manageableRepository.getConfiguration().getWorkspaceEntries().get(0).getCache();

         testUnmodifiableParameter(manageableRepository, cacheEntry);
         testBeforeInitializeParameterIsSetCorrectly(manageableRepository);
         testBeforeInitializeParameterIsNotSetCorrectly(manageableRepository);
         testBeforeInitializeParameterExceptionIsThrownCorrectly(manageableRepository);
View Full Code Here

               .forName("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");

            ArrayList cacheParams = new ArrayList();
            cacheParams.add(new SimpleParameterEntry("infinispan-configuration",
               "conf/standalone/test-infinispan-config.xml"));
            CacheEntry cacheEntry = new CacheEntry(cacheParams);
            cacheEntry
               .setType("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");
            cacheEntry.setEnabled(true);

            ArrayList<WorkspaceEntry> wsList = repoEntry.getWorkspaceEntries();

            wsList.get(0).setCache(cacheEntry);
            repoEntry.setWorkspaceEntries(wsList);
View Full Code Here

      params.add(new SimpleParameterEntry("index-dir", "target/temp/index/" + wsName));
      QueryHandlerEntry qEntry =
         new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", params);

      // Cache
      CacheEntry cacheEntry = null;

      try
      {
         Class
            .forName("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");

         //TODO EXOJCR-1784
         ArrayList cacheParams = new ArrayList();
         cacheParams.add(new SimpleParameterEntry("infinispan-configuration",
            "conf/standalone/test-infinispan-config.xml"));
         cacheEntry = new CacheEntry(cacheParams);
         cacheEntry.setEnabled(cacheEnabled);
         cacheEntry
            .setType("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");
      }
      catch (ClassNotFoundException e)
      {
         ArrayList cacheParams = new ArrayList();
         cacheParams.add(new SimpleParameterEntry("jbosscache-configuration",
            "conf/standalone/test-jbosscache-config.xml"));
         cacheParams.add(new SimpleParameterEntry("jbosscache-shareable", Boolean.toString(cacheShared)));
         cacheEntry = new CacheEntry(cacheParams);
         cacheEntry
            .setType("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache");
         cacheEntry.setEnabled(cacheEnabled);
      }

      LockManagerEntry lockManagerEntry = new LockManagerEntry();
      lockManagerEntry.putParameterValue("time-out", "15m");
View Full Code Here

      QueryHandlerEntry qEntry = new QueryHandlerEntry(wsEntry.getQueryHandler().getType(), params);

      // Cache
      ArrayList cacheParams = new ArrayList();
      cacheParams.addAll(wsEntry.getCache().getParameters());
      CacheEntry cacheEntry = new CacheEntry(cacheParams);
      cacheEntry.setEnabled(wsEntry.getCache().getEnabled());
      cacheEntry.setType(wsEntry.getCache().getType());

      // Lock
      LockManagerEntry lockManagerEntry = new LockManagerEntry();
      lockManagerEntry.setType(wsEntry.getLockManager().getType());
      ArrayList lockParams = new ArrayList();
View Full Code Here

      ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
      list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
         "jar:/conf/standalone/cluster/test-jbosscache-data-no-mux.xml"));
      list.add(new SimpleParameterEntry("jbosscache-cluster-name", "TestJBossCacheWorkspaceStorageCacheInClusterMode"));
     
      CacheEntry entry = new CacheEntry(list);
      entry.setEnabled(true);
      WorkspaceEntry workspaceEntry = new WorkspaceEntry();
      workspaceEntry.setCache(entry);
      workspaceEntry.setUniqueName("MyWorkspace");
      JBossCacheWorkspaceStorageCache cache = new JBossCacheWorkspaceStorageCache(workspaceEntry,
         transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
View Full Code Here

      ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
      list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
         "jar:/conf/standalone/test-jbosscache-config.xml"));

      CacheEntry entry = new CacheEntry(list);
      entry.setEnabled(true);
      WorkspaceEntry workspaceEntry = new WorkspaceEntry();
      workspaceEntry.setUniqueName("WS_UUID");
      workspaceEntry.setCache(entry);
      return new JBossCacheWorkspaceStorageCache(workspaceEntry,
         transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
View Full Code Here

   public LinkedWorkspaceStorageCacheImpl(WorkspaceEntry wsConfig) throws RepositoryConfigurationException
   {

      this.name = "jcr." + wsConfig.getUniqueName();

      CacheEntry cacheConfig = wsConfig.getCache();

      long statisticPeriod;
      long cleanerPeriod;
      boolean cleanStats;
      int blockingUsers;
      boolean showStatistic;

      if (cacheConfig != null)
      {
         this.enabled = cacheConfig.isEnabled();

         int maxSizeConf;
         try
         {
            maxSizeConf = cacheConfig.getParameterInteger(MAX_SIZE_PARAMETER_NAME);
         }
         catch (RepositoryConfigurationException e)
         {
            maxSizeConf = cacheConfig.getParameterInteger("maxSize");
         }
         this.maxSize = maxSizeConf;

         int initialSize = maxSize > MAX_CACHE_SIZE ? maxSize / 4 : maxSize;
         this.nodesCache = new WeakHashMap<String, List<NodeData>>(initialSize, LOAD_FACTOR);
         this.propertiesCache = new WeakHashMap<String, List<PropertyData>>(initialSize, LOAD_FACTOR);

         try
         {
            // apply in milliseconds
            this.liveTime = cacheConfig.getParameterTime(LIVE_TIME_PARAMETER_NAME);
         }
         catch (RepositoryConfigurationException e)
         {
            this.liveTime = cacheConfig.getParameterTime("liveTime");
         }

         this.deepDelete = cacheConfig.getParameterBoolean(DEEP_DELETE_PARAMETER_NAME, false);

         blockingUsers = cacheConfig.getParameterInteger(BLOCKING_USERS_COUNT_PARAMETER_NAME, DEF_BLOCKING_USERS_COUNT);

         cleanerPeriod = cacheConfig.getParameterTime(CLEANER_PERIOD_PARAMETER_NAME, DEF_CLEANER_PERIOD);

         cleanStats = cacheConfig.getParameterBoolean(STATISTIC_CLEAN_PARAMETER_NAME, true);
         statisticPeriod = cacheConfig.getParameterTime(STATISTIC_PERIOD_PARAMETER_NAME, DEF_STATISTIC_PERIOD);
         showStatistic = cacheConfig.getParameterBoolean(STATISTIC_LOG_PARAMETER_NAME, false);

      }
      else
      {
         this.maxSize = MAX_CACHE_SIZE;
View Full Code Here

      // create cache using custom factory
      ISPNCacheFactory<CacheKey, Object> factory =
         new ISPNCacheFactory<CacheKey, Object>(cfm, ts == null ? null : ts.getTransactionManager());

      // create parent Infinispan instance
      CacheEntry cacheEntry = wsConfig.getCache();
      boolean useDistributedCache = cacheEntry.getParameterBoolean("use-distributed-cache", false);
      Cache<CacheKey, Object> parentCache;
      if (useDistributedCache)
      {
                  // We expect a distributed cache
                 if (dcm == null)
                 {
                     throw new IllegalArgumentException("The DistributedCacheManager has not been defined in the configuration,"
                        + " please configure it at root container level if you want to use a distributed cache.");
                  }
                  parentCache = dcm.getCache(CACHE_NAME);
                  this.ownerId = ctx.getName();
                  if (LOG.isDebugEnabled())
                  {
                     LOG.debug("The distributed cache has been enabled for the workspace whose unique id is " + ownerId);
                  }
      }
      else
      {
         parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
         Configuration config = parentCache.getCacheConfiguration();
         if (config.clustering().cacheMode() == CacheMode.DIST_SYNC
            || config.clustering().cacheMode() == CacheMode.DIST_ASYNC)
         {
            throw new IllegalArgumentException("Cache configuration not allowed, if you want to use the distributed "
               + "cache please enable the parameter 'use-distributed-cache' and configure the DistributedCacheManager.");
         }
         this.ownerId = null;
      }
      Boolean allowLocalChanges =
         useDistributedCache ? cacheEntry.getParameterBoolean("allow-local-changes", Boolean.TRUE) : Boolean.TRUE;
      this.cache = new BufferedISPNCache(parentCache, allowLocalChanges);
      if (useDistributedCache)
      {
         this.caller = new DistributedOperationCaller();
      }
View Full Code Here

      // create cache using custom factory
      ISPNCacheFactory<CacheKey, Object> factory =
         new ISPNCacheFactory<CacheKey, Object>(cfm, ts == null ? null : ts.getTransactionManager());

      // create parent Infinispan instance
      CacheEntry cacheEntry = wsConfig.getCache();
      boolean useDistributedCache = cacheEntry.getParameterBoolean("use-distributed-cache", false);
      Cache<CacheKey, Object> parentCache;
      if (useDistributedCache)
      {
         // We expect a distributed cache
         if (dcm == null)
         {
            throw new IllegalArgumentException("The DistributedCacheManager has not been defined in the configuration,"
               + " please configure it at root container level if you want to use a distributed cache.");
         }
         parentCache = dcm.getCache(CACHE_NAME);
         this.ownerId = ctx.getName();
         if (LOG.isDebugEnabled())
         {
            LOG.debug("The distributed cache has been enabled for the workspace whose unique id is " + ownerId);
         }
      }
      else
      {
         parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
         Configuration config = parentCache.getCacheConfiguration();
         if (config.clustering().cacheMode() == CacheMode.DIST_SYNC
            || config.clustering().cacheMode() == CacheMode.DIST_ASYNC)
         {
            throw new IllegalArgumentException("Cache configuration not allowed, if you want to use the distributed "
               + "cache please enable the parameter 'use-distributed-cache' and configure the DistributedCacheManager.");
         }
         this.ownerId = null;
      }
      Boolean allowLocalChanges =
         useDistributedCache ? cacheEntry.getParameterBoolean("allow-local-changes", Boolean.TRUE) : Boolean.TRUE;
      this.cache = new BufferedISPNCache(parentCache, allowLocalChanges);
      if (useDistributedCache)
      {
         this.caller = new DistributedOperationCaller();
      }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.config.CacheEntry

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.