Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.SourceValidity


            Iterator iter = javaSource.entrySet().iterator();
            List invalid = new LinkedList();
            while (iter.hasNext()) {
                Map.Entry e = (Map.Entry)iter.next();
                String uri = (String)e.getKey();
                SourceValidity validity =
                    (SourceValidity)e.getValue();
                int valid = validity.isValid();
                if (valid == SourceValidity.UNKNOWN) {
                    Source newSrc = null;
                    try {
                        newSrc = sourceResolver.resolveURI(uri);
                        valid = newSrc.getValidity().isValid(validity);
View Full Code Here


  public void store(Serializable 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

                                    AbstractAggregatedValidity val,
                                    Serializable 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

                    if (this.reloadable) {
                        if (logger.isDebugEnabled()) {
                            logger.debug("Document cached... checking validity of uri " + this.uri);
                        }
                        src = resolver.resolveURI(this.uri);
                        SourceValidity valid = src.getValidity();
                        if (srcVal != null && this.srcVal.isValid(valid) != 1) {
                            if (logger.isDebugEnabled())
                                logger.debug("reloading document... uri "+this.uri);
                            this.srcVal = valid;
                            this.document = SourceUtil.toDOM(src);
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

    Object result = null;
    if (this.objectCache == null)
      init();
    CacheEntry cacheEntry = (CacheEntry) this.objectCache.get(key);
    if (cacheEntry != null) {
      SourceValidity previous = cacheEntry.validity;
      Source source = null;
      switch (previous.isValid()) {
        case SourceValidity.VALID:
          result = cacheEntry.object;
          break;
        case SourceValidity.UNKNOWN:
          source = resolver.resolveURI(uri);
          SourceValidity fresh = source.getValidity();
          switch (previous.isValid(fresh)){
            case SourceValidity.VALID:
              result = cacheEntry.object;
              break;
            case SourceValidity.UNKNOWN:
View Full Code Here

        // Source exists
        Object[] values = (Object[])this.mountTables.get(uri);
       
        if (values != null) {
            // Check validity
            SourceValidity oldValidity = (SourceValidity)values[1];
            int valid = oldValidity.isValid();
            if (valid == 1) {
                // Valid without needing the new validity
                return (Map)values[0];
            }
           
            if (valid == 0 && oldValidity.isValid(source.getValidity()) == 1) {
                // Valid after comparing with the new validity
                return (Map)values[0];
            }
           
            // Invalid: fallback below to read the mount table
View Full Code Here

        Source source = null;
        SourceResolver resolver = null;
        try {
            resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI(sourceURL);
            SourceValidity sourceValidity = source.getValidity();
            if (validity == null || validity.isValid( sourceValidity ) == SourceValidity.INVALID) {
                HashMap values = new HashMap();
                SourceUtil.toSAX(source, new SAXContentHandler(values));
                this.validity = sourceValidity;
                this.values = values;
View Full Code Here

        this.configuration = configuration;
    }

    public Object get(Source source, String prefix) {
        String key = prefix + source.getURI();
        SourceValidity newValidity = source.getValidity();

        if (newValidity == null) {
            cache.remove(key);
            return null;
        }

        Object[] objectAndValidity = (Object[])cache.get(key);
        if (objectAndValidity == null)
            return null;

        SourceValidity storedValidity = (SourceValidity)objectAndValidity[1];
        int valid = storedValidity.isValid();
        boolean isValid;
        if (valid == 0) {
            valid = storedValidity.isValid(newValidity);
            isValid = (valid == 1);
        } else {
            isValid = (valid == 1);
        }
View Full Code Here

        return objectAndValidity[0];
    }

    public void set(Object object, Source source, String prefix) throws IOException {
        String key = prefix + source.getURI();
        SourceValidity validity = source.getValidity();
        if (validity != null) {
            Object[] objectAndValidity = {object,  validity};
            cache.put(key, objectAndValidity);
        }
    }
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.