geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r804089 - in /geronimo/server/trunk: framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/ plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ plugins/console...
Date Fri, 14 Aug 2009 06:29:53 GMT
Author: xuhaihong
Date: Fri Aug 14 06:29:52 2009
New Revision: 804089

URL: http://svn.apache.org/viewvc?rev=804089&view=rev
Log:
GERONIMO-4659 Include web app "Display Name" in console web app portlet (Patch from Victor
Fang)

Modified:
    geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/WebAppContextWrapper.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.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

Modified: geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java?rev=804089&r1=804088&r2=804089&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
Fri Aug 14 06:29:52 2009
@@ -47,4 +47,10 @@
      * content or a user would copy updated JSPs to.
      */
     public URL getWARDirectory();
+    
+    /**
+     * Get the first displayName value set in the web.xml
+     * @return
+     */
+    public String getDisplayName();
 }

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=804089&r1=804088&r2=804089&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
Fri Aug 14 06:29:52 2009
@@ -84,8 +84,12 @@
     private PortletRequestDispatcher maximizedView;
 
     private PortletRequestDispatcher helpView;
+    
+    private boolean showDisplayName;
+    
+    private String moduleType;
 
-    private static List loadChildren(Kernel kernel, String configName) {
+    private static List<String> loadChildren(Kernel kernel, String configName) {
         List<String> kids = new ArrayList<String>();
 
         Map<String, String> filter = new HashMap<String, String>();
@@ -201,14 +205,12 @@
         }
               
         String cookies = renderRequest.getProperty("cookie");
-        boolean showDependencies = (cookies != null && cookies.indexOf(SHOW_DEPENDENCIES_COOKIE
+ "=true") > 0);
+        boolean showDependencies = (cookies != null && cookies.indexOf(SHOW_DEPENDENCIES_COOKIE
+ "=true") > 0);        
         
         List<ModuleDetails> moduleDetails = new ArrayList<ModuleDetails>();
         ConfigurationManager configManager = ConfigurationUtil.getConfigurationManager(kernel);
         List<ConfigurationInfo> infos = configManager.listConfigurations();
-        for (ConfigurationInfo info : infos) {
-
-            String moduleType = getInitParameter(CONFIG_INIT_PARAM);
+        for (ConfigurationInfo info : infos) {           
             if (ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType)) {
 
                 if (info.getType().getValue() == ConfigurationModuleType.WAR.getValue())
{
@@ -217,14 +219,17 @@
                         AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                         boolean loaded = loadModule(configManager, configObjName);
 
-                        WebModule webModule = (WebModule) PortletManager.getModule(renderRequest,
info.getConfigID());
+                        WebModule webModule = (WebModule) PortletManager.getModule(renderRequest,
info.getConfigID());                        
+
                         if (webModule != null) {
                             details.getContextPaths().add(webModule.getContextPath());
+                            details.setDisplayName(webModule.getDisplayName());
                         }
 
                         if (showDependencies) {
                             addDependencies(details, configObjName);
                         }
+                        
                         if (loaded) {
                             unloadModule(configManager, configObjName);
                         }
@@ -244,9 +249,10 @@
                                 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);
+                                    WebModule webModule = getWebModule(config, child);  
                                 
                                     if (webModule != null) {
                                         childDetails.getContextPaths().add(webModule.getContextPath());
+                                        childDetails.setDisplayName(webModule.getDisplayName());
                                     }
                                     if (showDependencies) {
                                         addDependencies(childDetails, configObjName);
@@ -305,6 +311,7 @@
         Collections.sort(moduleDetails);
         renderRequest.setAttribute("configurations", moduleDetails);
         renderRequest.setAttribute("showWebInfo", Boolean.valueOf(showWebInfo()));
+        renderRequest.setAttribute("showDisplayName", Boolean.valueOf(showDisplayName));
         renderRequest.setAttribute("showDependencies", Boolean.valueOf(showDependencies));
         if (moduleDetails.size() == 0) {
             addWarningMessage(renderRequest, getLocalizedString(renderRequest, "consolebase.warnMsg02"));
@@ -404,11 +411,10 @@
         }        
     }
     
-    private boolean showWebInfo() {
-        String moduleType = getInitParameter(CONFIG_INIT_PARAM);
+    private boolean showWebInfo() {        
         return ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType) ||
                ConfigurationModuleType.EAR.getName().equalsIgnoreCase(moduleType);
-    }
+    }    
     
     protected void doHelp(RenderRequest renderRequest, RenderResponse renderResponse) throws
PortletException, IOException {
         helpView.include(renderRequest, renderResponse);
@@ -420,6 +426,9 @@
         normalView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/normal.jsp");
         maximizedView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/maximized.jsp");
         helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/help.jsp");
+        moduleType = getInitParameter(CONFIG_INIT_PARAM);
+        //Only show the displayNames for the web applications
+        showDisplayName = ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType);
     }
 
     public void destroy() {
@@ -445,6 +454,7 @@
         private String componentName;
         //This flag is used to indicate whether it is the client side if the module is a
client application
         private boolean clientAppServerSide = false;
+        private String displayName;
 
         public ModuleDetails(Artifact configId, ConfigurationModuleType type, State state)
{
             this.configId = configId;
@@ -497,6 +507,14 @@
         
         public void setComponentName(String name){
             componentName = name;
+        }       
+        
+        public String getDisplayName(){
+            return displayName;
+        }
+        
+        public void setDisplayName(String name){
+            displayName = name;
         }
         
         public void setClientAppServerSide(boolean clientAppServerSide) {

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/configmanager/normal.jsp?rev=804089&r1=804088&r2=804089&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
Fri Aug 14 06:29:52 2009
@@ -197,8 +197,11 @@
 
 <table width="100%" class="TableLine" summary="Config Manager">
     <tr class="DarkBackground">
-        <th scope="col" align="left">&nbsp;<fmt:message key="configmanager.normal.componentName"
/></th>
-        <c:if test="${showWebInfo}">
+        <th scope="col" align="left">&nbsp;<fmt:message key="configmanager.normal.componentName"
/></th>   
+        <c:if test="${showDisplayName}">    
+               <th scope="col"><fmt:message key="configmanager.normal.displayName"
/></th> 
+        </c:if>
+        <c:if test="${showWebInfo}">          
           <th scope="col">URL</th>
         </c:if>
         <th scope="col">&nbsp;<fmt:message key="consolebase.common.state"/></th>
@@ -227,8 +230,20 @@
             <c:otherwise>
                <td class="${backgroundClass}">&nbsp;${moduleDetails.configId}&nbsp;</td>
             </c:otherwise>   
-        </c:choose>
+        </c:choose>        
         
+        <!-- display id -->
+        <c:if test="${showDisplayName}">
+            <c:choose>
+                <c:when test="${moduleDetails.displayName != null}">
+                    <td class="${backgroundClass}">&nbsp;${moduleDetails.displayName}&nbsp;</td>
+                </c:when>
+                <c:otherwise>
+                    <td class="${backgroundClass}">&nbsp;</td>
+                </c:otherwise> 
+            </c:choose>
+        </c:if>
+                
         <!-- context path -->
         <c:if test="${showWebInfo}">
             <td class="${backgroundClass}">

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/WebAppContextWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/WebAppContextWrapper.java?rev=804089&r1=804088&r2=804089&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/WebAppContextWrapper.java
(original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/WebAppContextWrapper.java
Fri Aug 14 06:29:52 2009
@@ -31,7 +31,6 @@
 import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
 import javax.transaction.TransactionManager;
 
 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
@@ -46,8 +45,8 @@
 import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
-import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.apache.geronimo.jetty7.handler.GeronimoWebAppContext;
+import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.apache.geronimo.jetty7.security.SecurityHandlerFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.ObjectNameUtil;
@@ -239,7 +238,7 @@
         }
 
         //stuff from spec dd
-        webAppContext.setDisplayName(displayName);
+        setDisplayName(displayName);
         webAppContext.setInitParams(contextParamMap);
         setListenerClassNames(listenerClassNames);
         webAppContext.setDistributable(distributable);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=804089&r1=804088&r2=804089&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Fri Aug 14 06:29:52 2009
@@ -25,18 +25,14 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.net.URL;
-import java.security.PermissionCollection;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
 import java.util.jar.JarFile;
 
 import javax.servlet.Servlet;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
@@ -50,8 +46,8 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -68,8 +64,8 @@
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
 import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
-import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.security.jaas.ConfigurationFactory;
+import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.tomcat.LifecycleListenerGBean;
 import org.apache.geronimo.tomcat.ManagerGBean;
 import org.apache.geronimo.tomcat.RealmGBean;
@@ -80,15 +76,14 @@
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
-import org.apache.geronimo.xbeans.geronimo.j2ee.GerClusteringDocument;
-import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
-import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;
-import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatAuthenticationType;
-import org.apache.geronimo.xbeans.geronimo.web.tomcat.config.GerTomcatDocument;
+import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiAuthModuleType;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiConfigProviderType;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiServerAuthConfigType;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiServerAuthContextType;
-import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiAuthModuleType;
+import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatAuthenticationType;
+import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;
+import org.apache.geronimo.xbeans.geronimo.web.tomcat.config.GerTomcatDocument;
 import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
 import org.apache.geronimo.xbeans.javaee.EjbRefType;
 import org.apache.geronimo.xbeans.javaee.EnvEntryType;
@@ -107,6 +102,8 @@
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev:385659 $ $Date$
@@ -368,6 +365,12 @@
             } else {
                 webModuleData.setReferencePattern("Container", tomcatContainerName);
             }
+            
+            //get Tomcat display-name
+            if (webApp.getDisplayNameArray().length > 0) {
+                webModuleData.setAttribute("displayName", webApp.getDisplayNameArray()[0].getStringValue());
+            }
+            
             // Process the Tomcat container-config elements
             if (tomcatWebApp.isSetHost()) {
                 String virtualServer = tomcatWebApp.getHost().trim();

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=804089&r1=804088&r2=804089&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 Aug 14 06:29:52 2009
@@ -109,6 +109,7 @@
     private final URL configurationBaseURL;
     private final Holder holder;
     private final RuntimeCustomizer contextCustomizer;
+    private String displayName;
 
     // JSR 77
     private final String j2EEServer;
@@ -144,6 +145,7 @@
             boolean crossContext,
             String workDir,
             boolean disableCookies,
+            String displayName,
             Map webServices,
             Holder holder,
             RuntimeCustomizer contextCustomizer,
@@ -207,6 +209,8 @@
             realm = null;
         }
 
+        this.displayName = displayName;
+        
         //Add the valve list
         if (tomcatValveChain != null){
             ArrayList<Valve> chain = new ArrayList<Valve>();
@@ -448,6 +452,14 @@
 
         return result;
     }
+    
+    public String getDisplayName(){
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;        
+    }
 
     /**
      * ObjectName must match this pattern: <p/>
@@ -586,6 +598,7 @@
         infoBuilder.addReference("J2EEServer", J2EEServer.class);
         infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
         infoBuilder.addAttribute("kernel", Kernel.class, false);
+        infoBuilder.addAttribute("displayName", String.class, true);
 
         infoBuilder.addInterface(WebModule.class);
 
@@ -613,12 +626,13 @@
                 "crossContext",
                 "workDir",
                 "disableCookies",
+                "displayName",
                 "webServices",
                 "holder",
                 "ContextCustomizer",
                 "J2EEServer",
                 "J2EEApplication",
-                "kernel"
+                "kernel"                
                 }
         );
 

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=804089&r1=804088&r2=804089&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 Aug 14 06:29:52 2009
@@ -97,6 +97,7 @@
                 null,
                 null,
                 null,
+                null,
                 null);
         app.setContextPath("/test");
         app.doStart();



Mime
View raw message