geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r718344 - /geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Date Mon, 17 Nov 2008 19:41:32 GMT
Author: dwoods
Date: Mon Nov 17 11:41:31 2008
New Revision: 718344

URL: http://svn.apache.org/viewvc?rev=718344&view=rev
Log:
GERONIMO-4377 Fail to indicate datasource create unsuccessfully in admin console database
pool porlet when choosing wrong database driver.  Thanks to Ivan for the patch.

Modified:
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=718344&r1=718343&r2=718344&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Mon Nov 17 11:41:31 2008
@@ -40,7 +40,9 @@
 import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.DependencyManager;
+import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.config.Configuration;
@@ -176,7 +178,7 @@
             // todo we have a much more detailed report now
             message(actionResponse, null, "Lifecycle operation failed<br /><br />");
             logger.error("Lifecycle operation failed ", e);
-        } catch (Exception e) {
+        } catch (Throwable e) {
             message(actionResponse, null, "Encountered an unhandled exception<br /><br
/>");
             logger.error("Exception", e);
         }
@@ -274,7 +276,7 @@
                 }
 
             } else if (shouldListConfig(info.getType())) {
-                ModuleDetails details = new ModuleDetails(info.getConfigID(), info.getType(),
info.getState());
+                ModuleDetails details = new ModuleDetails(info.getConfigID(), info.getType(),
getConfigurationState(info));
                 try {
                     AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                     boolean loaded = loadModule(configManager, configObjName);
@@ -324,6 +326,30 @@
         }
     }
 
+    private State getConfigurationState(ConfigurationInfo configurationInfo) {
+        State configurationState = configurationInfo.getState();
+        if (configurationState.isRunning()) {
+            // Check whether the Configuration's sub-gbeans are running
+            try {
+                Configuration configuration = PortletManager.getConfigurationManager().getConfiguration(configurationInfo.getConfigID());
+                Map<AbstractName, GBeanData> abstractNameGBeanDataMap = configuration.getGBeans();
+                // Check one sub-GBean's state, if one gbean fails to start, all will be
shutdown
+                Iterator<AbstractName> it = abstractNameGBeanDataMap.keySet().iterator();
+                if (it.hasNext()) {
+                    AbstractName abstractName = it.next();
+                    if (!PortletManager.getKernel().isRunning(abstractName)) {
+                        return State.STOPPED;
+                    }
+                }
+            } catch (InternalKernelException e) {
+                return State.STOPPED;
+            } catch (IllegalStateException e) {
+                return State.STOPPED;
+            }
+        }
+        return configurationState;
+    }
+
     private WebModule getWebModule(Configuration config, Configuration child) {
         try {
             Map<String, String> query1 = new HashMap<String, String>();



Mime
View raw message