geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1143308 - in /geronimo/server/trunk/plugins/console/console-base-portlets: pom.xml src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Date Wed, 06 Jul 2011 09:25:43 GMT
Author: xuhaihong
Date: Wed Jul  6 09:25:43 2011
New Revision: 1143308

URL: http://svn.apache.org/viewvc?rev=1143308&view=rev
Log:
GERONIMO-5302 A successfully deployed war package(contained in a ear package) is not listed
on admin console.

Modified:
    geronimo/server/trunk/plugins/console/console-base-portlets/pom.xml
    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/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/pom.xml?rev=1143308&r1=1143307&r2=1143308&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/pom.xml (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/pom.xml Wed Jul  6 09:25:43
2011
@@ -22,7 +22,13 @@
     <name>Geronimo Plugins, Console :: Base Portlets</name>
     <packaging>war</packaging>
 
-    <dependencies>
+    <dependencies>        
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-web</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
 
         <!-- for jspc maven plugin -->
         <dependency>
@@ -93,7 +99,7 @@
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.commons-io</artifactId>
             <scope>provided</scope>
-        </dependency>
+        </dependency>                
         
         <!-- FIXME : this should be replaced by org.apache.aries.util in next release
-->
         <dependency>

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=1143308&r1=1143307&r2=1143308&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
Wed Jul  6 09:25:43 2011
@@ -41,6 +41,7 @@ import org.apache.geronimo.console.util.
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
@@ -58,6 +59,7 @@ import org.apache.geronimo.kernel.manage
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.management.geronimo.WebModule;
+import org.apache.geronimo.web.info.WebAppInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -76,7 +78,7 @@ public class ConfigManagerPortlet extend
     private static final String CONFIG_INIT_PARAM = "config-type";
 
     private static final String SHOW_DEPENDENCIES_COOKIE = "org.apache.geronimo.configmanager.showDependencies";
-    
+
     private Kernel kernel;
 
     private PortletRequestDispatcher normalView;
@@ -144,12 +146,12 @@ public class ConfigManagerPortlet extend
     public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException {
         String action = actionRequest.getParameter("action");
         actionResponse.setRenderParameter("message", ""); // set to blank first
-        
+
         try {
             ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
             String config = getConfigID(actionRequest);
             Artifact configId = Artifact.create(config);
-            
+
             if (START_ACTION.equals(action)) {
 
                 if (!configurationManager.isLoaded(configId)) {
@@ -163,28 +165,28 @@ public class ConfigManagerPortlet extend
                 }
 
             } else if (STOP_ACTION.equals(action)) {
-                
+
                 if(configurationManager.isLoaded(configId)) {
                     LifecycleResults lcresult = configurationManager.unloadConfiguration(configId);
                     addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg02")
+ printResults(lcresult.getStopped()));
                 }
 
             } else if (UNINSTALL_ACTION.equals(action)) {
-                
+
                 configurationManager.uninstallConfiguration(configId);
-                
+
                 addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg04")
+ "<br />" + configId);
-                
+
             } else if (RESTART_ACTION.equals(action)) {
-                
+
                 LifecycleResults lcresult = configurationManager.restartConfiguration(configId);
                 addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg03")
+ printResults(lcresult.getStarted()));
-                
+
             } else {
                 addWarningMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.warnMsg01")
+ action + "<br />");
                 throw new PortletException("Invalid value for changeState: " + action);
             }
-            
+
         } catch (NoSuchConfigException e) {
             // ignore this for now
             addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.errorMsg01"));
@@ -198,7 +200,7 @@ public class ConfigManagerPortlet extend
             logger.error("Exception", e);
         }
     }
