/[classpath]/classpath/java/security/Provider.java
ViewVC logotype

Diff of /classpath/java/security/Provider.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mkoch, Wed Oct 2 12:58:40 2002 UTC revision 1.8 by mark, Sat Nov 16 23:28:25 2002 UTC
# Line 1  Line 1 
1  /* Provider.java -- Security provider information  /* Provider.java -- Security provider information
2     Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 119  public abstract class Provider extends P Line 119  public abstract class Provider extends P
119    }    }
120    
121    /**    /**
122     * This method sets the specified key to have the specified value.     * Sets the key property to have the specified value.
123     *     * <p>
124     * @param key The property key     * <bold>NOT IMPLEMENTED YET</bold>[
125     * @param value The property value     * First, if there is a security manager, its <code>checkSecurityAccess</code>
126     *     * method is called with the string "putProviderProperty."+name, where name is
127     * @return The previous value for this key, or <code>null</code> if no previous value.     * the provider name, to see if it's ok to set this provider's property
128       * values.
129       * If the default implementation of <code>checkSecurityAccess</code> is used
130       * (that is, that method is not overriden), then this results in a call to the
131       * security manager's <code>checkPermission</code> method with a
132       * <code>SecurityPermission("putProviderProperty."+name)</code>
133       * permission.<br>]
134       *
135       * @param key The property key.
136       * @param value The property value.
137       *
138       * @return The previous value of the specified property (<code>key</code>),
139       *         or <code>null</code> if it did not have one.
140       * @throws SecurityException If a security manager exists and its
141       * {@link java.lang.SecurityManager.checkSecurityAccess(java.lang.String)}
142       * method denies access to set property values.
143       * @since Classpath 0.4+cvs, JDK 1.2
144       * @see java.lang.Object.equals(Object)
145       * @see java.util.Hashtable.get(Object)
146     */     */
147    public Object put(Object key, Object value)    public Object put(Object key, Object value)
148    {    {
149      return (super.put(key, value));      return super.put(toCanonicalKey(key), value);
150      }
151      
152      // overrides same in java.util.Hashtable
153      public Object get(Object key)
154      {
155        return super.get(toCanonicalKey(key));
156    }    }
157    
158    /**    /**
# Line 137  public abstract class Provider extends P Line 161  public abstract class Provider extends P
161     *     *
162     * @param key The key to remove     * @param key The key to remove
163     *     *
164     * @return The previous value for this key, or <code>null</code> if no previous value.     * @return The previous value for this key, or <code>null</code> if no
165       * previous value.
166     */     */
167    public Object remove(Object key)    public Object remove(Object key)
168    {    {
169      return (super.remove(key));      return super.remove(toCanonicalKey(key));
170    }    }
171    
172    /**    /**
# Line 166  public abstract class Provider extends P Line 191  public abstract class Provider extends P
191      return (getClass().getName() + ": name=" + getName() + " version=" +      return (getClass().getName() + ": name=" + getName() + " version=" +
192              version);              version);
193    }    }
194      
195      private Object toCanonicalKey(Object key)
196      {
197        if (key.getClass().isAssignableFrom(String.class)) // is it ours?
198          return ((String) key).toUpperCase(); // use default locale
199        else
200          return key;
201      }
202  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26