diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-07-14 11:42:29 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-07-14 11:42:29 +0000 |
commit | a042ee746381ba0765ed5df716fb1e5f79d4df86 (patch) | |
tree | d1e3367ff9389bec98439775a4f617e1becce48e /spss.server/src/at/gv/egovernment/moa/spss | |
parent | 7906e946b71cfca6fe702f855756248b2a2376b3 (diff) | |
download | moa-id-spss-a042ee746381ba0765ed5df716fb1e5f79d4df86.tar.gz moa-id-spss-a042ee746381ba0765ed5df716fb1e5f79d4df86.tar.bz2 moa-id-spss-a042ee746381ba0765ed5df716fb1e5f79d4df86.zip |
Bug 7 fixed.tags/Build-1.0.10.D2-svn
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@11 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java | 9 | ||||
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java | 43 |
2 files changed, 50 insertions, 2 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index fbae33b72..c3ba9fe23 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -76,9 +76,16 @@ public class ConfigurationProvider { * The name of the generic configuration property giving the database URL of * the CRL archive. */ - public static final String DATABASE_ARCHIVE_PARAMETER_PROPERTY = + public static final String DATABASE_ARCHIVE_PARAMETER_URL_PROPERTY = "DataBaseArchiveParameter.JDBCUrl"; + /** + * The name of the generic configuration property giving the JDBC driver + * class name for accessing the database used for the the CRL archive. + */ + public static final String DATABASE_ARCHIVE_PARAMETER_DRIVERCLASS_PROPERTY = + "DataBaseArchiveParameter.JDBCDriverClass"; + /** The name of the generic configuration property determining whether * to check the revocation status of signer certificates. */ public static final String REVOCATION_CHECKING_PROPERTY = "checkRevocation"; diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java b/spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java index 22d798bc3..daff07bd2 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java @@ -4,6 +4,10 @@ import iaik.pki.store.revocation.archive.ArchiveConfiguration; import iaik.pki.store.revocation.archive.ArchiveParameter; import iaik.pki.store.revocation.archive.ArchiveTypes; +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.Enumeration; + import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; /** @@ -30,11 +34,48 @@ public class ArchiveConfigurationImpl public ArchiveConfigurationImpl(ConfigurationProvider config) { String jdbcUrl = config.getGenericConfiguration( - ConfigurationProvider.DATABASE_ARCHIVE_PARAMETER_PROPERTY); + ConfigurationProvider.DATABASE_ARCHIVE_PARAMETER_URL_PROPERTY); if (jdbcUrl != null) { this.archiveParameters = new DataBaseArchiveParameterImpl(jdbcUrl); } + + // Register JDBC driver class specified in generic configuration parameters + String jdbcDriverClass = config.getGenericConfiguration( + ConfigurationProvider.DATABASE_ARCHIVE_PARAMETER_DRIVERCLASS_PROPERTY); + if (jdbcDriverClass != null) + { + try + { + Class.forName(jdbcDriverClass); + } + catch (ClassNotFoundException e) + { + // TODO 20030709 GK Improve exception handling + throw new RuntimeException("JDBC driver class \"" + jdbcDriverClass + " could not be found."); + } + + Enumeration regDrivers = DriverManager.getDrivers(); + boolean isRegistered = false; + while (regDrivers.hasMoreElements()) + { + Object currentDriver = regDrivers.nextElement(); + if (jdbcDriverClass.equals(currentDriver.getClass().getName())) isRegistered = true; + } + if (!isRegistered) + { + // Workaround for a driver which does not register itselve at invocation of Class.forName(drvname) + try + { + DriverManager.registerDriver((Driver)Class.forName(jdbcDriverClass).newInstance()); + } + catch (Exception e) + { + // TODO 20030709 GK Improve exception handling + throw new RuntimeException("Registering JDBC driver \"" + jdbcDriverClass + " failed."); + } + } + } } /** |