Move Catalina start to runtime
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 11 Dec 2012 09:56:30 +0000 (09:56 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 11 Dec 2012 09:56:30 +0000 (09:56 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5948 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

20 files changed:
server/modules/org.argeo.server.catalina.start/.classpath [deleted file]
server/modules/org.argeo.server.catalina.start/.project [deleted file]
server/modules/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs [deleted file]
server/modules/org.argeo.server.catalina.start/META-INF/MANIFEST.MF [deleted file]
server/modules/org.argeo.server.catalina.start/build.properties [deleted file]
server/modules/org.argeo.server.catalina.start/pom.xml [deleted file]
server/modules/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java [deleted file]
server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java [deleted file]
server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java [deleted file]
server/modules/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml [deleted file]
server/runtime/org.argeo.server.catalina.start/.classpath [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/.project [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/META-INF/MANIFEST.MF [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/build.properties [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/pom.xml [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java [new file with mode: 0644]
server/runtime/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml [new file with mode: 0644]

diff --git a/server/modules/org.argeo.server.catalina.start/.classpath b/server/modules/org.argeo.server.catalina.start/.classpath
deleted file mode 100644 (file)
index b56882d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
-       <classpathentry kind="src" output="target/classes" path="src/main/resources"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
diff --git a/server/modules/org.argeo.server.catalina.start/.project b/server/modules/org.argeo.server.catalina.start/.project
deleted file mode 100644 (file)
index 25f3507..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.server.catalina.start</name>
-       <comment></comment>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-               <nature>org.eclipse.pde.PluginNature</nature>
-       </natures>
-</projectDescription>
-
diff --git a/server/modules/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs b/server/modules/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 6d0bce7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#Fri Apr 23 08:40:00 CEST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/server/modules/org.argeo.server.catalina.start/META-INF/MANIFEST.MF b/server/modules/org.argeo.server.catalina.start/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 2b322c7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Bundle-Activator: org.argeo.dep.osgi.catalina.start.CatalinaActivator\r
-Created-By: Argeo\r
-Import-Package: javax.management;resolution:=optional,\r
- org.apache.catalina,\r
- org.apache.catalina.connector,\r
- org.apache.catalina.core,\r
- org.apache.catalina.startup,\r
- org.apache.catalina.util,\r
- org.apache.commons.io,\r
- org.apache.commons.logging;resolution:=optional,\r
- org.apache.naming.resources,\r
- org.osgi.framework;version="1.3",\r
- org.osgi.service.url;version="1.0"\r
-Bundle-Version: 1.0.0.0009\r
-Bundle-Name: Tomcat Catalina OSGi Activator (Argeo)\r
-Bundle-Description: Tomcat Catalina OSGi Activator with Argeo addons\r
-Bundle-SymbolicName: org.argeo.dep.osgi.catalina.start\r
-Bundle-RequiredExecutionEnvironment: J2SE-1.5\r
diff --git a/server/modules/org.argeo.server.catalina.start/build.properties b/server/modules/org.argeo.server.catalina.start/build.properties
deleted file mode 100644 (file)
index 2c65f86..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/main/java/,\
-           src/main/resources/
-output.. = target/classes/
-bin.includes = META-INF/,\
-               .
diff --git a/server/modules/org.argeo.server.catalina.start/pom.xml b/server/modules/org.argeo.server.catalina.start/pom.xml
deleted file mode 100644 (file)
index 7a405eb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<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">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons.server</groupId>
-               <version>1.1.9-SNAPSHOT</version>
-               <artifactId>modules</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.server.catalina.start</artifactId>
-       <name>Commons Catalina starter</name>
-       <description>Catalina starter hacked from Spring DM sandbox</description>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-Activator>org.argeo.dep.osgi.catalina.start.CatalinaActivator</Bundle-Activator>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <dependency>
-                       <groupId>org.eclipse.osgi</groupId>
-                       <artifactId>org.eclipse.osgi</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.catalina</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.logging</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.io</artifactId>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/server/modules/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java b/server/modules/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java
deleted file mode 100644 (file)
index 5c1df1a..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.argeo.dep.osgi.catalina.start;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.commons.io.IOUtils;
-import org.osgi.framework.BundleContext;
-import org.springframework.osgi.web.tomcat.internal.Activator;
-
-/** Starts Catalina (hacked from Spring OSGi 1.0) */
-public class CatalinaActivator extends Activator {
-       private final static String ARGEO_OSGI_DATA_DIR = "argeo.osgi.data.dir";
-
-       public void start(BundleContext context) throws Exception {
-               if (!System.getProperties().containsKey(ARGEO_OSGI_DATA_DIR)) {
-                       String osgiInstanceArea = System.getProperty("osgi.instance.area");
-                       String osgiInstanceAreaDefault = System
-                                       .getProperty("osgi.instance.area.default");
-                       String tempDir = System.getProperty("java.io.tmpdir");
-
-                       File dataDir = null;
-                       if (osgiInstanceArea != null) {
-                               // within OSGi with -data specified
-                               osgiInstanceArea = removeFilePrefix(osgiInstanceArea);
-                               dataDir = new File(osgiInstanceArea);
-                       } else if (osgiInstanceAreaDefault != null) {
-                               // within OSGi without -data specified
-                               osgiInstanceAreaDefault = removeFilePrefix(osgiInstanceAreaDefault);
-                               dataDir = new File(osgiInstanceAreaDefault);
-                       } else {// outside OSGi
-                               dataDir = new File(tempDir + File.separator + "osgiData");
-                       }
-
-                       System.setProperty(ARGEO_OSGI_DATA_DIR, dataDir.getAbsolutePath());
-               }
-
-               // Load config properties and put them in system properties so that they
-               // can be used in tomcat conf
-               Properties confProps = new Properties();
-               URL propsUrl = context.getBundle().getResource("tomcat.properties");
-               if (propsUrl != null) {
-                       InputStream in = null;
-                       try {
-                               in = propsUrl.openStream();
-                               confProps.load(in);
-                       } catch (Exception e) {
-                               throw new RuntimeException("Cannot read catalina properties.",
-                                               e);
-                       } finally {
-                               IOUtils.closeQuietly(in);
-                       }
-
-                       for (Object key : confProps.keySet()) {
-                               // System properties have priority
-                               if (!System.getProperties().containsKey(key)) {
-                                       System.setProperty(key.toString(),
-                                                       confProps.getProperty(key.toString()));
-                               }
-                       }
-               }
-
-               // calling Catalina.setCatalinaHome(String) or
-               // Catalina.setCatalinaBase(String) does the same
-               if (System.getProperty("catalina.home") == null)
-                       System.setProperty("catalina.home",
-                                       System.getProperty(ARGEO_OSGI_DATA_DIR) + "/tomcat");
-               if (System.getProperty("catalina.base") == null)
-                       System.setProperty("catalina.base",
-                                       System.getProperty(ARGEO_OSGI_DATA_DIR) + "/tomcat");
-
-               // Call Spring starter
-               super.start(context);
-       }
-
-       @Override
-       public void stop(BundleContext context) throws Exception {
-               super.stop(context);
-       }
-
-       protected String removeFilePrefix(String url) {
-               if (url.startsWith("file:"))
-                       return url.substring("file:".length());
-               else if (url.startsWith("reference:file:"))
-                       return url.substring("reference:file:".length());
-               else
-                       return url;
-       }
-
-}
diff --git a/server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java b/server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java
deleted file mode 100644 (file)
index 70284fe..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*\r
- * Copyright 2006-2008 the original author or authors.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.springframework.osgi.web.tomcat.internal;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.net.URL;\r
-import java.net.URLConnection;\r
-import java.net.URLStreamHandler;\r
-import java.util.Properties;\r
-\r
-import javax.management.MBeanRegistration;\r
-\r
-import org.apache.catalina.Lifecycle;\r
-import org.apache.catalina.Server;\r
-import org.apache.catalina.Service;\r
-import org.apache.catalina.connector.Connector;\r
-import org.apache.catalina.core.StandardService;\r
-import org.apache.catalina.util.ServerInfo;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.apache.naming.resources.DirContextURLStreamHandler;\r
-import org.osgi.framework.Bundle;\r
-import org.osgi.framework.BundleActivator;\r
-import org.osgi.framework.BundleContext;\r
-import org.osgi.framework.Constants;\r
-import org.osgi.framework.ServiceRegistration;\r
-import org.osgi.service.url.AbstractURLStreamHandlerService;\r
-import org.osgi.service.url.URLConstants;\r
-import org.osgi.service.url.URLStreamHandlerService;\r
-\r
-/**\r
- * Simple activator for starting Apache Tomcat Catalina container inside OSGi\r
- * using Tomcat's XML configuration files.\r
- * \r
- * <p/> This activator looks initially for a <code>conf/server.xml</code> file\r
- * falling back to <code>conf/default-server.xml</code>. This allows the\r
- * default configuration to be tweaked through fragments for example.\r
- * \r
- * @author Costin Leau\r
- */\r
-public class Activator implements BundleActivator {\r
-\r
-       /** logger */\r
-       private static final Log log = LogFactory.getLog(Activator.class);\r
-\r
-       /** default XML configuration */\r
-       private static final String DEFAULT_XML_CONF_LOCATION = "conf/default-server.xml";\r
-\r
-       /** user-configurable XML configuration */\r
-       private static final String XML_CONF_LOCATION = "conf/server.xml";\r
-\r
-       private BundleContext bundleContext;\r
-\r
-       private StandardService server;\r
-\r
-       private ServiceRegistration registration, urlRegistration;\r
-\r
-       private Thread startupThread;\r
-\r
-\r
-       public void start(BundleContext context) throws Exception {\r
-               this.bundleContext = context;\r
-               // do the initialization on a different thread\r
-               // so the activator finishes fast\r
-               startupThread = new Thread(new Runnable() {\r
-\r
-                       public void run() {\r
-                               log.info("Starting " + ServerInfo.getServerInfo() + " ...");\r
-\r
-                               // default startup procedure\r
-                               ClassLoader cl = Activator.class.getClassLoader();\r
-                               Thread current = Thread.currentThread();\r
-                               ClassLoader old = current.getContextClassLoader();\r
-\r
-                               try {\r
-                                       current.setContextClassLoader(cl);\r
-\r
-                                       server = createCatalinaServer(bundleContext.getBundle());\r
-\r
-                                       server.start();\r
-\r
-                                       Connector[] connectors = server.findConnectors();\r
-                                       for (int i = 0; i < connectors.length; i++) {\r
-                                               Connector conn = connectors[i];\r
-                                               log.info("Succesfully started " + ServerInfo.getServerInfo() + " @ " + conn.getDomain() + ":"\r
-                                                               + conn.getPort());\r
-                                       }\r
-\r
-                                       // register URL service\r
-                                       urlRegistration = registerTomcatJNDIUrlService();\r
-                                       // publish server as an OSGi service\r
-                                       registration = publishServerAsAService(server);\r
-                                       log.info("Published " + ServerInfo.getServerInfo() + " as an OSGi service");\r
-                               }\r
-                               catch (Exception ex) {\r
-                                       String msg = "Cannot start " + ServerInfo.getServerInfo();\r
-                                       log.error(msg, ex);\r
-                                       throw new RuntimeException(msg, ex);\r
-                               }\r
-                               finally {\r
-                                       current.setContextClassLoader(old);\r
-                               }\r
-                       }\r
-               }, "Tomcat Catalina Start Thread");\r
-\r
-               startupThread.start();\r
-       }\r
-\r
-       public void stop(BundleContext context) throws Exception {\r
-               // unpublish service first\r
-               registration.unregister();\r
-               urlRegistration.unregister();\r
-\r
-               log.info("Unpublished  " + ServerInfo.getServerInfo() + " OSGi service");\r
-\r
-               // default startup procedure\r
-               ClassLoader cl = Activator.class.getClassLoader();\r
-               Thread current = Thread.currentThread();\r
-               ClassLoader old = current.getContextClassLoader();\r
-\r
-               try {\r
-                       current.setContextClassLoader(cl);\r
-                       //reset CCL \r
-                       // current.setContextClassLoader(null);\r
-                       log.info("Stopping " + ServerInfo.getServerInfo() + " ...");\r
-                       server.stop();\r
-                       log.info("Succesfully stopped " + ServerInfo.getServerInfo());\r
-               }\r
-               catch (Exception ex) {\r
-                       log.error("Cannot stop " + ServerInfo.getServerInfo(), ex);\r
-                       throw ex;\r
-               }\r
-               finally {\r
-                       current.setContextClassLoader(old);\r
-               }\r
-       }\r
-\r
-       private StandardService createCatalinaServer(Bundle bundle) throws Exception {\r
-               // first try to use the XML file\r
-               URL xmlConfiguration = bundle.getResource(XML_CONF_LOCATION);\r
-\r
-               if (xmlConfiguration != null) {\r
-                       log.info("Using custom XML configuration " + xmlConfiguration);\r
-               }\r
-               else {\r
-                       xmlConfiguration = bundle.getResource(DEFAULT_XML_CONF_LOCATION);\r
-                       if (xmlConfiguration == null)\r
-                               log.error("No XML configuration found; bailing out...");\r
-                       else\r
-                               log.info("Using default XML configuration " + xmlConfiguration);\r
-               }\r
-\r
-               return createServerFromXML(xmlConfiguration);\r
-       }\r
-\r
-       private StandardService createServerFromXML(URL xmlConfiguration) throws IOException {\r
-               OsgiCatalina catalina = new OsgiCatalina();\r
-               catalina.setAwait(false);\r
-               catalina.setUseShutdownHook(false);\r
-               catalina.setName("Catalina");\r
-               catalina.setParentClassLoader(Thread.currentThread().getContextClassLoader());\r
-\r
-               // copy the URL file to a local temporary file (since Catalina doesn't use URL unfortunately)\r
-               File configTempFile = File.createTempFile("dm.catalina", ".cfg.xml");\r
-               configTempFile.deleteOnExit();\r
-\r
-               // copy URL to temporary file\r
-               copyURLToFile(xmlConfiguration.openStream(), new FileOutputStream(configTempFile));\r
-               log.debug("Copied configuration " + xmlConfiguration + " to temporary file " + configTempFile);\r
-\r
-               catalina.setConfigFile(configTempFile.getAbsolutePath());\r
-\r
-               catalina.load();\r
-\r
-               Server server = catalina.getServer();\r
-\r
-               return (StandardService) server.findServices()[0];\r
-       }\r
-\r
-       private void copyURLToFile(InputStream inStream, FileOutputStream outStream) {\r
-\r
-               int bytesRead;\r
-               byte[] buf = new byte[4096];\r
-               try {\r
-                       while ((bytesRead = inStream.read(buf)) >= 0) {\r
-                               outStream.write(buf, 0, bytesRead);\r
-                       }\r
-               }\r
-               catch (IOException ex) {\r
-                       throw (RuntimeException) new IllegalStateException("Cannot copy URL to file").initCause(ex);\r
-               }\r
-               finally {\r
-                       try {\r
-                               inStream.close();\r
-                       }\r
-                       catch (IOException ignore) {\r
-                       }\r
-                       try {\r
-                               outStream.close();\r
-                       }\r
-                       catch (IOException ignore) {\r
-                       }\r
-               }\r
-       }\r
-\r
-       private ServiceRegistration publishServerAsAService(StandardService server) {\r
-               Properties props = new Properties();\r
-               // put some extra properties to easily identify the service\r
-               props.put(Constants.SERVICE_VENDOR, "Spring Dynamic Modules");\r
-               props.put(Constants.SERVICE_DESCRIPTION, ServerInfo.getServerInfo());\r
-               props.put(Constants.BUNDLE_VERSION, ServerInfo.getServerNumber());\r
-               props.put(Constants.BUNDLE_NAME, bundleContext.getBundle().getSymbolicName());\r
-\r
-               // spring-dm specific property\r
-               props.put("org.springframework.osgi.bean.name", "tomcat-server");\r
-\r
-               // publish just the interfaces and the major classes (server/handlerWrapper)\r
-               String[] classes = new String[] { StandardService.class.getName(), Service.class.getName(),\r
-                       MBeanRegistration.class.getName(), Lifecycle.class.getName() };\r
-\r
-               return bundleContext.registerService(classes, server, props);\r
-       }\r
-\r
-       private ServiceRegistration registerTomcatJNDIUrlService() {\r
-               Properties properties = new Properties();\r
-               properties.put(URLConstants.URL_HANDLER_PROTOCOL, "jndi");\r
-               final URLStreamHandler handler = new DirContextURLStreamHandler();\r
-\r
-               return bundleContext.registerService(URLStreamHandlerService.class.getName(),\r
-                       new AbstractURLStreamHandlerService() {\r
-\r
-                               private final static String EMPTY_STRING = "";\r
-\r
-\r
-                               public URLConnection openConnection(URL u) throws IOException {\r
-                                       return new URL(u, EMPTY_STRING, handler).openConnection();\r
-                               }\r
-                       }, properties);\r
-       }\r
-}
\ No newline at end of file
diff --git a/server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java b/server/modules/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java
deleted file mode 100644 (file)
index f7903ff..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*\r
- * Copyright 2006-2008 the original author or authors.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.springframework.osgi.web.tomcat.internal;\r
-\r
-import org.apache.catalina.Server;\r
-import org.apache.catalina.startup.Catalina;\r
-\r
-/**\r
- * OSGi extension of Catalina class used for easy access to the underlying\r
- * configuration.\r
- * \r
- * @author Costin Leau\r
- * \r
- */\r
-public class OsgiCatalina extends Catalina {\r
-\r
-       public Server getServer() {\r
-               return server;\r
-       }\r
-}\r
diff --git a/server/modules/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml b/server/modules/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml
deleted file mode 100644 (file)
index c8cd5bb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<Server port="8005" shutdown="SHUTDOWN">\r
-\r
-\r
-       <Service name="Catalina">\r
-               <Connector port="8080" />\r
-\r
-               <Engine name="Catalina" defaultHost="localhost">\r
-                       <Host name="localhost" unpackWARs="false" autoDeploy="false"\r
-                               liveDeploy="false" deployOnStartup="false" xmlValidation="false"\r
-                               xmlNamespaceAware="false">\r
-                       </Host>\r
-               </Engine>\r
-\r
-\r
-       </Service>\r
-</Server>\r
diff --git a/server/runtime/org.argeo.server.catalina.start/.classpath b/server/runtime/org.argeo.server.catalina.start/.classpath
new file mode 100644 (file)
index 0000000..b56882d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+       <classpathentry kind="src" output="target/classes" path="src/main/resources"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
diff --git a/server/runtime/org.argeo.server.catalina.start/.project b/server/runtime/org.argeo.server.catalina.start/.project
new file mode 100644 (file)
index 0000000..25f3507
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.server.catalina.start</name>
+       <comment></comment>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.PluginNature</nature>
+       </natures>
+</projectDescription>
+
diff --git a/server/runtime/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs b/server/runtime/org.argeo.server.catalina.start/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..6d0bce7
--- /dev/null
@@ -0,0 +1,12 @@
+#Fri Apr 23 08:40:00 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/server/runtime/org.argeo.server.catalina.start/META-INF/MANIFEST.MF b/server/runtime/org.argeo.server.catalina.start/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..2b322c7
--- /dev/null
@@ -0,0 +1,18 @@
+Bundle-Activator: org.argeo.dep.osgi.catalina.start.CatalinaActivator\r
+Created-By: Argeo\r
+Import-Package: javax.management;resolution:=optional,\r
+ org.apache.catalina,\r
+ org.apache.catalina.connector,\r
+ org.apache.catalina.core,\r
+ org.apache.catalina.startup,\r
+ org.apache.catalina.util,\r
+ org.apache.commons.io,\r
+ org.apache.commons.logging;resolution:=optional,\r
+ org.apache.naming.resources,\r
+ org.osgi.framework;version="1.3",\r
+ org.osgi.service.url;version="1.0"\r
+Bundle-Version: 1.0.0.0009\r
+Bundle-Name: Tomcat Catalina OSGi Activator (Argeo)\r
+Bundle-Description: Tomcat Catalina OSGi Activator with Argeo addons\r
+Bundle-SymbolicName: org.argeo.dep.osgi.catalina.start\r
+Bundle-RequiredExecutionEnvironment: J2SE-1.5\r
diff --git a/server/runtime/org.argeo.server.catalina.start/build.properties b/server/runtime/org.argeo.server.catalina.start/build.properties
new file mode 100644 (file)
index 0000000..2c65f86
--- /dev/null
@@ -0,0 +1,5 @@
+source.. = src/main/java/,\
+           src/main/resources/
+output.. = target/classes/
+bin.includes = META-INF/,\
+               .
diff --git a/server/runtime/org.argeo.server.catalina.start/pom.xml b/server/runtime/org.argeo.server.catalina.start/pom.xml
new file mode 100644 (file)
index 0000000..7a405eb
--- /dev/null
@@ -0,0 +1,44 @@
+<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">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons.server</groupId>
+               <version>1.1.9-SNAPSHOT</version>
+               <artifactId>modules</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.server.catalina.start</artifactId>
+       <name>Commons Catalina starter</name>
+       <description>Catalina starter hacked from Spring DM sandbox</description>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-Activator>org.argeo.dep.osgi.catalina.start.CatalinaActivator</Bundle-Activator>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+       <dependencies>
+               <dependency>
+                       <groupId>org.eclipse.osgi</groupId>
+                       <artifactId>org.eclipse.osgi</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.apache.catalina</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.apache.commons.logging</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.apache.commons.io</artifactId>
+               </dependency>
+       </dependencies>
+</project>
diff --git a/server/runtime/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java b/server/runtime/org.argeo.server.catalina.start/src/main/java/org/argeo/dep/osgi/catalina/start/CatalinaActivator.java
new file mode 100644 (file)
index 0000000..5c1df1a
--- /dev/null
@@ -0,0 +1,91 @@
+package org.argeo.dep.osgi.catalina.start;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.commons.io.IOUtils;
+import org.osgi.framework.BundleContext;
+import org.springframework.osgi.web.tomcat.internal.Activator;
+
+/** Starts Catalina (hacked from Spring OSGi 1.0) */
+public class CatalinaActivator extends Activator {
+       private final static String ARGEO_OSGI_DATA_DIR = "argeo.osgi.data.dir";
+
+       public void start(BundleContext context) throws Exception {
+               if (!System.getProperties().containsKey(ARGEO_OSGI_DATA_DIR)) {
+                       String osgiInstanceArea = System.getProperty("osgi.instance.area");
+                       String osgiInstanceAreaDefault = System
+                                       .getProperty("osgi.instance.area.default");
+                       String tempDir = System.getProperty("java.io.tmpdir");
+
+                       File dataDir = null;
+                       if (osgiInstanceArea != null) {
+                               // within OSGi with -data specified
+                               osgiInstanceArea = removeFilePrefix(osgiInstanceArea);
+                               dataDir = new File(osgiInstanceArea);
+                       } else if (osgiInstanceAreaDefault != null) {
+                               // within OSGi without -data specified
+                               osgiInstanceAreaDefault = removeFilePrefix(osgiInstanceAreaDefault);
+                               dataDir = new File(osgiInstanceAreaDefault);
+                       } else {// outside OSGi
+                               dataDir = new File(tempDir + File.separator + "osgiData");
+                       }
+
+                       System.setProperty(ARGEO_OSGI_DATA_DIR, dataDir.getAbsolutePath());
+               }
+
+               // Load config properties and put them in system properties so that they
+               // can be used in tomcat conf
+               Properties confProps = new Properties();
+               URL propsUrl = context.getBundle().getResource("tomcat.properties");
+               if (propsUrl != null) {
+                       InputStream in = null;
+                       try {
+                               in = propsUrl.openStream();
+                               confProps.load(in);
+                       } catch (Exception e) {
+                               throw new RuntimeException("Cannot read catalina properties.",
+                                               e);
+                       } finally {
+                               IOUtils.closeQuietly(in);
+                       }
+
+                       for (Object key : confProps.keySet()) {
+                               // System properties have priority
+                               if (!System.getProperties().containsKey(key)) {
+                                       System.setProperty(key.toString(),
+                                                       confProps.getProperty(key.toString()));
+                               }
+                       }
+               }
+
+               // calling Catalina.setCatalinaHome(String) or
+               // Catalina.setCatalinaBase(String) does the same
+               if (System.getProperty("catalina.home") == null)
+                       System.setProperty("catalina.home",
+                                       System.getProperty(ARGEO_OSGI_DATA_DIR) + "/tomcat");
+               if (System.getProperty("catalina.base") == null)
+                       System.setProperty("catalina.base",
+                                       System.getProperty(ARGEO_OSGI_DATA_DIR) + "/tomcat");
+
+               // Call Spring starter
+               super.start(context);
+       }
+
+       @Override
+       public void stop(BundleContext context) throws Exception {
+               super.stop(context);
+       }
+
+       protected String removeFilePrefix(String url) {
+               if (url.startsWith("file:"))
+                       return url.substring("file:".length());
+               else if (url.startsWith("reference:file:"))
+                       return url.substring("reference:file:".length());
+               else
+                       return url;
+       }
+
+}
diff --git a/server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java b/server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/Activator.java
new file mode 100644 (file)
index 0000000..70284fe
--- /dev/null
@@ -0,0 +1,257 @@
+/*\r
+ * Copyright 2006-2008 the original author or authors.\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.springframework.osgi.web.tomcat.internal;\r
+\r
+import java.io.File;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.net.URL;\r
+import java.net.URLConnection;\r
+import java.net.URLStreamHandler;\r
+import java.util.Properties;\r
+\r
+import javax.management.MBeanRegistration;\r
+\r
+import org.apache.catalina.Lifecycle;\r
+import org.apache.catalina.Server;\r
+import org.apache.catalina.Service;\r
+import org.apache.catalina.connector.Connector;\r
+import org.apache.catalina.core.StandardService;\r
+import org.apache.catalina.util.ServerInfo;\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.apache.naming.resources.DirContextURLStreamHandler;\r
+import org.osgi.framework.Bundle;\r
+import org.osgi.framework.BundleActivator;\r
+import org.osgi.framework.BundleContext;\r
+import org.osgi.framework.Constants;\r
+import org.osgi.framework.ServiceRegistration;\r
+import org.osgi.service.url.AbstractURLStreamHandlerService;\r
+import org.osgi.service.url.URLConstants;\r
+import org.osgi.service.url.URLStreamHandlerService;\r
+\r
+/**\r
+ * Simple activator for starting Apache Tomcat Catalina container inside OSGi\r
+ * using Tomcat's XML configuration files.\r
+ * \r
+ * <p/> This activator looks initially for a <code>conf/server.xml</code> file\r
+ * falling back to <code>conf/default-server.xml</code>. This allows the\r
+ * default configuration to be tweaked through fragments for example.\r
+ * \r
+ * @author Costin Leau\r
+ */\r
+public class Activator implements BundleActivator {\r
+\r
+       /** logger */\r
+       private static final Log log = LogFactory.getLog(Activator.class);\r
+\r
+       /** default XML configuration */\r
+       private static final String DEFAULT_XML_CONF_LOCATION = "conf/default-server.xml";\r
+\r
+       /** user-configurable XML configuration */\r
+       private static final String XML_CONF_LOCATION = "conf/server.xml";\r
+\r
+       private BundleContext bundleContext;\r
+\r
+       private StandardService server;\r
+\r
+       private ServiceRegistration registration, urlRegistration;\r
+\r
+       private Thread startupThread;\r
+\r
+\r
+       public void start(BundleContext context) throws Exception {\r
+               this.bundleContext = context;\r
+               // do the initialization on a different thread\r
+               // so the activator finishes fast\r
+               startupThread = new Thread(new Runnable() {\r
+\r
+                       public void run() {\r
+                               log.info("Starting " + ServerInfo.getServerInfo() + " ...");\r
+\r
+                               // default startup procedure\r
+                               ClassLoader cl = Activator.class.getClassLoader();\r
+                               Thread current = Thread.currentThread();\r
+                               ClassLoader old = current.getContextClassLoader();\r
+\r
+                               try {\r
+                                       current.setContextClassLoader(cl);\r
+\r
+                                       server = createCatalinaServer(bundleContext.getBundle());\r
+\r
+                                       server.start();\r
+\r
+                                       Connector[] connectors = server.findConnectors();\r
+                                       for (int i = 0; i < connectors.length; i++) {\r
+                                               Connector conn = connectors[i];\r
+                                               log.info("Succesfully started " + ServerInfo.getServerInfo() + " @ " + conn.getDomain() + ":"\r
+                                                               + conn.getPort());\r
+                                       }\r
+\r
+                                       // register URL service\r
+                                       urlRegistration = registerTomcatJNDIUrlService();\r
+                                       // publish server as an OSGi service\r
+                                       registration = publishServerAsAService(server);\r
+                                       log.info("Published " + ServerInfo.getServerInfo() + " as an OSGi service");\r
+                               }\r
+                               catch (Exception ex) {\r
+                                       String msg = "Cannot start " + ServerInfo.getServerInfo();\r
+                                       log.error(msg, ex);\r
+                                       throw new RuntimeException(msg, ex);\r
+                               }\r
+                               finally {\r
+                                       current.setContextClassLoader(old);\r
+                               }\r
+                       }\r
+               }, "Tomcat Catalina Start Thread");\r
+\r
+               startupThread.start();\r
+       }\r
+\r
+       public void stop(BundleContext context) throws Exception {\r
+               // unpublish service first\r
+               registration.unregister();\r
+               urlRegistration.unregister();\r
+\r
+               log.info("Unpublished  " + ServerInfo.getServerInfo() + " OSGi service");\r
+\r
+               // default startup procedure\r
+               ClassLoader cl = Activator.class.getClassLoader();\r
+               Thread current = Thread.currentThread();\r
+               ClassLoader old = current.getContextClassLoader();\r
+\r
+               try {\r
+                       current.setContextClassLoader(cl);\r
+                       //reset CCL \r
+                       // current.setContextClassLoader(null);\r
+                       log.info("Stopping " + ServerInfo.getServerInfo() + " ...");\r
+                       server.stop();\r
+                       log.info("Succesfully stopped " + ServerInfo.getServerInfo());\r
+               }\r
+               catch (Exception ex) {\r
+                       log.error("Cannot stop " + ServerInfo.getServerInfo(), ex);\r
+                       throw ex;\r
+               }\r
+               finally {\r
+                       current.setContextClassLoader(old);\r
+               }\r
+       }\r
+\r
+       private StandardService createCatalinaServer(Bundle bundle) throws Exception {\r
+               // first try to use the XML file\r
+               URL xmlConfiguration = bundle.getResource(XML_CONF_LOCATION);\r
+\r
+               if (xmlConfiguration != null) {\r
+                       log.info("Using custom XML configuration " + xmlConfiguration);\r
+               }\r
+               else {\r
+                       xmlConfiguration = bundle.getResource(DEFAULT_XML_CONF_LOCATION);\r
+                       if (xmlConfiguration == null)\r
+                               log.error("No XML configuration found; bailing out...");\r
+                       else\r
+                               log.info("Using default XML configuration " + xmlConfiguration);\r
+               }\r
+\r
+               return createServerFromXML(xmlConfiguration);\r
+       }\r
+\r
+       private StandardService createServerFromXML(URL xmlConfiguration) throws IOException {\r
+               OsgiCatalina catalina = new OsgiCatalina();\r
+               catalina.setAwait(false);\r
+               catalina.setUseShutdownHook(false);\r
+               catalina.setName("Catalina");\r
+               catalina.setParentClassLoader(Thread.currentThread().getContextClassLoader());\r
+\r
+               // copy the URL file to a local temporary file (since Catalina doesn't use URL unfortunately)\r
+               File configTempFile = File.createTempFile("dm.catalina", ".cfg.xml");\r
+               configTempFile.deleteOnExit();\r
+\r
+               // copy URL to temporary file\r
+               copyURLToFile(xmlConfiguration.openStream(), new FileOutputStream(configTempFile));\r
+               log.debug("Copied configuration " + xmlConfiguration + " to temporary file " + configTempFile);\r
+\r
+               catalina.setConfigFile(configTempFile.getAbsolutePath());\r
+\r
+               catalina.load();\r
+\r
+               Server server = catalina.getServer();\r
+\r
+               return (StandardService) server.findServices()[0];\r
+       }\r
+\r
+       private void copyURLToFile(InputStream inStream, FileOutputStream outStream) {\r
+\r
+               int bytesRead;\r
+               byte[] buf = new byte[4096];\r
+               try {\r
+                       while ((bytesRead = inStream.read(buf)) >= 0) {\r
+                               outStream.write(buf, 0, bytesRead);\r
+                       }\r
+               }\r
+               catch (IOException ex) {\r
+                       throw (RuntimeException) new IllegalStateException("Cannot copy URL to file").initCause(ex);\r
+               }\r
+               finally {\r
+                       try {\r
+                               inStream.close();\r
+                       }\r
+                       catch (IOException ignore) {\r
+                       }\r
+                       try {\r
+                               outStream.close();\r
+                       }\r
+                       catch (IOException ignore) {\r
+                       }\r
+               }\r
+       }\r
+\r
+       private ServiceRegistration publishServerAsAService(StandardService server) {\r
+               Properties props = new Properties();\r
+               // put some extra properties to easily identify the service\r
+               props.put(Constants.SERVICE_VENDOR, "Spring Dynamic Modules");\r
+               props.put(Constants.SERVICE_DESCRIPTION, ServerInfo.getServerInfo());\r
+               props.put(Constants.BUNDLE_VERSION, ServerInfo.getServerNumber());\r
+               props.put(Constants.BUNDLE_NAME, bundleContext.getBundle().getSymbolicName());\r
+\r
+               // spring-dm specific property\r
+               props.put("org.springframework.osgi.bean.name", "tomcat-server");\r
+\r
+               // publish just the interfaces and the major classes (server/handlerWrapper)\r
+               String[] classes = new String[] { StandardService.class.getName(), Service.class.getName(),\r
+                       MBeanRegistration.class.getName(), Lifecycle.class.getName() };\r
+\r
+               return bundleContext.registerService(classes, server, props);\r
+       }\r
+\r
+       private ServiceRegistration registerTomcatJNDIUrlService() {\r
+               Properties properties = new Properties();\r
+               properties.put(URLConstants.URL_HANDLER_PROTOCOL, "jndi");\r
+               final URLStreamHandler handler = new DirContextURLStreamHandler();\r
+\r
+               return bundleContext.registerService(URLStreamHandlerService.class.getName(),\r
+                       new AbstractURLStreamHandlerService() {\r
+\r
+                               private final static String EMPTY_STRING = "";\r
+\r
+\r
+                               public URLConnection openConnection(URL u) throws IOException {\r
+                                       return new URL(u, EMPTY_STRING, handler).openConnection();\r
+                               }\r
+                       }, properties);\r
+       }\r
+}
\ No newline at end of file
diff --git a/server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java b/server/runtime/org.argeo.server.catalina.start/src/main/java/org/springframework/osgi/web/tomcat/internal/OsgiCatalina.java
new file mode 100644 (file)
index 0000000..f7903ff
--- /dev/null
@@ -0,0 +1,34 @@
+/*\r
+ * Copyright 2006-2008 the original author or authors.\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.springframework.osgi.web.tomcat.internal;\r
+\r
+import org.apache.catalina.Server;\r
+import org.apache.catalina.startup.Catalina;\r
+\r
+/**\r
+ * OSGi extension of Catalina class used for easy access to the underlying\r
+ * configuration.\r
+ * \r
+ * @author Costin Leau\r
+ * \r
+ */\r
+public class OsgiCatalina extends Catalina {\r
+\r
+       public Server getServer() {\r
+               return server;\r
+       }\r
+}\r
diff --git a/server/runtime/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml b/server/runtime/org.argeo.server.catalina.start/src/main/resources/conf/default-server.xml
new file mode 100644 (file)
index 0000000..c8cd5bb
--- /dev/null
@@ -0,0 +1,16 @@
+<Server port="8005" shutdown="SHUTDOWN">\r
+\r
+\r
+       <Service name="Catalina">\r
+               <Connector port="8080" />\r
+\r
+               <Engine name="Catalina" defaultHost="localhost">\r
+                       <Host name="localhost" unpackWARs="false" autoDeploy="false"\r
+                               liveDeploy="false" deployOnStartup="false" xmlValidation="false"\r
+                               xmlNamespaceAware="false">\r
+                       </Host>\r
+               </Engine>\r
+\r
+\r
+       </Service>\r
+</Server>\r