FileDocCategorySizeDatePackage
KeyResolver.javaAPI DocJava SE 6 API9349Tue Jun 10 00:23:02 BST 2008com.sun.org.apache.xml.internal.security.keys.keyresolver

KeyResolver

public class KeyResolver extends Object
KeyResolver is factory class for subclass of KeyResolverSpi that represent child element of KeyInfo.
author
$Author: raul $
version
1.3, 11/14/05

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
static boolean
_alreadyInitialized
Field _alreadyInitialized
static List
_resolverVector
Field _resolverVector
protected KeyResolverSpi
_resolverSpi
Field _resolverSpi
protected StorageResolver
_storage
Field _storage
Constructors Summary
private KeyResolver(String className)
Constructor ResourceResolver

param
className
throws
ClassNotFoundException
throws
IllegalAccessException
throws
InstantiationException


                 
     
             
                   
      this._resolverSpi =
         (KeyResolverSpi) Class.forName(className).newInstance();
   
Methods Summary
public booleancanResolve(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method canResolve

param
element
param
BaseURI
param
storage
return
true if can resolve the key in the element

      return this._resolverSpi.engineCanResolve(element, BaseURI, storage);
   
public static final com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolvergetInstance(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method getInstance

param
element
param
BaseURI
param
storage
return
the instance that happends to implement the thing.
throws
KeyResolverException


      for (int i = 0; i < KeyResolver._resolverVector.size(); i++) {
		  KeyResolver resolver=
            (KeyResolver) KeyResolver._resolverVector.get(i);

		  if (resolver==null) {
            Object exArgs[] = {
               (((element != null)
                 && (element.getNodeType() == Node.ELEMENT_NODE))
                ? element.getTagName()
                : "null") };

            throw new KeyResolverException("utils.resolver.noClass", exArgs);
         }
         if (true)
         	if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());

         if (resolver.canResolve(element, BaseURI, storage)) {
            return resolver;
         }
      }

      Object exArgs[] = {
         (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
          ? element.getTagName()
          : "null") };

      throw new KeyResolverException("utils.resolver.noClass", exArgs);
   
public java.lang.StringgetProperty(java.lang.String key)
Method getProperty

param
key
return
the property setted for this resolver

      return this._resolverSpi.engineGetProperty(key);
   
public java.lang.String[]getPropertyKeys()
Method getPropertyKeys

return
the properties key registerd in this resolver

      return this._resolverSpi.engineGetPropertyKeys();
   
public static voidinit()
The init() function is called by com.sun.org.apache.xml.internal.security.Init.init()


      if (!KeyResolver._alreadyInitialized) {
         KeyResolver._resolverVector = new ArrayList(10);
         _alreadyInitialized = true;
      }
   
public static com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolveritem(int i)
Method item

param
i
return
the number i resolver registerd
throws
KeyResolverException


	   KeyResolver resolver = (KeyResolver) KeyResolver._resolverVector.get(i);
      if (resolver==null) {
         throw new KeyResolverException("utils.resolver.noClass");
      }

      return resolver;
   
public static intlength()
Method length

return
the length of resolvers registed

      return KeyResolver._resolverVector.size();
   
public static voidregister(java.lang.String className)
This method is used for registering {@link KeyResolverSpi}s which are available to all {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that personalized {@link KeyResolverSpi}s should only be registered directly to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.

param
className
throws
InstantiationException
throws
IllegalAccessException
throws
ClassNotFoundException

      KeyResolver._resolverVector.add(new KeyResolver(className));
   
public static voidregisterAtStart(java.lang.String className)
This method is used for registering {@link KeyResolverSpi}s which are available to all {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that personalized {@link KeyResolverSpi}s should only be registered directly to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.

param
className

      KeyResolver._resolverVector.add(0, className);
   
public java.security.PublicKeyresolvePublicKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method resolve

param
element
param
BaseURI
param
storage
return
resolved public key from the registered from the elements
throws
KeyResolverException

      return this._resolverSpi.engineResolvePublicKey(element, BaseURI, storage);
   
public javax.crypto.SecretKeyresolveSecretKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)

param
element
param
BaseURI
param
storage
return
resolved SecretKey key from the registered from the elements
throws
KeyResolverException

      return this._resolverSpi.engineResolveSecretKey(element, BaseURI,
              storage);
   
public static java.security.PublicKeyresolveStatic(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method resolveStatic

param
element
param
BaseURI
param
storage
return
resolve from the static register an element
throws
KeyResolverException


      KeyResolver myResolver = KeyResolver.getInstance(element, BaseURI,
                                  storage);

      return myResolver.resolvePublicKey(element, BaseURI, storage);
   
public java.security.cert.X509CertificateresolveX509Certificate(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method resolveX509Certificate

param
element
param
BaseURI
param
storage
return
resolved X509certificate key from the registered from the elements
throws
KeyResolverException

      return this._resolverSpi.engineResolveX509Certificate(element, BaseURI,
              storage);
   
public java.lang.StringresolverClassName()
Method resolverClassName

return
the name of the resolver.

      return this._resolverSpi.getClass().getName();
   
public voidsetProperty(java.lang.String key, java.lang.String value)
Method setProperty

param
key
param
value

      this._resolverSpi.engineSetProperty(key, value);
   
public booleanunderstandsProperty(java.lang.String propertyToTest)
Method understandsProperty

param
propertyToTest
return
true if the resolver understands property propertyToTest

      return this._resolverSpi.understandsProperty(propertyToTest);