You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2006/06/08 00:19:32 UTC

svn commit: r412583 - /xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java

Author: raul
Date: Wed Jun  7 15:19:31 2006
New Revision: 412583

URL: http://svn.apache.org/viewvc?rev=412583&view=rev
Log:
Lazy code initialization.
Proper use of hashtables.

Modified:
    xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java

Modified: xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java?rev=412583&r1=412582&r2=412583&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java Wed Jun  7 15:19:31 2006
@@ -18,6 +18,8 @@
 
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
+import java.util.HashMap;
+
 import javax.crypto.SecretKey;
 
 import org.apache.xml.security.keys.storage.StorageResolver;
@@ -81,7 +83,7 @@
          throws KeyResolverException;
 
    /** Field _properties */
-   protected java.util.Map _properties = new java.util.HashMap(10);
+   protected java.util.Map _properties = null;
 
    /**
     * Method engineSetProperty
@@ -89,20 +91,9 @@
     * @param key
     * @param value
     */
-   public void engineSetProperty(String key, String value) {
-
-      java.util.Iterator i = this._properties.keySet().iterator();
-
-      while (i.hasNext()) {
-         String c = (String) i.next();
-
-         if (c.equals(key)) {
-            key = c;
-
-            break;
-         }
-      }
-
+   public void engineSetProperty(String key, String value) {     
+	   if (_properties==null)
+		   _properties=new HashMap();
       this._properties.put(key, value);
    }
 
@@ -113,49 +104,22 @@
     * @return obtain the property appointed by key
     */
    public String engineGetProperty(String key) {
-
-      java.util.Iterator i = this._properties.keySet().iterator();
-
-      while (i.hasNext()) {
-         String c = (String) i.next();
-
-         if (c.equals(key)) {
-            key = c;
-
-            break;
-         }
-      }
-
+	   if (_properties==null)
+		   return null;
+      
       return (String) this._properties.get(key);
    }
 
    /**
-    * Method engineGetPropertyKeys
-    *
-    * @return the keys of properties known by this resolver
-    */
-   public String[] engineGetPropertyKeys() {
-      return new String[0];
-   }
-
-   /**
     * Method understandsProperty
     *
     * @param propertyToTest
     * @return true if understood the property
     */
    public boolean understandsProperty(String propertyToTest) {
-
-      String[] understood = this.engineGetPropertyKeys();
-
-      if (understood != null) {
-         for (int i = 0; i < understood.length; i++) {
-            if (understood[i].equals(propertyToTest)) {
-               return true;
-            }
-         }
-      }
-
-      return false;
+	   if (_properties==null)
+		   return false;
+      
+      return  this._properties.get(propertyToTest)!=null;
    }
 }