geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r449523 - in /geronimo/server/trunk/applications/console/geronimo-console-standard/src/main: java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java webapp/WEB-INF/view/configmanager/normal.jsp
Date Sun, 24 Sep 2006 23:31:09 GMT
Author: djencks
Date: Sun Sep 24 16:31:08 2006
New Revision: 449523

URL: http://svn.apache.org/viewvc?view=rev&rev=449523
Log:
GERONIMO-2248 show parent and child modules for each module

Modified:
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?view=diff&rev=449523&r1=449522&r2=449523
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Sun Sep 24 16:31:08 2006
@@ -34,12 +34,16 @@
 import javax.portlet.WindowState;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.LifecycleException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.management.State;
@@ -144,6 +148,7 @@
 
         List moduleDetails = new ArrayList();
         ConfigurationManager configManager = ConfigurationUtil.getConfigurationManager(kernel);
+        DependencyManager depMgr = kernel.getDependencyManager();
         List infos = configManager.listConfigurations();
         for (Iterator j = infos.iterator(); j.hasNext();) {
             ConfigurationInfo info = (ConfigurationInfo) j.next();
@@ -157,6 +162,52 @@
                         details.setUrlFor(webModule.getURLFor());
                     }
                 }
+                try {
+                    AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
+                    boolean flag = false;
+                    // Check if the configuration is loaded.  If not, load it to get information.
+                    if(!kernel.isLoaded(configObjName)) {
+                        flag = true;
+                        try {
+                            configManager.loadConfiguration(configObjName.getArtifact());
+                        } catch (NoSuchConfigException e) {
+                            // Should not occur
+                            e.printStackTrace();
+                        } catch (LifecycleException e) {
+                            // TODO Auto-generated catch block
+                            e.printStackTrace();
+                        }
+                    }
+
+                    java.util.Set parents = depMgr.getParents(configObjName);
+                    for(Iterator itr = parents.iterator(); itr.hasNext(); ) {
+                        AbstractName parent = (AbstractName)itr.next();
+                        details.getParents().add(parent.getArtifact());
+                    }
+                    java.util.Set children = depMgr.getChildren(configObjName);
+                    for(Iterator itr = children.iterator(); itr.hasNext(); ) {
+                        AbstractName child = (AbstractName)itr.next();
+                        //if(configManager.isConfiguration(child.getArtifact()))
+                        if(child.getNameProperty("configurationName") != null) {
+                            details.getChildren().add(child.getArtifact());
+                        }
+                    }
+                    Collections.sort(details.getParents());
+                    Collections.sort(details.getChildren());
+
+                    // Unload the configuration if it has been loaded earlier for the sake
of getting information
+                    if(flag) {
+                        try {
+                            configManager.unloadConfiguration(configObjName.getArtifact());
+                        } catch (NoSuchConfigException e) {
+                            // Should not occur
+                            e.printStackTrace();
+                        }
+                    }
+                } catch(InvalidConfigException ice) {
+                    // Should not occur
+                    ice.printStackTrace();
+                }
                 moduleDetails.add(details);
             }
         }
@@ -206,6 +257,8 @@
         private final State state;
         private URL urlFor;             // only relevant for webapps
         private String contextPath;     // only relevant for webapps
+        private List parents = new ArrayList();
+        private List children = new ArrayList();
 
         public ModuleDetails(Artifact configId, ConfigurationModuleType type, State state)
{
             this.configId = configId;
@@ -213,6 +266,14 @@
             this.state = state;
         }
 
+        public ModuleDetails(Artifact configId, ConfigurationModuleType type, State state,
List parents, List children) {
+            this.configId = configId;
+            this.type = type;
+            this.state = state;
+            this.parents = parents;
+            this.children = children;
+        }
+
         public int compareTo(Object o) {
             if (o != null && o instanceof ModuleDetails){
                 return configId.compareTo(((ModuleDetails)o).configId);
@@ -247,6 +308,14 @@
 
         public ConfigurationModuleType getType() {
             return type;
+        }
+
+        public List getParents() {
+            return parents;
+        }
+
+        public List getChildren() {
+            return children;
         }
     }
 }

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp?view=diff&rev=449523&r1=449522&r2=449523
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
Sun Sep 24 16:31:08 2006
@@ -10,6 +10,8 @@
         <c:if test="${showWebInfo}"><th>URL</th></c:if>
         <th>&nbsp;State</th>
         <th align="center" colspan="3">Commands</th>
+        <th align="left">Parent Components</th>
+        <th align="left">Child Components</th>
     </tr>
   <c:set var="backgroundClass" value='MediumBackground'/>
   <c:forEach var="moduleDetails" items="${configurations}">
@@ -37,6 +39,16 @@
         </td>
         <td width="75" class="${backgroundClass}">
             <a href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param
name="action" value="uninstall"/></portlet:actionURL>" onClick="return confirm('Are
you sure you want to uninstall ${moduleDetails.configId}?');">Uninstall</a>
+        </td>
+        <td class="${backgroundClass}">
+            <c:forEach var="parent" items="${moduleDetails.parents}">
+                ${parent} <br>
+            </c:forEach>
+        </td>
+        <td class="${backgroundClass}">
+        <c:forEach var="child" items="${moduleDetails.children}">
+            ${child} <br>
+        </c:forEach>
         </td>
     </tr>
   </c:forEach>



Mime
View raw message