diff options
164 files changed, 1639 insertions, 2273 deletions
diff --git a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java index 8c59d42d8..94693d69a 100644 --- a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java +++ b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java @@ -49,7 +49,6 @@ import com.netscape.certsrv.ca.ICMSCRLExtensions; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.common.Constants; -import com.netscape.certsrv.common.NameValuePair; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; import com.netscape.cms.crl.CMSIssuingDistributionPointExtension; @@ -521,14 +520,14 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { */ if (mEnabledCRLExtensions.contains(id)) { - nvp.add(PROP_ENABLE, Constants.TRUE); + nvp.put(PROP_ENABLE, Constants.TRUE); } else { - nvp.add(PROP_ENABLE, Constants.FALSE); + nvp.put(PROP_ENABLE, Constants.FALSE); } if (mCriticalCRLExtensions.contains(id)) { - nvp.add(PROP_CRITICAL, Constants.TRUE); + nvp.put(PROP_CRITICAL, Constants.TRUE); } else { - nvp.add(PROP_CRITICAL, Constants.FALSE); + nvp.put(PROP_CRITICAL, Constants.FALSE); } if (mCRLExtensionClassNames.containsKey(id)) { @@ -563,7 +562,7 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { String idName = name.substring(i + 1); if (idName != null) { - nvp.add(Constants.PR_CRLEXT_IMPL_NAME, idName); + nvp.put(Constants.PR_CRLEXT_IMPL_NAME, idName); } } } @@ -574,17 +573,15 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { public void setConfigParams(String id, NameValuePairs nvp, IConfigStore config) { ICertificateAuthority ca = (ICertificateAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_CA); - String ipId = nvp.getValue("id"); + String ipId = nvp.get("id"); ICRLIssuingPoint ip = null; if (ipId != null && ca != null) { ip = ca.getCRLIssuingPoint(ipId); } - for (int i = 0; i < nvp.size(); i++) { - NameValuePair p = nvp.elementAt(i); - String name = p.getName(); - String value = p.getValue(); + for (String name : nvp.keySet()) { + String value = nvp.get(name); if (name.equals(PROP_ENABLE)) { if (!(value.equals(Constants.TRUE) || value.equals(Constants.FALSE))) { @@ -647,7 +644,7 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { if (value.equals(Constants.TRUE) && (issuingDistPointExtEnabled == true)) { if (crlCACertsOnly == false) { CMS.debug(" value = true and CRLCACertsOnly is already false."); - crlIssuingPointPairs.add(Constants.PR_CA_CERTS_ONLY, Constants.TRUE); + crlIssuingPointPairs.put(Constants.PR_CA_CERTS_ONLY, Constants.TRUE); newValue = Constants.TRUE; ip.updateConfig(crlIssuingPointPairs); modifiedCRLConfig = true; @@ -656,7 +653,7 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { //If the CRLCACertsOnly prop is true change it to false to sync. if (value.equals(Constants.FALSE) && (issuingDistPointExtEnabled == true)) { - crlIssuingPointPairs.add(Constants.PR_CA_CERTS_ONLY, Constants.FALSE); + crlIssuingPointPairs.put(Constants.PR_CA_CERTS_ONLY, Constants.FALSE); if (ip != null) { ip.updateConfig(crlIssuingPointPairs); newValue = Constants.FALSE; diff --git a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java index 3de6128b6..dd6194101 100644 --- a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java +++ b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java @@ -58,7 +58,6 @@ import com.netscape.certsrv.ca.ICMSCRLExtensions; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.common.Constants; -import com.netscape.certsrv.common.NameValuePair; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.dbs.EDBNotAvailException; import com.netscape.certsrv.dbs.IElementProcessor; @@ -931,10 +930,8 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { boolean noRestart = true; boolean modifiedSchedule = false; - for (int i = 0; i < params.size(); i++) { - NameValuePair p = params.elementAt(i); - String name = p.getName(); - String value = p.getValue(); + for (String name : params.keySet()) { + String value = params.get(name); // -- Update Schema -- if (name.equals(Constants.PR_ENABLE_CRL)) { diff --git a/pki/base/common/src/CMakeLists.txt b/pki/base/common/src/CMakeLists.txt index ed83bb68e..6dfd322a1 100644 --- a/pki/base/common/src/CMakeLists.txt +++ b/pki/base/common/src/CMakeLists.txt @@ -90,7 +90,6 @@ set(pki-certsrv_java_SRCS com/netscape/certsrv/common/ScopeDef.java com/netscape/certsrv/common/PrefixDef.java com/netscape/certsrv/common/ConfigConstants.java - com/netscape/certsrv/common/NameValuePair.java com/netscape/certsrv/common/OpDef.java com/netscape/certsrv/common/Constants.java com/netscape/certsrv/usrgrp/EUsrGrpException.java diff --git a/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java b/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java deleted file mode 100644 index ed1d06149..000000000 --- a/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java +++ /dev/null @@ -1,68 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.certsrv.common; - -/** - * A class represents a name value pair. A name value - * pair consists of a name and a value. - * - * @version $Revision$, $Date$ - */ -public class NameValuePair { - - private String mName = null; - private String mValue = null; - - /** - * Constructs value pair object. - * - * @param name name - * @param value value - */ - public NameValuePair(String name, String value) { - mName = name; - mValue = value; - } - - /** - * Retrieves the name. - * - * @return name - */ - public String getName() { - return mName; - } - - /** - * Retrieves the value. - * - * @return value - */ - public String getValue() { - return mValue; - } - - /** - * Sets the value - * - * @param value value - */ - public void setValue(String value) { - mValue = value; - } -} diff --git a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java index 61d3cad62..0999db7bc 100644 --- a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java +++ b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java @@ -17,10 +17,8 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.common; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.LinkedHashMap; import java.util.StringTokenizer; -import java.util.Vector; /** * A class represents an ordered list of name @@ -28,13 +26,9 @@ import java.util.Vector; * * @version $Revision$, $Date$ */ -public class NameValuePairs { +public class NameValuePairs extends LinkedHashMap<String, String> { - private Vector<NameValuePair> mPairs = new Vector<NameValuePair>(); - - // an index to speed up searching - // The key is the name. The element is the NameValuePair. - private Hashtable<String, NameValuePair> index = new Hashtable<String, NameValuePair>(); + private static final long serialVersionUID = 1494507857048437440L; /** * Constructs name value pairs. @@ -43,97 +37,6 @@ public class NameValuePairs { } /** - * Adds a name value pair into this set. - * if the name already exist, the value will - * be replaced. - * - * @param name name - * @param value value - */ - public void add(String name, String value) { - NameValuePair pair = getPair(name); - - if (pair == null) { - pair = new NameValuePair(name, value); - mPairs.addElement(pair); - index.put(name, pair); - } else { - pair.setValue(value); - } - } - - /** - * Retrieves name value pair from this set. - * - * @param name name - * @return name value pair - */ - public NameValuePair getPair(String name) { - return (NameValuePair) index.get(name); - } - - /** - * Returns number of pairs in this set. - * - * @return size - */ - public int size() { - return mPairs.size(); - } - - /** - * Retrieves name value pairs in specific position. - * - * @param pos position of the value - * @return name value pair - */ - public NameValuePair elementAt(int pos) { - return (NameValuePair) mPairs.elementAt(pos); - } - - /** - * Removes all name value pairs in this set. - */ - public void removeAllPairs() { - mPairs.removeAllElements(); - index.clear(); - } - - /** - * Retrieves value of the name value pairs that matches - * the given name. - * - * @param name name - * @return value - */ - public String getValue(String name) { - NameValuePair p = getPair(name); - - if (p != null) { - return p.getValue(); - } - return null; - } - - /** - * Retrieves a list of names. - * - * @return a list of names - */ - public Enumeration<String> getNames() { - Vector<String> v = new Vector<String>(); - int size = mPairs.size(); - - for (int i = 0; i < size; i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); - - v.addElement(p.getName()); - } - //System.out.println("getNames: "+v.size()); - return v.elements(); - } - - /** * Show the content of this name value container as * string representation. * @@ -142,12 +45,13 @@ public class NameValuePairs { public String toString() { StringBuffer buf = new StringBuffer(); - for (int i = 0; i < mPairs.size(); i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); + for (String name : keySet()) { + String value = get(name); - buf.append(p.getName() + "=" + p.getValue()); + buf.append(name + "=" + value); buf.append("\n"); } + return buf.toString(); } @@ -171,17 +75,8 @@ public class NameValuePairs { String n = t.substring(0, i); String v = t.substring(i + 1); - nvp.add(n, v); + nvp.put(n, v); } return true; } - - /** - * Returns a list of name value pair object. - * - * @return name value objects - */ - public Enumeration<NameValuePair> elements() { - return mPairs.elements(); - } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java index d070cc6fd..d4cef0148 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java @@ -159,7 +159,7 @@ public class CMSAuthInfoAccessExtension } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_AIA_INVALID_NUM_ADS", e.toString())); } - nvp.add(PROP_NUM_ADS, String.valueOf(numberOfAccessDescriptions)); + nvp.put(PROP_NUM_ADS, String.valueOf(numberOfAccessDescriptions)); for (int i = 0; i < numberOfAccessDescriptions; i++) { String accessMethod = null; @@ -175,9 +175,9 @@ public class CMSAuthInfoAccessExtension } if (accessMethod != null && accessMethod.length() > 0) { - nvp.add(PROP_ACCESS_METHOD + i, accessMethod); + nvp.put(PROP_ACCESS_METHOD + i, accessMethod); } else { - nvp.add(PROP_ACCESS_METHOD + i, PROP_ACCESS_METHOD_CAISSUERS); + nvp.put(PROP_ACCESS_METHOD + i, PROP_ACCESS_METHOD_CAISSUERS); } try { @@ -189,9 +189,9 @@ public class CMSAuthInfoAccessExtension } if (accessLocationType != null && accessLocationType.length() > 0) { - nvp.add(PROP_ACCESS_LOCATION_TYPE + i, accessLocationType); + nvp.put(PROP_ACCESS_LOCATION_TYPE + i, accessLocationType); } else { - nvp.add(PROP_ACCESS_LOCATION_TYPE + i, PROP_URINAME); + nvp.put(PROP_ACCESS_LOCATION_TYPE + i, PROP_URINAME); } try { @@ -203,14 +203,14 @@ public class CMSAuthInfoAccessExtension } if (accessLocation != null && accessLocation.length() > 0) { - nvp.add(PROP_ACCESS_LOCATION + i, accessLocation); + nvp.put(PROP_ACCESS_LOCATION + i, accessLocation); } else { String hostname = CMS.getEENonSSLHost(); String port = CMS.getEENonSSLPort(); if (hostname != null && port != null) { accessLocation = "http://" + hostname + ":" + port + "/ca/ee/ca/getCAChain?op=downloadBIN"; } - nvp.add(PROP_ACCESS_LOCATION + i, accessLocation); + nvp.put(PROP_ACCESS_LOCATION + i, accessLocation); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java index 67f4736c7..b0bf20856 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java @@ -149,7 +149,7 @@ public class CMSCertificateIssuerExtension } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", e.toString())); } - nvp.add("numNames", String.valueOf(numNames)); + nvp.put("numNames", String.valueOf(numNames)); for (int i = 0; i < numNames; i++) { String nameType = null; @@ -164,9 +164,9 @@ public class CMSCertificateIssuerExtension } if (nameType != null && nameType.length() > 0) { - nvp.add("nameType" + i, nameType); + nvp.put("nameType" + i, nameType); } else { - nvp.add("nameType" + i, ""); + nvp.put("nameType" + i, ""); } String name = null; @@ -181,16 +181,16 @@ public class CMSCertificateIssuerExtension } if (name != null && name.length() > 0) { - nvp.add("name" + i, name); + nvp.put("name" + i, name); } else { - nvp.add("name" + i, ""); + nvp.put("name" + i, ""); } } if (numNames < 3) { for (int i = numNames; i < 3; i++) { - nvp.add("nameType" + i, ""); - nvp.add("name" + i, ""); + nvp.put("nameType" + i, ""); + nvp.put("name" + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java index edb6494af..72dbe5502 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java @@ -157,7 +157,7 @@ public class CMSFreshestCRLExtension log(ILogger.LL_FAILURE, "Invalid numPoints property for CRL " + "Freshest CRL extension - " + e); } - nvp.add(PROP_NUM_POINTS, String.valueOf(numPoints)); + nvp.put(PROP_NUM_POINTS, String.valueOf(numPoints)); for (int i = 0; i < numPoints; i++) { String pointType = null; @@ -171,9 +171,9 @@ public class CMSFreshestCRLExtension } if (pointType != null && pointType.length() > 0) { - nvp.add(PROP_POINTTYPE + i, pointType); + nvp.put(PROP_POINTTYPE + i, pointType); } else { - nvp.add(PROP_POINTTYPE + i, ""); + nvp.put(PROP_POINTTYPE + i, ""); } String pointName = null; @@ -187,9 +187,9 @@ public class CMSFreshestCRLExtension } if (pointName != null && pointName.length() > 0) { - nvp.add(PROP_POINTNAME + i, pointName); + nvp.put(PROP_POINTNAME + i, pointName); } else { - nvp.add(PROP_POINTNAME + i, ""); + nvp.put(PROP_POINTNAME + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java index df8d058ce..4023e3b2f 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java @@ -123,7 +123,7 @@ public class CMSHoldInstructionExtension } else { instruction = PROP_INSTR_NONE; } - nvp.add(PROP_INSTR, instruction); + nvp.put(PROP_INSTR, instruction); } public String[] getExtendedPluginInfo(Locale locale) { diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java index ee656a199..64252a0b9 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java @@ -200,7 +200,7 @@ public class CMSIssuerAlternativeNameExtension log(ILogger.LL_FAILURE, "Invalid numNames property for CRL " + "IssuerAlternativeName extension - " + e); } - nvp.add("numNames", String.valueOf(numNames)); + nvp.put("numNames", String.valueOf(numNames)); for (int i = 0; i < numNames; i++) { String nameType = null; @@ -216,9 +216,9 @@ public class CMSIssuerAlternativeNameExtension } if (nameType != null && nameType.length() > 0) { - nvp.add("nameType" + i, nameType); + nvp.put("nameType" + i, nameType); } else { - nvp.add("nameType" + i, ""); + nvp.put("nameType" + i, ""); } String name = null; @@ -234,16 +234,16 @@ public class CMSIssuerAlternativeNameExtension } if (name != null && name.length() > 0) { - nvp.add("name" + i, name); + nvp.put("name" + i, name); } else { - nvp.add("name" + i, ""); + nvp.put("name" + i, ""); } } if (numNames < 3) { for (int i = numNames; i < 3; i++) { - nvp.add("nameType" + i, ""); - nvp.add("name" + i, ""); + nvp.put("nameType" + i, ""); + nvp.put("name" + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java index 21bd86b0a..4253584ce 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java @@ -229,9 +229,9 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointType != null && pointType.length() > 0) { - nvp.add("pointType", pointType); + nvp.put("pointType", pointType); } else { - nvp.add("pointType", ""); + nvp.put("pointType", ""); } String pointName = null; @@ -244,9 +244,9 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointName != null && pointName.length() > 0) { - nvp.add("pointName", pointName); + nvp.put("pointName", pointName); } else { - nvp.add("pointName", ""); + nvp.put("pointName", ""); } String reasons = null; @@ -257,17 +257,17 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString())); } if (reasons != null && reasons.length() > 0) { - nvp.add(PROP_REASONS, reasons); + nvp.put(PROP_REASONS, reasons); } else { - nvp.add(PROP_REASONS, ""); + nvp.put(PROP_REASONS, ""); } try { boolean caCertsOnly = config.getBoolean(PROP_CACERTS, false); - nvp.add(PROP_CACERTS, String.valueOf(caCertsOnly)); + nvp.put(PROP_CACERTS, String.valueOf(caCertsOnly)); } catch (EBaseException e) { - nvp.add(PROP_CACERTS, "false"); + nvp.put(PROP_CACERTS, "false"); log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString())); } // Disable these for now unitl we support them fully diff --git a/pki/base/common/src/com/netscape/cms/logging/LogFile.java b/pki/base/common/src/com/netscape/cms/logging/LogFile.java index 0a5f18579..5144bf16d 100644 --- a/pki/base/common/src/com/netscape/cms/logging/LogFile.java +++ b/pki/base/common/src/com/netscape/cms/logging/LogFile.java @@ -1340,7 +1340,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { try { entries = readEntry(maxLine, level, source, fName); for (int i = 0; i < entries.size(); i++) { - params.add(Integer.toString(i) + + params.put(Integer.toString(i) + ((LogEntry) entries.elementAt(i)).getEntry(), ""); } } catch (Exception e) { diff --git a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java index e085937e5..93455e9fe 100644 --- a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java +++ b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java @@ -524,7 +524,7 @@ public class RollingLogFile extends LogFile { files = fileList(); for (int i = 0; i < files.length; i++) { - params.add(files[i], ""); + params.put(files[i], ""); } return params; } diff --git a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java index d3b5d545e..2482d69af 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java @@ -798,13 +798,13 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { try { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_OCSPSTORE_IMPL_NAME, + params.put(Constants.PR_OCSPSTORE_IMPL_NAME, mConfig.getString("class")); - params.add(PROP_NOT_FOUND_GOOD, + params.put(PROP_NOT_FOUND_GOOD, mConfig.getString(PROP_NOT_FOUND_GOOD, "true")); - params.add(PROP_BY_NAME, + params.put(PROP_BY_NAME, mConfig.getString(PROP_BY_NAME, "true")); - params.add(PROP_INCLUDE_NEXT_UPDATE, + params.put(PROP_INCLUDE_NEXT_UPDATE, mConfig.getString(PROP_INCLUDE_NEXT_UPDATE, "false")); return params; } catch (Exception e) { @@ -814,12 +814,9 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration<String> k = pairs.getNames(); - while (k.hasMoreElements()) { - String key = (String) k.nextElement(); - - mConfig.put(key, pairs.getValue(key)); + for (String key : pairs.keySet()) { + mConfig.put(key, pairs.get(key)); } } diff --git a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java index 697d1bb40..11e91fdeb 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -531,34 +531,34 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { try { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_OCSPSTORE_IMPL_NAME, + params.put(Constants.PR_OCSPSTORE_IMPL_NAME, mConfig.getString("class")); int num = mConfig.getInteger(PROP_NUM_CONNS, 0); - params.add(PROP_NUM_CONNS, Integer.toString(num)); + params.put(PROP_NUM_CONNS, Integer.toString(num)); for (int i = 0; i < num; i++) { - params.add(PROP_HOST + Integer.toString(i), + params.put(PROP_HOST + Integer.toString(i), mConfig.getString(PROP_HOST + Integer.toString(i), "")); - params.add(PROP_PORT + Integer.toString(i), + params.put(PROP_PORT + Integer.toString(i), mConfig.getString(PROP_PORT + Integer.toString(i), "389")); - params.add(PROP_BASE_DN + Integer.toString(i), + params.put(PROP_BASE_DN + Integer.toString(i), mConfig.getString(PROP_BASE_DN + Integer.toString(i), "")); - params.add(PROP_REFRESH_IN_SEC + Integer.toString(i), + params.put(PROP_REFRESH_IN_SEC + Integer.toString(i), mConfig.getString(PROP_REFRESH_IN_SEC + Integer.toString(i), Integer.toString(DEF_REFRESH_IN_SEC))); } - params.add(PROP_BY_NAME, + params.put(PROP_BY_NAME, mConfig.getString(PROP_BY_NAME, "true")); - params.add(PROP_CA_CERT_ATTR, + params.put(PROP_CA_CERT_ATTR, mConfig.getString(PROP_CA_CERT_ATTR, DEF_CA_CERT_ATTR)); - params.add(PROP_CRL_ATTR, + params.put(PROP_CRL_ATTR, mConfig.getString(PROP_CRL_ATTR, DEF_CRL_ATTR)); - params.add(PROP_NOT_FOUND_GOOD, + params.put(PROP_NOT_FOUND_GOOD, mConfig.getString(PROP_NOT_FOUND_GOOD, "true")); - params.add(PROP_INCLUDE_NEXT_UPDATE, + params.put(PROP_INCLUDE_NEXT_UPDATE, mConfig.getString(PROP_INCLUDE_NEXT_UPDATE, "false")); return params; } catch (Exception e) { @@ -568,12 +568,9 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration<String> k = pairs.getNames(); - while (k.hasMoreElements()) { - String key = k.nextElement(); - - mConfig.put(key, pairs.getValue(key)); + for (String key : pairs.keySet()) { + mConfig.put(key, pairs.get(key)); } } } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java index cab594188..7f624cb8b 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java @@ -615,15 +615,12 @@ public abstract class BasicProfile implements IProfile { outputInfo.getName(Locale.getDefault())); outputStore.putString(prefix + "class_id", outputId); - Enumeration<String> enum1 = nvps.getNames(); + for (String name : nvps.keySet()) { - while (enum1.hasMoreElements()) { - String name = enum1.nextElement(); - - outputStore.putString(prefix + "params." + name, nvps.getValue(name)); + outputStore.putString(prefix + "params." + name, nvps.get(name)); try { if (output != null) { - output.setConfig(name, nvps.getValue(name)); + output.setConfig(name, nvps.get(name)); } } catch (EBaseException e) { CMS.debug(e.toString()); @@ -718,15 +715,12 @@ public abstract class BasicProfile implements IProfile { inputInfo.getName(Locale.getDefault())); inputStore.putString(prefix + "class_id", inputId); - Enumeration<String> enum1 = nvps.getNames(); - - while (enum1.hasMoreElements()) { - String name = enum1.nextElement(); + for (String name : nvps.keySet()) { - inputStore.putString(prefix + "params." + name, nvps.getValue(name)); + inputStore.putString(prefix + "params." + name, nvps.get(name)); try { if (input != null) { - input.setConfig(name, nvps.getValue(name)); + input.setConfig(name, nvps.get(name)); } } catch (EBaseException e) { CMS.debug(e.toString()); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java index f23b7e24c..76ea4e143 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java @@ -225,7 +225,7 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { } boolean critical = ext.isCritical(); - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); ext = new AuthInfoAccessExtension(critical); @@ -235,20 +235,18 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { String enable = null; for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(AD_METHOD)) { - method = nvps.getValue(name1); + method = nvps.get(name1); } else if (name1.equals(AD_LOCATION_TYPE)) { - locationType = nvps.getValue(name1); + locationType = nvps.get(name1); } else if (name1.equals(AD_LOCATION)) { - location = nvps.getValue(name1); + location = nvps.get(name1); } else if (name1.equals(AD_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -352,18 +350,18 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { des = ext.getAccessDescription(i); } if (des == null) { - np.add(AD_METHOD, ""); - np.add(AD_LOCATION_TYPE, ""); - np.add(AD_LOCATION, ""); - np.add(AD_ENABLE, "false"); + np.put(AD_METHOD, ""); + np.put(AD_LOCATION_TYPE, ""); + np.put(AD_LOCATION, ""); + np.put(AD_ENABLE, "false"); } else { ObjectIdentifier methodOid = des.getMethod(); GeneralName gn = des.getLocation(); - np.add(AD_METHOD, methodOid.toString()); - np.add(AD_LOCATION_TYPE, getGeneralNameType(gn)); - np.add(AD_LOCATION, getGeneralNameValue(gn)); - np.add(AD_ENABLE, "true"); + np.put(AD_METHOD, methodOid.toString()); + np.put(AD_LOCATION_TYPE, getGeneralNameType(gn)); + np.put(AD_LOCATION, getGeneralNameValue(gn)); + np.put(AD_ENABLE, "true"); } recs.addElement(np); } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java index a95ec6b7d..c7a0f9abd 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java @@ -247,8 +247,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { int i = 0; for (; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); String pointType = null; String pointValue = null; String issuerType = null; @@ -256,21 +255,20 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { String enable = null; CRLDistributionPoint cdp = new CRLDistributionPoint(); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(REASONS)) { - addReasons(locale, cdp, REASONS, nvps.getValue(name1)); + addReasons(locale, cdp, REASONS, nvps.get(name1)); } else if (name1.equals(POINT_TYPE)) { - pointType = nvps.getValue(name1); + pointType = nvps.get(name1); } else if (name1.equals(POINT_NAME)) { - pointValue = nvps.getValue(name1); + pointValue = nvps.get(name1); } else if (name1.equals(ISSUER_TYPE)) { - issuerType = nvps.getValue(name1); + issuerType = nvps.get(name1); } else if (name1.equals(ISSUER_NAME)) { - issuerValue = nvps.getValue(name1); + issuerValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -466,12 +464,12 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { protected NameValuePairs buildEmptyGeneralNames() { NameValuePairs pairs = new NameValuePairs(); - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); - pairs.add(REASONS, ""); - pairs.add(ISSUER_TYPE, ""); - pairs.add(ISSUER_NAME, ""); - pairs.add(ENABLE, "false"); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); + pairs.put(REASONS, ""); + pairs.put(ISSUER_TYPE, ""); + pairs.put(ISSUER_NAME, ""); + pairs.put(ENABLE, "false"); return pairs; } @@ -483,16 +481,16 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { RDN rdn = null; boolean hasFullName = false; - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); if (gns == null) { rdn = p.getRelativeName(); if (rdn != null) { hasFullName = true; - pairs.add(POINT_TYPE, RELATIVETOISSUER); - pairs.add(POINT_NAME, rdn.toString()); + pairs.put(POINT_TYPE, RELATIVETOISSUER); + pairs.put(POINT_NAME, rdn.toString()); } else { - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); } } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -501,30 +499,30 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(POINT_TYPE, getGeneralNameType(gn)); - pairs.add(POINT_NAME, getGeneralNameValue(gn)); + pairs.put(POINT_TYPE, getGeneralNameType(gn)); + pairs.put(POINT_NAME, getGeneralNameValue(gn)); } } if (!hasFullName) { - pairs.add(POINT_TYPE, GN_DIRECTORY_NAME); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, GN_DIRECTORY_NAME); + pairs.put(POINT_NAME, ""); } BitArray reasons = p.getReasons(); String s = convertBitArrayToReasonNames(reasons); if (s.length() > 0) { - pairs.add(REASONS, s); + pairs.put(REASONS, s); } else { - pairs.add(REASONS, ""); + pairs.put(REASONS, ""); } gns = p.getCRLIssuer(); if (gns == null) { - pairs.add(ISSUER_TYPE, GN_DIRECTORY_NAME); - pairs.add(ISSUER_NAME, ""); + pairs.put(ISSUER_TYPE, GN_DIRECTORY_NAME); + pairs.put(ISSUER_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -532,8 +530,8 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(ISSUER_TYPE, getGeneralNameType(gn)); - pairs.add(ISSUER_NAME, getGeneralNameValue(gn)); + pairs.put(ISSUER_TYPE, getGeneralNameType(gn)); + pairs.put(ISSUER_NAME, getGeneralNameValue(gn)); } } return pairs; 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 855cd92c7..5310986d5 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 @@ -641,11 +641,9 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe sb.append("Record #"); sb.append(i); sb.append("\r\n"); - Enumeration<String> e = pairs.getNames(); - while (e.hasMoreElements()) { - String key = e.nextElement(); - String val = pairs.getValue(key); + for (String key : pairs.keySet()) { + String val = pairs.get(key); sb.append(key); sb.append(":"); @@ -691,9 +689,9 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe throw new EPropertyException("Bad Input Format"); } else { if (pos == (token.length() - 1)) { - nvps.add(token.substring(0, pos), ""); + nvps.put(token.substring(0, pos), ""); } else { - nvps.add(token.substring(0, pos), token.substring(pos + 1)); + nvps.put(token.substring(0, pos), token.substring(pos + 1)); } } } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java index a2de3f491..739fd3448 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java @@ -230,8 +230,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { int i = 0; for (; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); String pointType = null; String pointValue = null; String issuerType = null; @@ -239,19 +238,18 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { String enable = null; CRLDistributionPoint cdp = new CRLDistributionPoint(); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(POINT_TYPE)) { - pointType = nvps.getValue(name1); + pointType = nvps.get(name1); } else if (name1.equals(POINT_NAME)) { - pointValue = nvps.getValue(name1); + pointValue = nvps.get(name1); } else if (name1.equals(ISSUER_TYPE)) { - issuerType = nvps.getValue(name1); + issuerType = nvps.get(name1); } else if (name1.equals(ISSUER_NAME)) { - issuerValue = nvps.getValue(name1); + issuerValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -409,11 +407,11 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { protected NameValuePairs buildEmptyGeneralNames() { NameValuePairs pairs = new NameValuePairs(); - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); - pairs.add(ISSUER_TYPE, ""); - pairs.add(ISSUER_NAME, ""); - pairs.add(ENABLE, "false"); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); + pairs.put(ISSUER_TYPE, ""); + pairs.put(ISSUER_NAME, ""); + pairs.put(ENABLE, "false"); return pairs; } @@ -424,10 +422,10 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { boolean hasFullName = false; - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); if (gns == null) { - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -435,21 +433,21 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(POINT_TYPE, getGeneralNameType(gn)); - pairs.add(POINT_NAME, getGeneralNameValue(gn)); + pairs.put(POINT_TYPE, getGeneralNameType(gn)); + pairs.put(POINT_NAME, getGeneralNameValue(gn)); } } if (!hasFullName) { - pairs.add(POINT_TYPE, GN_DIRECTORY_NAME); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, GN_DIRECTORY_NAME); + pairs.put(POINT_NAME, ""); } gns = p.getCRLIssuer(); if (gns == null) { - pairs.add(ISSUER_TYPE, GN_DIRECTORY_NAME); - pairs.add(ISSUER_NAME, ""); + pairs.put(ISSUER_TYPE, GN_DIRECTORY_NAME); + pairs.put(ISSUER_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -457,8 +455,8 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(ISSUER_TYPE, getGeneralNameType(gn)); - pairs.add(ISSUER_NAME, getGeneralNameValue(gn)); + pairs.put(ISSUER_TYPE, getGeneralNameType(gn)); + pairs.put(ISSUER_NAME, getGeneralNameValue(gn)); } } return pairs; 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 c513c332b..e57d04067 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 @@ -366,20 +366,18 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { Vector<GeneralSubtree> subtrees = new Vector<GeneralSubtree>(); for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(GENERAL_NAME_CHOICE)) { - choice = nvps.getValue(name1); + choice = nvps.get(name1); } else if (name1.equals(GENERAL_NAME_VALUE)) { - val = nvps.getValue(name1); + val = nvps.get(name1); } else if (name1.equals(MIN_VALUE)) { - minS = nvps.getValue(name1); + minS = nvps.get(name1); } else if (name1.equals(MAX_VALUE)) { - maxS = nvps.getValue(name1); + maxS = nvps.get(name1); } } @@ -527,11 +525,11 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { NameValuePairs pairs = new NameValuePairs(); - pairs.add(GENERAL_NAME_CHOICE, type); - pairs.add(GENERAL_NAME_VALUE, getGeneralNameValue(gn)); - pairs.add(MIN_VALUE, Integer.toString(min)); - pairs.add(MAX_VALUE, Integer.toString(max)); - pairs.add(ENABLE, "true"); + pairs.put(GENERAL_NAME_CHOICE, type); + pairs.put(GENERAL_NAME_VALUE, getGeneralNameValue(gn)); + pairs.put(MIN_VALUE, Integer.toString(min)); + pairs.put(MAX_VALUE, Integer.toString(max)); + pairs.put(ENABLE, "true"); recs.addElement(pairs); } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java index 183ef87bc..1f05fef3e 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java @@ -216,18 +216,16 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { Vector<CertificatePolicyMap> policyMaps = new Vector<CertificatePolicyMap>(); for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(ISSUER_POLICY_ID)) { - issuerPolicyId = nvps.getValue(name1); + issuerPolicyId = nvps.get(name1); } else if (name1.equals(SUBJECT_POLICY_ID)) { - subjectPolicyId = nvps.getValue(name1); + subjectPolicyId = nvps.get(name1); } else if (name1.equals(POLICY_ID_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -327,13 +325,13 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { CertificatePolicyId i1 = map.getIssuerIdentifier(); CertificatePolicyId s1 = map.getSubjectIdentifier(); - pairs.add(ISSUER_POLICY_ID, i1.getIdentifier().toString()); - pairs.add(SUBJECT_POLICY_ID, s1.getIdentifier().toString()); - pairs.add(POLICY_ID_ENABLE, "true"); + pairs.put(ISSUER_POLICY_ID, i1.getIdentifier().toString()); + pairs.put(SUBJECT_POLICY_ID, s1.getIdentifier().toString()); + pairs.put(POLICY_ID_ENABLE, "true"); } else { - pairs.add(ISSUER_POLICY_ID, ""); - pairs.add(SUBJECT_POLICY_ID, ""); - pairs.add(POLICY_ID_ENABLE, "false"); + pairs.put(ISSUER_POLICY_ID, ""); + pairs.put(SUBJECT_POLICY_ID, ""); + pairs.put(POLICY_ID_ENABLE, "false"); } recs.addElement(pairs); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java index a706fb4ad..cca5ab234 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java @@ -220,19 +220,18 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { Vector<Attribute> attrV = new Vector<Attribute>(); for (int i = 0; i < size; i++) { NameValuePairs nvps = v.elementAt(i); - Enumeration<String> names = nvps.getNames(); String attrName = null; String attrValue = null; String enable = "false"; - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + + for (String name1 : nvps.keySet()) { if (name1.equals(ATTR_NAME)) { - attrName = nvps.getValue(name1); + attrName = nvps.get(name1); } else if (name1.equals(ATTR_VALUE)) { - attrValue = nvps.getValue(name1); + attrValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -316,7 +315,7 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { while (e.hasMoreElements()) { NameValuePairs pairs = new NameValuePairs(); - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); Attribute attr = e.nextElement(); CMS.debug("SubjectDirAttributesExtDefault: getValue: attribute=" + attr); ObjectIdentifier oid = attr.getOid(); @@ -325,9 +324,9 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { String vv = map.getName(oid); if (vv != null) - pairs.add(ATTR_NAME, vv); + pairs.put(ATTR_NAME, vv); else - pairs.add(ATTR_NAME, oid.toString()); + pairs.put(ATTR_NAME, oid.toString()); Enumeration<String> v = attr.getValues(); // just support single value for now @@ -341,16 +340,16 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { } } - pairs.add(ATTR_VALUE, ss.toString()); + pairs.put(ATTR_VALUE, ss.toString()); recs.addElement(pairs); i++; } for (; i < num; i++) { NameValuePairs pairs = new NameValuePairs(); - pairs.add(ENABLE, "false"); - pairs.add(ATTR_NAME, "GENERATIONQUALIFIER"); - pairs.add(ATTR_VALUE, ""); + pairs.put(ENABLE, "false"); + pairs.put(ATTR_NAME, "GENERATIONQUALIFIER"); + pairs.put(ATTR_VALUE, ""); recs.addElement(pairs); } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java index 670728e59..104b29a08 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java @@ -231,19 +231,17 @@ public class SubjectInfoAccessExtDefault extends EnrollExtDefault { for (int i = 0; i < size; i++) { NameValuePairs nvps = v.elementAt(i); - Enumeration<String> names = nvps.getNames(); - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(AD_METHOD)) { - method = nvps.getValue(name1); + method = nvps.get(name1); } else if (name1.equals(AD_LOCATION_TYPE)) { - locationType = nvps.getValue(name1); + locationType = nvps.get(name1); } else if (name1.equals(AD_LOCATION)) { - location = nvps.getValue(name1); + location = nvps.get(name1); } else if (name1.equals(AD_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -347,18 +345,18 @@ public class SubjectInfoAccessExtDefault extends EnrollExtDefault { des = ext.getAccessDescription(i); } if (des == null) { - np.add(AD_METHOD, ""); - np.add(AD_LOCATION_TYPE, ""); - np.add(AD_LOCATION, ""); - np.add(AD_ENABLE, "false"); + np.put(AD_METHOD, ""); + np.put(AD_LOCATION_TYPE, ""); + np.put(AD_LOCATION, ""); + np.put(AD_ENABLE, "false"); } else { ObjectIdentifier methodOid = des.getMethod(); GeneralName gn = des.getLocation(); - np.add(AD_METHOD, methodOid.toString()); - np.add(AD_LOCATION_TYPE, getGeneralNameType(gn)); - np.add(AD_LOCATION, getGeneralNameValue(gn)); - np.add(AD_ENABLE, "true"); + np.put(AD_METHOD, methodOid.toString()); + np.put(AD_LOCATION_TYPE, getGeneralNameType(gn)); + np.put(AD_LOCATION, getGeneralNameValue(gn)); + np.put(AD_ENABLE, "true"); } recs.addElement(np); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java index 29088fc2d..bde075334 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java @@ -260,9 +260,9 @@ public class ACLAdminServlet extends AdminServlet { String desc = acl.getDescription(); if (desc == null) - params.add(acl.getName(), ""); + params.put(acl.getName(), ""); else - params.add(acl.getName(), desc); + params.put(acl.getName(), desc); } sendResponse(SUCCESS, null, params, resp); @@ -305,7 +305,7 @@ public class ACLAdminServlet extends AdminServlet { } } - params.add(Constants.PR_ACL_OPS, rights.toString()); + params.put(Constants.PR_ACL_OPS, rights.toString()); Enumeration<ACLEntry> aclEntryEnum; aclEntryEnum = acl.entries(); @@ -323,7 +323,7 @@ public class ACLAdminServlet extends AdminServlet { } } - params.add(Constants.PR_ACI, acis); + params.put(Constants.PR_ACI, acis); sendResponse(SUCCESS, null, params, resp); return; @@ -472,7 +472,7 @@ public class ACLAdminServlet extends AdminServlet { IAccessEvaluator evaluator = res.nextElement(); // params.add(evaluator.getType(), evaluator.getDescription()); - params.add(evaluator.getType(), evaluator.getClass().getName()); + params.put(evaluator.getType(), evaluator.getClass().getName()); } sendResponse(SUCCESS, null, params, resp); @@ -495,7 +495,7 @@ public class ACLAdminServlet extends AdminServlet { str.append(operators[i]); } - params.add(evaluator.getType(), str.toString()); + params.put(evaluator.getType(), str.toString()); } sendResponse(SUCCESS, null, params, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java index 0e3d2c228..c7d7d619e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java @@ -21,7 +21,9 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.security.cert.X509Certificate; +import java.util.Collection; import java.util.Enumeration; +import java.util.Iterator; import java.util.Locale; import java.util.StringTokenizer; @@ -794,17 +796,17 @@ public class AdminServlet extends HttpServlet { StringBuffer buf = new StringBuffer(); if (params != null) { - Enumeration<String> e = params.getNames(); + Collection<String> names = params.keySet(); - if (e.hasMoreElements()) { - while (e.hasMoreElements()) { - String name = e.nextElement(); - String value = java.net.URLEncoder.encode((String) - params.getValue(name)); + if (!names.isEmpty()) { + for (Iterator<String> i = names.iterator(); i.hasNext(); ) { + String name = i.next(); + String value = java.net.URLEncoder.encode( + params.get(name)); buf.append(java.net.URLEncoder.encode(name) + "=" + value); - if (e.hasMoreElements()) + if (i.hasNext()) buf.append("&"); } byte content[] = buf.toString().getBytes(); @@ -875,7 +877,7 @@ public class AdminServlet extends HttpServlet { //System.out.println(name); //System.out.println(name+","+config.getString(name)); - params.add(name, config.getString(name)); + params.put(name, config.getString(name)); } sendResponse(SUCCESS, null, params, resp); } @@ -925,7 +927,7 @@ public class AdminServlet extends HttpServlet { while (e.hasMoreElements()) { String s = e.nextElement(); - params.add(s, config.getString(s)); + params.put(s, config.getString(s)); } sendResponse(SUCCESS, null, params, resp); } @@ -1275,7 +1277,7 @@ public class AdminServlet extends HttpServlet { String paramName = s[i].substring(0, j); String args = s[i].substring(j + 1); - nvps.add(paramName, args); + nvps.put(paramName, args); } return nvps; diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java index 6a7ad9599..cacd0b5d0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java @@ -168,7 +168,7 @@ public class AuthAdminServlet extends AdminServlet { // no need to authenticate this. if we're alive, return true. NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PING, Constants.TRUE); + params.put(Constants.PR_PING, Constants.TRUE); sendResponse(SUCCESS, null, params, resp); return; } else { @@ -188,7 +188,7 @@ public class AuthAdminServlet extends AdminServlet { String val = configStore.getString("authType", "pwd"); NameValuePairs params = new NameValuePairs(); - params.add("authType", val); + params.put("authType", val); sendResponse(SUCCESS, null, params, resp); return; } @@ -856,7 +856,7 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_AUTH_IMPL_NAME, implname); + params.put(Constants.PR_AUTH_IMPL_NAME, implname); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( @@ -921,7 +921,7 @@ public class AuthAdminServlet extends AdminServlet { mAuths.getPlugins().get(name); if (value.isVisible()) { - params.add(name, value.getClassPath() + EDIT); + params.put(name, value.getClassPath() + EDIT); } } sendResponse(SUCCESS, null, params, resp); @@ -948,9 +948,9 @@ public class AuthAdminServlet extends AdminServlet { mAuths.getPlugins().get(value.getImplName()); if (!amgrplugin.isVisible()) { - params.add(name, value.getImplName() + ";invisible;" + enableStr); + params.put(name, value.getImplName() + ";invisible;" + enableStr); } else { - params.add(name, value.getImplName() + ";visible;" + enableStr); + params.put(name, value.getImplName() + ";visible;" + enableStr); } } sendResponse(SUCCESS, null, params, resp); @@ -1316,10 +1316,10 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_AUTH_IMPL_NAME, ""); + params.put(Constants.PR_AUTH_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.length; i++) { - params.add(configParams[i], ""); + params.put(configParams[i], ""); } } sendResponse(0, null, params, resp); @@ -1355,7 +1355,7 @@ public class AuthAdminServlet extends AdminServlet { String[] configParams = mgrInst.getConfigParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_AUTH_IMPL_NAME, mgrInst.getImplName()); + params.put(Constants.PR_AUTH_IMPL_NAME, mgrInst.getImplName()); // implName is always required so always send it. if (configParams != null) { for (int i = 0; i < configParams.length; i++) { @@ -1363,9 +1363,9 @@ public class AuthAdminServlet extends AdminServlet { String val = (String) config.get(key); if (val != null) { - params.add(key, val); + params.put(key, val); } else { - params.add(key, ""); + params.put(key, ""); } } } @@ -1501,7 +1501,7 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add(IAuthSubsystem.PROP_PLUGIN, + saveParams.put(IAuthSubsystem.PROP_PLUGIN, (String) oldConfig.get(IAuthSubsystem.PROP_PLUGIN)); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.length; i++) { @@ -1509,7 +1509,7 @@ public class AuthAdminServlet extends AdminServlet { Object val = oldConfig.get(key); if (val != null) { - saveParams.add(key, (String) val); + saveParams.put(key, (String) val); } } } @@ -1711,11 +1711,8 @@ public class AuthAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java index 5bcaa46d2..e7b32e844 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java @@ -243,10 +243,10 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, rc.getString(name, "")); + params.put(name, rc.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, rc.getString(PROP_ENABLED, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -304,10 +304,10 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, riq.getString(name, "")); + params.put(name, riq.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, riq.getString(PROP_ENABLED, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -462,8 +462,8 @@ public class CAAdminServlet extends AdminServlet { String ipId = ip.getId(); if (ipId != null && ipId.length() > 0) - params.add(ipId, ip.getDescription()); - params.add(ipId + "." + Constants.PR_ENABLED, + params.put(ipId, ip.getDescription()); + params.put(ipId + "." + Constants.PR_ENABLED, (Boolean.valueOf(ip.isCRLIssuingPointEnabled())).toString()); } } @@ -504,7 +504,7 @@ public class CAAdminServlet extends AdminServlet { if (name.equals(Constants.PR_CLASS)) value = ip.getClass().getName(); - params.add(name, value); + params.put(name, value); } } } @@ -552,7 +552,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP name", null, resp); return; } - params.add(Constants.PR_ID, ipId); + params.put(Constants.PR_ID, ipId); String desc = req.getParameter(Constants.PR_DESCRIPTION); @@ -569,7 +569,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP description", null, resp); return; } - params.add(Constants.PR_DESCRIPTION, desc); + params.put(Constants.PR_DESCRIPTION, desc); String sEnable = req.getParameter(Constants.PR_ENABLED); boolean enable = true; @@ -577,9 +577,9 @@ public class CAAdminServlet extends AdminServlet { if (sEnable != null && sEnable.length() > 0 && sEnable.equalsIgnoreCase(Constants.FALSE)) { enable = false; - params.add(Constants.PR_ENABLED, Constants.FALSE); + params.put(Constants.PR_ENABLED, Constants.FALSE); } else { - params.add(Constants.PR_ENABLED, Constants.TRUE); + params.put(Constants.PR_ENABLED, Constants.TRUE); } IConfigStore crlSubStore = @@ -708,7 +708,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP name", null, resp); return; } - params.add(Constants.PR_ID, ipId); + params.put(Constants.PR_ID, ipId); String desc = req.getParameter(Constants.PR_DESCRIPTION); @@ -725,7 +725,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP description", null, resp); return; } - params.add(Constants.PR_DESCRIPTION, desc); + params.put(Constants.PR_DESCRIPTION, desc); String sEnable = req.getParameter(Constants.PR_ENABLED); boolean enable = true; @@ -733,9 +733,9 @@ public class CAAdminServlet extends AdminServlet { if (sEnable != null && sEnable.length() > 0 && sEnable.equalsIgnoreCase(Constants.FALSE)) { enable = false; - params.add(Constants.PR_ENABLED, Constants.FALSE); + params.put(Constants.PR_ENABLED, Constants.FALSE); } else { - params.add(Constants.PR_ENABLED, Constants.TRUE); + params.put(Constants.PR_ENABLED, Constants.TRUE); } IConfigStore crlSubStore = @@ -1036,7 +1036,7 @@ public class CAAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); } crlExts.setConfigParams(id, params, crlExtSubStore); commit(true); @@ -1125,7 +1125,7 @@ public class CAAdminServlet extends AdminServlet { crlExtEnabled = crlExtSubStore.getBoolean(name, false); } } - params.add(extName, extName + ";visible;" + ((crlExtEnabled) ? "enabled" : "disabled")); + params.put(extName, extName + ";visible;" + ((crlExtEnabled) ? "enabled" : "disabled")); } } @@ -1245,7 +1245,7 @@ public class CAAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); crlSubStore.putString(name, value); } boolean noRestart = ip.updateConfig(params); @@ -1334,7 +1334,7 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, crlSubStore.getString(name, "")); + params.put(name, crlSubStore.getString(name, "")); } getSigningAlgConfig(params); @@ -1369,7 +1369,7 @@ public class CAAdminServlet extends AdminServlet { if (name.equals(Constants.OP_TYPE)) continue; - params.add(name, caConnectorConfig.getString(name, "")); + params.put(name, caConnectorConfig.getString(name, "")); } } sendResponse(SUCCESS, null, params, resp); @@ -1488,7 +1488,7 @@ public class CAAdminServlet extends AdminServlet { IConfigStore caConfig = mCA.getConfigStore(); value = caConfig.getString(ICertificateAuthority.PROP_ENABLE_PAST_CATIME, "false"); - params.add(Constants.PR_VALIDITY, value); + params.put(Constants.PR_VALIDITY, value); getSigningAlgConfig(params); getSerialConfig(params); @@ -1498,7 +1498,7 @@ public class CAAdminServlet extends AdminServlet { } private void getSigningAlgConfig(NameValuePairs params) { - params.add(Constants.PR_DEFAULT_ALGORITHM, + params.put(Constants.PR_DEFAULT_ALGORITHM, mCA.getDefaultAlgorithm()); String[] algorithms = mCA.getCASigningAlgorithms(); StringBuffer algorStr = new StringBuffer(); @@ -1511,16 +1511,16 @@ public class CAAdminServlet extends AdminServlet { algorStr.append(algorithms[i]); } } - params.add(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); + params.put(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); } private void getSerialConfig(NameValuePairs params) { - params.add(Constants.PR_SERIAL, + params.put(Constants.PR_SERIAL, mCA.getStartSerial()); } private void getMaxSerialConfig(NameValuePairs params) { - params.add(Constants.PR_MAXSERIAL, + params.put(Constants.PR_MAXSERIAL, mCA.getMaxSerial()); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java index 58fb1d03f..3a2ae0a11 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java @@ -320,9 +320,9 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); if (File.separator.equals("\\")) - params.add(Constants.PR_NT, Constants.TRUE); + params.put(Constants.PR_NT, Constants.TRUE); else - params.add(Constants.PR_NT, Constants.FALSE); + params.put(Constants.PR_NT, Constants.FALSE); sendResponse(SUCCESS, null, params, resp); } @@ -335,7 +335,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_TOKEN_LIST, jssSubSystem.getTokenList()); + params.put(Constants.PR_TOKEN_LIST, jssSubSystem.getTokenList()); sendResponse(SUCCESS, null, params, resp); } @@ -348,7 +348,7 @@ public final class CMSAdminServlet extends AdminServlet { ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - params.add(Constants.PR_ALL_NICKNAMES, jssSubSystem.getAllCerts()); + params.put(Constants.PR_ALL_NICKNAMES, jssSubSystem.getAllCerts()); sendResponse(SUCCESS, null, params, resp); } @@ -405,10 +405,10 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_CIPHER_VERSION, + params.put(Constants.PR_CIPHER_VERSION, jssSubSystem.getCipherVersion()); - params.add(Constants.PR_CIPHER_FORTEZZA, jssSubSystem.isCipherFortezza()); - params.add(Constants.PR_CIPHER_PREF, jssSubSystem.getCipherPreferences()); + params.put(Constants.PR_CIPHER_FORTEZZA, jssSubSystem.isCipherFortezza()); + params.put(Constants.PR_CIPHER_PREF, jssSubSystem.getCipherPreferences()); String tokenList = jssSubSystem.getTokenList(); @@ -426,10 +426,10 @@ public final class CMSAdminServlet extends AdminServlet { else tokenNewList = tokenNewList + "," + tokenName; tokenName = escapeString(tokenName); - params.add(Constants.PR_TOKEN_PREFIX + tokenName, certs); + params.put(Constants.PR_TOKEN_PREFIX + tokenName, certs); } - params.add(Constants.PR_TOKEN_LIST, tokenNewList); + params.put(Constants.PR_TOKEN_LIST, tokenNewList); if (isCAInstalled) { ICertificateAuthority ca = (ICertificateAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_CA); @@ -443,7 +443,7 @@ public final class CMSAdminServlet extends AdminServlet { String caNickName = signingUnit.getNickname(); //params.add(Constants.PR_CERT_CA, caTokenName+","+caNickName); - params.add(Constants.PR_CERT_CA, getCertNickname(caNickName)); + params.put(Constants.PR_CERT_CA, getCertNickname(caNickName)); } if (isRAInstalled) { @@ -451,7 +451,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_RA); String raNickname = ra.getNickname(); - params.add(Constants.PR_CERT_RA, getCertNickname(raNickname)); + params.put(Constants.PR_CERT_RA, getCertNickname(raNickname)); } if (isKRAInstalled) { @@ -459,12 +459,12 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_KRA); String kraNickname = kra.getNickname(); - params.add(Constants.PR_CERT_TRANS, getCertNickname(kraNickname)); + params.put(Constants.PR_CERT_TRANS, getCertNickname(kraNickname)); } String nickName = CMS.getServerCertNickname(); - params.add(Constants.PR_CERT_SERVER, getCertNickname(nickName)); + params.put(Constants.PR_CERT_SERVER, getCertNickname(nickName)); sendResponse(SUCCESS, null, params, resp); } @@ -795,7 +795,7 @@ public final class CMSAdminServlet extends AdminServlet { if (sys instanceof ITKSAuthority) type = Constants.PR_TKS_INSTANCE; if (!type.trim().equals("")) - params.add(sys.getId(), type); + params.put(sys.getId(), type); } sendResponse(SUCCESS, null, params, resp); @@ -811,25 +811,25 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore cs = CMS.getConfigStore(); try { String installdate = cs.getString(Constants.PR_STAT_INSTALLDATE, ""); - params.add(Constants.PR_STAT_INSTALLDATE, installdate); + params.put(Constants.PR_STAT_INSTALLDATE, installdate); } catch (Exception e) { } try { String version = cs.getString(Constants.PR_STAT_VERSION, ""); - params.add(Constants.PR_STAT_VERSION, version); + params.put(Constants.PR_STAT_VERSION, version); } catch (Exception e) { } try { String instanceId = cs.getString(Constants.PR_STAT_INSTANCEID, ""); - params.add(Constants.PR_STAT_INSTANCEID, instanceId); + params.put(Constants.PR_STAT_INSTANCEID, instanceId); } catch (Exception e) { } - params.add(Constants.PR_STAT_STARTUP, + params.put(Constants.PR_STAT_STARTUP, (new Date(CMS.getStartupTime())).toString()); - params.add(Constants.PR_STAT_TIME, + params.put(Constants.PR_STAT_TIME, (new Date(System.currentTimeMillis())).toString()); sendResponse(SUCCESS, null, params, resp); } @@ -890,8 +890,8 @@ public final class CMSAdminServlet extends AdminServlet { String masterKeyPrefix = CMS.getConfigStore().getString("tks.master_key_prefix", null); SessionKey.SetDefaultPrefix(masterKeyPrefix); - params.add(Constants.PR_KEY_LIST, newKeyName); - params.add(Constants.PR_TOKEN_LIST, selectedToken); + params.put(Constants.PR_KEY_LIST, newKeyName); + params.put(Constants.PR_TOKEN_LIST, selectedToken); } sendResponse(SUCCESS, null, params, resp); } @@ -937,7 +937,7 @@ public final class CMSAdminServlet extends AdminServlet { } // String symKeys = new String("key1,key2"); String symKeys = SessionKey.ListSymmetricKeys(selectedToken); - params.add(Constants.PR_TOKEN_LIST, symKeys); + params.put(Constants.PR_TOKEN_LIST, symKeys); } } @@ -966,9 +966,9 @@ public final class CMSAdminServlet extends AdminServlet { if (name.equals(Constants.OP_SCOPE)) continue; if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) - params.add(name, ldapConfig.getString(name, "Constants.FALSE")); + params.put(name, ldapConfig.getString(name, "Constants.FALSE")); else - params.add(name, ldapConfig.getString(name, "")); + params.put(name, ldapConfig.getString(name, "")); } sendResponse(SUCCESS, null, params, resp); } @@ -1006,9 +1006,9 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore dbConfig = mConfig.getSubStore(PROP_SMTP); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_SERVER_NAME, + params.put(Constants.PR_SERVER_NAME, dbConfig.getString("host")); - params.add(Constants.PR_PORT, + params.put(Constants.PR_PORT, dbConfig.getString("port")); sendResponse(SUCCESS, null, params, resp); } @@ -1064,7 +1064,7 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOGGED_IN, "" + status); + params.put(Constants.PR_LOGGED_IN, "" + status); sendResponse(SUCCESS, null, params, resp); } @@ -1210,8 +1210,8 @@ public final class CMSAdminServlet extends AdminServlet { } String certReq = jssSubSystem.getCertRequest(subjectName, keypair); - params.add(Constants.PR_CSR, certReq); - params.add(Constants.PR_CERT_REQUEST_DIR, dir); + params.put(Constants.PR_CSR, certReq); + params.put(Constants.PR_CERT_REQUEST_DIR, dir); PrintStream ps = new PrintStream(new FileOutputStream(pathname)); ps.println(certReq); @@ -2432,8 +2432,8 @@ public final class CMSAdminServlet extends AdminServlet { String content = jssSubSystem.getCertPrettyPrint(b64Cert, super.getLocale(req)); - results.add(Constants.PR_NICKNAME, "FBCA cross-signed cert"); - results.add(Constants.PR_CERT_CONTENT, content); + results.put(Constants.PR_NICKNAME, "FBCA cross-signed cert"); + results.put(Constants.PR_CERT_CONTENT, content); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( @@ -2618,8 +2618,8 @@ public final class CMSAdminServlet extends AdminServlet { super.getLocale(req)); if (nickname != null && !nickname.equals("")) - results.add(Constants.PR_NICKNAME, nickname); - results.add(Constants.PR_CERT_CONTENT, content); + results.put(Constants.PR_NICKNAME, nickname); + results.put(Constants.PR_CERT_CONTENT, content); //results = jssSubSystem.getCertInfo(value); sendResponse(SUCCESS, null, results, resp); @@ -2664,7 +2664,7 @@ public final class CMSAdminServlet extends AdminServlet { String print = jssSubSystem.getCertPrettyPrintAndFingerPrint(nickname, serialno, issuername, locale); - pairs.add(nickname, print); + pairs.put(nickname, print); sendResponse(SUCCESS, null, pairs, resp); } @@ -2707,7 +2707,7 @@ public final class CMSAdminServlet extends AdminServlet { String trustbit = jssSubSystem.getRootCertTrustBit(nickname, serialno, issuername); - pairs.add(nickname, trustbit); + pairs.put(nickname, trustbit); sendResponse(SUCCESS, null, pairs, resp); } @@ -2924,7 +2924,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String subjectName = jssSubSystem.getSubjectDN(nickname); - params.add(Constants.PR_SUBJECT_NAME, subjectName); + params.put(Constants.PR_SUBJECT_NAME, subjectName); sendResponse(SUCCESS, null, params, resp); } @@ -2950,7 +2950,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String subjectName = jssSubSystem.getSubjectDN(nickname); - params.add(Constants.PR_SUBJECT_NAME, subjectName); + params.put(Constants.PR_SUBJECT_NAME, subjectName); sendResponse(SUCCESS, null, params, resp); } @@ -3342,9 +3342,9 @@ public final class CMSAdminServlet extends AdminServlet { audit(auditMessage); // notify console of SUCCESS - results.add(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CLASS, + results.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CLASS, CMSAdminServlet.class.getName()); - results.add(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CONTENT, + results.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CONTENT, content); sendResponse(SUCCESS, null, results, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java index a9baa874c..42ff32ebe 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java @@ -510,7 +510,7 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_JOBS_IMPL_NAME, implname); + params.put(Constants.PR_JOBS_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -526,7 +526,7 @@ public class JobsAdminServlet extends AdminServlet { String name = e.nextElement(); JobPlugin value = mJobsSched.getPlugins().get(name); - params.add(name, value.getClassPath()); + params.put(name, value.getClassPath()); // params.add(name, value.getClassPath()+EDIT); } sendResponse(SUCCESS, null, params, resp); @@ -544,9 +544,9 @@ public class JobsAdminServlet extends AdminServlet { IJob value = mJobsSched.getInstances().get((Object) name); // params.add(name, value.getImplName()); - params.add(name, value.getImplName() + VISIBLE + + params.put(name, value.getImplName() + VISIBLE + (value.isEnabled() ? ENABLED : DISABLED) - ); + ); } sendResponse(SUCCESS, null, params, resp); return; @@ -691,10 +691,10 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_JOBS_IMPL_NAME, ""); + params.put(Constants.PR_JOBS_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.length; i++) { - params.add(configParams[i], ""); + params.put(configParams[i], ""); } } sendResponse(0, null, params, resp); @@ -728,7 +728,7 @@ public class JobsAdminServlet extends AdminServlet { String[] configParams = jobInst.getConfigParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_JOBS_IMPL_NAME, jobInst.getImplName()); + params.put(Constants.PR_JOBS_IMPL_NAME, jobInst.getImplName()); // implName is always required so always send it. if (configParams != null) { @@ -738,9 +738,9 @@ public class JobsAdminServlet extends AdminServlet { String val = (String) config.get(key); if (val != null && !val.equals("")) { - params.add(key, val); + params.put(key, val); } else { - params.add(key, ""); + params.put(key, ""); } } } @@ -813,7 +813,7 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add(IJobsScheduler.PROP_PLUGIN, + saveParams.put(IJobsScheduler.PROP_PLUGIN, (String) oldConfig.get(IJobsScheduler.PROP_PLUGIN)); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.length; i++) { @@ -821,7 +821,7 @@ public class JobsAdminServlet extends AdminServlet { Object val = oldConfig.get(key); if (val != null) { - saveParams.add(key, (String) val); + saveParams.put(key, (String) val); } } } @@ -945,11 +945,11 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); IConfigStore config = mConfig.getSubStore(DestDef.DEST_JOBS_ADMIN); - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, config.getString(IJobsScheduler.PROP_ENABLED, Constants.FALSE)); // default 1 minute - params.add(Constants.PR_JOBS_FREQUENCY, + params.put(Constants.PR_JOBS_FREQUENCY, config.getString(IJobsScheduler.PROP_INTERVAL, "1")); //System.out.println("Send: "+params.toString()); @@ -997,11 +997,8 @@ public class JobsAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (!value.equals("")) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java index 0d3648c98..eaa5a95c4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java @@ -180,7 +180,7 @@ public class KRAAdminServlet extends AdminServlet { int value = 1; value = mKRA.getNoOfRequiredAgents(); - params.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, Integer.toString(value)); + params.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, Integer.toString(value)); sendResponse(SUCCESS, null, params, resp); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java index ff70a5c53..be723fcd6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java @@ -355,7 +355,7 @@ public class LogAdminServlet extends AdminServlet { // not show ntEventlog here if (all || (!all && !c.endsWith("NTEventLog"))) - params.add(name, pName + ";visible"); + params.put(name, pName + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -976,7 +976,7 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOG_IMPL_NAME, implname); + params.put(Constants.PR_LOG_IMPL_NAME, implname); // store a message in the signed audit log file if (logType.equals(SIGNED_AUDIT_LOG_TYPE)) { @@ -1054,7 +1054,7 @@ public class LogAdminServlet extends AdminServlet { resp); return; } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1569,13 +1569,13 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = (String) oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2214,16 +2214,16 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_LOG_IMPL_NAME, ""); + params.put(Constants.PR_LOG_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); if (index == -1) { - params.add(kv, ""); + params.put(kv, ""); } else { - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2259,7 +2259,7 @@ public class LogAdminServlet extends AdminServlet { Vector<String> configParams = logInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOG_IMPL_NAME, + params.put(Constants.PR_LOG_IMPL_NAME, getLogPluginName(logInst)); // implName is always required so always send it. if (configParams != null) { @@ -2267,7 +2267,7 @@ public class LogAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2282,11 +2282,8 @@ public class LogAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); @@ -2323,10 +2320,10 @@ public class LogAdminServlet extends AdminServlet { String value = "false"; value = mConfig.getString(Constants.PR_DEBUG_LOG_ENABLE, "false"); - params.add(Constants.PR_DEBUG_LOG_ENABLE, value); + params.put(Constants.PR_DEBUG_LOG_ENABLE, value); value = mConfig.getString(Constants.PR_DEBUG_LOG_LEVEL, "0"); - params.add(Constants.PR_DEBUG_LOG_LEVEL, value); + params.put(Constants.PR_DEBUG_LOG_LEVEL, value); sendResponse(SUCCESS, null, params, resp); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java index 317a50d68..59eead9df 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java @@ -362,7 +362,7 @@ public class OCSPAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); } store.setConfigParameters(params); commit(true); @@ -432,7 +432,7 @@ public class OCSPAdminServlet extends AdminServlet { if (storeName.equals(defStore)) { storeEnabled = true; } - params.add(storeName, storeName + ";visible;" + ((storeEnabled) ? "enabled" : "disabled")); + params.put(storeName, storeName + ";visible;" + ((storeEnabled) ? "enabled" : "disabled")); } sendResponse(SUCCESS, null, params, resp); } @@ -449,7 +449,7 @@ public class OCSPAdminServlet extends AdminServlet { } private void getSigningAlgConfig(NameValuePairs params) { - params.add(Constants.PR_DEFAULT_ALGORITHM, + params.put(Constants.PR_DEFAULT_ALGORITHM, mOCSP.getDefaultAlgorithm()); String[] algorithms = mOCSP.getOCSPSigningAlgorithms(); StringBuffer algorStr = new StringBuffer(); @@ -461,7 +461,7 @@ public class OCSPAdminServlet extends AdminServlet { algorStr.append(":"); algorStr.append(algorithms[i]); } - params.add(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); + params.put(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); } /** diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java index 4dbde7e06..9eb5c3455 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java @@ -298,11 +298,11 @@ public class PolicyAdminServlet extends AdminServlet { /* make sure policy rules have 'enable' and 'predicate' */ if (ext_info instanceof IPolicyRule) { - if (nvps.getPair(IPolicyRule.PROP_ENABLE) == null) { - nvps.add(IPolicyRule.PROP_ENABLE, "boolean;Enable this policy rule"); + if (nvps.get(IPolicyRule.PROP_ENABLE) == null) { + nvps.put(IPolicyRule.PROP_ENABLE, "boolean;Enable this policy rule"); } - if (nvps.getPair(PROP_PREDICATE) == null) { - nvps.add(PROP_PREDICATE, "string;Rules describing when this policy should run."); + if (nvps.get(PROP_PREDICATE) == null) { + nvps.put(PROP_PREDICATE, "string;Rules describing when this policy should run."); } } } @@ -448,7 +448,7 @@ public class PolicyAdminServlet extends AdminServlet { impl.getClass().getName(); String desc = impl.getDescription(); - nvp.add(id, className + "," + desc); + nvp.put(id, className + "," + desc); } sendResponse(SUCCESS, null, nvp, resp); } @@ -471,7 +471,7 @@ public class PolicyAdminServlet extends AdminServlet { String info = instancesInfo.nextElement(); int i = info.indexOf(";"); - nvp.add(info.substring(0, i), info.substring(i + 1)); + nvp.put(info.substring(0, i), info.substring(i + 1)); } sendResponse(SUCCESS, null, nvp, resp); @@ -594,7 +594,7 @@ public class PolicyAdminServlet extends AdminServlet { String nv = e.nextElement(); int index = nv.indexOf("="); - nvp.add(nv.substring(0, index), nv.substring(index + 1)); + nvp.put(nv.substring(0, index), nv.substring(index + 1)); } sendResponse(SUCCESS, null, nvp, resp); } @@ -829,7 +829,7 @@ public class PolicyAdminServlet extends AdminServlet { value = ""; } - nvp.add(name, value); + nvp.put(name, value); } sendResponse(SUCCESS, null, nvp, resp); 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 8e67c3402..94235f532 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 @@ -387,7 +387,7 @@ public class ProfileAdminServlet extends AdminServlet { String id = (String) impls.nextElement(); IPluginInfo info = mRegistry.getPluginInfo("profile", id); - nvp.add(id, info.getClassName() + "," + + nvp.put(id, info.getClassName() + "," + info.getDescription(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -599,7 +599,7 @@ public class ProfileAdminServlet extends AdminServlet { continue; if (name.equals("RS_ID")) continue; - nvps.add(name, req.getParameter(name)); + nvps.put(name, req.getParameter(name)); } try { @@ -725,7 +725,7 @@ public class ProfileAdminServlet extends AdminServlet { continue; if (name.equals("RS_ID")) continue; - nvps.add(name, req.getParameter(name)); + nvps.put(name, req.getParameter(name)); } try { @@ -1968,9 +1968,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + rule.getConfig(name)); + nvp.put(name, ";" + ";" + rule.getConfig(name)); } else { - nvp.add(name, + nvp.put(name, desc.getSyntax() + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); @@ -2019,9 +2019,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + rule.getConfig(name)); + nvp.put(name, ";" + rule.getConfig(name)); } else { - nvp.add(name, + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); @@ -2064,7 +2064,7 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyDefault def = policy.getDefault(); IPolicyConstraint con = policy.getConstraint(); - nvp.add(setId + ":" + policy.getId(), + nvp.put(setId + ":" + policy.getId(), def.getName(getLocale(req)) + ";" + con.getName(getLocale(req))); } @@ -2094,7 +2094,7 @@ public class ProfileAdminServlet extends AdminServlet { String outputId = (String) outputs.nextElement(); IProfileOutput output = profile.getProfileOutput(outputId); - nvp.add(outputId, output.getName(getLocale(req))); + nvp.put(outputId, output.getName(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -2121,7 +2121,7 @@ public class ProfileAdminServlet extends AdminServlet { String inputId = (String) inputs.nextElement(); IProfileInput input = profile.getProfileInput(inputId); - nvp.add(inputId, input.getName(getLocale(req))); + nvp.put(inputId, input.getName(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -2156,9 +2156,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = profileInput.getConfigDescriptor( getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + profileInput.getConfig(name)); + nvp.put(name, ";" + ";" + profileInput.getConfig(name)); } else { - nvp.add(name, desc.getSyntax() + ";" + + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + profileInput.getConfig(name)); @@ -2197,9 +2197,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = profileOutput.getConfigDescriptor( getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + profileOutput.getConfig(name)); + nvp.put(name, ";" + ";" + profileOutput.getConfig(name)); } else { - nvp.add(name, desc.getSyntax() + ";" + + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + profileOutput.getConfig(name)); @@ -2228,7 +2228,7 @@ public class ProfileAdminServlet extends AdminServlet { } // mInstanceId + ";visible;" + enabled - nvp.add(profileId, profileId + ";visible;" + status); + nvp.put(profileId, profileId + ";visible;" + status); } sendResponse(SUCCESS, null, nvp, resp); } @@ -2250,21 +2250,21 @@ public class ProfileAdminServlet extends AdminServlet { NameValuePairs nvp = new NameValuePairs(); - nvp.add("name", profile.getName(getLocale(req))); - nvp.add("desc", profile.getDescription(getLocale(req))); - nvp.add("visible", Boolean.toString(profile.isVisible())); - nvp.add("enable", Boolean.toString( + nvp.put("name", profile.getName(getLocale(req))); + nvp.put("desc", profile.getDescription(getLocale(req))); + nvp.put("visible", Boolean.toString(profile.isVisible())); + nvp.put("enable", Boolean.toString( mProfileSub.isProfileEnable(id))); String authid = profile.getAuthenticatorId(); if (authid == null) { - nvp.add("auth", ""); + nvp.put("auth", ""); } else { - nvp.add("auth", authid); + nvp.put("auth", authid); } CMS.debug("ProfileAdminServlet: authid=" + authid); - nvp.add("plugin", mProfileSub.getProfileClassId(id)); + nvp.put("plugin", mProfileSub.getProfileClassId(id)); sendResponse(SUCCESS, null, nvp, resp); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java index 799e1bb37..3774d6e6f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java @@ -468,7 +468,7 @@ public class PublisherAdminServlet extends AdminServlet { if (name.equals(Constants.PR_CERT_NAMES)) { ICryptoSubsystem jss = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - params.add(name, jss.getAllCerts()); + params.put(name, jss.getAllCerts()); } else { String value = ldap.getString(name, ""); @@ -481,22 +481,22 @@ public class PublisherAdminServlet extends AdminServlet { value = ILdapAuthInfo.PROP_BINDDN_DEFAULT; } } - params.add(name, value); + params.put(name, value); } } - params.add(Constants.PR_PUBLISHING_ENABLE, + params.put(Constants.PR_PUBLISHING_ENABLE, publishcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE)); - params.add(Constants.PR_PUBLISHING_QUEUE_ENABLE, + params.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE)); - params.add(Constants.PR_PUBLISHING_QUEUE_THREADS, + params.put(Constants.PR_PUBLISHING_QUEUE_THREADS, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_THREADS, "3")); - params.add(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, + params.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, "40")); - params.add(Constants.PR_PUBLISHING_QUEUE_PRIORITY, + params.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PRIORITY, "0")); - params.add(Constants.PR_PUBLISHING_QUEUE_STATUS, + params.put(Constants.PR_PUBLISHING_QUEUE_STATUS, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_STATUS, "200")); - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, ldapcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -694,7 +694,7 @@ public class PublisherAdminServlet extends AdminServlet { // test before commit if (publishcfg.getBoolean(IPublisherProcessor.PROP_ENABLE) && ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE)) { - params.add("title", + params.put("title", "You've attempted to configure CMS to connect" + " to a LDAP directory. The connection status is" + " as follows:\n \n"); @@ -725,16 +725,16 @@ public class PublisherAdminServlet extends AdminServlet { conn = new LDAPConnection(CMS.getLdapJssSSLSocketFactory( certNickName)); CMS.debug("Publishing Test certNickName=" + certNickName); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create ssl LDAPConnection with certificate: " + certNickName + dashes(70 - 44 - certNickName.length()) + " Success"); } catch (Exception ex) { - params.add(Constants.PR_CONN_INIT_FAIL, + params.put(Constants.PR_CONN_INIT_FAIL, "Create ssl LDAPConnection with certificate: " + certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex); - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); sendResponse(SUCCESS, null, params, resp); @@ -742,13 +742,13 @@ public class PublisherAdminServlet extends AdminServlet { } try { conn.connect(host, port); - params.add(Constants.PR_CONN_OK, + params.put(Constants.PR_CONN_OK, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); - params.add(Constants.PR_AUTH_OK, + params.put(Constants.PR_AUTH_OK, "Authentication: SSL client authentication" + dashes(70 - 41) + " Success" + "\nBind to the directory as: " + certNickName + @@ -757,20 +757,20 @@ public class PublisherAdminServlet extends AdminServlet { if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure\n" + " error: server unavailable"); } else { - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure"); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -782,21 +782,21 @@ public class PublisherAdminServlet extends AdminServlet { if (secure) { conn = new LDAPConnection( CMS.getLdapJssSSLSocketFactory()); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create ssl LDAPConnection" + dashes(70 - 25) + " Success"); } else { conn = new LDAPConnection(); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create LDAPConnection" + dashes(70 - 21) + " Success"); } } catch (Exception ex) { - params.add(Constants.PR_CONN_INIT_FAIL, + params.put(Constants.PR_CONN_INIT_FAIL, "Create LDAPConnection" + dashes(70 - 21) + " Failure\n" + "exception: " + ex); - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -805,7 +805,7 @@ public class PublisherAdminServlet extends AdminServlet { } try { conn.connect(host, port); - params.add(Constants.PR_CONN_OK, + params.put(Constants.PR_CONN_OK, "Connect to directory server " + host + " at port " + port + @@ -815,7 +815,7 @@ public class PublisherAdminServlet extends AdminServlet { if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + @@ -823,7 +823,7 @@ public class PublisherAdminServlet extends AdminServlet { + " Failure" + "\nerror: server unavailable"); } else { - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + @@ -831,7 +831,7 @@ public class PublisherAdminServlet extends AdminServlet { + " Failure" + "\nexception: " + ex); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -843,14 +843,14 @@ public class PublisherAdminServlet extends AdminServlet { bindAs = ldap.getSubStore( ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString(ILdapAuthInfo.PROP_BINDDN); conn.authenticate(version, bindAs, pwd); - params.add(Constants.PR_AUTH_OK, + params.put(Constants.PR_AUTH_OK, "Authentication: Basic authentication" + dashes(70 - 36) + " Success" + "\nBind to the directory as: " + bindAs + dashes(70 - 26 - bindAs.length()) + " Success"); } catch (LDAPException ex) { if (ex.getLDAPResultCode() == LDAPException.NO_SUCH_OBJECT) { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + "Failure" + "\nBind to the directory as: " + bindAs + @@ -859,7 +859,7 @@ public class PublisherAdminServlet extends AdminServlet { "Please correct the value assigned in the" + " \"Directory manager DN\" field."); } else if (ex.getLDAPResultCode() == LDAPException.INVALID_CREDENTIALS) { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + " Failure" + "\nBind to the directory as: " + bindAs + @@ -868,14 +868,14 @@ public class PublisherAdminServlet extends AdminServlet { "Please correct the value assigned in the" + " \"Password\" field."); } else { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + " Failure" + "\nBind to the directory as: " + bindAs + dashes(70 - 26 - bindAs.length()) + " Failure"); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -942,23 +942,23 @@ public class PublisherAdminServlet extends AdminServlet { try { mProcessor.publishCACert(ca.getCACert()); CMS.debug("PublisherAdminServlet: " + CMS.getLogMessage("ADMIN_SRVLT_PUB_CA_CERT")); - params.add("publishCA", + params.put("publishCA", "CA certificate is published."); } catch (Exception ex) { // exception not thrown - not seen as a fatal error. log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_NO_PUB_CA_CERT", ex.toString())); - params.add("publishCA", + params.put("publishCA", "Failed to publish CA certificate."); int index = ex.toString().indexOf("Failed to create CA"); if (index > -1) { - params.add("createError", + params.put("createError", ex.toString().substring(index)); } mProcessor.shutdown(); // Do you want to enable LDAP publishing anyway - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "the CA certificate won't be published.\n" + "Do you want to enable LDAP publishing anyway?"); @@ -971,17 +971,17 @@ public class PublisherAdminServlet extends AdminServlet { CMS.debug("PublisherAdminServlet: about to update CRL"); ca.publishCRLNow(); CMS.debug(CMS.getLogMessage("ADMIN_SRVLT_PUB_CRL")); - params.add("publishCRL", + params.put("publishCRL", "CRL is published."); } catch (Exception ex) { // exception not thrown - not seen as a fatal error. log(ILogger.LL_FAILURE, "Could not publish crl " + ex.toString()); - params.add("publishCRL", + params.put("publishCRL", "Failed to publish CRL."); mProcessor.shutdown(); // Do you want to enable LDAP publishing anyway - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "the CRL won't be published.\n" + "Do you want to enable LDAP publishing anyway?"); @@ -990,14 +990,14 @@ public class PublisherAdminServlet extends AdminServlet { } } commit(true); - params.add(Constants.PR_SAVE_OK, + params.put(Constants.PR_SAVE_OK, "\n \nConfiguration changes are now committed."); - params.add("restarted", "Publishing is restarted."); + params.put("restarted", "Publishing is restarted."); } else { commit(true); - params.add(Constants.PR_SAVE_OK, + params.put(Constants.PR_SAVE_OK, "\n \nConfiguration changes are now committed."); - params.add("stopped", + params.put("stopped", "Publishing is stopped."); } @@ -1236,7 +1236,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_MAPPER_IMPL_NAME, implname); + params.put(Constants.PR_MAPPER_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -1265,7 +1265,7 @@ public class PublisherAdminServlet extends AdminServlet { resp); return; } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1292,7 +1292,7 @@ public class PublisherAdminServlet extends AdminServlet { String name = e.nextElement(); ILdapMapper value = mProcessor.getMapperInstance(name); - params.add(name, getMapperPluginName(value) + ";visible"); + params.put(name, getMapperPluginName(value) + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -1427,13 +1427,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_MAPPER_IMPL_NAME, ""); + params.put(Constants.PR_MAPPER_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1468,7 +1468,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = mapperInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_MAPPER_IMPL_NAME, + params.put(Constants.PR_MAPPER_IMPL_NAME, getMapperPluginName(mapperInst)); // implName is always required so always send it. if (configParams != null) { @@ -1476,7 +1476,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1534,13 +1534,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1875,7 +1875,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_RULE_IMPL_NAME, implname); + params.put(Constants.PR_RULE_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -1901,7 +1901,7 @@ public class PublisherAdminServlet extends AdminServlet { desc = lp.getDescription(); } catch (Exception exp) { } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1919,7 +1919,7 @@ public class PublisherAdminServlet extends AdminServlet { mProcessor.getRuleInsts().get((Object) name); String enabled = value.enabled() ? "enabled" : "disabled"; - params.add(name, value.getInstanceName() + ";visible;" + enabled); + params.put(name, value.getInstanceName() + ";visible;" + enabled); } sendResponse(SUCCESS, null, params, resp); return; @@ -2062,13 +2062,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_RULE_IMPL_NAME, ""); + params.put(Constants.PR_RULE_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2102,7 +2102,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = ruleInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_RULE_IMPL_NAME, + params.put(Constants.PR_RULE_IMPL_NAME, getRulePluginName(ruleInst)); // implName is always required so always send it. if (configParams != null) { @@ -2110,7 +2110,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2167,13 +2167,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2523,7 +2523,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PUBLISHER_IMPL_NAME, implname); + params.put(Constants.PR_PUBLISHER_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -2550,7 +2550,7 @@ public class PublisherAdminServlet extends AdminServlet { desc = lp.getDescription(); } catch (Exception exp) { } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -2579,7 +2579,7 @@ public class PublisherAdminServlet extends AdminServlet { if (value == null) continue; - params.add(name, getPublisherPluginName(value) + ";visible"); + params.put(name, getPublisherPluginName(value) + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -2725,16 +2725,16 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_PUBLISHER_IMPL_NAME, ""); + params.put(Constants.PR_PUBLISHER_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); if (index == -1) { - params.add(kv, ""); + params.put(kv, ""); } else { - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2771,7 +2771,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = publisherInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PUBLISHER_IMPL_NAME, + params.put(Constants.PR_PUBLISHER_IMPL_NAME, getPublisherPluginName(publisherInst)); // implName is always required so always send it. if (configParams != null) { @@ -2779,7 +2779,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2848,7 +2848,7 @@ public class PublisherAdminServlet extends AdminServlet { String pubType = ""; // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = (String) oldConfigParms.elementAt(i); @@ -2860,7 +2860,7 @@ public class PublisherAdminServlet extends AdminServlet { pubType = "crl"; } - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2876,11 +2876,11 @@ public class PublisherAdminServlet extends AdminServlet { // get objects added and deleted if (pubType.equals("cacert")) { - saveParams.add("caObjectClassAdded", instancesConfig.getString(id + ".caObjectClassAdded", "")); - saveParams.add("caObjectClassDeleted", instancesConfig.getString(id + ".caObjectClassDeleted", "")); + saveParams.put("caObjectClassAdded", instancesConfig.getString(id + ".caObjectClassAdded", "")); + saveParams.put("caObjectClassDeleted", instancesConfig.getString(id + ".caObjectClassDeleted", "")); } else if (pubType.equals("crl")) { - saveParams.add("crlObjectClassAdded", instancesConfig.getString(id + ".crlObjectClassAdded", "")); - saveParams.add("crlObjectClassDeleted", instancesConfig.getString(id + ".crlObjectClassDeleted", "")); + saveParams.put("crlObjectClassAdded", instancesConfig.getString(id + ".crlObjectClassAdded", "")); + saveParams.put("crlObjectClassDeleted", instancesConfig.getString(id + ".crlObjectClassDeleted", "")); } // create new substore. @@ -3054,9 +3054,9 @@ public class PublisherAdminServlet extends AdminServlet { } catch (Exception e) { } - oldOC = saveParams.getValue(objName); - oldAdded = saveParams.getValue(objName + "Added"); - oldDeleted = saveParams.getValue(objName + "Deleted"); + oldOC = saveParams.get(objName); + oldAdded = saveParams.get(objName + "Added"); + oldDeleted = saveParams.get(objName + "Deleted"); if ((oldOC == null) || (newOC == null)) return; @@ -3106,11 +3106,8 @@ public class PublisherAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java index 1adde0891..5bdb14177 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java @@ -199,10 +199,10 @@ public class RAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, rc.getString(name, "")); + params.put(name, rc.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, rc.getString(PROP_ENABLED, Constants.FALSE)); //System.out.println("Send: "+params.toString()); sendResponse(SUCCESS, null, params, resp); @@ -265,10 +265,10 @@ public class RAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, riq.getString(name, "")); + params.put(name, riq.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, riq.getString(PROP_ENABLED, Constants.FALSE)); //System.out.println("Send: "+params.toString()); sendResponse(SUCCESS, null, params, resp); @@ -423,7 +423,7 @@ public class RAAdminServlet extends AdminServlet { if (name.equals(Constants.OP_TYPE)) continue; - params.add(name, caConnectorConfig.getString(name, "")); + params.put(name, caConnectorConfig.getString(name, "")); } } sendResponse(SUCCESS, null, params, resp); 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 0175d9aa4..aa5494f0d 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 @@ -251,7 +251,7 @@ public class RegistryAdminServlet extends AdminServlet { String id = impls.nextElement(); IPluginInfo info = mRegistry.getPluginInfo(scope, id); - nvp.add(id, info.getClassName() + "," + + nvp.put(id, info.getClassName() + "," + info.getDescription(getLocale(req)) + "," + info.getName(getLocale(req))); } @@ -289,7 +289,7 @@ public class RegistryAdminServlet extends AdminServlet { if (policyConstraintClass.isApplicable(policyDefaultClass)) { CMS.debug("RegistryAdminServlet: getSUpportedConstraint isApplicable " + constraintInfo.getClassName()); - nvp.add(constraintID, + nvp.put(constraintID, constraintInfo.getClassName() + "," + constraintInfo.getDescription(getLocale(req)) + "," @@ -352,7 +352,7 @@ public class RegistryAdminServlet extends AdminServlet { + getNonNull(desc.getDefaultValue()); CMS.debug("RegistryAdminServlet: getProfileImpl " + value); - nvp.add(name, value); + nvp.put(name, value); } catch (Exception e) { CMS.debug("RegistryAdminServlet: getProfileImpl skipped descriptor for " + name); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java index 3783ead6f..e5a6dd3c4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java @@ -327,7 +327,7 @@ public class UsrGrpAdminServlet extends AdminServlet { val = "noType"; NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_USER_TYPE, val); + params.put(Constants.PR_USER_TYPE, val); sendResponse(SUCCESS, null, params, resp); } @@ -372,7 +372,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } i++; } - params.add("userInfo", sb.toString()); + params.put("userInfo", sb.toString()); sendResponse(SUCCESS, null, params, resp); } @@ -416,10 +416,10 @@ public class UsrGrpAdminServlet extends AdminServlet { } if (user != null) { - params.add(Constants.PR_USER_FULLNAME, user.getFullName()); - params.add(Constants.PR_USER_EMAIL, user.getEmail()); - params.add(Constants.PR_USER_PHONE, user.getPhone()); - params.add(Constants.PR_USER_STATE, user.getState()); + params.put(Constants.PR_USER_FULLNAME, user.getFullName()); + params.put(Constants.PR_USER_EMAIL, user.getEmail()); + params.put(Constants.PR_USER_PHONE, user.getPhone()); + params.put(Constants.PR_USER_STATE, user.getState()); // get list of groups, and get a list of those that this // uid belongs to @@ -447,7 +447,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } } - params.add(Constants.PR_USER_GROUP, grpString.toString()); + params.put(Constants.PR_USER_GROUP, grpString.toString()); sendResponse(SUCCESS, null, params, resp); return; @@ -516,7 +516,7 @@ public class UsrGrpAdminServlet extends AdminServlet { String base64 = CMS.getEncodedCert(certs[i]); // pretty print certs - params.add(getCertificateString(certs[i]), + params.put(getCertificateString(certs[i]), print.toString(clientLocale) + "\n" + base64); } sendResponse(SUCCESS, null, params, resp); @@ -567,9 +567,9 @@ public class UsrGrpAdminServlet extends AdminServlet { String desc = group.getDescription(); if (desc != null) { - params.add(group.getGroupID(), desc); + params.put(group.getGroupID(), desc); } else { - params.add(group.getGroupID(), ""); + params.put(group.getGroupID(), ""); } } @@ -612,8 +612,8 @@ public class UsrGrpAdminServlet extends AdminServlet { if (e.hasMoreElements()) { IGroup group = e.nextElement(); - params.add(Constants.PR_GROUP_GROUP, group.getGroupID()); - params.add(Constants.PR_GROUP_DESC, + params.put(Constants.PR_GROUP_GROUP, group.getGroupID()); + params.put(Constants.PR_GROUP_DESC, group.getDescription()); Enumeration<String> members = group.getMemberNames(); @@ -631,7 +631,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } } - params.add(Constants.PR_GROUP_USER, membersString.toString()); + params.put(Constants.PR_GROUP_USER, membersString.toString()); sendResponse(SUCCESS, null, params, resp); return; diff --git a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java index ac44672d2..42768060c 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -90,7 +90,6 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; import com.netscape.certsrv.common.Constants; -import com.netscape.certsrv.common.NameValuePair; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.security.ICryptoSubsystem; @@ -1043,11 +1042,11 @@ public final class JssSubsystem implements ICryptoSubsystem { X509CertImpl impl = new X509CertImpl(b); NameValuePairs results = new NameValuePairs(); - results.add(Constants.PR_CERT_SUBJECT_NAME, impl.getSubjectDN().getName()); - results.add(Constants.PR_ISSUER_NAME, impl.getIssuerDN().getName()); - results.add(Constants.PR_SERIAL_NUMBER, impl.getSerialNumber().toString()); - results.add(Constants.PR_BEFORE_VALIDDATE, impl.getNotBefore().toString()); - results.add(Constants.PR_AFTER_VALIDDATE, impl.getNotAfter().toString()); + results.put(Constants.PR_CERT_SUBJECT_NAME, impl.getSubjectDN().getName()); + results.put(Constants.PR_ISSUER_NAME, impl.getIssuerDN().getName()); + results.put(Constants.PR_SERIAL_NUMBER, impl.getSerialNumber().toString()); + results.put(Constants.PR_BEFORE_VALIDDATE, impl.getNotBefore().toString()); + results.put(Constants.PR_AFTER_VALIDDATE, impl.getNotAfter().toString()); // fingerprint is using MD5 hash @@ -1202,7 +1201,7 @@ public final class JssSubsystem implements ICryptoSubsystem { } String serialno = impl.getSerialNumber().toString(); String issuer = impl.getIssuerDN().toString(); - nvps.add(nickname + "," + serialno, issuer); + nvps.put(nickname + "," + serialno, issuer); Debug.trace("getRootCerts: nickname=" + nickname + ", serialno=" + serialno + ", issuer=" + issuer); continue; @@ -1265,7 +1264,7 @@ public final class JssSubsystem implements ICryptoSubsystem { } String serialno = impl.getSerialNumber().toString(); String issuer = impl.getIssuerDN().toString(); - nvps.add(nickname + "," + serialno, issuer); + nvps.put(nickname + "," + serialno, issuer); Debug.trace("getUserCerts: nickname=" + nickname + ", serialno=" + serialno + ", issuer=" + issuer); } catch (ObjectNotFoundException e) { @@ -1329,18 +1328,16 @@ public final class JssSubsystem implements ICryptoSubsystem { } Date date = impl.getNotAfter(); String dateStr = mFormatter.format(date); - NameValuePair pair = pairs.getPair(nickname); + String vvalue = pairs.get(nickname); /* always user cert here*/ String certValue = dateStr + "," + "u"; - if (pair == null) - pairs.add(nickname, certValue); + if (vvalue == null) + pairs.put(nickname, certValue); else { - String vvalue = pair.getValue(); - if (vvalue.endsWith(",u")) { - pair.setValue(vvalue + ";" + certValue); + pairs.put(nickname, vvalue + ";" + certValue); } } @@ -1441,15 +1438,13 @@ public final class JssSubsystem implements ICryptoSubsystem { impl = new X509CertImpl(icert.getEncoded()); Date date = impl.getNotAfter(); String dateStr = mFormatter.format(date); - NameValuePair pair = pairs.getPair(nickname); + String vvalue = pairs.get(nickname); String certValue = dateStr + "," + trust; - if (pair == null) - pairs.add(nickname, certValue); + if (vvalue == null) + pairs.put(nickname, certValue); else { - String vvalue = pair.getValue(); - - pair.setValue(vvalue + ";" + certValue); + pairs.put(nickname, vvalue + ";" + certValue); } } catch (CertificateException e) { log(ILogger.LL_FAILURE, diff --git a/pki/base/console/src/CMakeLists.txt b/pki/base/console/src/CMakeLists.txt index b164a33a0..175a4a1a7 100644 --- a/pki/base/console/src/CMakeLists.txt +++ b/pki/base/console/src/CMakeLists.txt @@ -85,7 +85,6 @@ set(pki-console_java_SRCS com/netscape/certsrv/common/ScopeDef.java com/netscape/certsrv/common/PrefixDef.java com/netscape/certsrv/common/ConfigConstants.java - com/netscape/certsrv/common/NameValuePair.java com/netscape/certsrv/common/OpDef.java com/netscape/certsrv/common/Constants.java com/netscape/admin/certsrv/CMSCCMUILoader.java diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java index bad1868b5..f967d28e0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java @@ -233,9 +233,7 @@ public class CMSCAUILoader implements ISubSystemUILoader { } if (nvps != null && nvps.size() > 0) { - Enumeration names = nvps.getNames(); - while (names.hasMoreElements()) { - String name = (String)names.nextElement(); + for (String name : nvps.keySet()) { if (name.indexOf('.') == -1) { node = new CMSResourceObject(); node.setName(name); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java index 2c4de161f..cb232c527 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java @@ -306,8 +306,7 @@ public class CMSKernelUILoader implements ISubSystemUILoader { } //update the index - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = (String)e.nextElement(); + for (String entry : response.keySet()) { CMSResourceObject node = new CMSResourceObject(entry); node.setCustomPanel(new LogInstancePanel(entry, model)); node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LOGOBJECT)); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java index d4646c2a0..d2d64b3fc 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java @@ -18,14 +18,9 @@ package com.netscape.admin.certsrv; import java.util.*; -import java.awt.*; -import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.border.*; -import javax.swing.text.*; + import com.netscape.management.client.util.*; -import com.netscape.management.client.console.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; @@ -102,7 +97,7 @@ public class CMSServerInfo implements IConnectionListener { // Need to do authentication here NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_PING,""); + config.put(Constants.PR_PING, ""); NameValuePairs response; @@ -111,7 +106,7 @@ public class CMSServerInfo implements IConnectionListener { Constants.RS_ID_CONFIG, config); - if (!response.getValue(Constants.PR_PING).equalsIgnoreCase(Constants.TRUE)) { + if (!response.get(Constants.PR_PING).equalsIgnoreCase(Constants.TRUE)) { Debug.println("Ping failed -> Server off"); throw new EAdminException("PING_FAILED",false); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java index 6949e73f6..13028b003 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java @@ -23,7 +23,6 @@ import com.netscape.management.client.util.*; import com.netscape.management.client.console.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; -import java.util.*; /** * Netscape Certificate Server 4.0 UI Framework @@ -88,7 +87,7 @@ public class CMSUIFramework { ScopeDef.SC_PLATFORM, new NameValuePairs()); if (response == null) throw new EAdminException("PROTOCOL_ERROR",false); - if (response.getValue(Constants.PR_NT).equals(Constants.TRUE)) + if (response.get(Constants.PR_NT).equals(Constants.TRUE)) return true; return false; } @@ -207,9 +206,9 @@ class HTTPSSubSystemLocator implements ISubSystemLocator { Debug.println("getInstalledSubSystem() - "+input.toString()); SubSystemInfo[] subsystems = new SubSystemInfo[input.size()]; int i =0; - for (Enumeration e = input.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = input.getValue(entry); + for (String entry : input.keySet()) { + entry = entry.trim(); + String value = input.get(entry); subsystems[i] = new SubSystemInfo(); subsystems[i].mType = value; subsystems[i].mNickName = entry; diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java index 7c2948795..e6085f820 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java @@ -18,16 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.config.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -250,13 +246,11 @@ public class ACIDialog extends JDialog } private boolean validateSyntax(String str, NameValuePairs nvps) { - Enumeration names = nvps.getNames(); - while (names.hasMoreElements()) { - String name = (String)names.nextElement(); + for (String name : nvps.keySet()) { if (str.startsWith(name)) { int len = name.length(); String leftover = str.substring(len).trim(); - String operators = nvps.getValue(name); + String operators = nvps.get(name); StringTokenizer st = new StringTokenizer(operators, ","); while (st.hasMoreTokens()) { String token = st.nextToken(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java index 9aa392eaf..b3bcb72e1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java @@ -18,16 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.config.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -145,9 +141,9 @@ public class ACLEditDialog extends JDialog else str = str+(String)mDataModel.elementAt(i); } - pairs.add(Constants.PR_ACI, str); - pairs.add(Constants.PR_ACL_DESC, desc); - pairs.add(Constants.PR_ACL_RIGHTS, rights); + pairs.put(Constants.PR_ACI, str); + pairs.put(Constants.PR_ACL_DESC, desc); + pairs.put(Constants.PR_ACL_RIGHTS, rights); } try { @@ -204,8 +200,8 @@ public class ACLEditDialog extends JDialog } public void showDialog(NameValuePairs data) { - String aci = data.getValue(Constants.PR_ACI); - mOperations = data.getValue(Constants.PR_ACL_OPS); + String aci = data.get(Constants.PR_ACI); + mOperations = data.get(Constants.PR_ACL_OPS); if ((aci != null) && (!aci.trim().equals(""))) { StringTokenizer tokenizer = new StringTokenizer(aci, ";"); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java index b0dd8bb9e..4693224b1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java @@ -204,9 +204,8 @@ public class ACLImplTab extends CMSBaseUGTab { int i=0; String[] vals = new String[response.size()]; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } CMSAdminUtil.bubbleSort(vals); @@ -217,7 +216,7 @@ public class ACLImplTab extends CMSBaseUGTab { v.addElement(new JLabel(name, CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ACLPLUGIN), JLabel.LEFT)); - v.addElement(response.getValue(name)); + v.addElement(response.get(name)); mDataModel.addRow(v); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java index 3b3d8c529..2593e0c0b 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java @@ -202,9 +202,8 @@ public class ACLPanel extends CMSBaseUGTab { int i=0; String[] vals = new String[response.size()]; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } CMSAdminUtil.bubbleSort(vals); @@ -215,7 +214,7 @@ public class ACLPanel extends CMSBaseUGTab { v.addElement(new JLabel(name, CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ACL), JLabel.LEFT)); - v.addElement(response.getValue(name)); + v.addElement(response.get(name)); mDataModel.addRow(v); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java index e57c56271..18590747a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.management.client.console.*; import com.netscape.certsrv.common.*; @@ -123,17 +122,16 @@ public class CACertsTab extends CMSBaseUGTab { try { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NICK_NAME, nickname); - nvps.add(Constants.PR_SERIAL_NUMBER, serialno); - nvps.add(Constants.PR_ISSUER_NAME, issuername); + nvps.put(Constants.PR_NICK_NAME, nickname); + nvps.put(Constants.PR_SERIAL_NUMBER, serialno); + nvps.put(Constants.PR_ISSUER_NAME, issuername); NameValuePairs results = mConnection.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT, Constants.RS_ID_CONFIG, nvps); if (nvps.size() <= 0) return; - NameValuePair nvp = results.elementAt(0); - String name = nvp.getName(); - String print = nvp.getValue(); + String name = results.keySet().iterator().next(); // first element + String print = results.get(name); CertViewDialog certdialog = new CertViewDialog(mModel.getFrame()); certdialog.showDialog(nickname, print); } catch (EAdminException ex) { @@ -150,17 +148,16 @@ public class CACertsTab extends CMSBaseUGTab { try { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NICK_NAME, nickname); - nvps.add(Constants.PR_SERIAL_NUMBER, serialno); - nvps.add(Constants.PR_ISSUER_NAME, issuername); + nvps.put(Constants.PR_NICK_NAME, nickname); + nvps.put(Constants.PR_SERIAL_NUMBER, serialno); + nvps.put(Constants.PR_ISSUER_NAME, issuername); NameValuePairs results = mConnection.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ROOTCERT_TRUSTBIT, Constants.RS_ID_CONFIG, nvps); if (nvps.size() <= 0) return; - NameValuePair nvp = results.elementAt(0); - String name = nvp.getName(); - String trust = nvp.getValue(); + String name = results.keySet().iterator().next(); // first element + String trust = results.get(name); int i; String[] params = new String[2]; if (trust.equals("U")) { @@ -174,7 +171,7 @@ public class CACertsTab extends CMSBaseUGTab { } if (i == JOptionPane.YES_OPTION) { - nvps.add("trustbit", params[1]); + nvps.put("trustbit", params[1]); mConnection.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ROOTCERT_TRUSTBIT, Constants.RS_ID_CONFIG, nvps); @@ -333,9 +330,8 @@ public class CACertsTab extends CMSBaseUGTab { if (response != null) { String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } int sindex = 0; @@ -344,7 +340,7 @@ public class CACertsTab extends CMSBaseUGTab { for (i=0; i<vals.length; i++) { Vector v = new Vector(); String entry = vals[i]; - String value = response.getValue(entry); + String value = response.get(entry); // look for the comma separator int lastindex = entry.lastIndexOf(","); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java index 420711e40..8f1fc1f20 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java @@ -18,13 +18,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import java.awt.*; + import java.awt.event.*; -import java.util.*; -import javax.swing.*; /** * Access Log Setting Tab to be displayed at the right hand side @@ -66,24 +63,24 @@ public class CMSAccessLogPanel extends CMSBaseLogPanel { public void refresh() { mModel.progressStart(); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_LOG_ENABLED, ""); - nvp.add(Constants.PR_LOG_LEVEL, ""); - nvp.add(Constants.PR_LOG_BUFFERSIZE, ""); + nvp.put(Constants.PR_LOG_ENABLED, ""); + nvp.put(Constants.PR_LOG_LEVEL, ""); + nvp.put(Constants.PR_LOG_BUFFERSIZE, ""); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, ""); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); + nvp.put(Constants.PR_LOG_MAXFILESIZE, ""); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_SYSTEMLOG, Constants.RS_ID_CONFIG, nvp); parseVals(val); if (mIsNT) { - nvp.removeAllPairs(); - nvp.add(Constants.PR_NT_EVENT_SOURCE, ""); - nvp.add(Constants.PR_NT_LOG_LEVEL, ""); - nvp.add(Constants.PR_NT_LOG_ENABLED, ""); + nvp.clear(); + nvp.put(Constants.PR_NT_EVENT_SOURCE, ""); + nvp.put(Constants.PR_NT_LOG_LEVEL, ""); + nvp.put(Constants.PR_NT_LOG_ENABLED, ""); val = mAdmin.read(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_NTSYSTEMLOG, Constants.RS_ID_CONFIG, nvp); parseNTVals(val); @@ -99,23 +96,23 @@ public class CMSAccessLogPanel extends CMSBaseLogPanel { } private void parseVals(NameValuePairs nvp) { - if (nvp.getValue(Constants.PR_LOG_ENABLED).equalsIgnoreCase( + if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase( Constants.TRUE)) activateLog.setSelected(true); else activateLog.setSelected(false); - mLevel = Integer.parseInt(nvp.getValue(Constants.PR_LOG_LEVEL)); - mlogBufSizTextData = nvp.getValue(Constants.PR_LOG_BUFFERSIZE); - mlogMaxSizTextData = nvp.getValue(Constants.PR_LOG_MAXFILESIZE); + mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL)); + mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE); + mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE); int val = - Integer.parseInt(nvp.getValue(Constants.PR_LOG_ROLLEROVER_INTERVAL)); + Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL)); mFrequency = getRollOverIndex(val); } private void parseNTVals(NameValuePairs nvp) { - mNTLevel = Integer.parseInt(nvp.getValue(Constants.PR_NT_LOG_LEVEL)); - mSource = nvp.getValue(Constants.PR_NT_EVENT_SOURCE); - if (nvp.getValue(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase( + mNTLevel = Integer.parseInt(nvp.get(Constants.PR_NT_LOG_LEVEL)); + mSource = nvp.get(Constants.PR_NT_EVENT_SOURCE); + if (nvp.get(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase( Constants.TRUE)) mActivateNTLog.setSelected(true); else @@ -152,33 +149,33 @@ public class CMSAccessLogPanel extends CMSBaseLogPanel { NameValuePairs nvp = new NameValuePairs(); mModel.progressStart(); if (activateLog.isSelected()) - nvp.add(Constants.PR_LOG_ENABLED, Constants.TRUE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE); else - nvp.add(Constants.PR_LOG_ENABLED, Constants.FALSE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE); String str = "" + mLogLevel.getSelectedIndex(); - nvp.add(Constants.PR_LOG_LEVEL, str); - nvp.add(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); + nvp.put(Constants.PR_LOG_LEVEL, str); + nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); + nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); str = "" + getRollOverTime(mlogFQC.getSelectedIndex()); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); try { mAdmin.modify(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_SYSTEMLOG, Constants.RS_ID_CONFIG, nvp); if (mIsNT) { - nvp.removeAllPairs(); - nvp.add(Constants.PR_NT_LOG_LEVEL, - ""+mNTLogLevel.getSelectedIndex()); - nvp.add(Constants.PR_NT_EVENT_SOURCE, - mEventSourceText.getText().trim()); + nvp.clear(); + nvp.put(Constants.PR_NT_LOG_LEVEL, + "" + mNTLogLevel.getSelectedIndex()); + nvp.put(Constants.PR_NT_EVENT_SOURCE, + mEventSourceText.getText().trim()); if (mActivateNTLog.isSelected()) - nvp.add(Constants.PR_NT_LOG_ENABLED, Constants.TRUE); + nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.TRUE); else - nvp.add(Constants.PR_NT_LOG_ENABLED, Constants.FALSE); + nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.FALSE); mAdmin.modify(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_NTSYSTEMLOG, Constants.RS_ID_CONFIG, nvp); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java index ba03e487b..067b954e8 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java @@ -18,13 +18,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import java.awt.*; + import java.awt.event.*; -import java.util.*; -import javax.swing.*; /** * Audit Log Setting Tab to be displayed at the right hand side @@ -66,24 +63,24 @@ public class CMSAuditLogPanel extends CMSBaseLogPanel { public void refresh() { mModel.progressStart(); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_LOG_ENABLED, ""); - nvp.add(Constants.PR_LOG_LEVEL, ""); - nvp.add(Constants.PR_LOG_BUFFERSIZE, ""); + nvp.put(Constants.PR_LOG_ENABLED, ""); + nvp.put(Constants.PR_LOG_LEVEL, ""); + nvp.put(Constants.PR_LOG_BUFFERSIZE, ""); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, ""); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); + nvp.put(Constants.PR_LOG_MAXFILESIZE, ""); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_AUDITLOG, Constants.RS_ID_CONFIG, nvp); parseVals(val); if (mIsNT) { - nvp.removeAllPairs(); - nvp.add(Constants.PR_NT_EVENT_SOURCE, ""); - nvp.add(Constants.PR_NT_LOG_LEVEL, ""); - nvp.add(Constants.PR_NT_LOG_ENABLED, ""); + nvp.clear(); + nvp.put(Constants.PR_NT_EVENT_SOURCE, ""); + nvp.put(Constants.PR_NT_LOG_LEVEL, ""); + nvp.put(Constants.PR_NT_LOG_ENABLED, ""); val = mAdmin.read(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_NTAUDITLOG, Constants.RS_ID_CONFIG, nvp); parseNTVals(val); @@ -99,23 +96,23 @@ public class CMSAuditLogPanel extends CMSBaseLogPanel { } private void parseVals(NameValuePairs nvp) { - if (nvp.getValue(Constants.PR_LOG_ENABLED).equalsIgnoreCase( + if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase( Constants.TRUE)) activateLog.setSelected(true); else activateLog.setSelected(false); - mLevel = Integer.parseInt(nvp.getValue(Constants.PR_LOG_LEVEL)); - mlogBufSizTextData = nvp.getValue(Constants.PR_LOG_BUFFERSIZE); - mlogMaxSizTextData = nvp.getValue(Constants.PR_LOG_MAXFILESIZE); + mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL)); + mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE); + mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE); int val = - Integer.parseInt(nvp.getValue(Constants.PR_LOG_ROLLEROVER_INTERVAL)); + Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL)); mFrequency = getRollOverIndex(val); } private void parseNTVals(NameValuePairs nvp) { - mNTLevel = Integer.parseInt(nvp.getValue(Constants.PR_NT_LOG_LEVEL)); - mSource = nvp.getValue(Constants.PR_NT_EVENT_SOURCE); - if (nvp.getValue(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase( + mNTLevel = Integer.parseInt(nvp.get(Constants.PR_NT_LOG_LEVEL)); + mSource = nvp.get(Constants.PR_NT_EVENT_SOURCE); + if (nvp.get(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase( Constants.TRUE)) mActivateNTLog.setSelected(true); else @@ -152,33 +149,33 @@ public class CMSAuditLogPanel extends CMSBaseLogPanel { NameValuePairs nvp = new NameValuePairs(); mModel.progressStart(); if (activateLog.isSelected()) - nvp.add(Constants.PR_LOG_ENABLED, Constants.TRUE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE); else - nvp.add(Constants.PR_LOG_ENABLED, Constants.FALSE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE); String str = "" + mLogLevel.getSelectedIndex(); - nvp.add(Constants.PR_LOG_LEVEL, str); - nvp.add(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); + nvp.put(Constants.PR_LOG_LEVEL, str); + nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); + nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); str = "" + getRollOverTime(mlogFQC.getSelectedIndex()); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); try { mAdmin.modify(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_AUDITLOG, Constants.RS_ID_CONFIG, nvp); if (mIsNT) { - nvp.removeAllPairs(); - nvp.add(Constants.PR_NT_LOG_LEVEL, - ""+mNTLogLevel.getSelectedIndex()); - nvp.add(Constants.PR_NT_EVENT_SOURCE, - mEventSourceText.getText().trim()); + nvp.clear(); + nvp.put(Constants.PR_NT_LOG_LEVEL, + "" + mNTLogLevel.getSelectedIndex()); + nvp.put(Constants.PR_NT_EVENT_SOURCE, + mEventSourceText.getText().trim()); if (mActivateNTLog.isSelected()) - nvp.add(Constants.PR_NT_LOG_ENABLED, Constants.TRUE); + nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.TRUE); else - nvp.add(Constants.PR_NT_LOG_ENABLED, Constants.FALSE); + nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.FALSE); mAdmin.modify(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_NTAUDITLOG, Constants.RS_ID_CONFIG, nvp); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java index 3fcaedea6..ef55470c6 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java @@ -24,7 +24,7 @@ import javax.swing.*; import javax.swing.table.*; import javax.swing.text.*; import javax.swing.event.*; -import javax.swing.border.*; + import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; @@ -88,8 +88,8 @@ public class CMSAutoRecovery extends JDialog implements ActionListener, return; } else { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_RECOVERY_AGENT, val); - nvps.add(Constants.PR_AUTO_RECOVERY_ON, Constants.TRUE); + nvps.put(Constants.PR_RECOVERY_AGENT, val); + nvps.put(Constants.PR_AUTO_RECOVERY_ON, Constants.TRUE); try { mAdmin.modify(DestDef.DEST_KRA_ADMIN, @@ -216,13 +216,13 @@ public class CMSAutoRecovery extends JDialog implements ActionListener, private void createTable() { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_RECOVERY_M, ""); + nvps.put(Constants.PR_RECOVERY_M, ""); int numUsers = 0; try { NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN, ScopeDef.SC_RECOVERY, Constants.RS_ID_CONFIG, nvps); - String str = val.getValue(Constants.PR_RECOVERY_M); + String str = val.get(Constants.PR_RECOVERY_M); numUsers = Integer.parseInt(str); } catch (EAdminException e) { //showErrorDialog(e.toString()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java index 20116c54c..87562829b 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java @@ -20,13 +20,11 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -177,30 +175,25 @@ public class CMSBaseConfigDialog extends JDialog /* if the servlet or rule wasn't capable of handling the new style * of interface, just return the names from the name/value pairs that * were passed in - */ - - Enumeration enum1 = oldstyle.elements(); - - /* otherwise, for each parameter name, fetch the associated + * otherwise, for each parameter name, fetch the associated * parameter type from the extendedPluginInfo that the server * returned */ - while (enum1.hasMoreElements()) { - NameValuePair pair = (NameValuePair)enum1.nextElement(); - NameValuePair epiNVPair = (NameValuePair)response.getPair(pair.getName()); - if (epiNVPair != null) { - epis.add(pair.getName(), epiNVPair.getValue(),false); + for (String name : oldstyle.keySet()) { + String value = response.get(name); + if (value != null) { + epis.add(name, value,false); } else { - epis.add(pair.getName(), "",true); + epis.add(name, "",true); } } - String ht = response.getValue("HELP_TOKEN"); + String ht = response.get("HELP_TOKEN"); if (ht != null) epis.setHelpToken(ht); - String hs = response.getValue("HELP_TEXT"); + String hs = response.get("HELP_TEXT"); if (hs != null) epis.setHelpSummary(hs); return epis; @@ -223,11 +216,11 @@ public class CMSBaseConfigDialog extends JDialog GridBagConstraints gbc = new GridBagConstraints(); p.setLayout(gb); - mRuleName = data.getValue(mImplName_token); + mRuleName = data.get(mImplName_token); mEPIs = getExtendedPluginInfo(mRuleName,data); - for (Enumeration e = data.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); + for (String entry : data.keySet()) { + entry = entry.trim(); Debug.println("in CMSBaseConfigDialog.showDialog() entry=" + entry); if (!entry.equals(mImplName_token)) { String labelname = entry; @@ -238,7 +231,7 @@ public class CMSBaseConfigDialog extends JDialog */ JComponent comp = null; - String stringvalue = data.getValue(entry); + String stringvalue = data.get(entry); ExtendedPluginInfo epi = mEPIs.get(entry); if (epi == null) { Debug.println("no ExtendedPluginInfo for "+entry); @@ -485,14 +478,14 @@ public class CMSBaseConfigDialog extends JDialog String password = value; value = "Rule "+mRuleName; if (password != null && password.length() >0) { - nvp.add("PASSWORD_CACHE_ADD",value+";"+password); + nvp.put("PASSWORD_CACHE_ADD", value + ";" + password); } } - nvp.add(paramName,value); + nvp.put(paramName, value); } - nvp.add(PolicyRuleDataModel.RULE_NAME,mRuleName); - nvp.add(mImplName_token,mImplName.getText()); + nvp.put(PolicyRuleDataModel.RULE_NAME, mRuleName); + nvp.put(mImplName_token, mImplName.getText()); mData = nvp; try { @@ -502,7 +495,7 @@ public class CMSBaseConfigDialog extends JDialog } else { if (mId != null && mId.length() > 0) { - nvp.add(Constants.PR_ID, mId); + nvp.put(Constants.PR_ID, mId); } mAdminConnection.modify(mDest, mInstanceScope, mRuleName, nvp); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java index cb8826d2a..dbba4a763 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java @@ -234,24 +234,24 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); if (mPublishing) - nvps.add(Constants.PR_PUBLISHING_ENABLE,""); + nvps.put(Constants.PR_PUBLISHING_ENABLE, ""); if (mLDAPPublishing) - nvps.add(Constants.PR_ENABLE,""); - nvps.add(Constants.PR_HOST_NAME, ""); - nvps.add(Constants.PR_LDAP_PORT, ""); - nvps.add(Constants.PR_SECURE_PORT_ENABLED, ""); + nvps.put(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_HOST_NAME, ""); + nvps.put(Constants.PR_LDAP_PORT, ""); + nvps.put(Constants.PR_SECURE_PORT_ENABLED, ""); //nvps.add(Constants.PR_BASE_DN, ""); - nvps.add(Constants.PR_BIND_DN, ""); - nvps.add(Constants.PR_LDAP_VERSION, ""); - nvps.add(Constants.PR_AUTH_TYPE, ""); - nvps.add(Constants.PR_CERT_NAMES, ""); - nvps.add(Constants.PR_LDAP_CLIENT_CERT, ""); - - nvps.add(Constants.PR_PUBLISHING_QUEUE_ENABLE, ""); - nvps.add(Constants.PR_PUBLISHING_QUEUE_THREADS, ""); - nvps.add(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, ""); - nvps.add(Constants.PR_PUBLISHING_QUEUE_PRIORITY, ""); - nvps.add(Constants.PR_PUBLISHING_QUEUE_STATUS, ""); + nvps.put(Constants.PR_BIND_DN, ""); + nvps.put(Constants.PR_LDAP_VERSION, ""); + nvps.put(Constants.PR_AUTH_TYPE, ""); + nvps.put(Constants.PR_CERT_NAMES, ""); + nvps.put(Constants.PR_LDAP_CLIENT_CERT, ""); + + nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, ""); + nvps.put(Constants.PR_PUBLISHING_QUEUE_THREADS, ""); + nvps.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, ""); + nvps.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, ""); + nvps.put(Constants.PR_PUBLISHING_QUEUE_STATUS, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -280,27 +280,26 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene int serverCertIndex = -1; String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_HOST_NAME)) { - mHostNameText.setText(nvp.getValue()); + mHostNameText.setText(value); } else if (name.equals(Constants.PR_LDAP_PORT)) { - mPortText.setText(nvp.getValue()); + mPortText.setText(value); } else if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mSecurePort.setSelected(true); else mSecurePort.setSelected(false); } else if (name.equals(Constants.PR_BIND_DN)) { - mBindAsText.setText(nvp.getValue()); + mBindAsText.setText(value); } else if (name.equals(Constants.PR_PUBLISHING_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnablePublishing.setSelected(true); else mEnablePublishing.setSelected(false); } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) { + if (value.equals(Constants.TRUE)) { mEnableQueue.setSelected(true); mPublishingQueue = true; } else { @@ -308,25 +307,25 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene mPublishingQueue = false; } } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_THREADS)) { - mMaxNumberOfPublishingThreads = nvp.getValue(); + mMaxNumberOfPublishingThreads = value; } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE)) { - mPublishingQueuePageSize = nvp.getValue(); + mPublishingQueuePageSize = value; } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_PRIORITY)) { - mPublishingQueuePriorityLevel = nvp.getValue(); + mPublishingQueuePriorityLevel = value; } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_STATUS)) { - mPublishingQueueStatus = nvp.getValue(); + mPublishingQueueStatus = value; } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); } else if (name.equals(Constants.PR_AUTH_TYPE)) { - int index = getIndex(nvp.getValue(), AUTHTYPE); + int index = getIndex(value, AUTHTYPE); if (index >= 0) mAuthBox.setSelectedIndex(index); } else if (name.equals(Constants.PR_CERT_NAMES)) { mCertBox.removeAllItems(); - String certNames = nvp.getValue(); + String certNames = value; StringTokenizer tokenizer = new StringTokenizer(certNames, DELIMITER); for (int index=0; tokenizer.hasMoreTokens(); index++) { @@ -336,9 +335,9 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene mCertBox.addItem(str); } } else if (name.equals(Constants.PR_LDAP_CLIENT_CERT)) { - clientCert = nvp.getValue(); + clientCert = value; } else if (name.equals(Constants.PR_LDAP_VERSION)) { - version = nvp.getValue(); + version = value; } } @@ -512,26 +511,26 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene if (mPublishing) { if (mEnablePublishing.isSelected()) - nvps.add(Constants.PR_PUBLISHING_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_PUBLISHING_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_PUBLISHING_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_PUBLISHING_ENABLE, Constants.FALSE); } if (mLDAPPublishing) { if (mEnable.isSelected()) - nvps.add(Constants.PR_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_ENABLE, Constants.FALSE); } if (mEnableQueue.isSelected()) - nvps.add(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE); + nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.FALSE); - nvps.add(Constants.PR_PUBLISHING_QUEUE_THREADS, mMaxNumberOfPublishingThreads); - nvps.add(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, mPublishingQueuePageSize); - nvps.add(Constants.PR_PUBLISHING_QUEUE_PRIORITY, mPublishingQueuePriorityLevel); - nvps.add(Constants.PR_PUBLISHING_QUEUE_STATUS, mPublishingQueueStatus); + nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.FALSE); + nvps.put(Constants.PR_PUBLISHING_QUEUE_THREADS, mMaxNumberOfPublishingThreads); + nvps.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, mPublishingQueuePageSize); + nvps.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, mPublishingQueuePriorityLevel); + nvps.put(Constants.PR_PUBLISHING_QUEUE_STATUS, mPublishingQueueStatus); if (mEnable.isSelected()) { String host = mHostNameText.getText().trim(); @@ -550,21 +549,21 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene showMessageDialog("NUMBERFORMAT"); return false; } - nvps.add(Constants.PR_HOST_NAME, host); - nvps.add(Constants.PR_LDAP_PORT, port); + nvps.put(Constants.PR_HOST_NAME, host); + nvps.put(Constants.PR_LDAP_PORT, port); if (mSecurePort.isSelected()) - nvps.add(Constants.PR_SECURE_PORT_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_SECURE_PORT_ENABLED, Constants.TRUE); else - nvps.add(Constants.PR_SECURE_PORT_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_SECURE_PORT_ENABLED, Constants.FALSE); if (mAuthBox.getSelectedIndex() == 0) { if (mPanelName.equals("CALDAPSETTING")) { - nvps.add(Constants.PR_BINDPWD_PROMPT, "CA LDAP Publishing"); + nvps.put(Constants.PR_BINDPWD_PROMPT, "CA LDAP Publishing"); } else { - nvps.add(Constants.PR_BINDPWD_PROMPT, "RA LDAP Publishing"); + nvps.put(Constants.PR_BINDPWD_PROMPT, "RA LDAP Publishing"); } - nvps.add(Constants.PR_BIND_DN, bindAs); + nvps.put(Constants.PR_BIND_DN, bindAs); passwd = mPasswordText.getText(); if (passwd.equals("")) { @@ -572,10 +571,10 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene return false; } - nvps.add(Constants.PR_DIRECTORY_MANAGER_PWD, passwd); + nvps.put(Constants.PR_DIRECTORY_MANAGER_PWD, passwd); } else { - nvps.add(Constants.PR_LDAP_CLIENT_CERT, - (String)(mCertBox.getSelectedItem())); + nvps.put(Constants.PR_LDAP_CLIENT_CERT, + (String) (mCertBox.getSelectedItem())); } int index = mAuthBox.getSelectedIndex(); @@ -585,11 +584,11 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene return false; } } - nvps.add(Constants.PR_AUTH_TYPE, AUTHTYPE[index]); - nvps.add(Constants.PR_LDAP_VERSION, - (String)mVersionBox.getSelectedItem()); + nvps.put(Constants.PR_AUTH_TYPE, AUTHTYPE[index]); + nvps.put(Constants.PR_LDAP_VERSION, + (String) mVersionBox.getSelectedItem()); - // test the connection before save + // test the connection before save /* LDAPConnection conn = null; if (mAuthBox.getSelectedIndex() == 1) { @@ -642,8 +641,8 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene Constants.RS_ID_CONFIG, nvps, false); // show test report String report = ""; - for (int i = 0; i<nvps1.size();i++) { - report = report + nvps1.elementAt(i).getValue() + "\n"; + for (String value : nvps1.values()) { + report = report + value + "\n"; } if (report.indexOf("Fail") == -1) { JOptionPane.showMessageDialog( @@ -665,8 +664,8 @@ public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListene Constants.RS_ID_CONFIG, nvps, false); clearDirtyFlag(); } else { - nvps.add(Constants.PR_ENABLE, "false"); - mAdmin.modify(mServletName, ScopeDef.SC_LDAP, + nvps.put(Constants.PR_ENABLE, "false"); + mAdmin.modify(mServletName, ScopeDef.SC_LDAP, Constants.RS_ID_CONFIG, nvps, false); } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java index a43df0d12..76aa59511 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java @@ -20,8 +20,7 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import javax.swing.*; -import java.awt.*; + import java.awt.event.*; /** @@ -71,8 +70,8 @@ public class CMSCACertSettingPanel extends CMSCertSettingPanel { public void refresh() { _model.progressStart(); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_MAPPER, ""); - nvp.add(Constants.PR_PUBLISHER, ""); + nvp.put(Constants.PR_MAPPER, ""); + nvp.put(Constants.PR_PUBLISHER, ""); try { NameValuePairs val = _admin.read(DestDef.DEST_CA_ADMIN, @@ -159,13 +158,12 @@ public class CMSCACertSettingPanel extends CMSCertSettingPanel { */ private void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_MAPPER)) { - _mapper.setText(nvp.getValue()); + _mapper.setText(value); } else if (name.equals(Constants.PR_PUBLISHER)) { - _publisher.setText(nvp.getValue()); + _publisher.setText(value); } } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java index 0ddb90dc4..1af02a881 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java @@ -18,15 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.management.client.*; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.border.*; import java.awt.*; import java.awt.event.*; -import java.util.*; /** * CA Connector Panel @@ -150,15 +147,15 @@ public class CMSCAConnectorPanel extends CMSBaseTab JFrame frame = mModel.getFrame(); String name = (String)mList.getSelectedValue(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ID, ""); - nvps.add(Constants.PR_HOST, ""); - nvps.add(Constants.PR_PORT, ""); + nvps.put(Constants.PR_ID, ""); + nvps.put(Constants.PR_HOST, ""); + nvps.put(Constants.PR_PORT, ""); // Inserted by beomsuk - nvps.add(Constants.PR_TIMEOUT, ""); + nvps.put(Constants.PR_TIMEOUT, ""); // Insert end - nvps.add(Constants.PR_URI, ""); - nvps.add(Constants.PR_LOCAL, ""); - nvps.add(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_URI, ""); + nvps.put(Constants.PR_LOCAL, ""); + nvps.put(Constants.PR_ENABLE, ""); try { NameValuePairs values = mAdmin.read(DestDef.DEST_CA_ADMIN, @@ -168,7 +165,7 @@ public class CMSCAConnectorPanel extends CMSBaseTab boolean colocated = false; if (name.equals("Data Recovery Manager Connector")) { - String val = values.getValue("id"); + String val = values.get("id"); if (val != null && val.equals("kra")) colocated = true; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java index 3efcd1bbc..6f809316a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java @@ -249,13 +249,13 @@ public class CMSCAGeneralPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_EE_ENABLED, ""); + nvps.put(Constants.PR_EE_ENABLED, ""); //nvps.add(Constants.PR_RA_ENABLED, ""); - nvps.add(Constants.PR_DEFAULT_ALGORITHM, ""); - nvps.add(Constants.PR_ALL_ALGORITHMS, ""); - nvps.add(Constants.PR_SERIAL, ""); - nvps.add(Constants.PR_MAXSERIAL, ""); - nvps.add(Constants.PR_VALIDITY, ""); + nvps.put(Constants.PR_DEFAULT_ALGORITHM, ""); + nvps.put(Constants.PR_ALL_ALGORITHMS, ""); + nvps.put(Constants.PR_SERIAL, ""); + nvps.put(Constants.PR_MAXSERIAL, ""); + nvps.put(Constants.PR_VALIDITY, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_CA_ADMIN, @@ -272,31 +272,30 @@ public class CMSCAGeneralPanel extends CMSBaseTab implements ItemListener { protected void populate(NameValuePairs nvps) { String defaultAlgorithm = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_EE_ENABLED)) { - mEEEnable.setSelected(getBoolean(nvp.getValue())); + mEEEnable.setSelected(getBoolean(value)); } else if (name.equals(Constants.PR_OCSP_ENABLED)) { - mOCSPEnable.setSelected(getBoolean(nvp.getValue())); + mOCSPEnable.setSelected(getBoolean(value)); /* } else if (name.equals(Constants.PR_RA_ENABLED)) { mRAEnable.setSelected(getBoolean(nvp.getValue())); */ } else if (name.equals(Constants.PR_VALIDITY)) { - mValidity.setSelected(getBoolean(nvp.getValue())); + mValidity.setSelected(getBoolean(value)); } else if (name.equals(Constants.PR_DEFAULT_ALGORITHM)) { - defaultAlgorithm = nvp.getValue(); + defaultAlgorithm = value; } else if (name.equals(Constants.PR_ALL_ALGORITHMS)) { - initAlgorithmBox(nvp.getValue()); + initAlgorithmBox(value); } else if (name.equals(Constants.PR_SERIAL)) { - String serial = nvp.getValue(); + String serial = value; if (!serial.equals("")) mSerialNumber.setText(serial); else mSerialNumber.setText("All serial numbers are used"); } else if (name.equals(Constants.PR_MAXSERIAL)) { - String serial = nvp.getValue(); + String serial = value; if (!serial.equals("")) mMaxSerialNumber.setText(serial); } @@ -340,14 +339,14 @@ public class CMSCAGeneralPanel extends CMSBaseTab implements ItemListener { NameValuePairs nvps = new NameValuePairs(); if (mEEEnable.isSelected()) - nvps.add(Constants.PR_EE_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_EE_ENABLED, Constants.TRUE); else - nvps.add(Constants.PR_EE_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_EE_ENABLED, Constants.FALSE); if (mOCSPEnable.isSelected()) - nvps.add(Constants.PR_OCSP_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_OCSP_ENABLED, Constants.TRUE); else - nvps.add(Constants.PR_OCSP_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_OCSP_ENABLED, Constants.FALSE); /* if (mRAEnable.isSelected()) @@ -357,12 +356,12 @@ public class CMSCAGeneralPanel extends CMSBaseTab implements ItemListener { */ if (mValidity.isSelected()) - nvps.add(Constants.PR_VALIDITY, Constants.TRUE); + nvps.put(Constants.PR_VALIDITY, Constants.TRUE); else - nvps.add(Constants.PR_VALIDITY, Constants.FALSE); + nvps.put(Constants.PR_VALIDITY, Constants.FALSE); - nvps.add(Constants.PR_DEFAULT_ALGORITHM, - (String)mAlgorithms.getSelectedItem()); + nvps.put(Constants.PR_DEFAULT_ALGORITHM, + (String) mAlgorithms.getSelectedItem()); String serial = (String)mSerialNumber.getText().trim(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java index 723668790..51da9c58c 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java @@ -24,7 +24,6 @@ import com.netscape.admin.certsrv.connection.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; -import java.util.StringTokenizer; /** * Panel Setting CRL Cache @@ -205,10 +204,10 @@ public class CMSCRLCachePanel extends CMSBaseTab { public void refresh() { _model.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE_CACHE, ""); - nvps.add(Constants.PR_CACHE_FREQ, ""); - nvps.add(Constants.PR_CACHE_RECOVERY, ""); - nvps.add(Constants.PR_CACHE_TESTING, ""); + nvps.put(Constants.PR_ENABLE_CACHE, ""); + nvps.put(Constants.PR_CACHE_FREQ, ""); + nvps.put(Constants.PR_CACHE_RECOVERY, ""); + nvps.put(Constants.PR_CACHE_TESTING, ""); try { NameValuePairs val = null; @@ -233,10 +232,8 @@ public class CMSCRLCachePanel extends CMSBaseTab { public void populate(NameValuePairs nvps) { String signingAlg = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); - String value = nvp.getValue().trim(); + for (String name : nvps.keySet()) { + String value = nvps.get(name).trim(); if (name.equals(Constants.PR_ENABLE_CACHE)) { mEnableCache.setSelected(getBoolean(value, true)); } else if (name.equals(Constants.PR_CACHE_FREQ)) { @@ -276,9 +273,9 @@ public class CMSCRLCachePanel extends CMSBaseTab { if (mEnableCache.isSelected()) - nvps.add(Constants.PR_ENABLE_CACHE, Constants.TRUE); + nvps.put(Constants.PR_ENABLE_CACHE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE_CACHE, Constants.FALSE); + nvps.put(Constants.PR_ENABLE_CACHE, Constants.FALSE); cacheFreq = mCacheFreq.getText().trim(); if (cacheFreq.equals("")) { @@ -295,18 +292,18 @@ public class CMSCRLCachePanel extends CMSBaseTab { showMessageDialog("NUMBERFORMAT"); return false; } - nvps.add(Constants.PR_CACHE_FREQ, cacheFreq); + nvps.put(Constants.PR_CACHE_FREQ, cacheFreq); if (mEnableCacheRecovery.isSelected()) - nvps.add(Constants.PR_CACHE_RECOVERY, Constants.TRUE); + nvps.put(Constants.PR_CACHE_RECOVERY, Constants.TRUE); else - nvps.add(Constants.PR_CACHE_RECOVERY, Constants.FALSE); + nvps.put(Constants.PR_CACHE_RECOVERY, Constants.FALSE); if (mEnableCacheTesting.isSelected()) - nvps.add(Constants.PR_CACHE_TESTING, Constants.TRUE); + nvps.put(Constants.PR_CACHE_TESTING, Constants.TRUE); else - nvps.add(Constants.PR_CACHE_TESTING, Constants.FALSE); + nvps.put(Constants.PR_CACHE_TESTING, Constants.FALSE); _model.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java index 6e22af602..3257b90a0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java @@ -220,14 +220,14 @@ public class CMSCRLFormatPanel extends CMSBaseTab { public void refresh() { _model.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_EXTENSIONS, ""); - nvps.add(Constants.PR_SIGNING_ALGORITHM, ""); - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS, ""); - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, ""); - nvps.add(Constants.PR_CA_CERTS_ONLY, ""); - nvps.add(Constants.PR_PROFILE_CERTS_ONLY, ""); - nvps.add(Constants.PR_PROFILE_LIST, ""); - nvps.add(Constants.PR_ENABLE_CACHE, ""); + nvps.put(Constants.PR_EXTENSIONS, ""); + nvps.put(Constants.PR_SIGNING_ALGORITHM, ""); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, ""); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, ""); + nvps.put(Constants.PR_CA_CERTS_ONLY, ""); + nvps.put(Constants.PR_PROFILE_CERTS_ONLY, ""); + nvps.put(Constants.PR_PROFILE_LIST, ""); + nvps.put(Constants.PR_ENABLE_CACHE, ""); try { NameValuePairs val = null; @@ -259,10 +259,8 @@ public class CMSCRLFormatPanel extends CMSBaseTab { public void populate(NameValuePairs nvps) { String signingAlg = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); - String value = nvp.getValue().trim(); + for (String name : nvps.keySet()) { + String value = nvps.get(name).trim(); if (name.equals(Constants.PR_EXTENSIONS)) { mEnableExtensions.setSelected(getBoolean(value)); } else if (name.equals(Constants.PR_SIGNING_ALGORITHM)) { @@ -328,29 +326,29 @@ public class CMSCRLFormatPanel extends CMSBaseTab { NameValuePairs nvps = new NameValuePairs(); if (mEnableExtensions.isSelected()) - nvps.add(Constants.PR_EXTENSIONS, Constants.TRUE); + nvps.put(Constants.PR_EXTENSIONS, Constants.TRUE); else - nvps.add(Constants.PR_EXTENSIONS, Constants.FALSE); + nvps.put(Constants.PR_EXTENSIONS, Constants.FALSE); if (mEnableExpired.isSelected()) - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.TRUE); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.TRUE); else - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.FALSE); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.FALSE); if (mEnableOneExtraTime.isSelected()) - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.TRUE); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.TRUE); else - nvps.add(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.FALSE); + nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.FALSE); if (mCACertsOnly.isSelected()) - nvps.add(Constants.PR_CA_CERTS_ONLY, Constants.TRUE); + nvps.put(Constants.PR_CA_CERTS_ONLY, Constants.TRUE); else - nvps.add(Constants.PR_CA_CERTS_ONLY, Constants.FALSE); + nvps.put(Constants.PR_CA_CERTS_ONLY, Constants.FALSE); if (mProfileCertsOnly.isSelected()) - nvps.add(Constants.PR_PROFILE_CERTS_ONLY, Constants.TRUE); + nvps.put(Constants.PR_PROFILE_CERTS_ONLY, Constants.TRUE); else - nvps.add(Constants.PR_PROFILE_CERTS_ONLY, Constants.FALSE); + nvps.put(Constants.PR_PROFILE_CERTS_ONLY, Constants.FALSE); String profileList = null; if (mProfileCertsOnly.isSelected()) { @@ -365,15 +363,15 @@ public class CMSCRLFormatPanel extends CMSBaseTab { } } if (profileList != null) - nvps.add(Constants.PR_PROFILE_LIST, profileList); + nvps.put(Constants.PR_PROFILE_LIST, profileList); else - nvps.add(Constants.PR_PROFILE_LIST, mProfiles.getText().trim()); + nvps.put(Constants.PR_PROFILE_LIST, mProfiles.getText().trim()); int index = mAlgorithms.getSelectedIndex(); - nvps.add(Constants.PR_SIGNING_ALGORITHM, - (String)mAlgorithms.getSelectedItem()); + nvps.put(Constants.PR_SIGNING_ALGORITHM, + (String) mAlgorithms.getSelectedItem()); _model.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java index 9bc141f7b..553211eb8 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java @@ -24,11 +24,9 @@ import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.border.*; import java.awt.*; import java.awt.event.*; import java.util.*; -import javax.swing.tree.*; /** * CRL IP Panel @@ -173,10 +171,10 @@ public class CMSCRLIPPanel extends CMSBaseTab String name = ((JLabel)mList.getSelectedValue()).getText(); //(String)mList.getSelectedValue(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLED, ""); - nvps.add(Constants.PR_ID, ""); - nvps.add(Constants.PR_DESCRIPTION, ""); - nvps.add(Constants.PR_CLASS, ""); + nvps.put(Constants.PR_ENABLED, ""); + nvps.put(Constants.PR_ID, ""); + nvps.put(Constants.PR_DESCRIPTION, ""); + nvps.put(Constants.PR_CLASS, ""); try { NameValuePairs values = mAdmin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRLIPS, @@ -295,15 +293,13 @@ public class CMSCRLIPPanel extends CMSBaseTab //update the UI component using the data retrieved private void populate(NameValuePairs nvps) { - Enumeration names = nvps.getNames(); mDataModel.removeAllElements(); mNames.removeAllElements(); - while (names.hasMoreElements()) { - String name = (String)names.nextElement(); + for (String name : nvps.keySet()) { if (name.indexOf('.') == -1) { mNames.addElement(name); - String enable = nvps.getValue(name+"."+Constants.PR_ENABLED); + String enable = nvps.get(name + "." + Constants.PR_ENABLED); if (enable != null && enable.equalsIgnoreCase(Constants.TRUE)) { mDataModel.addElement(new JLabel(name, CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java index d2b25f207..d420686e3 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java @@ -286,15 +286,15 @@ public class CMSCRLSettingPanel extends CMSBaseTab { public void refresh() { _model.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE_CRL, ""); - nvps.add(Constants.PR_UPDATE_SCHEMA, ""); - nvps.add(Constants.PR_EXTENDED_NEXT_UPDATE, ""); - nvps.add(Constants.PR_UPDATE_ALWAYS, ""); - nvps.add(Constants.PR_ENABLE_DAILY, ""); - nvps.add(Constants.PR_DAILY_UPDATES, ""); - nvps.add(Constants.PR_ENABLE_FREQ, ""); - nvps.add(Constants.PR_UPDATE_FREQ, ""); - nvps.add(Constants.PR_GRACE_PERIOD, ""); + nvps.put(Constants.PR_ENABLE_CRL, ""); + nvps.put(Constants.PR_UPDATE_SCHEMA, ""); + nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, ""); + nvps.put(Constants.PR_UPDATE_ALWAYS, ""); + nvps.put(Constants.PR_ENABLE_DAILY, ""); + nvps.put(Constants.PR_DAILY_UPDATES, ""); + nvps.put(Constants.PR_ENABLE_FREQ, ""); + nvps.put(Constants.PR_UPDATE_FREQ, ""); + nvps.put(Constants.PR_GRACE_PERIOD, ""); try { NameValuePairs val = null; @@ -319,11 +319,8 @@ public class CMSCRLSettingPanel extends CMSBaseTab { } public void populate(NameValuePairs nvps) { - String signingAlg = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); - String value = nvp.getValue().trim(); + for (String name : nvps.keySet()) { + String value = nvps.get(name).trim(); if (name.equals(Constants.PR_ENABLE_CRL)) { mEnableCRL.setSelected(getBoolean(value)); } else if (name.equals(Constants.PR_UPDATE_SCHEMA)) { @@ -535,41 +532,41 @@ public class CMSCRLSettingPanel extends CMSBaseTab { NameValuePairs nvps = new NameValuePairs(); if (mEnableCRL.isSelected()) - nvps.add(Constants.PR_ENABLE_CRL, Constants.TRUE); + nvps.put(Constants.PR_ENABLE_CRL, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE_CRL, Constants.FALSE); + nvps.put(Constants.PR_ENABLE_CRL, Constants.FALSE); - nvps.add(Constants.PR_UPDATE_SCHEMA, mCRLGen.getText().trim()); + nvps.put(Constants.PR_UPDATE_SCHEMA, mCRLGen.getText().trim()); if (mExtendNextUpdate.isSelected()) - nvps.add(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.TRUE); + nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.TRUE); else - nvps.add(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.FALSE); + nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.FALSE); if (mAlways.isSelected()) - nvps.add(Constants.PR_UPDATE_ALWAYS, Constants.TRUE); + nvps.put(Constants.PR_UPDATE_ALWAYS, Constants.TRUE); else - nvps.add(Constants.PR_UPDATE_ALWAYS, Constants.FALSE); + nvps.put(Constants.PR_UPDATE_ALWAYS, Constants.FALSE); if (mDaily.isSelected()) - nvps.add(Constants.PR_ENABLE_DAILY, Constants.TRUE); + nvps.put(Constants.PR_ENABLE_DAILY, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE_DAILY, Constants.FALSE); + nvps.put(Constants.PR_ENABLE_DAILY, Constants.FALSE); if (timeList != null) - nvps.add(Constants.PR_DAILY_UPDATES, timeList); + nvps.put(Constants.PR_DAILY_UPDATES, timeList); else - nvps.add(Constants.PR_DAILY_UPDATES, mDailyAt.getText().trim()); + nvps.put(Constants.PR_DAILY_UPDATES, mDailyAt.getText().trim()); if (mEnableFreq.isSelected()) - nvps.add(Constants.PR_ENABLE_FREQ, Constants.TRUE); + nvps.put(Constants.PR_ENABLE_FREQ, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE_FREQ, Constants.FALSE); + nvps.put(Constants.PR_ENABLE_FREQ, Constants.FALSE); - nvps.add(Constants.PR_UPDATE_FREQ, mFrequency.getText().trim()); + nvps.put(Constants.PR_UPDATE_FREQ, mFrequency.getText().trim()); - nvps.add(Constants.PR_GRACE_PERIOD, mGracePeriod.getText().trim()); + nvps.put(Constants.PR_GRACE_PERIOD, mGracePeriod.getText().trim()); _model.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java index 6130f9316..2d35133df 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java @@ -24,8 +24,6 @@ import com.netscape.admin.certsrv.connection.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; -import java.util.*; -import java.math.*; /** * KRA General Setting @@ -90,7 +88,7 @@ public class CMSEAGeneralPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, "1"); + nvps.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, "1"); try { NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN, @@ -106,12 +104,10 @@ public class CMSEAGeneralPanel extends CMSBaseTab implements ItemListener { } protected void populate(NameValuePairs nvps) { - String defaultAlgorithm = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS)) { - mNumberOfAgentsText.setText(nvp.getValue()); + mNumberOfAgentsText.setText(value); } } } @@ -144,8 +140,8 @@ public class CMSEAGeneralPanel extends CMSBaseTab implements ItemListener { } NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, - numberOfAgents); + nvps.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, + numberOfAgents); mModel.progressStart(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java index 0891c63fc..913974eaf 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java @@ -19,20 +19,15 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.management.client.console.*; -import com.netscape.admin.certsrv.security.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import java.awt.*; import java.util.*; -import java.io.*; import javax.swing.*; import java.awt.event.*; import javax.swing.border.*; import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; -import javax.swing.plaf.*; import com.netscape.admin.certsrv.keycert.*; -import com.netscape.admin.certsrv.config.install.*; import com.netscape.admin.certsrv.managecert.*; /** @@ -185,7 +180,7 @@ public class CMSEncryptionPanel extends CMSBaseTab { for (Enumeration e = mCertMapping.keys() ; e.hasMoreElements() ;) { CipherEntryData data = (CipherEntryData)mCertMapping.get(e.nextElement()); - nvp.add(data.getTagName(),data.getTokenName()+","+data.getCertName()); + nvp.put(data.getTagName(), data.getTokenName() + "," + data.getCertName()); } if (updateCertMap(nvp)) { @@ -423,20 +418,20 @@ public class CMSEncryptionPanel extends CMSBaseTab { private void setupDataContainer(NameValuePairs response) { //setup security version flag - String version = response.getValue(Constants.PR_CIPHER_VERSION); + String version = response.get(Constants.PR_CIPHER_VERSION); if ( (version != null) && (version.equals( Constants.PR_CIPHER_VERSION_DOMESTIC)) ) { mIsDomestic = true; } //setup fortezza flag - String fortezza = response.getValue(Constants.PR_CIPHER_FORTEZZA); + String fortezza = response.get(Constants.PR_CIPHER_FORTEZZA); if ( (fortezza != null) && (fortezza.equalsIgnoreCase("TRUE")) ){ mHasFortezza = true; } //setup cipher preference settings - String cipherpref = response.getValue(Constants.PR_CIPHER_PREF); + String cipherpref = response.get(Constants.PR_CIPHER_PREF); //Debug.println("cipher preference: "+cipherpref); if ( (cipherpref != null) && (!cipherpref.trim().equals("")) ) { StringTokenizer tokenizer = new StringTokenizer(cipherpref, ","); @@ -455,7 +450,7 @@ public class CMSEncryptionPanel extends CMSBaseTab { for (Enumeration e = mCertMapping.keys() ; e.hasMoreElements() ;) { String name = (String) e.nextElement(); CipherEntryData data = (CipherEntryData)mCertMapping.get(name); - String value = response.getValue(data.getTagName()); + String value = response.get(data.getTagName()); if ( (value != null) && (!value.trim().equals("")) ) { StringTokenizer tokenizer = new StringTokenizer(value, ","); try { @@ -475,7 +470,7 @@ public class CMSEncryptionPanel extends CMSBaseTab { mSelectionIgnore = false; //setup the token-cert list data table - String tokenlist = response.getValue(Constants.PR_TOKEN_LIST); + String tokenlist = response.get(Constants.PR_TOKEN_LIST); if ( (tokenlist != null) && (!tokenlist.trim().equals("")) ) { StringTokenizer tokenizer = new StringTokenizer(tokenlist, ","); while (tokenizer.hasMoreTokens()) { @@ -483,7 +478,7 @@ public class CMSEncryptionPanel extends CMSBaseTab { Debug.println("Token: "+token); //get the certificate associated with this token - String certList = response.getValue(Constants.PR_TOKEN_PREFIX+token); + String certList = response.get(Constants.PR_TOKEN_PREFIX + token); Vector certVector = new Vector(); if ( (certList != null) && (!certList.trim().equals("")) ) { StringTokenizer tokenizer2 = new StringTokenizer(certList, ","); @@ -739,15 +734,15 @@ public class CMSEncryptionPanel extends CMSBaseTab { { Debug.println("Get Security Information"); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_CIPHER_PREF,""); - nvp.add(Constants.PR_CIPHER_VERSION,""); - nvp.add(Constants.PR_CIPHER_FORTEZZA,""); - nvp.add(Constants.PR_TOKEN_LIST,""); + nvp.put(Constants.PR_CIPHER_PREF, ""); + nvp.put(Constants.PR_CIPHER_VERSION, ""); + nvp.put(Constants.PR_CIPHER_FORTEZZA, ""); + nvp.put(Constants.PR_TOKEN_LIST, ""); //create installed certificate list data request for (Enumeration e = mCertMapping.elements(); e.hasMoreElements() ;) { CipherEntryData data = (CipherEntryData)e.nextElement(); - nvp.add(data.getTagName(),""); + nvp.put(data.getTagName(), ""); } NameValuePairs response; @@ -767,7 +762,7 @@ public class CMSEncryptionPanel extends CMSBaseTab { Debug.println("Set Cipher Preference: "+list); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_CIPHER_PREF, list); + nvp.put(Constants.PR_CIPHER_PREF, list); //send to server try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java index 484be33dd..23b4ececa 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java @@ -18,13 +18,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import java.awt.*; + import java.awt.event.*; -import java.util.*; -import javax.swing.*; /** * Error Log Setting Tab to be displayed at the right hand side @@ -67,14 +64,14 @@ public class CMSErrorLogPanel extends CMSBaseLogPanel { public void refresh() { mModel.progressStart(); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_LOG_ENABLED, ""); - nvp.add(Constants.PR_LOG_LEVEL, ""); - nvp.add(Constants.PR_LOG_BUFFERSIZE, ""); + nvp.put(Constants.PR_LOG_ENABLED, ""); + nvp.put(Constants.PR_LOG_LEVEL, ""); + nvp.put(Constants.PR_LOG_BUFFERSIZE, ""); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, ""); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); + nvp.put(Constants.PR_LOG_MAXFILESIZE, ""); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN, @@ -92,16 +89,16 @@ public class CMSErrorLogPanel extends CMSBaseLogPanel { } private void parseVals(NameValuePairs nvp) { - if (nvp.getValue(Constants.PR_LOG_ENABLED).equalsIgnoreCase( + if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase( Constants.TRUE)) activateLog.setSelected(true); else activateLog.setSelected(false); - mLevel = Integer.parseInt(nvp.getValue(Constants.PR_LOG_LEVEL)); - mlogBufSizTextData = nvp.getValue(Constants.PR_LOG_BUFFERSIZE); - mlogMaxSizTextData = nvp.getValue(Constants.PR_LOG_MAXFILESIZE); + mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL)); + mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE); + mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE); int val = - Integer.parseInt(nvp.getValue(Constants.PR_LOG_ROLLEROVER_INTERVAL)); + Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL)); mFrequency = getRollOverIndex(val); } @@ -135,19 +132,19 @@ public class CMSErrorLogPanel extends CMSBaseLogPanel { NameValuePairs nvp = new NameValuePairs(); if (activateLog.isSelected()) - nvp.add(Constants.PR_LOG_ENABLED, Constants.TRUE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE); else - nvp.add(Constants.PR_LOG_ENABLED, Constants.FALSE); + nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE); String str = "" + mLogLevel.getSelectedIndex(); - nvp.add(Constants.PR_LOG_LEVEL, str); - nvp.add(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); + nvp.put(Constants.PR_LOG_LEVEL, str); + nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim()); //nvp.add(Constants.PR_LOG_EXPIRED_TIME, ""); //nvp.add(Constants.PR_LOG_FILENAME, ""); //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, ""); - nvp.add(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); + nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim()); str = "" + getRollOverTime(mlogFQC.getSelectedIndex()); - nvp.add(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); + nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str); mModel.progressStart(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java index be81b035b..f408e7297 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java @@ -18,13 +18,11 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -143,7 +141,7 @@ public class CMSKRAAutoPanel extends CMSBaseUGTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_AUTO_RECOVERY_ON, ""); + nvps.put(Constants.PR_AUTO_RECOVERY_ON, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN, @@ -157,11 +155,10 @@ public class CMSKRAAutoPanel extends CMSBaseUGTab { } protected void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_AUTO_RECOVERY_ON)) { - if (nvp.getValue().equals(Constants.TRUE)) { + if (value.equals(Constants.TRUE)) { setStatus(true); //mEnableAuto.setText(mDisableLabel); //mEnableAuto.setToolTipText(mDisableTTip); @@ -198,7 +195,7 @@ public class CMSKRAAutoPanel extends CMSBaseUGTab { } else { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_AUTO_RECOVERY_ON, Constants.FALSE); + nvps.put(Constants.PR_AUTO_RECOVERY_ON, Constants.FALSE); try { mAdmin.modify(DestDef.DEST_KRA_ADMIN, ScopeDef.SC_AUTO_RECOVERY, Constants.RS_ID_CONFIG, nvps); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java index 7c52eab87..7c70dca7f 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java @@ -18,9 +18,7 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.connection.AdminConnection; -import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; @@ -58,7 +56,7 @@ public class CMSKRAPasswdPanel extends CMSBaseUGTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_RECOVERY_AGENT, ""); + nvps.put(Constants.PR_RECOVERY_AGENT, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN, @@ -74,18 +72,17 @@ public class CMSKRAPasswdPanel extends CMSBaseUGTab { } protected void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_RECOVERY_AGENT)) { mAgentModel.removeAllElements(); - updateModel(nvp); + updateModel(value); } } } - private void updateModel(NameValuePair nvp) { - String[] uids = getUIDs(nvp.getValue()); + private void updateModel(String value) { + String[] uids = getUIDs(value); for (int i=0; i<uids.length; i++) { JLabel label = makeJLabel(mUserIcon, uids[i], SwingConstants.LEFT); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java index 274b7d54e..34950b371 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java @@ -18,14 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.connection.AdminConnection; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -82,8 +80,8 @@ public class CMSKRASchemePanel extends CMSBaseUGTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_RECOVERY_N, ""); - nvps.add(Constants.PR_RECOVERY_M, ""); + nvps.put(Constants.PR_RECOVERY_N, ""); + nvps.put(Constants.PR_RECOVERY_M, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN, @@ -99,13 +97,12 @@ public class CMSKRASchemePanel extends CMSBaseUGTab { } protected void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_RECOVERY_N)) { - mAvailAgentLbl.setText(nvp.getValue()); + mAvailAgentLbl.setText(value); } else if (name.equals(Constants.PR_RECOVERY_M)) { - mReqAgentLbl.setText(nvp.getValue()); + mReqAgentLbl.setText(value); } } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java index 85596d55e..641a6641e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.config; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; @@ -177,14 +176,14 @@ public class CMSLDAPSettingPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_HOST_NAME, ""); - nvps.add(Constants.PR_LDAP_PORT, ""); + nvps.put(Constants.PR_HOST_NAME, ""); + nvps.put(Constants.PR_LDAP_PORT, ""); //nvps.add(Constants.PR_SECURE_PORT_ENABLED, ""); //nvps.add(Constants.PR_BASE_DN, ""); - nvps.add(Constants.PR_BIND_DN, ""); - nvps.add(Constants.PR_LDAP_VERSION, ""); - nvps.add(Constants.PR_LDAP_MAX_CONNS, ""); - nvps.add(Constants.PR_LDAP_MIN_CONNS, ""); + nvps.put(Constants.PR_BIND_DN, ""); + nvps.put(Constants.PR_LDAP_VERSION, ""); + nvps.put(Constants.PR_LDAP_MAX_CONNS, ""); + nvps.put(Constants.PR_LDAP_MIN_CONNS, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -210,13 +209,12 @@ public class CMSLDAPSettingPanel extends CMSBaseTab { protected void populate(NameValuePairs nvps) { String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_HOST_NAME)) { - mHostNameText.setText(nvp.getValue()); + mHostNameText.setText(value); } else if (name.equals(Constants.PR_LDAP_PORT)) { - mPortText.setText(nvp.getValue()); + mPortText.setText(value); } else if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) { /* if (nvp.getValue().equals(Constants.TRUE)) @@ -227,18 +225,18 @@ public class CMSLDAPSettingPanel extends CMSBaseTab { } else if (name.equals(Constants.PR_BASE_DN)) { //mBaseDNText.setText(nvp.getValue()); } else if (name.equals(Constants.PR_BIND_DN)) { - mBindAsText.setText(nvp.getValue()); + mBindAsText.setText(value); } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); } else if (name.equals(Constants.PR_LDAP_VERSION)) { - version = nvp.getValue(); + version = value; } else if (name.equals(Constants.PR_LDAP_MIN_CONNS)) { - mMinConnsText.setText(nvp.getValue()); + mMinConnsText.setText(value); } else if (name.equals(Constants.PR_LDAP_MAX_CONNS)) { - mMaxConnsText.setText(nvp.getValue()); + mMaxConnsText.setText(value); } } @@ -301,12 +299,12 @@ public class CMSLDAPSettingPanel extends CMSBaseTab { } NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_HOST_NAME, host); - nvps.add(Constants.PR_LDAP_PORT, port); + nvps.put(Constants.PR_HOST_NAME, host); + nvps.put(Constants.PR_LDAP_PORT, port); //nvps.add(Constants.PR_BASE_DN, baseDN); - nvps.add(Constants.PR_BIND_DN, bindAs); - nvps.add(Constants.PR_LDAP_MAX_CONNS, maxConns); - nvps.add(Constants.PR_LDAP_MIN_CONNS, minConns); + nvps.put(Constants.PR_BIND_DN, bindAs); + nvps.put(Constants.PR_LDAP_MAX_CONNS, maxConns); + nvps.put(Constants.PR_LDAP_MIN_CONNS, minConns); /* nvps.add(Constants.PR_LDAP_VERSION, (String)mVersionBox.getSelectedItem()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java index ef85e4986..03458d2b1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java @@ -23,7 +23,6 @@ import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; import com.netscape.management.client.console.ConsoleInfo; import java.awt.*; -import java.util.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; @@ -251,25 +250,25 @@ public class CMSNetworkPanel extends CMSBaseTab { } else { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ADMIN_S_PORT, adminSSLPortStr); - nvps.add(Constants.PR_GATEWAY_PORT, gatewayPortStr); - nvps.add(Constants.PR_AGENT_S_PORT, agentSSLPortStr); + nvps.put(Constants.PR_ADMIN_S_PORT, adminSSLPortStr); + nvps.put(Constants.PR_GATEWAY_PORT, gatewayPortStr); + nvps.put(Constants.PR_AGENT_S_PORT, agentSSLPortStr); if (mGatewaySSLPortText.isEnabled()) { - nvps.add(Constants.PR_GATEWAY_S_PORT, gatewaySSLPortStr); + nvps.put(Constants.PR_GATEWAY_S_PORT, gatewaySSLPortStr); } if (mGatewaySSLBacklogText.isEnabled()) { - nvps.add(Constants.PR_GATEWAY_S_BACKLOG, gatewaySSLBacklogStr); + nvps.put(Constants.PR_GATEWAY_S_BACKLOG, gatewaySSLBacklogStr); } if (mEnable.isSelected()) { - nvps.add(Constants.PR_GATEWAY_PORT_ENABLED, Constants.TRUE); - nvps.add(Constants.PR_ADMIN_S_BACKLOG, adminSSLBacklogStr); - nvps.add(Constants.PR_GATEWAY_BACKLOG, gatewayBacklogStr); - nvps.add(Constants.PR_AGENT_S_BACKLOG, agentSSLBacklogStr); + nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_ADMIN_S_BACKLOG, adminSSLBacklogStr); + nvps.put(Constants.PR_GATEWAY_BACKLOG, gatewayBacklogStr); + nvps.put(Constants.PR_AGENT_S_BACKLOG, agentSSLBacklogStr); } else - nvps.add(Constants.PR_GATEWAY_PORT_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, Constants.FALSE); try { mAdmin.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_NETWORK, @@ -312,11 +311,11 @@ public class CMSNetworkPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ADMIN_S_PORT, ""); - nvps.add(Constants.PR_AGENT_S_PORT, ""); - nvps.add(Constants.PR_GATEWAY_S_PORT, ""); - nvps.add(Constants.PR_GATEWAY_PORT, ""); - nvps.add(Constants.PR_GATEWAY_PORT_ENABLED, ""); + nvps.put(Constants.PR_ADMIN_S_PORT, ""); + nvps.put(Constants.PR_AGENT_S_PORT, ""); + nvps.put(Constants.PR_GATEWAY_S_PORT, ""); + nvps.put(Constants.PR_GATEWAY_PORT, ""); + nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN, @@ -344,11 +343,9 @@ public class CMSNetworkPanel extends CMSBaseTab { } private void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); - String str = nvp.getValue(); - + for (String name : nvps.keySet()) { + String str = nvps.get(name); + if (name.equals(Constants.PR_GATEWAY_PORT_ENABLED)) { mEnable.setSelected(getBoolean(str)); } else { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java index 9c3bdf3d3..37dfbef44 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java @@ -126,8 +126,8 @@ public class CMSOCSPGeneralPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_DEFAULT_ALGORITHM, ""); - nvps.add(Constants.PR_ALL_ALGORITHMS, ""); + nvps.put(Constants.PR_DEFAULT_ALGORITHM, ""); + nvps.put(Constants.PR_ALL_ALGORITHMS, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_OCSP_ADMIN, @@ -144,13 +144,12 @@ public class CMSOCSPGeneralPanel extends CMSBaseTab implements ItemListener { protected void populate(NameValuePairs nvps) { String defaultAlgorithm = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_DEFAULT_ALGORITHM)) { - defaultAlgorithm = nvp.getValue(); + defaultAlgorithm = value; } else if (name.equals(Constants.PR_ALL_ALGORITHMS)) { - initAlgorithmBox(nvp.getValue()); + initAlgorithmBox(value); } } @@ -191,8 +190,8 @@ public class CMSOCSPGeneralPanel extends CMSBaseTab implements ItemListener { public boolean applyCallback() { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_DEFAULT_ALGORITHM, - (String)mAlgorithms.getSelectedItem()); + nvps.put(Constants.PR_DEFAULT_ALGORITHM, + (String) mAlgorithms.getSelectedItem()); mModel.progressStart(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java index 03fc449f7..47cb6c865 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java @@ -22,7 +22,7 @@ import java.util.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import javax.swing.border.*; + import com.netscape.admin.certsrv.*; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -229,8 +229,8 @@ public class CMSPasswordDialog extends JDialog NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_OLD_AGENT_PWD, oldpassword); - nvps.add(Constants.PR_AGENT_PWD, newpassword); + nvps.put(Constants.PR_OLD_AGENT_PWD, oldpassword); + nvps.put(Constants.PR_AGENT_PWD, newpassword); try { mAdmin.modify(DestDef.DEST_KRA_ADMIN, diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java index 3e50148f3..d4fb62340 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -148,7 +147,7 @@ public abstract class CMSPluginInstanceTab extends CMSBaseUGTab { dialog.setModel(mModel); dialog.setInstanceScope(mScope); - dialog.showDialog(response, data.getValue(RULE_NAME)); + dialog.showDialog(response, data.get(RULE_NAME)); if(!dialog.isOK()) return; @@ -329,7 +328,7 @@ public abstract class CMSPluginInstanceTab extends CMSBaseUGTab { NameValuePairs response; NameValuePairs request = new NameValuePairs(); if (mId != null && mId.length() > 0) { - request.add(Constants.PR_ID, mId); + request.put(Constants.PR_ID, mId); } try { @@ -349,22 +348,20 @@ public abstract class CMSPluginInstanceTab extends CMSBaseUGTab { Debug.println(response.toString()); - Enumeration e = response.getNames(); - - /* format of each data element: plugin;visibility;enabled where plugin is the name of the plugin impl visibility is one of {visible,invisible} enabled is one of {enabled,disabled} */ - while (e.hasMoreElements()) { + + for (String entry : response.keySet()) { String plugin=""; String visibility=null; String enabled=null; - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + entry = entry.trim(); + String value = response.get(entry); StringTokenizer st = new StringTokenizer(value,";"); @@ -382,10 +379,10 @@ Debug.println("xxxxxxx plugin " + plugin); if (visibility != null && visibility.equals("visible")) { NameValuePairs data = new NameValuePairs(); - data.add(RULE_NAME,entry); - data.add(RULE_IMPL,plugin); + data.put(RULE_NAME, entry); + data.put(RULE_IMPL, plugin); if (enabled != null) { - data.add(RULE_STAT,enabled); + data.put(RULE_STAT, enabled); } mDataModel.processData(data); } @@ -411,7 +408,7 @@ Debug.println("xxxxxxx plugin " + plugin); try { mConnection.delete(mDestination, mScope, - data.getValue(RULE_NAME)); + data.get(RULE_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); @@ -431,12 +428,12 @@ Debug.println("xxxxxxx plugin " + plugin); mDataModel.getObjectValueAt(mTable.getSelectedRow()); NameValuePairs request = new NameValuePairs(); if (mId != null && mId.length() > 0) { - request.add(mId, ""); + request.put(mId, ""); } NameValuePairs response = mConnection.read(mDestination, mScope, - data.getValue(RULE_NAME), + data.get(RULE_NAME), request); return response; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java index 3b2ee1ce4..734425b41 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java @@ -138,12 +138,12 @@ public class CMSRACLMPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_RENEWAL_ENABLED, ""); - nvps.add(Constants.PR_RENEWAL_VALIDITY, ""); - nvps.add(Constants.PR_RENEWAL_EMAIL, ""); - nvps.add(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, ""); - nvps.add(Constants.PR_RENEWAL_NUMNOTIFICATION, ""); - nvps.add(Constants.PR_RENEWAL_INTERVAL, ""); + nvps.put(Constants.PR_RENEWAL_ENABLED, ""); + nvps.put(Constants.PR_RENEWAL_VALIDITY, ""); + nvps.put(Constants.PR_RENEWAL_EMAIL, ""); + nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, ""); + nvps.put(Constants.PR_RENEWAL_NUMNOTIFICATION, ""); + nvps.put(Constants.PR_RENEWAL_INTERVAL, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_RA_ADMIN, @@ -162,23 +162,22 @@ public class CMSRACLMPanel extends CMSBaseTab { protected void populate(NameValuePairs nvps) { boolean renewalEnabled = false; boolean notificationEnabled = false; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_RENEWAL_ENABLED)) { - renewalEnabled = getBoolean(nvp.getValue()); + renewalEnabled = getBoolean(value); mRenewEnable.setSelected(renewalEnabled); } else if (name.equals(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED)) { - notificationEnabled = getBoolean(nvp.getValue()); + notificationEnabled = getBoolean(value); mNotifyEnable.setSelected(notificationEnabled); } else if (name.equals(Constants.PR_RENEWAL_VALIDITY)) { - mValidText.setText(nvp.getValue()); + mValidText.setText(value); } else if (name.equals(Constants.PR_RENEWAL_EMAIL)) { - mEmailText.setText(nvp.getValue()); + mEmailText.setText(value); } else if (name.equals(Constants.PR_RENEWAL_NUMNOTIFICATION)) { - mNotifiedText.setText(nvp.getValue()); + mNotifiedText.setText(value); } else if (name.equals(Constants.PR_RENEWAL_INTERVAL)) { - mIntervalText.setText(nvp.getValue()); + mIntervalText.setText(value); } } @@ -254,7 +253,7 @@ public class CMSRACLMPanel extends CMSBaseTab { public boolean applyCallback() { NameValuePairs nvps = new NameValuePairs(); if (mRenewEnable.isSelected()) { - nvps.add(Constants.PR_RENEWAL_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_RENEWAL_ENABLED, Constants.TRUE); String validStr = mValidText.getText(); try { int num = Integer.parseInt(validStr); @@ -262,12 +261,12 @@ public class CMSRACLMPanel extends CMSBaseTab { showMessageDialog("NUMBERFORMAT"); return false; } - nvps.add(Constants.PR_RENEWAL_VALIDITY, validStr); + nvps.put(Constants.PR_RENEWAL_VALIDITY, validStr); if (mNotifyEnable.isSelected()) { - nvps.add(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, - Constants.TRUE); - nvps.add(Constants.PR_RENEWAL_EMAIL, mEmailText.getText()); + nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, + Constants.TRUE); + nvps.put(Constants.PR_RENEWAL_EMAIL, mEmailText.getText()); String numStr = mNotifiedText.getText(); String intervalStr = mIntervalText.getText(); @@ -279,14 +278,14 @@ public class CMSRACLMPanel extends CMSBaseTab { return false; } - nvps.add(Constants.PR_RENEWAL_NUMNOTIFICATION, numStr); - nvps.add(Constants.PR_RENEWAL_INTERVAL, intervalStr); + nvps.put(Constants.PR_RENEWAL_NUMNOTIFICATION, numStr); + nvps.put(Constants.PR_RENEWAL_INTERVAL, intervalStr); } else { - nvps.add(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, - Constants.FALSE); + nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, + Constants.FALSE); } } else { - nvps.add(Constants.PR_RENEWAL_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_RENEWAL_ENABLED, Constants.FALSE); } mModel.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java index 34b351ea4..7733a43d7 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java @@ -18,15 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.management.client.*; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.border.*; import java.awt.*; import java.awt.event.*; -import java.util.*; /** * RA Connector Panel @@ -164,15 +161,15 @@ public class CMSRAConnectorPanel extends CMSBaseTab JFrame frame = mModel.getFrame(); String name = (String)mList.getSelectedValue(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ID, ""); - nvps.add(Constants.PR_HOST, ""); - nvps.add(Constants.PR_PORT, ""); + nvps.put(Constants.PR_ID, ""); + nvps.put(Constants.PR_HOST, ""); + nvps.put(Constants.PR_PORT, ""); // Inserted by beomsuk - nvps.add(Constants.PR_TIMEOUT, ""); + nvps.put(Constants.PR_TIMEOUT, ""); // Insert end - nvps.add(Constants.PR_URI, ""); - nvps.add(Constants.PR_LOCAL, ""); - nvps.add(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_URI, ""); + nvps.put(Constants.PR_LOCAL, ""); + nvps.put(Constants.PR_ENABLE, ""); try { NameValuePairs values = mAdmin.read(DestDef.DEST_RA_ADMIN, @@ -183,7 +180,7 @@ public class CMSRAConnectorPanel extends CMSBaseTab boolean colocated = false; if (name.equals("Data Recovery Manager Connector")) { - String val = values.getValue("id"); + String val = values.get("id"); if (val != null && val.equals("kra")) colocated = true; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java index f7ed785b5..6605385b0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java @@ -100,7 +100,7 @@ public class CMSRAGeneralPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_EE_ENABLED, ""); + nvps.put(Constants.PR_EE_ENABLED, ""); //nvps.add(Constants.PR_RA_ENABLED, ""); try { @@ -118,14 +118,13 @@ public class CMSRAGeneralPanel extends CMSBaseTab { protected void populate(NameValuePairs nvps) { Debug.println("RA General Received: "+nvps.toString()); - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_EE_ENABLED)) { - mEEEnable.setSelected(getBoolean(nvp.getValue())); + mEEEnable.setSelected(getBoolean(value)); /* } else if (name.equals(Constants.PR_RA_ENABLED)) { - mRAEnable.setSelected(getBoolean(nvp.getValue())); + mRAEnable.setSelected(getBoolean(value)); */ } } @@ -149,9 +148,9 @@ public class CMSRAGeneralPanel extends CMSBaseTab { NameValuePairs nvps = new NameValuePairs(); if (mEEEnable.isSelected()) - nvps.add(Constants.PR_EE_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_EE_ENABLED, Constants.TRUE); else - nvps.add(Constants.PR_EE_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_EE_ENABLED, Constants.FALSE); /* if (mRAEnable.isSelected()) diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java index 2f5aeb593..0275e3cb0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java @@ -87,8 +87,8 @@ public class CMSSMTPPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SERVER_NAME, ""); - nvps.add(Constants.PR_PORT, ""); + nvps.put(Constants.PR_SERVER_NAME, ""); + nvps.put(Constants.PR_PORT, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_SMTP, Constants.RS_ID_CONFIG, nvps); @@ -104,13 +104,12 @@ public class CMSSMTPPanel extends CMSBaseTab { } private void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_SERVER_NAME)) { - mServerText.setText(nvp.getValue()); + mServerText.setText(value); } else if (name.equals(Constants.PR_PORT)) { - mPortText.setText(nvp.getValue()); + mPortText.setText(value); } } } @@ -143,8 +142,8 @@ public class CMSSMTPPanel extends CMSBaseTab { } NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SERVER_NAME, mServerText.getText().trim()); - nvps.add(Constants.PR_PORT, port); + nvps.put(Constants.PR_SERVER_NAME, mServerText.getText().trim()); + nvps.put(Constants.PR_PORT, port); mModel.progressStart(); try { mAdmin.modify(DestDef.DEST_SERVER_ADMIN, diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java index 8ef18cc79..b5b589eb0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java @@ -147,13 +147,13 @@ public class CMSSNMPPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SNMP_ENABLED, ""); - nvps.add(Constants.PR_SNMP_MASTER_HOST, ""); - nvps.add(Constants.PR_SNMP_MASTER_PORT, ""); - nvps.add(Constants.PR_SNMP_DESC, ""); - nvps.add(Constants.PR_SNMP_ORGN, ""); - nvps.add(Constants.PR_SNMP_LOC, ""); - nvps.add(Constants.PR_SNMP_CONTACT, ""); + nvps.put(Constants.PR_SNMP_ENABLED, ""); + nvps.put(Constants.PR_SNMP_MASTER_HOST, ""); + nvps.put(Constants.PR_SNMP_MASTER_PORT, ""); + nvps.put(Constants.PR_SNMP_DESC, ""); + nvps.put(Constants.PR_SNMP_ORGN, ""); + nvps.put(Constants.PR_SNMP_LOC, ""); + nvps.put(Constants.PR_SNMP_CONTACT, ""); try { NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN, @@ -170,23 +170,22 @@ public class CMSSNMPPanel extends CMSBaseTab { } private void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_SNMP_ENABLED)) { - mEnable.setSelected(getBoolean(nvp)); + mEnable.setSelected(getBoolean(value)); } else if (name.equals(Constants.PR_SNMP_MASTER_HOST)) { - mHostNameText.setText(nvp.getValue()); + mHostNameText.setText(value); } else if (name.equals(Constants.PR_SNMP_MASTER_PORT)) { - mPortText.setText(nvp.getValue()); + mPortText.setText(value); } else if (name.equals(Constants.PR_SNMP_DESC)) { - mDescText.setText(nvp.getValue()); + mDescText.setText(value); } else if (name.equals(Constants.PR_SNMP_ORGN)) { - mOrgnText.setText(nvp.getValue()); + mOrgnText.setText(value); } else if (name.equals(Constants.PR_SNMP_LOC)) { - mLocText.setText(nvp.getValue()); + mLocText.setText(value); } else if (name.equals(Constants.PR_SNMP_CONTACT)) { - mContactText.setText(nvp.getValue()); + mContactText.setText(value); } } @@ -196,8 +195,8 @@ public class CMSSNMPPanel extends CMSBaseTab { enableTextField(false, getBackground()); } - public boolean getBoolean(NameValuePair nvp) { - if (nvp.getValue().equals(Constants.TRUE)) + public boolean getBoolean(String value) { + if (value.equals(Constants.TRUE)) return true; return false; } @@ -261,16 +260,16 @@ public class CMSSNMPPanel extends CMSBaseTab { NameValuePairs nvps = new NameValuePairs(); if (mEnable.isSelected()) - nvps.add(Constants.PR_SNMP_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_SNMP_ENABLED, Constants.TRUE); else - nvps.add(Constants.PR_SNMP_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_SNMP_ENABLED, Constants.FALSE); - nvps.add(Constants.PR_SNMP_MASTER_HOST, mHostNameText.getText().trim()); - nvps.add(Constants.PR_SNMP_MASTER_PORT, port); - nvps.add(Constants.PR_SNMP_DESC, mDescText.getText().trim()); - nvps.add(Constants.PR_SNMP_ORGN, mOrgnText.getText().trim()); - nvps.add(Constants.PR_SNMP_LOC, mLocText.getText().trim()); - nvps.add(Constants.PR_SNMP_CONTACT, mContactText.getText().trim()); + nvps.put(Constants.PR_SNMP_MASTER_HOST, mHostNameText.getText().trim()); + nvps.put(Constants.PR_SNMP_MASTER_PORT, port); + nvps.put(Constants.PR_SNMP_DESC, mDescText.getText().trim()); + nvps.put(Constants.PR_SNMP_ORGN, mOrgnText.getText().trim()); + nvps.put(Constants.PR_SNMP_LOC, mLocText.getText().trim()); + nvps.put(Constants.PR_SNMP_CONTACT, mContactText.getText().trim()); mModel.progressStart(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java index 712beb32b..ab957a69c 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java @@ -23,7 +23,6 @@ import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; import java.awt.*; import java.awt.event.*; -import java.util.*; import javax.swing.*; import javax.swing.border.*; @@ -147,7 +146,7 @@ public class CMSSelfTestsPanel extends CMSBaseTab NameValuePairs nvps = new NameValuePairs(); NameValuePairs nvps1; - nvps.add( Constants.PR_RUN_SELFTESTS_ON_DEMAND, Constants.TRUE ); + nvps.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND, Constants.TRUE); if( evt.getSource().equals( mOnDemand ) ) { Debug.println( "Run self tests on-demand . . ." ); @@ -161,13 +160,14 @@ public class CMSSelfTestsPanel extends CMSBaseTab // show server response String responseClass = ""; String response = ""; - for( int i = 0; i < nvps1.size(); i++ ) { - if( i == 0 ) { - responseClass = nvps1.elementAt( i ).getValue(); + boolean first = true; + for (String name : nvps1.keySet()) { + String value = nvps1.get(name); + if (first) { + first = false; + responseClass = value; } else { - response = response - + nvps1.elementAt( i ).getValue() - + "\n"; + response = response + value + "\n"; } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java index a4b7740f5..ca424c3a0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java @@ -20,8 +20,7 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import javax.swing.*; -import java.awt.*; + import java.awt.event.*; /** @@ -77,8 +76,8 @@ public class CMSUserCertSettingPanel extends CMSCertSettingPanel { public void refresh() { _model.progressStart(); NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_MAPPER, ""); - nvp.add(Constants.PR_PUBLISHER, ""); + nvp.put(Constants.PR_MAPPER, ""); + nvp.put(Constants.PR_PUBLISHER, ""); try { NameValuePairs val = _admin.read(_servletName, @@ -142,13 +141,12 @@ public class CMSUserCertSettingPanel extends CMSCertSettingPanel { } private void populate(NameValuePairs nvps) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_MAPPER)) { - _mapper.setText(nvp.getValue()); + _mapper.setText(value); } else if (name.equals(Constants.PR_PUBLISHER)) { - _publisher.setText(nvp.getValue()); + _publisher.setText(value); } } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java index 15f2ca3d3..e5ae9352a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,19 +51,19 @@ public class CRLExtensionsRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("CRLEXTSRULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("CRLEXTSRULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java index ea7d78c4f..040b21b83 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java @@ -18,16 +18,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.config.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -106,10 +102,8 @@ public class CRLIPEditor extends JDialog implements ActionListener { public void showDialog(NameValuePairs values) { - for (int i=0; i<values.size(); i++) { - NameValuePair nvp = values.elementAt(i); - String name = nvp.getName(); - String val = nvp.getValue(); + for (String name : values.keySet()) { + String val = values.get(name); if ((mName == null || mName.length() == 0) && name.equals(Constants.PR_ID)) { mNameText.setText(val); @@ -284,17 +278,17 @@ public class CRLIPEditor extends JDialog implements ActionListener { NameValuePairs nvps = new NameValuePairs(); if (mName != null && mName.length() > 0) { - nvps.add(Constants.PR_ID, mName); + nvps.put(Constants.PR_ID, mName); } else { - nvps.add(Constants.PR_ID, mNameText.getText().trim()); + nvps.put(Constants.PR_ID, mNameText.getText().trim()); } - nvps.add(Constants.PR_DESCRIPTION, mDescText.getText().trim()); + nvps.put(Constants.PR_DESCRIPTION, mDescText.getText().trim()); if (mEnable) { - nvps.add(Constants.PR_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_ENABLED, Constants.TRUE); } else { - nvps.add(Constants.PR_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_ENABLED, Constants.FALSE); } try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java index b6b831d05..6f711eca9 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java @@ -19,16 +19,13 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.ug.*; -import com.netscape.admin.certsrv.config.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -111,18 +108,17 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis if (response != null) { String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } int sindex = 0; String snickname = ""; - CMSAdminUtil.quickSort(vals, 0, response.size()-1); + CMSAdminUtil.quickSort(vals, 0, response.size() - 1); for (i=0; i<vals.length; i++) { Vector v = new Vector(); String entry = vals[i]; - String value = response.getValue(entry); + String value = response.get(entry); // look for the comma separator int lastindex = entry.lastIndexOf(","); @@ -179,17 +175,16 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis try { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NICK_NAME, nickname); - nvps.add(Constants.PR_SERIAL_NUMBER, serialno); - nvps.add(Constants.PR_ISSUER_NAME, issuername); + nvps.put(Constants.PR_NICK_NAME, nickname); + nvps.put(Constants.PR_SERIAL_NUMBER, serialno); + nvps.put(Constants.PR_ISSUER_NAME, issuername); NameValuePairs results = mAdmin.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT, Constants.RS_ID_CONFIG, nvps); if (nvps.size() <= 0) return; - NameValuePair nvp = results.elementAt(0); - String name = nvp.getName(); - String print = nvp.getValue(); + String name = results.keySet().iterator().next(); // first element + String print = results.get(name); CertViewDialog certdialog = new CertViewDialog(mParentFrame); certdialog.showDialog(nickname, print); } catch (EAdminException ex) { @@ -225,10 +220,8 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis public void showDialog(NameValuePairs values) { - for (int i=0; i<values.size(); i++) { - NameValuePair nvp = values.elementAt(i); - String name = nvp.getName(); - String val = nvp.getValue(); + for (String name : values.keySet()) { + String val = values.get(name); if (name.equals(Constants.PR_HOST)) { mHostText.setText(val); } else if (name.equals(Constants.PR_PORT)) { @@ -568,8 +561,8 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis NameValuePairs nvps = new NameValuePairs(); if (mEnable) { - nvps.add(Constants.PR_LOCAL, Constants.FALSE); - nvps.add(Constants.PR_HOST, mHostText.getText()); + nvps.put(Constants.PR_LOCAL, Constants.FALSE); + nvps.put(Constants.PR_HOST, mHostText.getText()); String portStr = mPortText.getText().trim(); try { int port = Integer.parseInt(portStr); @@ -583,7 +576,7 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis "NONINTEGER", CMSAdminUtil.ERROR_MESSAGE); return; } - nvps.add(Constants.PR_PORT, portStr); + nvps.put(Constants.PR_PORT, portStr); String timeoutStr = mTimeoutText.getText().trim(); try { @@ -598,19 +591,19 @@ public class ConnectorEditor extends JDialog implements ActionListener, MouseLis "TIMEOUTNONINTEGER", CMSAdminUtil.ERROR_MESSAGE); return; } - nvps.add(Constants.PR_TIMEOUT, timeoutStr); + nvps.put(Constants.PR_TIMEOUT, timeoutStr); if (mName.equals("Data Recovery Manager Connector")) { - nvps.add(Constants.PR_URI, "/kra/agent/kra/connector"); + nvps.put(Constants.PR_URI, "/kra/agent/kra/connector"); } else if (mName.equals("Registration Manager Connector")) { - nvps.add(Constants.PR_URI, "/ra/connector"); + nvps.put(Constants.PR_URI, "/ra/connector"); } else if (mName.equals("Certificate Manager Connector")) { - nvps.add(Constants.PR_URI, "/ca/connector"); + nvps.put(Constants.PR_URI, "/ca/connector"); } - nvps.add(Constants.PR_NICK_NAME, mNicknameText.getText().trim()); - nvps.add(Constants.PR_ENABLED, Constants.TRUE); + nvps.put(Constants.PR_NICK_NAME, mNicknameText.getText().trim()); + nvps.put(Constants.PR_ENABLED, Constants.TRUE); } else { - nvps.add(Constants.PR_ENABLED, Constants.FALSE); + nvps.put(Constants.PR_ENABLED, Constants.FALSE); } try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java index 8765f08eb..66e9b4397 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java @@ -17,9 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.config; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.ug.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; @@ -119,8 +117,8 @@ public class GeneralLogPanel extends CMSBaseTab { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_DEBUG_LOG_ENABLE, "true"); - nvps.add(Constants.PR_DEBUG_LOG_LEVEL, "0"); + nvps.put(Constants.PR_DEBUG_LOG_ENABLE, "true"); + nvps.put(Constants.PR_DEBUG_LOG_LEVEL, "0"); /*nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, ""); */ try { @@ -150,21 +148,19 @@ public class GeneralLogPanel extends CMSBaseTab { } protected void populate(NameValuePairs nvps) { - String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_DEBUG_LOG_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); } else if (name.equals(Constants.PR_DEBUG_LOG_LEVEL)) { - mLevelText.setText(nvp.getValue()); + mLevelText.setText(value); } /* else if (name.equals(Constants.PR_DEBUG_LOG_SHOWCALLER)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mShowCaller.setSelected(true); else mShowCaller.setSelected(false); @@ -213,7 +209,7 @@ public class GeneralLogPanel extends CMSBaseTab { } NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_DEBUG_LOG_LEVEL, level); + nvps.put(Constants.PR_DEBUG_LOG_LEVEL, level); /* if (mShowCaller.isSelected()) @@ -223,9 +219,9 @@ public class GeneralLogPanel extends CMSBaseTab { */ if (mEnable.isSelected()) - nvps.add(Constants.PR_DEBUG_LOG_ENABLE, Constants.TRUE); + nvps.put(Constants.PR_DEBUG_LOG_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_DEBUG_LOG_ENABLE, Constants.FALSE); + nvps.put(Constants.PR_DEBUG_LOG_ENABLE, Constants.FALSE); mModel.progressStart(); try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java index 76f7a73ec..d3a605433 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class JobsImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java index 58628b133..57848c649 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -110,9 +109,9 @@ public class JobsImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -264,23 +263,23 @@ public class JobsImplTab extends CMSBaseUGTab { //parse the data int i=0; String[] vals = new String[response.size()]; - Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>(); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("entry= "+entry); - Debug.println("value= "+value); + Debug.println("value= " + value); int x = value.indexOf(","); - Debug.println("x = "+x); + Debug.println("x = " + x); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; if (x != -1) { - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); } else { - obj.add(IMPL_CLASS, value); + obj.put(IMPL_CLASS, value); } data.put(entry,obj); } @@ -309,7 +308,7 @@ public class JobsImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_JOBS_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java index e12114eb1..76fbd9a38 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -53,19 +52,19 @@ public class JobsRuleDataModel extends CMSRuleDataModel NameValuePairs obj = (NameValuePairs) data; //XXX NEED TO ADD STUFF - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("JOBSRULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("JOBSRULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java index b33613014..b6a93d191 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java @@ -19,12 +19,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; -import com.netscape.admin.certsrv.config.*; + import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -110,8 +108,8 @@ public class JobsSettingPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE,""); - nvps.add(Constants.PR_JOBS_FREQUENCY, ""); + nvps.put(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_JOBS_FREQUENCY, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -131,13 +129,12 @@ public class JobsSettingPanel extends CMSBaseTab implements ItemListener { String clientCert = ""; String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_JOBS_FREQUENCY)) { - mFrequencyText.setText(nvp.getValue()); + mFrequencyText.setText(value); } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); @@ -208,12 +205,12 @@ public class JobsSettingPanel extends CMSBaseTab implements ItemListener { NameValuePairs nvps = new NameValuePairs(); if (mEnable.isSelected()) - nvps.add(Constants.PR_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_ENABLE, Constants.FALSE); if (mEnable.isSelected()){ - nvps.add(Constants.PR_JOBS_FREQUENCY, freq); + nvps.put(Constants.PR_JOBS_FREQUENCY, freq); } mModel.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java index 9e6d1cf9b..5821127d4 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java @@ -25,9 +25,8 @@ import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; -import javax.swing.table.*; import com.netscape.certsrv.common.*; /** @@ -285,8 +284,8 @@ public class KeyCreateDialog extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_KEY_LIST, mNameField.getText()); - config.add(Constants.PR_TOKEN_LIST, selectedToken); + config.put(Constants.PR_KEY_LIST, mNameField.getText()); + config.put(Constants.PR_TOKEN_LIST, selectedToken); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java index df246f2c5..a5af0b1dc 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class LogImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java index 984e2cb21..1b654fead 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -110,9 +109,9 @@ public class LogImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -264,16 +263,16 @@ public class LogImplTab extends CMSBaseUGTab { //parse the data int i=0; String[] vals = new String[response.size()]; - Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>(); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); data.put(entry,obj); } @@ -301,7 +300,7 @@ public class LogImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_LOG_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java index 57b7b0471..1a64226f0 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,10 +51,10 @@ public class LogRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); - v.addElement(obj.getValue(RULE_IMPL)); + v.addElement(obj.get(RULE_IMPL)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java b/pki/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java index fd2fe0843..8d90914b3 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java @@ -17,12 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.config; -import java.awt.*; -import javax.swing.*; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; -import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; /** @@ -95,16 +92,16 @@ public class MNSchemeWizardInfo extends WizardInfo { public void changeScheme() throws EAdminException { NameValuePairs param = new NameValuePairs(); - param.add(Constants.PR_RECOVERY_M, (String)get(Constants.PR_RECOVERY_M)); - param.add(Constants.PR_RECOVERY_N, (String)get(Constants.PR_RECOVERY_N)); - param.add(Constants.PR_RECOVERY_AGENT, (String)get(Constants.PR_RECOVERY_AGENT)); - param.add(Constants.PR_OLD_RECOVERY_AGENT, (String)get(Constants.PR_OLD_RECOVERY_AGENT)); + param.put(Constants.PR_RECOVERY_M, (String) get(Constants.PR_RECOVERY_M)); + param.put(Constants.PR_RECOVERY_N, (String) get(Constants.PR_RECOVERY_N)); + param.put(Constants.PR_RECOVERY_AGENT, (String) get(Constants.PR_RECOVERY_AGENT)); + param.put(Constants.PR_OLD_RECOVERY_AGENT, (String) get(Constants.PR_OLD_RECOVERY_AGENT)); mConnection.modify(DestDef.DEST_KRA_ADMIN, ScopeDef.SC_MNSCHEME, Constants.RS_ID_CONFIG, param); - //param.removeAllPairs(); + //param.clear(); } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java index 50728b13d..23d6ee0b4 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class MapperImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java index 66d4ba4ce..2ad54da60 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -115,9 +114,9 @@ public class MapperImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -269,16 +268,16 @@ public class MapperImplTab extends CMSBaseUGTab { //parse the data int i=0; String[] vals = new String[response.size()]; - Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>(); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); data.put(entry,obj); } @@ -306,7 +305,7 @@ public class MapperImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_MAPPER_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java index 1235fcc14..a72b59f7c 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,10 +51,10 @@ public class MapperRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); - v.addElement(obj.getValue(RULE_IMPL)); + v.addElement(obj.get(RULE_IMPL)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java index f48339b25..ff234c7fd 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java @@ -19,13 +19,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; -import com.netscape.admin.certsrv.ug.*; + import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; -import java.awt.*; -import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -118,7 +115,7 @@ public class OCSPStoresInstanceTab extends CMSPluginInstanceTab { try { mConnection.modify(DestDef.DEST_OCSP_ADMIN, ScopeDef.SC_OCSPSTORE_DEFAULT, - data.getValue(RULE_NAME), nvps); + data.get(RULE_NAME), nvps); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java index 30211b689..5cd67e276 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,19 +51,19 @@ public class OCSPStoresRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("OCSPSTORESRULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("OCSPSTORESRULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java index f3db6374a..5de06c7f9 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java @@ -20,13 +20,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import javax.swing.table.*; import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -207,8 +206,8 @@ public class PanelMapperConfigDialog extends JDialog Debug.println("MapperList: "+response.toString()); mSelection.removeAllItems(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - mSelection.addItem(((String)e.nextElement()).trim()); + for (String name : response.keySet()) { + mSelection.addItem(name.trim()); } mSelection.setSelectedItem(mapperName); @@ -230,11 +229,11 @@ public class PanelMapperConfigDialog extends JDialog mDataModel.removeAllRows(); - for (Enumeration e = mData.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); + for (String entry : mData.keySet()) { + entry = entry.trim(); if (!entry.equals(Constants.PR_MAPPER)) { - String value = mData.getValue(entry); - Vector v = new Vector(); + String value = mData.get(entry); + Vector<String> v = new Vector<String>(); v.addElement(entry); v.addElement(value); mDataModel.addRow(v); @@ -369,15 +368,15 @@ public class PanelMapperConfigDialog extends JDialog //save the configuration settings for the mapper private void saveConfiguration() throws EAdminException { NameValuePairs nvp = getData(); - nvp.add(Constants.PR_MAPPER, (String)mSelection.getSelectedItem()); + nvp.put(Constants.PR_MAPPER, (String) mSelection.getSelectedItem()); mConn.modify(mDest, mScope, Constants.RS_ID_CONFIG, nvp); } private NameValuePairs getData() { NameValuePairs response = new NameValuePairs(); for (int i=0; i< mDataModel.getRowCount(); i++) { - response.add((String)mDataModel.getValueAt(i,0), - (String)mDataModel.getValueAt(i,1)); + response.put((String) mDataModel.getValueAt(i, 0), + (String) mDataModel.getValueAt(i, 1)); } return response; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java index c88251f0b..437881186 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -163,7 +162,7 @@ public class PluginSelectionDialog extends JDialog } Debug.println(response.toString()); String id = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText(); - response.add(Constants.PR_POLICY_IMPL_NAME,id); + response.put(Constants.PR_POLICY_IMPL_NAME, id); CMSBaseConfigDialog dialog = null; if (mExtraDestination == null) { @@ -338,9 +337,9 @@ public class PluginSelectionDialog extends JDialog //parse the data String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - vals[i++] = ((String)e.nextElement()).trim(); - Debug.println("PluginSelectionDialog::update() - adding '"+vals[i-1]+"'"); + for (String name : response.keySet()) { + vals[i++] = name.trim(); + Debug.println("PluginSelectionDialog::update() - adding '" + vals[i - 1] + "'"); } CMSAdminUtil.bubbleSort(vals); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java index 8ac219345..59ea36ec8 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class PolicyImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java index 8e89dcf45..f4fab7260 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -117,9 +116,9 @@ public class PolicyImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -271,16 +270,16 @@ public class PolicyImplTab extends CMSBaseUGTab { //parse the data int i=0; String[] vals = new String[response.size()]; - Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>(); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); data.put(entry,obj); } @@ -308,7 +307,7 @@ public class PolicyImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_POLICY_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java index e379b53e9..9bbeda334 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -53,19 +52,19 @@ public class PolicyRuleDataModel extends CMSRuleDataModel NameValuePairs obj = (NameValuePairs) data; //XXX NEED TO ADD STUFF - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("POLICYRULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("POLICYRULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java index ec7394d4e..1c99d999f 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -285,7 +284,7 @@ public class PolicyRuleOrderDialog extends JDialog } NameValuePairs nvp = new NameValuePairs(); - nvp.add(Constants.PR_POLICY_ORDER, buf.toString()); + nvp.put(Constants.PR_POLICY_ORDER, buf.toString()); Debug.println("ORDER: "+buf.toString()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java index f83a7457c..a8d312d2a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java @@ -20,13 +20,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -367,11 +364,11 @@ public class ProfileConfigDialog extends CMSBaseConfigDialog if (mModel != null) { mModel.progressStart(); } String instanceName = mPluginName.getText(); - nvp.add("impl", mImplName.getText()); - nvp.add("name", mNameField.getText()); - nvp.add("visible", (String)(mVisibleField.getSelectedItem())); - nvp.add("auth", mAuthField.getText()); - nvp.add("desc", mDescField.getText()); + nvp.put("impl", mImplName.getText()); + nvp.put("name", mNameField.getText()); + nvp.put("visible", (String) (mVisibleField.getSelectedItem())); + nvp.put("auth", mAuthField.getText()); + nvp.put("desc", mDescField.getText()); // nvp.add("config", mConfigField.getText()); // mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN, mAdminConnection.add(mDest, diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java index 0a3ceebe2..d10e19215 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java @@ -21,12 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -684,11 +682,11 @@ public class ProfileEditDialog extends CMSBaseConfigDialog mModel.progressStart(); String instanceName = mPluginName.getText(); - nvp.add("impl", mImplName.getText()); - nvp.add("name", mNameField.getText()); - nvp.add("desc", mDescField.getText()); - nvp.add("visible", (String)(mVisibleField.getSelectedItem())); - nvp.add("auth", mAuthField.getText()); + nvp.put("impl", mImplName.getText()); + nvp.put("name", mNameField.getText()); + nvp.put("desc", mDescField.getText()); + nvp.put("visible", (String) (mVisibleField.getSelectedItem())); + nvp.put("auth", mAuthField.getText()); // nvp.add("config", mConfigField.getText()); /* @@ -719,7 +717,7 @@ public class ProfileEditDialog extends CMSBaseConfigDialog private void deletePolicy(String profileId, String policyId) throws EAdminException{ NameValuePairs nvps = new NameValuePairs(); - nvps.add("POLICYID", policyId); + nvps.put("POLICYID", policyId); //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN, mAdminConnection.delete(mDest, ScopeDef.SC_PROFILE_POLICIES, profileId, nvps); @@ -728,7 +726,7 @@ public class ProfileEditDialog extends CMSBaseConfigDialog private void deleteInput(String profileId, String inputId) throws EAdminException{ NameValuePairs nvps = new NameValuePairs(); - nvps.add("INPUTID", inputId); + nvps.put("INPUTID", inputId); //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN, mAdminConnection.delete(mDest, ScopeDef.SC_PROFILE_INPUT, profileId, nvps); @@ -737,7 +735,7 @@ public class ProfileEditDialog extends CMSBaseConfigDialog private void deleteOutput(String profileId, String outputId) throws EAdminException{ NameValuePairs nvps = new NameValuePairs(); - nvps.add("OUTPUTID", outputId); + nvps.put("OUTPUTID", outputId); //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN, mAdminConnection.delete(mDest, ScopeDef.SC_PROFILE_OUTPUT, profileId, nvps); @@ -769,17 +767,17 @@ public class ProfileEditDialog extends CMSBaseConfigDialog } mModel.progressStop(); - String enable = response.getValue("enable"); + String enable = response.get("enable"); if (response != null) { mPluginName.setEnabled(false); mPluginName.setBackground(getBackground()); mPluginName.setText(name); - mNameField.setText(response.getValue("name")); - mDescField.setText(response.getValue("desc")); - mAuthField.setText(response.getValue("auth")); - mVisibleField.setSelectedItem(response.getValue("visible")); - mImplName.setText(response.getValue("plugin")); + mNameField.setText(response.get("name")); + mDescField.setText(response.get("desc")); + mAuthField.setText(response.get("auth")); + mVisibleField.setSelectedItem(response.get("visible")); + mImplName.setText(response.get("plugin")); // mConfigField.setText(response.getValue("config")); } if (enable != null && enable.equals("true")) { @@ -870,29 +868,27 @@ public class ProfileEditDialog extends CMSBaseConfigDialog } private void populatePolicies(NameValuePairs response, JTable table) { - Vector colNames = new Vector(); + Vector<String> colNames = new Vector<String>(); colNames.addElement("Set Id"); colNames.addElement("Id"); colNames.addElement("Defaults"); colNames.addElement("Constraints"); - Vector d = new Vector(); + Vector<Vector<String>> d = new Vector<Vector<String>>(); - Enumeration e = response.getNames(); - if (e != null) { - for (; e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("populatePolicies entry= "+entry); Debug.println("populatePolicies value= "+value); StringTokenizer st = new StringTokenizer(value, ";"); - String def = (String)st.nextToken(); - String con = (String)st.nextToken(); - Vector row = new Vector(); + String def = st.nextToken(); + String con = st.nextToken(); + Vector<String> row = new Vector<String>(); StringTokenizer st1 = new StringTokenizer(entry, ":"); - String setId = (String)st1.nextToken(); - String id = (String)st1.nextToken(); + String setId = st1.nextToken(); + String id = st1.nextToken(); if (mDefSetId == null) { mDefSetId = setId; @@ -902,7 +898,6 @@ public class ProfileEditDialog extends CMSBaseConfigDialog row.addElement(def); row.addElement(con); d.addElement(row); - } } ProfileEditDataModel model = new ProfileEditDataModel(); model.setInfo(d, colNames); @@ -910,21 +905,21 @@ public class ProfileEditDialog extends CMSBaseConfigDialog } private void populateNonPolicy(NameValuePairs response, JTable table) { - Vector colNames = new Vector(); + Vector<String> colNames = new Vector<String>(); colNames.addElement("Id"); if (table == mInputTable) colNames.addElement("Inputs"); else if (table == mOutputTable) colNames.addElement("Outputs"); - Vector d = new Vector(); + Vector<Vector<String>> d = new Vector<Vector<String>>(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); - Debug.println("populateNonPolicy entry= "+entry); - Debug.println("populateNonPolicy value= "+value); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); + Debug.println("populateNonPolicy entry= " + entry); + Debug.println("populateNonPolicy value= " + value); - Vector row = new Vector(); + Vector<String> row = new Vector<String>(); row.addElement(entry); row.addElement(value); d.addElement(row); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java index 98c188380..eee2531cf 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -59,11 +58,11 @@ public class ProfileImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_TYPE)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_TYPE)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java index e9047701c..c7d28dd07 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -111,9 +110,9 @@ public class ProfileImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -264,9 +263,9 @@ public class ProfileImplTab extends CMSBaseUGTab { mModel.progressStop(); return; } - for (Enumeration e = response1.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - response.add(entry+";profile", response1.getValue(entry)); + for (String entry : response1.keySet()) { + entry = entry.trim(); + response.put(entry + ";profile", response1.get(entry)); } try { response2 = mConnection.search(mDestination, @@ -278,9 +277,9 @@ public class ProfileImplTab extends CMSBaseUGTab { mModel.progressStop(); return; } - for (Enumeration e = response2.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - response.add(entry+";profileInput", response2.getValue(entry)); + for (String entry : response2.keySet()) { + entry = entry.trim(); + response.put(entry + ";profileInput", response2.get(entry)); } try { response3 = mConnection.search(mDestination, @@ -292,9 +291,9 @@ public class ProfileImplTab extends CMSBaseUGTab { mModel.progressStop(); return; } - for (Enumeration e = response3.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - response.add(entry+";profileOutput", response3.getValue(entry)); + for (String entry : response3.keySet()) { + entry = entry.trim(); + response.put(entry + ";profileOutput", response3.get(entry)); } try { response4 = mConnection.search(mDestination, @@ -306,9 +305,9 @@ public class ProfileImplTab extends CMSBaseUGTab { mModel.progressStop(); return; } - for (Enumeration e = response4.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - response.add(entry+";defaultPolicy", response4.getValue(entry)); + for (String entry : response4.keySet()) { + entry = entry.trim(); + response.put(entry + ";defaultPolicy", response4.get(entry)); } try { response5 = mConnection.search(mDestination, @@ -320,27 +319,27 @@ public class ProfileImplTab extends CMSBaseUGTab { mModel.progressStop(); return; } - for (Enumeration e = response5.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - response.add(entry+";constraintPolicy", response5.getValue(entry)); + for (String entry : response5.keySet()) { + entry = entry.trim(); + response.put(entry + ";constraintPolicy", response5.get(entry)); } //parse the data int i=0; String[] vals = new String[response.size()]; Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); int x_end = value.lastIndexOf(","); int y = entry.indexOf(";"); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry.substring(0,y)); - obj.add(IMPL_TYPE,entry.substring(y+1)); + obj.put(IMPL_NAME, entry.substring(0, y)); + obj.put(IMPL_TYPE, entry.substring(y + 1)); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1,x_end)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1, x_end)); data.put(entry,obj); } @@ -367,8 +366,8 @@ public class ProfileImplTab extends CMSBaseUGTab { //send comment to server for the removal of user try { mConnection.delete(mDestination, - obj.getValue(IMPL_TYPE), - obj.getValue(IMPL_NAME)); + obj.get(IMPL_TYPE), + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java index 05836bc87..e597b242b 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java @@ -20,13 +20,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -309,8 +306,8 @@ setLabelCellEditor(mTable, 1); } for (int i = 0; i < mTable.getRowCount(); i++) { - nvp.add((String)mTable.getValueAt(i,0), - (String)mTable.getValueAt(i,1)); + nvp.put((String) mTable.getValueAt(i, 0), + (String) mTable.getValueAt(i, 1)); } if (mIsNew) { @@ -384,11 +381,11 @@ setLabelCellEditor(mTable, 1); defcolNames.addElement("Value"); Vector defdata = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); - Debug.println("entry= "+entry); - Debug.println("value= "+value); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); + Debug.println("entry= " + entry); + Debug.println("value= " + value); int start_pos = value.indexOf(';'); int end_pos = value.lastIndexOf(';'); @@ -413,9 +410,9 @@ setLabelCellEditor(mTable, 1); mPluginName.setText(profileId); mPluginName.setBackground(getBackground()); mPluginName.setEnabled(false); - mNameField.setText(response.getValue("name")); + mNameField.setText(response.get("name")); if (mIsNew) - mDescField.setText(response.getValue("desc")); + mDescField.setText(response.get("desc")); } this.show(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java index 4487754f2..8d97ffd13 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -348,9 +347,9 @@ public class ProfileNonPolicySelDialog extends JDialog //parse the data String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String name = ((String)e.nextElement()).trim(); - String val = response.getValue(name); + for (String name : response.keySet()) { + name = name.trim(); + String val = response.get(name); StringTokenizer st = new StringTokenizer(val, ","); String className = st.nextToken(); String desc = st.nextToken(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java index c3b033221..ec3bb4c7c 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java @@ -20,11 +20,8 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; -import java.awt.*; -import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -89,7 +86,7 @@ public class ProfilePluginSelectionDialog extends PluginSelectionDialog } Debug.println(response.toString()); String id =(String)(((ProfileListDataModel)mDataModel).getObjectValueAt(mList.getSelectedIndex())); - response.add(Constants.PR_POLICY_IMPL_NAME,id); + response.put(Constants.PR_POLICY_IMPL_NAME, id); CMSBaseConfigDialog dialog = null; if (mExtraDestination == null) { @@ -160,9 +157,8 @@ public class ProfilePluginSelectionDialog extends PluginSelectionDialog String[] classnames = new String[response.size()]; String[] ids = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String id = (String)e.nextElement(); - String value = response.getValue(id); + for (String id : response.keySet()) { + String value = response.get(id); int pos = value.lastIndexOf(","); String className = value.substring(pos+1); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java index 12781c6b5..34b95c0f1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java @@ -20,13 +20,11 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -462,7 +460,7 @@ public class ProfilePolicyEditDialog extends CMSBaseConfigDialog val = (String)(((JComboBox)comp).getSelectedItem()); } String name1 = ((JLabel)(mDefaultTable.getValueAt(i,0))).getText(); - nvp.add(name1, val); + nvp.put(name1, val); } @@ -485,7 +483,7 @@ public class ProfilePolicyEditDialog extends CMSBaseConfigDialog } String name1 = ((JLabel)(mConstraintTable.getValueAt(i,0))).getText(); - nvp.add(name1, val); + nvp.put(name1, val); } instanceName = mPluginName.getText(); //DestDef.DEST_CA_PROFILE_ADMIN, @@ -582,9 +580,9 @@ public class ProfilePolicyEditDialog extends CMSBaseConfigDialog defcolNames.addElement("Value"); Vector defdata = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("ProfilePolicyEditDialog entry= "+entry); Debug.println("ProfilePolicyEditDialog value= "+value); @@ -605,7 +603,7 @@ public class ProfilePolicyEditDialog extends CMSBaseConfigDialog mPluginName.setText(profileId); mPluginName.setBackground(getBackground()); mPluginName.setEnabled(false); - mNameField.setText(response.getValue("name")); + mNameField.setText(response.get("name")); mDescField.setText(setid); mDescField.setBackground(getBackground()); mDescField.setEnabled(false); @@ -633,9 +631,9 @@ public class ProfilePolicyEditDialog extends CMSBaseConfigDialog colNames.addElement("Value"); Vector d = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("entry= "+entry); Debug.println("value= "+value); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java index 44e1aa512..941917808 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java @@ -20,13 +20,11 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import javax.swing.table.*; -import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -483,7 +481,7 @@ public class ProfilePolicyNewDialog extends CMSBaseConfigDialog val = (String)(((JComboBox)comp).getSelectedItem()); } String name1 = ((JLabel)(mDefaultTable.getValueAt(i,0))).getText(); - nvp.add(name1, val); + nvp.put(name1, val); } @@ -505,7 +503,7 @@ public class ProfilePolicyNewDialog extends CMSBaseConfigDialog } String name1 = ((JLabel)(mConstraintTable.getValueAt(i,0))).getText(); - nvp.add(name1, val); + nvp.put(name1, val); } instanceName = mPluginName.getText(); //mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN, @@ -559,9 +557,9 @@ public class ProfilePolicyNewDialog extends CMSBaseConfigDialog defcolNames.addElement("Value"); Vector defdata = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("entry= "+entry); Debug.println("value= "+value); @@ -581,8 +579,8 @@ public class ProfilePolicyNewDialog extends CMSBaseConfigDialog mPluginName.setText(profileId); mPluginName.setBackground(getBackground()); mPluginName.setEnabled(false); - mNameField.setText(response.getValue("name")); - mDescField.setText(response.getValue("desc")); + mNameField.setText(response.get("name")); + mDescField.setText(response.get("desc")); } // retrieve policy information @@ -604,9 +602,9 @@ public class ProfilePolicyNewDialog extends CMSBaseConfigDialog colNames.addElement("Value"); Vector d = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("entry= "+entry); Debug.println("value= "+value); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java index 69d502355..44fe9886b 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java @@ -24,7 +24,7 @@ import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -460,9 +460,9 @@ public class ProfilePolicySelectionDialog extends JDialog //parse the data String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String name = ((String)e.nextElement()).trim(); - String val = response.getValue(name); + for (String name : response.keySet()) { + name = name.trim(); + String val = response.get(name); StringTokenizer st = new StringTokenizer(val, ","); String className = st.nextToken(); String desc = st.nextToken(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java index fb9ed20e7..c576adbe6 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java @@ -20,14 +20,12 @@ package com.netscape.admin.certsrv.config; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.*; import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; -import javax.swing.table.*; import com.netscape.certsrv.common.*; @@ -287,8 +285,8 @@ public class ProfileRegisterDialog extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_POLICY_CLASS, mClassField.getText()); - config.add(Constants.PR_POLICY_DESC, mDescField.getText()); + config.put(Constants.PR_POLICY_CLASS, mClassField.getText()); + config.put(Constants.PR_POLICY_DESC, mDescField.getText()); if (mType) { mScope=mTypeField.getText(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java index 73bf5ca91..7a3ba2827 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java @@ -20,9 +20,7 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; -import com.netscape.management.client.util.Debug; /** @@ -52,19 +50,19 @@ public class ProfileRuleDataModel extends CMSRuleDataModel NameValuePairs obj = (NameValuePairs) data; //XXX NEED TO ADD STUFF - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("POLICYRULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("POLICYRULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java index 18ad05ba2..aefa4b1cc 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class PublisherImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java index ebe4db5db..79fedfe5e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -115,9 +114,9 @@ public class PublisherImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -271,15 +270,15 @@ public class PublisherImplTab extends CMSBaseUGTab { int i=0; String[] vals = new String[response.size()]; Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); data.put(entry,obj); } @@ -307,7 +306,7 @@ public class PublisherImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_PUBLISHER_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java index e8ff44e44..03faeac21 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,10 +51,10 @@ public class PublisherRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); - v.addElement(obj.getValue(RULE_IMPL)); + v.addElement(obj.get(RULE_IMPL)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java index e1ef3631a..fe48419c7 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java @@ -24,9 +24,8 @@ import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; -import javax.swing.table.*; import com.netscape.certsrv.common.*; /** @@ -270,7 +269,7 @@ public class RegisterDialog extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_POLICY_CLASS, mClassField.getText()); + config.put(Constants.PR_POLICY_CLASS, mClassField.getText()); if (mType) { mScope=mTypeField.getText(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java index 26e065c04..86a4fa6d4 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** @@ -58,10 +57,10 @@ public class RuleImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - v.addElement(new JLabel(obj.getValue(IMPL_NAME), + v.addElement(new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN), JLabel.LEFT)); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java index b0c262dea..098cbcbd1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java @@ -21,11 +21,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -115,9 +114,9 @@ public class RuleImplTab extends CMSBaseUGTab { mDataModel.getObjectValueAt(mTable.getSelectedRow()); if (mViewer==null) mViewer = new ViewDialog(mModel.getFrame()); - mViewer.showDialog(obj.getValue(IMPL_NAME), - obj.getValue(IMPL_CLASS), - obj.getValue(IMPL_DESC)); + mViewer.showDialog(obj.get(IMPL_NAME), + obj.get(IMPL_CLASS), + obj.get(IMPL_DESC)); } if (e.getSource().equals(mHelp)) { helpCallback(); @@ -270,15 +269,15 @@ public class RuleImplTab extends CMSBaseUGTab { int i=0; String[] vals = new String[response.size()]; Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); int x = value.indexOf(","); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); vals[i++]= entry ; - obj.add(IMPL_CLASS, value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_CLASS, value.substring(0, x)); + obj.put(IMPL_DESC, value.substring(x + 1)); data.put(entry,obj); } @@ -306,7 +305,7 @@ public class RuleImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_RULE_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java index 0eb22433d..cee7727a1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.config; import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.Debug; @@ -52,19 +51,19 @@ public class RuleRuleDataModel extends CMSRuleDataModel Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - if (obj.getValue(RULE_STAT).equalsIgnoreCase("enabled")) { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) { + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE), JLabel.LEFT)); v.addElement(mResource.getString("RULERULE_LABEL_ENABLED_LABEL")); } else { - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE), JLabel.LEFT)); v.addElement(mResource.getString("RULERULE_LABEL_DISABLED_LABEL")); } addRow(v, data); - mRules.addElement(obj.getValue(RULE_NAME)); + mRules.addElement(obj.get(RULE_NAME)); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java index 458885e2a..ac8b5e610 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java @@ -17,22 +17,17 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.config; -import com.netscape.admin.certsrv.keycert.*; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.console.*; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; -import org.mozilla.jss.*; -import org.mozilla.jss.pkcs10.*; -import org.mozilla.jss.crypto.*; import org.mozilla.jss.CryptoManager; /** * User Certs Tab @@ -239,9 +234,8 @@ public class TKSKeysTab extends CMSBaseUGTab { mToken.removeAllItems(); String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } int sindex = 0; @@ -249,7 +243,7 @@ public class TKSKeysTab extends CMSBaseUGTab { for (i=0; i<vals.length; i++) { Vector v = new Vector(); String entry = vals[i]; - String value = response.getValue(entry); + String value = response.get(entry); // look for the comma separator StringTokenizer st = new StringTokenizer(value, ","); @@ -293,7 +287,7 @@ public class TKSKeysTab extends CMSBaseUGTab { NameValuePairs response; NameValuePairs request; request = new NameValuePairs(); - request.add(Constants.PR_TOKEN_LIST, (String)mToken.getSelectedItem()); + request.put(Constants.PR_TOKEN_LIST, (String) mToken.getSelectedItem()); try { response = mConnection.search(mDestination, ScopeDef.SC_TKSKEYSLIST, request); @@ -311,9 +305,8 @@ public class TKSKeysTab extends CMSBaseUGTab { if (response != null) { String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } int sindex = 0; @@ -321,7 +314,7 @@ public class TKSKeysTab extends CMSBaseUGTab { for (i=0; i<vals.length; i++) { String entry = vals[i]; if (entry.equals(Constants.PR_TOKEN_LIST)) { - String value = response.getValue(entry); + String value = response.get(entry); // look for the comma separator StringTokenizer st = new StringTokenizer(value, ","); int numberOfKeys = 0; diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java b/pki/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java index e5fc28135..de0a075a1 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java @@ -22,11 +22,10 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.ug.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.console.*; import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -123,17 +122,16 @@ public class UserCertsTab extends CMSBaseUGTab { try { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_NICK_NAME, nickname); - nvps.add(Constants.PR_SERIAL_NUMBER, serialno); - nvps.add(Constants.PR_ISSUER_NAME, issuername); + nvps.put(Constants.PR_NICK_NAME, nickname); + nvps.put(Constants.PR_SERIAL_NUMBER, serialno); + nvps.put(Constants.PR_ISSUER_NAME, issuername); NameValuePairs results = mConnection.read( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT, Constants.RS_ID_CONFIG, nvps); if (nvps.size() <= 0) return; - NameValuePair nvp = results.elementAt(0); - String name = nvp.getName(); - String print = nvp.getValue(); + String name = results.keySet().iterator().next(); // first element + String print = results.get(name); CertViewDialog certdialog = new CertViewDialog(mModel.getFrame()); certdialog.showDialog(nickname, print); } catch (EAdminException ex) { @@ -289,9 +287,8 @@ public class UserCertsTab extends CMSBaseUGTab { if (response != null) { String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } int sindex = 0; @@ -300,7 +297,7 @@ public class UserCertsTab extends CMSBaseUGTab { for (i=0; i<vals.length; i++) { Vector v = new Vector(); String entry = vals[i]; - String value = response.getValue(entry); + String value = response.get(entry); // look for the comma separator int lastindex = entry.lastIndexOf(","); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java index 7ba0636fd..8c989685a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java @@ -17,18 +17,10 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.config.install; -import java.awt.*; -import java.awt.event.*; -import javax.swing.border.*; -import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.config.*; -import com.netscape.management.client.console.*; -import com.netscape.admin.certsrv.task.*; -import java.util.*; /** * Certificate Extension for installation wizard. @@ -87,12 +79,12 @@ class WICertExtensionPage extends WBaseCertExtensionPage implements if (ready) { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_CERTIFICATE_TYPE, wizardInfo.getCertType()); - nvps.add(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); - nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); - nvps.add(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); - nvps.add(Constants.PR_KEY_TYPE, wizardInfo.getKeyType()); - nvps.add(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); + nvps.put(Constants.PR_CERTIFICATE_TYPE, wizardInfo.getCertType()); + nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); + nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); + nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); + nvps.put(Constants.PR_KEY_TYPE, wizardInfo.getKeyType()); + nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); addValidityPeriod(wizardInfo, nvps); if (mBasicCheckBox.isSelected()) @@ -102,16 +94,16 @@ class WICertExtensionPage extends WBaseCertExtensionPage implements addExtendedKey(nvps); if (mAKICheckBox.isSelected()) - nvps.add(Constants.PR_AKI, Constants.TRUE); + nvps.put(Constants.PR_AKI, Constants.TRUE); if (mSKICheckBox.isSelected()) - nvps.add(Constants.PR_SKI, Constants.TRUE); + nvps.put(Constants.PR_SKI, Constants.TRUE); if (mKeyUsageBox.isSelected()) - nvps.add(Constants.PR_KEY_USAGE, Constants.TRUE); + nvps.put(Constants.PR_KEY_USAGE, Constants.TRUE); if (mMIMECheckBox.isSelected()) - nvps.add(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim()); + nvps.put(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim()); wizardInfo.put(wizardInfo.ALL_CERT_INFO, nvps); } @@ -122,45 +114,45 @@ class WICertExtensionPage extends WBaseCertExtensionPage implements private void addValidityPeriod(InstallWizardInfo wizardInfo, NameValuePairs nvps) { - nvps.add(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear()); - nvps.add(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth()); - nvps.add(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate()); - nvps.add(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour()); - nvps.add(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin()); - nvps.add(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec()); - nvps.add(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear()); - nvps.add(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth()); - nvps.add(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate()); - nvps.add(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour()); - nvps.add(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin()); - nvps.add(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec()); + nvps.put(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear()); + nvps.put(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth()); + nvps.put(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate()); + nvps.put(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour()); + nvps.put(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin()); + nvps.put(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec()); + nvps.put(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear()); + nvps.put(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth()); + nvps.put(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate()); + nvps.put(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour()); + nvps.put(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin()); + nvps.put(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec()); } private void addBasicConstraints(NameValuePairs nvps) { if (mCACheckBox.isSelected()) - nvps.add(Constants.PR_IS_CA, Constants.TRUE); + nvps.put(Constants.PR_IS_CA, Constants.TRUE); if (mCertPathBox.isSelected()) { String certLen = mCertPathText.getText().trim(); if (!certLen.equals("")) - nvps.add(Constants.PR_CERT_LEN, certLen); + nvps.put(Constants.PR_CERT_LEN, certLen); } else { // negative number means infinity - nvps.add(Constants.PR_CERT_LEN, "-1"); + nvps.put(Constants.PR_CERT_LEN, "-1"); } } private void addExtendedKey(NameValuePairs nvps) { if (mSSLClient.isSelected()) - nvps.add(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE); if (mSSLServer.isSelected()) - nvps.add(Constants.PR_SSL_SERVER_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_SERVER_BIT, Constants.TRUE); if (mSSLMail.isSelected()) - nvps.add(Constants.PR_SSL_MAIL_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_MAIL_BIT, Constants.TRUE); if (mObjectSigning.isSelected()) - nvps.add(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE); + nvps.put(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE); if (mTimeStamping.isSelected()) - nvps.add(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE); + nvps.put(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE); } public void callHelp() { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java index 9a5c0b617..8272d44df 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java @@ -18,14 +18,10 @@ package com.netscape.admin.certsrv.config.install; import java.awt.*; -import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; import com.netscape.certsrv.common.*; -import com.netscape.admin.certsrv.task.*; -import com.netscape.management.client.console.*; /** * Generate the certificate @@ -85,10 +81,10 @@ class WIGenKeyCertPage extends WizardBasePanel implements IWizardPanel { rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd(); if (nvps != null) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = (NameValuePair)nvps.elementAt(i); - rawData = rawData+"&"+nvp.getName()+"="+nvp.getValue(); - } + for (String name : nvps.keySet()) { + String value = nvps.get(name); + rawData = rawData+"&"+name+"="+value; + } } startProgressStatus(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java index 7d83c8b65..b5c0378c3 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java @@ -18,15 +18,10 @@ package com.netscape.admin.certsrv.config.install; import java.awt.*; -import java.util.*; import javax.swing.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; import com.netscape.certsrv.common.*; -import com.netscape.admin.certsrv.task.*; -import com.netscape.management.client.console.*; -import com.netscape.management.client.util.*; /** * Generate the certificate request @@ -70,7 +65,7 @@ class WIGenKeyCertReqPage extends WizardBasePanel implements IWizardPanel { NameValuePairs nvps = (NameValuePairs)wizardInfo.get(wizardInfo.ALL_CERT_INFO); if (nvps != null) { - str = (String)nvps.getValue(Constants.PR_SKI); + str = (String)nvps.get(Constants.PR_SKI); if (str != null && str.equals(ConfigConstants.TRUE)) { mCMC.setEnabled(true); mCMC.setVisible(true); @@ -171,11 +166,10 @@ class WIGenKeyCertReqPage extends WizardBasePanel implements IWizardPanel { NameValuePairs nvps = wizardInfo.getAllCertInfo();//extensions if (nvps != null) { - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = (NameValuePair)nvps.elementAt(i); - - if (nvp.getName()!= null && nvp.getValue()!= null) - rawData = rawData+"&"+nvp.getName()+"="+nvp.getValue(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); + if (name != null && value != null) + rawData = rawData+"&"+name+"="+value; } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java b/pki/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java index 7539c393c..acb023132 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java @@ -20,7 +20,7 @@ package com.netscape.admin.certsrv.connection; import java.io.*; import java.net.*; import java.util.*; -import java.util.*; + import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.*; import com.netscape.management.client.util.*; @@ -263,9 +263,9 @@ public class AdminConnection { request.set(Constants.OP_TYPE, OpDef.OP_ADD); request.set(Constants.OP_SCOPE, scope); request.set(Constants.RS_ID, id); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request); if (response.getReturnCode() == Response.SUCCESS) { @@ -319,9 +319,9 @@ public class AdminConnection { request.set(Constants.OP_TYPE, OpDef.OP_DELETE); request.set(Constants.OP_SCOPE, scope); request.set(Constants.RS_ID, id); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request); if (response.getReturnCode() == Response.SUCCESS) { @@ -413,9 +413,9 @@ public class AdminConnection { Request request = new Request(mPath + "/" + dest); request.set(Constants.OP_TYPE, OpDef.OP_SEARCH); request.set(Constants.OP_SCOPE, scope); - for (int i = 0; i < filters.size(); i++) { - NameValuePair p = (NameValuePair)filters.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : filters.keySet()) { + String value = filters.get(name); + request.set(name, value); } Response response = sendRequest(request); @@ -425,7 +425,7 @@ public class AdminConnection { Enumeration e = response.getNames(); while (e.hasMoreElements()) { String n = (String)e.nextElement(); - newpairs.add(n, response.get(n)); + newpairs.put(n, response.get(n)); } return newpairs; } @@ -465,9 +465,9 @@ public class AdminConnection { request.set(Constants.OP_TYPE, OpDef.OP_READ); request.set(Constants.OP_SCOPE, scope); request.set(Constants.RS_ID, id); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request); @@ -477,7 +477,7 @@ public class AdminConnection { Enumeration e = response.getNames(); while (e.hasMoreElements()) { String n = (String)e.nextElement(); - newpairs.add(n, response.get(n)); + newpairs.put(n, response.get(n)); } return newpairs; } @@ -496,9 +496,9 @@ public class AdminConnection { request.set(Constants.OP_SCOPE, scope); request.set(Constants.RS_ID, id); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request, useGET); @@ -507,7 +507,7 @@ public class AdminConnection { Enumeration e = response.getNames(); while (e.hasMoreElements()) { String n = (String)e.nextElement(); - newpairs.add(n, response.get(n)); + newpairs.put(n, response.get(n)); } return newpairs; } @@ -519,9 +519,9 @@ public class AdminConnection { Request request = new Request(mPath + "/" + dest); request.set(Constants.OP_TYPE, OpDef.OP_VALIDATE); request.set(Constants.OP_SCOPE, scope); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request); @@ -568,9 +568,9 @@ public class AdminConnection { request.set(Constants.OP_TYPE, OpDef.OP_MODIFY); request.set(Constants.OP_SCOPE, scope); request.set(Constants.RS_ID, id); - for (int i = 0; i < pairs.size(); i++) { - NameValuePair p = (NameValuePair)pairs.elementAt(i); - request.set(p.getName(), p.getValue()); + for (String name : pairs.keySet()) { + String value = pairs.get(name); + request.set(name, value); } Response response = sendRequest(request, useGET); if (response.getReturnCode() == Response.SUCCESS) { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java index 661b7e469..1c2268bb2 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java @@ -17,11 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.keycert; -import java.awt.*; -import java.util.*; import javax.swing.*; import javax.swing.border.*; -import javax.swing.event.*; + import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; @@ -62,7 +60,7 @@ class WCertDNPage extends WBaseDNPage implements IWizardPanel { public boolean initializePanel(WizardInfo info) { CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info; NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); + nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps); if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) || @@ -133,7 +131,7 @@ class WCertDNPage extends WBaseDNPage implements IWizardPanel { AdminConnection connection = wizardInfo.getAdminConnection(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SUBJECT_NAME, str); + nvps.put(Constants.PR_SUBJECT_NAME, str); wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, str); try { @@ -149,13 +147,13 @@ class WCertDNPage extends WBaseDNPage implements IWizardPanel { if (wizardInfo.isNewKey()) { String type = wizardInfo.getKeyType(); if (type.equals("ECC")) { - nvps.add(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); + nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); } else { - nvps.add(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); + nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); } - nvps.add(Constants.PR_KEY_TYPE, type); - nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); + nvps.put(Constants.PR_KEY_TYPE, type); + nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); } wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java index b53e200dc..f7505be2e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java @@ -17,8 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.keycert; -import java.awt.*; -import java.awt.event.*; import javax.swing.border.*; import javax.swing.*; import com.netscape.admin.certsrv.*; @@ -145,7 +143,7 @@ class WCertExtensionPage extends WBaseCertExtensionPage implements if (mMIMECheckBox.isSelected()) { startProgressStatus(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(ConfigConstants.PR_CERTIFICATE_EXTENSION, mMIMEText.getText().trim()); + nvps.put(ConfigConstants.PR_CERTIFICATE_EXTENSION, mMIMEText.getText().trim()); AdminConnection connection = wizardInfo.getAdminConnection(); try { connection.validate( @@ -159,16 +157,16 @@ class WCertExtensionPage extends WBaseCertExtensionPage implements NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); + nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); if (wizardInfo.isNewKey()) { String type = wizardInfo.getKeyType(); if (type.equals("ECC")) { - nvps.add(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); + nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); } else { - nvps.add(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); + nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); } - nvps.add(Constants.PR_KEY_TYPE, type); - nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); + nvps.put(Constants.PR_KEY_TYPE, type); + nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); } //nvps.add(Constants.PR_VALIDITY_PERIOD, wizardInfo.getValidityPeriod()); addValidityPeriod(wizardInfo, nvps); @@ -180,22 +178,22 @@ class WCertExtensionPage extends WBaseCertExtensionPage implements addExtendedKey(nvps); if (mAIACheckBox.isSelected()) - nvps.add(Constants.PR_AIA, Constants.TRUE); + nvps.put(Constants.PR_AIA, Constants.TRUE); if (mAKICheckBox.isSelected()) - nvps.add(Constants.PR_AKI, Constants.TRUE); + nvps.put(Constants.PR_AKI, Constants.TRUE); if (mSKICheckBox.isSelected()) - nvps.add(Constants.PR_SKI, Constants.TRUE); + nvps.put(Constants.PR_SKI, Constants.TRUE); if (mOCSPNoCheck.isSelected()) - nvps.add(Constants.PR_OCSP_NOCHECK, Constants.TRUE); + nvps.put(Constants.PR_OCSP_NOCHECK, Constants.TRUE); if (mKeyUsageBox.isSelected()) - nvps.add(Constants.PR_KEY_USAGE, Constants.TRUE); + nvps.put(Constants.PR_KEY_USAGE, Constants.TRUE); if (mMIMECheckBox.isSelected()) - nvps.add(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim()); + nvps.put(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim()); wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps); @@ -205,44 +203,44 @@ class WCertExtensionPage extends WBaseCertExtensionPage implements private void addValidityPeriod(CertSetupWizardInfo wizardInfo, NameValuePairs nvps) { - nvps.add(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear()); - nvps.add(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth()); - nvps.add(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate()); - nvps.add(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour()); - nvps.add(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin()); - nvps.add(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec()); - nvps.add(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear()); - nvps.add(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth()); - nvps.add(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate()); - nvps.add(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour()); - nvps.add(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin()); - nvps.add(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec()); + nvps.put(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear()); + nvps.put(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth()); + nvps.put(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate()); + nvps.put(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour()); + nvps.put(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin()); + nvps.put(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec()); + nvps.put(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear()); + nvps.put(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth()); + nvps.put(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate()); + nvps.put(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour()); + nvps.put(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin()); + nvps.put(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec()); } private void addBasicConstraints(NameValuePairs nvps) { if (mCACheckBox.isSelected()) - nvps.add(Constants.PR_IS_CA, Constants.TRUE); + nvps.put(Constants.PR_IS_CA, Constants.TRUE); String certLen = mCertPathText.getText().trim(); if (!certLen.equals("")) - nvps.add(Constants.PR_CERT_LEN, certLen); + nvps.put(Constants.PR_CERT_LEN, certLen); } private void addExtendedKey(NameValuePairs nvps) { if (mSSLClient.isSelected()) - nvps.add(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE); if (mSSLServer.isSelected()) - nvps.add(Constants.PR_SSL_SERVER_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_SERVER_BIT, Constants.TRUE); if (mSSLMail.isSelected()) - nvps.add(Constants.PR_SSL_MAIL_BIT, Constants.TRUE); + nvps.put(Constants.PR_SSL_MAIL_BIT, Constants.TRUE); if (mObjectSigning.isSelected()) - nvps.add(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE); + nvps.put(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE); if (mTimeStamping.isSelected()) - nvps.add(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE); + nvps.put(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE); if (mOCSPSigning.isSelected()) - nvps.add(Constants.PR_OCSP_SIGNING, Constants.TRUE); + nvps.put(Constants.PR_OCSP_SIGNING, Constants.TRUE); } public void callHelp() { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java index a4e30cd2c..88350fc32 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java @@ -84,9 +84,8 @@ class WCertTypePage extends WizardBasePanel implements IWizardPanel, NameValuePairs response = connection.search(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_SUBSYSTEM, nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String type = nvp.getValue(); + for (String name : response.keySet()) { + String type = response.get(name); if (type.equals(Constants.PR_RA_INSTANCE)) mRASigningCert = mResource.getString( @@ -226,8 +225,8 @@ class WCertTypePage extends WizardBasePanel implements IWizardPanel, response = connection.read(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_GET_NICKNAMES, wizardInfo.getCertType(), nvps); - NameValuePair nvp = response.getPair(Constants.PR_ALL_NICKNAMES); - wizardInfo.setNicknames(nvp.getValue()); + String value = response.get(Constants.PR_ALL_NICKNAMES); + wizardInfo.setNicknames(value); } catch (EAdminException e) { setErrorMessage(e.toString()); endProgressStatus(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java index 0ebfd7cb7..a7fe56352 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java @@ -20,7 +20,6 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; import java.awt.event.*; import java.util.*; -import java.io.*; import javax.swing.*; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; @@ -126,16 +125,16 @@ class WDisplayCertPage extends WizardBasePanel implements IWizardPanel { String cert = wizardInfo.getPKCS10(); if (cert == null) { - nvps.add(Constants.PR_CERT_FILEPATH, - wizardInfo.getCertFilePath()); + nvps.put(Constants.PR_CERT_FILEPATH, + wizardInfo.getCertFilePath()); } else { - nvps.add(Constants.PR_PKCS10, wizardInfo.getPKCS10()); + nvps.put(Constants.PR_PKCS10, wizardInfo.getPKCS10()); } - nvps.add(Constants.PR_NICKNAME, mCertNameField.getText().trim()); - nvps.add("pathname", pathname); - nvps.add(Constants.PR_SERVER_ROOT, serverInfo.getServerRoot()); - nvps.add(Constants.PR_SERVER_ID, serverInfo.getServerId()); + nvps.put(Constants.PR_NICKNAME, mCertNameField.getText().trim()); + nvps.put("pathname", pathname); + nvps.put(Constants.PR_SERVER_ROOT, serverInfo.getServerRoot()); + nvps.put(Constants.PR_SERVER_ID, serverInfo.getServerId()); try { connection.modify( diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java index 60154d2da..d13bca6e4 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java @@ -18,7 +18,6 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; -import java.io.*; import javax.swing.*; import javax.swing.border.*; import com.netscape.admin.certsrv.*; @@ -105,17 +104,15 @@ class WExecute1Page extends WizardBasePanel implements IWizardPanel { NameValuePairs nvps = wizardInfo.getNameValuePairs(); if (wizardInfo.getCertType().equals(Constants.PR_OTHER_CERT) && !wizardInfo.isNewKey()) { - nvps.add(Constants.PR_NICKNAME, wizardInfo.getNickname()); + nvps.put(Constants.PR_NICKNAME, wizardInfo.getNickname()); } try { NameValuePairs response = connection.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_REQUEST, wizardInfo.getCertType(), nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String key = nvp.getName(); - String value = nvp.getValue(); + for (String key : response.keySet()) { + String value = response.get(key); if (key.equals(Constants.PR_CSR)) { wizardInfo.addEntry(Constants.PR_CSR, value); } else if (key.equals(Constants.PR_CERT_REQUEST_DIR)) { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java index 109a82e69..a3ce14257 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java @@ -18,7 +18,6 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; -import java.io.*; import javax.swing.*; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; @@ -112,12 +111,12 @@ class WExecutePage extends WizardBasePanel implements IWizardPanel { if (wizardInfo.isNewKey()) { if (wizardInfo.getHashType() != null) - nvps.add(ConfigConstants.PR_HASH_TYPE, wizardInfo.getHashType()); + nvps.put(ConfigConstants.PR_HASH_TYPE, wizardInfo.getHashType()); if (wizardInfo.getSignedByType() != null) - nvps.add(ConfigConstants.PR_SIGNEDBY_TYPE, wizardInfo.getSignedByType()); + nvps.put(ConfigConstants.PR_SIGNEDBY_TYPE, wizardInfo.getSignedByType()); } - nvps.add("pathname", dir); + nvps.put("pathname", dir); try { connection.modify( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ISSUE_IMPORT_CERT, diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java index 81adab9f7..5b4d2d340 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java @@ -84,9 +84,8 @@ class WInstallOpPage extends WizardBasePanel implements IWizardPanel { try { NameValuePairs response = connection.search(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_SUBSYSTEM, nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String type = nvp.getValue(); + for (String name : response.keySet()) { + String type = response.get(name); if (type.equals(Constants.PR_RA_INSTANCE)) mRASigningCert = mResource.getString( diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java index b1d0d40d9..abcec63f3 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java @@ -67,15 +67,14 @@ class WIntroPage extends WizardBasePanel implements IWizardPanel { startProgressStatus(); AdminConnection connection = wizardInfo.getAdminConnection(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_TOKEN_LIST, ""); + nvps.put(Constants.PR_TOKEN_LIST, ""); try { NameValuePairs response = connection.read(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_TOKEN, Constants.RS_ID_CONFIG, nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String name = nvp.getName(); + for (String name : response.keySet()) { + String value = response.get(name); if (name.equals(Constants.PR_TOKEN_LIST)) - wizardInfo.addEntry(name, nvp.getValue()); + wizardInfo.addEntry(name, value); } } catch (EAdminException e) { //showErrorDialog(e.toString()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java index 84852fa4b..40d601c1d 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java @@ -20,10 +20,9 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; import java.awt.event.*; import java.util.*; -import java.io.*; import javax.swing.*; import javax.swing.border.*; -import javax.swing.event.*; + import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; @@ -235,38 +234,38 @@ class WKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener { if (mKeyCurveBox.isVisible()) { // ECC wizardInfo.addEntry(Constants.PR_KEY_CURVENAME, mKeyCurveText.getText().trim()); - nvps.add(Constants.PR_KEY_CURVENAME, mKeyCurveText.getText().trim()); + nvps.put(Constants.PR_KEY_CURVENAME, mKeyCurveText.getText().trim()); } else { wizardInfo.addEntry(Constants.PR_KEY_LENGTH, mKeyLengthText.getText().trim()); - nvps.add(Constants.PR_KEY_LENGTH, mKeyLengthText.getText().trim()); + nvps.put(Constants.PR_KEY_LENGTH, mKeyLengthText.getText().trim()); } } else { if (mKeyCurveBox.isVisible()) { // ECC wizardInfo.addEntry(Constants.PR_KEY_CURVENAME, val.trim()); - nvps.add(Constants.PR_KEY_CURVENAME, val.trim()); + nvps.put(Constants.PR_KEY_CURVENAME, val.trim()); } else { wizardInfo.addEntry(Constants.PR_KEY_LENGTH, val.trim()); - nvps.add(Constants.PR_KEY_LENGTH, val.trim()); + nvps.put(Constants.PR_KEY_LENGTH, val.trim()); } } if (mKeyTypeBox.isVisible()) { wizardInfo.addEntry(Constants.PR_KEY_TYPE, (String)mKeyTypeBox.getSelectedItem()); - nvps.add(Constants.PR_KEY_TYPE, (String)mKeyTypeBox.getSelectedItem()); + nvps.put(Constants.PR_KEY_TYPE, (String) mKeyTypeBox.getSelectedItem()); } else if (mDSAKeyTypeBox.isVisible()) { wizardInfo.addEntry(Constants.PR_KEY_TYPE, (String)mDSAKeyTypeBox.getSelectedItem()); - nvps.add(Constants.PR_KEY_TYPE, (String)mDSAKeyTypeBox.getSelectedItem()); + nvps.put(Constants.PR_KEY_TYPE, (String) mDSAKeyTypeBox.getSelectedItem()); } } startProgressStatus(); String certType = wizardInfo.getCertType(); - nvps.add(Constants.PR_SUBJECT_NAME, ""); - nvps.add(Constants.PR_CERTIFICATE_TYPE, certType); + nvps.put(Constants.PR_SUBJECT_NAME, ""); + nvps.put(Constants.PR_CERTIFICATE_TYPE, certType); try { // validate the key length or curvename @@ -283,7 +282,7 @@ class WKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener { if (mNicknameBox.isVisible()) { String nicknameStr = (String)mNicknameBox.getSelectedItem(); - nvps.add(Constants.PR_NICKNAME, nicknameStr); + nvps.put(Constants.PR_NICKNAME, nicknameStr); response = connection.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_SUBJECT_NAME, @@ -296,22 +295,21 @@ class WKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener { wizardInfo.getCertType(), nvps); } - NameValuePair nvp = response.getPair(Constants.PR_SUBJECT_NAME); - - wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, nvp.getValue()); + String value = response.get(Constants.PR_SUBJECT_NAME); + wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, value); } if (mNewKeyBtn.isSelected()) { String tokenName = (String)mTokenBox.getSelectedItem(); if (tokenName.equals("internal")) tokenName = Constants.PR_INTERNAL_TOKEN_NAME; - nvps.removeAllPairs(); - nvps.add(Constants.PR_TOKEN_NAME, tokenName); + nvps.clear(); + nvps.put(Constants.PR_TOKEN_NAME, tokenName); response = connection.process(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_TOKEN_STATUS, Constants.RS_ID_CONFIG, nvps); - NameValuePair result = response.getPair(Constants.PR_LOGGED_IN); - wizardInfo.addEntry(Constants.PR_LOGGED_IN, result.getValue()); + String value = response.get(Constants.PR_LOGGED_IN); + wizardInfo.addEntry(Constants.PR_LOGGED_IN, value); wizardInfo.addEntry(Constants.PR_TOKEN_NAME, tokenName); } } catch (EAdminException e) { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java index 8dda6e32d..50e14a50e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java @@ -19,7 +19,6 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; import java.awt.event.*; -import java.io.*; import javax.swing.*; import javax.swing.text.*; import com.netscape.admin.certsrv.*; @@ -102,11 +101,11 @@ class WPasteCertPage extends WizardBasePanel implements IWizardPanel { NameValuePairs nvps = new NameValuePairs(); if (mFileBtn.isSelected()) { - nvps.add(Constants.PR_CERT_FILEPATH, mCertFilePath); + nvps.put(Constants.PR_CERT_FILEPATH, mCertFilePath); wizardInfo.setCertFilePath(mCertFilePath); wizardInfo.setPKCS10(""); } else if (mBase64Btn.isSelected()) { - nvps.add(Constants.PR_PKCS10, mCertContent); + nvps.put(Constants.PR_PKCS10, mCertContent); wizardInfo.setPKCS10(mCertContent); wizardInfo.setCertFilePath(""); } @@ -116,10 +115,8 @@ class WPasteCertPage extends WizardBasePanel implements IWizardPanel { DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERTINFO, wizardInfo.getInstallCertType(), nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String name = nvp.getName(); - String str = nvp.getValue(); + for (String name : response.keySet()) { + String str = response.get(name); wizardInfo.addEntry(name, str); } /* diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java index dd92d20b3..53a623d0a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java @@ -18,15 +18,12 @@ package com.netscape.admin.certsrv.keycert; import java.awt.*; -import java.util.*; import javax.swing.*; -import javax.swing.text.*; + import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.wizard.*; import com.netscape.certsrv.common.*; -import com.netscape.admin.certsrv.task.*; -import com.netscape.management.client.console.*; /** * This panel asks for the user to logon to the keycert token . @@ -99,8 +96,8 @@ class WTokenLogonPage extends WizardBasePanel implements IWizardPanel { try { NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_TOKEN_NAME, tokenname); - nvps.add(Constants.PR_TOKEN_PASSWD, pwd); + nvps.put(Constants.PR_TOKEN_NAME, tokenname); + nvps.put(Constants.PR_TOKEN_PASSWD, pwd); connection.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_TOKEN_LOGON, Constants.RS_ID_CONFIG, nvps); } catch (EAdminException e) { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java index 01b53e88c..be844576c 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java @@ -76,10 +76,8 @@ class WWarningExecute1Page extends WizardBasePanel implements IWizardPanel { NameValuePairs response = connection.process( DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_REQUEST, wizardInfo.getCertType(), nvps); - for (int i=0; i<response.size(); i++) { - NameValuePair nvp = response.elementAt(i); - String key = nvp.getName(); - String value = nvp.getValue(); + for (String key : response.keySet()) { + String value = response.get(key); if (key.equals(Constants.PR_CSR)) { wizardInfo.addEntry(Constants.PR_CSR, value); break; diff --git a/pki/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java index 5e66a6357..3a5c43705 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java @@ -19,14 +19,10 @@ package com.netscape.admin.certsrv.managecert; import com.netscape.admin.certsrv.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.border.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; -import com.netscape.management.client.util.*; -import javax.swing.table.*; + import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; @@ -120,7 +116,7 @@ public class CertificateInfoDialog extends JDialog NameValuePairs nvps = new NameValuePairs(); String value = mCertName+";"+mCertDate; - nvps.add("certName0", value); + nvps.put("certName0", value); try { mConn.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_TRUST, diff --git a/pki/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java index 20fad62ac..4fd902584 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java @@ -22,9 +22,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.table.*; import javax.swing.*; -import javax.swing.border.*; + import com.netscape.admin.certsrv.*; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; @@ -85,16 +84,15 @@ public class ManageCertDialog extends JDialog implements ActionListener, String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - vals[i++] = entry; + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } CMSAdminUtil.bubbleSort(vals); for (i=0; i<vals.length; i++) { String entry = vals[i]; - String value = response.getValue(entry); + String value = response.get(entry); addRows(entry, value); } mTable.getSelectionModel().clearSelection(); @@ -278,9 +276,8 @@ public class ManageCertDialog extends JDialog implements ActionListener, Constants.RS_ID_CONFIG, nvps); if (nvps.size() <= 0) return; - NameValuePair nvp = results.elementAt(0); - String name = nvp.getName(); - String print = nvp.getValue(); + String name = results.keySet().iterator().next(); // first element + String print = results.get(name); CertificateInfoDialog dialog = new CertificateInfoDialog(mParent); dialog.showDialog(name, print, getTrustLbl(), getDate(),mConn); refresh(); @@ -339,7 +336,7 @@ public class ManageCertDialog extends JDialog implements ActionListener, for (int i=0; i<rows.length; i++) { String value = (String)mDataModel.getValueAt(rows[i], 0); String date = (String)mDataModel.getValueAt(rows[i], 1); - nvps.add(name+i, value+";"+date); + nvps.put(name + i, value + ";" + date); } return nvps; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java index f87b03d8c..c01407193 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java @@ -19,12 +19,10 @@ package com.netscape.admin.certsrv.notification; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.config.*; import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -137,10 +135,10 @@ public class RequestCompletePanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE,""); - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, ""); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, ""); - nvps.add(Constants.PR_NOTIFICATION_SENDER, ""); + nvps.put(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, ""); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, ""); + nvps.put(Constants.PR_NOTIFICATION_SENDER, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -157,20 +155,16 @@ public class RequestCompletePanel extends CMSBaseTab implements ItemListener { } protected void populate(NameValuePairs nvps) { - String clientCert = ""; - - String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) { - mEmailFormText.setText(nvp.getValue()); + mEmailFormText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) { - mEmailSubjectText.setText(nvp.getValue()); + mEmailSubjectText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) { - mSenderEmailText.setText(nvp.getValue()); + mSenderEmailText.setText(value); } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); @@ -249,14 +243,14 @@ public class RequestCompletePanel extends CMSBaseTab implements ItemListener { NameValuePairs nvps = new NameValuePairs(); if (mEnable.isSelected()) - nvps.add(Constants.PR_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_ENABLE, Constants.FALSE); if (mEnable.isSelected()){ - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); - nvps.add(Constants.PR_NOTIFICATION_SENDER, senderEmail); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); + nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail); } mModel.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java index 1f48ef90d..aa37ed149 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java @@ -19,12 +19,10 @@ package com.netscape.admin.certsrv.notification; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.config.*; import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -146,11 +144,11 @@ public class RequestInQPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE,""); - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, ""); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, ""); - nvps.add(Constants.PR_NOTIFICATION_SENDER, ""); - nvps.add(Constants.PR_NOTIFICATION_RECEIVER, ""); + nvps.put(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, ""); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, ""); + nvps.put(Constants.PR_NOTIFICATION_SENDER, ""); + nvps.put(Constants.PR_NOTIFICATION_RECEIVER, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -167,22 +165,18 @@ public class RequestInQPanel extends CMSBaseTab implements ItemListener { } protected void populate(NameValuePairs nvps) { - String clientCert = ""; - - String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) { - mEmailFormText.setText(nvp.getValue()); + mEmailFormText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) { - mEmailSubjectText.setText(nvp.getValue()); + mEmailSubjectText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) { - mSenderEmailText.setText(nvp.getValue()); + mSenderEmailText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_RECEIVER)) { - mReceiverEmailText.setText(nvp.getValue()); + mReceiverEmailText.setText(value); } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); @@ -270,15 +264,15 @@ public class RequestInQPanel extends CMSBaseTab implements ItemListener { NameValuePairs nvps = new NameValuePairs(); if (mEnable.isSelected()) - nvps.add(Constants.PR_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_ENABLE, Constants.FALSE); if (mEnable.isSelected()){ - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); - nvps.add(Constants.PR_NOTIFICATION_SENDER, senderEmail); - nvps.add(Constants.PR_NOTIFICATION_RECEIVER, receiverEmail); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); + nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail); + nvps.put(Constants.PR_NOTIFICATION_RECEIVER, receiverEmail); } mModel.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java index ec45287aa..60b0e2949 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java @@ -19,12 +19,10 @@ package com.netscape.admin.certsrv.notification; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; -import com.netscape.management.client.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.config.*; import javax.swing.*; import java.awt.*; -import java.util.*; import java.awt.event.*; /** @@ -137,10 +135,10 @@ public class RequestRevokedPanel extends CMSBaseTab implements ItemListener { public void refresh() { mModel.progressStart(); NameValuePairs nvps = new NameValuePairs(); - nvps.add(Constants.PR_ENABLE,""); - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, ""); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, ""); - nvps.add(Constants.PR_NOTIFICATION_SENDER, ""); + nvps.put(Constants.PR_ENABLE, ""); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, ""); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, ""); + nvps.put(Constants.PR_NOTIFICATION_SENDER, ""); try { NameValuePairs val = mAdmin.read(mServletName, @@ -160,17 +158,16 @@ public class RequestRevokedPanel extends CMSBaseTab implements ItemListener { String clientCert = ""; String version = ""; - for (int i=0; i<nvps.size(); i++) { - NameValuePair nvp = nvps.elementAt(i); - String name = nvp.getName(); + for (String name : nvps.keySet()) { + String value = nvps.get(name); if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) { - mEmailFormText.setText(nvp.getValue()); + mEmailFormText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) { - mEmailSubjectText.setText(nvp.getValue()); + mEmailSubjectText.setText(value); } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) { - mSenderEmailText.setText(nvp.getValue()); + mSenderEmailText.setText(value); } else if (name.equals(Constants.PR_ENABLE)) { - if (nvp.getValue().equals(Constants.TRUE)) + if (value.equals(Constants.TRUE)) mEnable.setSelected(true); else mEnable.setSelected(false); @@ -249,14 +246,14 @@ public class RequestRevokedPanel extends CMSBaseTab implements ItemListener { NameValuePairs nvps = new NameValuePairs(); if (mEnable.isSelected()) - nvps.add(Constants.PR_ENABLE,Constants.TRUE); + nvps.put(Constants.PR_ENABLE, Constants.TRUE); else - nvps.add(Constants.PR_ENABLE,Constants.FALSE); + nvps.put(Constants.PR_ENABLE, Constants.FALSE); if (mEnable.isSelected()){ - nvps.add(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); - nvps.add(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); - nvps.add(Constants.PR_NOTIFICATION_SENDER, senderEmail); + nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm); + nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject); + nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail); } mModel.progressStart(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java index 36308e21f..dc6a8da27 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java @@ -18,12 +18,11 @@ package com.netscape.admin.certsrv.status; -import java.util.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; -import javax.swing.event.*; + import java.awt.event.*; /** @@ -76,18 +75,18 @@ public class LogInstancePanel extends CMSLogPanel { //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_LOG_INSTANCE, mInstanceName); - config.add(Constants.PR_LOG_ENTRY,mNoRecord.getText().trim()); - config.add(Constants.PR_LOG_SOURCE,Integer.toString(mSource.getSelectedIndex())); - config.add(Constants.PR_LOG_LEVEL,Integer.toString(mLevel.getSelectedIndex())); + config.put(Constants.PR_LOG_INSTANCE, mInstanceName); + config.put(Constants.PR_LOG_ENTRY, mNoRecord.getText().trim()); + config.put(Constants.PR_LOG_SOURCE, Integer.toString(mSource.getSelectedIndex())); + config.put(Constants.PR_LOG_LEVEL, Integer.toString(mLevel.getSelectedIndex())); if ((mFile.getSelectedIndex()< 0) || (mFile.getSelectedIndex()< 0)) { - config.add(Constants.PR_LOG_NAME,Constants.PR_CURRENT_LOG); + config.put(Constants.PR_LOG_NAME, Constants.PR_CURRENT_LOG); mSelectedFile = mResource.getString("LOGCONTENT_COMBOBOX_FILE_DEFAULT"); } else { String filename = (String) mFile.getSelectedItem(); if (filename.equalsIgnoreCase(Constants.PR_CURRENT_LOG)) filename = Constants.PR_CURRENT_LOG; - config.add(Constants.PR_LOG_NAME, filename); + config.put(Constants.PR_LOG_NAME, filename); mSelectedFile = (String) mFile.getSelectedItem(); } NameValuePairs response; @@ -107,8 +106,7 @@ public class LogInstancePanel extends CMSLogPanel { Debug.println(response.toString()); //update the table - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = (String)e.nextElement(); + for (String entry : response.keySet()) { mDataModel.processData(entry); } @@ -130,7 +128,7 @@ public class LogInstancePanel extends CMSLogPanel { mModel.progressStart(); //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_LOG_INSTANCE, mInstanceName); + config.put(Constants.PR_LOG_INSTANCE, mInstanceName); try { response = connection.search(DestDef.DEST_LOG_ADMIN, ScopeDef.SC_LOG_ARCH, @@ -143,8 +141,7 @@ public class LogInstancePanel extends CMSLogPanel { } //update the combo - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = (String)e.nextElement(); + for (String entry : response.keySet()) { mFile.addItem(entry); } mModel.progressStop(); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java index 237224415..431d0d61f 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java @@ -18,11 +18,10 @@ package com.netscape.admin.certsrv.status; import java.awt.*; -import java.util.*; import javax.swing.*; import javax.swing.border.*; import com.netscape.admin.certsrv.*; -import javax.swing.event.*; + import java.awt.event.*; import com.netscape.management.client.*; import com.netscape.management.client.util.*; @@ -215,8 +214,8 @@ public class StatusPanel extends CMSBasePanel public void refresh() { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_STAT_STARTUP,""); - params.add(Constants.PR_STAT_TIME,""); + params.put(Constants.PR_STAT_STARTUP, ""); + params.put(Constants.PR_STAT_TIME, ""); NameValuePairs response; mModel.progressStart(); @@ -237,11 +236,11 @@ public class StatusPanel extends CMSBasePanel Debug.println("StatusPanel: refresh() "+ response.toString()); //populate data - mServerName.setText(response.getValue(Constants.PR_STAT_INSTANCEID)); - mServerVersion.setText(response.getValue(Constants.PR_STAT_VERSION)); - mInstallDate.setText(response.getValue(Constants.PR_STAT_INSTALLDATE)); - mServerStart.setText(response.getValue(Constants.PR_STAT_STARTUP)); - mServerTime.setText(response.getValue(Constants.PR_STAT_TIME)); + mServerName.setText(response.get(Constants.PR_STAT_INSTANCEID)); + mServerVersion.setText(response.get(Constants.PR_STAT_VERSION)); + mInstallDate.setText(response.get(Constants.PR_STAT_INSTALLDATE)); + mServerStart.setText(response.get(Constants.PR_STAT_STARTUP)); + mServerTime.setText(response.get(Constants.PR_STAT_TIME)); } } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java index d2a412d18..6656b3abb 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java @@ -18,16 +18,13 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.config.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; import javax.swing.text.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -90,12 +87,12 @@ public class AuthBaseDialog extends JDialog mDataModel.removeAllRows(); mData = data; - mImplName.setText(data.getValue(Constants.PR_AUTH_IMPL_NAME)); + mImplName.setText(data.get(Constants.PR_AUTH_IMPL_NAME)); - for (Enumeration e = data.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); + for (String entry : data.keySet()) { + entry = entry.trim(); if (!entry.equals(Constants.PR_AUTH_IMPL_NAME)) { - String value = data.getValue(entry); + String value = data.get(entry); Vector v = new Vector(); v.addElement(entry); v.addElement(value); @@ -134,10 +131,10 @@ public class AuthBaseDialog extends JDialog protected NameValuePairs getData() { NameValuePairs response = new NameValuePairs(); - response.add(Constants.PR_AUTH_IMPL_NAME,mImplName.getText()); + response.put(Constants.PR_AUTH_IMPL_NAME, mImplName.getText()); for (int i=0; i< mDataModel.getRowCount(); i++) { - response.add((String)mDataModel.getValueAt(i,0), - (String)mDataModel.getValueAt(i,1)); + response.put((String) mDataModel.getValueAt(i, 0), + (String) mDataModel.getValueAt(i, 1)); } return response; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java index ca034e61c..98214871e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java @@ -21,7 +21,6 @@ import java.util.*; import javax.swing.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; /** * Auth Plugin Implementation Data model - represents the implementation @@ -59,13 +58,13 @@ public class AuthImplDataModel extends CMSContentTableModel public void processData(Object data) { Vector v = new Vector(); NameValuePairs obj = (NameValuePairs) data; - JLabel label = new JLabel(obj.getValue(IMPL_NAME), + JLabel label = new JLabel(obj.get(IMPL_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_AUTH_PLUGIN), JLabel.LEFT); - if(!obj.getValue(IMPL_DESC).trim().equals("")) - label.setToolTipText(obj.getValue(IMPL_DESC)); + if(!obj.get(IMPL_DESC).trim().equals("")) + label.setToolTipText(obj.get(IMPL_DESC)); v.addElement(label); - v.addElement(obj.getValue(IMPL_CLASS)); + v.addElement(obj.get(IMPL_CLASS)); //v.addElement(obj.getValue(IMPL_DESC)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java index 52ec30824..0cc964c60 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java @@ -19,13 +19,12 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; -import com.netscape.admin.certsrv.config.*; + import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -232,7 +231,7 @@ public class AuthImplTab extends CMSBaseUGTab { if (index >= 0) { NameValuePairs nvp = (NameValuePairs)mDataModel.getObjectValueAt(index); - String type = nvp.getValue(IMPL_TYPE); + String type = nvp.get(IMPL_TYPE); if (type.equals(Constants.VIEW) || type.equals(Constants.VIEW)) mDelete.setEnabled(false); } @@ -264,9 +263,9 @@ public class AuthImplTab extends CMSBaseUGTab { int i=0; String[] vals = new String[response.size()]; Hashtable data = new Hashtable(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - String value = response.getValue(entry); + for (String entry : response.keySet()) { + entry = entry.trim(); + String value = response.get(entry); Debug.println("AuthImplTab.java update(): "+ "entry="+entry+ "value="+value @@ -274,34 +273,34 @@ public class AuthImplTab extends CMSBaseUGTab { int x = value.indexOf(","); int y = value.indexOf(TOKEN); NameValuePairs obj = new NameValuePairs(); - obj.add(IMPL_NAME,entry); + obj.put(IMPL_NAME, entry); Debug.println("x="+x); if(x != -1) { Debug.println("0 obj.add(IMPL_CLASS,"+value.substring(0,x)); - obj.add(IMPL_CLASS, value.substring(0,x)); + obj.put(IMPL_CLASS, value.substring(0, x)); if (y == -1) { Debug.println("1 obj.add(IMPL_DESC,"+value.substring(0,x)); - obj.add(IMPL_DESC, value.substring(x+1)); + obj.put(IMPL_DESC, value.substring(x + 1)); } else { Debug.println("1 obj.add(IMPL_DESC,"+value.substring(x+1,y)); - obj.add(IMPL_DESC, value.substring(x+1, y)); + obj.put(IMPL_DESC, value.substring(x + 1, y)); } } else { Debug.println(" 2 obj.add(IMPL_CLASS,"+value.substring(0,y)); - obj.add(IMPL_CLASS, value.substring(0,y)); + obj.put(IMPL_CLASS, value.substring(0, y)); Debug.println(" 2 obj.add(IMPL_DESC,\"\""); - obj.add(IMPL_DESC,""); + obj.put(IMPL_DESC, ""); } String type = ""; Debug.println("y="+y); if (y == -1) { type = Constants.EDIT; - obj.add(IMPL_TYPE, Constants.EDIT); + obj.put(IMPL_TYPE, Constants.EDIT); } else { type = value.substring(y+1); - obj.add(IMPL_TYPE, type); + obj.put(IMPL_TYPE, type); } if (type.equals(Constants.EDIT)) { data.put(entry,obj); @@ -339,7 +338,7 @@ public class AuthImplTab extends CMSBaseUGTab { try { mConnection.delete(mDestination, ScopeDef.SC_AUTH_IMPLS, - obj.getValue(IMPL_NAME)); + obj.get(IMPL_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java index a4db6dd0a..929f99aef 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java @@ -21,12 +21,7 @@ import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.config.*; import javax.swing.*; -import javax.swing.event.*; -import java.awt.event.*; -import java.awt.*; -import java.util.*; -import com.netscape.management.client.*; -import com.netscape.management.client.util.*; + import com.netscape.certsrv.common.*; /** @@ -117,7 +112,7 @@ public class AuthInstanceTab extends CMSPluginInstanceTab { try { mConnection.delete(DestDef.DEST_AUTH_ADMIN, ScopeDef.SC_AUTH_MGR_INSTANCE, - data.getValue(RULE_NAME)); + data.get(RULE_NAME)); } catch (EAdminException e) { //display error dialog showErrorDialog(e.getMessage()); @@ -139,7 +134,7 @@ public class AuthInstanceTab extends CMSPluginInstanceTab { NameValuePairs response; response = mConnection.read(DestDef.DEST_AUTH_ADMIN, ScopeDef.SC_AUTH_MGR_INSTANCE, - data.getValue(RULE_NAME), + data.get(RULE_NAME), new NameValuePairs()); return response; } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java index 41fabfcc4..35e08d0eb 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java @@ -21,7 +21,6 @@ import java.util.*; import javax.swing.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.admin.certsrv.config.*; import com.netscape.management.client.util.Debug; @@ -54,10 +53,10 @@ public class AuthRuleDataModel extends CMSRuleDataModel NameValuePairs obj = (NameValuePairs) data; //XXX NEED TO ADD STUFF - v.addElement(new JLabel(obj.getValue(RULE_NAME), + v.addElement(new JLabel(obj.get(RULE_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_AUTH), JLabel.LEFT)); - v.addElement(obj.getValue(RULE_IMPL)); + v.addElement(obj.get(RULE_IMPL)); addRow(v, data); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java index b6eda1308..de6a588f6 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java @@ -18,7 +18,6 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; import com.netscape.management.client.util.*; import java.util.*; @@ -60,7 +59,7 @@ public class CertDataModel extends CMSContentTableModel NameValuePairs obj = (NameValuePairs) data; //XXX NEED TO CHANGE if we are going to have multi-column table - v.addElement(new JLabel(obj.getValue(CERT_NAME), + v.addElement(new JLabel(obj.get(CERT_NAME), CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL), JLabel.LEFT)); addRow(v, data); @@ -77,7 +76,7 @@ public class CertDataModel extends CMSContentTableModel public String getDataBlob(int row) { try { NameValuePairs obj = (NameValuePairs)getObjectValueAt(row); - return obj.getValue(CERT_DATA); + return obj.get(CERT_DATA); } catch (Exception e) { Debug.println("CertDataModel: getDataBlob()- "+e.toString()); return ""; diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java index c6a1a878c..82083649e 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -298,8 +297,8 @@ public class CertManagementDialog extends JDialog String[] vals = new String[response.size()]; int i=0; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - vals[i++] = ((String)e.nextElement()).trim(); + for (String entry : response.keySet()) { + vals[i++] = entry.trim(); } CMSAdminUtil.bubbleSort(vals); @@ -309,7 +308,7 @@ public class CertManagementDialog extends JDialog mDataModel.addElement(new JLabel(str, CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL), JLabel.LEFT)); - mPPData.addElement(response.getValue(vals[y])); + mPPData.addElement(response.get(vals[y])); } return true; @@ -386,7 +385,7 @@ public class CertManagementDialog extends JDialog private void addCert(String B64E) { //send comment to server for the removal of user NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_USER_CERT, cleanupCertData(B64E)); + config.put(Constants.PR_USER_CERT, cleanupCertData(B64E)); try { mConnection.add(DestDef.DEST_USER_ADMIN, ScopeDef.SC_USER_CERTS, @@ -423,7 +422,7 @@ public class CertManagementDialog extends JDialog String dn = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText(); dn = toServerFormat(dn); NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_USER_CERT,dn); + config.put(Constants.PR_USER_CERT, dn); //send comment to server for the removal of user try { diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java index f25267be5..e9693b15d 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java @@ -24,8 +24,7 @@ import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import javax.swing.table.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -203,8 +202,8 @@ public class GroupEditor extends JDialog response = mConnection.search(DestDef.DEST_USER_ADMIN, ScopeDef.SC_USERS, new NameValuePairs()); boolean hasNewUser = false; - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); + for (String entry : response.keySet()) { + entry = entry.trim(); if (currentUser.indexOf(entry)== -1) hasNewUser = true; } @@ -483,9 +482,9 @@ public class GroupEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_GROUP_DESC, ""); - config.add(Constants.PR_GROUP_USER, ""); - config.add(Constants.PR_GROUP_GROUP, ""); + config.put(Constants.PR_GROUP_DESC, ""); + config.put(Constants.PR_GROUP_USER, ""); + config.put(Constants.PR_GROUP_GROUP, ""); NameValuePairs response; response = mConnection.read(DestDef.DEST_GROUP_ADMIN, @@ -496,12 +495,12 @@ public class GroupEditor extends JDialog Debug.println("Received Memebership: "+response.toString()); //setup the ui mGroupNameField.setText(mGroupName); - mGroupDescField.setText(response.getValue(Constants.PR_GROUP_DESC)); + mGroupDescField.setText(response.get(Constants.PR_GROUP_DESC)); //setup the member table //parse user entry - String user = response.getValue(Constants.PR_GROUP_USER).trim(); + String user = response.get(Constants.PR_GROUP_USER).trim(); StringTokenizer tokenizer = new StringTokenizer(user, ","); while (tokenizer.hasMoreTokens()) { String user_str = tokenizer.nextToken().trim(); @@ -515,7 +514,7 @@ public class GroupEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_GROUP_DESC, mGroupName); + config.put(Constants.PR_GROUP_DESC, mGroupName); createUGString(config); //send request @@ -530,7 +529,7 @@ public class GroupEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_GROUP_DESC, mGroupDescField.getText()); + config.put(Constants.PR_GROUP_DESC, mGroupDescField.getText()); createUGString(config); //send request @@ -567,7 +566,7 @@ public class GroupEditor extends JDialog } //set parameters - config.add(Constants.PR_GROUP_USER, userBuf.toString()); + config.put(Constants.PR_GROUP_USER, userBuf.toString()); } //refresh the table content diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java index 706ed2ccd..d5931a6f8 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java @@ -260,8 +260,8 @@ public class GroupListDialog extends JDialog } //parse the data - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); + for (String entry : response.keySet()) { + entry = entry.trim(); //check if not already in current list if (mCurrentGroups.indexOf(entry)== -1) mDataModel.processData(entry); diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java index eca04bddc..e80cc7047 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -323,9 +322,8 @@ public class GroupTab extends CMSBaseUGTab { //parse the data Vector store = new Vector(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String entry = ((String)e.nextElement()).trim(); - store.addElement(entry); + for (String entry : response.keySet()) { + store.addElement(entry.trim()); } String[] vals = new String[store.size()]; @@ -334,7 +332,7 @@ public class GroupTab extends CMSBaseUGTab { CMSAdminUtil.bubbleSort(vals); for (int y=0; y< vals.length ; y++) { - String value = response.getValue(vals[y]); + String value = response.get(vals[y]); mDataModel.processData(vals[y],value); } diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java index 6ebb84cb6..6b1fbfeec 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java @@ -21,7 +21,6 @@ import java.util.*; import javax.swing.*; import com.netscape.certsrv.common.*; import com.netscape.admin.certsrv.*; -import com.netscape.admin.certsrv.connection.*; import com.netscape.management.client.util.*; /** @@ -66,13 +65,13 @@ public class MemberDataModel extends CMSContentTableModel NameValuePairs rec = (NameValuePairs)data; Icon icon; - icon = (rec.getValue(MEMBER_TYPE).equals(MEMBER_GROUP))? + icon = (rec.get(MEMBER_TYPE).equals(MEMBER_GROUP))? CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USERGROUP): CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER); - String entry = rec.getValue(MEMBER_NAME); + String entry = rec.get(MEMBER_NAME); String name = entry; - if(rec.getValue(MEMBER_TYPE).equals(MEMBER_GROUP)) { + if(rec.get(MEMBER_TYPE).equals(MEMBER_GROUP)) { if (entry.startsWith(PrefixDef.PX_SYS)) name = entry.substring(PrefixDef.PX_SYS.length()); else @@ -101,10 +100,10 @@ public class MemberDataModel extends CMSContentTableModel { Debug.println("MemberDataModel: removeRow() - start"); NameValuePairs data = (NameValuePairs)getObjectValueAt(index); - if (data.getValue(MEMBER_TYPE).equals(MEMBER_GROUP)) - mGroups.removeElement(data.getValue(MEMBER_NAME)); + if (data.get(MEMBER_TYPE).equals(MEMBER_GROUP)) + mGroups.removeElement(data.get(MEMBER_NAME)); else - mUsers.removeElement(data.getValue(MEMBER_NAME)); + mUsers.removeElement(data.get(MEMBER_NAME)); super.removeRow(index); Debug.println("MemberDataModel: removeRow() - end"); } @@ -118,10 +117,10 @@ public class MemberDataModel extends CMSContentTableModel super.addRow(values); mObjectContainer.addElement(obj); NameValuePairs rec = (NameValuePairs)obj; - if (rec.getValue(MEMBER_TYPE).equals(MEMBER_GROUP)) - mGroups.addElement(rec.getValue(MEMBER_NAME)); + if (rec.get(MEMBER_TYPE).equals(MEMBER_GROUP)) + mGroups.addElement(rec.get(MEMBER_NAME)); else - mUsers.addElement(rec.getValue(MEMBER_NAME)); + mUsers.addElement(rec.get(MEMBER_NAME)); } /** diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java index 561b8bb19..75908fe6a 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java @@ -24,9 +24,8 @@ import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; -import javax.swing.table.*; import com.netscape.certsrv.common.*; /** @@ -520,11 +519,11 @@ public class UserEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_USER_FULLNAME, ""); - config.add(Constants.PR_USER_EMAIL, ""); - config.add(Constants.PR_USER_PHONE, ""); - config.add(Constants.PR_USER_STATE, ""); - config.add(Constants.PR_USER_GROUP, ""); + config.put(Constants.PR_USER_FULLNAME, ""); + config.put(Constants.PR_USER_EMAIL, ""); + config.put(Constants.PR_USER_PHONE, ""); + config.put(Constants.PR_USER_STATE, ""); + config.put(Constants.PR_USER_GROUP, ""); NameValuePairs response; response = mConnection.read(DestDef.DEST_USER_ADMIN, @@ -534,13 +533,13 @@ public class UserEditor extends JDialog //setup the ui mUserNameField.setText(mUserName); - mFullNameField.setText(response.getValue(Constants.PR_USER_FULLNAME)); - mEMailField.setText(response.getValue(Constants.PR_USER_EMAIL)); - mPhoneField.setText(response.getValue(Constants.PR_USER_PHONE)); - mStateField.setText(response.getValue(Constants.PR_USER_STATE)); + mFullNameField.setText(response.get(Constants.PR_USER_FULLNAME)); + mEMailField.setText(response.get(Constants.PR_USER_EMAIL)); + mPhoneField.setText(response.get(Constants.PR_USER_PHONE)); + mStateField.setText(response.get(Constants.PR_USER_STATE)); //parse group entry - String userStr = response.getValue(Constants.PR_USER_GROUP); + String userStr = response.get(Constants.PR_USER_GROUP); if ( (userStr != null) && (!userStr.trim().equals("")) ) { StringTokenizer tokenizer = new StringTokenizer(userStr, ","); while (tokenizer.hasMoreTokens()) { @@ -556,8 +555,7 @@ public class UserEditor extends JDialog ScopeDef.SC_GROUPS, new NameValuePairs()); if (mGroupBox.getItemCount() > 0) mGroupBox.removeAllItems(); - for (Enumeration e = response.getNames(); e.hasMoreElements() ;) { - String groupname = (String)e.nextElement(); + for (String groupname : response.keySet()) { mGroupBox.addItem(groupname.trim()); } @@ -568,13 +566,13 @@ public class UserEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim()); - config.add(Constants.PR_USER_PASSWORD,mPasswordField.getText().trim()); - config.add(Constants.PR_USER_EMAIL,mEMailField.getText().trim()); - config.add(Constants.PR_USER_PHONE,mPhoneField.getText().trim()); - config.add(Constants.PR_USER_STATE,mStateField.getText().trim()); - config.add(Constants.PR_USER_GROUP,(String)mGroupBox.getSelectedItem()); - config.add(Constants.PR_USER_TYPE, ""); + config.put(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim()); + config.put(Constants.PR_USER_PASSWORD, mPasswordField.getText().trim()); + config.put(Constants.PR_USER_EMAIL, mEMailField.getText().trim()); + config.put(Constants.PR_USER_PHONE, mPhoneField.getText().trim()); + config.put(Constants.PR_USER_STATE, mStateField.getText().trim()); + config.put(Constants.PR_USER_GROUP, (String) mGroupBox.getSelectedItem()); + config.put(Constants.PR_USER_TYPE, ""); //config.add(Constants.PR_USER_CERT,""); //createCertEntry(config); @@ -590,12 +588,12 @@ public class UserEditor extends JDialog //construct NVP NameValuePairs config = new NameValuePairs(); - config.add(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim()); - config.add(Constants.PR_USER_PASSWORD,mPasswordField.getText().trim()); - config.add(Constants.PR_USER_EMAIL,mEMailField.getText().trim()); - config.add(Constants.PR_USER_PHONE,mPhoneField.getText().trim()); - config.add(Constants.PR_USER_STATE,mStateField.getText().trim()); - config.add(Constants.PR_USER_TYPE, ""); + config.put(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim()); + config.put(Constants.PR_USER_PASSWORD, mPasswordField.getText().trim()); + config.put(Constants.PR_USER_EMAIL, mEMailField.getText().trim()); + config.put(Constants.PR_USER_PHONE, mPhoneField.getText().trim()); + config.put(Constants.PR_USER_STATE, mStateField.getText().trim()); + config.put(Constants.PR_USER_TYPE, ""); //createCertEntry(config); //send request diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java index b54ac7d8d..6f0c6215b 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java @@ -20,13 +20,11 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; -import javax.swing.table.*; import com.netscape.certsrv.common.*; /** @@ -317,7 +315,7 @@ public class UserListDialog extends JDialog store.copyInto(vals); */ - String responseValue = response.getValue("userInfo"); + String responseValue = response.get("userInfo"); StringTokenizer tokenizer = new StringTokenizer(responseValue, ";"); StringTokenizer subTokenizer = null; diff --git a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java index ccf7ac5ae..78b7e5252 100644 --- a/pki/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java +++ b/pki/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java @@ -20,11 +20,10 @@ package com.netscape.admin.certsrv.ug; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import javax.swing.*; -import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; -import com.netscape.management.client.*; + import com.netscape.management.client.util.*; import com.netscape.certsrv.common.*; @@ -289,7 +288,7 @@ public class UserTab extends CMSBaseUGTab { Debug.println(response.toString()); - String responseValue = response.getValue("userInfo"); + String responseValue = response.get("userInfo"); StringTokenizer tokenizer = new StringTokenizer(responseValue, ";"); StringTokenizer subTokenizer = null; diff --git a/pki/base/console/src/com/netscape/certsrv/common/NameValuePair.java b/pki/base/console/src/com/netscape/certsrv/common/NameValuePair.java deleted file mode 100644 index b2ad3ac29..000000000 --- a/pki/base/console/src/com/netscape/certsrv/common/NameValuePair.java +++ /dev/null @@ -1,56 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.certsrv.common; - - -import java.io.*; -import java.util.*; -import java.net.*; -import java.util.*; -import java.text.*; -import java.math.*; - - -/** - * A class represents a name value pair. - * - * @author thomask - * @version $Revision$, $Date$ - */ -public class NameValuePair { - - private String mName = null; - private String mValue = null; - - public NameValuePair(String name, String value) { - mName = name; - mValue = value; - } - - public String getName() { - return mName; - } - - public String getValue() { - return mValue; - } - - public void setValue(String value) { - mValue = value; - } -} diff --git a/pki/base/console/src/com/netscape/certsrv/common/NameValuePairs.java b/pki/base/console/src/com/netscape/certsrv/common/NameValuePairs.java index 2dd913ea7..5e7d79cde 100644 --- a/pki/base/console/src/com/netscape/certsrv/common/NameValuePairs.java +++ b/pki/base/console/src/com/netscape/certsrv/common/NameValuePairs.java @@ -17,112 +17,24 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.common; - -import java.io.*; -import java.util.*; -import java.net.*; -import java.util.*; -import java.text.*; -import java.math.*; - +import java.util.LinkedHashMap; +import java.util.StringTokenizer; /** - * A class represents an ordered list of name + * A class represents an ordered list of name * value pairs. * - * @author thomask * @version $Revision$, $Date$ */ -public class NameValuePairs { - - private Vector mPairs = new Vector(); - - // an index to speed up searching - // The key is the name. The element is the NameValuePair. - private Hashtable index = new Hashtable(); +public class NameValuePairs extends LinkedHashMap<String, String> { /** * Constructs name value pairs. - */ - public NameValuePairs() { - } - - /** - * Adds a name value pair into this set. - * if the name already exist, the value will - * be replaced. - */ - public void add(String name, String value) { - NameValuePair pair = getPair(name); - - if (pair == null) { - pair = new NameValuePair(name, value); - mPairs.addElement(pair); - index.put(name, pair); - } else { - pair.setValue(value); - } - } - - /** - * Retrieves name value pair from this set. - */ - public NameValuePair getPair(String name) { - return (NameValuePair) index.get(name); - } - - /** - * Returns number of pairs in this set. - */ - public int size() { - return mPairs.size(); - } - - /** - * Retrieves name value pairs in specific position. - */ - public NameValuePair elementAt(int pos) { - return (NameValuePair) mPairs.elementAt(pos); - } - - /** - * Removes all name value pairs in this set. - */ - public void removeAllPairs() { - mPairs.removeAllElements(); - index.clear(); - } - - /** - * Retrieves value of the name value pairs that matches - * the given name. */ - public String getValue(String name) { - NameValuePair p = getPair(name); - - if (p != null) { - return p.getValue(); - } - return null; + public NameValuePairs() { } /** - * Retrieves a list of names. - */ - public Enumeration getNames() { - Vector v = new Vector(); - int size = mPairs.size(); - - for (int i = 0; i < size; i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); - - v.addElement(p.getName()); - } - //System.out.println("getNames: "+v.size()); - return v.elements(); - } - - /** * Show the content of this name value container as * string representation. * @@ -131,15 +43,23 @@ public class NameValuePairs { public String toString() { StringBuffer buf = new StringBuffer(); - for (int i = 0; i < mPairs.size(); i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); + for (String name : keySet()) { + String value = get(name); - buf.append(p.getName() + "=" + p.getValue()); + buf.append(name + "=" + value); buf.append("\n"); } + return buf.toString(); } + /** + * Parses a string into name value pairs. + * + * @param s string + * @param nvp name value pairs + * @return true if successful + */ public static boolean parseInto(String s, NameValuePairs nvp) { StringTokenizer st = new StringTokenizer(s, "&"); @@ -153,12 +73,8 @@ public class NameValuePairs { String n = t.substring(0, i); String v = t.substring(i + 1); - nvp.add(n, v); - } + nvp.put(n, v); + } return true; } - - public Enumeration elements() { - return mPairs.elements(); - } -} +} |