geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r911190 - in /geronimo/server/trunk/plugins/wab: ./ geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ web-extender/src/main/plan/
Date Wed, 17 Feb 2010 22:07:13 GMT
Author: gawor
Date: Wed Feb 17 22:07:12 2010
New Revision: 911190

URL: http://svn.apache.org/viewvc?rev=911190&view=rev
Log:
GERONIMO-5030: Start tracking WABs only after all plugins have been started. Also, throw nicer
exception if there are no web module builders present to deploy the WAB

Added:
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/wab/TODO
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
    geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml

Modified: geronimo/server/trunk/plugins/wab/TODO
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/TODO?rev=911190&r1=911189&r2=911190&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/wab/TODO (original)
+++ geronimo/server/trunk/plugins/wab/TODO Wed Feb 17 22:07:12 2010
@@ -1,5 +1,3 @@
 TODO:
- - extender needs to start tracking bundles only once kernel is fully initialized (all plugins
are loaded)
  - for collision detection the extender will need to know all the contextPaths of other Java
EE apps deployed
- - extender needs to check/wait for web container to be available
 

Added: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java?rev=911190&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
(added)
+++ geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
Wed Feb 17 22:07:12 2010
@@ -0,0 +1,57 @@
+/**
+ * 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.geronimo.osgi.web.extender;
+
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.system.main.ServerStatus;
+
+/**
+ * A GBean that tracks server status and starts rfc66 extender after all
+ * plugins have been started.
+ */
+@GBean
+public class ServerStatusTracker implements ServerStatus {
+
+    private WebContainerExtender extender;
+    private boolean serverStarted;
+    
+    public ServerStatusTracker(@ParamReference(name = "extender") WebContainerExtender extender)
{
+        this.extender = extender;
+        this.serverStarted = false;
+    }
+    
+    public boolean isServerStarted() {
+        return serverStarted;
+    }
+
+    public void setServerStarted(boolean started) {
+        serverStarted = started;
+        if (started) {
+            try {
+                extender.start();
+            } catch (Throwable e) {
+                extender.stop();
+            }
+        } else {
+            extender.stop();
+        }
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/ServerStatusTracker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java?rev=911190&r1=911189&r2=911190&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java
(original)
+++ geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java
Wed Feb 17 22:07:12 2010
@@ -26,6 +26,7 @@
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
@@ -177,7 +178,9 @@
                 Kernel kernel = extender.getKernel();
                 Naming naming = kernel.getNaming();
                 ModuleBuilder webModuleBuilder = extender.getWebModuleBuilder();    
-                
+                if (webModuleBuilder == null) {
+                    throw new DeploymentException("Unable to deploy " + bundle + " WAB. No
web module builders found.");
+                }
                 WebModule webModule = (WebModule) webModuleBuilder.createModule(bundle, naming,
idBuilder);
 
                 BundleDeploymentContext deploymentContext = 

Modified: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java?rev=911190&r1=911189&r2=911190&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
(original)
+++ geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
Wed Feb 17 22:07:12 2010
@@ -31,6 +31,7 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.SingleElementCollection;
+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;
@@ -57,6 +58,7 @@
  * 
  * @version $Rev$, $Date$
  */
+@GBean
 public class WebContainerExtender implements GBeanLifecycle {
     // the header that identifies a bundle as being a WAB
     public final static String WEB_CONTEXT_PATH_HEADER = "Web-ContextPath";
@@ -268,16 +270,22 @@
         webApplications.unregister(wab, !stopped);
     }
 
-    public void doFail() {
-        stop(bundleContext);  
+    protected void start() {
+        start(bundleContext);
     }
-
+    
+    protected void stop() {
+        stop(bundleContext);        
+    }
+    
     public void doStart() throws Exception {
-        start(bundleContext);
     }
 
+    public void doFail() {
+    }
+    
     public void doStop() throws Exception {
-        stop(bundleContext);        
+        stop();
     }
     
     private static class WebApplications {

Modified: geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml?rev=911190&r1=911189&r2=911190&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml Wed Feb 17 22:07:12
2010
@@ -34,4 +34,10 @@
         </references>
     </gbean>
 
+    <gbean name="ServerStatusTracker" class="org.apache.geronimo.osgi.web.extender.ServerStatusTracker">
+        <reference name="extender">
+            <name>WebBuilder</name>
+        </reference>
+    </gbean>
+
 </module>



Mime
View raw message