geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r785090 - in /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src: main/java/org/apache/geronimo/tomcat/ test/java/org/apache/geronimo/tomcat/
Date Tue, 16 Jun 2009 06:57:53 GMT
Author: xuhaihong
Date: Tue Jun 16 06:57:52 2009
New Revision: 785090

URL: http://svn.apache.org/viewvc?rev=785090&view=rev
Log:
GERONIMO-4684 Configure tomcat server using server.xml

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=785090&r1=785089&r2=785090&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Tue Jun 16 06:57:52 2009
@@ -134,7 +134,8 @@
         System.setProperty("catalina.home", catalinaHome);
 
         if (server != null) {
-            this.engine = server.getEngine(serviceName);
+            embedded = server.getService(serviceName);
+            engine = (Engine) embedded.getContainer();
         } else {
             this.engine = (Engine) engineGBean.getInternalObject();
             StandardService embedded = new StandardService();

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java?rev=785090&r1=785089&r2=785090&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
Tue Jun 16 06:57:52 2009
@@ -20,34 +20,36 @@
 
 package org.apache.geronimo.tomcat;
 
-import java.io.Reader;
-import java.io.IOException;
-import java.io.StringReader;
 import java.io.File;
 import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
 import java.util.Arrays;
 
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.JAXBElement;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
+import org.apache.catalina.Engine;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.apache.geronimo.gbean.annotation.ParamReference;
-import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.tomcat.model.ServerType;
+import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.catalina.Server;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.Engine;
-import org.apache.catalina.Service;
+import org.apache.geronimo.tomcat.model.ServerType;
+import org.apache.tomcat.util.modeler.Registry;
 import org.xml.sax.SAXException;
 
 /**
@@ -76,6 +78,7 @@
     public TomcatServerGBean(@ParamAttribute(name = "serverConfig")String serverConfig,
                              @ParamAttribute(name = "serverConfigLocation")String serverConfigLocation,
                              @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                             @ParamReference(name = "MBeanServerReference") MBeanServerReference
mbeanServerReference,
                              @ParamSpecial(type= SpecialAttributeType.classLoader)ClassLoader
classLoader) throws Exception {
         this.serverConfig = serverConfig;
         this.serverInfo = serverInfo;
@@ -88,8 +91,13 @@
             File loc = serverInfo.resolveServer(serverConfigLocation);
             in = new FileReader(loc);
         }
+
+        if(mbeanServerReference != null) {
+            Registry.setServer(mbeanServerReference.getMBeanServer());
+        }
+        
         try {
-            ServerType serverType = loadServerType(in);
+            ServerType serverType = loadServerType(in);            
             server = serverType.build(classLoader);
         } finally {
             in.close();
@@ -120,7 +128,7 @@
         }
     }
 
-    public Engine getEngine(String serviceName) {
+    public Service getService(String serviceName) {
         Service service;
         if (serviceName == null) {
             Service[] services = server.findServices();
@@ -132,6 +140,6 @@
         } else {
             service = server.findService(serviceName);
         }
-        return (Engine) service.getContainer();
+        return service;
     }
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java?rev=785090&r1=785089&r2=785090&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
Tue Jun 16 06:57:52 2009
@@ -56,7 +56,7 @@
     }
     public void testGBeanServer1() throws Exception {
         ServerInfo serverInfo = new BasicServerInfo(BASEDIR.getAbsolutePath());
-        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, serverInfo,
getClass().getClassLoader());
+        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, serverInfo,
null, getClass().getClassLoader());
         try {
             tomcatServerGBean.doStart();
         } finally {



Mime
View raw message