geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r786690 - in /geronimo/server/trunk/plugins/tomcat: geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/ geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ geronimo-tomcat6/src/test/java/org/apache/geronimo/...
Date Fri, 19 Jun 2009 22:09:32 GMT
Author: djencks
Date: Fri Jun 19 22:09:31 2009
New Revision: 786690

URL: http://svn.apache.org/viewvc?rev=786690&view=rev
Log:
GERONIMO-4684 Provide a way for the existing EngineGBean to wrap the engine started from a
server.xml.  This should provide backward compatibility for added gbeans in user plans

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
    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/TomcatWebAppContext.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
    geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=786690&r1=786689&r2=786690&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
Fri Jun 19 22:09:31 2009
@@ -285,7 +285,7 @@
         // Default Engine
         initParams = new HashMap();
         initParams.put("name", "Geronimo");
-        GBeanData engine = bootstrap.addGBean("tomcatEngine", EngineGBean.GBEAN_INFO);
+        GBeanData engine = bootstrap.addGBean("tomcatEngine", EngineGBean.class);
         engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
         engine.setAttribute("initParams", initParams);
         engine.setReferencePattern("DefaultHost", host.getAbstractName());

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java?rev=786690&r1=786689&r2=786690&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
Fri Jun 19 22:09:31 2009
@@ -36,6 +36,9 @@
 import org.apache.geronimo.gbean.ReferenceCollection;
 import org.apache.geronimo.gbean.ReferenceCollectionEvent;
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
+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.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
@@ -46,6 +49,7 @@
 /**
  * @version $Rev$ $Date$
  */
