summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-12-05 17:15:56 -0500
committerAdam Young <ayoung@redhat.com>2011-12-07 12:30:49 -0500
commit948bfab248d4cb1faf00c5999f8a55580e89999f (patch)
treeff8f037c8841291b27cb7841d1ed4076928aa04b /pki/base/common/src/com/netscape/cmscore
parentec45d246502d8dedb59a97c4599d26657c464e56 (diff)
downloadpki-948bfab248d4cb1faf00c5999f8a55580e89999f.tar.gz
pki-948bfab248d4cb1faf00c5999f8a55580e89999f.tar.xz
pki-948bfab248d4cb1faf00c5999f8a55580e89999f.zip
TreeSet
ArraySet and AttributeNameEnumeration both were not updated to handfle Generics. Neither are really needed, and are likely to introduce errors. ArraySet can be safely replaced by TreeSet. TreeSet provides a stricter ordering constraint than ArraySet did. This will not hurt anything, and may actually be closer to the desired behavior AttributeNameEnumeration was a thin wrapper around Vector. It has been replaced with Vector<String> In addition, this patch cleans up the Type safety in of the collections used in the related files. removed files from cmake Removed custom collection files Supressed watnings generated by the clone method.
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java20
-rw-r--r--pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java92
2 files changed, 55 insertions, 57 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java
index 16bc7f02b..233cbf871 100644
--- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java
+++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java
@@ -66,20 +66,20 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo {
mConfig = config;
mProcessor = processor;
- Enumeration mappers = mProcessor.getMapperInsts().keys();
- Enumeration publishers = mProcessor.getPublisherInsts().keys();
+ Enumeration<String> mappers = mProcessor.getMapperInsts().keys();
+ Enumeration<String> publishers = mProcessor.getPublisherInsts().keys();
String map = NOMAPPER;
for (; mappers.hasMoreElements();) {
- String name = (String) mappers.nextElement();
+ String name = mappers.nextElement();
map = map + "," + name;
}
String publish = "";
for (; publishers.hasMoreElements();) {
- String name = (String) publishers.nextElement();
+ String name = publishers.nextElement();
publish = publish + "," + name;
}
@@ -168,11 +168,11 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo {
/**
* Returns the current instance parameters.
*/
- public Vector getInstanceParams() {
+ public Vector<String> getInstanceParams() {
//if (mProcessor == null) System.out.println("xxxxnull");
//dont know why the processor was null in getExtendedPluginInfo()
- Enumeration mappers = mProcessor.getMapperInsts().keys();
- Enumeration publishers = mProcessor.getPublisherInsts().keys();
+ Enumeration<String> mappers = mProcessor.getMapperInsts().keys();
+ Enumeration<String> publishers = mProcessor.getPublisherInsts().keys();
String map = NOMAPPER;
for (; mappers.hasMoreElements();) {
@@ -197,7 +197,7 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo {
mExtendedPluginInfo.add("predicate","string;");
*/
- Vector v = new Vector();
+ Vector<String> v = new Vector<String>();
try {
v.addElement(IPublisherProcessor.PROP_TYPE + "=" +
@@ -288,8 +288,8 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo {
/**
* Returns the initial default parameters.
*/
- public Vector getDefaultParams() {
- Vector v = new Vector();
+ public Vector<String> getDefaultParams() {
+ Vector<String> v = new Vector<String>();
v.addElement(IPublisherProcessor.PROP_TYPE + "=");
v.addElement(IPublisherProcessor.PROP_PREDICATE + "=");
diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java b/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java
index a1e45a58a..1477e57b0 100644
--- a/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java
+++ b/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java
@@ -65,12 +65,12 @@ import com.netscape.cmscore.util.Debug;
public class PublisherProcessor implements
IPublisherProcessor, IXcertPublisherProcessor {
- public Hashtable mPublisherPlugins = new Hashtable();
- public Hashtable mPublisherInsts = new Hashtable();
- public Hashtable mMapperPlugins = new Hashtable();
- public Hashtable mMapperInsts = new Hashtable();
- public Hashtable mRulePlugins = new Hashtable();
- public Hashtable mRuleInsts = new Hashtable();
+ public Hashtable<String, PublisherPlugin> mPublisherPlugins = new Hashtable<String, PublisherPlugin>();
+ public Hashtable<String, PublisherProxy> mPublisherInsts = new Hashtable<String, PublisherProxy>();
+ public Hashtable<String, MapperPlugin> mMapperPlugins = new Hashtable<String, MapperPlugin>();
+ public Hashtable<String, MapperProxy> mMapperInsts = new Hashtable<String, MapperProxy>();
+ public Hashtable<String, RulePlugin> mRulePlugins = new Hashtable<String, RulePlugin>();
+ public Hashtable<String, ILdapRule> mRuleInsts = new Hashtable<String, ILdapRule>();
/**
protected PublishRuleSet mRuleSet = null;
@@ -112,7 +112,7 @@ public class PublisherProcessor implements
IConfigStore publisherConfig = config.getSubStore("publisher");
IConfigStore c = publisherConfig.getSubStore(PROP_IMPL);
mCreateOwnDNEntry = mConfig.getBoolean("createOwnDNEntry", false);
- Enumeration mImpls = c.getSubStoreNames();
+ Enumeration<String> mImpls = c.getSubStoreNames();
while (mImpls.hasMoreElements()) {
String id = (String) mImpls.nextElement();
@@ -126,7 +126,7 @@ public class PublisherProcessor implements
// load publisher instances
c = publisherConfig.getSubStore(PROP_INSTANCE);
- Enumeration instances = c.getSubStoreNames();
+ Enumeration<String> instances = c.getSubStoreNames();
while (instances.hasMoreElements()) {
String insName = (String) instances.nextElement();
@@ -460,35 +460,35 @@ public class PublisherProcessor implements
}
}
- public Hashtable getRulePlugins() {
+ public Hashtable<String, RulePlugin> getRulePlugins() {
return mRulePlugins;
}
- public Hashtable getRuleInsts() {
+ public Hashtable<String, ILdapRule> getRuleInsts() {
return mRuleInsts;
}
- public Hashtable getMapperPlugins() {
+ public Hashtable<String, MapperPlugin> getMapperPlugins() {
return mMapperPlugins;
}
- public Hashtable getPublisherPlugins() {
+ public Hashtable<String, PublisherPlugin> getPublisherPlugins() {
return mPublisherPlugins;
}
- public Hashtable getMapperInsts() {
+ public Hashtable<String, MapperProxy> getMapperInsts() {
return mMapperInsts;
}
- public Hashtable getPublisherInsts() {
+ public Hashtable<String, PublisherProxy> getPublisherInsts() {
return mPublisherInsts;
}
//certType can be client,server,ca,crl,smime
//XXXshould make it static to make it faster
- public Enumeration getRules(String publishingType) {
- Vector rules = new Vector();
- Enumeration e = mRuleInsts.keys();
+ public Enumeration<ILdapRule> getRules(String publishingType) {
+ Vector<ILdapRule> rules = new Vector<ILdapRule>();
+ Enumeration<String> e = mRuleInsts.keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
@@ -525,13 +525,13 @@ public class PublisherProcessor implements
return rules.elements();
}
- public Enumeration getRules(String publishingType, IRequest req) {
+ public Enumeration<ILdapRule> getRules(String publishingType, IRequest req) {
if (req == null) {
return getRules(publishingType);
}
- Vector rules = new Vector();
- Enumeration e = mRuleInsts.keys();
+ Vector<ILdapRule> rules = new Vector<ILdapRule>();
+ Enumeration<String> e = mRuleInsts.keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
@@ -575,11 +575,10 @@ public class PublisherProcessor implements
}
**/
- public Vector getMapperDefaultParams(String implName) throws
+ public Vector<String> getMapperDefaultParams(String implName) throws
ELdapException {
// is this a registered implname?
- MapperPlugin plugin = (MapperPlugin)
- mMapperPlugins.get(implName);
+ MapperPlugin plugin = mMapperPlugins.get(implName);
if (plugin == null) {
log(ILogger.LL_FAILURE,
@@ -597,7 +596,7 @@ public class PublisherProcessor implements
try {
mapperInst = (ILdapMapper)
Class.forName(className).newInstance();
- Vector v = mapperInst.getDefaultParams();
+ Vector<String> v = mapperInst.getDefaultParams();
return v;
} catch (InstantiationException e) {
@@ -612,7 +611,7 @@ public class PublisherProcessor implements
}
}
- public Vector getMapperInstanceParams(String insName) throws
+ public Vector<String> getMapperInstanceParams(String insName) throws
ELdapException {
ILdapMapper mapperInst = null;
MapperProxy proxy = (MapperProxy) mMapperInsts.get(insName);
@@ -624,12 +623,12 @@ public class PublisherProcessor implements
if (mapperInst == null) {
return null;
}
- Vector v = mapperInst.getInstanceParams();
+ Vector<String> v = mapperInst.getInstanceParams();
return v;
}
- public Vector getPublisherDefaultParams(String implName) throws
+ public Vector<String> getPublisherDefaultParams(String implName) throws
ELdapException {
// is this a registered implname?
PublisherPlugin plugin = (PublisherPlugin)
@@ -651,7 +650,7 @@ public class PublisherProcessor implements
try {
publisherInst = (ILdapPublisher)
Class.forName(className).newInstance();
- Vector v = publisherInst.getDefaultParams();
+ Vector<String> v = publisherInst.getDefaultParams();
return v;
} catch (InstantiationException e) {
@@ -728,23 +727,22 @@ public class PublisherProcessor implements
return proxy.getPublisher();
}
- public Vector getPublisherInstanceParams(String insName) throws
+ public Vector<String> getPublisherInstanceParams(String insName) throws
ELdapException {
ILdapPublisher publisherInst = getPublisherInstance(insName);
if (publisherInst == null) {
return null;
}
- Vector v = publisherInst.getInstanceParams();
+ Vector<String> v = publisherInst.getInstanceParams();
return v;
}
- public Vector getRuleDefaultParams(String implName) throws
+ public Vector<String> getRuleDefaultParams(String implName) throws
ELdapException {
// is this a registered implname?
- RulePlugin plugin = (RulePlugin)
- mRulePlugins.get(implName);
+ RulePlugin plugin = mRulePlugins.get(implName);
if (plugin == null) {
log(ILogger.LL_FAILURE,
@@ -763,7 +761,7 @@ public class PublisherProcessor implements
ruleInst = (ILdapRule)
Class.forName(className).newInstance();
- Vector v = ruleInst.getDefaultParams();
+ Vector<String> v = ruleInst.getDefaultParams();
return v;
} catch (InstantiationException e) {
@@ -778,11 +776,10 @@ public class PublisherProcessor implements
}
}
- public Vector getRuleInstanceParams(String implName) throws
+ public Vector<String> getRuleInstanceParams(String implName) throws
ELdapException {
// is this a registered implname?
- RulePlugin plugin = (RulePlugin)
- mRulePlugins.get(implName);
+ RulePlugin plugin = mRulePlugins.get(implName);
if (plugin == null) {
log(ILogger.LL_FAILURE,
@@ -800,7 +797,7 @@ public class PublisherProcessor implements
try {
ruleInst = (ILdapRule)
Class.forName(className).newInstance();
- Vector v = ruleInst.getInstanceParams();
+ Vector<String> v = ruleInst.getInstanceParams();
IConfigStore rc = ruleInst.getConfigStore();
return v;
@@ -864,7 +861,7 @@ public class PublisherProcessor implements
CMS.debug("PublishProcessor::publishCACert");
// get mapper and publisher for cert type.
- Enumeration rules = getRules(PROP_LOCAL_CA);
+ Enumeration<ILdapRule> rules = getRules(PROP_LOCAL_CA);
if (rules == null || !rules.hasMoreElements()) {
if (isClone()) {
@@ -934,7 +931,7 @@ public class PublisherProcessor implements
return;
// get mapper and publisher for cert type.
- Enumeration rules = getRules(PROP_LOCAL_CA);
+ Enumeration<ILdapRule> rules = getRules(PROP_LOCAL_CA);
if (rules == null || !rules.hasMoreElements()) {
if (isClone()) {
@@ -1001,7 +998,7 @@ public class PublisherProcessor implements
CMS.debug("PublisherProcessor: in publishXCertPair()");
// get mapper and publisher for cert type.
- Enumeration rules = getRules(PROP_XCERT);
+ Enumeration<ILdapRule> rules = getRules(PROP_XCERT);
if (rules == null || !rules.hasMoreElements()) {
if (isClone()) {
@@ -1063,7 +1060,7 @@ public class PublisherProcessor implements
return;
// get mapper and publisher for cert type.
- Enumeration rules = getRules("certs", req);
+ Enumeration<ILdapRule> rules = getRules("certs", req);
// Bugscape #52306 - Remove superfluous log messages on failure
if (rules == null || !rules.hasMoreElements()) {
@@ -1120,7 +1117,7 @@ public class PublisherProcessor implements
return;
// get mapper and publisher for cert type.
- Enumeration rules = getRules("certs", req);
+ Enumeration<ILdapRule> rules = getRules("certs", req);
if (rules == null || !rules.hasMoreElements()) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_NO_UNPUBLISHING_RULE_FOUND_FOR_REQUEST", "certs", req.getRequestId().toString()));
@@ -1189,7 +1186,7 @@ public class PublisherProcessor implements
ILdapPublisher publisher = null;
// get mapper and publisher for cert type.
- Enumeration rules = getRules(PROP_LOCAL_CRL);
+ Enumeration<ILdapRule> rules = getRules(PROP_LOCAL_CRL);
if (rules == null || !rules.hasMoreElements()) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_NO_RULE_FOR_CRL"));
@@ -1279,7 +1276,7 @@ public class PublisherProcessor implements
if (!enabled())
return;
// get mapper and publisher for cert type.
- Enumeration rules = getRules(PROP_LOCAL_CRL);
+ Enumeration<ILdapRule> rules = getRules(PROP_LOCAL_CRL);
if (rules == null || !rules.hasMoreElements()) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_NO_RULE_FOR_CRL"));
@@ -1364,9 +1361,10 @@ public class PublisherProcessor implements
try {
if (dirdn instanceof Vector) {
- int n = ((Vector)dirdn).size();
+ Vector<?> dirdnVector = (Vector<?>)dirdn;
+ int n = dirdnVector.size();
for (int i = 0; i < n; i++) {
- publisher.publish(conn, (String)(((Vector)dirdn).elementAt(i)), cert);
+ publisher.publish(conn, (String)dirdnVector.elementAt(i), cert);
}
} else if (dirdn instanceof String ||
publisher instanceof com.netscape.cms.publish.publishers.FileBasedPublisher) {