diff options
Diffstat (limited to 'pki/base/common')
40 files changed, 269 insertions, 248 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/notification/IEmailFormProcessor.java b/pki/base/common/src/com/netscape/certsrv/notification/IEmailFormProcessor.java index 9d7ee46f0..ace09a8cf 100644 --- a/pki/base/common/src/com/netscape/certsrv/notification/IEmailFormProcessor.java +++ b/pki/base/common/src/com/netscape/certsrv/notification/IEmailFormProcessor.java @@ -67,12 +67,12 @@ public interface IEmailFormProcessor { * @return mail content */ public String getEmailContent(String form, - Hashtable tok2vals); + Hashtable<String, Object> tok2vals); /** * takes a vector of strings and concatenate them */ - public String formContent(Vector vec); + public String formContent(Vector<String> vec); /** * logs an entry in the log file. diff --git a/pki/base/common/src/com/netscape/certsrv/notification/IMailNotification.java b/pki/base/common/src/com/netscape/certsrv/notification/IMailNotification.java index c5375caed..b537fbbd2 100644 --- a/pki/base/common/src/com/netscape/certsrv/notification/IMailNotification.java +++ b/pki/base/common/src/com/netscape/certsrv/notification/IMailNotification.java @@ -65,7 +65,7 @@ public interface IMailNotification { * sets the recipients' email addresses * @param addresses a list of email addresses of the recipients */ - public void setTo(Vector addresses); + public void setTo(Vector<String> addresses); /** * sets the recipient's email address diff --git a/pki/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java b/pki/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java index 2a9a87e39..22cfc232c 100644 --- a/pki/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java +++ b/pki/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java @@ -28,7 +28,7 @@ import com.netscape.certsrv.base.IAttrSet; * * @version $Revision$, $Date$ */ -public class AttrSetCollection extends Hashtable { +public class AttrSetCollection extends Hashtable<String, IAttrSet> { /** * diff --git a/pki/base/common/src/com/netscape/certsrv/pattern/Pattern.java b/pki/base/common/src/com/netscape/certsrv/pattern/Pattern.java index d177f87b1..36cc7cb3b 100644 --- a/pki/base/common/src/com/netscape/certsrv/pattern/Pattern.java +++ b/pki/base/common/src/com/netscape/certsrv/pattern/Pattern.java @@ -70,7 +70,7 @@ public class Pattern { */ public String substitute(AttrSetCollection attrSetCollection) { String temp = mS; - Enumeration keys = attrSetCollection.keys(); + Enumeration<String> keys = attrSetCollection.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java index 0d44be081..953bb41ea 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java @@ -56,7 +56,7 @@ public interface IGeneralNameConfig { * @return a vector of general names * @exception EBaseException failed to form general name */ - public Vector formGeneralNames(Object value) + public Vector<GeneralName> formGeneralNames(Object value) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IPolicyProcessor.java b/pki/base/common/src/com/netscape/certsrv/policy/IPolicyProcessor.java index 834d462e0..09f2415a1 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IPolicyProcessor.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IPolicyProcessor.java @@ -73,7 +73,7 @@ public interface IPolicyProcessor extends ISubsystem, * about policy implementations. Currently only the * the implementation id is expected. */ - Enumeration getPolicyImplsInfo(); + Enumeration<String> getPolicyImplsInfo(); /** * Returns the rule implementations registered with this processor. @@ -81,7 +81,7 @@ public interface IPolicyProcessor extends ISubsystem, * @return An Enumeration of uninitialized IPolicyRule * objects. */ - Enumeration getPolicyImpls(); + Enumeration<IPolicyRule> getPolicyImpls(); /** * Returns an implementation identified by a given id. @@ -98,7 +98,7 @@ public interface IPolicyProcessor extends ISubsystem, * @return A vector of name/value pairs in the form of * name=value. */ - Vector getPolicyImplConfig(String id); + Vector<String> getPolicyImplConfig(String id); /** * Deletes a policy implementation identified by an impl id. @@ -129,14 +129,14 @@ public interface IPolicyProcessor extends ISubsystem, * @return An Enumeration of Strings describing the information * about policy rule instances. */ - Enumeration getPolicyInstancesInfo(); + Enumeration<String> getPolicyInstancesInfo(); /** * Returns policy instances registered with this processor. * * @return An Enumeration of policy instances. */ - Enumeration getPolicyInstances(); + Enumeration<IPolicyRule> getPolicyInstances(); /** * Returns instance configuration for a given instance id. @@ -145,7 +145,7 @@ public interface IPolicyProcessor extends ISubsystem, * @return A vector of name/value pairs in the form of * name=value. */ - Vector getPolicyInstanceConfig(String id); + Vector<String> getPolicyInstanceConfig(String id); /** * Returns instance configuration for a given instance id. @@ -172,7 +172,7 @@ public interface IPolicyProcessor extends ISubsystem, * @param ht a Hashtable of config params. * @exception EBaseException is thrown if an error occurs in addition. */ - void addPolicyInstance(String id, Hashtable ht) + void addPolicyInstance(String id, Hashtable<String, String> ht) throws EBaseException; /** @@ -183,7 +183,7 @@ public interface IPolicyProcessor extends ISubsystem, * @param ht a Hashtable of config params. * @exception EBaseException is thrown if an error occurs in addition. */ - void modifyPolicyInstance(String id, Hashtable ht) + void modifyPolicyInstance(String id, Hashtable<String, String> ht) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IPolicyRule.java b/pki/base/common/src/com/netscape/certsrv/policy/IPolicyRule.java index d80a0d0c2..0babd48aa 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IPolicyRule.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IPolicyRule.java @@ -110,7 +110,7 @@ public interface IPolicyRule * @return nvPairs A Vector of name/value pairs. Each name/value * pair is constructed as a String in name=value format. */ - public Vector getInstanceParams(); + public Vector<String> getInstanceParams(); /** * Return default parameters for a policy implementation. @@ -118,7 +118,7 @@ public interface IPolicyRule * @return nvPairs A Vector of name/value pairs. Each name/value * pair is constructed as a String in name=value. */ - public Vector getDefaultParams(); + public Vector<String> getDefaultParams(); public void setError(IRequest req, String format, Object[] params); diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IPolicySet.java b/pki/base/common/src/com/netscape/certsrv/policy/IPolicySet.java index ea12f4b1b..dd5a36bca 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IPolicySet.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IPolicySet.java @@ -90,7 +90,7 @@ public interface IPolicySet { * * @return An enumeration of rules. */ - Enumeration getRules(); + Enumeration<IPolicyRule> getRules(); /** * Apply policy rules on a request. This call may modify diff --git a/pki/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java b/pki/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java index fae38c696..75f134c2a 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java @@ -28,7 +28,7 @@ import com.netscape.certsrv.base.IConfigStore; public class CertInfoProfile { - private Vector mDefaults = new Vector(); + private Vector<ICertInfoPolicyDefault> mDefaults = new Vector<ICertInfoPolicyDefault>(); private String mName = null; private String mID = null; private String mDescription = null; @@ -96,7 +96,7 @@ public class CertInfoProfile public void populate(X509CertInfo info) { - Enumeration e1 = mDefaults.elements(); + Enumeration<ICertInfoPolicyDefault> e1 = mDefaults.elements(); while (e1.hasMoreElements()) { ICertInfoPolicyDefault def = (ICertInfoPolicyDefault)e1.nextElement(); diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java b/pki/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java index 018054926..092b10fdc 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java @@ -109,7 +109,7 @@ public interface IPolicyDefault extends IConfigTemplate { * @return a list of property names. The values are * of type java.lang.String */ - public Enumeration getValueNames(); + public Enumeration<String> getValueNames(); /** * Retrieves the descriptor of the given property diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java index c006db679..cc6975cdf 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java @@ -26,6 +26,7 @@ import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; +import com.netscape.cms.profile.common.ProfilePolicy; /** * This interface represents a profile. A profile contains @@ -137,7 +138,7 @@ public interface IProfile { * * @return input policy id list */ - public Enumeration getProfileInputIds(); + public Enumeration<String> getProfileInputIds(); /** * Retrieves input policy by id. @@ -152,7 +153,7 @@ public interface IProfile { * * @return output policy id list */ - public Enumeration getProfileOutputIds(); + public Enumeration<String> getProfileOutputIds(); /** * Retrieves output policy by id. @@ -243,7 +244,7 @@ public interface IProfile { * * @return a list of policy set id */ - public Enumeration getProfilePolicySetIds(); + public Enumeration<String> getProfilePolicySetIds(); /** * Creates a profile policy. @@ -325,7 +326,7 @@ public interface IProfile { * @param setId set id * @return a list of policy id */ - public Enumeration getProfilePolicyIds(String setId); + public Enumeration<String> getProfilePolicyIds(String setId); /** * Retrieves a default set id for the given request. @@ -343,7 +344,7 @@ public interface IProfile { * @param setId set id * @return a list of policies */ - public Enumeration getProfilePolicies(String setId); + public Enumeration<ProfilePolicy> getProfilePolicies(String setId); /** * Creates one or more requests. Normally, only one request will diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java index 195078f7b..476002e2d 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java @@ -89,7 +89,7 @@ public interface IProfileAuthenticator extends IAuthManager { * * @return a list of property names */ - public Enumeration getValueNames(); + public Enumeration<String> getValueNames(); /** * Checks if the value of the given property should be diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfileInput.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfileInput.java index 6d861579c..35453e7d5 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfileInput.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfileInput.java @@ -83,7 +83,7 @@ public interface IProfileInput extends IConfigTemplate { * * @return a list of property names */ - public Enumeration getValueNames(); + public Enumeration<String> getValueNames(); /** * Retrieves the descriptor of the given value diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java index b4654f408..6dbfea51c 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java @@ -83,7 +83,7 @@ public interface IProfileOutput extends IConfigTemplate { * * @return a list of property names */ - public Enumeration getValueNames(); + public Enumeration<String> getValueNames(); /** * Retrieves the descriptor of the given value diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java index 795a19c0e..6f2fef378 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java @@ -124,7 +124,7 @@ public interface IProfileSubsystem extends ISubsystem { * * @return a list of profile ids */ - public Enumeration getProfileIds(); + public Enumeration<String> getProfileIds(); /** * Checks if owner id should be enforced during profile approval. diff --git a/pki/base/common/src/com/netscape/certsrv/property/IConfigTemplate.java b/pki/base/common/src/com/netscape/certsrv/property/IConfigTemplate.java index f435db50c..e40c98fa9 100644 --- a/pki/base/common/src/com/netscape/certsrv/property/IConfigTemplate.java +++ b/pki/base/common/src/com/netscape/certsrv/property/IConfigTemplate.java @@ -41,7 +41,7 @@ public interface IConfigTemplate { * * @return parameter names */ - public Enumeration getConfigNames(); + public Enumeration<String> getConfigNames(); /** * Returns the descriptors of configuration parameter. diff --git a/pki/base/common/src/com/netscape/certsrv/property/PropertySet.java b/pki/base/common/src/com/netscape/certsrv/property/PropertySet.java index 360477fe9..f308a3e7e 100644 --- a/pki/base/common/src/com/netscape/certsrv/property/PropertySet.java +++ b/pki/base/common/src/com/netscape/certsrv/property/PropertySet.java @@ -26,7 +26,7 @@ import java.util.Hashtable; */ public class PropertySet { - private Hashtable mProperties = new Hashtable(); + private Hashtable<String, IDescriptor> mProperties = new Hashtable<String, IDescriptor>(); public PropertySet() { @@ -37,7 +37,7 @@ public class PropertySet { mProperties.put(name, desc); } - public Enumeration getNames() + public Enumeration<String> getNames() { return mProperties.keys(); } diff --git a/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java b/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java index 62fe529f0..3ab3a0848 100644 --- a/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java +++ b/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java @@ -168,5 +168,5 @@ public interface IRegistrationAuthority extends ISubsystem { * * @return name enumeration of all request listeners */ - public Enumeration getRequestListenerNames(); + public Enumeration<String> getRequestListenerNames(); } diff --git a/pki/base/common/src/com/netscape/certsrv/registry/IPluginRegistry.java b/pki/base/common/src/com/netscape/certsrv/registry/IPluginRegistry.java index 0497562be..7631f3eaf 100644 --- a/pki/base/common/src/com/netscape/certsrv/registry/IPluginRegistry.java +++ b/pki/base/common/src/com/netscape/certsrv/registry/IPluginRegistry.java @@ -49,7 +49,7 @@ public interface IPluginRegistry extends ISubsystem { * * @return a list of String-based names */ - public Enumeration getTypeNames(); + public Enumeration<String> getTypeNames(); /** * Returns a list of plugin identifiers of the given type. @@ -57,7 +57,7 @@ public interface IPluginRegistry extends ISubsystem { * @param type plugin type * @return a list of plugin IDs */ - public Enumeration getIds(String type); + public Enumeration<String> getIds(String type); /** * Retrieves the plugin information. diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java index c509e2966..477a14c65 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java @@ -643,7 +643,7 @@ public interface IRequest { * @param key The extdata key * @return A Vector of strings, or null on error. */ - public Vector getExtDataInStringVector(String key); + public Vector<String> getExtDataInStringVector(String key); /** * Gets boolean value for given type or default value diff --git a/pki/base/common/src/com/netscape/certsrv/usrgrp/IUGSubsystem.java b/pki/base/common/src/com/netscape/certsrv/usrgrp/IUGSubsystem.java index e575c58bd..ff6f7be6f 100644 --- a/pki/base/common/src/com/netscape/certsrv/usrgrp/IUGSubsystem.java +++ b/pki/base/common/src/com/netscape/certsrv/usrgrp/IUGSubsystem.java @@ -58,7 +58,7 @@ public interface IUGSubsystem extends ISubsystem, IUsrGrp { * @return list of users * @exception EUsrGrpException thrown when any internal error occurs */ - public Enumeration listUsers(String filter) throws EUsrGrpException; + public Enumeration<IUser> listUsers(String filter) throws EUsrGrpException; /** * Adds the given user to the internal database @@ -107,7 +107,7 @@ public interface IUGSubsystem extends ISubsystem, IUsrGrp { * @param filter the search filter * @return a list of groups that match the given search filter */ - public Enumeration findGroups(String filter); + public Enumeration<IGroup> findGroups(String filter); /** * Find a group for the given name @@ -125,7 +125,7 @@ public interface IUGSubsystem extends ISubsystem, IUsrGrp { * its description. * @exception EUsrGrpException thrown when failed to list groups */ - public Enumeration listGroups(String filter) throws EUsrGrpException; + public Enumeration<IGroup> listGroups(String filter) throws EUsrGrpException; /** * Retrieves a group from LDAP for the given group name diff --git a/pki/base/common/src/com/netscape/cms/authentication/UidPwdPinDirAuthentication.java b/pki/base/common/src/com/netscape/cms/authentication/UidPwdPinDirAuthentication.java index 116054181..ce60bf8de 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/UidPwdPinDirAuthentication.java +++ b/pki/base/common/src/com/netscape/cms/authentication/UidPwdPinDirAuthentication.java @@ -415,8 +415,8 @@ public class UidPwdPinDirAuthentication extends DirBasedAuthentication /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { - Vector v = new Vector(); + public Enumeration<String> getValueNames() { + Vector<String> v = new Vector<String>(); v.addElement(CRED_UID); v.addElement(CRED_PWD); diff --git a/pki/base/common/src/com/netscape/cms/notification/MailNotification.java b/pki/base/common/src/com/netscape/cms/notification/MailNotification.java index 1e409af87..af6515843 100644 --- a/pki/base/common/src/com/netscape/cms/notification/MailNotification.java +++ b/pki/base/common/src/com/netscape/cms/notification/MailNotification.java @@ -170,7 +170,7 @@ public class MailNotification implements IMailNotification { * sets the recipients' email addresses * @param addresses a list of email addresses of the recipients */ - public void setTo(Vector addresses) { + public void setTo(Vector<String> addresses) { // concatenate addresses into comma separated mTo String } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java index b5afc1c79..71cccdff5 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java @@ -80,13 +80,13 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe public static final String GN_OID_NAME = "OIDName"; protected IConfigStore mConfig = null; - protected Vector mConfigNames = new Vector(); - protected Vector mValueNames = new Vector(); + protected Vector<String> mConfigNames = new Vector<String>(); + protected Vector<String> mValueNames = new Vector<String>(); public EnrollDefault() { } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mConfigNames.elements(); } @@ -212,7 +212,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe mValueNames.addElement(name); } - public Enumeration getValueNames() { + public Enumeration<String> getValueNames() { return mValueNames.elements(); } @@ -291,7 +291,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe info.get(X509CertInfo.EXTENSIONS); if (exts == null) return; - Enumeration e = exts.getNames(); + Enumeration<?> e = exts.getNames(); while (e.hasMoreElements()) { String n = (String) e.nextElement(); @@ -323,7 +323,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe protected Extension getExtension(String name, CertificateExtensions exts) { if (exts == null) return null; - Enumeration e = exts.getElements(); + Enumeration<?> e = exts.getElements(); while (e.hasMoreElements()) { Extension ext = (Extension) e.nextElement(); @@ -515,7 +515,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe String realm = nameValue.substring(pos0 + 1, pos1).trim(); String name_type = nameValue.substring(pos1 + 1, pos2).trim(); String name_strings = nameValue.substring(pos2 + 1).trim(); - Vector strings = new Vector(); + Vector<String> strings = new Vector<String>(); StringTokenizer st = new StringTokenizer(name_strings, ","); while (st.hasMoreTokens()) { strings.addElement(st.nextToken()); @@ -637,7 +637,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe return true; } - protected String buildRecords(Vector recs) throws EPropertyException { + protected String buildRecords(Vector<?> recs) throws EPropertyException { StringBuffer sb = new StringBuffer(); for (int i = 0; i < recs.size(); i++) { @@ -646,7 +646,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe sb.append("Record #"); sb.append(i); sb.append("\r\n"); - Enumeration e = pairs.getNames(); + Enumeration<?> e = pairs.getNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); @@ -663,10 +663,10 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe return sb.toString(); } - protected Vector parseRecords(String value) throws EPropertyException { + protected Vector<NameValuePairs> parseRecords(String value) throws EPropertyException { StringTokenizer st = new StringTokenizer(value, "\r\n"); int num = 0; - Vector v = new Vector(); + Vector<NameValuePairs> v = new Vector<NameValuePairs>(); NameValuePairs nvps = null; while (st.hasMoreTokens()) { diff --git a/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java index f6ddd9153..065b30444 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java @@ -163,7 +163,7 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java index 8691b45c7..4a8f60505 100644 --- a/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java +++ b/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java @@ -81,8 +81,8 @@ public class SubjectDNInput extends EnrollInput implements IProfileInput { /** * Returns selected value names based on the configuration. */ - public Enumeration getValueNames() { - Vector v = new Vector(); + public Enumeration<String> getValueNames() { + Vector<String> v = new Vector<String>(); v.addElement(VAL_SUBJECT); return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/output/EnrollOutput.java b/pki/base/common/src/com/netscape/cms/profile/output/EnrollOutput.java index 3013e8810..5e3f077b2 100644 --- a/pki/base/common/src/com/netscape/cms/profile/output/EnrollOutput.java +++ b/pki/base/common/src/com/netscape/cms/profile/output/EnrollOutput.java @@ -39,8 +39,8 @@ import com.netscape.certsrv.request.IRequest; */ public abstract class EnrollOutput implements IProfileOutput { private IConfigStore mConfig = null; - private Vector mValueNames = new Vector(); - protected Vector mConfigNames = new Vector(); + private Vector<String> mValueNames = new Vector<String>(); + protected Vector<String> mConfigNames = new Vector<String>(); /** * Initializes this default policy. @@ -98,7 +98,7 @@ public abstract class EnrollOutput implements IProfileOutput { /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { + public Enumeration<String> getValueNames() { return mValueNames.elements(); } @@ -115,7 +115,7 @@ public abstract class EnrollOutput implements IProfileOutput { request.setExtData(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mConfigNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java index 6f64d81a0..9c83a30c8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java @@ -51,6 +51,7 @@ import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.property.IDescriptor; import com.netscape.certsrv.registry.IPluginInfo; import com.netscape.certsrv.registry.IPluginRegistry; +import com.netscape.cms.profile.common.ProfilePolicy; /** @@ -383,7 +384,7 @@ public class ProfileAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException { - Enumeration impls = mRegistry.getIds("profile"); + Enumeration<String> impls = mRegistry.getIds("profile"); NameValuePairs nvp = new NameValuePairs(); while (impls.hasMoreElements()) { @@ -592,11 +593,12 @@ public class ProfileAdminServlet extends AdminServlet { } IProfileInput input = null; - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); NameValuePairs nvps = new NameValuePairs(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); if (name.equals("OP_SCOPE")) continue; @@ -718,11 +720,12 @@ public class ProfileAdminServlet extends AdminServlet { } IProfileOutput output = null; - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); NameValuePairs nvps = new NameValuePairs(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); if (name.equals("OP_SCOPE")) continue; @@ -819,10 +822,11 @@ public class ProfileAdminServlet extends AdminServlet { try { String profileId = ""; String policyId = ""; - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); if (name.equals("OP_SCOPE")) continue; @@ -939,10 +943,11 @@ public class ProfileAdminServlet extends AdminServlet { try { String profileId = ""; String inputId = ""; - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); if (name.equals("OP_SCOPE")) continue; @@ -1056,7 +1061,8 @@ public class ProfileAdminServlet extends AdminServlet { try { String profileId = ""; String outputId = ""; - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -1205,7 +1211,8 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyDefault def = policy.getDefault(); IConfigStore defConfig = def.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -1341,10 +1348,11 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyConstraint con = policy.getConstraint(); IConfigStore conConfig = con.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); if (name.equals("OP_SCOPE")) continue; @@ -1478,7 +1486,8 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyDefault def = policy.getDefault(); IConfigStore defConfig = def.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -1606,7 +1615,8 @@ public class ProfileAdminServlet extends AdminServlet { IProfileInput input = profile.getProfileInput(inputId); IConfigStore inputConfig = input.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -1725,7 +1735,8 @@ public class ProfileAdminServlet extends AdminServlet { IProfileOutput output = profile.getProfileOutput(outputId); IConfigStore outputConfig = output.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -1849,7 +1860,8 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyConstraint con = policy.getConstraint(); IConfigStore conConfig = con.getConfigStore(); - Enumeration names = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); CMS.debug("ProfileAdminServlet: modifyPolicyConstraintConfig policy " + policy + " con " + con); while (names.hasMoreElements()) { @@ -1959,10 +1971,10 @@ public class ProfileAdminServlet extends AdminServlet { rule = policy.getDefault(); NameValuePairs nvp = new NameValuePairs(); - Enumeration names = rule.getConfigNames(); + Enumeration<String> names = rule.getConfigNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { @@ -2007,10 +2019,10 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyConstraint rule = policy.getConstraint(); NameValuePairs nvp = new NameValuePairs(); - Enumeration names = rule.getConfigNames(); + Enumeration<String> names = rule.getConfigNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { @@ -2040,7 +2052,7 @@ public class ProfileAdminServlet extends AdminServlet { } NameValuePairs nvp = new NameValuePairs(); - Enumeration setIds = profile.getProfilePolicySetIds(); + Enumeration<String> setIds = profile.getProfilePolicySetIds(); if (!setIds.hasMoreElements()) { // no set id; this is a brand new profile @@ -2049,7 +2061,7 @@ public class ProfileAdminServlet extends AdminServlet { } while (setIds.hasMoreElements()) { String setId = (String) setIds.nextElement(); - Enumeration policies = profile.getProfilePolicies(setId); + Enumeration<ProfilePolicy> policies = profile.getProfilePolicies(setId); while (policies.hasMoreElements()) { IProfilePolicy policy = (IProfilePolicy) policies.nextElement(); @@ -2082,7 +2094,7 @@ public class ProfileAdminServlet extends AdminServlet { } NameValuePairs nvp = new NameValuePairs(); - Enumeration outputs = profile.getProfileOutputIds(); + Enumeration<String> outputs = profile.getProfileOutputIds(); while (outputs.hasMoreElements()) { String outputId = (String) outputs.nextElement(); @@ -2109,7 +2121,7 @@ public class ProfileAdminServlet extends AdminServlet { } NameValuePairs nvp = new NameValuePairs(); - Enumeration inputs = profile.getProfileInputIds(); + Enumeration<String> inputs = profile.getProfileInputIds(); while (inputs.hasMoreElements()) { String inputId = (String) inputs.nextElement(); @@ -2143,10 +2155,10 @@ public class ProfileAdminServlet extends AdminServlet { NameValuePairs nvp = new NameValuePairs(); profileInput = profile.getProfileInput(inputId); - Enumeration names = profileInput.getConfigNames(); + Enumeration<String> names = profileInput.getConfigNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); IDescriptor desc = profileInput.getConfigDescriptor( getLocale(req), name); if (desc == null) { @@ -2184,10 +2196,10 @@ public class ProfileAdminServlet extends AdminServlet { NameValuePairs nvp = new NameValuePairs(); profileOutput = profile.getProfileOutput(outputId); - Enumeration names = profileOutput.getConfigNames(); + Enumeration<String> names = profileOutput.getConfigNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); IDescriptor desc = profileOutput.getConfigDescriptor( getLocale(req), name); if (desc == null) { @@ -2208,10 +2220,10 @@ public class ProfileAdminServlet extends AdminServlet { throws ServletException, IOException { NameValuePairs nvp = new NameValuePairs(); - Enumeration e = mProfileSub.getProfileIds(); + Enumeration<String> e = mProfileSub.getProfileIds(); while (e.hasMoreElements()) { - String profileId = (String) e.nextElement(); + String profileId = e.nextElement(); IProfile profile = null; try { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java index be9eb456e..7605eb2e4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java @@ -245,11 +245,11 @@ public class RegistryAdminServlet extends AdminServlet { throws ServletException, IOException { String scope = req.getParameter(Constants.OP_SCOPE); - Enumeration impls = mRegistry.getIds(scope); + Enumeration<String> impls = mRegistry.getIds(scope); NameValuePairs nvp = new NameValuePairs(); while (impls.hasMoreElements()) { - String id = (String) impls.nextElement(); + String id = impls.nextElement(); IPluginInfo info = mRegistry.getPluginInfo(scope, id); nvp.add(id, info.getClassName() + "," + @@ -276,7 +276,7 @@ public class RegistryAdminServlet extends AdminServlet { Class.forName(className).newInstance(); if (policyDefaultClass != null) { - Enumeration impls = mRegistry.getIds("constraintPolicy"); + Enumeration<String> impls = mRegistry.getIds("constraintPolicy"); while (impls.hasMoreElements()) { String constraintID = (String) impls.nextElement(); @@ -332,11 +332,11 @@ public class RegistryAdminServlet extends AdminServlet { } catch (Exception e) { } if (template != null) { - Enumeration names = template.getConfigNames(); + Enumeration<String> names = template.getConfigNames(); if (names != null) { while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); CMS.debug("RegistryAdminServlet: getProfileImpl descriptor " + name); IDescriptor desc = template.getConfigDescriptor(getLocale(req), name); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java index 1c5062758..60075b6d5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -1042,7 +1042,7 @@ public abstract class CMSServlet extends HttpServlet { */ protected void saveHttpParams( IArgBlock httpParams, IRequest req) { - Hashtable<String, Object> saveParams = new Hashtable<String, Object>(); + Hashtable<String, String> saveParams = new Hashtable<String, String>(); Enumeration<String> names = httpParams.elements(); @@ -1065,7 +1065,7 @@ public abstract class CMSServlet extends HttpServlet { // retrieves string values. // TODO - when we can use JDK5 features we should typecast // the params until they get here - saveParams.put(name, httpParams.get(name)); + saveParams.put(name, (String) httpParams.get(name)); } } req.setExtData(IRequest.HTTP_PARAMS, saveParams); @@ -1477,7 +1477,7 @@ public abstract class CMSServlet extends HttpServlet { // # 56230 - expose auth token parameters to the policy predicate if (token != null && req != null) { - Enumeration e = token.getElements(); + Enumeration<String> e = token.getElements(); while (e.hasMoreElements()) { String n = (String) e.nextElement(); String[] x1 = token.getInStringArray(n); @@ -2197,7 +2197,7 @@ public abstract class CMSServlet extends HttpServlet { return ILogger.SIGNED_AUDIT_EMPTY_VALUE; } - Enumeration groups = null; + Enumeration<IGroup> groups = null; try { groups = mUG.findGroups("*"); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java index a159c0f2d..33233275d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java @@ -703,12 +703,12 @@ public class ProfileProcessServlet extends ProfileServlet { IProfileOutput profileOutput = profile.getProfileOutput( outputId); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration<String> outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { ArgSet outputset = new ArgSet(); - String outputName = (String) + String outputName = outputNames.nextElement(); IDescriptor outputDesc = profileOutput.getValueDescriptor(locale, diff --git a/pki/base/common/src/com/netscape/cmscore/notification/EmailFormProcessor.java b/pki/base/common/src/com/netscape/cmscore/notification/EmailFormProcessor.java index aa1fd15f2..770b5ba42 100644 --- a/pki/base/common/src/com/netscape/cmscore/notification/EmailFormProcessor.java +++ b/pki/base/common/src/com/netscape/cmscore/notification/EmailFormProcessor.java @@ -71,8 +71,8 @@ public class EmailFormProcessor implements IEmailFormProcessor { }; // stores the eventual content of the email - Vector mContent = new Vector(); - Hashtable mTok2vals = null; + Vector<String> mContent = new Vector<String>(); + Hashtable<String, Object> mTok2vals = null; public EmailFormProcessor() { } @@ -87,7 +87,7 @@ public class EmailFormProcessor implements IEmailFormProcessor { * @return mail content */ public String getEmailContent(String form, - Hashtable tok2vals) { + Hashtable<String, Object> tok2vals) { mTok2vals = tok2vals; if (form == null) { @@ -154,7 +154,7 @@ public class EmailFormProcessor implements IEmailFormProcessor { boolean matched = false; String tok = null; - for (Enumeration e = mTok2vals.keys(); e.hasMoreElements();) { + for (Enumeration<String> e = mTok2vals.keys(); e.hasMoreElements();) { // get key tok = (String) e.nextElement(); @@ -167,7 +167,7 @@ public class EmailFormProcessor implements IEmailFormProcessor { String s = (String) o; if (!s.equals("")) { - mContent.add(o); + mContent.add(s); } else { break; } @@ -221,18 +221,18 @@ public class EmailFormProcessor implements IEmailFormProcessor { /** * takes a vector of strings and concatenate them */ - public String formContent(Vector vec) { + public String formContent(Vector<String> vec) { String content = null; - Enumeration e = vec.elements(); + Enumeration<String> e = vec.elements(); // initialize content with first element if (e.hasMoreElements()) { - content = (String) e.nextElement(); + content = e.nextElement(); } while (e.hasMoreElements()) { - String v = (String) e.nextElement(); + String v = e.nextElement(); content += v; } diff --git a/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java b/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java index cdfb7025c..2b4d012c7 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java @@ -75,13 +75,13 @@ public class GenericPolicyProcessor implements IPolicyProcessor { {"com.netscape.cms.policy.constraints.ManualAuthentication"}; // Policies that can't be deleted nor disabled. - public final static Hashtable DEF_UNDELETABLE_POLICIES = - new Hashtable(); + public final static Hashtable<String, IExpression> DEF_UNDELETABLE_POLICIES = + new Hashtable<String, IExpression>(); private String mId = "Policy"; - private Vector mPolicyOrder = new Vector(); - private Hashtable mImplTable = new Hashtable(); - private Hashtable mInstanceTable = new Hashtable(); + private Vector<String> mPolicyOrder = new Vector<String>(); + private Hashtable<String, RegisteredPolicy> mImplTable = new Hashtable<String, RegisteredPolicy>(); + private Hashtable<String, PolicyInstance> mInstanceTable = new Hashtable<String, PolicyInstance>(); PolicySet mEnrollmentRules = new PolicySet("EnrollmentRules"); PolicySet mRenewalRules = new PolicySet("RenewalRules"); PolicySet mRevocationRules = new PolicySet("RevocationRules"); @@ -92,7 +92,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { // A Table of persistent policies and their predicates. // The predicates cannot be changed during configuration. - private Hashtable mUndeletablePolicies = null; + private Hashtable<String, IExpression> mUndeletablePolicies = null; public GenericPolicyProcessor() { mInitSystemPolicies = true; // CA & RA @@ -208,7 +208,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { IConfigStore c; c = config.getSubStore(PROP_IMPL); - Enumeration mImpls = c.getSubStoreNames(); + Enumeration<String> mImpls = c.getSubStoreNames(); while (mImpls.hasMoreElements()) { String id = (String) mImpls.nextElement(); @@ -458,10 +458,10 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return mAuthority.getId() + ".Policy"; } - public Enumeration getPolicyImpls() { - Vector impls = new Vector(); - Enumeration enum1 = mImplTable.elements(); - Enumeration ret = null; + public Enumeration<IPolicyRule> getPolicyImpls() { + Vector<IPolicyRule> impls = new Vector<IPolicyRule>(); + Enumeration<RegisteredPolicy> enum1 = mImplTable.elements(); + Enumeration<IPolicyRule> ret = null; try { while (enum1.hasMoreElements()) { @@ -481,10 +481,10 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return ret; } - public Enumeration getPolicyImplsInfo() { - Vector impls = new Vector(); - Enumeration enum1 = mImplTable.elements(); - Enumeration ret = null; + public Enumeration<String> getPolicyImplsInfo() { + Vector<String> impls = new Vector<String>(); + Enumeration<RegisteredPolicy> enum1 = mImplTable.elements(); + Enumeration<String> ret = null; try { while (enum1.hasMoreElements()) { @@ -518,15 +518,15 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return impl; } - public Vector getPolicyImplConfig(String id) { + public Vector<String> getPolicyImplConfig(String id) { IPolicyRule rp = getPolicyImpl(id); if (rp == null) return null; - Vector v = rp.getDefaultParams(); + Vector<String> v = rp.getDefaultParams(); if (v == null) - v = new Vector(); + v = new Vector<String>(); v.insertElementAt(IPolicyRule.PROP_ENABLE + "=" + "true", 0); v.insertElementAt(IPolicyRule.PROP_PREDICATE + "=" + " ", 1); return v; @@ -544,7 +544,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { // If any instance exists for this impl, can't delete it. boolean instanceExist = false; - Enumeration e = mInstanceTable.elements(); + Enumeration<PolicyInstance> e = mInstanceTable.elements(); for (; e.hasMoreElements();) { PolicyInstance inst = (PolicyInstance) e.nextElement(); @@ -629,10 +629,10 @@ public class GenericPolicyProcessor implements IPolicyProcessor { } } - public Enumeration getPolicyInstances() { - Vector rules = new Vector(); - Enumeration enum1 = mPolicyOrder.elements(); - Enumeration ret = null; + public Enumeration<IPolicyRule> getPolicyInstances() { + Vector<IPolicyRule> rules = new Vector<IPolicyRule>(); + Enumeration<String> enum1 = mPolicyOrder.elements(); + Enumeration<IPolicyRule> ret = null; try { while (enum1.hasMoreElements()) { @@ -649,17 +649,15 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return ret; } - public Enumeration getPolicyInstancesInfo() { - Vector rules = new Vector(); - Enumeration enum1 = mPolicyOrder.elements(); - Enumeration ret = null; + public Enumeration<String> getPolicyInstancesInfo() { + Vector<String> rules = new Vector<String>(); + Enumeration<String> enum1 = mPolicyOrder.elements(); + Enumeration<String> ret = null; try { while (enum1.hasMoreElements()) { - String ruleName = (String) enum1.nextElement(); - PolicyInstance instance = - (PolicyInstance) mInstanceTable.get(ruleName); - + String ruleName = enum1.nextElement(); + PolicyInstance instance = mInstanceTable.get(ruleName); rules.addElement(instance.getRuleInfo()); } ret = rules.elements(); @@ -676,16 +674,16 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return (policyInstance == null) ? null : policyInstance.getRule(); } - public Vector getPolicyInstanceConfig(String id) { + public Vector<String> getPolicyInstanceConfig(String id) { PolicyInstance policyInstance = (PolicyInstance) mInstanceTable.get(id); if (policyInstance == null) return null; - Vector v = policyInstance.getRule().getInstanceParams(); + Vector<String> v = policyInstance.getRule().getInstanceParams(); if (v == null) - v = new Vector(); + v = new Vector<String>(); v.insertElementAt(PROP_IMPL_NAME + "=" + policyInstance.getImplId(), 0); v.insertElementAt(PROP_ENABLE + "=" + policyInstance.isActive(), 1); String predicate = " "; @@ -757,7 +755,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { mInstanceTable.remove(id); } - public void addPolicyInstance(String id, Hashtable ht) + public void addPolicyInstance(String id, Hashtable<String, String> ht) throws EBaseException { // The instance id should be unique if (getPolicyInstance(id) != null) @@ -780,9 +778,9 @@ public class GenericPolicyProcessor implements IPolicyProcessor { policyStore.getSubStore(PROP_RULE); IConfigStore newStore = instanceStore.makeSubStore(id); - for (Enumeration keys = ht.keys(); keys.hasMoreElements();) { - String key = (String) keys.nextElement(); - String val = (String) ht.get(key); + for (Enumeration<String> keys = ht.keys(); keys.hasMoreElements();) { + String key = keys.nextElement(); + String val = ht.get(key); newStore.put(key, val); } @@ -836,7 +834,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { addRule(id, rule); } - public void modifyPolicyInstance(String id, Hashtable ht) + public void modifyPolicyInstance(String id, Hashtable<String, String> ht) throws EBaseException { // The instance id should be there already PolicyInstance policyInstance = (PolicyInstance) @@ -923,7 +921,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { ht.put(IPolicyRule.PROP_ENABLE, String.valueOf(active)); // put old config store parameters first. - for (Enumeration oldkeys = oldStore.keys(); + for (Enumeration<String> oldkeys = oldStore.keys(); oldkeys.hasMoreElements();) { String k = (String) oldkeys.nextElement(); String v = (String) oldStore.getString(k); @@ -932,7 +930,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { } // put modified params. - for (Enumeration newkeys = ht.keys(); + for (Enumeration<String> newkeys = ht.keys(); newkeys.hasMoreElements();) { String k = (String) newkeys.nextElement(); String v = (String) ht.get(k); @@ -973,7 +971,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { // Store the changes in the file. try { - for (Enumeration e = newStore.keys(); e.hasMoreElements();) { + for (Enumeration<String> e = newStore.keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); if (key != null) { @@ -1022,7 +1020,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { public synchronized void changePolicyInstanceOrdering( String policyOrderStr) throws EBaseException { - Vector policyOrder = new Vector(); + Vector<String> policyOrder = new Vector<String>(); StringTokenizer tokens = new StringTokenizer(policyOrderStr, ","); // Get all the elements @@ -1082,7 +1080,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { } // add rules specified in the new order. - for (Enumeration enum1 = policyOrder.elements(); + for (Enumeration<String> enum1 = policyOrder.elements(); enum1.hasMoreElements();) { String instanceName = (String) enum1.nextElement(); PolicyInstance pInstance = (PolicyInstance) @@ -1131,7 +1129,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { } } - private boolean areSameVectors(Vector v1, Vector v2) { + private boolean areSameVectors(Vector<String> v1, Vector<String> v2) { if (v1.size() != v2.size()) return false; int size = v1.size(); @@ -1143,10 +1141,10 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return (i == size ? true : false); } - private String getRuleOrderString(Vector rules) { + private String getRuleOrderString(Vector<String> rules) { StringBuffer sb = new StringBuffer(); - for (Enumeration e = rules.elements(); e.hasMoreElements();) { + for (Enumeration<String> e = rules.elements(); e.hasMoreElements();) { sb.append((String) e.nextElement()); sb.append(","); } @@ -1155,7 +1153,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return new String(sb); } - private String getRuleOrderString(Vector rules, String newRule) { + private String getRuleOrderString(Vector<String> rules, String newRule) { String currentRules = getRuleOrderString(rules); if (currentRules == null || currentRules.length() == 0) @@ -1211,7 +1209,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { configuredDefaults.trim().length() == 0) mSystemDefaults = DEF_POLICIES; else { - Vector rules = new Vector(); + Vector<String> rules = new Vector<String>(); StringTokenizer tokenizer = new StringTokenizer(configuredDefaults.trim(), ","); @@ -1364,7 +1362,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { return; } - Vector rules = new Vector(); + Vector<String> rules = new Vector<String>(); StringTokenizer tokenizer = new StringTokenizer(configuredUndeletables.trim(), ","); @@ -1381,8 +1379,8 @@ public class GenericPolicyProcessor implements IPolicyProcessor { // For each rule read from the config file, see if any // predicate is set. - mUndeletablePolicies = new Hashtable(); - for (Enumeration e = rules.elements(); e.hasMoreElements();) { + mUndeletablePolicies = new Hashtable<String, IExpression>(); + for (Enumeration<String> e = rules.elements(); e.hasMoreElements();) { String urn = (String) e.nextElement(); // See if there is predicate in the file @@ -1429,7 +1427,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { // For each policy in undeletable list make sure that // the policy is present, is not disabled and its predicate // is not tampered with. - for (Enumeration e = mUndeletablePolicies.keys(); + for (Enumeration<String> e = mUndeletablePolicies.keys(); e.hasMoreElements();) { String urn = (String) e.nextElement(); diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java index 17a19e9d4..24918a336 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java @@ -40,8 +40,8 @@ import com.netscape.cmscore.util.Debug; */ public class PolicySet implements IPolicySet { private String mName; - private Vector mRuleNames = new Vector(); - private Vector mRules = new Vector(); + private Vector<String> mRuleNames = new Vector<String>(); + private Vector<IPolicyRule> mRules = new Vector<IPolicyRule>(); private ILogger mLogger = CMS.getLogger(); public PolicySet(String name) { @@ -140,7 +140,7 @@ public class PolicySet implements IPolicySet { * * @return An enumeration of rules. */ - public Enumeration getRules() { + public Enumeration<IPolicyRule> getRules() { return mRules.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java index 3af3321d1..4f3862594 100644 --- a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java @@ -46,9 +46,9 @@ public class ProfileSubsystem implements IProfileSubsystem { private IConfigStore mConfig = null; private ISubsystem mOwner = null; - private Vector mProfileIds = new Vector(); - private Hashtable mProfiles = new Hashtable(); - private Hashtable mProfileClassIds = new Hashtable(); + private Vector<String> mProfileIds = new Vector<String>(); + private Hashtable<String, IProfile> mProfiles = new Hashtable<String, IProfile>(); + private Hashtable<String, String> mProfileClassIds = new Hashtable<String, String>(); /** * Retrieves the name of this subsystem. @@ -106,7 +106,7 @@ public class ProfileSubsystem implements IProfileSubsystem { CMS.debug("Done Profile Creation - " + id); } - Enumeration ee = getProfileIds(); + Enumeration<String> ee = getProfileIds(); while (ee.hasMoreElements()) { String id = (String) ee.nextElement(); @@ -308,7 +308,7 @@ public class ProfileSubsystem implements IProfileSubsystem { * Retrieves a list of profile ids. The return * list is of type String. */ - public Enumeration getProfileIds() { + public Enumeration<String> getProfileIds() { return mProfileIds.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java b/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java index cde61d665..20c9cef04 100644 --- a/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java +++ b/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java @@ -44,7 +44,7 @@ public class PluginRegistry implements IPluginRegistry { private IConfigStore mConfig = null; private IConfigStore mFileConfig = null; private ISubsystem mOwner = null; - private Hashtable mTypes = new Hashtable(); + private Hashtable<String, Hashtable <String ,IPluginInfo>> mTypes = new Hashtable<String, Hashtable<String, IPluginInfo>>(); public PluginRegistry() { } @@ -158,7 +158,7 @@ public class PluginRegistry implements IPluginRegistry { public void removePluginInfo(String type, String id) throws ERegistryException { - Hashtable plugins = (Hashtable)mTypes.get(type); + Hashtable<String, IPluginInfo> plugins = mTypes.get(type); if (plugins == null) return; plugins.remove(id); @@ -173,10 +173,10 @@ public class PluginRegistry implements IPluginRegistry { public void addPluginInfo(String type, String id, IPluginInfo info, int saveConfig) throws ERegistryException { - Hashtable plugins = (Hashtable) mTypes.get(type); + Hashtable<String, IPluginInfo> plugins = mTypes.get(type); if (plugins == null) { - plugins = new Hashtable(); + plugins = new Hashtable<String, IPluginInfo>(); mTypes.put(type, plugins); } Locale locale = Locale.getDefault(); @@ -192,7 +192,7 @@ public class PluginRegistry implements IPluginRegistry { public void rebuildConfigStore(Locale locale) throws ERegistryException { - Enumeration types = mTypes.keys(); + Enumeration<String> types = mTypes.keys(); StringBuffer typesBuf = new StringBuffer(); while (types.hasMoreElements()) { @@ -202,9 +202,9 @@ public class PluginRegistry implements IPluginRegistry { if (types.hasMoreElements()) { typesBuf.append(","); } - Hashtable mPlugins = (Hashtable) mTypes.get(type); + Hashtable<String, IPluginInfo> mPlugins = mTypes.get(type); StringBuffer idsBuf = new StringBuffer(); - Enumeration plugins = mPlugins.keys(); + Enumeration<String> plugins = mPlugins.keys(); while (plugins.hasMoreElements()) { String id = (String) plugins.nextElement(); @@ -266,15 +266,15 @@ public class PluginRegistry implements IPluginRegistry { /** * Returns all type names. */ - public Enumeration getTypeNames() { + public Enumeration<String> getTypeNames() { return mTypes.keys(); } /** * Returns a list of identifiers of the given type. */ - public Enumeration getIds(String type) { - Hashtable plugins = (Hashtable) mTypes.get(type); + public Enumeration<String> getIds(String type) { + Hashtable<String, IPluginInfo> plugins = mTypes.get(type); if (plugins == null) return null; @@ -285,11 +285,11 @@ public class PluginRegistry implements IPluginRegistry { * Retrieves the plugin information. */ public IPluginInfo getPluginInfo(String type, String id) { - Hashtable plugins = (Hashtable) mTypes.get(type); + Hashtable <String ,IPluginInfo> plugins = mTypes.get(type); if (plugins == null) return null; - return (IPluginInfo) plugins.get(id); + return plugins.get(id); } } diff --git a/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java b/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java index 2da14467e..e7bc05f64 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java @@ -830,7 +830,7 @@ class Request * this isn't that efficient but will do for now. */ public void copyContents(IRequest req) { - Enumeration e = req.getExtDataKeys(); + Enumeration<String> e = req.getExtDataKeys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (!key.equals(IRequest.ISSUED_CERTS) && @@ -858,11 +858,11 @@ class Request (! key.equals("")); } - protected boolean isValidExtDataHashtableValue(Hashtable hash) { + protected boolean isValidExtDataHashtableValue(Hashtable<String, String> hash) { if (hash == null) { return false; } - Enumeration keys = hash.keys(); + Enumeration<String> keys = hash.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if (! ((key instanceof String) && diff --git a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java index ba3a8d550..8104210d9 100644 --- a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java @@ -275,7 +275,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); int i = 0; @@ -320,7 +320,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -382,7 +382,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -427,7 +427,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -471,7 +471,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -511,7 +511,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed on demand - Enumeration instances = mOnDemandOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mOnDemandOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -600,7 +600,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); int i = 0; @@ -645,7 +645,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -707,7 +707,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -753,7 +753,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -797,7 +797,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -846,7 +846,7 @@ public class SelfTestSubsystem // loop through all self test plugin instances // specified to be executed at server startup - Enumeration instances = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> instances = mStartupOrder.elements(); while (instances.hasMoreElements()) { SelfTestOrderedInstance instance = (SelfTestOrderedInstance) @@ -980,7 +980,7 @@ public class SelfTestSubsystem } // loop through all self test plugin instances - Enumeration instances = mSelfTestInstances.elements(); + Enumeration<ISelfTest> instances = mSelfTestInstances.elements(); while (instances.hasMoreElements()) { ISelfTest instance = (ISelfTest) instances.nextElement(); @@ -1355,7 +1355,7 @@ public class SelfTestSubsystem throw new EMissingSelfTestException(); } - Enumeration loggerInstances = loggerConfig.getPropertyNames(); + Enumeration<String> loggerInstances = loggerConfig.getPropertyNames(); if (loggerInstances.hasMoreElements()) { loadStatus++; @@ -1495,7 +1495,7 @@ public class SelfTestSubsystem throw new EMissingSelfTestException(); } - Enumeration instances = instanceConfig.getPropertyNames(); + Enumeration<String> instances = instanceConfig.getPropertyNames(); if (instances.hasMoreElements()) { loadStatus++; @@ -1842,7 +1842,7 @@ public class SelfTestSubsystem public void startup() throws EBaseException { // loop through all self test plugin instances - Enumeration instances = mSelfTestInstances.elements(); + Enumeration<ISelfTest> instances = mSelfTestInstances.elements(); while (instances.hasMoreElements()) { ISelfTest instance = (ISelfTest) instances.nextElement(); @@ -1852,7 +1852,7 @@ public class SelfTestSubsystem if (!CMS.isPreOpMode()) { // run all self test plugin instances (designated at startup) - Enumeration selftests = mStartupOrder.elements(); + Enumeration<SelfTestOrderedInstance> selftests = mStartupOrder.elements(); if (selftests.hasMoreElements()) { // log that execution of startup self tests has begun @@ -1883,13 +1883,13 @@ public class SelfTestSubsystem */ public void shutdown() { // reverse order of all self test plugin instances - Collection collection = mSelfTestInstances.values(); - Vector list = new Vector(collection); + Collection<ISelfTest> collection = mSelfTestInstances.values(); + Vector<ISelfTest> list = new Vector<ISelfTest>(collection); Collections.reverse(list); // loop through all self test plugin instances - ListIterator instances = list.listIterator(); + ListIterator<ISelfTest> instances = list.listIterator(); while (instances.hasNext()) { ISelfTest instance = (ISelfTest) instances.next(); diff --git a/pki/base/common/src/com/netscape/cmscore/usrgrp/Group.java b/pki/base/common/src/com/netscape/cmscore/usrgrp/Group.java index 40f3281ee..d91eedf93 100644 --- a/pki/base/common/src/com/netscape/cmscore/usrgrp/Group.java +++ b/pki/base/common/src/com/netscape/cmscore/usrgrp/Group.java @@ -40,10 +40,10 @@ public class Group implements IGroup { private static final long serialVersionUID = -1264387079578766750L; private IUsrGrp mBase = null; private String mName = null; - private Vector mMembers = new Vector(); + private Vector<String> mMembers = new Vector<String>(); private String mDescription = null; - private static final Vector mNames = new Vector(); + private static final Vector<String> mNames = new Vector<String>(); static { mNames.addElement(ATTR_NAME); mNames.addElement(ATTR_ID); @@ -75,7 +75,7 @@ public class Group implements IGroup { mMembers.addElement(name); } - public Enumeration getMemberNames() { + public Enumeration<String> getMemberNames() { return mMembers.elements(); } @@ -90,13 +90,14 @@ public class Group implements IGroup { return false; } - public void set(String name, Object object) throws EBaseException { + @SuppressWarnings("unchecked") + public void set(String name, Object object) throws EBaseException { if (name.equals(ATTR_NAME)) { throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", name)); } else if (name.equals(ATTR_ID)) { throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", name)); } else if (name.equals(ATTR_MEMBERS)) { - mMembers = (Vector) object; + mMembers = (Vector<String>) object; } else if (name.equals(ATTR_DESCRIPTION)) { mDescription = (String) object; } else { @@ -120,7 +121,7 @@ public class Group implements IGroup { throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", name)); } - public Enumeration getElements() { + public Enumeration<String> getElements() { return mNames.elements(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java b/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java index 0c1180362..6b25410eb 100644 --- a/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java @@ -197,7 +197,7 @@ public final class UGSubsystem implements IUGSubsystem { try { if (userid.indexOf('=') == -1) { - Enumeration e = findUsers(userid); + Enumeration<IUser> e = findUsers(userid); if (e != null && e.hasMoreElements()) { IUser u = (IUser) e.nextElement(); @@ -215,7 +215,7 @@ public final class UGSubsystem implements IUGSubsystem { LDAPSearchResults res = ldapconn.search(userid, LDAPv2.SCOPE_SUB, "(objectclass=*)", null, false); - Enumeration e = buildUsers(res); + Enumeration<IUser> e = buildUsers(res); if (e.hasMoreElements()) { return (IUser) e.nextElement(); @@ -248,7 +248,7 @@ public final class UGSubsystem implements IUGSubsystem { LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPConnection.SCOPE_SUB, filter, null, false); - Enumeration e = buildUsers(res); + Enumeration<IUser> e = buildUsers(res); return (User) e.nextElement(); } catch (LDAPException e) { @@ -306,7 +306,7 @@ public final class UGSubsystem implements IUGSubsystem { LDAPv2.SCOPE_SUB, "(" + filter + ")", null, false); - Enumeration e = buildUsers(res); + Enumeration<IUser> e = buildUsers(res); return (User) e.nextElement(); } catch (LDAPException e) { @@ -333,7 +333,7 @@ public final class UGSubsystem implements IUGSubsystem { /** * Searchs for identities that matches the filter. */ - public Enumeration findUsers(String filter) throws EUsrGrpException { + public Enumeration<IUser> findUsers(String filter) throws EUsrGrpException { if (filter == null) { return null; } @@ -346,7 +346,7 @@ public final class UGSubsystem implements IUGSubsystem { LDAPv2.SCOPE_SUB, "(uid=" + filter + ")", null, false); - Enumeration e = buildUsers(res); + Enumeration<IUser> e = buildUsers(res); return e; } catch (LDAPException e) { @@ -373,7 +373,7 @@ public final class UGSubsystem implements IUGSubsystem { * Searchs for identities that matches the filter. * retrieves uid only, for efficiency of user listing */ - public Enumeration listUsers(String filter) throws EUsrGrpException { + public Enumeration<IUser> listUsers(String filter) throws EUsrGrpException { if (filter == null) { return null; } @@ -392,7 +392,7 @@ public final class UGSubsystem implements IUGSubsystem { cons.setMaxResults(0); LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPv2.SCOPE_SUB, "(uid=" + filter + ")", attrs, false, cons); - Enumeration e = lbuildUsers(res); + Enumeration<IUser> e = lbuildUsers(res); return e; } catch (LDAPException e) { @@ -412,9 +412,9 @@ public final class UGSubsystem implements IUGSubsystem { return null; } - protected Enumeration lbuildUsers(LDAPSearchResults res) throws + protected Enumeration<IUser> lbuildUsers(LDAPSearchResults res) throws EUsrGrpException { - Vector v = new Vector(); + Vector<IUser> v = new Vector<IUser>(); while (res.hasMoreElements()) { LDAPEntry entry = (LDAPEntry) res.nextElement(); @@ -425,9 +425,9 @@ public final class UGSubsystem implements IUGSubsystem { return v.elements(); } - protected Enumeration buildUsers(LDAPSearchResults res) throws + protected Enumeration<IUser> buildUsers(LDAPSearchResults res) throws EUsrGrpException { - Vector v = new Vector(); + Vector<IUser> v = new Vector<IUser>(); if (res != null) { while (res.hasMoreElements()) { @@ -469,13 +469,14 @@ public final class UGSubsystem implements IUGSubsystem { entry.getAttribute(LDAP_ATTR_USER_CERT); if (certAttr != null) { - Vector certVector = new Vector(); - Enumeration e = certAttr.getByteValues(); + Vector<X509Certificate> certVector = new Vector<X509Certificate>(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> e = certAttr.getByteValues(); try { for (; e != null && e.hasMoreElements();) { X509Certificate cert = new X509CertImpl( - (byte[]) e.nextElement()); + e.nextElement()); certVector.addElement(cert); } @@ -486,7 +487,7 @@ public final class UGSubsystem implements IUGSubsystem { if (certVector != null && certVector.size() != 0) { // Make an array of certs X509Certificate[] certArray = new X509Certificate[certVector.size()]; - Enumeration en = certVector.elements(); + Enumeration<X509Certificate> en = certVector.elements(); int i = 0; while (en.hasMoreElements()) { @@ -544,10 +545,11 @@ public final class UGSubsystem implements IUGSubsystem { LDAPAttribute mailAttr = entry.getAttribute("mail"); if (mailAttr != null) { - Enumeration en = mailAttr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = mailAttr.getStringValues(); if (en != null && en.hasMoreElements()) { - String mail = (String) en.nextElement(); + String mail = en.nextElement(); if (mail != null) { id.setEmail(mail); @@ -570,7 +572,8 @@ public final class UGSubsystem implements IUGSubsystem { LDAPAttribute phoneAttr = entry.getAttribute("telephonenumber"); if (phoneAttr != null) { - Enumeration en = phoneAttr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = phoneAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String phone = (String) en.nextElement(); @@ -589,7 +592,8 @@ public final class UGSubsystem implements IUGSubsystem { if (userTypeAttr == null) id.setUserType(""); else { - Enumeration en = userTypeAttr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = userTypeAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String userType = (String) en.nextElement(); @@ -607,7 +611,8 @@ public final class UGSubsystem implements IUGSubsystem { if (userStateAttr == null) id.setState(""); else { - Enumeration en = userStateAttr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = userStateAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String userState = (String) en.nextElement(); @@ -624,8 +629,9 @@ public final class UGSubsystem implements IUGSubsystem { entry.getAttribute(LDAP_ATTR_USER_CERT); if (certAttr != null) { - Vector certVector = new Vector(); - Enumeration e = certAttr.getByteValues(); + Vector<X509Certificate> certVector = new Vector<X509Certificate>(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> e = certAttr.getByteValues(); try { for (; e != null && e.hasMoreElements();) { @@ -641,7 +647,7 @@ public final class UGSubsystem implements IUGSubsystem { if (certVector != null && certVector.size() != 0) { // Make an array of certs X509Certificate[] certArray = new X509Certificate[certVector.size()]; - Enumeration en = certVector.elements(); + Enumeration<X509Certificate> en = certVector.elements(); int i = 0; while (en.hasMoreElements()) { @@ -1132,8 +1138,8 @@ public final class UGSubsystem implements IUGSubsystem { } } - protected Enumeration buildGroups(LDAPSearchResults res) { - Vector v = new Vector(); + protected Enumeration<IGroup> buildGroups(LDAPSearchResults res) { + Vector<IGroup> v = new Vector<IGroup>(); while (res.hasMoreElements()) { LDAPEntry entry = (LDAPEntry) res.nextElement(); @@ -1146,7 +1152,7 @@ public final class UGSubsystem implements IUGSubsystem { /** * Finds groups. */ - public Enumeration findGroups(String filter) { + public Enumeration<IGroup> findGroups(String filter) { if (filter == null) { return null; } @@ -1183,7 +1189,7 @@ public final class UGSubsystem implements IUGSubsystem { } public IGroup findGroup(String filter) { - Enumeration groups = findGroups(filter); + Enumeration<IGroup> groups = findGroups(filter); if (groups == null || !groups.hasMoreElements()) return null; @@ -1194,7 +1200,7 @@ public final class UGSubsystem implements IUGSubsystem { * List groups. more efficient than find Groups. only retrieves * group names and description. */ - public Enumeration listGroups(String filter) throws EUsrGrpException { + public Enumeration<IGroup> listGroups(String filter) throws EUsrGrpException { if (filter == null) { return null; } @@ -1243,7 +1249,8 @@ public final class UGSubsystem implements IUGSubsystem { LDAPAttribute grpDesc = entry.getAttribute("description"); if (grpDesc != null) { - Enumeration en = grpDesc.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = grpDesc.getStringValues(); if (en != null && en.hasMoreElements()) { String desc = (String) en.nextElement(); @@ -1274,7 +1281,8 @@ public final class UGSubsystem implements IUGSubsystem { return grp; } - Enumeration e = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> e = attr.getStringValues(); while (e.hasMoreElements()) { String v = (String) e.nextElement(); @@ -1331,7 +1339,7 @@ public final class UGSubsystem implements IUGSubsystem { // read the group object LDAPSearchResults res = ldapconn.search(name, LDAPConnection.SCOPE_BASE, "(objectclass=*)", null, false); - Enumeration e = buildGroups(res); + Enumeration<IGroup> e = buildGroups(res); if (e == null || e.hasMoreElements() == false) return null; @@ -1363,7 +1371,8 @@ public final class UGSubsystem implements IUGSubsystem { if (attr == null) { return false; } - Enumeration en = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> en = attr.getStringValues(); for (; en.hasMoreElements();) { String v = (String) en.nextElement(); @@ -1491,7 +1500,7 @@ public final class UGSubsystem implements IUGSubsystem { attrs.add(new LDAPAttribute("objectclass", oc)); attrs.add(new LDAPAttribute("cn", group.getGroupID())); attrs.add(new LDAPAttribute("description", group.getDescription())); - Enumeration e = grp.getMemberNames(); + Enumeration<String> e = grp.getMemberNames(); if (e.hasMoreElements() == true) { LDAPAttribute attrMembers = new LDAPAttribute("uniquemember"); @@ -1589,7 +1598,7 @@ public final class UGSubsystem implements IUGSubsystem { new LDAPAttribute("description", desc)); } - Enumeration e = grp.getMemberNames(); + Enumeration<String> e = grp.getMemberNames(); if (e.hasMoreElements() == true) { while (e.hasMoreElements()) { |