aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-spring-initializer/src/main/java
diff options
context:
space:
mode:
authorChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2016-06-28 13:47:52 +0200
committerChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2016-06-28 13:47:52 +0200
commit7717d75918fb63ee7e9d7bf31de2696577b7e991 (patch)
tree789f089649f27825e5570b8f6a0675474de5e6a5 /id/server/moa-id-spring-initializer/src/main/java
parent0d4863abf480dd35d5ffa87f09604096aae905bc (diff)
downloadmoa-id-spss-7717d75918fb63ee7e9d7bf31de2696577b7e991.tar.gz
moa-id-spss-7717d75918fb63ee7e9d7bf31de2696577b7e991.tar.bz2
moa-id-spss-7717d75918fb63ee7e9d7bf31de2696577b7e991.zip
statisticlogger dbcp connection pool
Diffstat (limited to 'id/server/moa-id-spring-initializer/src/main/java')
-rw-r--r--id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringInitializer.java29
-rw-r--r--id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringResourceProvider.java5
2 files changed, 27 insertions, 7 deletions
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 636a3ed03..51670281d 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
@@ -7,6 +7,8 @@ import javax.servlet.ServletRegistration;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.WebApplicationInitializer;
@@ -18,6 +20,7 @@ import org.springframework.web.servlet.DispatcherServlet;
import at.gv.egiz.components.spring.api.SpringLoader;
import at.gv.egovernment.moa.id.commons.utils.MOAIDMessageProvider;
+import at.gv.egovernment.moa.id.config.auth.PropertyBasedAuthConfigurationProvider;
import at.gv.egovernment.moa.logging.Logger;
/**
@@ -50,16 +53,34 @@ public class MOAIDAuthSpringInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
try {
+ Logger.info("=============== Loading Config Root Context! ===============");
+ ApplicationContext cfgRootContext =
+ new ClassPathXmlApplicationContext(new String[] {
+ "/moaid.configuration.beans.xml",
+ "/configuration.beans.xml"});
+
+
Logger.info("=============== Loading Root Context! ===============");
GenericWebApplicationContext rootContext = new GenericWebApplicationContext();
rootContext.setServletContext(servletContext);
+ rootContext.setParent(cfgRootContext);
+ PropertyBasedAuthConfigurationProvider moaidconfig = (PropertyBasedAuthConfigurationProvider) cfgRootContext.getBean("moaidauthconfig");
+ String[] springProfiles = moaidconfig.getActiveProfiles();
+
+
Logger.info("=============== Setting active profiles! ===============");
if (this.activeProfiles != null) {
for (String profile : this.activeProfiles) {
rootContext.getEnvironment().addActiveProfile(profile);
}
}
+
+ if (springProfiles != null) {
+ for (String profile : springProfiles) {
+ rootContext.getEnvironment().addActiveProfile(profile);
+ }
+ }
Logger.info("=============== Loading Local Contexts! ===============");
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
@@ -76,7 +97,7 @@ public class MOAIDAuthSpringInitializer implements WebApplicationInitializer {
// logger.debug("Beans after logAMQP in {}", rootContext);
// dumpBeanDefinitions(rootContext);
-
+
Logger.info("=============== Loading SPI Context! ===============");
// logger.debug("Startup with context {}", rootContext);
if (rootContext instanceof BeanDefinitionRegistry) {
@@ -141,16 +162,16 @@ public class MOAIDAuthSpringInitializer implements WebApplicationInitializer {
}
private void dumpBeanDefinitions(GenericApplicationContext context) {
- Logger.trace("Registered Bean in context " + context.toString());
+ Logger.debug("Registered Bean in context " + context.toString());
String[] registeredBeans = context.getBeanDefinitionNames();
for (String registeredBean : registeredBeans) {
BeanDefinition beanDefinition = context
.getBeanDefinition(registeredBean);
- Logger.trace(registeredBean + " -> " + beanDefinition.getBeanClassName());
+ Logger.debug(registeredBean + " -> " + beanDefinition.getBeanClassName());
}
- Logger.trace("Registered Bean in context --"+ context);
+ Logger.debug("Registered Bean in context --"+ context);
}
}
diff --git a/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringResourceProvider.java b/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringResourceProvider.java
index bfa1baddd..565e1cccd 100644
--- a/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringResourceProvider.java
+++ b/id/server/moa-id-spring-initializer/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthSpringResourceProvider.java
@@ -38,13 +38,12 @@ public class MOAIDAuthSpringResourceProvider implements SpringResourceProvider {
*/
@Override
public Resource[] getResourcesToLoad() {
- ClassPathResource moaidauthConfig = new ClassPathResource("/moaid.configuration.beans.xml", MOAIDAuthInitializer.class);
- ClassPathResource configurationDBConfig = new ClassPathResource("/configuration.beans.xml", MOAIDAuthInitializer.class);
ClassPathResource moaIdAuthBeans = new ClassPathResource("/moaid.authentication.beans.xml", MOAIDAuthInitializer.class);
ClassPathResource moaSessionCommonBeans = new ClassPathResource("/session.common.beans.xml", MOAIDAuthInitializer.class);
ClassPathResource moaSessionDBBeans = new ClassPathResource("/session.db.beans.xml", MOAIDAuthInitializer.class);
ClassPathResource moaSessionRedisBeans = new ClassPathResource("/session.redis.beans.xml", MOAIDAuthInitializer.class);
- return new Resource[] {configurationDBConfig, moaidauthConfig, moaIdAuthBeans, moaSessionDBBeans, moaSessionRedisBeans, moaSessionCommonBeans};
+ ClassPathResource configurationStatisticLog = new ClassPathResource("/statistic.logging.beans.xml", MOAIDAuthInitializer.class);
+ return new Resource[] {configurationStatisticLog, moaIdAuthBeans, moaSessionDBBeans, moaSessionRedisBeans, moaSessionCommonBeans};
}