geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r559099 [7/7] - in /geronimo/sandbox/tuscany-integration: ./ geronimo-tuscany/ geronimo-tuscany/configs/ geronimo-tuscany/configs/src/main/resources/META-INF/ geronimo-tuscany/configs/src/plan/ geronimo-tuscany/modules/ geronimo-tuscany/mod...
Date Tue, 24 Jul 2007 16:49:09 GMT
Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml (added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml Tue Jul 24
09:49:03 2007
@@ -0,0 +1,91 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>geronimo-plugins</groupId>
+		<artifactId>tuscany</artifactId>
+		<version>1.0</version>
+		<relativePath>../../geronimo-tuscany/pom.xml</relativePath>
+	</parent>
+
+	<groupId>org.apache.tuscany.sca</groupId>
+	<artifactId>tuscany-host-geronimo</artifactId>
+	<version>1.0-incubating-SNAPSHOT</version>
+	<packaging>jar</packaging>
+
+
+	<name>Tuscany :: Modules</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>catalina</artifactId>
+			<version>6.0.13-G543818</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>coyote</artifactId>
+			<version>6.0.13</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-servlet_2.5_spec</artifactId>
+			<version>1.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-host-http</artifactId>
+			<version>1.0-incubating-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-core-spi</artifactId>
+			<version>1.0-incubating-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-core</artifactId>
+			<version>1.0-incubating-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.modules</groupId>
+			<artifactId>geronimo-kernel</artifactId>
+			<version>2.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.modules</groupId>
+			<artifactId>geronimo-tomcat6</artifactId>
+			<version>2.0-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+
+
+		</plugins>
+
+		<sourceDirectory>src/main/java</sourceDirectory>
+		<testSourceDirectory>src/test</testSourceDirectory>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>true</filtering>
+			</resource>
+		</resources>
+		<testResources>
+			<testResource>
+				<directory>src/test/resources</directory>
+			</testResource>
+		</testResources>
+	</build>
+
+</project>
+
+

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
(added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
Tue Jul 24 09:49:03 2007
@@ -0,0 +1,205 @@
+/*
+ * 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 org.apache.tuscany.sca.http.geronimo;
+
+import java.net.URI;
+import java.util.concurrent.Executor;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.Context;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardWrapper;
+import org.apache.catalina.loader.WebappLoader;
+import org.apache.catalina.startup.ContextConfig;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.coyote.http11.Http11Protocol;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.tomcat.TomcatWebContainer;
+import org.apache.tomcat.util.buf.MessageBytes;
+import org.apache.tomcat.util.http.mapper.MappingData;
+import org.apache.tomcat.util.net.JIoEndpoint;
+import org.apache.tuscany.sca.http.DefaultResourceServlet;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletMappingException;
+
+
+/**
+ * A Geronimo based implementation of ServletHost. This works only on those 
+ * versions of Geronimo 2.0 that use Tomcat as the Web Container.
+ * Adds contexts to the tomcat host as and when required. In case of existing contexts
+ * it adds the servlets to those contexts provided they were created by this
+ * servlet host implementation. If the context provided in the URL where the service
+ * is exposed is an existing J2EE context then an error is thrown. 
+ * 
+ */
+@SuppressWarnings("deprecation")
+public class GeronimoServletHost implements ServletHost {
+
+    private static final Log log = LogFactory.getLog(GeronimoServletHost.class);
+    private static final int DEFAULT_PORT = 8080;
+    private Engine engine;
+    private NetworkConnector[] connectors;
+    private Container host;
+    private StandardContext context;
+    private ObjectRetriever engineGbean;
+    private TomcatWebContainer tomcatContainerGbean;
+    private static final String JMX_APP_NAME = "Tuscany Service Context";
+    private static final String JMX_SERVER_NAME = "geronimo";
+    private static final String SEPARATOR = "/";
+    private static final String WILDCARD = "*";
+    private static final String docext = "work";
+    private static final String tomcatEngineGBeanName = "TomcatEngine";
+    private static final String tomcatContainerGBeanName = "TomcatWebContainer";
+    
+
+    
+    public void init(){
+        log.debug("Start of init() method");
+        Kernel kernel = KernelRegistry.getSingleKernel();
+        try {            
+            tomcatContainerGbean = (TomcatWebContainer)kernel.getGBean(tomcatContainerGBeanName,
TomcatWebContainer.class);            
+        } catch (Exception e) {
+            log.fatal("Cannot find GBean named " + tomcatContainerGBeanName,e);
+            throw new IllegalArgumentException("Cannot find GBean named " + tomcatContainerGBeanName,e);
+        }
+        try {
+            engineGbean = (ObjectRetriever) kernel.getGBean(tomcatEngineGBeanName, ObjectRetriever.class);
           
+        } catch (Exception e) {
+            log.fatal("Cannot find GBean named " + tomcatEngineGBeanName,e);
+            throw new IllegalArgumentException("Cannot find GBean named " + tomcatEngineGBeanName,e);
+        }
+        
+        this.engine = (Engine) engineGbean.getInternalObject();
+        this.connectors = tomcatContainerGbean.getConnectors();
+        log.debug("End of init() method");
+    }
+
+    public void addServletMapping(String strURI, Servlet servlet) {
+        log.debug("Start of addServletMapping() method");
+        URI uri = URI.create(strURI);
+        boolean validport = false;
+        int port = uri.getPort();
+        if (port == -1) {
+            port = DEFAULT_PORT;
+        }
+        for(int i=0;i<connectors.length;i++){
+            if(port == connectors[0].getPort())    {
+                validport = true;
+                break;
+            }
+        }
+        if(!validport){
+            throw new IllegalArgumentException("Invalid port '" + port + "'.  Do you have
a connector configured for that port?");
+        }
+        String path = uri.getPath();
+        path = (path.startsWith(SEPARATOR))?path.substring(1):path;
+        String contextPath = SEPARATOR + path.substring(0,path.indexOf(SEPARATOR));
+        String mapping = path.substring(path.indexOf(SEPARATOR));              
+        String virtualServer = engine.getDefaultHost();
+        host = engine.findChild(virtualServer);
+        if (host == null) {
+            throw new IllegalArgumentException("Invalid virtual host '" + virtualServer +
"'.  Do you have a matching Host entry in the plan?");
+        }
+        
+        context = (StandardContext)((StandardHost)host).map(contextPath);
+        if(context.getName().equals("")) {
+            context = new StandardContext();
+            context.setDocBase(docext + contextPath);
+            context.setJ2EEApplication(JMX_APP_NAME);
+            context.setJ2EEServer(JMX_SERVER_NAME);
+            context.setPath(contextPath);        
+            context.setName(contextPath);
+            context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader()));
+            ContextConfig config = new ContextConfig();
+            ((Lifecycle)context).addLifecycleListener(config); 
+        } else {
+            if(!context.getJ2EEApplication().equals(JMX_APP_NAME)){
+                throw new IllegalArgumentException("This context named '" + context.getName()
+ "' is already assigned to a J2EE application");
+            }            
+        }
+        ServletWrapper wrapper;
+        if (servlet instanceof DefaultResourceServlet) {            
+            // Optimize the handling of resource requests, use the Tomcat default servlet
+            // instead of our default resource servlet
+            String servletPath = uri.getPath();
+            if (servletPath.endsWith(WILDCARD)) {
+                servletPath = servletPath.substring(0, servletPath.length()-1);
+            }
+            if (servletPath.endsWith(SEPARATOR)) {
+                servletPath = servletPath.substring(0, servletPath.length()-1);
+            }
+            DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet;
+            TomcatDefaultServlet defaultServlet = new TomcatDefaultServlet(servletPath, resourceServlet.getDocumentRoot());
+            wrapper = new ServletWrapper(defaultServlet);            
+        } else {
+            wrapper = new ServletWrapper(servlet);
+        }        
+        wrapper.setServletClass(servlet.getClass().getName());        
+        wrapper.setName(mapping);
+        wrapper.addMapping(mapping);
+        wrapper.setLoadOnStartup(0);
+        context.addChild(wrapper);        
+        host.addChild(context);        
+        try {
+            context.start();
+        } catch (LifecycleException e) {
+            log.fatal("The context named " + context.getName() + " failed to start",e);
+            throw new IllegalArgumentException("The context named " + context.getName() +
" failed to start");
+        }                          
+        log.debug("End of addServletMapping() method");
+    }
+
+    public Servlet removeServletMapping(String uri) {
+        log.debug("Start of removeServletMapping() method");
+        String path = URI.create(uri).getPath();            
+        path = (path.startsWith(SEPARATOR))?path.substring(1):path;
+        String contextPath = SEPARATOR + path.substring(0,path.indexOf(SEPARATOR));
+        String mapping = path.substring(path.indexOf(SEPARATOR));              
+        Context context = ((StandardHost)host).map(contextPath);        
+        Container container = context.findChild(mapping);
+        context.removeChild(container);
+        //when to remove the context? Assuming when it has 2 children only i.e. JSP Servlet
and DefaultServlet
+        //and it is not the default context
+        if(context.findChildren().length < 3 && !context.getName().equals("")){
+            host.removeChild(context);
+        }
+        log.debug("End of removeServletMapping() method");        
+        return ((StandardWrapper)container).getServlet();
+        
+    }
+    
+}

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/GeronimoServletHost.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
(added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
Tue Jul 24 09:49:03 2007
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.tuscany.sca.http.geronimo;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.core.StandardWrapper;
+
+/**
+ * A servlet wrapper.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ServletWrapper extends StandardWrapper {
+    private static final long serialVersionUID = 1L;
+
+    private final Servlet servlet;
+
+    public ServletWrapper(Servlet servlet) {
+        this.servlet = servlet;
+    }
+
+    public synchronized Servlet loadServlet() {
+        return servlet;
+    }
+
+    public Servlet getServlet() {
+        return servlet;
+    }
+    
+    public void initServlet() throws ServletException {
+        servlet.init(facade);
+    }
+    
+    public void destroyServlet() {
+        servlet.destroy();
+    }
+
+}

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/ServletWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
(added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
Tue Jul 24 09:49:03 2007
@@ -0,0 +1,70 @@
+/*
+ * 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 org.apache.tuscany.sca.http.geronimo;
+
+import java.net.URI;
+import java.util.Hashtable;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.catalina.servlets.DefaultServlet;
+import org.apache.naming.resources.FileDirContext;
+import org.apache.naming.resources.ProxyDirContext;
+
+public class TomcatDefaultServlet extends DefaultServlet {
+    private static final long serialVersionUID = -7503581551326796573L;
+    
+    private String documentRoot;
+    private ProxyDirContext proxyDirContext;
+    
+    public TomcatDefaultServlet(String servletPath, String documentRoot) {
+        this.documentRoot = documentRoot;
+        
+        FileDirContext dirContext = new FileDirContext();
+        URI uri = URI.create(this.documentRoot);
+        dirContext.setDocBase(uri.getPath());
+        
+        proxyDirContext = new ProxyDirContext(new Hashtable(), dirContext);
+        resources = proxyDirContext;
+    }
+    
+    @Override
+    public void init() throws ServletException {
+        super.init();
+        resources = proxyDirContext;
+    }
+    
+    @Override
+    public void init(ServletConfig servletConfig) throws ServletException {
+        super.init(servletConfig);
+        resources = proxyDirContext;
+    }
+
+    @Override
+    protected String getRelativePath(HttpServletRequest request) {
+        String path = request.getPathInfo();
+        if (path == null || path.length() == 0) {
+            path = "/";
+        }
+        return path;
+    }
+}

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/TomcatDefaultServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
(added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
Tue Jul 24 09:49:03 2007
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.tuscany.sca.http.geronimo.module;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.geronimo.GeronimoServletHost;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoRuntimeModuleActivator implements ModuleActivator {
+
+    private GeronimoServletHost servletHost;
+
+    public Object[] getExtensionPoints() {
+        return null;
+    }
+
+    public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+        // Register a Tomcat servlet host
+        ServletHostExtensionPoint servletHosts =
+            extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);  
     
+        servletHost = new GeronimoServletHost();  
+        servletHost.init();
+        servletHosts.addServletHost(servletHost);
+    }
+
+    public void stop(ExtensionPointRegistry registry) {
+        ServletHostExtensionPoint servletHosts =
+            registry.getExtensionPoint(ServletHostExtensionPoint.class);
+        List hostList = servletHosts.getServletHosts();
+        for(int i=0;i<hostList.size();i++){
+        	if(hostList.get(i) instanceof GeronimoServletHost){
+        		servletHosts.removeServletHost((GeronimoServletHost)hostList.get(i));
+        		return;
+        	}
+        }
+
+    }
+
+}

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/java/org/apache/tuscany/sca/http/geronimo/module/GeronimoRuntimeModuleActivator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?view=auto&rev=559099
==============================================================================
--- geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
(added)
+++ geronimo/sandbox/tuscany-integration/modules/tuscany-http-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
Tue Jul 24 09:49:03 2007
@@ -0,0 +1,18 @@
+# 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.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.geronimo.module.GeronimoRuntimeModuleActivator



Mime
View raw message