-    
+
     /**
      * Check if a configuration should be listed here. This method depends on the "config-type"
portlet parameter
      * which is set in portle.xml.
@@ -223,21 +225,21 @@ public class ConfigManagerPortlet extend
         List<ModuleDetails> moduleDetails = new ArrayList<ModuleDetails>();
         ConfigurationManager configManager = PortletManager.getConfigurationManager();
         List<ConfigurationInfo> infos = configManager.listConfigurations();
-    
+
         for (ConfigurationInfo info : infos) {
             if (ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType)) {
 
-                if (info.getType().getValue() == ConfigurationModuleType.WAR.getValue())
{
+                if (info.getType() == ConfigurationModuleType.WAR) {
                     ModuleDetails details = new ModuleDetails(info.getConfigID(), info.getType(),
info.getState());
                     try {
                         AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                         boolean loaded = loadModule(configManager, configObjName);
-
-                        WebModule webModule = (WebModule) PortletManager.getModule(renderRequest,
info.getConfigID());
-
-                        if (webModule != null) {
-                            details.getContextPaths().add(webModule.getContextPath());
-                            details.setDisplayName(webModule.getDisplayName());
+                        Configuration config = configManager.getConfiguration(info.getConfigID());
+                        for(Map.Entry<AbstractName, GBeanData> entry : config.getGBeans().entrySet())
{
+                            if(entry.getKey().getNameProperty(NameFactory.J2EE_TYPE).equals(NameFactory.WEB_MODULE))
{
+                                details.getContextPaths().add((String)entry.getValue().getAttribute("contextPath"));
+                                details.setDisplayName(((WebAppInfo)entry.getValue().getAttribute("webAppInfo")).displayName);
+                            }
                         }
 
                         if (showDependencies) {
@@ -248,26 +250,24 @@ public class ConfigManagerPortlet extend
                             unloadModule(configManager, configObjName);
                         }
                     } catch (InvalidConfigException ice) {
-                        // Should not occur
-                        ice.printStackTrace();
+                        logger.error("Fail to load configuration", ice);
                     }
                     moduleDetails.add(details);
-                } else if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue())
{
+                } else if (info.getType() == ConfigurationModuleType.EAR) {
                     try {
                         AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                         boolean loaded = loadModule(configManager, configObjName);
 
                         Configuration config = configManager.getConfiguration(info.getConfigID());
-                        if(config != null){
-                            for (Configuration child : config.getChildren()) {
-                                if (child.getModuleType().getValue() == ConfigurationModuleType.WAR.getValue())
{
-                                    ModuleDetails childDetails = new ModuleDetails(info.getConfigID(),
child.getModuleType(), info.getState());
-                                    childDetails.setComponentName(child.getId().toString());
-                                    WebModule webModule = getWebModule(config, child);
-                                    if (webModule != null) {
-                                        childDetails.getContextPaths().add(webModule.getContextPath());
-                                        childDetails.setDisplayName(webModule.getDisplayName());
-                                    }
+                        if (config != null) {
+                            for (Map.Entry<AbstractName, GBeanData> entry : config.getGBeans().entrySet())
{
+                                if (entry.getKey().getNameProperty(NameFactory.J2EE_TYPE).equals(NameFactory.WEB_MODULE))
{
+                                    ModuleDetails childDetails = new ModuleDetails(info.getConfigID(),
ConfigurationModuleType.WAR, info.getState());
+                                    AbstractName webModuleAbName = entry.getKey();
+                                    GBeanData webModuleGBeanData = entry.getValue();
+                                    childDetails.setComponentName(webModuleAbName.getNameProperty("name"));
+                                    childDetails.getContextPaths().add((String) webModuleGBeanData.getAttribute("contextPath"));
+                                    childDetails.setDisplayName(((WebAppInfo)webModuleGBeanData.getAttribute("webAppInfo")).displayName);
                                     if (showDependencies) {
                                         addDependencies(childDetails, configObjName);
                                     }
@@ -275,13 +275,11 @@ public class ConfigManagerPortlet extend
                                 }
                             }
                         }
-
                         if (loaded) {
                             unloadModule(configManager, configObjName);
                         }
                     } catch (InvalidConfigException ice) {
-                        // Should not occur
-                        ice.printStackTrace();
+                        logger.error("Fail to load configuration", ice);
                     }
                 }
 
@@ -291,17 +289,13 @@ public class ConfigManagerPortlet extend
                     AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                     boolean loaded = loadModule(configManager, configObjName);
 
-                    if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue())
{
+                    if (info.getType() == ConfigurationModuleType.EAR) {
                         Configuration config = configManager.getConfiguration(info.getConfigID());
                         if(config != null){
-                            Iterator childs = config.getChildren().iterator();
-                            while (childs.hasNext()) {
-                                Configuration child = (Configuration) childs.next();
-                                if (child.getModuleType().getValue() == ConfigurationModuleType.WAR.getValue())
{
-                                    WebModule webModule = getWebModule(config, child);
-                                    if (webModule != null) {
-                                        details.getContextPaths().add(webModule.getContextPath());
-                                    }
+                            for(Map.Entry<AbstractName, GBeanData> entry : config.getGBeans().entrySet())
{
+                                if(entry.getKey().getNameProperty(NameFactory.J2EE_TYPE).equals(NameFactory.WEB_MODULE))
{
+                                    details.getContextPaths().add((String)entry.getValue().getAttribute("contextPath"));
+                                    details.setDisplayName(((WebAppInfo)entry.getValue().getAttribute("webAppInfo")).displayName);
                                 }
                             }
                         }
@@ -316,14 +310,13 @@ public class ConfigManagerPortlet extend
                         unloadModule(configManager, configObjName);
                     }
                 } catch (InvalidConfigException ice) {
-                    // Should not occur
-                    ice.printStackTrace();
+                    logger.error("Fail to load configuration", ice);
                 }
                 moduleDetails.add(details);
-            }  
-            
-        }            
-        
+            }
+
+        }
+
         Collections.sort(moduleDetails);
         renderRequest.setAttribute("configurations", moduleDetails);
         renderRequest.setAttribute("showWebInfo", Boolean.valueOf(showWebInfo()));
@@ -362,7 +355,7 @@ public class ConfigManagerPortlet extend
         }
         return configurationState;
     }
-    
+
     private WebModule getWebModule(Configuration config, Configuration child) {
         try {
             Map<String, String> query1 = new HashMap<String, String>();



Mime
View raw message