Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.SourceValidity


            file = new File(file.getAbsolutePath()+".cxml");
            if ( file.exists() ) {
                altContent = this.get(file);
            }
            if ( content != null || altContent != null ) {
                SourceValidity val = new FileTimeStampValidity(file);
                response = new ExtendedCachedResponse(val, content);
                ((ExtendedCachedResponse)response).setAlternativeResponse(altContent);
            }
        }
        return response;
View Full Code Here


        }
       
        if (checkValidity) {
           
            final ExpiresValidity cacheValidity = (ExpiresValidity) this.response.getValidityObjects()[0];
            final SourceValidity sourceValidity = this.response.getValidityObjects()[1];
           
            boolean remove = false;
            if (this.expires == 0) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Force invalidation of cached response" +
View Full Code Here

    protected void initMetaResponse() throws IOException {
        boolean storeResponse = false;
        CachedSourceResponse response = this.response;
        if (response == null) {
            if (this.expires != 0) {
                final SourceValidity cacheValidity = new ExpiresValidity(getExpiration());
                final SourceValidity sourceValidity = source.getValidity();
                response = new CachedSourceResponse(new SourceValidity[] {cacheValidity, sourceValidity});
                storeResponse = true;
            }
            else {
                response = new CachedSourceResponse(null);
View Full Code Here

        boolean storeResponse = false;
        /* delay caching the response until we have a valid new one */
        CachedSourceResponse response = this.response;
        if (response == null) {
            if (this.expires != 0) {
                final SourceValidity cacheValidity = new ExpiresValidity(getExpiration());
                final SourceValidity sourceValidity = source.getValidity();
                response = new CachedSourceResponse(new SourceValidity[] {cacheValidity, sourceValidity});
                storeResponse = true;
            }
            else {
                response = new CachedSourceResponse(null);
View Full Code Here

        boolean storeResponse = false;
        /* delay caching the response until we have a valid new one */
        CachedSourceResponse response = this.response;
        if (response == null) {
            if (this.expires != 0) {
                final SourceValidity cacheValidity = new ExpiresValidity(getExpiration());
                final SourceValidity sourceValidity = source.getValidity();
                response = new CachedSourceResponse(new SourceValidity[] {cacheValidity, sourceValidity});
                storeResponse = true;
            }
            else {
                response = new CachedSourceResponse(null);
View Full Code Here

      Object result = this.checkValidity(key, parameters, forcedLoad, adapter);
           
      if (!(result instanceof SourceValidity))
        return new Object[]{result, Boolean.FALSE};
      SourceValidity newValidity = (SourceValidity)result;

      this.lock.releaseReadLock();
      this.lock.writeLock();
     
      // check validity again in case of another thread has already loaded
View Full Code Here

                                  Map parameters,
                                  boolean forcedLoad,
                                  ProfileLS adapter) {
    Object[] objects = (Object[])this.attributes.get(key);

    SourceValidity sourceValidity = null;
    int valid = SourceValidity.INVALID;
    if (objects != null) {
      sourceValidity = (SourceValidity) objects[1];
      valid = sourceValidity.isValid();
      if (!forcedLoad && valid == SourceValidity.VALID)
        return objects[0];
    }

    SourceValidity newValidity = adapter.getValidity(key, parameters);
    if (!forcedLoad && valid == SourceValidity.UNKNOWN) {
      if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
        return objects[0];
    }
   
View Full Code Here

        AggregatedValidity validity = new AggregatedValidity();
        SourceInspector inspector;
        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            SourceValidity sv = inspector.getValidity(source);
            if (sv == null) {
                return null;
            }
            validity.add(sv);
        }
View Full Code Here

        this.delay = delay;
    }
   
    public void addSource(Source src) {
        if (this.uris != null) {
            SourceValidity validity = src.getValidity();
            if (validity == null) {
                // one of the sources has no validity : this object will always be invalid
                this.uris = null;
            } else {
                // Add the validity and URI to the list
View Full Code Here

    }
   
    private int computeStatus(SourceResolver resolver) {
        List validities = super.getValidities();
        for (int i = 0; i < validities.size(); i++) {
            SourceValidity validity = (SourceValidity) validities.get(i);
            switch(validity.isValid()) {
                case -1:
                    // invalid : stop examining
                    return -1;
                case 1:
                    // valid : just continue to next source
                    break;
                case 0:
                    // don't know : check with the new source
                    if (resolver == null) {
                        // we have no resolver : definitely don't know (need to have one)
                        return 0;
                    }
                    try {
                        Source newSrc = resolver.resolveURI((String) uris.get(i));
                        int value = validity.isValid(newSrc.getValidity());
                        resolver.release(newSrc);
                        if (value != 1) {
                            return -1;
                        }
                    } catch(IOException ioe) {
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.SourceValidity

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.