Examples of ExpiresValidity


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

            while ((length = inputStream.read(buffer)) > -1) {
                baos.write(buffer, 0, length);
            }
            baos.flush();
            inputStream.close();
            this.cachedResponse = new ExtendedCachedResponse(new ExpiresValidity(this.expires),
                                                             baos.toByteArray());                                                           
            storeResponse = true;                                                            
        } else if ( this.cachedResponse == null ) {
            this.cachedResponse = new ExtendedCachedResponse(new ExpiresValidity(this.expires),
                                                             null);                                                           
        }
       
        // we cache both
        if ( alternative && this.cachedResponse.getAlternativeResponse() == 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

        // 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);
        } else if ( this.cacheExpires < 0 ) {
            this.cacheValidity = NOPValidity.SHARED_INSTANCE;
        }
        final boolean purge = this.parameters.getParameterAsBoolean("purge-cache", false);

View Full Code Here

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

                    serializer = new XMLByteStreamCompiler();
               
                    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

    private Log logger = LogFactory.getLog(getClass());

    public SourceValidity[] getCacheValidities(CachingSource cachingSource, Source source) {
        return new SourceValidity[] {
              new ExpiresValidity(cachingSource.getExpiration()), source.getValidity() };
    }
View Full Code Here

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

    public boolean checkValidity(CachedSourceResponse response, Source source, long expires) {
        final SourceValidity[] validities = response.getValidityObjects();
        boolean valid = true;

        final ExpiresValidity expiresValidity = (ExpiresValidity) validities[0];
        final SourceValidity sourceValidity = validities[1];

        if (expiresValidity.isValid() != SourceValidity.VALID) {
            int validity = sourceValidity != null? sourceValidity.isValid() : SourceValidity.INVALID;
            if (validity == SourceValidity.INVALID ||
                    validity == SourceValidity.UNKNOWN &&
                            sourceValidity.isValid(source.getValidity()) != SourceValidity.VALID) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Response expired, invalid for " + logger);
                }
                valid = false;
            } else {
                if (logger.isDebugEnabled()) {
                    logger.debug("Response expired, still valid for " + logger);
                }
                // set new expiration period
                validities[0] = new ExpiresValidity(expires);
            }
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("Response not expired for " + logger);
            }
View Full Code Here

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

        }

        final SourceValidity[] validities = this.response.getValidityObjects();
        boolean valid = true;

        final ExpiresValidity expiresValidity = (ExpiresValidity) validities[0];
        final SourceValidity sourceValidity = validities[1];

        if (expiresValidity.isValid() != SourceValidity.VALID) {
            int validity = sourceValidity != null? sourceValidity.isValid() : SourceValidity.INVALID;
            if (validity == SourceValidity.INVALID ||
                    validity == SourceValidity.UNKNOWN &&
                            sourceValidity.isValid(source.getValidity()) != SourceValidity.VALID) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Response expired, invalid for " + getSourceURI());
                }
                valid = false;
            } else {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Response expired, still valid for " + getSourceURI());
                }
                // set new expiration period
                validities[0] = new ExpiresValidity(getExpiration());
            }
        } else {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Response not expired for " + getSourceURI());
            }
View Full Code Here

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

            // use event caching strategy, the associated event is the source uri
            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

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

    {
        if (this.validity == null)
        {
                long expiry = System.currentTimeMillis() +
                ConfigurationManager.getIntProperty("websvc.opensearch.validity") * 60 * 60 * 1000;
                this.validity = new ExpiresValidity(expiry);
        }
        return this.validity;
    }
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.