+@GBean
 public class EngineGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {
 
     private static final Logger log = LoggerFactory.getLogger(EngineGBean.class);
@@ -55,17 +59,25 @@
 
     private final Engine engine;
 
-    public EngineGBean(String className,
-            Map initParams,
-            HostGBean defaultHost,
-            ObjectRetriever realmGBean,
-            ConfigurationFactory configurationFactory,
-            ValveGBean tomcatValveChain,
-            LifecycleListenerGBean listenerChain,
-            CatalinaClusterGBean clusterGBean,
-            ManagerGBean manager,
-            MBeanServerReference mbeanServerReference) throws Exception {
-        super(); // TODO: make it an attribute
+    public EngineGBean(
+            //fish engine out of server configured with server.xml
+            @ParamReference(name="Server")TomcatServerGBean server,
+            @ParamAttribute(name="serviceName")String serviceName,
+
+            //Or (deprecated) set up an engine directly
+            @ParamAttribute(name = "className")String className,
+            @ParamAttribute(name = "initParams")Map initParams,
+            @ParamReference(name="DefaultHost", namingType = HostGBean.J2EE_TYPE)HostGBean
defaultHost,
+            @ParamReference(name="RealmGBean", namingType = GBeanInfoBuilder.DEFAULT_J2EE_TYPE)ObjectRetriever
realmGBean,
+            @ParamReference(name="ConfigurationFactory", namingType = GBeanInfoBuilder.DEFAULT_J2EE_TYPE)ConfigurationFactory
configurationFactory,
+            @ParamReference(name="TomcatValveChain", namingType = ValveGBean.J2EE_TYPE)ValveGBean
tomcatValveChain,
+            @ParamReference(name="LifecycleListenerChain", namingType = LifecycleListenerGBean.J2EE_TYPE)LifecycleListenerGBean
listenerChain,
+            @ParamReference(name="CatalinaCluster", namingType = CatalinaClusterGBean.J2EE_TYPE)CatalinaClusterGBean
clusterGBean,
+            @ParamReference(name="Manager", namingType = ManagerGBean.J2EE_TYPE)ManagerGBean
manager,
+            @ParamReference(name="MBeanServerReference")MBeanServerReference mbeanServerReference)
throws Exception {
+
+        if (server == null) {
+            //legacy configuration
 
         if (className == null){
             className = "org.apache.geronimo.tomcat.TomcatEngine";
@@ -143,6 +155,11 @@
         if (clusterGBean != null){
             engine.setCluster((Cluster)clusterGBean.getInternalObject());
         }
+        } else {
+            //get engine from server gbean
+            engine = (Engine) server.getService(serviceName).getContainer();
+        }
+
     }
 
     public void removeHost(Host host) {
@@ -169,35 +186,4 @@
         log.debug("Stopped");
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("TomcatEngine", EngineGBean.class);
-        infoFactory.addAttribute("className", String.class, true);
-        infoFactory.addAttribute("initParams", Map.class, true);
-        infoFactory.addReference("DefaultHost", HostGBean.class, HostGBean.J2EE_TYPE);
-        infoFactory.addReference("RealmGBean", ObjectRetriever.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-        infoFactory.addReference("ConfigurationFactory", ConfigurationFactory.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-        infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
-        infoFactory.addReference("LifecycleListenerChain", LifecycleListenerGBean.class,
LifecycleListenerGBean.J2EE_TYPE);
-        infoFactory.addReference("CatalinaCluster", CatalinaClusterGBean.class, CatalinaClusterGBean.J2EE_TYPE);
-        infoFactory.addReference("Manager", ManagerGBean.class, ManagerGBean.J2EE_TYPE);
-        infoFactory.addReference("MBeanServerReference", MBeanServerReference.class);
-        infoFactory.setConstructor(new String[] {
-                "className", 
-                "initParams", 
-                "DefaultHost",
-                "RealmGBean",
-                "ConfigurationFactory",
-                "TomcatValveChain",
-                "LifecycleListenerChain",
-                "CatalinaCluster",
-                "Manager",
-                "MBeanServerReference"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

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=786690&r1=786689&r2=786690&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
Fri Jun 19 22:09:31 2009
@@ -139,7 +139,6 @@
         } else {
             this.engine = (Engine) engineGBean.getInternalObject();
             StandardService embedded = new StandardService();
-//            StandardService embedded = new Embedded();
 
             // Assemble FileLogger as a gbean
             /*
@@ -150,7 +149,6 @@
             // 2. Set the relevant properties of this object itself. In particular,
             // you will want to establish the default Logger to be used, as well as
             // the default Realm if you are using container-managed security.
-//            embedded.setUseNaming(false);
 
             //Add default contexts
             File rootContext = new File(catalinaHome + "/ROOT");

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=786690&r1=786689&r2=786690&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Fri Jun 19 22:09:31 2009
@@ -134,7 +134,8 @@
             TrackedConnectionAssociator trackedConnectionAssociator,
             TomcatContainer container,
             RunAsSource runAsSource,
-            ConfigurationFactory configurationFactory, ObjectRetriever tomcatRealm,
+            ConfigurationFactory configurationFactory,
+            ObjectRetriever tomcatRealm,
             ObjectRetriever clusteredValveRetriever,
             ValveGBean tomcatValveChain,
             LifecycleListenerGBean lifecycleListenerChain,

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=786690&r1=786689&r2=786690&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Fri Jun 19 22:09:31 2009
@@ -16,24 +16,11 @@
  */
 package org.apache.geronimo.tomcat;
 
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.security.Principal;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.TransactionManager;
-
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
 import org.apache.geronimo.connector.outbound.connectiontracking.GeronimoTransactionListener;
 import org.apache.geronimo.security.SecurityServiceImpl;
 import org.apache.geronimo.security.deploy.PrincipalInfo;
 import org.apache.geronimo.security.deploy.SubjectInfo;
-import org.apache.geronimo.security.jaas.ConfigurationEntryFactory;
-import org.apache.geronimo.security.jaas.GeronimoLoginConfiguration;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
 import org.apache.geronimo.security.jaas.LoginModuleControlFlag;
 import org.apache.geronimo.security.jaas.LoginModuleGBean;
@@ -53,6 +40,16 @@
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
 
+import javax.transaction.TransactionManager;
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 
 /**
  * @version $Rev$ $Date$
@@ -172,7 +169,8 @@
         //Default Engine
         initParams = Collections.singletonMap("name", "Geronimo");
 
-        EngineGBean engine = new EngineGBean("org.apache.geronimo.tomcat.TomcatEngine",
+        EngineGBean engine = new EngineGBean(null, null,
+                "org.apache.geronimo.tomcat.TomcatEngine",
                 initParams,
                 host,
                 realm,

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml?rev=786690&r1=786689&r2=786690&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml Fri Jun 19 22:09:31
2009
@@ -63,7 +63,15 @@
             <!--<name>AprLifecycleListener</name>-->
         <!--</reference>-->
     </gbean>
-<!--
+
+    <!-- for support of Host, Valve, etc gbeans in web app plans that need an Engine reference
-->
+    <gbean name="TomcatEngine" class="org.apache.geronimo.tomcat.EngineGBean">
+        <reference name="Server">
+            <name>TomcatServer</name>
+        </reference>
+    </gbean>
+
+    <!--
     <gbean name="AprLifecycleListener" class="org.apache.geronimo.tomcat.LifecycleListenerGBean">
         <attribute name="className">org.apache.geronimo.tomcat.listener.GeronimoAprLifecycleListener</attribute>
     </gbean>



Mime
View raw message