Commit d30b02ab authored by Yann Mombrun's avatar Yann Mombrun
Browse files

WEBLAB-1527 - Replace any list of space characters by a single one when...

WEBLAB-1527 - Replace any list of space characters by a single one when importing environment variables

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabApplications/bundle@4402 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 686a7f54
......@@ -30,6 +30,7 @@ import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -250,7 +251,6 @@ public class ProcessUtils {
* Ease environment construction for process
*
* @author asaval
*
*/
public static final class Env {
......@@ -263,7 +263,11 @@ public class ProcessUtils {
public Env(final Map<String, String> details) {
this.details.putAll(details);
if (details != null) {
for (final Entry<String, String> environmentEntry : details.entrySet()) {
this.details.put(environmentEntry.getKey(), environmentEntry.getValue().replaceAll("\\s+", " ").trim());
}
}
}
......@@ -277,30 +281,6 @@ public class ProcessUtils {
}
/**
* Utils method to create environments
*
* @param envs
* variables and their values
* @return an environment
*/
public static Env prepare(final String... envs) {
final Env env = new Env();
for (int i = 0; i < envs.length; i += 2) {
env.details.put(envs[i], envs[i + 1]);
}
return env;
}
public static Env copy(final Env source, final String... envs) {
final Env env = new Env();
env.details.putAll(source.details);
for (int i = 0; i < envs.length; i += 2) {
env.details.put(envs[i], envs[i + 1]);
}
return env;
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- define servers -->
<!--
WebLabServer.tomcat = new TomcatServer("Tomcat", logger);
WebLabServer.tomcat.setHome(properties.getProperty(Constants.Option.TOMCAT_HOME));
WebLabServer.tomcat.setPort(Integer.parseInt(properties.getProperty(Constants.Option.TOMCAT_PORT)));
WebLabServer.tomcat.setJmxPort(Integer.parseInt(properties.getProperty(Constants.Option.TOMCAT_JMX_PORT)));
WebLabServer.tomcat.setDir(PathUtils.getWebLabHome(""));
WebLabServer.tomcat.setStopEnv(Env.prepare("CATALINA_HOME", PathUtils.removeLastSeparator(WebLabServer.tomcat.getHome()), // CATALINA HOME
"JAVA_OPTS", properties.getProperty(Constants.Option.TOMCAT_OPTS))); // JAVA_OPTS
WebLabServer.tomcat.setEnv(
Env.prepare("CATALINA_HOME", PathUtils.removeLastSeparator(WebLabServer.tomcat.getHome()), // CATALINA HOME
"JAVA_OPTS", properties.getProperty(Constants.Option.TOMCAT_OPTS)+
" -Dweblab.repository="+properties.getProperty(Constants.Option.WEBLAB_REPOSITORY)+
" "+properties.getProperty(Constants.Option.TOMCAT_JMX_OPTS))); // JAVA_OPTS
WebLabServer.tomcat.setScript(PathUtils.createPath(WebLabServer.tomcat.getHome(),"bin")+"catalina."+PathUtils.getExtension());
WebLabServer.tomcat.setTimeout(Integer.parseInt(properties.getProperty(Constants.Option.WEBLAB_TIMEOUT)));
WebLabServer.tomcat.setEnabled(Boolean.parseBoolean(properties.getProperty(Constants.Option.TOMCAT_ENABLED)));
public static final String WEBLAB_MONITORING_SERVER = "weblab.monitoring.server";
public static final String WEBLAB_MONITORING_EMAIL = "weblab.monitoring.email";
public static final String WEBLAB_MONITORING_THRESHOLD = "weblab.monitoring.threshold";
public static final String WEBLAB_MONITORING_DELAY = "weblab.monitoring.delay";
public static final String WEBLAB_SPLIT = "weblab.split";
public static final String WEBLAB_REMOTE_ACCESS = "weblab.remote.access";
public static final String WEBLAB_REMOTE_LOGIN = "weblab.remote.login";
public static final String WEBLAB_REMOTE_PASSWORD = "weblab.remote.password";
/**
* WebDav options
*/
public static final String WEBLAB_WEBDAV_URL = "weblab.webdav.url";
public static final String WEBLAB_WEBDAV_USER = "weblab.webdav.user";
public static final String WEBLAB_WEBDAV_PASSWORD = "weblab.webdav.password";
-->
<bean id="Configuration" class="org.ow2.weblab.bundle.WebLabConfiguration">
<!-- <property name="home" value="path/to/weblab" /> -->
<property name="timeout" value="300000" />
<property name="repository" value="data/repository" />
<property name="toIndex" value="data/toIndex" />
<property name="warcs" value="data/warcs" />
<property name="solrData" value="data/solr" />
<property name="solrConf" value="conf/solr" />
<property name="centralConfiguration" value="true" />
<property name="logLevel" value="info" />
<property name="jmxCheck" value="false" />
<property name="contentManager" value="conf/contentManager.properties" />
<property name="registry" value="conf/registry.xml" />
</bean>
<bean id="Tomcat" class="org.ow2.weblab.bundle.server.TomcatServer">
<property name="name" value="Tomcat" />
<!-- <property name="home" value="path/to/tomcat/home" /> -->
<property name="port" value="8181" />
<property name="jmxPort" value="18181" />
<property name="timeout" value="300000" />
<property name="JAVA_OPTS" value="-Xmx1500m -XX:MaxPermSize=256m" />
<property name="enabled" value="true" />
</bean>
<bean id="Liferay" class="org.ow2.weblab.bundle.server.TomcatServer">
<property name="name" value="Liferay" />
<!-- <property name="home" value="path/to/tomcat/home" /> -->
<property name="path" value="liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27" />
<property name="port" value="8080" />
<property name="jmxPort" value="18080" />
<property name="timeout" value="300000" />
<property name="JAVA_OPTS" value="-Xmx1500m -XX:MaxPermSize=512m -Dweblab.client.url=http://localhost:8181/exposed-configuration/weblab-client.xml -Dweblab.portlet.filter.url=http://localhost:8181/exposed-configuration/weblab-portlet-filters.xml" />
<property name="enabled" value="true" />
</bean>
<bean id="Petals" class="org.ow2.weblab.bundle.server.Petals">
<property name="name" value="Petals" />
<!-- <property name="home" value="path/to/tomcat/home" /> -->
<property name="path" value="petals-esb-4.0" />
<property name="port" value="8084" />
<property name="jmxPort" value="7700" />
<property name="timeout" value="300000" />
<property name="JAVA_OPTS" value="-Djava.net.preferIPv4Stack=true -Xmx1024m -XX:MaxPermSize=256m" />
<property name="enabled" value="true" />
</bean>
<!-- Define server order start -->
<!-- Defined server order stop -->
</beans>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment