geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r393803 - in /geronimo/branches/1.1: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ applications/console-standard/src/java/org/apache/geroni...
Date Thu, 13 Apr 2006 13:44:26 GMT
Author: ammulder
Date: Thu Apr 13 06:43:49 2006
New Revision: 393803

URL: http://svn.apache.org/viewcvs?rev=393803&view=rev
Log:
More progress on cleaning up portlets after the 1.1 merge

Added:
    geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ConfigurationData.java
Modified:
    geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
    geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEApplicationImpl.java
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEApplication.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebModule.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java

Added: geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ConfigurationData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ConfigurationData.java?rev=393803&view=auto
==============================================================================
--- geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ConfigurationData.java
(added)
+++ geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ConfigurationData.java
Thu Apr 13 06:43:49 2006
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.console.util;
+
+import java.io.Serializable;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.gbean.AbstractName;
+
+/**
+ * Standard metadata about a configuration
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public class ConfigurationData implements Serializable, Comparable {
+    private final State state;
+    private final AbstractName parentName;
+    private final String childName;
+    private final ConfigurationModuleType type;
+    private final AbstractName moduleBeanName;
+
+    public ConfigurationData(AbstractName parentName, String childName, State state, ConfigurationModuleType
type, AbstractName moduleBeanName) {
+        this.childName = childName;
+        this.parentName = parentName;
+        this.state = state;
+        this.type = type;
+        this.moduleBeanName = moduleBeanName;
+    }
+
+    public boolean isChild() {
+        return childName != null;
+    }
+
+    public String getChildName() {
+        return childName;
+    }
+
+    public AbstractName getModuleBeanName() {
+        return moduleBeanName;
+    }
+
+    public AbstractName getParentName() {
+        return parentName;
+    }
+
+    public State getState() {
+        return state;
+    }
+
+    public ConfigurationModuleType getType() {
+        return type;
+    }
+
+    public int compareTo(Object o) {
+        ConfigurationData other = (ConfigurationData) o;
+        int test = getParentName().toString().compareTo(other.getParentName().toString());
+        if(test == 0) {
+            if(getChildName() != null && other.getChildName() != null) {
+                return getChildName().compareTo(other.getChildName());
+            } else if(getChildName() == null && other.getChildName() == null) {
+                return 0;
+            } else return getChildName() == null ? 1 : -1;
+        } else return test;
+    }
+}

Modified: geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
(original)
+++ geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
Thu Apr 13 06:43:49 2006
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -41,17 +40,14 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.management.impl.Util;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.management.State;
 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.NoSuchStoreException;
 import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.management.AppClientModule;
@@ -67,7 +63,6 @@
 import org.apache.geronimo.management.JMSResource;
 import org.apache.geronimo.management.ResourceAdapter;
 import org.apache.geronimo.management.Servlet;
-import org.apache.geronimo.management.WebModule;
 import org.apache.geronimo.management.geronimo.J2EEApplication;
 import org.apache.geronimo.management.geronimo.J2EEDomain;
 import org.apache.geronimo.management.geronimo.J2EEServer;
@@ -76,6 +71,7 @@
 import org.apache.geronimo.management.geronimo.JCAResource;
 import org.apache.geronimo.management.geronimo.JVM;
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+import org.apache.geronimo.management.geronimo.WebModule;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
 import org.apache.geronimo.system.logging.SystemLog;
 
@@ -577,24 +573,11 @@
     }
 
 
-    public J2EEResource[] getResources(J2EEApplication application) {
-        J2EEResource[] result = new J2EEResource[0];
-        try {
-            String[] names = application.getResources();
-            Object[] temp = pm.createProxies(names, KernelManagementHelper.class.getClassLoader());
-            result = new J2EEResource[temp.length];
-            System.arraycopy(temp, 0, result, 0, temp.length);
-        } catch (Exception e) {
-            log.error("Unable to look up related GBean", e);
-        }
-        return result;
-    }
-
     public JCAResource[] getJCAResources(J2EEApplication application) {
         List list = new ArrayList();
         try {
             //todo: filter based on ObjectName or something, but what counts as a "JCAResource"?
-            J2EEResource[] all = getResources(application);
+            J2EEResource[] all = application.getResources();
             for (int i = 0; i < all.length; i++) {
                 if(all[i] instanceof JCAResource) {
                     list.add(all[i]);
@@ -709,22 +692,7 @@
     }
 
     public Artifact getConfigurationNameFor(AbstractName abstractName) {
-        try {
-            return abstractName.getArtifact();
-//            Set parents = kernel.getDependencyManager().getParents(ObjectName.getInstance(objectName));
-//            if(parents.size() == 0) {
-//                throw new IllegalStateException("No parents for GBean '"+objectName+"'");
-//            }
-//            for (Iterator it = parents.iterator(); it.hasNext();) {
-//                ObjectName name = (ObjectName) it.next();
-//                if(Configuration.isConfigurationObjectName(name)) {
-//                    return Configuration.getConfigurationID(name);
-//                }
-//            }
-        } catch (Exception e) {
-            log.error("Unable to look up related GBean", e);
-        }
-        return null;
+        return abstractName.getArtifact();
     }
 
     public String getGBeanDescription(AbstractName abstractName) {
@@ -789,7 +757,7 @@
         return kernel.getAbstractNameFor(component);
     }
 
-    public ConfigurationInfo[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules)
{
+    public ConfigurationData[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules)
{
         ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
         List stores = mgr.listStores();
         List results = new ArrayList();
@@ -799,39 +767,43 @@
                 List infos = mgr.listConfigurations(storeName);
                 for (Iterator j = infos.iterator(); j.hasNext();) {
                     ConfigurationInfo info = (ConfigurationInfo) j.next();
+                    AbstractName configuration = mgr.getConfiguration(info.getConfigID()).getAbstractName();
                     if(type == null || type.getValue() == info.getType().getValue()) {
-                        results.add(info);
+
+                        results.add(new ConfigurationData(configuration, null, info.getState(),
info.getType(), kernel.getAbstractNameFor(info.getConfigID())));
                     }
-                    if(includeChildModules && (type == null || info.getType().getValue()
== ConfigurationModuleType.EAR.getValue())) {
-                        String dest = type.equals(ConfigurationModuleType.EAR) ? "J2EEApplication"
:
-                                type.equals(ConfigurationModuleType.EJB) ? "EJBModule" :
-                                type.equals(ConfigurationModuleType.RAR) ? "ResourceAdapterModule"
:
-                                type.equals(ConfigurationModuleType.WAR) ? "WebModule" :
-                                type.equals(ConfigurationModuleType.CAR) ? "AppClientModule"
: null;
-                        String[] modules = Util.getObjectNames(kernel, "*:", new String[]{dest});
+                    if(includeChildModules && info.getType().getValue() == ConfigurationModuleType.EAR.getValue())
{
+                        J2EEApplication app = (J2EEApplication) getModuleForConfiguration(info.getConfigID());
+                        Object[] modules = null;
+                        if(type == null) {
+                            modules = app.getModulesInstances();
+                        } else if(type.equals(ConfigurationModuleType.CAR)) {
+                            modules = app.getClientModules();
+                        } else if(type.equals(ConfigurationModuleType.EJB)) {
+                            modules = app.getEJBModules();
+                        } else if(type.equals(ConfigurationModuleType.RAR)) {
+                            modules = app.getRAModules();
+                        } else if(type.equals(ConfigurationModuleType.WAR)) {
+                            modules = app.getWebModules();
+                        } //todo: handle dynamically registered module types, etc.
+                        if(modules == null) continue;
                         for (int k = 0; k < modules.length; k++) {
-                            String name = modules[k];
-                            if(name.indexOf("J2EEApplication="+info.getConfigID()) > -1)
{
-                                ObjectName temp = null;
-                                try {
-                                    temp = ObjectName.getInstance(name);
-                                } catch (MalformedObjectNameException e) {
-                                    throw new IllegalStateException("Bad ObjectName, Should
Never Happen: "+e.getMessage());
-                                }
-                                State state;
-                                if (kernel.isLoaded(temp)) {
-                                    try {
-                                        state = State.fromInt(kernel.getGBeanState(temp));
-                                    } catch (Exception e) {
-                                        state = null;
-                                    }
-                                } else {
-                                    // If the configuration is not loaded by the kernel
-                                    // and defined by the store, then it is stopped.
-                                    state = State.STOPPED;
-                                }
-                                results.add(new ConfigurationInfo(info.getStoreName(), Artifact.create(temp.getKeyProperty(NameFactory.J2EE_NAME)),
type, info.getCreated(), info.getOwnedConfigurations(), state, info.getConfigID()));
+                            Object module = modules[k];
+                            ConfigurationModuleType moduleType = type;
+                            if(moduleType == null) {
+                                if(module instanceof WebModule) moduleType = ConfigurationModuleType.WAR;
+                                else if(module instanceof EJBModule) moduleType = ConfigurationModuleType.EJB;
+                                else if(module instanceof ResourceAdapterModule) moduleType
= ConfigurationModuleType.RAR;
+                                else if(module instanceof AppClientModule) moduleType = ConfigurationModuleType.CAR;
+                            }
+                            String moduleName;
+                            if(type != null && type.equals(ConfigurationModuleType.WAR))
{
+                                moduleName = ((WebModule)module).getWARName();
+                            } else {
+                                //todo: solutions for other module types
+                                moduleName = (String) kernel.getAbstractNameFor(module).getName().get(NameFactory.J2EE_NAME);
                             }
+                            results.add(new ConfigurationData(configuration, moduleName,
info.getState(), moduleType, kernel.getAbstractNameFor(module)));
                         }
                     }
                 }
@@ -840,54 +812,32 @@
                 // in the unlikely event it does, just continue
             }
         }
-        Collections.sort(results, new Comparator() {
-            public int compare(Object o1, Object o2) {
-                ConfigurationInfo ci1 = (ConfigurationInfo) o1;
-                ConfigurationInfo ci2 = (ConfigurationInfo) o2;
-                return ci1.getConfigID().toString().compareTo(ci2.getConfigID().toString());
-            }
-        });
-        return (ConfigurationInfo[]) results.toArray(new ConfigurationInfo[results.size()]);
+        Collections.sort(results);
+        return (ConfigurationData[]) results.toArray(new ConfigurationData[results.size()]);
     }
 
     public J2EEDeployedObject getModuleForConfiguration(Artifact configuration) {
         ConfigurationManager manager = ConfigurationUtil.getConfigurationManager(kernel);
-        ConfigurationStore store = manager.getStoreForConfiguration(configuration);
-        ObjectName base = kernel.getAbstractNameFor(store).getObjectName();
         Configuration config = manager.getConfiguration(configuration);
-        Configuration parent = config.getEnclosingConfiguration();
         ConfigurationModuleType type = config.getModuleType();
+        AbstractName result;
         try {
-            ObjectName module = null;
             if(type.equals(ConfigurationModuleType.CAR)) {
-                if(parent == null) {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication=null,j2eeType=AppClientModule,name="+configuration);
-                } else {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+parent.getId()+",j2eeType=AppClientModule,name="+configuration);
-                }
+                result = config.findGBean(new AbstractNameQuery(AppClientModule.class.getName()));
             } else if(type.equals(ConfigurationModuleType.EAR)) {
-                module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+configuration+",j2eeType=J2EEApplication,name="+configuration);
+                result = config.findGBean(new AbstractNameQuery(J2EEApplication.class.getName()));
             } else if(type.equals(ConfigurationModuleType.EJB)) {
-                if(parent == null) {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication=null,j2eeType=EJBModule,name="+configuration);
-                } else {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+parent.getId()+",j2eeType=EJBModule,name="+configuration);
-                }
+                result = config.findGBean(new AbstractNameQuery(EJBModule.class.getName()));
             } else if(type.equals(ConfigurationModuleType.RAR)) {
-                if(parent == null) {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication=null,j2eeType=ResourceAdapterModule,name="+configuration);
-                } else {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+parent.getId()+",j2eeType=ResourceAdapterModule,name="+configuration);
-                }
+                result = config.findGBean(new AbstractNameQuery(ResourceAdapterModule.class.getName()));
             } else if(type.equals(ConfigurationModuleType.WAR)) {
-                if(parent == null) {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication=null,j2eeType=WebModule,name="+configuration);
-                } else {
-                    module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+parent.getId()+",j2eeType=WebModule,name="+configuration);
-                }
+                result = config.findGBean(new AbstractNameQuery(WebModule.class.getName()));
+                System.out.println("CL: "+WebModule.class.getClassLoader());
+            } else {
+                return null;
             }
-            return (J2EEDeployedObject) kernel.getProxyManager().createProxy(module, getClass().getClassLoader());
-        } catch (MalformedObjectNameException e) {
+            return (J2EEDeployedObject) kernel.getProxyManager().createProxy(result, getClass().getClassLoader());
+        } catch (GBeanNotFoundException e) {
             throw new IllegalStateException("Bad config ID: "+e.getMessage());
         }
     }

Modified: geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
(original)
+++ geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
Thu Apr 13 06:43:49 2006
@@ -36,7 +36,6 @@
 import org.apache.geronimo.management.JMSResource;
 import org.apache.geronimo.management.ResourceAdapter;
 import org.apache.geronimo.management.Servlet;
-import org.apache.geronimo.management.WebModule;
 import org.apache.geronimo.management.J2EEDeployedObject;
 import org.apache.geronimo.management.geronimo.J2EEApplication;
 import org.apache.geronimo.management.geronimo.J2EEDomain;
@@ -46,6 +45,7 @@
 import org.apache.geronimo.management.geronimo.JCAResource;
 import org.apache.geronimo.management.geronimo.JVM;
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+import org.apache.geronimo.management.geronimo.WebModule;
 import org.apache.geronimo.system.logging.SystemLog;
 
 /**
@@ -82,7 +82,6 @@
     WebModule[] getWebModules(J2EEApplication application);
     EJBModule[] getEJBModules(J2EEApplication application);
     ResourceAdapterModule[] getRAModules(J2EEApplication application);
-    J2EEResource[] getResources(J2EEApplication application);
     JCAResource[] getJCAResources(J2EEApplication application);
     JDBCResource[] getJDBCResources(J2EEApplication application);
     JMSResource[] getJMSResources(J2EEApplication application);
@@ -116,6 +115,6 @@
     Subject testLoginModule(J2EEServer server, LoginModule module, Map options, String username,
String password) throws LoginException;
     Object[] findByInterface(Class iface);
     AbstractName getNameFor(Object component);
-    ConfigurationInfo[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules);
+    ConfigurationData[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules);
     J2EEDeployedObject getModuleForConfiguration(Artifact configuration);
 }

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
Thu Apr 13 06:43:49 2006
@@ -43,22 +43,28 @@
     }
 
     public final static class WebAppData implements Serializable {
-        private String configId;
+        private String parentConfigId;
+        private String childName;
+        private String moduleBeanName;
         private boolean enabled;
         private String dynamicPattern;
         private boolean serveStaticContent;
         private String contextRoot;
         private String webAppDir;
 
-        public WebAppData(String configId, boolean enabled, String dynamicPattern, boolean
serveStaticContent) {
-            this.configId = configId;
+        public WebAppData(String parentConfigId, String childName, String moduleBeanName,
boolean enabled, String dynamicPattern, boolean serveStaticContent) {
+            this.parentConfigId = parentConfigId;
             this.enabled = enabled;
             this.dynamicPattern = dynamicPattern;
             this.serveStaticContent = serveStaticContent;
+            this.moduleBeanName = moduleBeanName;
+            this.childName = childName;
         }
 
         public WebAppData(PortletRequest request, String prefix) {
-            configId = request.getParameter(prefix+"configId");
+            parentConfigId = request.getParameter(prefix+"configId");
+            childName = request.getParameter(prefix+"childName");
+            moduleBeanName = request.getParameter(prefix+"moduleBeanName");
             dynamicPattern = request.getParameter(prefix+"dynamicPattern");
             String test = request.getParameter(prefix+"enabled");
             enabled = test != null && !test.equals("") && !test.equals("false");
@@ -69,12 +75,14 @@
         }
 
         public void save(ActionResponse response, String prefix) {
-            response.setRenderParameter(prefix+"configId", configId);
+            response.setRenderParameter(prefix+"configId", parentConfigId);
+            response.setRenderParameter(prefix+"moduleBeanName", moduleBeanName);
             response.setRenderParameter(prefix+"dynamicPattern", dynamicPattern);
             response.setRenderParameter(prefix+"enabled", Boolean.toString(enabled));
             response.setRenderParameter(prefix+"serveStaticContent", Boolean.toString(serveStaticContent));
             if(contextRoot != null) response.setRenderParameter(prefix+"contextRoot", contextRoot);
             if(webAppDir != null) response.setRenderParameter(prefix+"webAppDir", webAppDir);
+            if(childName != null) response.setRenderParameter(prefix+"childName", childName);
         }
 
         public boolean isEnabled() {
@@ -85,12 +93,12 @@
             this.enabled = enabled;
         }
 
-        public String getConfigId() {
-            return configId;
+        public String getParentConfigId() {
+            return parentConfigId;
         }
 
-        public void setConfigId(String configId) {
-            this.configId = configId;
+        public void setParentConfigId(String parentConfigId) {
+            this.parentConfigId = parentConfigId;
         }
 
         public String getDynamicPattern() {
@@ -123,6 +131,18 @@
 
         public void setWebAppDir(String webAppDir) {
             this.webAppDir = webAppDir;
+        }
+
+        public String getChildName() {
+            return childName;
+        }
+
+        public String getModuleBeanName() {
+            return moduleBeanName;
+        }
+
+        public String getName() {
+            return childName == null ? parentConfigId : childName;
         }
     }
 

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
Thu Apr 13 06:43:49 2006
@@ -16,11 +16,7 @@
  */
 package org.apache.geronimo.console.apache.jk;
 
