aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2018-02-27 08:54:36 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2018-02-27 08:54:36 +0100
commit9d01327960b0531da64ae3ffd1b39592830dd425 (patch)
tree06d67a5224ba7de9813e6803a5aedd4a30f35cc6
parent80ea041e0240eb3d9291eb0d699bb09c90aaa2a9 (diff)
downloadmoa-id-spss-9d01327960b0531da64ae3ffd1b39592830dd425.tar.gz
moa-id-spss-9d01327960b0531da64ae3ffd1b39592830dd425.tar.bz2
moa-id-spss-9d01327960b0531da64ae3ffd1b39592830dd425.zip
some more updates are required to support postgresql databases
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java26
-rw-r--r--id/server/doc/handbook/config/config.html3
-rw-r--r--id/server/doc/handbook/install/install.html6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java3
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java3
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java13
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java23
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java11
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java16
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java22
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java11
-rw-r--r--id/server/moa-id-commons/src/main/resources/configuration.beans.xml36
-rw-r--r--id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java10
-rw-r--r--pom.xml1
14 files changed, 118 insertions, 66 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 8aab7ef06..abde2089d 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
@@ -35,6 +35,7 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Properties;
import java.util.Timer;
import java.util.jar.Attributes;
@@ -52,9 +53,8 @@ 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 org.springframework.context.support.GenericApplicationContext;
-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;
@@ -91,7 +91,7 @@ public class ConfigurationProvider {
private boolean pvp2logininitialzied = false;
- private ApplicationContext context = null;
+ private ClassPathXmlApplicationContext context = null;
private MOAIDConfigurationModul configModule = null;
private NewConfigurationDBRead deprecatedDBRead = null;
private FileBasedUserConfiguration userManagement = null;
@@ -140,13 +140,15 @@ public class ConfigurationProvider {
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);
+ GenericApplicationContext rootContext = new GenericApplicationContext();
+
+// if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false")))
+// activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG);
+// for (String el: activeProfiles)
+// rootContext.getEnvironment().addActiveProfile(el);
+
+ //refresh generic context
+ rootContext.refresh();
//initialize SpringContext
context = new ClassPathXmlApplicationContext(
@@ -155,6 +157,10 @@ public class ConfigurationProvider {
"moaid.migration.beans.xml",
"moaid.configurationtool.beans.xml"
}, rootContext);
+
+
+ log.info("Spring-context was initialized with active profiles: "
+ + Arrays.asList(context.getEnvironment().getActiveProfiles()));
//Autowire beans in these context
AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
diff --git a/id/server/doc/handbook/config/config.html b/id/server/doc/handbook/config/config.html
index 1972d2150..8b2f6a632 100644
--- a/id/server/doc/handbook/config/config.html
+++ b/id/server/doc/handbook/config/config.html
@@ -275,6 +275,8 @@ UNIX: -Duser.properties=file:C:/Programme/apache/tomcat-8.x.x/conf/moa-id-config
</tr>
</table>
<p>&nbsp;</p>
+<p><strong>Hinweis:</strong> Defaultm&auml;&szlig;ig werden Konfigurationswerte textuell in der Datenbank abgelegt. Sollte es mit dem verwendeten Datenbank-Backend Probleme mit rein textueller Representation von Konfigurationswerten geben kann alternativ eine generische Datenrepresentation verwendet werden. Zur Aktivierung dieser generischen Datenrepresentation muss das Spring Profile <code>byteBasedConfig</code> siehe <a href="../install/install.html#moa_id_configuration_deploy">Kapitel Installation</a> als System-Property gesetzt werden (z.B. -Dspring.profiles.active=byteBasedConfig).</p>
+<p>&nbsp;</p>
<p>Die Beispielkonfiguration beinhaltet noch zus&auml;tzliche Konfigurationsparameter f&uuml;r den Datenbankzugriff welche direkt aus der Beispielkonfiguration &uuml;bernommen werden k&ouml;nnen. Eine detaillierte Beschreibung der einzelnen Einstellungsparameter kann der <a href="http://docs.jboss.org/hibernate/core/4.2/manual/en-US/html/">Hibernate Dokumention</a> entnommen werden.</p>
<h4><a name="moa_id_config_init" id="uebersicht_zentraledatei_aktualisierung13"></a>2.1.3 Initialisierung des Modules MOA-ID-Configuration</h4>
<p>F&uuml;r den ersten Start muss die Authentifizierung deaktiviert werden (siehe <em>general.login.deaktivate</em> <a href="#moa_id_config_parameters_generel">Abschnitt 2.2.2.1</a>). Anschlie&szlig;end kann die Benutzerverwaltung des Modules MOA-ID-Configuration unter der folgenden Adresse aufgerufen werden.</p>
@@ -656,6 +658,7 @@ https://&lt;host&gt;:&lt;port&gt;/moa-id-auth/MonitoringServlet</pre>
</tr>
</table>
<p>&nbsp;</p>
+<p><strong>Hinweis:</strong> Defaultm&auml;&szlig;ig werden Konfigurationswerte textuell in der Datenbank abgelegt. Sollte es mit dem verwendeten Datenbank-Backend Probleme mit rein textueller Representation von Konfigurationswerten geben kann alternativ eine generische Datenrepresentation verwendet werden. Zur Aktivierung dieser generischen Datenrepresentation muss das Spring Profile <code>byteBasedConfig</code> siehe <a href="../install/install.html#webservice_basisinstallation_installation_spssdeploy">Kapitel Installation</a> als System-Property gesetzt werden (z.B. -Dspring.profiles.active=byteBasedConfig).</p>
<h6><a name="basisconfig_moa_id_auth_param_database_session" id="uebersicht_bekanntmachung13"></a>2.2.2.4.2 Session Informationen</h6>
<p>Alle Parameter aus der Basiskonfiguration welche als Prefix <em>moasession.hibernate</em>. im Parameternamen aufweisen konfigurieren den Zugriff auf das Datenbank Schema in welchem MOA-ID-Auth die Session Informationen tempor&auml;r ablegt. Eine Konfiguration dieser Parameter ist nicht optional.</p>
<table class="configtable">
diff --git a/id/server/doc/handbook/install/install.html b/id/server/doc/handbook/install/install.html
index db96cda3c..bcd802b75 100644
--- a/id/server/doc/handbook/install/install.html
+++ b/id/server/doc/handbook/install/install.html
@@ -147,6 +147,7 @@
<li id="klein"><code>javax.net.ssl.trustStore</code>: Pfad und Dateiname des <span class="term">Truststores</span> f&uuml;r vertrauensw&uuml;rdige SSL Zertifikate. Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden m&uuml;ssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li>
<li id="klein"><code>javax.net.ssl.trustStorePassword</code>: Passwort f&uuml;r den <span class="term">Truststore</span> (optional; nur, wenn SSL Client-Authentisierung durchgef&uuml;hrt werden soll). </li>
<li id="klein"><code>javax.net.ssl.trustStoreType</code>: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgef&uuml;hrt werden soll). Je nach verwendetem Keystore-Typ muss <code>jks</code> (<span class="term">Java Key Store</span>) oder <code>pkcs12</code> (PKCS#12-Datei) angegeben werden.</li>
+ <li><code>spring.profiles.active:</code> Set generic configuration parameters in MOA-ID-Auth Spring-Context. Configuartion values are added as comma-separated list (e.g. byteBasedConfig,value2,value3). Details on possible configuration values are in <a href="../config/config.html">Chapter Configuration</a>.</li>
</ul>
</li>
</ul>
@@ -159,12 +160,13 @@
<li>Folgende <span class="term">System Properties</span> k&ouml;nnen gesetzt werden (wird beim Starten von Tomcat der <span class="term">Java Virtual Machine</span> in der Umgebungsvariablen <code>CATALINA_OPTS</code> in der Form <code>-D&lt;name&gt;=&lt;wert&gt;</code> &uuml;bergeben):
<ul>
<li><code>moa.id.webconfig</code>: Pfad und Name der Basiskonfigurationsdatei f&uuml;r MOA-ID-Configuration. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-id-configuration/moa-id-configtool.properties">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li>
- <li><code>-Duser.properties</code>: Pfad und Name der Basiskonfigurationsdatei f&uuml;r das Usermanagement der Konfigurationsoberfl&auml;che. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-id-configuration/userdatabase.properties">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li>
+ <li><code>user.properties</code>: Pfad und Name der Basiskonfigurationsdatei f&uuml;r das Usermanagement der Konfigurationsoberfl&auml;che. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-id-configuration/userdatabase.properties">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li>
<li><code>log4j.configuration</code>: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie <a href="../../../conf/moa-id/log4j.properties">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen.</li>
- <li><code>-Dlogback.configurationFile</code>: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie <a href="../../../conf/moa-id/logback_config.xml">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen. &Uuml;berdies besteht die M&ouml;glichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu &uuml;berf&uuml;hren (<a href="http://logback.qos.ch/translator/">http://logback.qos.ch/translator/</a>).</li>
+ <li><code>logback.configurationFile</code>: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie <a href="../../../conf/moa-id/logback_config.xml">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen. &Uuml;berdies besteht die M&ouml;glichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu &uuml;berf&uuml;hren (<a href="http://logback.qos.ch/translator/">http://logback.qos.ch/translator/</a>).</li>
<li><code>javax.net.ssl.trustStore</code>: Pfad und Dateiname des <span class="term">Truststores</span> f&uuml;r vertrauensw&uuml;rdige SSL Zertifikate Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden m&uuml;ssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li>
<li><code>javax.net.ssl.trustStorePassword</code>: Passwort f&uuml;r den <span class="term">Truststore</span> (optional; nur, wenn SSL Client-Authentisierung durchgef&uuml;hrt werden soll). </li>
<li><code>javax.net.ssl.trustStoreType</code>: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgef&uuml;hrt werden soll). Je nach verwendetem Keystore-Typ muss <code>jks</code> (<span class="term">Java Key Store</span>) oder <code>pkcs12</code> (PKCS#12-Datei) angegeben werden.</li>
+ <li><code>spring.profiles.active:</code> Set generic configuration parameters in MOA-ID-Configuration Spring-Context. Configuartion values are added as comma-separated list (e.g. byteBasedConfig,value2,value3). Details on possible configuration values are in <a href="../config/config.html">Chapter Configuration</a>.</li>
</ul>
</li>
</ul>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
index 151eda89f..804b98a5f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
@@ -279,9 +279,12 @@ public abstract class ConfigurationProviderImpl implements ConfigurationProvider
if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false")))
activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG);
+
+
}
public String[] getActiveProfiles(){
+ Logger.debug("Set active Spring-Profiles to: " + activeProfiles);
return activeProfiles.toArray(new String[0]);
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
index 98f0616a5..436dcc91d 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
@@ -134,7 +134,8 @@ public class MOAIDConstants {
static {
List<String> jdbcDriverWorkaround = new ArrayList<String>();
jdbcDriverWorkaround.add("oracle.jdbc.");
- jdbcDriverWorkaround.add("com.microsoft.sqlserver.");
+ jdbcDriverWorkaround.add("com.microsoft.sqlserver.");
+ jdbcDriverWorkaround.add("org.postgresql.");
JDBC_DRIVER_NEEDS_WORKAROUND = Collections.unmodifiableList(jdbcDriverWorkaround);
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
index 4fd382606..4944813ad 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -1,6 +1,5 @@
package at.gv.egovernment.moa.id.commons.config.persistence;
-import java.sql.SQLSyntaxErrorException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -17,7 +16,7 @@ import at.gv.egiz.components.configuration.api.Configuration;
import at.gv.egiz.components.configuration.api.ConfigurationException;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty;
-import at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty;
import at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl;
import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
import at.gv.egovernment.moa.logging.Logger;
@@ -56,7 +55,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
}
- TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
configQuery.setParameter("key", preFix + "%");
List<AbstractConfigProperty> configResult = configQuery.getResultList();
@@ -94,7 +93,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
}
- TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
configQuery.setParameter("key", searchKey.replace("*", "%"));
List<AbstractConfigProperty> configResult = configQuery.getResultList();
@@ -128,7 +127,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
+ MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER;
List<AbstractConfigProperty> oaSearchResult = null;
- TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key and dbconfig.value = SUBSTRING(:uniqueID, 1, LENGTH(dbconfig.value))", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key and dbconfig.value = SUBSTRING(:uniqueID, 1, LENGTH(dbconfig.value))", AbstractConfigProperty.class);
oaSearchQuery.setParameter("key", keyId);
oaSearchQuery.setParameter("uniqueID", publicURLPrefix);
oaSearchResult = oaSearchQuery.getResultList();
@@ -159,7 +158,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
List<AbstractConfigProperty> oaSearchResult = new ArrayList<AbstractConfigProperty>();
- TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
oaSearchQuery.setParameter("key", keyId);
List<AbstractConfigProperty> intermResult = oaSearchQuery.getResultList();
if (intermResult != null) {
@@ -224,7 +223,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
String oaType = KeyValueUtils.getFirstChildAfterPrefix(oaIdKey, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES);
String oaKey = KeyValueUtils.getPrefixFromKey(oaIdKey, MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER);
- TypedQuery<AbstractConfigProperty> oaConfigQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> oaConfigQuery = em.createQuery("select dbconfig from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key", AbstractConfigProperty.class);
oaConfigQuery.setParameter("key", oaKey + ".%");
List<AbstractConfigProperty> oaConfigResult = oaConfigQuery.getResultList();
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java
index d50aa9c6e..0d9a1bf8b 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/AbstractConfigProperty.java
@@ -8,6 +8,9 @@ import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class AbstractConfigProperty implements Serializable{
+
+
+
/**
*
*/
@@ -65,7 +68,7 @@ public abstract class AbstractConfigProperty implements Serializable{
return false;
if (getClass() != obj.getClass())
return false;
- ConfigProperty other = (ConfigProperty) obj;
+ AbstractConfigProperty other = (AbstractConfigProperty) obj;
if (key == null) {
if (other.key != null)
return false;
@@ -76,7 +79,7 @@ public abstract class AbstractConfigProperty implements Serializable{
public String toString() {
StringBuilder builder = new StringBuilder();
- builder.append(getImpplementationName());
+ builder.append(getImplementationName());
builder.append(" [key=");
builder.append(getKey());
builder.append(", value=");
@@ -86,9 +89,21 @@ public abstract class AbstractConfigProperty implements Serializable{
}
/**
- * Get a name for this Entity-Implementation for logging purposes
+ * Get a name for this Entity-Implementation class
*
* @return
*/
- abstract protected String getImpplementationName();
+ protected String getImplementationName() {
+ return getImplementationClass().getSimpleName();
+
+ }
+
+ /**
+ * Get get Class of the implemented Entity
+ *
+ * @return
+ */
+ abstract protected Class<? extends AbstractConfigProperty> getImplementationClass();
+
+
} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java
index 07770fdf3..2cea90e7b 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java
@@ -14,8 +14,7 @@ import javax.persistence.Table;
@Entity
public class ConfigProperty extends AbstractConfigProperty{
-
-
+
/**
*
*/
@@ -46,9 +45,13 @@ public class ConfigProperty extends AbstractConfigProperty{
this.value = value;
}
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty#getImplementationClass()
+ */
@Override
- protected String getImpplementationName() {
- return this.getClass().getName();
+ protected Class<? extends AbstractConfigProperty> getImplementationClass() {
+ return this.getClass();
+
}
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java
index 51f7e4da6..c31ca98ed 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java
@@ -1,11 +1,9 @@
package at.gv.egovernment.moa.id.commons.db.dao.config;
import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Lob;
import javax.persistence.Table;
import at.gv.egovernment.moa.logging.Logger;
@@ -27,7 +25,6 @@ public class ConfigPropertyByteValues extends AbstractConfigProperty{
private static final long serialVersionUID = 1L;
- @Lob
@Column(name = "propertyValueBytes")
private byte[] value = null;
@@ -58,7 +55,10 @@ public class ConfigPropertyByteValues extends AbstractConfigProperty{
@Override
public void setValue(String value) {
try {
- this.value = value.getBytes("UTF-8");
+ if (value == null)
+ this.value = null;
+ else
+ this.value = value.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
Logger.error("Internal DB write error! Can not read write to configuration DB.", e);
@@ -66,8 +66,12 @@ public class ConfigPropertyByteValues extends AbstractConfigProperty{
}
}
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty#getImplementationClass()
+ */
@Override
- protected String getImpplementationName() {
- return this.getClass().getName();
+ protected Class<? extends AbstractConfigProperty> getImplementationClass() {
+ return this.getClass();
+
}
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
index 213d1a860..c202e231b 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
@@ -3,9 +3,9 @@ package at.gv.egovernment.moa.id.commons.db.dao.config;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map.Entry;
import java.util.regex.Pattern;
+import javax.annotation.PostConstruct;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
@@ -36,6 +36,15 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
@Autowired(required=true)
private ApplicationContext appContext;
+
+ static protected String dataBaseEntityName;
+
+ @PostConstruct
+ void postConstructor() {
+ dataBaseEntityName = appContext.getBean(AbstractConfigProperty.class).getImplementationName();
+ log.info("DB-Entity for config: " + dataBaseEntityName);
+
+ }
/**
*
@@ -51,7 +60,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
log.error("No EntityManager set!");
throw new ConfigurationException("No EntityManager set!");
}
- TypedQuery<String> query = em.createQuery("select key from ConfigProperty", String.class);
+ TypedQuery<String> query = em.createQuery("select key from " + dataBaseEntityName, String.class);
List<String> result = query.getResultList();
return result;
}
@@ -109,7 +118,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
protected void deleteKey(String key) {
log.debug("Deleting entry with key '{}'.", key);
- AbstractConfigProperty el = em.find(AbstractConfigProperty.class, key);
+ AbstractConfigProperty el = em.find(appContext.getBean(AbstractConfigProperty.class).getClass(), key);
if (el != null)
em.remove(el);
@@ -126,7 +135,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
throw new ConfigurationException("No EntityManager set!");
}
- TypedQuery<String> query = em.createQuery("select key from ConfigProperty dbconfig where dbconfig.key like :key", String.class);
+ TypedQuery<String> query = em.createQuery("select key from " + dataBaseEntityName + " dbconfig where dbconfig.key like :key", String.class);
query.setParameter("key", searchString.replace("*", "%"));
List<String> result = query.getResultList();
if (result == null)
@@ -146,7 +155,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
throw new ConfigurationException("No EntityManager set!");
}
- TypedQuery<AbstractConfigProperty> query = em.createQuery("select * from ConfigProperty dbconfig", AbstractConfigProperty.class);
+ TypedQuery<AbstractConfigProperty> query = em.createQuery("select * from " + dataBaseEntityName + " dbconfig", AbstractConfigProperty.class);
List<AbstractConfigProperty> all = query.getResultList();
searchString = searchString.replace(".", "\\.");
@@ -195,7 +204,8 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
private AbstractConfigProperty getProperty(String key) {
log.trace("Looking for configuration property for key '{}'.", key);
- AbstractConfigProperty result = em.find(AbstractConfigProperty.class, key);
+
+ AbstractConfigProperty result = em.find(appContext.getBean(AbstractConfigProperty.class).getClass(), key);
if (result != null) {
log.trace("Found configuration property {}.", result);
} else {
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
index 7cb921ee7..b13f0ba5b 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
@@ -98,9 +98,12 @@ public class AuthenticatedSessionStore implements Serializable{
@Column(name = "pendingRequestID", nullable=true)
private String pendingRequestID = "";
- @Column(name = "additionalInformationBytes", nullable=true)
+ @Column(name = "additionalInformation", nullable=true)
@Lob
- private byte[] additionalInformation;
+ private String additionalInformation;
+
+ @Column(name = "additionalInformationBytes", nullable=true)
+ private byte[] additionalInformationBytes;
@Column(name = "created", updatable=false, nullable=false)
@Temporal(TemporalType.TIMESTAMP)
@@ -350,14 +353,14 @@ public class AuthenticatedSessionStore implements Serializable{
* @return the additionalInformation
*/
public byte[] getAdditionalInformation() {
- return additionalInformation;
+ return additionalInformationBytes;
}
/**
* @param additionalInformation the additionalInformation to set
*/
public void setAdditionalInformation(byte[] additionalInformation) {
- this.additionalInformation = additionalInformation;
+ this.additionalInformationBytes = additionalInformation;
}
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 1251cf406..79e2decc1 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
@@ -12,30 +12,32 @@
<context:annotation-config />
<beans profile="!byteBasedConfig">
<bean id="StringBasedConfigProperty"
- class="at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty"/>
+ class="at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty"
+ scope="prototype"/>
</beans>
<beans profile="byteBasedConfig">
<bean id="ByteBasedConfigProperty"
- class="at.gv.egovernment.moa.id.commons.db.dao.config.ConfigPropertyByteValues"
- />
+ class="at.gv.egovernment.moa.id.commons.db.dao.config.ConfigPropertyByteValues"
+ scope="prototype"/>
</beans>
- <bean id="configPropertyDao"
- class="at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl"/>
+ <beans>
+ <bean id="configPropertyDao"
+ class="at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl"/>
- <bean id="moaidconfig" class="at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl" />
+ <bean id="moaidconfig" class="at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl" />
- <bean name="config" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="packagesToScan" value="at.gv.egovernment.moa.id.commons.db.dao.config" />
- <property name="dataSource" ref="dataSource" />
- <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
- <property name="persistenceUnitName" value="config" />
- </bean>
-
- <bean name="transactionManager" id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
- <tx:annotation-driven transaction-manager="transactionManager"/>
+ <bean name="config" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="packagesToScan" value="at.gv.egovernment.moa.id.commons.db.dao.config" />
+ <property name="dataSource" ref="dataSource" />
+ <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
+ <property name="persistenceUnitName" value="config" />
+ </bean>
+ <bean name="transactionManager" id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+ <tx:annotation-driven transaction-manager="transactionManager"/>
+ </beans>
</beans> \ No newline at end of file
diff --git a/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java b/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java
index b6fd8de8e..bf0273898 100644
--- a/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java
+++ b/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java
@@ -1,5 +1,6 @@
package at.gv.egovernment.moa.id.auth;
+import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
@@ -67,12 +68,10 @@ public class MOAIDAuthSpringInitializer implements WebApplicationInitializer {
GenericWebApplicationContext rootContext = new GenericWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.setParent(cfgRootContext);
-
+
ConfigurationProvider moaidconfig = (ConfigurationProvider) cfgRootContext.getBean("moaidauthconfig");
String[] springProfiles = moaidconfig.getActiveProfiles();
-
-
-
+
Logger.info("=============== Setting active profiles! ===============");
if (this.activeProfiles != null) {
for (String profile : this.activeProfiles) {
@@ -86,6 +85,9 @@ public class MOAIDAuthSpringInitializer implements WebApplicationInitializer {
}
}
+ Logger.info("Spring-context was initialized with active profiles: " +
+ Arrays.asList(rootContext.getEnvironment().getActiveProfiles()));
+
Logger.info("=============== Loading Local Contexts! ===============");
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
rootContext);
diff --git a/pom.xml b/pom.xml
index 5ccd01a52..3716d4382 100644
--- a/pom.xml
+++ b/pom.xml
@@ -581,7 +581,6 @@
<groupId>iaik.prod</groupId>
<artifactId>iaik_jce_full</artifactId>
<version>5.5_MOA</version>
- <scope>compile</scope>
</dependency>
<dependency>