You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:47:06 UTC

[14/50] [abbrv] brooklyn-library git commit: Add Tomcat 8 support

Add Tomcat 8 support


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/f2de556e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/f2de556e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/f2de556e

Branch: refs/heads/0.7.0-incubating
Commit: f2de556e360bffe0640aa90a1b845fac86eae0a3
Parents: 8b39a93
Author: Mike Zaccardo <mi...@cloudsoftcorp.com>
Authored: Wed May 27 15:17:24 2015 -0400
Committer: Mike Zaccardo <mi...@cloudsoftcorp.com>
Committed: Wed May 27 15:17:24 2015 -0400

----------------------------------------------------------------------
 .../entity/webapp/tomcat/Tomcat7Driver.java     |    7 +-
 .../entity/webapp/tomcat/Tomcat7SshDriver.java  |  161 +-
 .../entity/webapp/tomcat/Tomcat8Server.java     |   55 +
 .../entity/webapp/tomcat/Tomcat8ServerImpl.java |   26 +
 .../entity/webapp/tomcat/TomcatDriver.java      |   24 +
 .../entity/webapp/tomcat/TomcatServerImpl.java  |    2 +-
 .../entity/webapp/tomcat/TomcatSshDriver.java   |  174 +
 .../entity/webapp/tomcat/tomcat8-server.xml     |  149 +
 .../entity/webapp/tomcat/tomcat8-web.xml        | 4615 ++++++++++++++++++
 .../webapp/tomcat/Tomcat8ServerEc2LiveTest.java |   67 +
 .../Tomcat8ServerRestartIntegrationTest.java    |   45 +
 .../Tomcat8ServerSimpleIntegrationTest.java     |  108 +
 .../tomcat/Tomcat8ServerSoftlayerLiveTest.java  |   76 +
 ...mcat8ServerWebAppFixtureIntegrationTest.java |  176 +
 .../TomcatServerSimpleIntegrationTest.java      |   12 +-
 15 files changed, 5535 insertions(+), 162 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7Driver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7Driver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7Driver.java
index 2dcb261..d5a98ac 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7Driver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7Driver.java
@@ -18,7 +18,6 @@
  */
 package brooklyn.entity.webapp.tomcat;
 
