Examples of ExpiresValidity


Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        // and now prepare the caching information
        this.cacheKey = new IdentifierCacheKey(key,
                                           this.serializer == this.lastConsumer);
        if ( this.cacheExpires > 0) {
            this.cacheValidity = new ExpiresValidity(this.cacheExpires*1000);
        }
        final boolean purge = this.parameters.getParameterAsBoolean("purge-cache", false);

        this.cachedResponse = this.cache.get(this.cacheKey);
        if ( this.cachedResponse != null ) {
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        }

        synchronized (this) {
            // Use expires validity to delay next reloading.
            if (interval > 0) {
                this.validity = new ExpiresValidity(interval);
            } else {
                this.validity = null;
            }
            this.values = newValues;
        }
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        return this.expires;
    }

    public SourceValidity getExpiresValidity() {
        if ( this.expires > 0 && this.validity == null) {
            this.validity = new ExpiresValidity( this.expires * 1000 ); // milliseconds
        }
        return this.validity;
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        return this.expires;
    }

    public SourceValidity getExpiresValidity() {
        if ( this.expires > 0 && this.validity == null) {
            this.validity = new ExpiresValidity( this.expires * 1000 ); // milliseconds
        }
        return this.validity;
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

                    serializer = (XMLSerializer)manager.lookup(XMLSerializer.ROLE);
               
                    SourceUtil.toSAX(source, serializer);
               
                    SourceValidity[] validities = new SourceValidity[1];
                    validities[0] = new ExpiresValidity(((Long)object[2]).longValue() * 1000); // milliseconds!
                    CachedResponse response = new CachedResponse(validities,
                                                                 (byte[])serializer.getSAXFragment());
                    ((IncludeCacheStorageProxy)object[0]).put(uri, response);
                    
                } catch (Exception ignore) {
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        }

        synchronized (this) {
            // Use expires validity to delay next reloading.
            if (interval > 0) {
                this.validity = new ExpiresValidity(interval);
            } else {
                this.validity = null;
            }
            this.values = newValues;
        }
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        // and now prepare the caching information
        this.cacheKey = new IdentifierCacheKey(key,
                                           this.serializer == this.lastConsumer);
        if ( this.cacheExpires > 0) {
            this.cacheValidity = new ExpiresValidity(this.cacheExpires*1000);
        }
        final boolean purge = this.parameters.getParameterAsBoolean("purge-cache", false);

        this.cachedResponse = this.cache.get(this.cacheKey);
        if ( this.cachedResponse != null ) {
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

                CachedSourceResponse response = this.response;
                try {
                    if (response == null) {
                        // create a new cached response
                        response = new CachedSourceResponse(new SourceValidity[] {
                                new ExpiresValidity(getExpiration()), source.getValidity()});
                    }
                    // only create objects that are cached
                    if (response.getBinaryResponse() != null) {
                        response.setBinaryResponse(readBinaryResponse(source));
                    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

        if (this.response == null) return false;
       
        final SourceValidity[] validities = this.response.getValidityObjects();
        boolean valid = true;
        if (validities.length == 2) {
            final ExpiresValidity expiresValidity = (ExpiresValidity) validities[0];
            final SourceValidity sourceValidity = validities[1];

            if (expiresValidity.isValid() != SourceValidity.VALID) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Cached response of source " + getSourceURI() + " is expired.");
                }
                if (!isValid(sourceValidity, source.getValidity())) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("Cached response of source " + getSourceURI() + " is invalid.");
                    }
                    valid = false;
                }
                else {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("Cached response of source " + getSourceURI() + " is still valid.");
                    }
                    // set new expiration period
                    this.response.getValidityObjects()[0] = new ExpiresValidity(getExpiration());
                }
            }
            else {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Cached response of source " + getSourceURI() + " is NOT expired.");
View Full Code Here

Examples of org.apache.excalibur.source.impl.validity.ExpiresValidity

            return new SourceValidity[] { new EventValidity(new NamedEvent(this.source.getURI())) };
        }
        else {
            // we need to store both the cache expiration and the original source validity
            // the former is to determine whether to recheck the latter (see checkValidity)
            return new SourceValidity[] { new ExpiresValidity(getExpiration()), source.getValidity() };
        }
    }
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.