Examples of SourceValidity


Examples of org.apache.excalibur.source.SourceValidity

  public void store(PipelineCacheKey key,
                    CachedResponse response)
                    throws ProcessingException {
        SourceValidity[] validities = response.getValidityObjects();
        for (int i=0; i< validities.length;i++) {
            SourceValidity val = validities[i];
      examineValidity(val, key);
        }
    super.store(key, response);
  }
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

                                    AggregatedValidity val,
                                    PipelineCacheKey key) {
        // AggregatedValidity must be investigated further.
         Iterator it = val.getValidities().iterator();
         while (it.hasNext()) {
             SourceValidity thisVal = (SourceValidity)it.next();
             // Allow recursion
             examineValidity(thisVal, key);
         }
    }
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

                this.toCacheSourceValidities = new SourceValidity[this.toCacheKey.size()];
                int len = this.toCacheSourceValidities.length;
                int i = 0;
                while (i < len) {
                    final SourceValidity validity = this.getValidityForInternalPipeline(i);

                    if (validity == null) {
                        if (i > 0
                            && (this.fromCacheKey == null || i > this.fromCacheKey.size())) {
                            // shorten key
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

                int i = 0;
                while (responseIsValid && i < fromCacheValidityObjects.length) {
                    boolean isValid = false;
                    // BH check if validities[i] is null, may happen
                    // if exception was thrown due to malformed content
                    SourceValidity validity = fromCacheValidityObjects[i];
                    int valid = validity != null ? validity.isValid() : -1;
                    if ( valid == 0) { // don't know if valid, make second test
                      
                        validity = this.getValidityForInternalPipeline(i);

                        if (validity != null) {
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

    protected boolean processReader(Environment  environment)
    throws ProcessingException {
        try {
            boolean usedCache = false;
            OutputStream outputStream = null;
            SourceValidity readerValidity = null;
            PipelineCacheKey pcKey = null;

            // test if reader is cacheable
            Serializable readerKey = null;
            boolean isCacheableProcessingComponent = false;
            if (super.reader instanceof CacheableProcessingComponent) {
                readerKey = ((CacheableProcessingComponent)super.reader).getKey();
                isCacheableProcessingComponent = true;
            } else if (super.reader instanceof Cacheable) {
                readerKey = new Long(((Cacheable)super.reader).generateKey());
            }

            if ( readerKey != null) {
                // response is cacheable, build the key
                pcKey = new PipelineCacheKey();
                pcKey.addKey(new ComponentCacheKey(ComponentCacheKey.ComponentType_Reader,
                                                   this.readerRole,
                                                   readerKey)
                            );

                // now we have the key to get the cached object
                CachedResponse cachedObject = (CachedResponse)this.cache.get( pcKey );

                if (cachedObject != null) {
                    if (this.getLogger().isDebugEnabled()) {
                        this.getLogger().debug(
                            "Found cached response for '" + environment.getURI() +
                            "' using key: " + pcKey
                        );
                    }
                    SourceValidity[] validities = cachedObject.getValidityObjects();
                    if (validities == null || validities.length != 1) {
                        throw new ProcessingException("Cached response is not correct.");
                    }
                    SourceValidity cachedValidity = validities[0];
                    int result = cachedValidity.isValid();
                    boolean valid = false;
                    if ( result == 0 ) {
                        // get reader validity and compare
                        if (isCacheableProcessingComponent) {
                            readerValidity = ((CacheableProcessingComponent)super.reader).getValidity();
                        } else {
                            CacheValidity cv = ((Cacheable)super.reader).generateValidity();
                            if ( cv != null ) {
                                readerValidity = CacheValidityToSourceValidity.createValidity( cv );
                            }
                        }
                        if (readerValidity != null) {
                            result = cachedValidity.isValid(readerValidity);
                            if ( result == 0 ) {
                                readerValidity = null;
                            } else {
                                valid = (result == 1);
                            }
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

    /**
     *
     * @see org.apache.cocoon.components.pipeline.ProcessingPipeline#getValidityForInternalPipeline(int)
     */
    SourceValidity getValidityForInternalPipeline(int index) {
        final SourceValidity validity;

        // if debugging try to tell why something is not cacheable
        final boolean debug = this.getLogger().isDebugEnabled();
        String msg = null;
        if(debug) msg = "getValidityForInternalPipeline(" + index + "): ";
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

            synchronized (cache) {
                StartDocument startEvent = (StartDocument)cache.get(uri);
                if (startEvent != null) {
                    int valid = startEvent.compileTime.isValid();
                    if ( valid == SourceValidity.UNKNOWN ) {
                        SourceValidity validity = inputSource.getValidity();
                        valid = startEvent.compileTime.isValid(validity);
                    }
                    if ( valid != SourceValidity.VALID) {
                        cache.remove(uri);
                    }
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

        StartDocument startEvent;
        synchronized (cache) {
            startEvent = (StartDocument)cache.get(inputSource.getURI());
        }
        if (startEvent == null) {
            SourceValidity validity = inputSource.getValidity();
            Parser parser = new Parser();
            SourceUtil.parse(this.manager, this.inputSource, parser);
            startEvent = parser.getStartEvent();
            startEvent.compileTime = validity;
            synchronized (cache) {
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

                } catch (Exception exc) {
                    throw new SAXParseException(exc.getMessage(),
                                                ev.location,
                                                exc);
                }
                SourceValidity validity = null;
                StartDocument doc;
                synchronized (cache) {
                    doc = (StartDocument)cache.get(input.getURI());
                    if (doc != null) {
                        boolean recompile = false;
View Full Code Here

Examples of org.apache.excalibur.source.SourceValidity

                    new SourceValidity[this.toCacheKey.size()];

                int len = this.toCacheSourceValidities.length;
                int i = 0;
                while (i < len) {
                    final SourceValidity validity = getValidityForInternalPipeline(i);

                    if (validity == null) {
                        if (i > 0
                                && (this.fromCacheKey == null
                                    || i > this.fromCacheKey.size())) {
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.