Package org.exoplatform.services.jcr.config

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


   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


   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

   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);

      // create parent Infinispan instance
      CacheEntry cacheEntry = wsConfig.getCache();
      Cache<CacheKey, Object> parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);

      Boolean allowLocalChanges = null;
      try
      {
         allowLocalChanges = cacheEntry.getParameterBoolean("allow-local-changes");
      }
      catch (RepositoryConfigurationException e)
      {
         // do n't nothing
      }
View Full Code Here

               new QueryHandlerEntry(baseWorkspaceEntry.getQueryHandler().getType(), params);

      // Cache
      params = new ArrayList<SimpleParameterEntry>();
      params.addAll(copyList(baseWorkspaceEntry.getCache().getParameters()));
      CacheEntry cacheEntry = new CacheEntry(params);
      cacheEntry.setType(baseWorkspaceEntry.getCache().getType());

      // Lock
      LockManagerEntry lockManagerEntry = new LockManagerEntry();
      lockManagerEntry.setType("org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl");
      lockManagerEntry.putParameterValue("time-out", "15m");
View Full Code Here

     
      // Cache
      ArrayList cacheParams = new ArrayList();
      cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
      cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
      CacheEntry cacheEntry = new CacheEntry(cacheParams);
      cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");

      // Lock
      LockManagerEntry lockManagerEntry = new LockManagerEntry();
      lockManagerEntry.setType("org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl");
      lockManagerEntry.putParameterValue("time-out", "15m");
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

      list.add(new SimpleParameterEntry(ISPNCacheFactory.INFINISPAN_CONFIG,
         "jar:/conf/standalone/cluster/test-infinispan-config.xml"));
      list.add(new SimpleParameterEntry("infinispan-cluster-name", "TestISPNCacheWorkspaceStorageCacheInClusterMode"));
      list.add(new SimpleParameterEntry("jgroups-configuration", "classpath:/flush-udp.xml"));
     
      CacheEntry entry = new CacheEntry(list);
      entry.setEnabled(true);
      WorkspaceEntry workspaceEntry = new WorkspaceEntry();
      workspaceEntry.setCache(entry);
      workspaceEntry.setUniqueName("MyWorkspace");
      try
      {
View Full Code Here

   public WorkspaceStorageCache getCacheImpl() throws Exception
   {
      ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
      list.add(new SimpleParameterEntry("infinispan-configuration", "jar:/conf/standalone/test-infinispan-config.xml"));

      CacheEntry entry = new CacheEntry(list);
      entry.setEnabled(true);
      WorkspaceEntry workspaceEntry = new WorkspaceEntry();
      workspaceEntry.setUniqueName("WS_UUID");
      workspaceEntry.setCache(entry);
      return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
   }
View Full Code Here

         String repositoryName = manageableRepository.getConfiguration().getName();
         String workspacesUniqueName =
            manageableRepository.getConfiguration().getWorkspaceEntries().get(0).getUniqueName();
         String baseParameterName = "test-parameter" + IdGenerator.generate();
         CacheEntry cacheEntry = manageableRepository.getConfiguration().getWorkspaceEntries().get(0).getCache();

         List<String> systemPropertyPrefixes =
            SystemParametersTestConfigurationHelper.generateDefaultPropertiesPrefixes(repositoryName,
               workspacesUniqueName);

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

         manageableRepository.getConfiguration().getWorkspaceEntries().get(0).getCache()
            .putParameterValue(baseParameterName, "correctValue");

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

         String parameterValue = cacheEntry.getParameterValue(baseParameterName);

         for (String propertyName : systemProperties)
         {
            System.clearProperty(propertyName);
         }
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.