geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r829687 - in /geronimo/server/trunk/plugins/console: console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ console-core/src/main/java/org/a...
Date Mon, 26 Oct 2009 02:07:05 GMT
Author: xuhaihong
Date: Mon Oct 26 02:07:04 2009
New Revision: 829687

URL: http://svn.apache.org/viewvc?rev=829687&view=rev
Log:
Clean console codes and remove unused classes

Removed:
    geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/core/jms/
Modified:
    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/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
    geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/CARExportServlet.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.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=829687&r1=829686&r2=829687&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 Oct 26 02:07:04 2009
@@ -208,7 +208,7 @@
         boolean showDependencies = (cookies != null && cookies.indexOf(SHOW_DEPENDENCIES_COOKIE
+ "=true") > 0);        
         
         List<ModuleDetails> moduleDetails = new ArrayList<ModuleDetails>();
-        ConfigurationManager configManager = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager configManager = PortletManager.getConfigurationManager();
         List<ConfigurationInfo> infos = configManager.listConfigurations();
         for (ConfigurationInfo info : infos) {           
             if (ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType)) {

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
Mon Oct 26 02:07:04 2009
@@ -53,6 +53,7 @@
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.management.geronimo.WebManager.ConnectorAttribute;
 import org.apache.geronimo.management.geronimo.WebManager.ConnectorType;
+import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -214,17 +215,14 @@
                 setKeystoreProperties(actionRequest, connectorName);
                 
                 try {
-                    Kernel kernel=PortletManager.getKernel();
-                    ClassLoader oldCL=connector.getClass().getClassLoader();
+                    Kernel kernel = PortletManager.getKernel();
+                    BundleContext bundleContext = kernel.getBundleFor(connector.getClass()).getBundleContext();
                     kernel.stopGBean(connectorName);
                     kernel.unloadGBean(connectorName);
-                    
-                    
-                    kernel.loadGBean(connectorGBeanData, oldCL);
+                    kernel.loadGBean(connectorGBeanData, bundleContext);
                     kernel.startGBean(connectorName);
-                  
                 } catch (Exception e) {
-                    log.error("Unable to reload updated connector:"+connectorName.toURI(),
e);
+                    log.error("Unable to reload updated connector:" + connectorName.toURI(),
e);
                 }
                 
                 

Modified: geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
(original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
Mon Oct 26 02:07:04 2009
@@ -51,6 +51,7 @@
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.osgi.BundleClassLoader;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -355,7 +356,7 @@
     public Object getObject(AbstractName objectName) {
         ClassLoader cl = null;
         try {
-            cl = kernel.getClassLoaderFor(objectName);
+            cl = new BundleClassLoader(kernel.getBundleFor(objectName));
         } catch(GBeanNotFoundException e) {
             cl = KernelManagementHelper.class.getClassLoader();
         }
@@ -429,7 +430,12 @@
     }
 
     public ConfigurationData[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules)
{
-        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager mgr = null;
+        try {
+            mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        } catch (GBeanNotFoundException e) {
+            return null;
+        }
         List<AbstractName> stores = mgr.listStores();
         List<ConfigurationData> results = new ArrayList<ConfigurationData>();
         for (AbstractName storeName : stores) {
@@ -499,7 +505,12 @@
      * @return The Module, or null if the configuration is not running.
      */
     public J2EEDeployedObject getModuleForConfiguration(Artifact configuration) {
-        ConfigurationManager manager = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager manager = null;
+        try {
+            manager = ConfigurationUtil.getConfigurationManager(kernel);
+        } catch (GBeanNotFoundException e) {
+            return null;
+        }
         Configuration config = manager.getConfiguration(configuration);
         if (config == null || !manager.isRunning(configuration)) {
             return null; // The configuration is not running, so we can't get its contents
@@ -520,7 +531,7 @@
             } else {
                 return null;
             }
-            ClassLoader classLoader = kernel.getClassLoaderFor(result);
+            ClassLoader classLoader = new BundleClassLoader(kernel.getBundleFor(result));
             return (J2EEDeployedObject) kernel.getProxyManager().createProxy(result, classLoader);
         } catch (GBeanNotFoundException e) {
             throw new IllegalStateException("Bad config ID: " + e.getMessage(), e);

Modified: geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
(original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
Mon Oct 26 02:07:04 2009
@@ -28,10 +28,9 @@
 import javax.security.auth.spi.LoginModule;
 import javax.servlet.http.HttpSession;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -57,6 +56,8 @@
 import org.apache.geronimo.management.geronimo.WebContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.logging.SystemLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -93,7 +94,11 @@
     }
 
     public static ConfigurationManager getConfigurationManager() {
-        return ConfigurationUtil.getConfigurationManager(getKernel());
+        try {
+            return ConfigurationUtil.getConfigurationManager(getKernel());
+        } catch (GBeanNotFoundException e) {
+            return null;
+        }
     }
 
     public static ManagementHelper getManagementHelper(PortletRequest request) {

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/CARExportServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/CARExportServlet.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/CARExportServlet.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/CARExportServlet.java
Mon Oct 26 02:07:04 2009
@@ -16,22 +16,22 @@
  */
 package org.apache.geronimo.console.car;
 
+import java.io.IOException;
 import java.net.URLEncoder;
 
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
 /**
  * Servlet that lets you download a CAR from the repository
  *
@@ -45,7 +45,7 @@
         }
         Artifact artifact = Artifact.create(configId);
         Kernel kernel = KernelRegistry.getSingleKernel();
-        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager mgr = PortletManager.getConfigurationManager();
         ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
         try {
             response.setContentType("application/zip");

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
Mon Oct 26 02:07:04 2009
@@ -23,7 +23,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.servlet.ServletException;
@@ -42,10 +41,9 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -58,8 +56,10 @@
 import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.util.XmlUtil;
 import org.apache.geronimo.system.plugin.PluginInstaller;
-import org.apache.geronimo.system.plugin.PluginXmlUtil;
 import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginXmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
@@ -70,6 +70,9 @@
  * @version $Rev$ $Date$
  */
 public class GeronimoAsMavenServlet extends HttpServlet {
+    
+    private static final long serialVersionUID = -2106697871964363101L;
+
     private static final Logger log = LoggerFactory.getLogger(GeronimoAsMavenServlet.class);
 
     protected void doHead(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws ServletException, IOException {
@@ -160,7 +163,12 @@
     private boolean produceDownloadFile(Kernel kernel, Artifact configId, HttpServletResponse
response, boolean reply) throws IOException {
         //todo: replace kernel mumbo jumbo with JSR-77 navigation
         // Step 1: check if it's in a configuration store
-        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager mgr;
+        try {
+            mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        } catch (GBeanNotFoundException e) {
+            throw new IOException(e.getMessage());
+        }
         if(mgr.isConfiguration(configId)) {
             ConfigurationStore store = mgr.getStoreForConfiguration(configId);
             response.setContentType("application/zip");
@@ -176,9 +184,8 @@
             }
         }
         // Step 2: check if it's in a repository
-        Set repos = kernel.listGBeans(new AbstractNameQuery(Repository.class.getName()));
-        for (Iterator it = repos.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
+        Set<AbstractName> repos = kernel.listGBeans(new AbstractNameQuery(Repository.class.getName()));
+        for (AbstractName name : repos) {
             Repository repo = (Repository) kernel.getProxyManager().createProxy(name, Repository.class);
             if(repo.contains(configId)) {
                 File path = repo.getLocation(configId);
@@ -204,9 +211,10 @@
     }
 
     private void generateConfigFile(HttpServletRequest request, Kernel kernel, PrintWriter
out) throws NoSuchStoreException, JAXBException, XMLStreamException {
-        String repo = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+request.getServletPath();
-        if(!repo.endsWith("/")) repo += "/";
-        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        String repo = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ request.getContextPath() + request.getServletPath();
+        if (!repo.endsWith("/")) {
+            repo += "/";
+        }
         PluginInstaller installer = getInstaller(kernel);
         PluginListType pluginList = installer.createPluginListForRepositories(repo);
         PluginXmlUtil.writePluginList(pluginList, out);
@@ -214,7 +222,7 @@
 
 
     private PluginInstaller getInstaller(Kernel kernel) {
-        Set names = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
+        Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
         if(names.size() == 0) {
             return null;
         }
@@ -222,7 +230,12 @@
     }
 
     private void generateMavenFile(Kernel kernel, PrintWriter writer, String groupId, String
artifactId, boolean reply) throws ParserConfigurationException, TransformerException {
-        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationManager mgr = null;
+        try {
+            mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        } catch (GBeanNotFoundException e) {
+            //Should Not Happen
+        }
         Artifact[] artifacts = mgr.getArtifactResolver().queryArtifacts(new Artifact(groupId,
artifactId, (Version)null, null));
         if(!reply) {
             return;

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=829687&r1=829686&r2=829687&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Mon Oct 26 02:07:04 2009
@@ -189,7 +189,7 @@
             if (data.getName() != null && !data.getName().trim().equals("")) {
                 // Check if realm with the same name already exists
                 Artifact artifact = new Artifact("console.realm", getArtifactId(data.getName()),
"1.0", "car");
-                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(PortletManager.getKernel());
+                ConfigurationManager configurationManager = PortletManager.getConfigurationManager();
                 if (configurationManager.isInstalled(artifact)) {
                     actionResponse.setRenderParameter(MODE_KEY, SELECT_TYPE_MODE);
                     String error = getLocalizedString(actionRequest, "plugin.errorMsg03");
@@ -597,7 +597,7 @@
         ConfigurationManager configMgr = null;
         if(results.length > 0) {
             // Needed only when there are any SecurityRealms
-            configMgr = ConfigurationUtil.getConfigurationManager(kernel);
+            configMgr = PortletManager.getConfigurationManager();
         }
         for (int i = 0; i < results.length; i++) {
             AbstractName abstractName = PortletManager.getNameFor(request, realms[i]);



Mime
View raw message