From a1ee0567607fe43909cd7fc1b75ace3197a2fa0b Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 3 Jul 2015 12:47:58 +0200 Subject: fix some configuration problems --- .../moa/id/auth/MOAIDAuthInitializer.java | 77 ++++++++++++---------- .../AuthenticationBlockAssertionBuilder.java | 11 +++- .../CreateXMLSignatureResponseValidator.java | 9 ++- .../moa/id/config/auth/OAAuthParameter.java | 2 +- .../PropertyBasedAuthConfigurationProvider.java | 7 +- .../moa/id/config/stork/STORKConfig.java | 30 +++++---- .../protocols/pvp2x/config/PVPConfiguration.java | 21 +++--- .../id/storage/AuthenticationSessionStoreage.java | 8 ++- .../id/config/auth/moaid.configuration.beans.xml | 14 ---- .../main/resources/moaid.configuration.beans.xml | 14 ++++ .../api/AbstractConfigurationImpl.java | 2 + .../config/ConfigurationMigrationUtils.java | 19 ++++-- .../config/MOAIDConfigurationConstants.java | 6 +- .../moa/id/commons/config/MigrationTest.java | 2 +- .../config/persistence/MOAIDConfigurationImpl.java | 11 ++-- .../db/dao/config/DatabaseConfigPropertyImpl.java | 6 +- 16 files changed, 137 insertions(+), 102 deletions(-) delete mode 100644 id/server/idserverlib/src/main/resources/at/gv/egovernment/moa/id/config/auth/moaid.configuration.beans.xml create mode 100644 id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java index 39ab28285..65e3b10d7 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java @@ -131,43 +131,50 @@ public class MOAIDAuthInitializer { Constants.nSMap.put(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); // Loads the configuration - AuthConfiguration authConf = AuthConfigurationProviderFactory.reload(); - - ConnectionParameter moaSPConnParam = authConf - .getMoaSpConnectionParameter(); - - // If MOA-SP API calls: loads MOA-SP configuration and configures IAIK - if (moaSPConnParam == null) { - try { - LoggingContextManager.getInstance().setLoggingContext( - new LoggingContext("startup")); - ConfigurationProvider config = ConfigurationProvider - .getInstance(); - new IaikConfigurator().configure(config); - } catch (at.gv.egovernment.moa.spss.server.config.ConfigurationException ex) { - throw new ConfigurationException("config.10", new Object[] { ex - .toString() }, ex); + try { + AuthConfiguration authConf = AuthConfigurationProviderFactory.reload(); + + ConnectionParameter moaSPConnParam = authConf + .getMoaSpConnectionParameter(); + + // If MOA-SP API calls: loads MOA-SP configuration and configures IAIK + if (moaSPConnParam == null) { + try { + LoggingContextManager.getInstance().setLoggingContext( + new LoggingContext("startup")); + ConfigurationProvider config = ConfigurationProvider + .getInstance(); + new IaikConfigurator().configure(config); + } catch (at.gv.egovernment.moa.spss.server.config.ConfigurationException ex) { + throw new ConfigurationException("config.10", new Object[] { ex + .toString() }, ex); + } } + + // Initializes IAIKX509TrustManager logging + /* + String log4jConfigURL = System.getProperty("log4j.configuration"); + Logger.info("Log4J Configuration: " + log4jConfigURL); + if (log4jConfigURL != null) { + IAIKX509TrustManager.initLog(new LoggerConfigImpl(log4jConfigURL)); + } + */ + + // Initializes the Axis secure socket factory for use in calling the + // MOA-SP web service + if (moaSPConnParam != null && moaSPConnParam.isHTTPSURL()) { + SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, + moaSPConnParam); + AxisSecureSocketFactory.initialize(ssf); + } + + + } catch (ConfigurationException e) { + Logger.error("MOA-ID-Auth start-up FAILED. Error during application configuration."); + System.exit(-1); + } - - // Initializes IAIKX509TrustManager logging - /* - String log4jConfigURL = System.getProperty("log4j.configuration"); - Logger.info("Log4J Configuration: " + log4jConfigURL); - if (log4jConfigURL != null) { - IAIKX509TrustManager.initLog(new LoggerConfigImpl(log4jConfigURL)); - } - */ - - // Initializes the Axis secure socket factory for use in calling the - // MOA-SP web service - if (moaSPConnParam != null && moaSPConnParam.isHTTPSURL()) { - SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, - moaSPConnParam); - AxisSecureSocketFactory.initialize(ssf); - } - - + // Starts the session cleaner thread to remove unpicked authentication data AuthenticationSessionCleaner.start(); AuthConfigLoader.start(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java index 6df0c4742..81699bcdf 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java @@ -265,9 +265,12 @@ public class AuthenticationBlockAssertionBuilder extends AuthenticationAssertion String text = ""; try { - OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } + } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } @@ -418,8 +421,10 @@ public class AuthenticationBlockAssertionBuilder extends AuthenticationAssertion String text = ""; try { OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java index 34613e658..e1ab0025e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java @@ -293,8 +293,10 @@ public class CreateXMLSignatureResponseValidator { String text = ""; try { OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } @@ -521,8 +523,11 @@ public class CreateXMLSignatureResponseValidator { String text = ""; try { - if (MiscUtil.isNotEmpty(text = AuthConfigurationProviderFactory.getInstance().getSSOSpecialText())) + if (MiscUtil.isNotEmpty(AuthConfigurationProviderFactory.getInstance().getSSOSpecialText())) { + text = AuthConfigurationProviderFactory.getInstance().getSSOSpecialText(); Logger.info("Use addional AuthBlock Text from SSO=" +text); + + } else text = new String(); } catch (ConfigurationException e) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index dfe4a7448..3bf631108 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -86,7 +86,7 @@ import at.gv.egovernment.moa.util.MiscUtil; */ public class OAAuthParameter implements IOAAuthParameters { - final public static String DEFAULT_KEYBOXIDENTIFIER = "SECURE_SIGNATURE_KEYPAIR"; + final public static String DEFAULT_KEYBOXIDENTIFIER = "SecureSignatureKeypair"; private Map oaConfiguration; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java index 60ae3882e..08a8dcdf2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java @@ -88,6 +88,11 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide Logger.error("OpenSAML initilalization FAILED. ", e); throw new ConfigurationException("config.23", null, e); + } catch (Exception e) { + Logger.error("General error during start-up process.", e); + throw new ConfigurationException("init.02", null, e); + + } finally { if (in != null) try { @@ -839,7 +844,7 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide STORKConfig result = null; try { Map storkProps = configuration.getPropertySubset( - MOAIDConfigurationConstants.GENERAL_AUTH_STORK); + MOAIDConfigurationConstants.GENERAL_AUTH_STORK + "."); if (storkProps == null) { Logger.warn("Error in MOA-ID Configuration. No STORK configuration found."); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index c926e2b01..9532aa9ab 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -38,6 +38,7 @@ import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; /** @@ -65,7 +66,7 @@ public class STORKConfig { Map storkCPEPSProps = AuthConfigurationProviderFactory.getInstance().getConfigurationWithPrefix( - MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST); + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "."); if (storkCPEPSProps != null) { Set keyValues = storkCPEPSProps.keySet(); for (Object elObj : keyValues) { @@ -74,19 +75,22 @@ public class STORKConfig { if (el.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)) { int index = el.indexOf("."); String listCounter = el.substring(0, index); - try { - CPEPS moacpep = - new CPEPS(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY), - new URL(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)), - Boolean.valueOf(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); - cpepsMap.put(moacpep.getCountryCode(), moacpep); + + if (MiscUtil.isNotEmpty(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY))) { + try { + CPEPS moacpep = + new CPEPS(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY), + new URL(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)), + Boolean.valueOf(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + cpepsMap.put(moacpep.getCountryCode(), moacpep); - } catch (MalformedURLException e) { - Logger.warn("CPEPS URL " + - storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL) + - " are not parseable.", e); - - } + } catch (MalformedURLException e) { + Logger.warn("CPEPS URL " + + storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL) + + " are not parseable.", e); + + } + } } } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java index ca95ff90c..de58c34a1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java @@ -93,16 +93,16 @@ public class PVPConfiguration { public static final String IDP_ISSUER_NAME = "servicename"; - public static final String IDP_ORG_NAME = "org.name.short"; - public static final String IDP_ORG_DISPNAME = "org.name.full"; - public static final String IDP_ORG_URL = "org.url"; - - public static final String IDP_CONTACT_SURNAME = "contact.familyname"; - public static final String IDP_CONTACT_GIVENNAME = "contact.givenname"; - public static final String IDP_CONTACT_MAIL = "contact.mail"; - public static final String IDP_CONTACT_TYPE = "contact.type"; - public static final String IDP_CONTACT_COMPANY = "contact.company"; - public static final String IDP_CONTACT_PHONE = "contact.phone"; + public static final String IDP_ORG_NAME = "name.short"; + public static final String IDP_ORG_DISPNAME = "name.full"; + public static final String IDP_ORG_URL = "url"; + + public static final String IDP_CONTACT_SURNAME = "familyname"; + public static final String IDP_CONTACT_GIVENNAME = "givenname"; + public static final String IDP_CONTACT_MAIL = "mail"; + public static final String IDP_CONTACT_TYPE = "type"; + public static final String IDP_CONTACT_COMPANY = "company"; + public static final String IDP_CONTACT_PHONE = "phone"; private static String moaIDVersion = null; @@ -255,6 +255,7 @@ public class PVPConfiguration { if (type == null) { Logger.error("IDP Contact with SurName " + contacts.get(IDP_CONTACT_SURNAME) + " has no type defined!"); + type = "unknown"; } ContactPersonTypeEnumeration enumType = null; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java index 1ca5dcce4..d843a171e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java @@ -385,8 +385,12 @@ public class AuthenticationSessionStoreage { //send transaction tx.commit(); - Logger.debug("Add SSO-Session login information for OA: " + OAUrl - + " and AssertionID: " + SLOInfo.getSessionIndex()); + if (SLOInfo != null) + Logger.debug("Add SSO-Session login information for OA: " + OAUrl + + " and AssertionID: " + SLOInfo.getSessionIndex()); + else + Logger.debug("Add SSO-Session login information for OA: " + OAUrl); + } } catch (MOADatabaseException e) { diff --git a/id/server/idserverlib/src/main/resources/at/gv/egovernment/moa/id/config/auth/moaid.configuration.beans.xml b/id/server/idserverlib/src/main/resources/at/gv/egovernment/moa/id/config/auth/moaid.configuration.beans.xml deleted file mode 100644 index cdfde11b1..000000000 --- a/id/server/idserverlib/src/main/resources/at/gv/egovernment/moa/id/config/auth/moaid.configuration.beans.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml b/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml new file mode 100644 index 000000000..cdfde11b1 --- /dev/null +++ b/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java index 801e765c3..d5ea2342a 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java @@ -28,11 +28,13 @@ import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.transaction.annotation.Transactional; /** * @author tlenz * */ +@Transactional("transactionManager") public abstract class AbstractConfigurationImpl implements Configuration { private static final Logger logger = LoggerFactory diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index 59c6687d5..974646ef0 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -218,6 +218,10 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_USE, Boolean.FALSE.toString()); } + //convert KeyBoxSelector + result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER, + oa.getKeyBoxIdentifier().value()); + //convert securtiyLayer templates TemplatesType templates = oaauth.getTemplates(); if (templates != null) { @@ -1172,16 +1176,19 @@ public class ConfigurationMigrationUtils { if (seclayer != null) { List list = seclayer.getTransformsInfo(); if (!list.isEmpty()) { - try { +// try { + //TODO: check if Transformation is always BASE64 encoded +// result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64, +// Base64Utils.encode(list.get(0).getTransformation())); result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64, - Base64Utils.encode(list.get(0).getTransformation())); + new String(list.get(0).getTransformation())); result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME, list.get(0).getFilename()); - - } catch (IOException e) { - Logger.warn("AuthBlockTransformation can not converted.", e); - } +// } catch (IOException e) { +// Logger.warn("AuthBlockTransformation can not converted.", e); +// +// } } else { Logger.warn("AuthBlockTransformation can not converted."); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java index 884587d36..78eec24ee 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java @@ -244,9 +244,9 @@ public final class MOAIDConfigurationConstants { public static final String GENERAL_PROTOCOLS_PVP2X_METADATA = GENERAL_PROTOCOLS_PVP2X + ".metadata"; public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_SERVICENAMME = GENERAL_PROTOCOLS_PVP2X_METADATA + ".servicename"; public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG = GENERAL_PROTOCOLS_PVP2X_METADATA + ".org"; - public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME = GENERAL_PROTOCOLS_PVP2X_METADATA + ".name.short"; - public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME = GENERAL_PROTOCOLS_PVP2X_METADATA + ".name.full"; - public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL = GENERAL_PROTOCOLS_PVP2X_METADATA + ".url"; + public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".name.short"; + public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".name.full"; + public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".url"; public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT = GENERAL_PROTOCOLS_PVP2X_METADATA + ".contact"; public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_FAMLIYNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".familyname"; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java index 2a8cd9c1c..7dbbac5b4 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java @@ -37,7 +37,7 @@ public class MigrationTest { public static void main(String[] args) { - String inputFile = "D:/Projekte/svn/moa-id/MOAID-2.0_config_test.xml"; + String inputFile = "D:/Projekte/svn/moa-id/MOAID-2.0_config_labda_12.05.2015.xml"; String outputFile = "D:/Projekte/svn/moa-id/MOAID-3.0_config.propery"; String moaidconfig = "D:/Projekte/svn/moa-id/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/moa-id/moa-id.properties"; 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 06e174942..832c82e78 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 @@ -9,8 +9,6 @@ import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; import at.gv.egiz.components.configuration.api.Configuration; @@ -25,8 +23,7 @@ import at.gv.egovernment.moa.logging.Logger; * The implementation of a key-value configuration implementing the {@link Configuration} interface. * It employs the {@link ConfigPropertyDao} to persist configuration data. */ -@Repository -@EnableTransactionManagement +@Component @Transactional("transactionManager") public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implements MOAIDConfiguration { @@ -52,8 +49,8 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } - TypedQuery configQuery = em.createQuery("select * from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); - configQuery.setParameter("key", preFix + ".%"); + TypedQuery configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + configQuery.setParameter("key", preFix + "%"); List configResult = configQuery.getResultList(); if (configResult == null || configResult.isEmpty()) { @@ -83,7 +80,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } - TypedQuery configQuery = em.createQuery("select * from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + TypedQuery configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); configQuery.setParameter("key", searchKey.replace("*", "%")); List configResult = configQuery.getResultList(); 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 72cb2fdf4..8e845478b 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 @@ -6,12 +6,9 @@ import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; -import org.hibernate.SessionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Repository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; import at.gv.egiz.components.configuration.api.AbstractConfigurationImpl; @@ -96,7 +93,8 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl { property.setKey(key); property.setValue(value); log.debug("Storing '{}'.", property.toString()); - em.persist(property); +// em.persist(property); + em.merge(property); } -- cgit v1.2.3