FileDocCategorySizeDatePackage
ResourceResolverSpi.javaAPI DocJava SE 6 API4942Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.utils.resolver

ResourceResolverSpi

public abstract class ResourceResolverSpi extends Object
During reference validation, we have to retrieve resources from somewhere.
author
$Author: raul $

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
protected Map
_properties
Field _properties
Constructors Summary
Methods Summary
public voidengineAddProperies(java.util.Map properties)

param
properties

      this._properties.putAll(properties);
   
public abstract booleanengineCanResolve(org.w3c.dom.Attr uri, java.lang.String BaseURI)
This method helps the {@link ResourceResolver} to decide whether a {@link ResourceResolverSpi} is able to perform the requested action.

param
uri
param
BaseURI
return
true if the engine can resolve the uri

public java.lang.StringengineGetProperty(java.lang.String key)
Method engineGetProperty

param
key
return
the value of the property


      java.util.Iterator i = this._properties.keySet().iterator();

      while (i.hasNext()) {
         String c = (String) i.next();

         if (c.equals(key)) {
            key = c;

            break;
         }
      }

      return (String) this._properties.get(key);
   
public java.lang.String[]engineGetPropertyKeys()
Method engineGetPropertyKeys

return
the property keys

      return new String[0];
   
public abstract com.sun.org.apache.xml.internal.security.signature.XMLSignatureInputengineResolve(org.w3c.dom.Attr uri, java.lang.String BaseURI)
This is the workhorse method used to resolve resources.

param
uri
param
BaseURI
return
the resource wrapped arround a XMLSignatureInput
throws
ResourceResolverException

public voidengineSetProperty(java.lang.String key, java.lang.String value)
Method engineSetProperty

param
key
param
value


                             
         
       

             
         

      java.util.Iterator i = this._properties.keySet().iterator();

      while (i.hasNext()) {
         String c = (String) i.next();

         if (c.equals(key)) {
            key = c;

            break;
         }
      }

      this._properties.put(key, value);
   
public static java.lang.StringfixURI(java.lang.String str)
Fixes a platform dependent filename to standard URI form.

param
str The string to fix.
return
Returns the fixed URI string.


      // handle platform dependent strings
      str = str.replace(java.io.File.separatorChar, '/");

      if (str.length() >= 4) {

         // str =~ /^\W:\/([^/])/ # to speak perl ;-))
         char ch0 = Character.toUpperCase(str.charAt(0));
         char ch1 = str.charAt(1);
         char ch2 = str.charAt(2);
         char ch3 = str.charAt(3);
         boolean isDosFilename = ((('A" <= ch0) && (ch0 <= 'Z"))
                                  && (ch1 == ':") && (ch2 == '/")
                                  && (ch3 != '/"));

         if (isDosFilename) {
            if (true)
            	if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found DOS filename: " + str);
         }
      }

      // Windows fix
      if (str.length() >= 2) {
         char ch1 = str.charAt(1);

         if (ch1 == ':") {
            char ch0 = Character.toUpperCase(str.charAt(0));

            if (('A" <= ch0) && (ch0 <= 'Z")) {
               str = "/" + str;
            }
         }
      }

      // done
      return str;
   
public booleanunderstandsProperty(java.lang.String propertyToTest)
Method understandsProperty

param
propertyToTest
return
true if understands the property


      String[] understood = this.engineGetPropertyKeys();

      if (understood != null) {
         for (int i = 0; i < understood.length; i++) {
            if (understood[i].equals(propertyToTest)) {
               return true;
            }
         }
      }

      return false;