summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/base
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/base')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java292
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java83
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java92
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java285
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java332
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java15
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java12
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java2
8 files changed, 561 insertions, 552 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java b/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java
index 10cc7a05f..b231a72f2 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.io.IOException;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
@@ -34,12 +33,10 @@ import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IArgBlock;
import com.netscape.certsrv.base.KeyGenInfo;
-
/**
- * This class represents a set of indexed arguments.
- * Each argument is indexed by a key, which can be
- * used during the argument retrieval.
- *
+ * This class represents a set of indexed arguments. Each argument is indexed by
+ * a key, which can be used during the argument retrieval.
+ *
* @version $Revision$, $Date$
*/
public class ArgBlock implements IArgBlock {
@@ -48,48 +45,45 @@ public class ArgBlock implements IArgBlock {
*
*/
private static final long serialVersionUID = -6054531129316353282L;
- /*==========================================================
- * variables
- *==========================================================*/
- public static final String
- CERT_NEW_REQUEST_HEADER = "-----BEGIN NEW CERTIFICATE REQUEST-----";
- public static final String
- CERT_NEW_REQUEST_TRAILER = "-----END NEW CERTIFICATE REQUEST-----";
- public static final String
- CERT_REQUEST_HEADER = "-----BEGIN CERTIFICATE REQUEST-----";
- public static final String
- CERT_REQUEST_TRAILER = "-----END CERTIFICATE REQUEST-----";
- public static final String
- CERT_RENEWAL_HEADER = "-----BEGIN RENEWAL CERTIFICATE REQUEST-----";
- public static final String
- CERT_RENEWAL_TRAILER = "-----END RENEWAL CERTIFICATE REQUEST-----";
+ /*
+ * ========================================================== variables
+ * ==========================================================
+ */
+ public static final String CERT_NEW_REQUEST_HEADER = "-----BEGIN NEW CERTIFICATE REQUEST-----";
+ public static final String CERT_NEW_REQUEST_TRAILER = "-----END NEW CERTIFICATE REQUEST-----";
+ public static final String CERT_REQUEST_HEADER = "-----BEGIN CERTIFICATE REQUEST-----";
+ public static final String CERT_REQUEST_TRAILER = "-----END CERTIFICATE REQUEST-----";
+ public static final String CERT_RENEWAL_HEADER = "-----BEGIN RENEWAL CERTIFICATE REQUEST-----";
+ public static final String CERT_RENEWAL_TRAILER = "-----END RENEWAL CERTIFICATE REQUEST-----";
private Hashtable mArgs = new Hashtable();
- private String mType = "unspecified-argblock";
+ private String mType = "unspecified-argblock";
- /*==========================================================
- * constructors
- *==========================================================*/
+ /*
+ * ========================================================== constructors
+ * ==========================================================
+ */
/**
* Constructs an argument block with the given hashtable values.
+ *
* @param realm the type of argblock - used for debugging the values
*/
public ArgBlock(String realm, Hashtable httpReq) {
- mType = realm;
- populate(httpReq);
- }
-
+ mType = realm;
+ populate(httpReq);
+ }
+
/**
* Constructs an argument block with the given hashtable values.
- *
+ *
* @param httpReq hashtable keys and values
*/
public ArgBlock(Hashtable httpReq) {
- populate(httpReq);
- }
+ populate(httpReq);
+ }
- private void populate(Hashtable httpReq) {
+ private void populate(Hashtable httpReq) {
// Add all parameters from the request
Enumeration e = httpReq.keys();
@@ -109,18 +103,19 @@ public class ArgBlock implements IArgBlock {
public ArgBlock() {
}
- /*==========================================================
- * public methods
- *==========================================================*/
+ /*
+ * ========================================================== public methods
+ * ==========================================================
+ */
/**
* Checks if this argument block contains the given key.
- *
+ *
* @param n key
* @return true if key is present
*/
public boolean isValuePresent(String n) {
- CMS.traceHashKey(mType, n);
+ CMS.traceHashKey(mType, n);
if (mArgs.get(n) != null) {
return true;
} else {
@@ -130,7 +125,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds string-based value into this argument block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -145,32 +140,33 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves argument value as string.
- *
+ *
* @param n key
* @return argument value as string
* @exception EBaseException failed to retrieve value
*/
public String getValueAsString(String n) throws EBaseException {
- String t= (String)mArgs.get(n);
- CMS.traceHashKey(mType, n, t);
+ String t = (String) mArgs.get(n);
+ CMS.traceHashKey(mType, n, t);
if (t != null) {
return t;
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
}
}
/**
* Retrieves argument value as string.
- *
+ *
* @param n key
* @param def default value to be returned if key is not present
* @return argument value as string
*/
public String getValueAsString(String n, String def) {
String val = (String) mArgs.get(n);
- CMS.traceHashKey(mType, n, val, def);
+ CMS.traceHashKey(mType, n, val, def);
if (val != null) {
return val;
@@ -181,35 +177,36 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves argument value as integer.
- *
+ *
* @param n key
* @return argument value as int
* @exception EBaseException failed to retrieve value
*/
public int getValueAsInt(String n) throws EBaseException {
if (mArgs.get(n) != null) {
- CMS.traceHashKey(mType, n, (String)mArgs.get(n));
+ CMS.traceHashKey(mType, n, (String) mArgs.get(n));
try {
return new Integer((String) mArgs.get(n)).intValue();
} catch (NumberFormatException e) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_TYPE", n, e.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_TYPE", n, e.toString()));
}
} else {
- CMS.traceHashKey(mType, n, "<notpresent>");
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
+ CMS.traceHashKey(mType, n, "<notpresent>");
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
}
}
/**
* Retrieves argument value as integer.
- *
+ *
* @param n key
* @param def default value to be returned if key is not present
* @return argument value as int
*/
public int getValueAsInt(String n, int def) {
- CMS.traceHashKey(mType, n, (String)mArgs.get(n), ""+def);
+ CMS.traceHashKey(mType, n, (String) mArgs.get(n), "" + def);
if (mArgs.get(n) != null) {
try {
return new Integer((String) mArgs.get(n)).intValue();
@@ -223,13 +220,12 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves argument value as big integer.
- *
+ *
* @param n key
* @return argument value as big integer
* @exception EBaseException failed to retrieve value
*/
- public BigInteger getValueAsBigInteger(String n)
- throws EBaseException {
+ public BigInteger getValueAsBigInteger(String n) throws EBaseException {
String v = (String) mArgs.get(n);
if (v != null) {
@@ -239,18 +235,19 @@ public class ArgBlock implements IArgBlock {
try {
return new BigInteger(v, 16);
} catch (NumberFormatException ex) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_TYPE", n, ex.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_TYPE", n, ex.toString()));
}
}
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", n));
}
}
/**
* Retrieves argument value as big integer.
- *
+ *
* @param n key
* @param def default value to be returned if key is not present
* @return argument value as big integer
@@ -265,7 +262,7 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves argument value as object
- *
+ *
* @param n key
* @return argument value as object
* @exception EBaseException failed to retrieve value
@@ -274,13 +271,14 @@ public class ArgBlock implements IArgBlock {
if (mArgs.get(n) != null) {
return mArgs.get(n);
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", (String) n));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", (String) n));
}
}
/**
* Retrieves argument value as object
- *
+ *
* @param n key
* @param def default value to be returned if key is not present
* @return argument value as object
@@ -295,56 +293,56 @@ public class ArgBlock implements IArgBlock {
/**
* Gets boolean value. They should be "true" or "false".
- *
+ *
* @param name name of the input type
* @return boolean type: <code>true</code> or <code>false</code>
* @exception EBaseException failed to retrieve value
*/
- public boolean getValueAsBoolean(String name) throws EBaseException {
+ public boolean getValueAsBoolean(String name) throws EBaseException {
String val = (String) mArgs.get(name);
- CMS.traceHashKey(mType, name, val);
+ CMS.traceHashKey(mType, name, val);
if (val != null) {
- if (val.equalsIgnoreCase("true") ||
- val.equalsIgnoreCase("on"))
+ if (val.equalsIgnoreCase("true") || val.equalsIgnoreCase("on"))
return true;
else
return false;
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
}
}
/**
* Gets boolean value. They should be "true" or "false".
- *
+ *
* @param name name of the input type
* @return boolean type: <code>true</code> or <code>false</code>
*/
public boolean getValueAsBoolean(String name, boolean def) {
boolean val;
- try {
- val = getValueAsBoolean(name);
+ try {
+ val = getValueAsBoolean(name);
return val;
- } catch (EBaseException e) {
- return def;
+ } catch (EBaseException e) {
+ return def;
}
}
/**
* Gets KeyGenInfo
- *
+ *
* @param name name of the input type
* @param verify true if signature validation is required
* @exception EBaseException
* @return KeyGenInfo object
*/
public KeyGenInfo getValueAsKeyGenInfo(String name, KeyGenInfo def)
- throws EBaseException {
+ throws EBaseException {
KeyGenInfo keyGenInfo;
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
if (mArgs.get(name) != null) {
try {
keyGenInfo = new KeyGenInfo((String) mArgs.get(name));
@@ -359,9 +357,9 @@ public class ArgBlock implements IArgBlock {
}
/**
- * Gets PKCS10 request. This pkcs10 attribute does not
- * contain header information.
- *
+ * Gets PKCS10 request. This pkcs10 attribute does not contain header
+ * information.
+ *
* @param name name of the input type
* @return pkcs10 request
* @exception EBaseException failed to retrieve value
@@ -370,42 +368,43 @@ public class ArgBlock implements IArgBlock {
PKCS10 request;
if (mArgs.get(name) != null) {
- CMS.traceHashKey(mType, name, (String)mArgs.get(name));
+ CMS.traceHashKey(mType, name, (String) mArgs.get(name));
String tempStr = unwrap((String) mArgs.get(name), false);
if (tempStr == null) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, "Empty Content"));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_VALUE", name, "Empty Content"));
}
try {
request = decodePKCS10(tempStr);
} catch (Exception e) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
}
} else {
- CMS.traceHashKey(mType, name, "<notpresent>");
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
+ CMS.traceHashKey(mType, name, "<notpresent>");
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
}
return request;
}
/**
- * Gets PKCS10 request. This pkcs10 attribute does not
- * contain header information.
- *
+ * Gets PKCS10 request. This pkcs10 attribute does not contain header
+ * information.
+ *
* @param name name of the input type
* @param def default PKCS10
* @return pkcs10 request
* @exception EBaseException failed to retrieve value
*/
public PKCS10 getValueAsRawPKCS10(String name, PKCS10 def)
- throws EBaseException {
+ throws EBaseException {
PKCS10 request;
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
if (mArgs.get(name) != null) {
String tempStr = unwrap((String) mArgs.get(name), false);
@@ -426,33 +425,34 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves PKCS10
- *
- * @param name name of the input type
+ *
+ * @param name name of the input type
* @param checkheader true if header must be present
* @return PKCS10 object
* @exception EBaseException failed to retrieve value
*/
- public PKCS10 getValueAsPKCS10(String name, boolean checkheader)
- throws EBaseException {
+ public PKCS10 getValueAsPKCS10(String name, boolean checkheader)
+ throws EBaseException {
PKCS10 request;
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
if (mArgs.get(name) != null) {
String tempStr = unwrap((String) mArgs.get(name), checkheader);
if (tempStr == null) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, "Empty Content"));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_VALUE", name, "Empty Content"));
}
try {
request = decodePKCS10(tempStr);
} catch (Exception e) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
}
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
}
return request;
@@ -460,19 +460,18 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves PKCS10
- *
- * @param name name of the input type
+ *
+ * @param name name of the input type
* @param checkheader true if header must be present
* @param def default PKCS10
- * @return PKCS10 object
+ * @return PKCS10 object
* @exception EBaseException
*/
- public PKCS10 getValueAsPKCS10(
- String name, boolean checkheader, PKCS10 def)
- throws EBaseException {
+ public PKCS10 getValueAsPKCS10(String name, boolean checkheader, PKCS10 def)
+ throws EBaseException {
PKCS10 request;
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
if (mArgs.get(name) != null) {
@@ -495,17 +494,16 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves PKCS10
- *
- * @param name name of the input type
+ *
+ * @param name name of the input type
* @param def default PKCS10
- * @return PKCS10 object
+ * @return PKCS10 object
* @exception EBaseException
*/
- public PKCS10 getValuePKCS10(String name, PKCS10 def)
- throws EBaseException {
+ public PKCS10 getValuePKCS10(String name, PKCS10 def) throws EBaseException {
PKCS10 request;
String p10b64 = (String) mArgs.get(name);
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
if (p10b64 != null) {
@@ -522,7 +520,7 @@ public class ArgBlock implements IArgBlock {
/**
* Sets argument into this block.
- *
+ *
* @param name key
* @param ob value
*/
@@ -532,18 +530,18 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves argument.
- *
+ *
* @param name key
* @return object value
*/
public Object get(String name) {
- CMS.traceHashKey(mType, name);
+ CMS.traceHashKey(mType, name);
return mArgs.get(name);
}
/**
* Deletes argument by the given key.
- *
+ *
* @param name key
*/
public void delete(String name) {
@@ -552,7 +550,7 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves a list of argument keys.
- *
+ *
* @return a list of string-based keys
*/
public Enumeration getElements() {
@@ -561,7 +559,7 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves a list of argument keys.
- *
+ *
* @return a list of string-based keys
*/
public Enumeration elements() {
@@ -570,7 +568,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds long-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -581,7 +579,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds integer-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -592,7 +590,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds boolean-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -607,7 +605,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds integer-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @param radix radix
@@ -617,20 +615,20 @@ public class ArgBlock implements IArgBlock {
return mArgs.put(n, v.toString(radix));
}
- /*==========================================================
- * private methods
- *==========================================================*/
-
+ /*
+ * ========================================================== private
+ * methods==========================================================
+ */
/**
* Unwrap PKCS10 Package
- *
+ *
* @param request string formated PKCS10 request
* @exception EBaseException
* @return Base64Encoded PKCS10 request
*/
private String unwrap(String request, boolean checkHeader)
- throws EBaseException {
+ throws EBaseException {
String unwrapped;
String header = null;
int head = -1;
@@ -655,7 +653,7 @@ public class ArgBlock implements IArgBlock {
// header.
if (!(head == -1 && trail == -1)) {
header = CERT_REQUEST_HEADER;
-
+
}
}
@@ -670,10 +668,12 @@ public class ArgBlock implements IArgBlock {
// Now validate if any headers or trailers are in place
if (head == -1 && checkHeader) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_MISSING_PKCS10_HEADER"));
+ throw new EBaseException(
+ CMS.getUserMessage("CMS_BASE_MISSING_PKCS10_HEADER"));
}
if (trail == -1 && checkHeader) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_MISSING_PKCS10_TRAILER"));
+ throw new EBaseException(
+ CMS.getUserMessage("CMS_BASE_MISSING_PKCS10_TRAILER"));
}
if (header != null) {
@@ -695,27 +695,31 @@ public class ArgBlock implements IArgBlock {
/**
* Decode Der encoded PKCS10 certifictae Request
- *
+ *
* @param base64Request Base64 Encoded Certificate Request
* @exception Exception
* @return PKCS10
*/
- private PKCS10 decodePKCS10(String base64Request)
- throws EBaseException {
+ private PKCS10 decodePKCS10(String base64Request) throws EBaseException {
PKCS10 pkcs10 = null;
try {
- byte[] decodedBytes = com.netscape.osutil.OSUtil.AtoB(base64Request);
+ byte[] decodedBytes = com.netscape.osutil.OSUtil
+ .AtoB(base64Request);
pkcs10 = new PKCS10(decodedBytes);
- } catch (NoSuchProviderException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INTERNAL_ERROR", e.toString()));
- } catch (IOException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INTERNAL_ERROR", e.toString()));
+ } catch (NoSuchProviderException e) {
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INTERNAL_ERROR", e.toString()));
+ } catch (IOException e) {
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INTERNAL_ERROR", e.toString()));
} catch (SignatureException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INTERNAL_ERROR", e.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INTERNAL_ERROR", e.toString()));
} catch (NoSuchAlgorithmException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INTERNAL_ERROR", e.toString()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INTERNAL_ERROR", e.toString()));
}
return pkcs10;
diff --git a/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java
index a4b371142..bfeec486b 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -33,22 +32,19 @@ import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.cmsutil.util.Utils;
-
/**
- * FileConfigStore:
- * Extends HashConfigStore with methods to load/save from/to file for
- * persistent storage. This is a configuration store agent who
- * reads data from a file.
+ * FileConfigStore: Extends HashConfigStore with methods to load/save from/to
+ * file for persistent storage. This is a configuration store agent who reads
+ * data from a file.
* <P>
- * Note that a LdapConfigStore can be implemented so that it reads
- * the configuration stores from the Ldap directory.
+ * Note that a LdapConfigStore can be implemented so that it reads the
+ * configuration stores from the Ldap directory.
* <P>
*
* @version $Revision$, $Date$
* @see PropConfigStore
*/
-public class FileConfigStore extends PropConfigStore implements
- IConfigStore {
+public class FileConfigStore extends PropConfigStore implements IConfigStore {
/**
*
@@ -59,7 +55,7 @@ public class FileConfigStore extends PropConfigStore implements
/**
* Constructs a file configuration store.
* <P>
- *
+ *
* @param fileName file name
* @exception EBaseException failed to create file configuration
*/
@@ -67,8 +63,8 @@ public class FileConfigStore extends PropConfigStore implements
super(null); // top-level store without a name
mFile = new File(fileName);
if (!mFile.exists()) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_NO_CONFIG_FILE",
- mFile.getPath()));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_NO_CONFIG_FILE", mFile.getPath()));
}
load(fileName);
}
@@ -76,7 +72,7 @@ public class FileConfigStore extends PropConfigStore implements
/**
* Loads property file into memory.
* <P>
- *
+ *
* @param fileName file name
* @exception EBaseException failed to load configuration
*/
@@ -93,69 +89,66 @@ public class FileConfigStore extends PropConfigStore implements
/**
* The original config file is copied to
- * <filename>.<current_time_in_milliseconds>.
- * Commits the current properties to the configuration file.
+ * <filename>.<current_time_in_milliseconds>. Commits the current properties
+ * to the configuration file.
* <P>
- *
- * @param backup
+ *
+ * @param backup
*/
public void commit(boolean createBackup) throws EBaseException {
if (createBackup) {
- File newName = new File(mFile.getPath() + "." +
- Long.toString(System.currentTimeMillis()));
+ File newName = new File(mFile.getPath() + "."
+ + Long.toString(System.currentTimeMillis()));
try {
- if( Utils.isNT() ) {
+ if (Utils.isNT()) {
// NT is very picky on the path
- Utils.exec( "copy " +
- mFile.getAbsolutePath().replace( '/', '\\' ) +
- " " +
- newName.getAbsolutePath().replace( '/',
- '\\' ) );
+ Utils.exec("copy "
+ + mFile.getAbsolutePath().replace('/', '\\') + " "
+ + newName.getAbsolutePath().replace('/', '\\'));
} else {
// Create a copy of the original file which
// preserves the original file permissions.
- Utils.exec( "cp -p " + mFile.getAbsolutePath() + " " +
- newName.getAbsolutePath() );
+ Utils.exec("cp -p " + mFile.getAbsolutePath() + " "
+ + newName.getAbsolutePath());
}
// Proceed only if the backup copy was successful.
- if( !newName.exists() ) {
- throw new EBaseException( "backup copy failed" );
+ if (!newName.exists()) {
+ throw new EBaseException("backup copy failed");
} else {
// Make certain that the backup file has
// the correct permissions.
- if( !Utils.isNT() ) {
- Utils.exec( "chmod 00660 " + newName.getAbsolutePath() );
+ if (!Utils.isNT()) {
+ Utils.exec("chmod 00660 " + newName.getAbsolutePath());
}
}
- } catch( EBaseException e ) {
- throw new EBaseException( "backup copy failed" );
+ } catch (EBaseException e) {
+ throw new EBaseException("backup copy failed");
}
}
// Overwrite the contents of the original file
// to preserve the original file permissions.
- save( mFile.getPath() );
+ save(mFile.getPath());
try {
// Make certain that the original file retains
// the correct permissions.
- if( !Utils.isNT() ) {
- Utils.exec( "chmod 00660 " + mFile.getCanonicalPath() );
+ if (!Utils.isNT()) {
+ Utils.exec("chmod 00660 " + mFile.getCanonicalPath());
}
- } catch( Exception e ) {
+ } catch (Exception e) {
}
}
/**
* Saves in-memory properties to a specified file.
* <P>
- * Note that the superclass's save is synchronized. It
- * means no properties can be altered (inserted) at
- * the saving time.
+ * Note that the superclass's save is synchronized. It means no properties
+ * can be altered (inserted) at the saving time.
* <P>
- *
+ *
* @param fileName filename
* @exception EBaseException failed to save configuration
*/
@@ -173,8 +166,7 @@ public class FileConfigStore extends PropConfigStore implements
}
private void printSubStore(PrintWriter writer, IConfigStore store,
- String name) throws EBaseException,
- IOException {
+ String name) throws EBaseException, IOException {
// print keys
Enumeration e0 = store.getPropertyNames();
Vector v = new Vector();
@@ -219,8 +211,7 @@ public class FileConfigStore extends PropConfigStore implements
}
}
v.removeElementAt(j);
- printSubStore(writer, store.getSubStore(pname), name +
- pname + ".");
+ printSubStore(writer, store.getSubStore(pname), name + pname + ".");
}
}
}
diff --git a/pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java b/pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java
index cd6959676..4b17248fe 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
@@ -44,19 +43,18 @@ import org.mozilla.jss.util.Password;
import org.mozilla.jss.util.PasswordCallback;
import org.mozilla.jss.util.PasswordCallbackInfo;
-
/**
* A class to retrieve passwords through a modal Java dialog box
*/
public class JDialogPasswordCallback implements PasswordCallback {
public Password getPasswordFirstAttempt(PasswordCallbackInfo info)
- throws PasswordCallback.GiveUpException {
+ throws PasswordCallback.GiveUpException {
return getPW(info, false);
}
public Password getPasswordAgain(PasswordCallbackInfo info)
- throws PasswordCallback.GiveUpException {
+ throws PasswordCallback.GiveUpException {
return getPW(info, true);
}
@@ -88,27 +86,27 @@ public class JDialogPasswordCallback implements PasswordCallback {
}
/**
- * This method does the work of displaying the dialog box,
- * extracting the information, and returning it.
+ * This method does the work of displaying the dialog box, extracting the
+ * information, and returning it.
*/
private Password getPW(PasswordCallbackInfo info, boolean retry)
- throws PasswordCallback.GiveUpException {
+ throws PasswordCallback.GiveUpException {
// These need to final so they can be accessed from action listeners
final PWHolder pwHolder = new PWHolder();
final JFrame f = new JFrame("Password Dialog");
final JPasswordField pwField = new JPasswordField(15);
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Panel
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
JPanel contentPane = new JPanel(new GridBagLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
GridBagConstraints c = new GridBagConstraints();
- ////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////
// Labels
- ////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////
if (retry) {
JLabel warning = new JLabel("Password incorrect.");
@@ -119,47 +117,47 @@ public class JDialogPasswordCallback implements PasswordCallback {
c.gridwidth = GridBagConstraints.REMAINDER;
// Setting this to NULL causes nasty Exception stack traces
// to be printed, although the program still seems to work
- //warning.setHighlighter(null);
+ // warning.setHighlighter(null);
contentPane.add(warning, c);
}
-
+
String prompt = getPrompt(info);
JLabel label = new JLabel(prompt);
label.setForeground(Color.black);
// Setting this to NULL causes nasty Exception stack traces
// to be printed, although the program still seems to work
- //label.setHighlighter(null);
+ // label.setHighlighter(null);
resetGBC(c);
c.anchor = GridBagConstraints.NORTHWEST;
c.gridwidth = GridBagConstraints.REMAINDER;
contentPane.add(label, c);
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Password text field
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Listener for the text field
ActionListener getPasswordListener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- //input = (JPasswordField)e.getSource();
+ public void actionPerformed(ActionEvent e) {
+ // input = (JPasswordField)e.getSource();
- // XXX!!! Change to char[] in JDK 1.2
- String pwString = pwField.getText();
+ // XXX!!! Change to char[] in JDK 1.2
+ String pwString = pwField.getText();
- pwHolder.password = new Password(pwString.toCharArray());
- pwHolder.cancelled = false;
- f.dispose();
- }
- };
+ pwHolder.password = new Password(pwString.toCharArray());
+ pwHolder.cancelled = false;
+ f.dispose();
+ }
+ };
// There is a bug in JPasswordField. The cursor is advanced by the
// width of the character you type, but a '*' is echoed, so the
// cursor does not stay lined up with the end of the text.
// We use a monospaced font to workaround this.
- pwField.setFont(new Font("Monospaced", Font.PLAIN,
- pwField.getFont().getSize()));
+ pwField.setFont(new Font("Monospaced", Font.PLAIN, pwField.getFont()
+ .getSize()));
pwField.setEchoChar('*');
pwField.addActionListener(getPasswordListener);
resetGBC(c);
@@ -167,12 +165,12 @@ public class JDialogPasswordCallback implements PasswordCallback {
c.fill = GridBagConstraints.NONE;
c.insets = new Insets(16, 0, 0, 0);
c.gridwidth = GridBagConstraints.REMAINDER;
- //c.gridy++;
+ // c.gridy++;
contentPane.add(pwField, c);
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Cancel button
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
JPanel buttonPanel = new JPanel(new GridBagLayout());
@@ -188,11 +186,11 @@ public class JDialogPasswordCallback implements PasswordCallback {
JButton cancel = new JButton("Cancel");
ActionListener buttonListener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- pwHolder.cancelled = true;
- f.dispose();
- }
- };
+ public void actionPerformed(ActionEvent e) {
+ pwHolder.cancelled = true;
+ f.dispose();
+ }
+ };
cancel.addActionListener(buttonListener);
resetGBC(c);
@@ -211,16 +209,16 @@ public class JDialogPasswordCallback implements PasswordCallback {
c.insets = new Insets(0, 0, 0, 0);
contentPane.add(buttonPanel, c);
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Create modal dialog
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
JDialog d = new JDialog(f, "Fedora Certificate System", true);
WindowListener windowListener = new WindowAdapter() {
- public void windowOpened(WindowEvent e) {
- pwField.requestFocus();
- }
- };
+ public void windowOpened(WindowEvent e) {
+ pwField.requestFocus();
+ }
+ };
d.addWindowListener(windowListener);
@@ -230,17 +228,17 @@ public class JDialogPasswordCallback implements PasswordCallback {
Dimension paneSize = d.getSize();
d.setLocation((screenSize.width - paneSize.width) / 2,
- (screenSize.height - paneSize.height) / 2);
+ (screenSize.height - paneSize.height) / 2);
d.getRootPane().setDefaultButton(ok);
// toFront seems to cause the dialog to go blank on unix!
- //d.toFront();
+ // d.toFront();
d.show();
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
// Return results
- ///////////////////////////////////////////////////
+ // /////////////////////////////////////////////////
if (pwHolder.cancelled) {
throw new PasswordCallback.GiveUpException();
}
@@ -253,8 +251,8 @@ public class JDialogPasswordCallback implements PasswordCallback {
try {
CryptoManager manager;
- CryptoManager.InitializationValues iv = new
- CryptoManager.InitializationValues(args[0]);
+ CryptoManager.InitializationValues iv = new CryptoManager.InitializationValues(
+ args[0]);
CryptoManager.initialize(iv);
manager = CryptoManager.getInstance();
diff --git a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java
index e54b19d90..bb3f32b74 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.io.ByteArrayOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
@@ -38,23 +37,22 @@ import com.netscape.certsrv.base.EPropertyNotFound;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.certsrv.base.ISourceConfigStore;
-
/**
- * A class represents a in-memory configuration store.
- * Note this class takes advantage of the recursive nature of
- * property names. The current property prefix is kept in
- * mStoreName and the mSource usually points back to another
+ * A class represents a in-memory configuration store. Note this class takes
+ * advantage of the recursive nature of property names. The current property
+ * prefix is kept in mStoreName and the mSource usually points back to another
* occurance of the same PropConfigStore, with longer mStoreName. IE
+ *
* <PRE>
- * cms.ca0.http.service0 -> mSource=PropConfigStore ->
- * cms.ca0.http -> mSource=PropConfigStore ->
- * cms.ca0 -> mSource=PropConfigStore ->
+ * cms.ca0.http.service0 -> mSource=PropConfigStore ->
+ * cms.ca0.http -> mSource=PropConfigStore ->
+ * cms.ca0 -> mSource=PropConfigStore ->
* cms -> mSource=SourceConfigStore -> Properties
* </PRE>
- * The chain ends when the store name is reduced down to it's original
- * value.
+ *
+ * The chain ends when the store name is reduced down to it's original value.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public class PropConfigStore implements IConfigStore, Cloneable {
@@ -76,14 +74,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
*/
protected ISourceConfigStore mSource = null;
- private static String mDebugType="CS.cfg";
+ private static String mDebugType = "CS.cfg";
/**
- * Constructs a property configuration store. This must
- * be a brand new store without properties. The subclass
- * must be a ISourceConfigStore.
+ * Constructs a property configuration store. This must be a brand new store
+ * without properties. The subclass must be a ISourceConfigStore.
* <P>
- *
+ *
* @param storeName property store name
* @exception EBaseException failed to create configuration
*/
@@ -93,12 +90,11 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Constructs a configuration store. The constructor is
- * a helper class for substores. Source is the one
- * that stores all the parameters. Each substore only
- * store a substore name, and a reference to the source.
+ * Constructs a configuration store. The constructor is a helper class for
+ * substores. Source is the one that stores all the parameters. Each
+ * substore only store a substore name, and a reference to the source.
* <P>
- *
+ *
* @param storeName store name
* @param prop list of properties
* @exception EBaseException failed to create configuration
@@ -111,7 +107,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Returns the name of this store.
* <P>
- *
+ *
* @return store name
*/
public String getName() {
@@ -121,7 +117,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a property from the configuration file.
* <P>
- *
+ *
* @param name property name
* @return property value
*/
@@ -130,10 +126,10 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Retrieves a property from the configuration file. Does not prepend
- * the config store name to the property.
+ * Retrieves a property from the configuration file. Does not prepend the
+ * config store name to the property.
* <P>
- *
+ *
* @param name property name
* @return property value
*/
@@ -142,11 +138,10 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Puts a property into the configuration file. The
- * values wont be updated to the file until save
- * method is invoked.
+ * Puts a property into the configuration file. The values wont be updated
+ * to the file until save method is invoked.
* <P>
- *
+ *
* @param name property name
* @param value property value
*/
@@ -156,16 +151,17 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Removes a property from the configuration file.
- *
+ *
* @param name property name
*/
public void remove(String name) {
((SourceConfigStore) mSource).remove(getFullName(name));
- }
+ }
/**
* Returns an enumeration of the config store's keys, hidding the store
* name.
+ *
* @see java.util.Hashtable#elements
* @see java.util.Enumeration
*/
@@ -178,7 +174,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves the hashtable where all the properties are kept.
- *
+ *
* @return hashtable
*/
public Hashtable hashtable() {
@@ -199,16 +195,16 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Fills the given hash table with all key/value pairs in the current
- * config store, removing the config store name prefix
+ * Fills the given hash table with all key/value pairs in the current config
+ * store, removing the config store name prefix
* <P>
- *
+ *
* @param h the hashtable
*/
private synchronized void enumerate(Hashtable h) {
Enumeration e = mSource.keys();
// We only want the keys which match the current substore name
- // without the current substore prefix. This code works even
+ // without the current substore prefix. This code works even
// if mStoreName is null.
String fullName = getFullName("");
int kIndex = fullName.length();
@@ -224,7 +220,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Reads a config store from an input stream.
- *
+ *
* @param in input stream where properties are located
* @exception IOException failed to load
*/
@@ -234,7 +230,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Stores this config store to the specified output stream.
- *
+ *
* @param out outputstream where the properties are saved
* @param header optional header information to be saved
*/
@@ -244,7 +240,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a property value.
- *
+ *
* @param name property key
* @return property value
* @exception EBaseException failed to retrieve value
@@ -253,28 +249,30 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String str = (String) get(name);
if (str == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
- throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
+ throw new EPropertyNotFound(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
- // should we check for empty string ?
+ // should we check for empty string ?
// if (str.length() == 0) {
- // throw new EPropertyNotDefined(getName() + "." + name);
+ // throw new EPropertyNotDefined(getName() + "." + name);
// }
String ret = null;
try {
ret = new String(str.getBytes(), "UTF8").trim();
} catch (java.io.UnsupportedEncodingException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_UTF8_NOT_SUPPORTED"));
+ throw new EBaseException(
+ CMS.getUserMessage("CMS_BASE_UTF8_NOT_SUPPORTED"));
}
- CMS.traceHashKey(mDebugType,getFullName(name),ret);
+ CMS.traceHashKey(mDebugType, getFullName(name), ret);
return ret;
}
/**
* Retrieves a String from the configuration file.
* <P>
- *
+ *
* @param name property name
* @param defval the default object to return if name does not exist
* @return property value
@@ -287,13 +285,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
} catch (EPropertyNotFound e) {
val = defval;
}
- CMS.traceHashKey(mDebugType,getFullName(name),val,defval);
+ CMS.traceHashKey(mDebugType, getFullName(name), val, defval);
return val;
}
/**
* Puts property value into this configuration store.
- *
+ *
* @param name property key
* @param value property value
*/
@@ -304,18 +302,19 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a byte array from the configuration file.
* <P>
- *
+ *
* @param name property name
* @exception IllegalArgumentException if name is not set or is null.
- *
+ *
* @return property value
*/
public byte[] getByteArray(String name) throws EBaseException {
byte[] arr = getByteArray(name, new byte[0]);
if (arr.length == 0) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
- throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
+ throw new EPropertyNotFound(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
return arr;
}
@@ -323,41 +322,39 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a byte array from the configuration file.
* <P>
- *
+ *
* @param name property name
- * @param defval the default byte array to return if name does
- * not exist
- *
+ * @param defval the default byte array to return if name does not exist
+ *
* @return property value
*/
- public byte[] getByteArray(String name, byte defval[])
- throws EBaseException {
+ public byte[] getByteArray(String name, byte defval[])
+ throws EBaseException {
String str = (String) get(name);
- byte returnval;
+ byte returnval;
- if (str == null || str.length() == 0) {
- CMS.traceHashKey(mDebugType,getFullName(name),
- "<notpresent>","<bytearray>");
- return defval;
- }
- else {
- CMS.traceHashKey(mDebugType,getFullName(name),
- "<bytearray>","<bytearray>");
- return com.netscape.osutil.OSUtil.AtoB(str);
- }
+ if (str == null || str.length() == 0) {
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>",
+ "<bytearray>");
+ return defval;
+ } else {
+ CMS.traceHashKey(mDebugType, getFullName(name), "<bytearray>",
+ "<bytearray>");
+ return com.netscape.osutil.OSUtil.AtoB(str);
+ }
}
/**
* Puts byte array into this configuration store.
- *
+ *
* @param name property key
* @param value byte array
*/
public void putByteArray(String name, byte value[]) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
- Base64OutputStream b64 = new Base64OutputStream(new
- PrintStream(new FilterOutputStream(output)));
+ Base64OutputStream b64 = new Base64OutputStream(new PrintStream(
+ new FilterOutputStream(output)));
try {
b64.write(value);
@@ -367,14 +364,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
// internationalization problems here
put(name, output.toString("8859_1"));
} catch (IOException e) {
- System.out.println("Warning: base-64 encoding of configuration " +
- "information failed");
+ System.out.println("Warning: base-64 encoding of configuration "
+ + "information failed");
}
}
/**
* Retrieves boolean-based property value.
- *
+ *
* @param name property key
* @return boolean value
* @exception EBaseException failed to retrieve
@@ -383,11 +380,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
- throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
+ throw new EPropertyNotFound(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
if (value.length() == 0) {
- throw new EPropertyNotDefined(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
+ throw new EPropertyNotDefined(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
}
if (value.equalsIgnoreCase("true")) {
@@ -395,20 +394,22 @@ public class PropConfigStore implements IConfigStore, Cloneable {
} else if (value.equalsIgnoreCase("false")) {
return false;
} else {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name, "boolean", "\"true\" or \"false\""));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name,
+ "boolean", "\"true\" or \"false\""));
}
}
/**
* Retrieves boolean-based property value.
- *
+ *
* @param name property key
* @param defval default value
* @return boolean value
* @exception EBaseException failed to retrieve
*/
- public boolean getBoolean(String name, boolean defval)
- throws EBaseException {
+ public boolean getBoolean(String name, boolean defval)
+ throws EBaseException {
boolean val;
try {
@@ -418,14 +419,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
} catch (EPropertyNotDefined e) {
val = defval;
}
- CMS.traceHashKey(mDebugType,getFullName(name),
- val?"true":"false", defval?"true":"false");
+ CMS.traceHashKey(mDebugType, getFullName(name), val ? "true" : "false",
+ defval ? "true" : "false");
return val;
}
/**
* Puts boolean value into the configuration store.
- *
+ *
* @param name property key
* @param value property value
*/
@@ -439,7 +440,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves integer value.
- *
+ *
* @param name property key
* @return property value
* @exception EBaseException failed to retrieve value
@@ -448,23 +449,27 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
- throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
+ throw new EPropertyNotFound(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
if (value.length() == 0) {
- throw new EPropertyNotDefined(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
+ throw new EPropertyNotDefined(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
}
try {
- CMS.traceHashKey(mDebugType,getFullName(name), value);
+ CMS.traceHashKey(mDebugType, getFullName(name), value);
return Integer.parseInt(value);
} catch (NumberFormatException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name, "int", "number"));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name,
+ "int", "number"));
}
}
/**
* Retrieves integer value.
- *
+ *
* @param name property key
* @param defval default value
* @return property value
@@ -480,14 +485,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
} catch (EPropertyNotDefined e) {
val = defval;
}
- CMS.traceHashKey(mDebugType,getFullName(name),
- ""+val,""+defval);
+ CMS.traceHashKey(mDebugType, getFullName(name), "" + val, "" + defval);
return val;
}
/**
* Puts an integer value.
- *
+ *
* @param name property key
* @param val property value
* @exception EBaseException failed to retrieve value
@@ -498,7 +502,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves big integer value.
- *
+ *
* @param name property key
* @return property value
* @exception EBaseException failed to retrieve value
@@ -507,11 +511,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
- throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
+ throw new EPropertyNotFound(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
if (value.length() == 0) {
- throw new EPropertyNotDefined(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
+ throw new EPropertyNotDefined(CMS.getUserMessage(
+ "CMS_BASE_GET_PROPERTY_NOVALUE", getName() + "." + name));
}
try {
if (value.startsWith("0x") || value.startsWith("0X")) {
@@ -521,20 +527,22 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
return new BigInteger(value);
} catch (NumberFormatException e) {
- throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name, "BigInteger", "number"));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_INVALID_PROPERTY_1", getName() + "." + name,
+ "BigInteger", "number"));
}
}
/**
* Retrieves integer value.
- *
+ *
* @param name property key
* @param defval default value
* @return property value
* @exception EBaseException failed to retrieve value
*/
- public BigInteger getBigInteger(String name, BigInteger defval)
- throws EBaseException {
+ public BigInteger getBigInteger(String name, BigInteger defval)
+ throws EBaseException {
BigInteger val;
try {
@@ -549,7 +557,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Puts a big integer value.
- *
+ *
* @param name property key
* @param val default value
*/
@@ -560,37 +568,33 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Creates a new sub store.
* <P>
- *
+ *
* @param name substore name
* @return substore
*/
public IConfigStore makeSubStore(String name) {
/*
- String names=(String)mSource.get(getFullName(PROP_SUBSTORES));
-
- if (names==null) {
- names=name;
- }
- else {
- names=names+","+name;
- }
- mSource.put(getFullName(PROP_SUBSTORES), name);
+ * String names=(String)mSource.get(getFullName(PROP_SUBSTORES));
+ *
+ * if (names==null) { names=name; } else { names=names+","+name; }
+ * mSource.put(getFullName(PROP_SUBSTORES), name);
*/
return new PropConfigStore(getFullName(name), mSource);
}
/**
- * Removes a sub store.<p>
- *
+ * Removes a sub store.
+ * <p>
+ *
* @param name substore name
*/
public void removeSubStore(String name) {
// this operation is expensive!!!
-
+
Enumeration e = mSource.keys();
// We only want the keys which match the current substore name
- // without the current substore prefix. This code works even
+ // without the current substore prefix. This code works even
// if mStoreName is null.
String fullName = getFullName(name);
int kIndex = fullName.length();
@@ -605,20 +609,22 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Retrieves a sub store. A substore contains a list
- * of properties and substores. For example,
+ * Retrieves a sub store. A substore contains a list of properties and
+ * substores. For example,
+ *
* <PRE>
* cms.ldap.host=ds.netscape.com
* cms.ldap.port=389
* </PRE>
- * "ldap" is a substore in above example. If the
- * substore property itself is set, this method
- * will treat the value as a reference. For example,
+ *
+ * "ldap" is a substore in above example. If the substore property itself is
+ * set, this method will treat the value as a reference. For example,
+ *
* <PRE>
- * cms.ldap=kms.ldap
+ * cms.ldap = kms.ldap
* </PRE>
* <P>
- *
+ *
* @param name substore name
* @return substore
*/
@@ -639,7 +645,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a list of property names.
- *
+ *
* @return a list of string-based property names
*/
public Enumeration getPropertyNames() {
@@ -668,7 +674,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Returns a list of sub store names.
* <P>
- *
+ *
* @return list of substore names
*/
public Enumeration getSubStoreNames() {
@@ -695,10 +701,9 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Retrieves the source configuration store where
- * the properties are stored.
+ * Retrieves the source configuration store where the properties are stored.
* <P>
- *
+ *
* @return source configuration store
*/
public ISourceConfigStore getSourceConfigStore() {
@@ -706,8 +711,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * For debugging purposes. Prints properties of this
- * substore.
+ * For debugging purposes. Prints properties of this substore.
*/
public void printProperties() {
Enumeration keys = mSource.keys();
@@ -726,7 +730,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Converts the substore parameters.
- *
+ *
* @param name property name
* @return fill property name
*/
@@ -739,7 +743,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Cloning of property configuration store.
- *
+ *
* @return a new configuration store
*/
public Object clone() {
@@ -751,18 +755,15 @@ public class PropConfigStore implements IConfigStore, Cloneable {
Enumeration subs = getSubStoreNames();
while (subs.hasMoreElements()) {
- IConfigStore sub = (IConfigStore)
- subs.nextElement();
- IConfigStore newSub = that.makeSubStore(
- sub.getName());
+ IConfigStore sub = (IConfigStore) subs.nextElement();
+ IConfigStore newSub = that.makeSubStore(sub.getName());
Enumeration props = sub.getPropertyNames();
while (props.hasMoreElements()) {
String n = (String) props.nextElement();
try {
- newSub.putString(n,
- sub.getString(n));
+ newSub.putString(n, sub.getString(n));
} catch (EBaseException ex) {
}
}
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
index 684f8a8ed..4f2d3af37 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
@@ -31,26 +30,24 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
-
/**
- * The <code>Properties</code> class represents a persistent set of
- * properties. The <code>Properties</code> can be saved to a stream
- * or loaded from a stream. Each key and its corresponding value in
- * the property list is a string.
+ * The <code>Properties</code> class represents a persistent set of properties.
+ * The <code>Properties</code> can be saved to a stream or loaded from a stream.
+ * Each key and its corresponding value in the property list is a string.
* <p>
- * A property list can contain another property list as its
- * "defaults"; this second property list is searched if
- * the property key is not found in the original property list.
- *
+ * A property list can contain another property list as its "defaults"; this
+ * second property list is searched if the property key is not found in the
+ * original property list.
+ *
* Because <code>Properties</code> inherits from <code>Hashtable</code>, the
* <code>put</code> and <code>putAll</code> methods can be applied to a
- * <code>Properties</code> object. Their use is strongly discouraged as they
+ * <code>Properties</code> object. Their use is strongly discouraged as they
* allow the caller to insert entries whose keys or values are not
- * <code>Strings</code>. The <code>setProperty</code> method should be used
- * instead. If the <code>store</code> or <code>save</code> method is called
- * on a "compromised" <code>Properties</code> object that contains a
- * non-<code>String</code> key or value, the call will fail.
- *
+ * <code>Strings</code>. The <code>setProperty</code> method should be used
+ * instead. If the <code>store</code> or <code>save</code> method is called on a
+ * "compromised" <code>Properties</code> object that contains a non-
+ * <code>String</code> key or value, the call will fail.
+ *
*/
public class SimpleProperties extends Hashtable {
@@ -60,9 +57,9 @@ public class SimpleProperties extends Hashtable {
private static final long serialVersionUID = -6129810287662322712L;
/**
- * A property list that contains default values for any keys not
- * found in this property list.
- *
+ * A property list that contains default values for any keys not found in
+ * this property list.
+ *
* @serial
*/
protected SimpleProperties defaults;
@@ -76,18 +73,19 @@ public class SimpleProperties extends Hashtable {
/**
* Creates an empty property list with the specified defaults.
- *
- * @param defaults the defaults.
+ *
+ * @param defaults the defaults.
*/
public SimpleProperties(SimpleProperties defaults) {
this.defaults = defaults;
}
/**
- * Calls the hashtable method <code>put</code>. Provided for
- * parallelism with the getProperties method. Enforces use of
- * strings for property keys and values.
- * @since JDK1.2
+ * Calls the hashtable method <code>put</code>. Provided for parallelism
+ * with the getProperties method. Enforces use of strings for property keys
+ * and values.
+ *
+ * @since JDK1.2
*/
public synchronized Object setProperty(String key, String value) {
return put(key, value);
@@ -104,79 +102,88 @@ public class SimpleProperties extends Hashtable {
/**
* Reads a property list (key and element pairs) from the input stream.
* <p>
- * Every property occupies one line of the input stream. Each line
- * is terminated by a line terminator (<code>\n</code> or <code>\r</code>
- * or <code>\r\n</code>). Lines from the input stream are processed until
- * end of file is reached on the input stream.
+ * Every property occupies one line of the input stream. Each line is
+ * terminated by a line terminator (<code>\n</code> or <code>\r</code> or
+ * <code>\r\n</code>). Lines from the input stream are processed until end
+ * of file is reached on the input stream.
* <p>
* A line that contains only whitespace or whose first non-whitespace
- * character is an ASCII <code>#</code> or <code>!</code> is ignored
- * (thus, <code>#</code> or <code>!</code> indicate comment lines).
+ * character is an ASCII <code>#</code> or <code>!</code> is ignored (thus,
+ * <code>#</code> or <code>!</code> indicate comment lines).
* <p>
* Every line other than a blank line or a comment line describes one
* property to be added to the table (except that if a line ends with \,
- * then the following line, if it exists, is treated as a continuation
- * line, as described
- * below). The key consists of all the characters in the line starting
- * with the first non-whitespace character and up to, but not including,
- * the first ASCII <code>=</code>, <code>:</code>, or whitespace
- * character. All of the key termination characters may be included in
- * the key by preceding them with a \.
- * Any whitespace after the key is skipped; if the first non-whitespace
- * character after the key is <code>=</code> or <code>:</code>, then it
- * is ignored and any whitespace characters after it are also skipped.
- * All remaining characters on the line become part of the associated
- * element string. Within the element string, the ASCII
- * escape sequences <code>\t</code>, <code>\n</code>,
- * <code>\r</code>, <code>\\</code>, <code>\"</code>, <code>\'</code>,
- * <code>\ &#32;</code> &#32;(a backslash and a space), and
- * <code>\\u</code><i>xxxx</i> are recognized and converted to single
- * characters. Moreover, if the last character on the line is
- * <code>\</code>, then the next line is treated as a continuation of the
- * current line; the <code>\</code> and line terminator are simply
- * discarded, and any leading whitespace characters on the continuation
- * line are also discarded and are not part of the element string.
+ * then the following line, if it exists, is treated as a continuation line,
+ * as described below). The key consists of all the characters in the line
+ * starting with the first non-whitespace character and up to, but not
+ * including, the first ASCII <code>=</code>, <code>:</code>, or whitespace
+ * character. All of the key termination characters may be included in the
+ * key by preceding them with a \. Any whitespace after the key is skipped;
+ * if the first non-whitespace character after the key is <code>=</code> or
+ * <code>:</code>, then it is ignored and any whitespace characters after it
+ * are also skipped. All remaining characters on the line become part of the
+ * associated element string. Within the element string, the ASCII escape
+ * sequences <code>\t</code>, <code>\n</code>, <code>\r</code>,
+ * <code>\\</code>, <code>\"</code>, <code>\'</code>, <code>\ &#32;</code>
+ * &#32;(a backslash and a space), and <code>\\u</code><i>xxxx</i> are
+ * recognized and converted to single characters. Moreover, if the last
+ * character on the line is <code>\</code>, then the next line is treated as
+ * a continuation of the current line; the <code>\</code> and line
+ * terminator are simply discarded, and any leading whitespace characters on
+ * the continuation line are also discarded and are not part of the element
+ * string.
* <p>
* As an example, each of the following four lines specifies the key
* <code>"Truth"</code> and the associated element value
* <code>"Beauty"</code>:
* <p>
+ *
* <pre>
* Truth = Beauty
- * Truth:Beauty
+ * Truth:Beauty
* Truth :Beauty
* </pre>
- * As another example, the following three lines specify a single
- * property:
+ *
+ * As another example, the following three lines specify a single property:
* <p>
+ *
* <pre>
* fruits apple, banana, pear, \
* cantaloupe, watermelon, \
* kiwi, mango
* </pre>
+ *
* The key is <code>"fruits"</code> and the associated element is:
* <p>
- * <pre>"apple, banana, pear, cantaloupe, watermelon,kiwi, mango"</pre>
- * Note that a space appears before each <code>\</code> so that a space
- * will appear after each comma in the final result; the <code>\</code>,
- * line terminator, and leading whitespace on the continuation line are
- * merely discarded and are <i>not</i> replaced by one or more other
- * characters.
+ *
+ * <pre>
+ * &quot;apple, banana, pear, cantaloupe, watermelon,kiwi, mango&quot;
+ * </pre>
+ *
+ * Note that a space appears before each <code>\</code> so that a space will
+ * appear after each comma in the final result; the <code>\</code>, line
+ * terminator, and leading whitespace on the continuation line are merely
+ * discarded and are <i>not</i> replaced by one or more other characters.
* <p>
* As a third example, the line:
* <p>
- * <pre>cheeses
+ *
+ * <pre>
+ * cheeses
* </pre>
+ *
* specifies that the key is <code>"cheeses"</code> and the associated
- * element is the empty string.<p>
- *
- * @param in the input stream.
- * @exception IOException if an error occurred when reading from the
- * input stream.
+ * element is the empty string.
+ * <p>
+ *
+ * @param in the input stream.
+ * @exception IOException if an error occurred when reading from the input
+ * stream.
*/
public synchronized void load(InputStream inStream) throws IOException {
- BufferedReader in = new BufferedReader(new InputStreamReader(inStream, "8859_1"));
+ BufferedReader in = new BufferedReader(new InputStreamReader(inStream,
+ "8859_1"));
while (true) {
// Get next line
@@ -195,14 +202,17 @@ public class SimpleProperties extends Hashtable {
if (nextLine == null)
nextLine = "";
- String loppedLine = line.substring(0, line.length() - 1);
+ String loppedLine = line
+ .substring(0, line.length() - 1);
// Advance beyond whitespace on new line
int startIndex = 0;
for (startIndex = 0; startIndex < nextLine.length(); startIndex++)
- if (whiteSpaceChars.indexOf(nextLine.charAt(startIndex)) == -1)
+ if (whiteSpaceChars.indexOf(nextLine
+ .charAt(startIndex)) == -1)
break;
- nextLine = nextLine.substring(startIndex, nextLine.length());
+ nextLine = nextLine.substring(startIndex,
+ nextLine.length());
line = new String(loppedLine + nextLine);
}
// Find start of key
@@ -232,24 +242,26 @@ public class SimpleProperties extends Hashtable {
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1)
break;
- // Skip over one non whitespace key value separators if any
+ // Skip over one non whitespace key value separators if any
if (valueIndex < len)
- if (strictKeyValueSeparators.indexOf(line.charAt(valueIndex)) != -1)
+ if (strictKeyValueSeparators.indexOf(line
+ .charAt(valueIndex)) != -1)
valueIndex++;
- // Skip over white space after other separators if any
+ // Skip over white space after other separators if any
while (valueIndex < len) {
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1)
break;
valueIndex++;
}
String key = line.substring(keyStart, separatorIndex);
- String value = (separatorIndex < len) ? line.substring(valueIndex, len) : "";
+ String value = (separatorIndex < len) ? line.substring(
+ valueIndex, len) : "";
// Convert then store key and value
// NETSCAPE: no need to convert escape characters
- // key = loadConvert(key);
- // value = loadConvert(value);
+ // key = loadConvert(key);
+ // value = loadConvert(value);
put(key, value);
}
}
@@ -257,8 +269,8 @@ public class SimpleProperties extends Hashtable {
}
/*
- * Returns true if the given line is a line that must
- * be appended to the next line
+ * Returns true if the given line is a line that must be appended to the
+ * next line
*/
private boolean continueLine(String line) {
int slashCount = 0;
@@ -270,8 +282,8 @@ public class SimpleProperties extends Hashtable {
}
/*
- * Converts encoded \\uxxxx to unicode chars
- * and changes special saved chars to their original forms
+ * Converts encoded \\uxxxx to unicode chars and changes special saved chars
+ * to their original forms
*/
private String loadConvert(String theString) {
char aChar;
@@ -327,10 +339,14 @@ public class SimpleProperties extends Hashtable {
}
outBuffer.append((char) value);
} else {
- if (aChar == 't') aChar = '\t';
- else if (aChar == 'r') aChar = '\r';
- else if (aChar == 'n') aChar = '\n';
- else if (aChar == 'f') aChar = '\f';
+ if (aChar == 't')
+ aChar = '\t';
+ else if (aChar == 'r')
+ aChar = '\r';
+ else if (aChar == 'n')
+ aChar = '\n';
+ else if (aChar == 'f')
+ aChar = '\f';
outBuffer.append(aChar);
}
} else
@@ -340,9 +356,8 @@ public class SimpleProperties extends Hashtable {
}
/*
- * Converts unicodes to encoded \\uxxxx
- * and writes out any of the characters in specialSaveChars
- * with a preceding slash
+ * Converts unicodes to encoded \\uxxxx and writes out any of the characters
+ * in specialSaveChars with a preceding slash
*/
private String saveConvert(String theString) {
char aChar;
@@ -396,18 +411,20 @@ public class SimpleProperties extends Hashtable {
}
/**
- * Calls the <code>store(OutputStream out, String header)</code> method
- * and suppresses IOExceptions that were thrown.
- *
+ * Calls the <code>store(OutputStream out, String header)</code> method and
+ * suppresses IOExceptions that were thrown.
+ *
* @deprecated This method does not throw an IOException if an I/O error
- * occurs while saving the property list. As of JDK 1.2, the preferred
- * way to save a properties list is via the <code>store(OutputStream out,
+ * occurs while saving the property list. As of JDK 1.2, the
+ * preferred way to save a properties list is via the
+ * <code>store(OutputStream out,
* String header)</code> method.
- *
- * @param out an output stream.
- * @param header a description of the property list.
- * @exception ClassCastException if this <code>Properties</code> object
- * contains any keys or values that are not <code>Strings</code>.
+ *
+ * @param out an output stream.
+ * @param header a description of the property list.
+ * @exception ClassCastException if this <code>Properties</code> object
+ * contains any keys or values that are not
+ * <code>Strings</code>.
*/
public synchronized void save(OutputStream out, String header) {
try {
@@ -422,44 +439,45 @@ public class SimpleProperties extends Hashtable {
* for loading into a <code>Properties</code> table using the
* <code>load</code> method.
* <p>
- * Properties from the defaults table of this <code>Properties</code>
- * table (if any) are <i>not</i> written out by this method.
+ * Properties from the defaults table of this <code>Properties</code> table
+ * (if any) are <i>not</i> written out by this method.
* <p>
* If the header argument is not null, then an ASCII <code>#</code>
- * character, the header string, and a line separator are first written
- * to the output stream. Thus, the <code>header</code> can serve as an
+ * character, the header string, and a line separator are first written to
+ * the output stream. Thus, the <code>header</code> can serve as an
* identifying comment.
* <p>
* Next, a comment line is always written, consisting of an ASCII
- * <code>#</code> character, the current date and time (as if produced
- * by the <code>toString</code> method of <code>Date</code> for the
- * current time), and a line separator as generated by the Writer.
+ * <code>#</code> character, the current date and time (as if produced by
+ * the <code>toString</code> method of <code>Date</code> for the current
+ * time), and a line separator as generated by the Writer.
* <p>
* Then every entry in this <code>Properties</code> table is written out,
* one per line. For each entry the key string is written, then an ASCII
- * <code>=</code>, then the associated element string. Each character of
- * the element string is examined to see whether it should be rendered as
- * an escape sequence. The ASCII characters <code>\</code>, tab, newline,
- * and carriage return are written as <code>\\</code>, <code>\t</code>,
- * <code>\n</code>, and <code>\r</code>, respectively. Characters less
- * than <code>\u0020</code> and characters greater than
- * <code>\u007E</code> are written as <code>\\u</code><i>xxxx</i> for
- * the appropriate hexadecimal value <i>xxxx</i>. Space characters, but
- * not embedded or trailing space characters, are written with a preceding
- * <code>\</code>. The key and value characters <code>#</code>,
- * <code>!</code>, <code>=</code>, and <code>:</code> are written with a
- * preceding slash to ensure that they are properly loaded.
+ * <code>=</code>, then the associated element string. Each character of the
+ * element string is examined to see whether it should be rendered as an
+ * escape sequence. The ASCII characters <code>\</code>, tab, newline, and
+ * carriage return are written as <code>\\</code>, <code>\t</code>,
+ * <code>\n</code>, and <code>\r</code>, respectively. Characters less than
+ * <code>\u0020</code> and characters greater than <code>\u007E</code> are
+ * written as <code>\\u</code><i>xxxx</i> for the appropriate hexadecimal
+ * value <i>xxxx</i>. Space characters, but not embedded or trailing space
+ * characters, are written with a preceding <code>\</code>. The key and
+ * value characters <code>#</code>, <code>!</code>, <code>=</code>, and
+ * <code>:</code> are written with a preceding slash to ensure that they are
+ * properly loaded.
* <p>
- * After the entries have been written, the output stream is flushed. The
+ * After the entries have been written, the output stream is flushed. The
* output stream remains open after this method returns.
- *
- * @param out an output stream.
- * @param header a description of the property list.
- * @exception ClassCastException if this <code>Properties</code> object
- * contains any keys or values that are not <code>Strings</code>.
+ *
+ * @param out an output stream.
+ * @param header a description of the property list.
+ * @exception ClassCastException if this <code>Properties</code> object
+ * contains any keys or values that are not
+ * <code>Strings</code>.
*/
public synchronized void store(OutputStream out, String header)
- throws IOException {
+ throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
@@ -470,8 +488,8 @@ public class SimpleProperties extends Hashtable {
String key = (String) e.nextElement();
String val = (String) get(key);
- // key = saveConvert(key);
- // val = saveConvert(val);
+ // key = saveConvert(key);
+ // val = saveConvert(val);
writeln(awriter, key + "=" + val);
}
awriter.flush();
@@ -487,16 +505,17 @@ public class SimpleProperties extends Hashtable {
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns
* <code>null</code> if the property is not found.
- *
- * @param key the property key.
- * @return the value in this property list with the specified key value.
- * @see java.util.Properties#defaults
+ *
+ * @param key the property key.
+ * @return the value in this property list with the specified key value.
+ * @see java.util.Properties#defaults
*/
public String getProperty(String key) {
Object oval = super.get(key);
String sval = (oval instanceof String) ? (String) oval : null;
- return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
+ return ((sval == null) && (defaults != null)) ? defaults
+ .getProperty(key) : sval;
}
/**
@@ -504,12 +523,12 @@ public class SimpleProperties extends Hashtable {
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns the
* default value argument if the property is not found.
- *
- * @param key the hashtable key.
- * @param defaultValue a default value.
- *
- * @return the value in this property list with the specified key value.
- * @see java.util.Properties#defaults
+ *
+ * @param key the hashtable key.
+ * @param defaultValue a default value.
+ *
+ * @return the value in this property list with the specified key value.
+ * @see java.util.Properties#defaults
*/
public String getProperty(String key, String defaultValue) {
String val = getProperty(key);
@@ -520,11 +539,11 @@ public class SimpleProperties extends Hashtable {
/**
* Returns an enumeration of all the keys in this property list, including
* the keys in the default property list.
- *
- * @return an enumeration of all the keys in this property list, including
- * the keys in the default property list.
- * @see java.util.Enumeration
- * @see java.util.Properties#defaults
+ *
+ * @return an enumeration of all the keys in this property list, including
+ * the keys in the default property list.
+ * @see java.util.Enumeration
+ * @see java.util.Properties#defaults
*/
public Enumeration propertyNames() {
Hashtable h = new Hashtable();
@@ -534,10 +553,10 @@ public class SimpleProperties extends Hashtable {
}
/**
- * Prints this property list out to the specified output stream.
- * This method is useful for debugging.
- *
- * @param out an output stream.
+ * Prints this property list out to the specified output stream. This method
+ * is useful for debugging.
+ *
+ * @param out an output stream.
*/
public void list(PrintStream out) {
out.println("-- listing properties --");
@@ -556,13 +575,13 @@ public class SimpleProperties extends Hashtable {
}
/**
- * Prints this property list out to the specified output stream.
- * This method is useful for debugging.
- *
- * @param out an output stream.
- * @since JDK1.1
+ * Prints this property list out to the specified output stream. This method
+ * is useful for debugging.
+ *
+ * @param out an output stream.
+ * @since JDK1.1
*/
-
+
/*
* Rather than use an anonymous inner class to share common code, this
* method is duplicated in order to ensure that a non-1.1 compiler can
@@ -586,6 +605,7 @@ public class SimpleProperties extends Hashtable {
/**
* Enumerates all key/value pairs in the specified hastable.
+ *
* @param h the hashtable
*/
private synchronized void enumerate(Hashtable h) {
@@ -601,14 +621,14 @@ public class SimpleProperties extends Hashtable {
/**
* Convert a nibble to a hex character
- * @param nibble the nibble to convert.
+ *
+ * @param nibble the nibble to convert.
*/
private static char toHex(int nibble) {
return hexDigit[(nibble & 0xF)];
}
/** A table of hex digits */
- private static final char[] hexDigit = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
- };
+ private static final char[] hexDigit = { '0', '1', '2', '3', '4', '5', '6',
+ '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
}
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
index 2b472c029..cfd54c347 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
@@ -17,19 +17,18 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import com.netscape.certsrv.base.ISourceConfigStore;
-
/**
- * This class is is a wrapper to hide the Properties methods from
- * the PropConfigStore. Lucky for us, Properties already implements
- * almost every thing ISourceConfigStore requires.
+ * This class is is a wrapper to hide the Properties methods from the
+ * PropConfigStore. Lucky for us, Properties already implements almost every
+ * thing ISourceConfigStore requires.
*
* @version $Revision$, $Date$
* @see java.util.Properties
*/
-public class SourceConfigStore extends SimpleProperties implements ISourceConfigStore {
+public class SourceConfigStore extends SimpleProperties implements
+ ISourceConfigStore {
/**
*
@@ -39,7 +38,7 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
/**
* Retrieves a property from the config store
* <P>
- *
+ *
* @param name property name
* @return property value
*/
@@ -50,7 +49,7 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
/**
* Puts a property into the config store.
* <P>
- *
+ *
* @param name property name
* @param value property value
*/
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java b/pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java
index 83c74ebc1..b389b441a 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.util.Vector;
import com.netscape.certsrv.apps.CMS;
@@ -25,7 +24,6 @@ import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.certsrv.base.ISubsystem;
-
/**
* A class represents a subsystem loader.
* <P>
@@ -34,7 +32,7 @@ import com.netscape.certsrv.base.ISubsystem;
* @version $Revision$, $Date$
*/
public class SubsystemLoader {
-
+
private static final String PROP_SUBSYSTEM = "subsystem";
private static final String PROP_CLASSNAME = "class";
private static final String PROP_ID = "id";
@@ -62,14 +60,14 @@ public class SubsystemLoader {
if (className == null)
break;
try {
- ISubsystem sub = (ISubsystem) Class.forName(
- className).newInstance();
+ ISubsystem sub = (ISubsystem) Class.forName(className)
+ .newInstance();
sub.setId(id);
v.addElement(sub);
} catch (Exception e) {
- throw new EBaseException(
- CMS.getUserMessage("CMS_BASE_LOAD_FAILED", className));
+ throw new EBaseException(CMS.getUserMessage(
+ "CMS_BASE_LOAD_FAILED", className));
}
}
return v;
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java b/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java
index ad8580187..d8a519cf5 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java
@@ -17,12 +17,10 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.util.Hashtable;
import com.netscape.certsrv.base.ISubsystem;
-
public class SubsystemRegistry extends Hashtable {
/**
*