-import java.io.File;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.List;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -30,13 +26,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.ConfigurationData;
 import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.management.geronimo.WebModule;
 
 /**
@@ -57,45 +49,30 @@
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
amodel) throws PortletException, IOException {
         ApacheModel model = (ApacheModel) amodel;
-        ConfigurationInfo[] webApps = PortletManager.getConfigurations(request, ConfigurationModuleType.WAR,
true);
+        ConfigurationData[] webApps = PortletManager.getConfigurations(request, ConfigurationModuleType.WAR,
true);
         if(model.getWebApps().size() == 0) {
             List list = model.getWebApps();
             for (int i = 0; i < webApps.length; i++) {
-                ConfigurationInfo app = webApps[i];
+                ConfigurationData app = webApps[i];
+log.error("*********** "+app.getType()+": "+app.getParentName()+" / "+app.getChildName());
                 if(!app.getState().isRunning()) {
                     continue;
                 }
-                AbstractName storeName = app.getStoreName();
-                ConfigurationStore store = (ConfigurationStore) PortletManager.getManagedBean(request,
storeName);
-                WebModule web = (WebModule) PortletManager.getModule(request, app.getConfigID());
-                WebAppData data = new WebAppData(app.getConfigID().toString(), false, null,
false);
+                WebModule web = (WebModule) PortletManager.getManagedBean(request, app.getModuleBeanName());
+                WebAppData data = new WebAppData(app.getParentName().toString(), app.getChildName(),
app.getModuleBeanName().toString(), false, null, false);
                 data.setContextRoot(web.getContextPath());
-                try {
-                    String path = getPathToConfiguration(store, app.getParentID() == null
? app.getConfigID() : app.getParentID(), app.getParentID() == null ? null : app.getConfigID());
-                    if(app.getParentID() == null) {
-                        path = path + File.separator + "web";
-                    } else {
-                        path = path + File.separator + app.getConfigID();
-                    }
-                    data.setWebAppDir(path);
-                } catch (NoSuchConfigException e) {
-                    log.error("I sure didn't expect to get this exception", e);
+                String path;
+                if(web.getWARDirectory().getProtocol().equals("file")) {
+                    path = web.getWARDirectory().getPath();
+                } else {
+                    path = "WARMustBeUnpacked";
                 }
+
+                data.setWebAppDir(path);
                 list.add(data);
             }
         }
         request.setAttribute("webApps", webApps);
-    }
-
-    private String getPathToConfiguration(ConfigurationStore store, Artifact moduleOrParentID,
Artifact childID) throws NoSuchConfigException {
-        try {
-            return store.resolve(moduleOrParentID, childID.toString(), new URI("")).getPath();
-        } catch (MalformedURLException e) {
-            log.error("Unable to locate path to web app "+moduleOrParentID+(childID == null
? "" : " / "+childID), e);
-        } catch (URISyntaxException e) {
-            log.error("Unable to locate path to web app "+moduleOrParentID+(childID == null
? "" : " / "+childID), e);
-        }
-        return "PATH_TO_EXPLODED_WAR_IN_REPO";
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
amodel) throws PortletException, IOException {

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
Thu Apr 13 06:43:49 2006
@@ -389,7 +389,7 @@
         return helper.getModuleForConfiguration(configuration);        
     }
 
-    public static ConfigurationInfo[] getConfigurations(PortletRequest request, ConfigurationModuleType
type, boolean includeChildModules) {
+    public static ConfigurationData[] getConfigurations(PortletRequest request, ConfigurationModuleType
type, boolean includeChildModules) {
         ManagementHelper helper = getManagementHelper(request);
         return helper.getConfigurations(type, includeChildModules);
     }

Modified: geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEApplicationImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEApplicationImpl.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEApplicationImpl.java
(original)
+++ geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEApplicationImpl.java
Thu Apr 13 06:43:49 2006
@@ -18,14 +18,19 @@
 
 import java.util.Hashtable;
 import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.management.J2EEServer;
-import org.apache.geronimo.management.geronimo.J2EEApplication;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.management.AppClientModule;
+import org.apache.geronimo.management.EJBModule;
+import org.apache.geronimo.management.J2EEModule;
+import org.apache.geronimo.management.J2EEResource;
+import org.apache.geronimo.management.geronimo.J2EEApplication;
+import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+import org.apache.geronimo.management.geronimo.WebModule;
 
 /**
  * @version $Rev$ $Date$
@@ -99,10 +104,34 @@
                 new String[]{"AppClientModule", "EJBModule", "WebModule", "ResourceAdapterModule"});
     }
 
-    public String[] getResources() {
-        return Util.getObjectNames(kernel,
-                baseName,
-                new String[]{"JavaMailResource", "JCAConnectionFactory", "JDBCResource",
"JDBCDriver", "JMSResource", "JNDIResource", "JTAResource", "RMI_IIOPResource", "URLResource"});
+    public J2EEModule[] getModulesInstances() {
+        return (J2EEModule[]) Util.getObjects(kernel, baseName,
+                new String[]{"AppClientModule", "EJBModule", "WebModule", "ResourceAdapterModule"},
J2EEModule.class);
+    }
+
+    public J2EEResource[] getResources() {
+        return (J2EEResource[]) Util.getObjects(kernel, baseName,
+                new String[]{"JavaMailResource", "JCAConnectionFactory", "JDBCResource",
"JDBCDriver", "JMSResource", "JNDIResource", "JTAResource", "RMI_IIOPResource", "URLResource"},
J2EEResource.class);
+    }
+
+    public AppClientModule[] getClientModules() {
+        return (AppClientModule[]) Util.getObjects(kernel, baseName,
+                new String[]{"AppClientModule"}, AppClientModule.class);
+    }
+
+    public EJBModule[] getEJBModules() {
+        return (EJBModule[]) Util.getObjects(kernel, baseName,
+                new String[]{"EJBModule"}, EJBModule.class);
+    }
+
+    public ResourceAdapterModule[] getRAModules() {
+        return (ResourceAdapterModule[]) Util.getObjects(kernel, baseName,
+                new String[]{"ResourceAdapterModule"}, ResourceAdapterModule.class);
+    }
+
+    public WebModule[] getWebModules() {
+        return (WebModule[]) Util.getObjects(kernel, baseName,
+                new String[]{"WebModule"}, WebModule.class);
     }
 
     public String getDeploymentDescriptor() {
@@ -121,9 +150,6 @@
         infoFactory.addAttribute("objectName", String.class, false);
         infoFactory.addReference("j2eeServer", J2EEServer.class);
         infoFactory.addAttribute("deploymentDescriptor", String.class, true);
-        infoFactory.addAttribute("server", String.class, false);
-        infoFactory.addAttribute("modules", String[].class, false);
-        infoFactory.addAttribute("resources", String[].class, false);
         infoFactory.addInterface(J2EEApplication.class);
 
         infoFactory.setConstructor(new String[]{

Modified: geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
(original)
+++ geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Thu Apr 13 06:43:49 2006
@@ -59,6 +59,7 @@
 import org.mortbay.jetty.servlet.WebApplicationHandler;
 
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 import javax.naming.Context;
 import java.io.IOException;
 import java.net.URI;
@@ -75,7 +76,7 @@
 /**
  * Wrapper for a WebApplicationContext that sets up its J2EE environment.
  *
- * @version $Rev: 386763 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class JettyWebAppContext extends WebApplicationContext implements GBeanLifecycle,
JettyServletRegistration, WebModule {
     private static Log log = LogFactory.getLog(JettyWebAppContext.class);
@@ -88,6 +89,7 @@
     private final JettyContainer jettyContainer;
 
     private final String webAppRoot;
+    private final URL configurationBaseURL;
     private final WebApplicationHandler handler;
     private String displayName;
     private final String[] welcomeFiles;
@@ -151,6 +153,7 @@
         welcomeFiles = null;
         objectName = null;
         sessionManager = null;
+        configurationBaseURL = null;
     }
 
     public JettyWebAppContext(String objectName,
@@ -206,6 +209,7 @@
             ObjectName myObjectName = JMXUtil.getObjectName(objectName);
             verifyObjectName(myObjectName);
         }
+        this.configurationBaseURL = configurationBaseUrl;
 
         this.jettyContainer = jettyContainer;
 
@@ -300,6 +304,19 @@
 
     public boolean isEventProvider() {
         return true;
+    }
+
+    public URL getWARDirectory() {
+        return configurationBaseURL;
+    }
+
+    public String getWARName() {
+        //todo: make this return something more consistent
+        try {
+            return ObjectName.getInstance(objectName).getKeyProperty(NameFactory.J2EE_NAME);
+        } catch (MalformedObjectNameException e) {
+            return null;
+        }
     }
 
     public String getContainerName() {

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEApplication.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEApplication.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEApplication.java
(original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEApplication.java
Thu Apr 13 06:43:49 2006
@@ -16,6 +16,11 @@
  */
 package org.apache.geronimo.management.geronimo;
 
