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.java200
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java63
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/JDialogPasswordCallback.java52
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java170
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java234
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java10
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SubsystemLoader.java4
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java3
8 files changed, 334 insertions, 402 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 8f29fc1b..905f7c8d 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,11 @@ 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
+ * 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 {
@@ -51,45 +49,40 @@ public class ArgBlock implements IArgBlock {
/*==========================================================
* 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-----";
+ 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<String, Object> mArgs = new Hashtable<String, Object>();
- private String mType = "unspecified-argblock";
+ private String mType = "unspecified-argblock";
/*==========================================================
* 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<String, String> 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<String, String> httpReq) {
- populate(httpReq);
- }
+ populate(httpReq);
+ }
- private void populate(Hashtable<String, String> httpReq) {
+ private void populate(Hashtable<String, String> httpReq) {
// Add all parameters from the request
Enumeration<String> e = httpReq.keys();
@@ -115,12 +108,12 @@ public class ArgBlock implements IArgBlock {
/**
* 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 +123,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds string-based value into this argument block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -145,14 +138,14 @@ 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;
@@ -163,14 +156,14 @@ public class ArgBlock implements IArgBlock {
/**
* 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,14 +174,14 @@ 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) {
@@ -196,20 +189,20 @@ public class ArgBlock implements IArgBlock {
CMS.getUserMessage("CMS_BASE_INVALID_ATTR_TYPE", n, e.toString()));
}
} else {
- CMS.traceHashKey(mType, n, "<notpresent>");
+ 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 +216,13 @@ 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 {
+ throws EBaseException {
String v = (String) mArgs.get(n);
if (v != null) {
@@ -250,7 +243,7 @@ public class ArgBlock implements IArgBlock {
/**
* 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 +258,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
@@ -280,7 +273,7 @@ public class ArgBlock implements IArgBlock {
/**
* 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,18 +288,18 @@ 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;
@@ -317,34 +310,34 @@ 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>
*/
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 +352,9 @@ public class ArgBlock implements IArgBlock {
}
/**
- * Gets PKCS10 request. This pkcs10 attribute does not
+ * 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,22 +363,22 @@ 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"));
+ 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()));
+ CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
}
} else {
- CMS.traceHashKey(mType, name, "<notpresent>");
+ CMS.traceHashKey(mType, name, "<notpresent>");
throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
}
@@ -393,19 +386,19 @@ public class ArgBlock implements IArgBlock {
}
/**
- * Gets PKCS10 request. This pkcs10 attribute does not
+ * 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,30 +419,30 @@ 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"));
+ 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()));
+ CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE", name, e.toString()));
}
} else {
throw new EBaseException(CMS.getUserMessage("CMS_BASE_ATTRIBUTE_NOT_FOUND", name));
@@ -460,19 +453,19 @@ 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 {
+ 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 +488,17 @@ 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 +515,7 @@ public class ArgBlock implements IArgBlock {
/**
* Sets argument into this block.
- *
+ *
* @param name key
* @param ob value
*/
@@ -532,18 +525,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 +545,7 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves a list of argument keys.
- *
+ *
* @return a list of string-based keys
*/
public Enumeration<String> getElements() {
@@ -561,7 +554,7 @@ public class ArgBlock implements IArgBlock {
/**
* Retrieves a list of argument keys.
- *
+ *
* @return a list of string-based keys
*/
public Enumeration<String> elements() {
@@ -570,7 +563,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds long-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -581,7 +574,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds integer-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -592,7 +585,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds boolean-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @return value
@@ -607,7 +600,7 @@ public class ArgBlock implements IArgBlock {
/**
* Adds integer-type arguments to this block.
- *
+ *
* @param n key
* @param v value
* @param radix radix
@@ -621,16 +614,15 @@ public class ArgBlock implements IArgBlock {
* 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 +647,7 @@ public class ArgBlock implements IArgBlock {
// header.
if (!(head == -1 && trail == -1)) {
header = CERT_REQUEST_HEADER;
-
+
}
}
@@ -695,22 +687,22 @@ 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 {
+ throws EBaseException {
PKCS10 pkcs10 = null;
try {
byte[] decodedBytes = com.netscape.osutil.OSUtil.AtoB(base64Request);
pkcs10 = new PKCS10(decodedBytes);
- } catch (NoSuchProviderException e) {
+ } catch (NoSuchProviderException e) {
throw new EBaseException(CMS.getUserMessage("CMS_BASE_INTERNAL_ERROR", e.toString()));
- } catch (IOException e) {
+ } 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()));
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 a4b37114..1278ed4f 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,21 +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
+ * 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
+public class FileConfigStore extends PropConfigStore implements
IConfigStore {
/**
@@ -59,7 +56,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,7 +64,7 @@ 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",
+ throw new EBaseException(CMS.getUserMessage("CMS_BASE_NO_CONFIG_FILE",
mFile.getPath()));
}
load(fileName);
@@ -76,7 +73,7 @@ public class FileConfigStore extends PropConfigStore implements
/**
* Loads property file into memory.
* <P>
- *
+ *
* @param fileName file name
* @exception EBaseException failed to load configuration
*/
@@ -96,8 +93,8 @@ public class FileConfigStore extends PropConfigStore implements
* <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) {
@@ -105,57 +102,55 @@ public class FileConfigStore extends PropConfigStore implements
Long.toString(System.currentTimeMillis()));
try {
- if( Utils.isNT() ) {
+ if (Utils.isNT()) {
// NT is very picky on the path
- Utils.exec( "copy " +
- mFile.getAbsolutePath().replace( '/', '\\' ) +
+ Utils.exec("copy " +
+ mFile.getAbsolutePath().replace('/', '\\') +
" " +
- newName.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,7 +168,7 @@ public class FileConfigStore extends PropConfigStore implements
}
private void printSubStore(PrintWriter writer, IConfigStore store,
- String name) throws EBaseException,
+ String name) throws EBaseException,
IOException {
// print keys
Enumeration e0 = store.getPropertyNames();
@@ -220,7 +215,7 @@ public class FileConfigStore extends PropConfigStore implements
}
v.removeElementAt(j);
printSubStore(writer, store.getSubStore(pname), name +
- pname + ".");
+ 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 cd695967..7a770946 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);
}
@@ -92,7 +90,7 @@ public class JDialogPasswordCallback implements PasswordCallback {
* 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");
@@ -122,7 +120,7 @@ public class JDialogPasswordCallback implements PasswordCallback {
//warning.setHighlighter(null);
contentPane.add(warning, c);
}
-
+
String prompt = getPrompt(info);
JLabel label = new JLabel(prompt);
@@ -141,24 +139,24 @@ public class JDialogPasswordCallback implements PasswordCallback {
// 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.setFont(new Font("Monospaced", Font.PLAIN,
pwField.getFont().getSize()));
pwField.setEchoChar('*');
pwField.addActionListener(getPasswordListener);
@@ -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);
@@ -217,10 +215,10 @@ public class JDialogPasswordCallback implements PasswordCallback {
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,7 +228,7 @@ 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!
@@ -254,7 +252,7 @@ public class JDialogPasswordCallback implements PasswordCallback {
CryptoManager manager;
CryptoManager.InitializationValues iv = new
- CryptoManager.InitializationValues(args[0]);
+ 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 be8e7007..ad56c2cd 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,24 @@ 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
+ * 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.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public class PropConfigStore implements IConfigStore, Cloneable {
@@ -76,14 +76,14 @@ 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.
* <P>
- *
+ *
* @param storeName property store name
* @exception EBaseException failed to create configuration
*/
@@ -98,7 +98,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
* 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 +111,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Returns the name of this store.
* <P>
- *
+ *
* @return store name
*/
public String getName() {
@@ -121,7 +121,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves a property from the configuration file.
* <P>
- *
+ *
* @param name property name
* @return property value
*/
@@ -130,10 +130,10 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * Retrieves a property from the configuration file. Does not prepend
+ * 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
*/
@@ -146,7 +146,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
* values wont be updated to the file until save
* method is invoked.
* <P>
- *
+ *
* @param name property name
* @param value property value
*/
@@ -156,16 +156,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 +179,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves the hashtable where all the properties are kept.
- *
+ *
* @return hashtable
*/
public Hashtable hashtable() {
@@ -202,7 +203,7 @@ 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
* <P>
- *
+ *
* @param h the hashtable
*/
private synchronized void enumerate(Hashtable h) {
@@ -224,7 +225,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 +235,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 +245,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,7 +254,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String str = (String) get(name);
if (str == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
// should we check for empty string ?
@@ -267,14 +268,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
} catch (java.io.UnsupportedEncodingException e) {
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 +288,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,17 +305,17 @@ 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>");
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
return arr;
@@ -323,34 +324,33 @@ 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
- *
+ * 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
*/
@@ -368,13 +368,13 @@ public class PropConfigStore implements IConfigStore, Cloneable {
put(name, output.toString("8859_1"));
} catch (IOException e) {
System.out.println("Warning: base-64 encoding of configuration " +
- "information failed");
+ "information failed");
}
}
/**
* Retrieves boolean-based property value.
- *
+ *
* @param name property key
* @return boolean value
* @exception EBaseException failed to retrieve
@@ -383,7 +383,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
if (value.length() == 0) {
@@ -401,14 +401,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* 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 +418,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 +439,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves integer value.
- *
+ *
* @param name property key
* @return property value
* @exception EBaseException failed to retrieve value
@@ -448,14 +448,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
+ 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));
}
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"));
@@ -464,7 +464,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Retrieves integer value.
- *
+ *
* @param name property key
* @param defval default value
* @return property value
@@ -480,14 +480,14 @@ 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 +498,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,7 +507,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
String value = (String) get(name);
if (value == null) {
- CMS.traceHashKey(mDebugType,getFullName(name),"<notpresent>");
+ CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>");
throw new EPropertyNotFound(CMS.getUserMessage("CMS_BASE_GET_PROPERTY_FAILED", getName() + "." + name));
}
if (value.length() == 0) {
@@ -527,14 +527,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* 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 +549,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Puts a big integer value.
- *
+ *
* @param name property key
* @param val default value
*/
@@ -560,7 +560,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Creates a new sub store.
* <P>
- *
+ *
* @param name substore name
* @return substore
*/
@@ -581,13 +581,14 @@ public class PropConfigStore implements IConfigStore, Cloneable {
}
/**
- * 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
@@ -607,18 +608,21 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* 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,
+ *
* <PRE>
- * cms.ldap=kms.ldap
+ * cms.ldap = kms.ldap
* </PRE>
* <P>
- *
+ *
* @param name substore name
* @return substore
*/
@@ -639,7 +643,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 +672,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
/**
* Returns a list of sub store names.
* <P>
- *
+ *
* @return list of substore names
*/
public Enumeration getSubStoreNames() {
@@ -698,7 +702,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
* Retrieves the source configuration store where
* the properties are stored.
* <P>
- *
+ *
* @return source configuration store
*/
public ISourceConfigStore getSourceConfigStore() {
@@ -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() {
@@ -752,7 +756,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
while (subs.hasMoreElements()) {
IConfigStore sub = (IConfigStore)
- subs.nextElement();
+ subs.nextElement();
IConfigStore newSub = that.makeSubStore(
sub.getName());
Enumeration props = sub.getPropertyNames();
@@ -761,8 +765,8 @@ public class PropConfigStore implements IConfigStore, Cloneable {
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 4eb1c839..9bc2a0f0 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,28 +30,19 @@ 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.
* <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.
- *
- * 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
- * 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.
- *
+ * 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 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.
+ *
*/
-public class SimpleProperties extends Hashtable<String,String> {
+public class SimpleProperties extends Hashtable<String, String> {
/**
*
@@ -62,7 +52,7 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* A property list that contains default values for any keys not
* found in this property list.
- *
+ *
* @serial
*/
protected SimpleProperties defaults;
@@ -76,8 +66,8 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* Creates an empty property list with the specified defaults.
- *
- * @param defaults the defaults.
+ *
+ * @param defaults the defaults.
*/
public SimpleProperties(SimpleProperties defaults) {
this.defaults = defaults;
@@ -87,7 +77,8 @@ public class SimpleProperties extends Hashtable<String,String> {
* 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
+ *
+ * @since JDK1.2
*/
public synchronized Object setProperty(String key, String value) {
return put(key, value);
@@ -104,75 +95,54 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* 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).
+ * 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).
* <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.
+ * 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.
* <p>
- * As an example, each of the following four lines specifies the key
- * <code>"Truth"</code> and the associated element value
- * <code>"Beauty"</code>:
+ * 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.
+ *
+ * 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.
*/
public synchronized void load(InputStream inStream) throws IOException {
@@ -232,12 +202,12 @@ public class SimpleProperties extends Hashtable<String,String> {
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)
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;
@@ -272,16 +242,16 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* 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 {
@@ -291,49 +261,27 @@ public class SimpleProperties extends Hashtable<String,String> {
}
/**
- * Writes this property list (key and element pairs) in this
- * <code>Properties</code> table to the output stream in a format suitable
- * for loading into a <code>Properties</code> table using the
- * <code>load</code> method.
+ * Writes this property list (key and element pairs) in this <code>Properties</code> table to the output stream in a format suitable
+ * 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
- * identifying comment.
+ * 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 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.
+ * 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.
* <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.
+ * 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.
* <p>
- * 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>.
+ * 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>.
*/
public synchronized void store(OutputStream out, String header)
- throws IOException {
+ throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
@@ -341,8 +289,8 @@ public class SimpleProperties extends Hashtable<String,String> {
writeln(awriter, "#" + header);
writeln(awriter, "#" + new Date().toString());
for (Enumeration<String> e = keys(); e.hasMoreElements();) {
- String key = e.nextElement();
- String val = get(key);
+ String key = e.nextElement();
+ String val = get(key);
// key = saveConvert(key);
// val = saveConvert(val);
@@ -359,16 +307,15 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* Searches for the property with the specified key in this property list.
* 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
+ * 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
*/
public String getProperty(String key) {
String oval = super.get(key);
- String sval = (oval instanceof String) ? oval : null;
+ String sval = (oval instanceof String) ? oval : null;
return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
}
@@ -378,12 +325,12 @@ public class SimpleProperties extends Hashtable<String,String> {
* 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);
@@ -394,11 +341,11 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* 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<String> propertyNames() {
Hashtable<String, String> h = new Hashtable<String, String>();
@@ -410,8 +357,8 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* Prints this property list out to the specified output stream.
* This method is useful for debugging.
- *
- * @param out an output stream.
+ *
+ * @param out an output stream.
*/
public void list(PrintStream out) {
out.println("-- listing properties --");
@@ -432,11 +379,11 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* Prints this property list out to the specified output stream.
* This method is useful for debugging.
- *
- * @param out an output stream.
- * @since JDK1.1
+ *
+ * @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
@@ -448,7 +395,7 @@ public class SimpleProperties extends Hashtable<String,String> {
enumerate(h);
for (Enumeration<String> e = h.keys(); e.hasMoreElements();) {
- String key = e.nextElement();
+ String key = e.nextElement();
String val = h.get(key);
if (val.length() > 40) {
@@ -460,6 +407,7 @@ public class SimpleProperties extends Hashtable<String,String> {
/**
* Enumerates all key/value pairs in the specified hastable.
+ *
* @param h the hashtable
*/
private synchronized void enumerate(Hashtable<String, String> h) {
@@ -467,7 +415,7 @@ public class SimpleProperties extends Hashtable<String,String> {
defaults.enumerate(h);
}
for (Enumeration<String> e = keys(); e.hasMoreElements();) {
- String key = e.nextElement();
+ String key = e.nextElement();
h.put(key, get(key));
}
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 70af37ce..3c4ec699 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
@@ -17,13 +17,11 @@
// --- 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
+ * the PropConfigStore. Lucky for us, Properties already implements
* almost every thing ISourceConfigStore requires.
*
* @version $Revision$, $Date$
@@ -39,7 +37,7 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
/**
* Retrieves a property from the config store
* <P>
- *
+ *
* @param name property name
* @return property value
*/
@@ -50,10 +48,10 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
/**
* Puts a property into the config store.
* <P>
- *
+ *
* @param name property name
* @param value property value
- * @return
+ * @return
*/
public String put(String name, String value) {
return super.put(name, value); // from Properties->Hashtable
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 83c74ebc..0dbeb4b5 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";
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 72b4105a..adae6049 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.base;
-
import java.util.Hashtable;
import com.netscape.certsrv.base.ISubsystem;
@@ -38,7 +37,7 @@ public class SubsystemRegistry extends Hashtable<String, ISubsystem> {
}
public ISubsystem get(String key) {
- return super.get(key);
+ return super.get(key);
}
}