summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-11-18 13:56:30 -0500
committerAdam Young <ayoung@redhat.com>2012-01-04 11:24:40 -0500
commit04de68d946118b7c56691da707a01334799f17e8 (patch)
treed3ab1ebfe2363a2e96d32afa69c63b1a07b50263
parent6373ddf8fdb15ecd841735910da728e55ad9582a (diff)
downloadpki-04de68d946118b7c56691da707a01334799f17e8.tar.gz
pki-04de68d946118b7c56691da707a01334799f17e8.tar.xz
pki-04de68d946118b7c56691da707a01334799f17e8.zip
typesafety certserv and cmscore
Using interface instead of implementing class
-rw-r--r--pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java1
-rw-r--r--pki/base/ca/src/com/netscape/ca/CertificateAuthority.java6
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java16
-rw-r--r--pki/base/common/src/com/netscape/certsrv/ca/ICRLIssuingPoint.java5
-rw-r--r--pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java5
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/IDBAttrMapper.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/IDBObj.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/IDBSearchResults.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/ModificationSet.java4
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java4
-rw-r--r--pki/base/common/src/com/netscape/cmscore/dbs/CertRecord.java6
-rw-r--r--pki/base/common/src/com/netscape/cmscore/dbs/DBSearchResults.java4
-rw-r--r--pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java15
-rw-r--r--pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java4
-rw-r--r--pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java3
-rw-r--r--pki/base/common/test/com/netscape/cmscore/dbs/RequestRecordDefaultStub.java6
17 files changed, 43 insertions, 44 deletions
diff --git a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
index ef0e949a..0e675be8 100644
--- a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
+++ b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CRLException;
-import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
diff --git a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
index b1bcb680..65374cca 100644
--- a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
+++ b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
@@ -134,7 +134,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
protected ISubsystem mOwner = null;
protected IConfigStore mConfig = null;
protected ILogger mLogger = CMS.getLogger();
- protected Hashtable<String, CRLIssuingPoint> mCRLIssuePoints = new Hashtable<String, CRLIssuingPoint>();
+ protected Hashtable<String, ICRLIssuingPoint> mCRLIssuePoints = new Hashtable<String, ICRLIssuingPoint>();
protected CRLIssuingPoint mMasterCRLIssuePoint = null; // the complete crl.
protected SigningUnit mSigningUnit;
protected SigningUnit mOCSPSigningUnit;
@@ -522,7 +522,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
* <P>
*/
public void shutdown() {
- Enumeration<CRLIssuingPoint> enums = mCRLIssuePoints.elements();
+ Enumeration<ICRLIssuingPoint> enums = mCRLIssuePoints.elements();
while (enums.hasMoreElements()) {
CRLIssuingPoint point = (CRLIssuingPoint)enums.nextElement();
point.shutdown();
@@ -668,7 +668,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
* <P>
* @return security service
*/
- public Enumeration<CRLIssuingPoint> getCRLIssuingPoints() {
+ public Enumeration<ICRLIssuingPoint> getCRLIssuingPoints() {
return mCRLIssuePoints.elements();
}
diff --git a/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java b/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java
index e01d40f8..93dd2502 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java
@@ -34,9 +34,9 @@ public class MetaAttributeDef {
private String mName;
private ObjectIdentifier mOid;
- private Class mValueClass;
- private static Hashtable mNameToAttrDef = new Hashtable();
- private static Hashtable mOidToAttrDef = new Hashtable();
+ private Class<?> mValueClass;
+ private static Hashtable<String, MetaAttributeDef> mNameToAttrDef = new Hashtable<String, MetaAttributeDef>();
+ private static Hashtable<ObjectIdentifier, MetaAttributeDef> mOidToAttrDef = new Hashtable<ObjectIdentifier, MetaAttributeDef>();
private MetaAttributeDef() {
}
@@ -49,7 +49,7 @@ public class MetaAttributeDef {
* @param valueClass attribute value class
* @param oid attribute object identifier
*/
- private MetaAttributeDef(String name, Class valueClass,
+ private MetaAttributeDef(String name, Class<?> valueClass,
ObjectIdentifier oid) {
mName = name;
mValueClass = valueClass;
@@ -72,7 +72,7 @@ public class MetaAttributeDef {
*
* @return returns Java class for the attribute values
*/
- public Class getValueClass() {
+ public Class<?> getValueClass() {
return mValueClass;
}
@@ -98,7 +98,7 @@ public class MetaAttributeDef {
* @exception IllegalArgumentException if name or valueClass are null, or
* conflicting attribute definition already exists
*/
- public static MetaAttributeDef register(String name, Class valueClass,
+ public static MetaAttributeDef register(String name, Class<?> valueClass,
ObjectIdentifier oid) {
if (name == null) {
throw new IllegalArgumentException(
@@ -183,7 +183,7 @@ public class MetaAttributeDef {
*
* @return returns enumeration of the registered attribute names
*/
- public static Enumeration getAttributeNames() {
+ public static Enumeration<String> getAttributeNames() {
return mNameToAttrDef.keys();
}
@@ -193,7 +193,7 @@ public class MetaAttributeDef {
*
* @return returns enumeration of the attribute object identifiers
*/
- public static Enumeration getAttributeNameOids() {
+ public static Enumeration<ObjectIdentifier> getAttributeNameOids() {
return mOidToAttrDef.keys();
}
}
diff --git a/pki/base/common/src/com/netscape/certsrv/ca/ICRLIssuingPoint.java b/pki/base/common/src/com/netscape/certsrv/ca/ICRLIssuingPoint.java
index 82e0961c..dab45fdb 100644
--- a/pki/base/common/src/com/netscape/certsrv/ca/ICRLIssuingPoint.java
+++ b/pki/base/common/src/com/netscape/certsrv/ca/ICRLIssuingPoint.java
@@ -25,6 +25,7 @@ import java.util.Vector;
import netscape.security.x509.CRLExtensions;
import netscape.security.x509.RevokedCertImpl;
+import netscape.security.x509.RevokedCertificate;
import netscape.security.x509.X509CRLImpl;
import com.netscape.certsrv.base.EBaseException;
@@ -295,7 +296,7 @@ public interface ICRLIssuingPoint {
* @param end next after last requested CRL entry
* @return set of all the revoked certificates or null if there are none.
*/
- public Set getRevokedCertificates(int start, int end);
+ public Set<RevokedCertificate> getRevokedCertificates(int start, int end);
/**
* Returns certificate authority.
@@ -373,7 +374,7 @@ public interface ICRLIssuingPoint {
*
* @return split times from CRL generation in milliseconds
*/
- public Vector getSplitTimes();
+ public Vector<Long> getSplitTimes();
/**
* Generates CRL now based on cache or local directory if cache
diff --git a/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java b/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
index 6f7a4961..d86a37dd 100644
--- a/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
+++ b/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
@@ -29,6 +29,7 @@ import netscape.security.x509.X509CertInfo;
import org.mozilla.jss.crypto.SignatureAlgorithm;
+
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.certsrv.base.ISubsystem;
@@ -225,7 +226,7 @@ public interface ICertificateAuthority extends ISubsystem {
*
* @return enumeration of all the CRL issuing points
*/
- public Enumeration getCRLIssuingPoints();
+ public Enumeration<ICRLIssuingPoint> getCRLIssuingPoints();
/**
* Retrieves CRL issuing point with the given identifier.
@@ -280,7 +281,7 @@ public interface ICertificateAuthority extends ISubsystem {
*
* @return name enumeration of all request listeners
*/
- public Enumeration getRequestListenerNames();
+ public Enumeration<String> getRequestListenerNames();
/**
* Retrieves the request listener for issued certificates.
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/IDBAttrMapper.java b/pki/base/common/src/com/netscape/certsrv/dbs/IDBAttrMapper.java
index 7d851b74..173537d6 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/IDBAttrMapper.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/IDBAttrMapper.java
@@ -42,7 +42,7 @@ public interface IDBAttrMapper {
*
* @return a list of supported attribute names
*/
- public Enumeration getSupportedLDAPAttributeNames();
+ public Enumeration<String> getSupportedLDAPAttributeNames();
/**
* Maps object attribute into LDAP attributes.
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/IDBObj.java b/pki/base/common/src/com/netscape/certsrv/dbs/IDBObj.java
index 4be6c340..ab1ce0a4 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/IDBObj.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/IDBObj.java
@@ -39,5 +39,5 @@ public interface IDBObj extends IAttrSet {
*
* @return a list of serializable attribute names
*/
- public Enumeration getSerializableAttrNames();
+ public Enumeration<String> getSerializableAttrNames();
}
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/IDBSearchResults.java b/pki/base/common/src/com/netscape/certsrv/dbs/IDBSearchResults.java
index ab90866b..9f15b808 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/IDBSearchResults.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/IDBSearchResults.java
@@ -28,7 +28,7 @@ import java.util.Enumeration;
*
* @version $Revision$, $Date$
*/
-public interface IDBSearchResults extends Enumeration {
+public interface IDBSearchResults extends Enumeration<Object> {
/**
* Checks if any element is available.
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/ModificationSet.java b/pki/base/common/src/com/netscape/certsrv/dbs/ModificationSet.java
index 4a5592c0..b737f861 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/ModificationSet.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/ModificationSet.java
@@ -33,7 +33,7 @@ public class ModificationSet {
/**
* A list of modifications
*/
- private Vector mods = new Vector();
+ private Vector<Modification> mods = new Vector<Modification>();
/**
* Constructs modification set.
@@ -57,7 +57,7 @@ public class ModificationSet {
*
* @return a list of Modifications
*/
- public Enumeration getModifications() {
+ public Enumeration<Modification> getModifications() {
return mods.elements();
}
}
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
index 2bc9f57b..5da23945 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
@@ -46,6 +46,6 @@ public interface IKeyRecordList {
* @return key records
* @exception EBaseException failed to retrieve key records
*/
- public Enumeration getKeyRecords(int startidx, int endidx)
+ public Enumeration<IKeyRecord> getKeyRecords(int startidx, int endidx)
throws EBaseException;
}
diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java
index 696dc4e1..53a3e37b 100644
--- a/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java
+++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java
@@ -74,7 +74,7 @@ public interface IRequestRecord
*
* @return list of attribute names
*/
- public Enumeration getAttrNames();
+ public Enumeration<String> getAttrNames();
/**
* Gets the request attribute value by the name.
@@ -105,7 +105,7 @@ public interface IRequestRecord
*
* @return attribute list
*/
- public Enumeration getElements();
+ public Enumeration<String> getElements();
// IDBObj.getSerializableAttrNames
//public Enumeration getSerializableAttrNames();
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CertRecord.java b/pki/base/common/src/com/netscape/cmscore/dbs/CertRecord.java
index 321ce618..973ddc4f 100644
--- a/pki/base/common/src/com/netscape/cmscore/dbs/CertRecord.java
+++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertRecord.java
@@ -61,7 +61,7 @@ public class CertRecord implements IDBObj, ICertRecord {
private String mRevokedBy = null;
private Date mRevokedOn = null;
- protected static Vector mNames = new Vector();
+ protected static Vector<String> mNames = new Vector<String>();
static {
mNames.addElement(ATTR_ID);
mNames.addElement(ATTR_META_INFO);
@@ -166,11 +166,11 @@ public class CertRecord implements IDBObj, ICertRecord {
throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", name));
}
- public Enumeration getElements() {
+ public Enumeration<String> getElements() {
return mNames.elements();
}
- public Enumeration getSerializableAttrNames() {
+ public Enumeration<String> getSerializableAttrNames() {
return mNames.elements();
}
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/DBSearchResults.java b/pki/base/common/src/com/netscape/cmscore/dbs/DBSearchResults.java
index c515b330..8b5098dc 100644
--- a/pki/base/common/src/com/netscape/cmscore/dbs/DBSearchResults.java
+++ b/pki/base/common/src/com/netscape/cmscore/dbs/DBSearchResults.java
@@ -40,13 +40,13 @@ import com.netscape.certsrv.logging.ILogger;
public class DBSearchResults implements IDBSearchResults {
private IDBRegistry mRegistry = null;
- private Enumeration mRes = null;
+ private Enumeration<Object> mRes = null;
private ILogger mLogger = CMS.getLogger();
/**
* Constructs search results.
*/
- public DBSearchResults(IDBRegistry registry, Enumeration res) {
+ public DBSearchResults(IDBRegistry registry, Enumeration<Object> res) {
mRegistry = registry;
mRes = res;
}
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
index 6d4e4688..f684718c 100644
--- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
+++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
@@ -22,7 +22,6 @@ import java.math.BigInteger;
import java.security.PublicKey;
import java.util.Date;
import java.util.Enumeration;
-import java.util.Vector;
import netscape.security.x509.X500Name;
@@ -178,9 +177,9 @@ public class KeyRepository extends Repository implements IKeyRepository {
IKeyRecordList list = findKeyRecordsInList(filter,
null, "serialno", 10);
int size = list.getSize();
- Enumeration e = list.getKeyRecords(0, size - 1);
+ Enumeration<IKeyRecord> e = list.getKeyRecords(0, size - 1);
while (e.hasMoreElements()) {
- KeyRecord rec = (KeyRecord) e.nextElement();
+ IKeyRecord rec = e.nextElement();
deleteKeyRecord(rec.getSerialNumber());
}
}
@@ -353,10 +352,10 @@ CMS.debug("filter= " + filter);
return result;
}
- public Enumeration searchKeys(String filter, int maxSize)
+ public Enumeration<Object> searchKeys(String filter, int maxSize)
throws EBaseException {
IDBSSession s = mDBService.createSession();
- Enumeration e = null;
+ Enumeration<Object> e = null;
try {
e = s.search(getDN(), filter, maxSize);
@@ -367,10 +366,10 @@ CMS.debug("filter= " + filter);
return e;
}
- public Enumeration searchKeys(String filter, int maxSize, int timeLimit)
+ public Enumeration<Object> searchKeys(String filter, int maxSize, int timeLimit)
throws EBaseException {
IDBSSession s = mDBService.createSession();
- Enumeration e = null;
+ Enumeration<Object> e = null;
try {
e = s.search(getDN(), filter, maxSize, timeLimit);
@@ -469,8 +468,6 @@ CMS.debug("filter= " + filter);
}
int ltSize = recList.getSizeBeforeJumpTo();
- Vector cList = new Vector(ltSize);
-
CMS.debug("KeyRepository:getLastSerialNumberInRange: ltSize " + ltSize);
int i;
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
index cb5e4cb6..46979715 100644
--- a/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
+++ b/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
@@ -48,7 +48,7 @@ import com.netscape.certsrv.logging.ILogger;
public class ObjectStreamMapper implements IDBAttrMapper {
private String mLdapName = null;
- private Vector v = new Vector();
+ private Vector<String> v = new Vector<String>();
private ILogger mLogger = CMS.getLogger();
/**
@@ -62,7 +62,7 @@ public class ObjectStreamMapper implements IDBAttrMapper {
/**
* Retrieves a list of supported ldap attributes.
*/
- public Enumeration getSupportedLDAPAttributeNames() {
+ public Enumeration<String> getSupportedLDAPAttributeNames() {
return v.elements();
}
diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
index 99764b91..321e32ec 100644
--- a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
+++ b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
@@ -103,7 +103,8 @@ public class RequestRecord
}
// IDBObj.set
- public void set(String name, Object o) {
+ @SuppressWarnings("unchecked")
+ public void set(String name, Object o) {
if (name.equals(IRequestRecord.ATTR_REQUEST_ID))
mRequestId = (RequestId) o;
else if (name.equals(IRequestRecord.ATTR_REQUEST_STATE))
diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/RequestRecordDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/RequestRecordDefaultStub.java
index 0788a0a3..1814c90d 100644
--- a/pki/base/common/test/com/netscape/cmscore/dbs/RequestRecordDefaultStub.java
+++ b/pki/base/common/test/com/netscape/cmscore/dbs/RequestRecordDefaultStub.java
@@ -20,7 +20,7 @@ public class RequestRecordDefaultStub implements IRequestRecord, IDBObj {
return null;
}
- public Enumeration getAttrNames() {
+ public Enumeration<String> getAttrNames() {
return null;
}
@@ -34,11 +34,11 @@ public class RequestRecordDefaultStub implements IRequestRecord, IDBObj {
public void delete(String name) throws EBaseException {
}
- public Enumeration getElements() {
+ public Enumeration<String> getElements() {
return null;
}
- public Enumeration getSerializableAttrNames() {
+ public Enumeration<String> getSerializableAttrNames() {
return null;
}
}