+import org.apache.geronimo.management.J2EEResource;
+import org.apache.geronimo.management.J2EEModule;
+import org.apache.geronimo.management.EJBModule;
+import org.apache.geronimo.management.AppClientModule;
+
 /**
  * Represents the JSR-77 type with the same name
  *
@@ -26,8 +31,16 @@
      * A list of J2EEResources deployed with this application.  This is not
      * a standard JSR-77 feature, I guess because most servers deploy most
      * resources at the top level, but RARs can always be embedded...
-     *
-     * @return the ObjectName Strings of the resources deployed with this EAR
      */
-    String[] getResources();
+    J2EEResource[] getResources();
+
+    J2EEModule[] getModulesInstances();
+
+    WebModule[] getWebModules();
+
+    EJBModule[] getEJBModules();
+
+    ResourceAdapterModule[] getRAModules();
+
+    AppClientModule[] getClientModules();
 }

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebModule.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebModule.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebModule.java
(original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebModule.java
Thu Apr 13 06:43:49 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.management.geronimo;
 
+import java.net.URL;
+
 /**
  * Geronimo extension to the standard JSR-77 WebModule type.
  *
@@ -32,4 +34,17 @@
      * WebModule.
      */
     public String getContainerName();
+
+    /**
+     * Gets a name for this WAR file that can be used to identify the WAR to a
+     * user.  This is not guaranteed to be anything in particular.
+     */
+    public String getWARName();
+
+    /**
+     * Gets the location of the web module "source" (typically an exploded
+     * directory).  This is where e.g. a web server would look for static
+     * content or a user would copy updated JSPs to.
+     */
+    public URL getWARDirectory();
 }

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=393803&r1=393802&r2=393803&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Thu Apr 13 06:43:49 2006
@@ -43,6 +43,7 @@
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
@@ -110,6 +111,8 @@
 
     private final String originalSpecDD;
 
+    private final URL configurationBaseURL;
+
     public TomcatWebAppContext(
             ClassLoader classLoader,
             String objectName,
@@ -170,6 +173,8 @@
         this.server = server;
         this.application = application;
 
+        this.configurationBaseURL = configurationBaseUrl;
+
         if (tomcatRealm != null){
             realm = (Realm)tomcatRealm.getInternalObject();
             if (realm == null){
@@ -242,6 +247,19 @@
 
     public boolean isEventProvider() {
         return true;
+    }
+
+    public URL getWARDirectory() {
+        return configurationBaseURL;
+    }
+
+    public String getWARName() {
+        //todo: make this return something more consistent
+        try {
+            return ObjectName.getInstance(objectName).getKeyProperty(NameFactory.J2EE_NAME);
+        } catch (MalformedObjectNameException e) {
+            return null;
+        }
     }
 
     public String getContainerName() {



Mime
View raw message