-import brooklyn.entity.webapp.JavaWebAppDriver;
-
-public interface Tomcat7Driver extends JavaWebAppDriver {
-}
+@Deprecated
+public interface Tomcat7Driver extends TomcatDriver {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
index 8eae5fb..7fc6150 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
@@ -18,161 +18,12 @@
  */
 package brooklyn.entity.webapp.tomcat;
 
-import static java.lang.String.format;
-
-import java.io.InputStream;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.webapp.JavaWebAppSshDriver;
 import brooklyn.location.basic.SshMachineLocation;
-import brooklyn.util.collections.MutableList;
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.net.Networking;
-import brooklyn.util.os.Os;
-import brooklyn.util.ssh.BashCommands;
-import brooklyn.util.text.StringEscapes.BashStringEscapes;
-
-import com.google.common.base.Preconditions;
-
-public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driver {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Tomcat7SshDriver.class);
-    private static final String KEYSTORE_FILE = "keystore";
-
-    public Tomcat7SshDriver(TomcatServerImpl entity, SshMachineLocation machine) {
-        super(entity, machine);
-    }
-
-    @Override
-    public void preInstall() {
-        resolver = Entities.newDownloader(this);
-        setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName("apache-tomcat-"+getVersion())));
-    }
-
-    @Override
-    public void install() {
-        List<String> urls = resolver.getTargets();
-        String saveAs = resolver.getFilename();
-
-        List<String> commands = new LinkedList<String>();
-        commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs));
-        commands.add(BashCommands.INSTALL_TAR);
-        commands.add(format("tar xvzf %s", saveAs));
-
-        newScript(INSTALLING)
-                .environmentVariablesReset()
-                .body.append(commands)
-                .execute();
-    }
-
-    @Override
-    public void customize() {
-        newScript(CUSTOMIZING)
-                .body.append("mkdir -p conf logs webapps temp")
-                .failOnNonZeroResultCode()
-                .execute();
-
-        copyTemplate(entity.getConfig(TomcatServer.SERVER_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "server.xml"));
-        copyTemplate(entity.getConfig(TomcatServer.WEB_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "web.xml"));
-
-        // Deduplicate same code in JBoss
-        if (isProtocolEnabled("HTTPS")) {
-            String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore URL must be specified if using HTTPS for " + entity);
-            String destinationSslKeystoreFile = getHttpsSslKeystoreFile();
-            InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl);
-            getMachine().copyTo(keystoreStream, destinationSslKeystoreFile);
-        }
-
-        getEntity().deployInitialWars();
-    }
-
-    @Override
-    public void launch() {
-        Map<String, Integer> ports = MutableMap.of("httpPort", getHttpPort(), "shutdownPort", getShutdownPort());
-        Networking.checkPortsValid(ports);
-
-        // We wait for evidence of tomcat running because, using 
-        // brooklyn.ssh.config.tool.class=brooklyn.util.internal.ssh.cli.SshCliTool,
-        // we saw the ssh session return before the tomcat process was fully running 
-        // so the process failed to start.
-        newScript(MutableMap.of(USE_PID_FILE, false), LAUNCHING)
-                .body.append(
-                        format("%s/bin/startup.sh >>$RUN/console 2>&1 </dev/null",getExpandedInstallDir()),
-                        "for i in {1..10}\n" +
-                        "do\n" +
-                        "    if [ -s "+getLogFileLocation()+" ]; then exit; fi\n" +
-                        "    sleep 1\n" +
-                        "done\n" +
-                        "echo \"Couldn't determine if tomcat-server is running (logs/catalina.out is still empty); continuing but may subsequently fail\""
-                    )
-                .execute();
-    }
-
-    @Override
-    public boolean isRunning() {
-        return newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), CHECK_RUNNING).execute() == 0;
-    }
-
-    @Override
-    public void stop() {
-        newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), STOPPING).execute();
-    }
-
-    @Override
-    public void kill() {
-        newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), KILLING).execute();
-    }
-
-    @Override
-    protected List<String> getCustomJavaConfigOptions() {
-        return MutableList.<String>builder()
-                .addAll(super.getCustomJavaConfigOptions())
-                .add("-Xms200m")
-                .add("-Xmx800m")
-                .add("-XX:MaxPermSize=400m")
-                .build();
-    }
-
-    @Override
-    public Map<String, String> getShellEnvironment() {
-        Map<String, String> shellEnv =  MutableMap.<String, String>builder()
-                .putAll(super.getShellEnvironment())
-                .remove("JAVA_OPTS")
-                .put("CATALINA_PID", "pid.txt")
-                .put("CATALINA_BASE", getRunDir())
-                .put("RUN", getRunDir())
-                .build();
-
-        // Double quoting of individual JAVA_OPTS entries required due to eval in catalina.sh
-        List<String> javaOpts = getJavaOpts();
-        String sJavaOpts = BashStringEscapes.doubleQuoteLiteralsForBash(javaOpts.toArray(new String[0]));
-        shellEnv.put("CATALINA_OPTS", sJavaOpts);
-
-        return shellEnv;
-    }
-
-    @Override
-    protected String getLogFileLocation() {
-        return Os.mergePathsUnix(getRunDir(), "logs/catalina.out");
-    }
-
-    @Override
-    protected String getDeploySubdir() {
-       return "webapps";
-    }
-
-    public Integer getShutdownPort() {
-        return entity.getAttribute(TomcatServerImpl.SHUTDOWN_PORT);
-    }
 
