aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/at/gv/egovernment
diff options
context:
space:
mode:
Diffstat (limited to 'spss.server/src/at/gv/egovernment')
-rw-r--r--spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java9
-rw-r--r--spss.server/src/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java43
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.");
+ }
+ }
+ }
}
/**