aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorGerwin Gsenger <g.gsenger@datentechnik-innovation.at>2015-01-19 10:00:36 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-06-19 11:07:55 +0200
commitf2ebaedd107e0660150faeee6dbe06be5094ac0a (patch)
tree8585b9afaf39a2854811c3d0f73f00b48f98f0cd /id
parent63c0626cb2a0bcfb37f903b98cf7975797186aca (diff)
downloadmoa-id-spss-f2ebaedd107e0660150faeee6dbe06be5094ac0a.tar.gz
moa-id-spss-f2ebaedd107e0660150faeee6dbe06be5094ac0a.tar.bz2
moa-id-spss-f2ebaedd107e0660150faeee6dbe06be5094ac0a.zip
add workaround for static field bean initialization, rework getMOAIDConfiguration()
Diffstat (limited to 'id')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java55
-rw-r--r--id/server/moa-id-commons/src/main/resources/configuration.beans.xml2
2 files changed, 48 insertions, 9 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
index e39f598b1..29bf02ba9 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
@@ -2,12 +2,18 @@ package at.gv.egovernment.moa.id.commons.db;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
+import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
+import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs;
+import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
+import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
import at.gv.egovernment.moa.logging.Logger;
@@ -19,9 +25,14 @@ import com.datentechnik.moa.id.conf.persistence.Configuration;
*/
public class NewConfigurationDBRead {
- @Autowired
private static Configuration conf;
+ @Autowired(required = true)
+ public void setConfiguration(Configuration conf) {
+ // https://jira.spring.io/browse/SPR-3845
+ NewConfigurationDBRead.conf = conf;
+ }
+
@SuppressWarnings("unchecked")
public static <T extends Iterable<?>> T nullGuard(T item) {
if (item == null) {
@@ -56,7 +67,8 @@ public class NewConfigurationDBRead {
Logger.trace("Get All OnlineApplications from database.");
// select onlineapplication from OnlineApplication onlineapplication
- return conf.getList("getAllOnlineApplications", OnlineApplication.class);
+ return conf.getList("getOnlineApplications", OnlineApplication.class);
+
}
/**
@@ -92,14 +104,41 @@ public class NewConfigurationDBRead {
public static MOAIDConfiguration getMOAIDConfiguration() {
Logger.trace("Load MOAID Configuration from database.");
- // select moaidconfiguration from MOAIDConfiguration moaidconfiguration
- MOAIDConfiguration result = null;
- result = conf.get("getMOAIDConfiguration", MOAIDConfiguration.class);
-
- if(result == null){
- Logger.trace("No entries found. Create fresh instance.");
+ AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get("getAuthComponentGeneral",
+ AuthComponentGeneral.class);
+ ChainingModes chainingModes = (ChainingModes) conf.get("getChainingModes", ChainingModes.class);
+ List<OnlineApplication> oas = (List<OnlineApplication>) conf.getList("getOnlineApplications",
+ OnlineApplication.class);
+ List<GenericConfiguration> genericConfigurations = (List<GenericConfiguration>) conf.getList(
+ "getGenericConfigurations", GenericConfiguration.class);
+ String trustedCaCertificates = (String) conf.get("getTrustedCACertificates", String.class);
+ DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get("getDefaultBKUs", DefaultBKUs.class);
+ SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get("getSLRequestTemplates",
+ SLRequestTemplates.class);
+ Date timeStamp = (Date) conf.get("getTimeStampItem", Date.class);
+ Date pvp2Refresh = (Date) conf.get("getPvp2RefreshItem", Date.class);
+
+ if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null
+ || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null
+
+ ) {
+ // TODO: is there a better approach in case of error?
+ Logger.trace("Not all necessary data available. Create fresh instance.");
return new MOAIDConfiguration();
}
+
+ // select moaidconfiguration from MOAIDConfiguration moaidconfiguration
+ MOAIDConfiguration result = new MOAIDConfiguration();
+ result.setAuthComponentGeneral(authComponent);
+ result.setChainingModes(chainingModes);
+ result.setOnlineApplication(oas);
+ result.setGenericConfiguration(genericConfigurations);
+ result.setTrustedCACertificates(trustedCaCertificates);
+ result.setDefaultBKUs(defaultBKUs);
+ result.setSLRequestTemplates(slrRequestRemplates);
+ result.setTimestampItem(timeStamp);
+ result.setPvp2RefreshItem(pvp2Refresh);
+
return result;
}
diff --git a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml
index 1a2e1fedd..ee906a407 100644
--- a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml
+++ b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml
@@ -23,7 +23,7 @@
<bean id="auth" class="at.gv.egovernment.moa.id.config.auth.NewAuthConfigurationProvider"/>
- <bean id="auth" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead"/>
+ <bean id="configRead" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close">
<aop:scoped-proxy/>