-    public String getHttpsSslKeystoreFile() {
-        return Os.mergePathsUnix(getRunDir(), "conf", KEYSTORE_FILE);
-    }
+@Deprecated
+public class Tomcat7SshDriver extends TomcatSshDriver implements Tomcat7Driver {
 
-}
+   public Tomcat7SshDriver(TomcatServerImpl entity, SshMachineLocation machine) {
+       super(entity, machine);
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8Server.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8Server.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8Server.java
new file mode 100644
index 0000000..3c50ff3
--- /dev/null
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8Server.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import brooklyn.catalog.Catalog;
+import brooklyn.config.ConfigKey;
+import brooklyn.entity.basic.ConfigKeys;
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.ImplementedBy;
+import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
+import brooklyn.util.flags.SetFromFlag;
+import brooklyn.util.javalang.JavaClassNames;
+
+/**
+ * An {@link brooklyn.entity.Entity} that represents a single Tomcat instance.
+ */
+@Catalog(name="Tomcat Server",
+        description="Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies",
+        iconUrl="classpath:///tomcat-logo.png")
+@ImplementedBy(Tomcat8ServerImpl.class)
+public interface Tomcat8Server extends TomcatServer {
+
+    @SetFromFlag("version")
+    ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "8.0.22");
+
+    @SetFromFlag("downloadUrl")
+    BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>(
+            SoftwareProcess.DOWNLOAD_URL, "http://download.nextag.com/apache/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz");
+
+    @SetFromFlag("server.xml")
+    ConfigKey<String> SERVER_XML_RESOURCE = ConfigKeys.newStringConfigKey(
+            "tomcat.serverxml", "The file to template and use as the Tomcat process' server.xml",
+            JavaClassNames.resolveClasspathUrl(Tomcat8Server.class, "tomcat8-server.xml"));
+
+    @SetFromFlag("web.xml")
+    ConfigKey<String> WEB_XML_RESOURCE = ConfigKeys.newStringConfigKey(
+            "tomcat.webxml", "The file to template and use as the Tomcat process' web.xml",
+            JavaClassNames.resolveClasspathUrl(Tomcat8Server.class, "tomcat8-web.xml"));
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerImpl.java
new file mode 100644
index 0000000..6858f51
--- /dev/null
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerImpl.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+/**
+ * An {@link brooklyn.entity.Entity} that represents a single Tomcat instance.
+ */
+public class Tomcat8ServerImpl extends TomcatServerImpl implements Tomcat8Server {
+}
+

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatDriver.java
new file mode 100644
index 0000000..00b4628
--- /dev/null
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatDriver.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import brooklyn.entity.webapp.JavaWebAppDriver;
+
+public interface TomcatDriver extends JavaWebAppDriver {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
index 64a4765..2618c31 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
@@ -101,7 +101,7 @@ public class TomcatServerImpl extends JavaWebAppSoftwareProcessImpl implements T
     @SuppressWarnings("rawtypes")
     @Override
     public Class getDriverInterface() {
-        return Tomcat7Driver.class;
+        return TomcatDriver.class;
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatSshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatSshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatSshDriver.java
new file mode 100644
index 0000000..76c820d
--- /dev/null
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatSshDriver.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import static java.lang.String.format;
+
+import java.io.InputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.webapp.JavaWebAppSshDriver;
+import brooklyn.location.basic.SshMachineLocation;
+import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.net.Networking;
+import brooklyn.util.os.Os;
+import brooklyn.util.ssh.BashCommands;
+import brooklyn.util.text.StringEscapes.BashStringEscapes;
+
+import com.google.common.base.Preconditions;
+
+public class TomcatSshDriver extends JavaWebAppSshDriver implements TomcatDriver {
+
+    private static final String KEYSTORE_FILE = "keystore";
+
+    public TomcatSshDriver(TomcatServerImpl entity, SshMachineLocation machine) {
+        super(entity, machine);
+    }
+
+    @Override
+    public void preInstall() {
+        resolver = Entities.newDownloader(this);
+        setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName("apache-tomcat-"+getVersion())));
+    }
+
+    @Override
+    public void install() {
+        List<String> urls = resolver.getTargets();
+        String saveAs = resolver.getFilename();
+
+        List<String> commands = new LinkedList<String>();
+        commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs));
+        commands.add(BashCommands.INSTALL_TAR);
+        commands.add(format("tar xvzf %s", saveAs));
+
+        newScript(INSTALLING)
+                .environmentVariablesReset()
+                .body.append(commands)
+                .execute();
+    }
+
+    @Override
+    public void customize() {
+        newScript(CUSTOMIZING)
+                .body.append("mkdir -p conf logs webapps temp")
+                .failOnNonZeroResultCode()
+                .execute();
+
+        copyTemplate(entity.getConfig(TomcatServer.SERVER_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "server.xml"));
+        copyTemplate(entity.getConfig(TomcatServer.WEB_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "web.xml"));
+
+        // Deduplicate same code in JBoss
+        if (isProtocolEnabled("HTTPS")) {
+            String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore URL must be specified if using HTTPS for " + entity);
+            String destinationSslKeystoreFile = getHttpsSslKeystoreFile();
+            InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl);
+            getMachine().copyTo(keystoreStream, destinationSslKeystoreFile);
+        }
+
+        getEntity().deployInitialWars();
+    }
+
+    @Override
+    public void launch() {
+        Map<String, Integer> ports = MutableMap.of("httpPort", getHttpPort(), "shutdownPort", getShutdownPort());
+        Networking.checkPortsValid(ports);
+
+        // We wait for evidence of tomcat running because, using 
+        // brooklyn.ssh.config.tool.class=brooklyn.util.internal.ssh.cli.SshCliTool,
+        // we saw the ssh session return before the tomcat process was fully running 
+        // so the process failed to start.
+        newScript(MutableMap.of(USE_PID_FILE, false), LAUNCHING)
+                .body.append(
+                        format("%s/bin/startup.sh >>$RUN/console 2>&1 </dev/null",getExpandedInstallDir()),
+                        "for i in {1..10}\n" +
+                        "do\n" +
+                        "    if [ -s "+getLogFileLocation()+" ]; then exit; fi\n" +
+                        "    sleep 1\n" +
+                        "done\n" +
+                        "echo \"Couldn't determine if tomcat-server is running (logs/catalina.out is still empty); continuing but may subsequently fail\""
+                    )
+                .execute();
+    }
+
+    @Override
+    public boolean isRunning() {
+        return newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), CHECK_RUNNING).execute() == 0;
+    }
+
+    @Override
+    public void stop() {
+        newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), STOPPING).execute();
+    }
+
+    @Override
+    public void kill() {
+        newScript(MutableMap.of(USE_PID_FILE, "pid.txt"), KILLING).execute();
+    }
+
+    @Override
+    protected List<String> getCustomJavaConfigOptions() {
+        return MutableList.<String>builder()
+                .addAll(super.getCustomJavaConfigOptions())
+                .add("-Xms200m")
+                .add("-Xmx800m")
+                .add("-XX:MaxPermSize=400m")
+                .build();
+    }
+
+    @Override
+    public Map<String, String> getShellEnvironment() {
+        Map<String, String> shellEnv =  MutableMap.<String, String>builder()
+                .putAll(super.getShellEnvironment())
+                .remove("JAVA_OPTS")
+                .put("CATALINA_PID", "pid.txt")
+                .put("CATALINA_BASE", getRunDir())
+                .put("RUN", getRunDir())
+                .build();
+
+        // Double quoting of individual JAVA_OPTS entries required due to eval in catalina.sh
+        List<String> javaOpts = getJavaOpts();
+        String sJavaOpts = BashStringEscapes.doubleQuoteLiteralsForBash(javaOpts.toArray(new String[0]));
+        shellEnv.put("CATALINA_OPTS", sJavaOpts);
+
+        return shellEnv;
+    }
+
+    @Override
+    protected String getLogFileLocation() {
+        return Os.mergePathsUnix(getRunDir(), "logs/catalina.out");
+    }
+
+    @Override
+    protected String getDeploySubdir() {
+       return "webapps";
+    }
+
+    public Integer getShutdownPort() {
+        return entity.getAttribute(TomcatServerImpl.SHUTDOWN_PORT);
+    }
+
+    public String getHttpsSslKeystoreFile() {
+        return Os.mergePathsUnix(getRunDir(), "conf", KEYSTORE_FILE);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/tomcat8-server.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/tomcat8-server.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/tomcat8-server.xml
new file mode 100644
index 0000000..98f014a
--- /dev/null
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/tomcat8-server.xml
@@ -0,0 +1,149 @@
+[#ftl]
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- Brooklyn note: This file is a modified copy of server.xml from Tomcat v8.0.22.
+-->
+<!-- Note:  A "Server" is not itself a "Container", so you may not
+     define subcomponents such as "Valves" at this level.
+     Documentation at /docs/config/server.html
+ -->
+<Server port="${driver.shutdownPort?c}" shutdown="SHUTDOWN">
+  <!-- Security listener. Documentation at /docs/config/listeners.html
+  <Listener className="org.apache.catalina.security.SecurityListener" />
+  -->
+  <!--APR library loader. Documentation at /docs/apr.html -->
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+  <!-- Global JNDI resources
+       Documentation at /docs/jndi-resources-howto.html
+  -->
+  <GlobalNamingResources>
+    <!-- Editable user database that can also be used by
+         UserDatabaseRealm to authenticate users
+    -->
+    <Resource name="UserDatabase" auth="Container"
+              type="org.apache.catalina.UserDatabase"
+              description="User database that can be updated and saved"
+              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+              pathname="conf/tomcat-users.xml" />
+  </GlobalNamingResources>
+
+  <!-- A "Service" is a collection of one or more "Connectors" that share
+       a single "Container" Note:  A "Service" is not itself a "Container",
+       so you may not define subcomponents such as "Valves" at this level.
+       Documentation at /docs/config/service.html
+   -->
+  <Service name="Catalina">
+
+    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
+    <!--
+    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+        maxThreads="150" minSpareThreads="4"/>
+    -->
+
+
+    <!-- A "Connector" represents an endpoint by which requests are received
+         and responses are returned. Documentation at :
+         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+         Java AJP  Connector: /docs/config/ajp.html
+         APR (HTTP/AJP) Connector: /docs/apr.html
+         Define a non-SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
+    -->
+    [#if entity.httpEnabled]
+    <Connector port="${driver.httpPort?c}" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="${driver.httpsPort?c}" />
+    [/#if]
+
+    <!-- A "Connector" using the shared thread pool-->
+    <!--
+    <Connector executor="tomcatThreadPool"
+               port="${driver.httpPort?c}" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="${driver.httpsPort?c}" />
+    -->
+
+    <!-- Define a SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
+         This connector uses the BIO implementation that requires the JSSE
+         style configuration. When using the APR/native implementation, the
+         OpenSSL style configuration is required as described in the APR/native
+         documentation -->
+    [#if entity.httpsEnabled]
+    <Connector port="${driver.httpsPort?c}" protocol="org.apache.coyote.http11.Http11Protocol"
+               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
+               keystoreFile="${driver.httpsSslKeystoreFile}" keystorePass="${entity.httpsSslKeystorePassword}"
+               clientAuth="false" sslEnabledProtocols="TLSv1.2,TLSv1.1,TLSv1" />
+    [/#if]
+
+    <!-- Define an AJP 1.3 Connector on port 8009 -->
+    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="${driver.httpPort?c}" /> -->
+
+
+    <!-- An Engine represents the entry point (within Catalina) that processes
+         every request.  The Engine implementation for Tomcat stand alone
+         analyzes the HTTP headers included with the request, and passes them
+         on to the appropriate Host (virtual host).
+         Documentation at /docs/config/engine.html -->
+
+    <!-- You should set jvmRoute to support load-balancing via AJP ie :
+    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
+    -->
+    <Engine name="Catalina" defaultHost="localhost">
+
+      <!--For clustering, please take a look at documentation at:
+          /docs/cluster-howto.html  (simple how to)
+          /docs/config/cluster.html (reference documentation) -->
+      <!--
+      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+      -->
+
+      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
+           via a brute-force attack -->
+      <Realm className="org.apache.catalina.realm.LockOutRealm">
+        <!-- This Realm uses the UserDatabase configured in the global JNDI
+             resources under the key "UserDatabase".  Any edits
+             that are performed against this UserDatabase are immediately
+             available for use by the Realm.  -->
+        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+               resourceName="UserDatabase"/>
+      </Realm>
+
+      <Host name="localhost"  appBase="webapps"
+            unpackWARs="true" autoDeploy="true">
+
+        <!-- SingleSignOn valve, share authentication between web applications
+             Documentation at: /docs/config/valve.html -->
+        <!--
+        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+        -->
+
+        <!-- Access log processes all example.
+             Documentation at: /docs/config/valve.html
+             Note: The pattern used is equivalent to using pattern="common" -->
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+               prefix="localhost_access_log" suffix=".txt"
+               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+
+      </Host>
+    </Engine>
+  </Service>
+</Server>