[Major] Refactored StrolchConfiguration.xml to use environments
Now the agent requires an environment parameter to start, and the configuration of that environment is used to load different sections of the configuration file Conflicts: src/main/java/li/strolch/tutorialwebapp/StartupListener.java
This commit is contained in:
parent
a6341da79b
commit
a05f6c10dd
263
pom.xml
263
pom.xml
|
@ -1,134 +1,167 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>li.strolch</groupId>
|
<groupId>li.strolch</groupId>
|
||||||
<artifactId>li.strolch.parent</artifactId>
|
<artifactId>li.strolch.parent</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<relativePath>../li.strolch.parent/pom.xml</relativePath>
|
<relativePath>../li.strolch.parent/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<warFinalName>tutorialwebapp</warFinalName>
|
<warFinalName>tutorialwebapp</warFinalName>
|
||||||
<tomcat7ServerId>tomcat7.eitchnet.ch</tomcat7ServerId>
|
<tomcat7ServerId>tomcat7.eitchnet.ch</tomcat7ServerId>
|
||||||
<tomcat7Url>http://appsrv:8080/manager/text</tomcat7Url>
|
<tomcat7Url>http://appsrv:8080/manager/text</tomcat7Url>
|
||||||
<m2eclipse.wtp.contextRoot>${warFinalName}</m2eclipse.wtp.contextRoot>
|
<m2eclipse.wtp.contextRoot>${warFinalName}</m2eclipse.wtp.contextRoot>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<artifactId>li.strolch.tutorialwebapp</artifactId>
|
<artifactId>li.strolch.tutorialwebapp</artifactId>
|
||||||
<name>li.strolch.tutorialwebapp</name>
|
<name>li.strolch.tutorialwebapp</name>
|
||||||
<description>Tutorial webapp to show case using Strolch in a servlet container</description>
|
<description>Tutorial webapp to show case using Strolch in a servlet container</description>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp</url>
|
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp</url>
|
||||||
|
|
||||||
<inceptionYear>2011</inceptionYear>
|
<inceptionYear>2011</inceptionYear>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>Github Issues</system>
|
<system>Github Issues</system>
|
||||||
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp/issues</url>
|
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp/issues</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://github.com/eitchnet/li.strolch.tutorialwebapp.git</connection>
|
<connection>scm:git:https://github.com/eitchnet/li.strolch.tutorialwebapp.git</connection>
|
||||||
<developerConnection>scm:git:git@github.com:eitch/li.strolch.tutorialwebapp.git</developerConnection>
|
<developerConnection>scm:git:git@github.com:eitch/li.strolch.tutorialwebapp.git</developerConnection>
|
||||||
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp</url>
|
<url>https://github.com/eitchnet/li.strolch.tutorialwebapp</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>li.strolch</groupId>
|
<groupId>li.strolch</groupId>
|
||||||
<artifactId>li.strolch.bom</artifactId>
|
<artifactId>li.strolch.bom</artifactId>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>li.strolch</groupId>
|
<groupId>li.strolch</groupId>
|
||||||
<artifactId>li.strolch.rest</artifactId>
|
<artifactId>li.strolch.rest</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>li.strolch</groupId>
|
<groupId>li.strolch</groupId>
|
||||||
<artifactId>li.strolch.persistence.xml</artifactId>
|
<artifactId>li.strolch.persistence.xml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${warFinalName}</finalName>
|
<finalName>${warFinalName}</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/componentVersion.properties</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
<warName>${warFinalName}</warName>
|
<warName>${warFinalName}</warName>
|
||||||
</configuration>
|
<webResources>
|
||||||
</plugin>
|
<resource>
|
||||||
|
<directory>src/main/non-packaged-resources</directory>
|
||||||
<plugin>
|
<targetPath>WEB-INF</targetPath>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<filtering>true</filtering>
|
||||||
<executions>
|
<includes>
|
||||||
<execution>
|
<include>**/ENV.properties</include>
|
||||||
<id>install-jar</id>
|
</includes>
|
||||||
<phase>package</phase>
|
</resource>
|
||||||
<goals>
|
</webResources>
|
||||||
<goal>copy</goal>
|
</configuration>
|
||||||
</goals>
|
</plugin>
|
||||||
<configuration>
|
|
||||||
<artifactItems>
|
|
||||||
<artifactItem>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>${project.artifactId}</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>war</type>
|
|
||||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
|
||||||
<destFileName>${project.artifactId}-${project.version}.war</destFileName>
|
|
||||||
</artifactItem>
|
|
||||||
</artifactItems>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<!-- Publish to Tomcat7: mvn tomcat7:redeploy -->
|
|
||||||
<groupId>org.apache.tomcat.maven</groupId>
|
|
||||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<url>${tomcat7Url}</url>
|
|
||||||
<server>${tomcat7ServerId}</server>
|
|
||||||
<path>/${warFinalName}</path>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
|
<!-- <plugin> -->
|
||||||
|
<!-- <artifactId>maven-dependency-plugin</artifactId> -->
|
||||||
|
<!-- <executions> -->
|
||||||
|
<!-- <execution> -->
|
||||||
|
<!-- <id>install-jar</id> -->
|
||||||
|
<!-- <phase>package</phase> -->
|
||||||
|
<!-- <goals> -->
|
||||||
|
<!-- <goal>copy</goal> -->
|
||||||
|
<!-- </goals> -->
|
||||||
|
<!-- <configuration> -->
|
||||||
|
<!-- <artifactItems> -->
|
||||||
|
<!-- <artifactItem> -->
|
||||||
|
<!-- <groupId>${project.groupId}</groupId> -->
|
||||||
|
<!-- <artifactId>${project.artifactId}</artifactId> -->
|
||||||
|
<!-- <version>${project.version}</version> -->
|
||||||
|
<!-- <type>war</type> -->
|
||||||
|
<!-- <outputDirectory>${project.build.directory}</outputDirectory> -->
|
||||||
|
<!-- <destFileName>${project.artifactId}-${project.version}.war</destFileName> -->
|
||||||
|
<!-- </artifactItem> -->
|
||||||
|
<!-- </artifactItems> -->
|
||||||
|
<!-- </configuration> -->
|
||||||
|
<!-- </execution> -->
|
||||||
|
<!-- </executions> -->
|
||||||
|
<!-- </plugin> -->
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<!-- Publish to Tomcat7: mvn tomcat7:redeploy -->
|
||||||
|
<groupId>org.apache.tomcat.maven</groupId>
|
||||||
|
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<url>${tomcat7Url}</url>
|
||||||
|
<server>${tomcat7ServerId}</server>
|
||||||
|
<path>/${warFinalName}</path>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>m2e</id>
|
||||||
|
<!-- This profile is only activated when building in Eclipse with m2e -->
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>m2e.version</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<strolch.env>dev</strolch.env>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class StartupListener implements ServletContextListener {
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
|
|
||||||
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
|
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
|
||||||
|
|
||||||
File pathF = new File(realPath);
|
File pathF = new File(realPath);
|
||||||
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
|
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
|
||||||
logger.info("Starting Agent...");
|
logger.info("Starting Agent...");
|
||||||
|
|
Loading…
Reference in New Issue