From cb9c98fe998a2f506559358fa5f0ac91604d70f0 Mon Sep 17 00:00:00 2001 From: tknall Date: Wed, 11 Apr 2007 10:05:20 +0000 Subject: jdk-1.5 dependency removed git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@62 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/ldap/api/LDAPAPIException.java | 1 - .../wag/egov/egiz/ldap/api/LDAPAPIFactory.java | 9 ++++-- .../wag/egov/egiz/ldap/api/LDAPAPIFactoryImpl.java | 8 ++--- .../egov/egiz/ldap/client/LDAPClientFactory.java | 15 ++++----- .../egiz/ldap/client/LDAPClientFactoryImpl.java | 7 ++-- .../wag/egov/egiz/ldap/client/LDAPClientImpl.java | 1 - .../wag/egov/egiz/ldap/client/LDAPMapping.java | 1 - .../egov/egiz/ldap/client/LDAPMappingStore.java | 37 +++++++++++----------- 8 files changed, 40 insertions(+), 39 deletions(-) (limited to 'src/main/java/at/knowcenter') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIException.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIException.java index 4f2e363..0436609 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIException.java @@ -43,7 +43,6 @@ public class LDAPAPIException extends Exception { } - @Override public String toString() { if (exception != null) { return exception.toString(); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactory.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactory.java index 6b71551..a54d861 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactory.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactory.java @@ -4,6 +4,9 @@ import iaik.asn1.ObjectID; import iaik.security.ecc.provider.ECCProvider; import iaik.security.provider.IAIK; import iaik.utils.RFC2253NameParser; + +import org.apache.log4j.Logger; + import at.knowcenter.wag.egov.egiz.ldap.client.LDAPIssuerNameFilter; import at.knowcenter.wag.egov.egiz.sig.LDAPAPI; @@ -13,13 +16,15 @@ import at.knowcenter.wag.egov.egiz.sig.LDAPAPI; public abstract class LDAPAPIFactory { private static LDAPAPIFactory ldapAPIfactoryInstance; + private final Logger log = Logger.getLogger(LDAPAPIFactory.class); protected LDAPAPIFactory() { IAIK.addAsProvider(); ECCProvider.addAsProvider(); - // Does not conform with PKIX, but is used by belgium citizen card - RFC2253NameParser.register("SERIALNUMBER", ObjectID.serialNumber); + // Does not conform with PKIX, but is used by belgium citizen card +// log.info("Registering RDN \"SERIALNUMBER\" as " + ObjectID.serialNumber + "."); + RFC2253NameParser.register("SERIALNUMBER", ObjectID.serialNumber); } public static synchronized LDAPAPIFactory getInstance(LDAPIssuerNameFilter ldapIssuerNameFilter) { diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactoryImpl.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactoryImpl.java index 9750270..dab42ee 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactoryImpl.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIFactoryImpl.java @@ -15,12 +15,13 @@ public class LDAPAPIFactoryImpl extends LDAPAPIFactory { private static final Logger log = Logger.getLogger(LDAPAPIFactoryImpl.class); // mapping - private Hashtable ldapImpls; +// private Hashtable ldapImpls; + private Hashtable ldapImpls; private LDAPIssuerNameFilter ldapIssuerNameFilter; protected LDAPAPIFactoryImpl(LDAPIssuerNameFilter ldapIssuerNameFilter) { - this.ldapImpls = new Hashtable(); + this.ldapImpls = new Hashtable(); this.ldapIssuerNameFilter = ldapIssuerNameFilter; } @@ -52,13 +53,12 @@ public class LDAPAPIFactoryImpl extends LDAPAPIFactory { return ldapAPIImpl; } - @Override public synchronized LDAPAPI createLDAPAPI(String implClassURI) throws LDAPAPIException { if (implClassURI == null || implClassURI.length() == 0) { // use internal implementation implClassURI = LDAPAPIImpl.class.getName(); } - LDAPAPI impl = this.ldapImpls.get(implClassURI); + LDAPAPI impl = (LDAPAPI) this.ldapImpls.get(implClassURI); if (impl == null) { impl = this.instantiatelAPIImpl(implClassURI); this.ldapImpls.put(implClassURI, impl); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactory.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactory.java index f8ce4f2..0d51f96 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactory.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactory.java @@ -20,7 +20,8 @@ public abstract class LDAPClientFactory { * Mapping of category/identifier to LDAPClientFactory. * Allows the usage of multiple independently configured LDAPClientFactoryImpls. */ - private static Hashtable ldapClientFactoryInstances = new Hashtable(); +// private static Hashtable ldapClientFactoryInstances = new Hashtable(); + private static Hashtable ldapClientFactoryInstances = new Hashtable(); private LDAPMappingStore ldapMappingStore; @@ -44,18 +45,16 @@ public abstract class LDAPClientFactory { return !this.ldapMappingStore.isEmpty(); } - public synchronized void registerMappings(Iterable iterable) { +// public synchronized void registerMappings(Iterable iterable) { + public synchronized void registerMappings(Iterable iterable) { if (!iterable.iterator().hasNext()) { log.warn("There were no ldap mappings provided."); } this.ldapMappingStore.storeMappings(iterable); } - public synchronized void registerMapping(LDAPMapping... ldapMappings) { - if (ldapMappings.length == 0) { - log.warn("There were no ldap mappings provided."); - } - this.ldapMappingStore.storeMapping(ldapMappings); + public synchronized void registerMapping(LDAPMapping ldapMapping) { + this.ldapMappingStore.storeMapping(ldapMapping); } public void setLDAPIssuerNameFilter(LDAPIssuerNameFilter filter) throws LDAPException { @@ -70,7 +69,7 @@ public abstract class LDAPClientFactory { } public static synchronized LDAPClientFactory getInstance(String idenfifier) { - LDAPClientFactory ldapClientFactoryInstance = ldapClientFactoryInstances.get(idenfifier); + LDAPClientFactory ldapClientFactoryInstance = (LDAPClientFactory) ldapClientFactoryInstances.get(idenfifier); if (ldapClientFactoryInstance == null) { ldapClientFactoryInstance = new LDAPClientFactoryImpl(); ldapClientFactoryInstances.put(idenfifier, ldapClientFactoryInstance); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactoryImpl.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactoryImpl.java index b4d0fa7..ad19df5 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactoryImpl.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientFactoryImpl.java @@ -16,10 +16,11 @@ public final class LDAPClientFactoryImpl extends LDAPClientFactory { private final Logger log = Logger.getLogger(getClass()); - private Hashtable ldapClients; +// private Hashtable ldapClients; + private Hashtable ldapClients; protected LDAPClientFactoryImpl() { - this.ldapClients = new Hashtable(); + this.ldapClients = new Hashtable(); } public static String rfc2253Name2Domain(Name name) { @@ -71,7 +72,7 @@ public final class LDAPClientFactoryImpl extends LDAPClientFactory { if (issuerName == null || issuerName.length() == 0) { throw new NullPointerException("Issuer name must not be null or empty."); } - LDAPClient ldapClient = ldapClients.get(issuerName); + LDAPClient ldapClient = (LDAPClient) ldapClients.get(issuerName); if (ldapClient == null) { ldapClient = instantiateLDAPClient(issuerName); ldapClients.put(issuerName, ldapClient); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientImpl.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientImpl.java index 2ba802d..2794c99 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientImpl.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPClientImpl.java @@ -180,7 +180,6 @@ public final class LDAPClientImpl implements LDAPClient { } } - @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("ldapURL = ").append(this.url); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMapping.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMapping.java index d341155..c232adc 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMapping.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMapping.java @@ -147,7 +147,6 @@ public class LDAPMapping { } } - @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("issuerName = ").append(this.issuerName != null ? this.issuerName.getName() : null); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMappingStore.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMappingStore.java index 324e859..2cd51ba 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMappingStore.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/client/LDAPMappingStore.java @@ -14,12 +14,13 @@ import org.apache.log4j.Logger; */ public class LDAPMappingStore { - private Hashtable storedMappings; +// private Hashtable storedMappings; + private Hashtable storedMappings; private LDAPIssuerNameFilter issuerNameFilter; private Logger log = Logger.getLogger(getClass()); public LDAPMappingStore(LDAPIssuerNameFilter issuerNameFilter) { - this.storedMappings = new Hashtable(); + this.storedMappings = new Hashtable(); this.issuerNameFilter = issuerNameFilter; } @@ -28,7 +29,7 @@ public class LDAPMappingStore { } public void clearStore() { - this.storedMappings = new Hashtable(); + this.storedMappings = new Hashtable(); } public boolean isEmpty() { @@ -39,25 +40,23 @@ public class LDAPMappingStore { return this.issuerNameFilter != null; } - public void storeMapping(LDAPMapping... mappings) { - for (LDAPMapping mapping : mappings) { - Name name = mapping.getIssuerName(); - if (issuerNameFilter != null) { - name = this.issuerNameFilter.applyFilter(name); - } - if (this.storedMappings.containsKey(name)) { - log.warn("Skipping mapping \"" + mapping + "\" because is has already been stored under \"" + name.getName() + "\"."); - } else { - log.debug("Storing mapping \"" + mapping + "\" under \"" + name.getName() + "\"."); - this.storedMappings.put(name, mapping); - } + public void storeMapping(LDAPMapping mapping) { + Name name = mapping.getIssuerName(); + if (issuerNameFilter != null) { + name = this.issuerNameFilter.applyFilter(name); + } + if (this.storedMappings.containsKey(name)) { + log.warn("Skipping mapping \"" + mapping + "\" because is has already been stored under \"" + name.getName() + "\"."); + } else { + log.debug("Storing mapping \"" + mapping + "\" under \"" + name.getName() + "\"."); + this.storedMappings.put(name, mapping); } } - public void storeMappings(Iterable iterable) { - Iterator it = iterable.iterator(); + public void storeMappings(Iterable iterable) { + Iterator it = iterable.iterator(); while (it.hasNext()) { - this.storeMapping(it.next()); + this.storeMapping((LDAPMapping) it.next()); } } @@ -65,7 +64,7 @@ public class LDAPMappingStore { if (issuerNameFilter != null) { name = this.issuerNameFilter.applyFilter(name); } - return this.storedMappings.get(name); + return (LDAPMapping) this.storedMappings.get(name); } public LDAPMapping getMapping(String nameString) throws LDAPException { -- cgit v1.2.3