>From c15214a68993859157a378761202451314e5ab3d Mon Sep 17 00:00:00 2001
From: Adam Young <ayoung@redhat.com>
Date: Thu, 17 Nov 2011 11:38:48 -0500
Subject: [PATCH 36/38] type safety for certserv.authenticator

---
 .../certsrv/authentication/AuthCredentials.java    |   10 +++-----
 .../certsrv/authentication/AuthMgrPlugin.java      |    1 -
 .../netscape/certsrv/authentication/AuthToken.java |    8 +++---
 .../certsrv/authentication/IAuthSubsystem.java     |    8 +++---
 .../certsrv/authentication/IAuthToken.java         |    2 +-
 .../cmscore/authentication/AuthSubsystem.java      |   24 ++++++++++----------
 6 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java b/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java
index 222f9a6137fc2dafa7781eea5840b3441d3ad707..de124a38c6f141638522e06e350d29ffc639f4a5 100644
--- a/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java
+++ b/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java
@@ -30,18 +30,16 @@ import com.netscape.certsrv.base.IArgBlock;
  * @version $Revision$, $Date$
  */
 public class AuthCredentials implements IAuthCredentials {
-    /**
-     *
-     */
+
     private static final long serialVersionUID = 5862936214648594328L;
-    private Hashtable authCreds = null;
+    private Hashtable<String, Object> authCreds = null;
     private IArgBlock argblk = null;
     
     /**
      * Constructor
      */
     public AuthCredentials() {
-        authCreds = new Hashtable();
+        authCreds = new Hashtable<String, Object>();
     }
 
     /**
@@ -80,7 +78,7 @@ public class AuthCredentials implements IAuthCredentials {
      * fetch the elements sequentially.
      * @return an enumeration of the values in this credential set
      */
-    public Enumeration getElements() {
+    public Enumeration<Object> getElements() {
         return (authCreds.elements());
     }
     
diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/AuthMgrPlugin.java b/pki/base/common/src/com/netscape/certsrv/authentication/AuthMgrPlugin.java
index f060db5f25fde398fa76d12b1f2a177ed2c32066..bdb2fe0021473c25ac329ab44f55bbd19a48281e 100644
--- a/pki/base/common/src/com/netscape/certsrv/authentication/AuthMgrPlugin.java
+++ b/pki/base/common/src/com/netscape/certsrv/authentication/AuthMgrPlugin.java
@@ -29,7 +29,6 @@ package com.netscape.certsrv.authentication;
 public class AuthMgrPlugin {
     protected String mId = null;
     protected String mClassPath = null;
-    protected Class mClass = null;
     protected boolean mVisible = true;
 
     /**
diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/AuthToken.java b/pki/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
index 7d2d5eb9da4d7239cb9524a5452680943812d7a2..eae282c0291fe0dd64fa9b29a887f5f8f112e597 100644
--- a/pki/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
+++ b/pki/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
@@ -48,7 +48,7 @@ import com.netscape.certsrv.usrgrp.Certificates;
  * @version $Revision$, $Date$
  */
 public class AuthToken implements IAuthToken {
-    protected Hashtable mAttrs = null;
+    protected Hashtable<String, Object> mAttrs = null;
 
     /* Subject name of the certificate in the authenticating entry */
     public static final String TOKEN_CERT_SUBJECT = "tokenCertSubject";
@@ -101,7 +101,7 @@ public class AuthToken implements IAuthToken {
      * @param authMgr The authentication manager that created this Token.
      */
     public AuthToken(IAuthManager authMgr) {
-        mAttrs = new Hashtable();
+        mAttrs = new Hashtable<String, Object>();
         if (authMgr != null) {
           set(TOKEN_AUTHMGR_INST_NAME, authMgr.getName());
           set(TOKEN_AUTHMGR_IMPL_NAME, authMgr.getImplName());
@@ -133,7 +133,7 @@ public class AuthToken implements IAuthToken {
      * Enumerate all attribute names in the AuthToken.
      * @return Enumeration of all attribute names in this AuthToken.
      */
-    public Enumeration getElements() {
+    public Enumeration<String> getElements() {
         return (mAttrs.keys());
     }
 
@@ -408,7 +408,7 @@ public class AuthToken implements IAuthToken {
      * Enumerate all attribute values in the AuthToken.
      * @return Enumeration of all attribute names in this AuthToken.
      */
-    public Enumeration getVals() {
+    public Enumeration<Object> getVals() {
         return (mAttrs.elements());
     }
 
diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/IAuthSubsystem.java b/pki/base/common/src/com/netscape/certsrv/authentication/IAuthSubsystem.java
index 29657e7a4494890290fce89f031829bd5ab4a12e..2de8ed266e9b3a495c314d41b17d8a7e47c2fb39 100644
--- a/pki/base/common/src/com/netscape/certsrv/authentication/IAuthSubsystem.java
+++ b/pki/base/common/src/com/netscape/certsrv/authentication/IAuthSubsystem.java
@@ -164,13 +164,13 @@ public interface IAuthSubsystem extends ISubsystem {
      * authentication subsystem.
      * @return a list of authentication managers
      */
-    public Enumeration getAuthManagers();
+    public Enumeration<IAuthManager> getAuthManagers();
 
     /**
      * Gets an enumeration of authentication manager plugins.
      * @return a list of authentication plugins
      */
-    public Enumeration getAuthManagerPlugins();
+    public Enumeration<AuthMgrPlugin> getAuthManagerPlugins();
 
     /**
      * Gets a single authentication manager plugin implementation
@@ -201,13 +201,13 @@ public interface IAuthSubsystem extends ISubsystem {
      * Get a hashtable containing all authentication plugins.
      * @return all authentication plugins.
      */
-    public Hashtable getPlugins();
+    public Hashtable<String, AuthMgrPlugin> getPlugins();
 
     /**
      * Get a hashtable containing all authentication instances.
      * @return all authentication instances.
      */
-    public Hashtable getInstances();
+    public Hashtable<?, ?> getInstances();
 
     /**
      * Get an authentication manager interface for the given name.
diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java b/pki/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
index a8462108ee77364250958643c5b26a7f180109a4..942793633d8fc42e7ef38d31652f7a201e55f52d 100644
--- a/pki/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
+++ b/pki/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
@@ -61,7 +61,7 @@ public interface IAuthToken {
      *
      * @return an enumeration of the attribute names.
      */
-    public Enumeration getElements();
+    public Enumeration<String> getElements();
 
     /************
      * Helpers for non-string sets and gets.
diff --git a/pki/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java b/pki/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
index d3793e344452bfd5e582dc30d347b3b4b613e7a6..252d69d6a0c11e8e5c5ee61be4eddd7f13c15f6c 100644
--- a/pki/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
+++ b/pki/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
@@ -52,8 +52,8 @@ import com.netscape.cmscore.util.Debug;
 public class AuthSubsystem implements IAuthSubsystem {
     public static final String ID = "auths";
 
-    public Hashtable mAuthMgrPlugins = new Hashtable();
-    public Hashtable mAuthMgrInsts = new Hashtable();
+    public Hashtable<String, AuthMgrPlugin> mAuthMgrPlugins = new Hashtable<String, AuthMgrPlugin>();
+    public Hashtable<String, AuthManagerProxy> mAuthMgrInsts = new Hashtable<String, AuthManagerProxy>();
     private String mId = "auths";
     private IConfigStore mConfig = null;
 
@@ -123,7 +123,7 @@ public class AuthSubsystem implements IAuthSubsystem {
             // get auth manager plugins.
 
             IConfigStore c = config.getSubStore(PROP_IMPL);
-            Enumeration mImpls = c.getSubStoreNames();
+            Enumeration<String> mImpls = c.getSubStoreNames();
 
             while (mImpls.hasMoreElements()) {
                 String id = (String) mImpls.nextElement();
@@ -192,7 +192,7 @@ public class AuthSubsystem implements IAuthSubsystem {
 
             // get auth manager instances.
             c = config.getSubStore(PROP_INSTANCE);
-            Enumeration instances = c.getSubStoreNames();
+            Enumeration<String> instances = c.getSubStoreNames();
 
             while (instances.hasMoreElements()) {
                 String insName = (String) instances.nextElement();
@@ -380,12 +380,12 @@ public class AuthSubsystem implements IAuthSubsystem {
     /**
      * Enumerate all authentication manager instances.
      */
-    public Enumeration getAuthManagers() {
-        Vector inst = new Vector();
-        Enumeration e = mAuthMgrInsts.keys();
+    public Enumeration<IAuthManager> getAuthManagers() {
+        Vector<IAuthManager> inst = new Vector<IAuthManager>();
+        Enumeration<String> e = mAuthMgrInsts.keys();
 
         while (e.hasMoreElements()) {
-            IAuthManager p = get((String) e.nextElement());
+            IAuthManager p = get( e.nextElement());
 
             if (p != null) {
                 inst.addElement(p);
@@ -397,7 +397,7 @@ public class AuthSubsystem implements IAuthSubsystem {
     /**
      * Enumerate all registered authentication manager plugins.
      */
-    public Enumeration getAuthManagerPlugins() {
+    public Enumeration<AuthMgrPlugin> getAuthManagerPlugins() {
         return (mAuthMgrPlugins.elements());
     }
 
@@ -459,7 +459,7 @@ public class AuthSubsystem implements IAuthSubsystem {
      * <P>
      */
     public void shutdown() {
-        for (Enumeration e = mAuthMgrInsts.keys();
+        for (Enumeration<String> e = mAuthMgrInsts.keys();
             e.hasMoreElements();) {
 
             IAuthManager mgr = (IAuthManager) get((String) e.nextElement());
@@ -475,11 +475,11 @@ public class AuthSubsystem implements IAuthSubsystem {
         mAuthMgrInsts = null;
     }
 
-    public Hashtable getPlugins() {
+    public Hashtable<String, AuthMgrPlugin> getPlugins() {
         return mAuthMgrPlugins;
     }
 
-    public Hashtable getInstances() {
+    public Hashtable<String, AuthManagerProxy> getInstances() {
         return mAuthMgrInsts;
     }
 
-- 
1.7.7.3

