Examples of CachePolicy


Examples of org.jboss.dna.graph.cache.CachePolicy

                // Set the name using the property if there is one ...
                defaultWorkspaceName = strings.create(defaultWorkspaceNameProperty.getFirstValue());
            }

            // Get the default expiration time for the repository ...
            CachePolicy defaultCachePolicy = null;
            Property timeToExpire = repositories.getRoot().getProperty(DnaLexicon.TIME_TO_EXPIRE);
            if (timeToExpire != null && !timeToExpire.isEmpty()) {
                long timeToCacheInMillis = longs.create(timeToExpire.getFirstValue());
                defaultCachePolicy = new BasicCachePolicy(timeToCacheInMillis, TimeUnit.MILLISECONDS).getUnmodifiable();
            }
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

        // Now set up or get the existing components needed by the workspace ...
        RepositoryConnectionFactory connectionFactory = null;
        ExecutorService executor = null;
        LinkedList<FederatedWorkspace> workspaces = new LinkedList<FederatedWorkspace>();
        CachePolicy defaultCachePolicy = null;
        if (this.configuration != null) {
            connectionFactory = this.configuration.getConnectionFactory();
            executor = this.configuration.getExecutor();
            defaultCachePolicy = this.configuration.getDefaultCachePolicy();
            for (String existingWorkspaceName : this.configuration.getWorkspaceNames()) {
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

            if (existingWorkspaceName.equals(workspaceName)) continue;
            workspaces.add(this.configuration.getWorkspace(existingWorkspaceName));
        }
        RepositoryConnectionFactory connectionFactory = this.configuration.getConnectionFactory();
        ExecutorService executor = this.configuration.getExecutor();
        CachePolicy defaultCachePolicy = this.configuration.getDefaultCachePolicy();
        this.configuration = new FederatedRepository(name, connectionFactory, workspaces, defaultCachePolicy, executor);
        return true;
    }
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

        }
        return value;
    }

    protected static DateTime computeExpirationTime( CacheableRequest request ) {
        CachePolicy policy = request.getCachePolicy();
        return policy == null ? null : request.getTimeLoaded().plus(policy.getTimeToLive(), TimeUnit.MILLISECONDS);
    }
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

        assertThat(connection.getDefaultCachePolicy(), is(sameInstance(policy)));
    }

    @Test
    public void shouldGetTheSVNRepositoryRootFromTheSVNRepositoryWhenPinged() throws Exception {
        CachePolicy policy = mock(CachePolicy.class);
        selectedRepository = SVNConnectorTestUtil.createRepository(url, "sp", "");
        connection = new SVNRepositoryConnection("the source name", selectedRepository, availableWorkspaceNames,
                                                 Boolean.FALSE, policy, Boolean.FALSE, new RepositoryAccessData(url, username,password));
        assertThat(connection.ping(1, TimeUnit.SECONDS), is(true));
    }
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

            final String source = projection.getSourceName();
            if (sourceNames != null && !sourceNames.contains(source)) continue;
            final RepositoryConnection sourceConnection = getConnection(projection);
            if (sourceConnection == null) continue; // No source exists by this name
            // Get the cached information ...
            CachePolicy cachePolicy = sourceConnection.getDefaultCachePolicy();
            if (cachePolicy == null) cachePolicy = this.defaultCachePolicy;
            DateTime expirationTime = null;
            if (cachePolicy != null) {
                expirationTime = getCurrentTimeInUtc().plus(cachePolicy.getTimeToLive(), TimeUnit.MILLISECONDS);
            }
            // Get the paths-in-source where we should fetch node contributions ...
            Set<Path> pathsInSource = projection.getPathsInSource(path, pathFactory);
            if (pathsInSource.isEmpty()) {
                // The source has no contributions, but see whether the project exists BELOW this path.
View Full Code Here

Examples of org.jboss.dna.graph.cache.CachePolicy

        if (workspaceNames != null && workspaceNames.length != 0) {
            ref.add(new StringRefAddr(PREDEFINED_WORKSPACE_NAMES, StringUtil.combineLines(workspaceNames)));
        }
        if (getDefaultCachePolicy() != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            CachePolicy policy = getDefaultCachePolicy();
            try {
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                oos.writeObject(policy);
                ref.add(new BinaryRefAddr(DEFAULT_CACHE_POLICY, baos.toByteArray()));
            } catch (IOException e) {
                I18n msg = InfinispanConnectorI18n.errorSerializingCachePolicyInSource;
                throw new RepositorySourceException(getName(), msg.text(policy.getClass().getName(), getName()), e);
            }
        }
        return ref;
    }
View Full Code Here

Examples of org.jboss.util.CachePolicy

         // scan all security domains
         for (Entry<String, SecurityDomainContext> entry : securityMgrMap.entrySet())
         {
            String securityDomain = entry.getKey();
            SecurityDomainContext securityDomainCtx = entry.getValue();
            CachePolicy cache = securityDomainCtx.getAuthenticationCache();
            AuthenticationTimedCachePolicy timedCache = null;
            if (cache instanceof TimedCachePolicy)
            {
               timedCache = (AuthenticationTimedCachePolicy) cache;
            }
View Full Code Here

Examples of org.jboss.util.CachePolicy

    @param timeoutInSecs - the cache timeout in seconds.
    @param resInSecs - resolution of timeouts in seconds.
    */
   public void setCacheTimeout(String securityDomain, int timeoutInSecs, int resInSecs)
   {
      CachePolicy cache = getCachePolicy(securityDomain);
      if( cache != null && cache instanceof TimedCachePolicy )
      {
         TimedCachePolicy tcp = (TimedCachePolicy) cache;
         synchronized( tcp )
         {
View Full Code Here

Examples of org.jboss.util.CachePolicy

   /** flush the cache policy for the indicated security domain if one exists.
    * @param securityDomain the name of the security domain cache
    */
   public void flushAuthenticationCache(String securityDomain)
   {
      CachePolicy cache = getCachePolicy(securityDomain);
      if( cache != null )
      {
         cache.flush();
      }
      else
      {
         log.warn("Failed to find cache policy for securityDomain='"
            + securityDomain + "'");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.