aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-23 13:35:12 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-23 13:35:12 +0100
commit80ea041e0240eb3d9291eb0d699bb09c90aaa2a9 (patch)
treec1d950bbdfbc40991e2bcfc7822ff3e181951688 /id/ConfigWebTool/src
parentf35737cbb27dda96caf0435c4bac7d279832e4fd (diff)
downloadmoa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.gz
moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.bz2
moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.zip
first untested unfactoring for Postgresql suppport
The scheme of configuration DB changed, therefore this version is incompatible to 3.3.2 configuration
Diffstat (limited to 'id/ConfigWebTool/src')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
index c5ae5065f..8aab7ef06 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
@@ -34,6 +34,7 @@ import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
+import java.util.ArrayList;
import java.util.Properties;
import java.util.Timer;
import java.util.jar.Attributes;
@@ -51,7 +52,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.web.context.support.GenericWebApplicationContext;
+import at.gv.egovernment.moa.id.commons.config.SpringProfileConstants;
import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException;
import at.gv.egovernment.moa.id.commons.utils.MOAHttpProtocolSocketFactory;
@@ -93,6 +96,8 @@ public class ConfigurationProvider {
private NewConfigurationDBRead deprecatedDBRead = null;
private FileBasedUserConfiguration userManagement = null;
+ private ArrayList<String> activeProfiles = new ArrayList<String>();
+
public static ConfigurationProvider getInstance() throws ConfigurationException {
if (instance == null) {
@@ -134,12 +139,24 @@ public class ConfigurationProvider {
props.load(fis);
fis.close();
+ //initialize generic SpringContext to set profiles
+ GenericWebApplicationContext rootContext = new GenericWebApplicationContext();
+ if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false")))
+ activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG);
+
+ log.info("Activate SpingProfiles: " + activeProfiles.toString());
+ for (String el: activeProfiles)
+ rootContext.getEnvironment().addActiveProfile(el);
+
+ //initialize SpringContext
context = new ClassPathXmlApplicationContext(
new String[] { "configuration.beans.xml",
"moaid.webgui.beans.xml",
"moaid.migration.beans.xml",
"moaid.configurationtool.beans.xml"
- });
+ }, rootContext);
+
+ //Autowire beans in these context
AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
acbFactory.autowireBean(this);