geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r393787 [14/22] - in /geronimo/trunk/applications: ./ console/ console/console-core/ console/console-core/src/ console/console-core/src/java/ console/console-core/src/java/org/ console/console-core/src/java/org/apache/ console/console-core/...
Date Thu, 13 Apr 2006 11:36:26 GMT
Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,457 @@
+/**
+ *
+ * Copyright 2003-2004 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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.WriteableRepository;
+import org.apache.geronimo.management.J2EEDomain;
+import org.apache.geronimo.management.ResourceAdapter;
+import org.apache.geronimo.management.geronimo.*;
+import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.security.realm.SecurityRealm;
+import org.apache.geronimo.system.logging.SystemLog;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderResponse;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.net.URI;
+import java.net.URL;
+import java.net.URISyntaxException;
+import java.net.MalformedURLException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PortletManager {
+    private final static Log log = LogFactory.getLog(PortletManager.class);
+    // The following are currently static due to having only one server/JVM/etc. per Geronimo
+    private final static String HELPER_KEY = "org.apache.geronimo.console.ManagementHelper";
+    private final static String DOMAIN_KEY = "org.apache.geronimo.console.J2EEDomain";
+    private final static String SERVER_KEY = "org.apache.geronimo.console.J2EEServer";
+    private final static String JVM_KEY = "org.apache.geronimo.console.JVM";
+    private final static String SYSTEM_LOG_KEY = "org.apache.geronimo.console.SystemLog";
+    // The following may change based on the user's selections
+        // nothing yet
+
+    private static ManagementHelper createHelper() {
+        //todo: consider making this configurable; we could easily connect to a remote kernel if we wanted to
+        Kernel kernel = null;
+        try {
+            kernel = (Kernel) new InitialContext().lookup("java:comp/GeronimoKernel");
+        } catch (NamingException e) {
+//            log.error("Unable to look up kernel in JNDI", e);
+        }
+        if(kernel == null) {
+            log.debug("Unable to find kernel in JNDI; using KernelRegistry instead");
+            kernel = KernelRegistry.getSingleKernel();
+        }
+        return new KernelManagementHelper(kernel);
+    }
+
+    public static DeploymentManager getDeploymentManager(PortletRequest request) {
+        DeploymentFactoryImpl factory = new DeploymentFactoryImpl();
+        try {
+            return factory.getDeploymentManager("deployer:geronimo:inVM", null, null);
+        } catch (DeploymentManagerCreationException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static ManagementHelper getManagementHelper(PortletRequest request) {
+        ManagementHelper helper = (ManagementHelper) request.getPortletSession(true).getAttribute(HELPER_KEY, PortletSession.APPLICATION_SCOPE);
+        if(helper == null) {
+            helper = createHelper();
+            request.getPortletSession().setAttribute(HELPER_KEY, helper, PortletSession.APPLICATION_SCOPE);
+        }
+        return helper;
+    }
+
+    public static ManagementHelper getManagementHelper(HttpSession session) {
+        ManagementHelper helper = (ManagementHelper) session.getAttribute(HELPER_KEY);
+        if(helper == null) {
+            helper = createHelper();
+            session.setAttribute(HELPER_KEY, helper);
+        }
+        return helper;
+    }
+
+    public static J2EEDomain getCurrentDomain(PortletRequest request) {
+        J2EEDomain domain = (J2EEDomain) request.getPortletSession(true).getAttribute(DOMAIN_KEY, PortletSession.APPLICATION_SCOPE);
+        if(domain == null) {
+            domain = getManagementHelper(request).getDomains()[0]; //todo: some day, select a domain
+            request.getPortletSession().setAttribute(DOMAIN_KEY, domain, PortletSession.APPLICATION_SCOPE);
+        }
+        return domain;
+
+    }
+
+    public static J2EEServer getCurrentServer(PortletRequest request) {
+        J2EEServer server = (J2EEServer) request.getPortletSession(true).getAttribute(SERVER_KEY, PortletSession.APPLICATION_SCOPE);
+        if(server == null) {
+            ManagementHelper helper = getManagementHelper(request);
+            server = helper.getServers(getCurrentDomain(request))[0]; //todo: some day, select a server from the domain
+            request.getPortletSession().setAttribute(SERVER_KEY, server, PortletSession.APPLICATION_SCOPE);
+        }
+        else {
+            // to do     handle "should not occur" error   - message?
+        }
+        return server;
+    }
+
+    public static JVM getCurrentJVM(PortletRequest request) {
+        JVM jvm = (JVM) request.getPortletSession(true).getAttribute(JVM_KEY, PortletSession.APPLICATION_SCOPE);
+        if(jvm == null) {
+            ManagementHelper helper = getManagementHelper(request);
+            jvm = helper.getJavaVMs(getCurrentServer(request))[0]; //todo: some day, select a JVM from the server
+            request.getPortletSession().setAttribute(JVM_KEY, jvm, PortletSession.APPLICATION_SCOPE);
+        }
+        return jvm;
+    }
+
+    public static Repository[] getRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getRepositories(getCurrentServer(request));
+    }
+
+    public static SecurityRealm[] getSecurityRealms(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getSecurityRealms(getCurrentServer(request));
+    }
+
+    public static ServerInfo getServerInfo(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getServerInfo(getCurrentServer(request));
+    }
+
+    public static void testLoginModule(PortletRequest request, LoginModule module, Map options) {
+        ManagementHelper helper = getManagementHelper(request);
+        helper.testLoginModule(getCurrentServer(request), module, options);
+    }
+
+    public static Subject testLoginModule(PortletRequest request, LoginModule module, Map options, String username, String password) throws LoginException {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.testLoginModule(getCurrentServer(request), module, options, username, password);
+    }
+
+    public static ListableRepository[] getListableRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        Repository[] list = helper.getRepositories(getCurrentServer(request));
+        List result = new ArrayList();
+        for (int i = 0; i < list.length; i++) {
+            Repository repository = list[i];
+            if(repository instanceof ListableRepository) {
+                result.add(repository);
+            }
+        }
+        return (ListableRepository[]) result.toArray(new ListableRepository[result.size()]);
+    }
+
+    public static WriteableRepository[] getWritableRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        Repository[] list = helper.getRepositories(getCurrentServer(request));
+        List result = new ArrayList();
+        for (int i = 0; i < list.length; i++) {
+            Repository repository = list[i];
+            if(repository instanceof WriteableRepository) {
+                result.add(repository);
+            }
+        }
+        return (WriteableRepository[]) result.toArray(new WriteableRepository[result.size()]);
+    }
+
+    public static ResourceAdapterModule[] getOutboundRAModules(PortletRequest request, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundRAModules(getCurrentServer(request), iface);
+    }
+
+    public static ResourceAdapterModule[] getOutboundRAModules(PortletRequest request, String[] iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundRAModules(getCurrentServer(request), iface);
+    }
+
+    public static ResourceAdapterModule[] getAdminObjectModules(PortletRequest request, String[] ifaces) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getAdminObjectModules(getCurrentServer(request), ifaces);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesOfType(PortletRequest request, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories(getCurrentServer(request), iface);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesForRA(PortletRequest request, String resourceAdapterModuleName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories((ResourceAdapterModule)helper.getObject(resourceAdapterModuleName));
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesForRA(PortletRequest request, String resourceAdapterModuleName, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories((ResourceAdapterModule)helper.getObject(resourceAdapterModuleName), iface);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesForRA(PortletRequest request, ResourceAdapterModule module) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories(module);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesForRA(PortletRequest request, ResourceAdapterModule module, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories(module, iface);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactoriesForRA(PortletRequest request, ResourceAdapterModule module, String[] iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories(module, iface);
+    }
+
+    //todo: Create an interface for admin objects
+    public static JCAAdminObject[] getAdminObjectsForRA(PortletRequest request, ResourceAdapterModule module, String[] ifaces) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getAdminObjects(module, ifaces);
+    }
+
+    public static String[] getWebManagerNames(PortletRequest request) {
+        return getCurrentServer(request).getWebManagers();
+    }
+
+    public static WebManager[] getWebManagers(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getWebManagers(getCurrentServer(request));
+    }
+
+    public static WebManager getWebManager(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (WebManager) helper.getObject(managerObjectName);
+    }
+
+    public static String[] getWebContainerNames(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return manager.getContainers();
+    }
+
+    public static WebAccessLog getWebAccessLog(PortletRequest request, String managerObjectName, String containerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return helper.getWebAccessLog(manager, containerObjectName);
+    }
+
+    public static WebContainer getWebContainer(PortletRequest request, String containerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (WebContainer) helper.getObject(containerObjectName);
+    }
+
+    public static WebConnector createWebConnector(PortletRequest request, String managerObjectName, String containerObjectName, String name, String protocol, String host, int port) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        String objectName = manager.addConnector(containerObjectName, name, protocol, host, port);
+        return objectName == null ? null : (WebConnector)helper.getObject(objectName);
+    }
+
+    public static WebConnector[] getWebConnectors(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return helper.getWebConnectors(manager);
+    }
+
+    public static WebConnector[] getWebConnectors(PortletRequest request, String managerObjectName, String protocol) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return helper.getWebConnectors(manager, protocol);
+    }
+
+    public static WebConnector[] getWebConnectorsForContainer(PortletRequest request, String managerObjectName, String containerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return helper.getWebConnectorsForContainer(manager, containerObjectName);
+    }
+
+    public static WebConnector[] getWebConnectorsForContainer(PortletRequest request, String managerObjectName, String containerObjectName, String protocol) {
+        ManagementHelper helper = getManagementHelper(request);
+        WebManager manager = (WebManager) helper.getObject(managerObjectName);
+        return helper.getWebConnectorsForContainer(manager, containerObjectName, protocol);
+    }
+
+    public static EJBManager[] getEJBManagers(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getEJBManagers(getCurrentServer(request));
+    }
+
+    public static EJBManager getEJBManager(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (EJBManager) helper.getObject(managerObjectName);
+    }
+
+    public static String[] getJMSManagerNames(PortletRequest request) {
+        return getCurrentServer(request).getJMSManagers();
+    }
+
+    public static JMSManager getJMSManager(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (JMSManager) helper.getObject(managerObjectName);
+    }
+
+    public static String[] getJMSBrokerNames(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        return manager.getContainers();
+    }
+
+    public static JMSBroker getJMSBroker(PortletRequest request, String brokerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (JMSBroker) helper.getObject(brokerObjectName);
+    }
+
+    public static JMSConnector createJMSConnector(PortletRequest request, String managerObjectName, String containerObjectName, String name, String protocol, String host, int port) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        String objectName = manager.addConnector(containerObjectName, name, protocol, host, port);
+        return (JMSConnector)helper.getObject(objectName);
+    }
+
+    public static JMSConnector[] getJMSConnectors(PortletRequest request, String managerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        return helper.getJMSConnectors(manager);
+    }
+
+    public static JMSConnector[] getJMSConnectors(PortletRequest request, String managerObjectName, String protocol) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        return helper.getJMSConnectors(manager, protocol);
+    }
+
+    public static JMSConnector[] getJMSConnectorsForContainer(PortletRequest request, String managerObjectName, String brokerObjectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        return helper.getJMSConnectorsForContainer(manager, brokerObjectName);
+    }
+
+    public static JMSConnector[] getJMSConnectorsForContainer(PortletRequest request, String managerObjectName, String brokerObjectName, String protocol) {
+        ManagementHelper helper = getManagementHelper(request);
+        JMSManager manager = (JMSManager) helper.getObject(managerObjectName);
+        return helper.getJMSConnectorsForContainer(manager, brokerObjectName, protocol);
+    }
+
+    public static ResourceAdapter[] getResourceAdapters(PortletRequest request, ResourceAdapterModule module) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getResourceAdapters(module);
+    }
+
+    public static JCAResource[] getJCAResources(PortletRequest request, ResourceAdapter adapter) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getRAResources(adapter);
+    }
+
+    public static GeronimoExecutor[] getThreadPools(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getThreadPools(getCurrentServer(request));
+    }
+
+    public static String getGBeanDescription(PortletRequest request, String objectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getGBeanDescription(objectName);
+    }
+
+    public static SystemLog getCurrentSystemLog(PortletRequest request) {
+        SystemLog log = (SystemLog) request.getPortletSession(true).getAttribute(SYSTEM_LOG_KEY, PortletSession.APPLICATION_SCOPE);
+        if(log == null) {
+            ManagementHelper helper = getManagementHelper(request);
+            log = helper.getSystemLog(getCurrentJVM(request));
+            request.getPortletSession().setAttribute(SYSTEM_LOG_KEY, log, PortletSession.APPLICATION_SCOPE);
+        }
+        return log;
+    }
+
+    public static GeronimoManagedBean[] getManagedBeans(PortletRequest request, Class intrface) {
+        ManagementHelper helper = getManagementHelper(request);
+        Object[] obs = helper.findByInterface(intrface);
+        GeronimoManagedBean[] results = new GeronimoManagedBean[obs.length];
+        for (int i = 0; i < results.length; i++) {
+            results[i] = (GeronimoManagedBean) obs[i];
+        }
+        return results;
+    }
+
+    public static GeronimoManagedBean getManagedBean(PortletRequest request, String name) {
+        ManagementHelper helper = getManagementHelper(request);
+        return (GeronimoManagedBean) helper.getObject(name);
+    }
+
+    public static URI getConfigurationFor(PortletRequest request, String objectName) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getConfigurationNameFor(objectName);
+    }
+
+    public static URL getRepositoryEntry(PortletRequest request, String repositoryURI) {
+        try {
+            Repository[] repos = getRepositories(request);
+            URI uri = new URI(repositoryURI);
+            for (int i = 0; i < repos.length; i++) {
+                Repository repo = repos[i];
+                if(repo.hasURI(uri)) {
+                    return repo.getURL(uri);
+                }
+            }
+        } catch (URISyntaxException e) {
+            log.error("Unable to access repository entry '"+repositoryURI+"'", e);
+        } catch (MalformedURLException e) {
+            log.error("Unable to access repository entry '"+repositoryURI+"'", e);
+        }
+        return null;
+    }
+
+    /**
+     * Looks up the context prefix used by the portal, even if the thing running
+     * is in one of the portlets.  We're kind of hacking our way there, but hey,
+     * it beats hardcoding.
+     */
+    public static String getConsoleFrameworkServletPath (HttpServletRequest request) {
+        String contextPath = "";
+        Object o = request.getAttribute("javax.portlet.response");
+        if (o!=null && o instanceof RenderResponse) { // request came from a portlet
+            RenderResponse renderResponse = (RenderResponse)o;
+            contextPath = renderResponse.createRenderURL().toString();
+            int index = contextPath.indexOf(request.getPathInfo());
+            contextPath = contextPath.substring(0,index);
+        } else { // request did not come from a portlet
+            contextPath = request.getContextPath();
+        }
+        return contextPath;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,21 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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;
+
+public abstract class RealmHelper extends KernelHelper {
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,127 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+
+public class SERealmGroupHelper extends RealmHelper {
+
+    private static final String GET_GROUPS_FUNCTION = "getGroups";
+
+    private static final String ADD_GROUP_FUNCTION = "addGroupPrincipal";
+
+    private static final String GROUP_EXISTS_FUNCTION = "groupExists";
+
+    private static final String UPDATE_GROUP_FUNCTION = "updateGroupPrincipal";
+
+    private static final String DELETE_GROUP_FUNCTION = "removeGroupPrincipal";
+
+    private static final String GET_USERS_FUNCTION = "getGroupMembers";
+
+    private static final String[] STRING = { "java.lang.String" };
+
+    private static final String[] HASHTABLE = { "java.util.Hashtable" };
+
+    private static final Kernel kernel = KernelRegistry.getSingleKernel();
+
+    public static String[] getGroups() throws Exception {
+        String[] groups = (String[]) invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, GET_GROUPS_FUNCTION);
+        return groups;
+    }
+
+    private static void refresh() {
+        try {
+
+            kernel.stopGBean(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+            kernel.startGBean(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+//            kernel.stopGBean(ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME);
+//            kernel.startGBean(ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME);
+
+        } catch (Exception e) {
+        }
+    }
+
+    public static void addGroup(String groupName, String[] userList)
+            throws Exception {
+        addGroup(groupName, StringUtils.convertToCommaDelimited(userList));
+        refresh();
+    }
+
+    public static void updateGroup(String groupName, String[] userList)
+            throws Exception {
+        updateGroup(groupName, StringUtils.convertToCommaDelimited(userList));
+        refresh();
+    }
+
+    public static boolean groupExists(String username) throws Exception {
+        Boolean ret;
+        String[] arg = {username};
+        ret = (Boolean) invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, GROUP_EXISTS_FUNCTION, arg, STRING);
+        return ret.booleanValue();
+    }
+
+    public static void addGroup(String groupName, String userList)
+            throws Exception {
+
+        Hashtable props = new Hashtable();
+        props.put("GroupName", groupName);
+        props.put("Members", userList);
+        Object[] args = {props};
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, ADD_GROUP_FUNCTION, args, HASHTABLE);
+    }
+
+    public static void updateGroup(String groupName, String userList)
+            throws Exception {
+        Hashtable props = new Hashtable();
+        props.put("GroupName", groupName);
+        props.put("Members", userList);
+        Object[] args = {props};
+
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, UPDATE_GROUP_FUNCTION, args, HASHTABLE);
+    }
+
+    public static void deleteGroup(String groupName) throws Exception {
+        String[] args = {groupName};
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, DELETE_GROUP_FUNCTION, args, STRING);
+        refresh();
+    }
+
+    public static Set getUsers(String groupName) throws Exception {
+        Set ret = null;
+        String[] arg = {groupName};
+        ret = (Set) invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, GET_USERS_FUNCTION, arg, STRING);
+        return ret;
+    }
+
+    public static boolean isGroupMember(String groupName, String username)
+            throws Exception {
+        Collection users = getUsersAsCollection(groupName);
+        return (users.contains(username));
+    }
+
+    private static Collection getUsersAsCollection(String groupName)
+            throws Exception {
+        return getUsers(groupName);
+    }
+
+}
\ No newline at end of file

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.util.Hashtable;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+
+public class SERealmUserHelper extends RealmHelper {
+
+    private static final String GET_USERS_FUNCTION = "getUsers";
+
+    private static final String ADD_USER_FUNCTION = "addUserPrincipal";
+
+    private static final String USER_EXISTS_FUNCTION = "userExists";
+
+    private static final String UPDATE_USER_FUNCTION = "updateUserPrincipal";
+
+    private static final String DELETE_USER_FUNCTION = "removeUserPrincipal";
+
+    private static final String GET_PASSWORD_FUNCTION = "getPassword";
+
+    private static final String[] STRING = { "java.lang.String" };
+
+    private static final String[] HASHTABLE = { "java.util.Hashtable" };
+
+    private static final Kernel kernel = KernelRegistry.getSingleKernel();
+
+    public static String[] getUsers() throws Exception {
+        return (String[]) invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, GET_USERS_FUNCTION);
+    }
+
+    private static void refresh() {
+        try {
+
+            kernel.stopGBean(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+            kernel.startGBean(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+//            kernel.stopGBean(ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME);
+//            kernel.startGBean(ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME);
+
+        } catch (Exception e) {
+        }
+    }
+
+    public static String getPassword(String username) throws Exception {
+        Object ret;
+        String[] arg = {username};
+        ret = invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, GET_PASSWORD_FUNCTION, arg, STRING);
+        return (ret != null) ? ret.toString() : "";
+    }
+
+    public static boolean userExists(String username) throws Exception {
+        Boolean ret;
+        String[] arg = {username};
+        ret = (Boolean) invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, USER_EXISTS_FUNCTION, arg, STRING);
+        return ret.booleanValue();
+    }
+
+    public static void addUser(String username, String password)
+            throws Exception {
+        Hashtable props = new Hashtable();
+        props.put("UserName", username);
+        props.put("Password", password);
+        Object[] args = {props};
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, ADD_USER_FUNCTION, args, HASHTABLE);
+        refresh();
+    }
+
+    public static void updateUser(String username, String password)
+            throws Exception {
+        Hashtable props = new Hashtable();
+        props.put("UserName", username);
+        props.put("Password", password);
+        Object[] args = {props};
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, UPDATE_USER_FUNCTION, args, HASHTABLE);
+        refresh();
+    }
+
+    public static void deleteUser(String username) throws Exception {
+        String[] args = {username};
+        invoke(ObjectNameConstants.SE_REALM_MBEAN_NAME, DELETE_USER_FUNCTION, args, STRING);
+        refresh();
+    }
+
+
+}
\ No newline at end of file

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,32 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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;
+
+public interface SecurityConstants {
+
+    //public static final String SE_REALM_MBEAN_NAME =
+    // "gluecode-se.security:realm=gluecode-se-properties-realm-mutable,type=SecurityRealm";
+    //public static final String DERBY_REALM_MBEAN_NAME =
+    // "gluecode-se.security:realm=gluecode-se-application-realm-mutable,type=SecurityRealm";
+    //public static final String FILE_LOGGER_MBEAN_NAME =
+    // "gluecode-se.system:role=LogAppender,type=DailyRollingFileAppender";
+    //public static final String SECURITY_REALM =
+    // "gluecode-se.security:type=SecurityRealm,*";
+    public static final String SECURITY_CONFIG_PREFIX = "runtimerealm/";
+
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,106 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.util.Map;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class SecurityRealmBean {
+
+    private ObjectName realmObjectName, configEntryObjName;
+
+    private String configID, realmName, applicationConfigName;
+
+    private boolean running;
+
+    private Map attributes;
+
+    public SecurityRealmBean(ObjectName realmObjectName,
+            ObjectName configEntryObjName, String configID,
+            String applicationConfigName, String realmName, boolean started,
+            Map attributes) {
+        this.realmObjectName = realmObjectName;
+        this.configEntryObjName = configEntryObjName;
+        this.configID = configID;
+        this.applicationConfigName = applicationConfigName;
+        this.realmName = realmName;
+        this.running = started;
+        this.attributes = attributes;
+    }
+
+    public SecurityRealmBean(String realmObjectName, String configEntryObjName,
+            String configID, String applicationConfigName, String realmName,
+            boolean started, Map attributes) {
+        this(JMXUtil.getObjectName(realmObjectName), JMXUtil
+                .getObjectName(configEntryObjName), configID,
+                applicationConfigName, realmName, started, attributes);
+    }
+
+    /**
+     * @return Returns the configEntryObjName.
+     */
+    public ObjectName getConfigEntryObjName() {
+        return configEntryObjName;
+    }
+
+    /**
+     * @return Returns the applicationConfigName.
+     */
+    public String getApplicationConfigName() {
+        return applicationConfigName;
+    }
+
+    /**
+     * @return Returns the attributes.
+     */
+    public Map getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * @return Returns the configID.
+     */
+    public String getConfigID() {
+        return configID;
+    }
+
+    /**
+     * @return Returns the realmName.
+     */
+    public String getRealmName() {
+        return realmName;
+    }
+
+    /**
+     * @return Returns the realmObjectName.
+     */
+    public ObjectName getRealmObjectName() {
+        return realmObjectName;
+    }
+
+    /**
+     * @return Returns the running.
+     */
+    public boolean isRunning() {
+        return running;
+    }
+
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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;
+
+public abstract class StringUtils {
+
+    public static String convertToCommaDelimited(String[] list) {
+        StringBuffer ret = new StringBuffer("");
+        for (int i = 0; list != null && i < list.length; i++) {
+            ret.append(list[i]);
+            if (i < list.length - 1) {
+                ret.append(',');
+            }
+        }
+        return ret.toString();
+    }
+
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,86 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.webmanager;
+
+import java.io.Serializable;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.kernel.management.State;
+
+public class ConnectorInfo implements Serializable {
+    private String description;
+    private String displayName;
+    private String objectName;
+    private String protocol;
+    private int port;
+    private int state;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public int getState() {
+        return state;
+    }
+
+    public void setState(int state) {
+        this.state = state;
+    }
+
+    public String getStateName() {
+        return State.toString(state);
+    }
+
+}
\ No newline at end of file

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,524 @@
+/**
+ *
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.webmanager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.management.geronimo.SecureConnector;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A portlet that lets you list, add, remove, start, stop, and edit web
+ * connectors (currently, either Tomcat or Jetty).
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectorPortlet extends BasePortlet {
+    private final static Log log = LogFactory.getLog(ConnectorPortlet.class);
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher maximizedView;
+
+    private PortletRequestDispatcher helpView;
+
+    protected PortletRequestDispatcher editHttpView;
+    protected PortletRequestDispatcher editHttpsView;
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        String mode = actionRequest.getParameter("mode");
+        String managerName = actionRequest.getParameter("managerObjectName");
+        String containerName = actionRequest.getParameter("containerObjectName");
+        if(managerName != null) actionResponse.setRenderParameter("managerObjectName", managerName);
+        if(containerName != null) actionResponse.setRenderParameter("containerObjectName", containerName);
+
+        String server = null;
+        if(containerName != null) {
+            WebContainer container = PortletManager.getWebContainer(actionRequest, containerName);
+            server = getWebServerType(container.getClass());
+        } else {
+            server = "unknown";
+        }
+        actionResponse.setRenderParameter("server", server);
+        if(mode.equals("new")) {
+            // User selected to add a new connector, need to show criteria portlet
+            actionResponse.setRenderParameter("mode", "new");
+            String protocol = actionRequest.getParameter("protocol");
+            String containerDisplayName = actionRequest.getParameter("containerDisplayName");
+            actionResponse.setRenderParameter("protocol", protocol);
+            actionResponse.setRenderParameter("containerDisplayName", containerDisplayName);
+        } else if(mode.equals("add")) { // User just submitted the form to add a new connector
+            // Get submitted values
+            //todo: lots of validation
+            String protocol = actionRequest.getParameter("protocol");
+            String host = actionRequest.getParameter("host");
+            int port = Integer.parseInt(actionRequest.getParameter("port"));
+            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
+            Integer minThreads = getInteger(actionRequest, "minThreads");
+            String name = actionRequest.getParameter("name");
+            // Create and configure the connector
+            WebConnector connector = PortletManager.createWebConnector(actionRequest, managerName, containerName, name, protocol, host, port);
+            connector.setMaxThreads(maxThreads);
+            // todo: more configurable HTTP/Jetty values
+            if(server.equals(WEB_SERVER_JETTY)) {
+                if(minThreads != null) {
+                    setProperty(connector, "minThreads", minThreads);
+                }
+            }
+            else if (server.equals(WEB_SERVER_TOMCAT)) {
+                //todo:   Any Tomcat specific processing?
+            }
+            else {
+                //todo:   Handle "should not occur" condition
+            }
+            if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
+                String keystoreType = actionRequest.getParameter("keystoreType");
+                String keystoreFile = actionRequest.getParameter("keystoreFile");
+                String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
+                String keystorePass = actionRequest.getParameter("keystorePassword");
+                String secureProtocol = actionRequest.getParameter("secureProtocol");
+                String algorithm = actionRequest.getParameter("algorithm");
+                String truststoreType = actionRequest.getParameter("truststoreType");
+                String truststoreFile = actionRequest.getParameter("truststoreFile");
+                String truststorePass = actionRequest.getParameter("truststorePassword");
+                boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
+                SecureConnector secure = (SecureConnector) connector;
+                if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
+                if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
+                if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
+                if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
+                if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
+                secure.setClientAuthRequired(clientAuth);
+                if(server.equals(WEB_SERVER_JETTY)) {
+                    if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
+                }
+                else if (server.equals(WEB_SERVER_TOMCAT)) {
+                    if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
+                    if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
+                    if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
+                }
+                else {
+                    //todo:   Handle "should not occur" condition
+                }
+            }
+            // Start the connector
+            try {
+                ((GeronimoManagedBean)connector).startRecursive();
+            } catch (Exception e) {
+                log.error("Unable to start connector", e); //todo: get into rendered page somehow?
+            }
+            actionResponse.setRenderParameter("mode", "list");
+        } else if(mode.equals("save")) { // User just submitted the form to update a connector
+            // Get submitted values
+            //todo: lots of validation
+            String host = actionRequest.getParameter("host");
+            int port = Integer.parseInt(actionRequest.getParameter("port"));
+            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
+            Integer minThreads = getInteger(actionRequest, "minThreads");
+            String objectName = actionRequest.getParameter("objectName");
+            // Identify and update the connector
+            WebConnector connector = null;
+            WebConnector all[] = PortletManager.getWebConnectors(actionRequest, managerName);
+            for (int i = 0; i < all.length; i++) {
+                WebConnector conn = all[i];
+                if(((GeronimoManagedBean)conn).getObjectName().equals(objectName)) {
+                    connector = conn;
+                    break;
+                }
+            }
+            if(connector != null) {
+                connector.setHost(host);
+                connector.setPort(port);
+                connector.setMaxThreads(maxThreads);
+                if(server.equals(WEB_SERVER_JETTY)) {
+                    if(minThreads != null) {
+                        setProperty(connector,"minThreads",minThreads);
+                    }
+                    else if (server.equals(WEB_SERVER_TOMCAT)) {
+                        //todo:   Any Tomcat specific processing?
+                    }
+                    else {
+                        //todo:   Handle "should not occur" condition
+                    }
+                }
+                if(connector instanceof SecureConnector) {
+                    String keystoreType = actionRequest.getParameter("keystoreType");
+                    String keystoreFile = actionRequest.getParameter("keystoreFile");
+                    String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
+                    String keystorePass = actionRequest.getParameter("keystorePassword");
+                    String secureProtocol = actionRequest.getParameter("secureProtocol");
+                    String algorithm = actionRequest.getParameter("algorithm");
+                    String truststoreType = actionRequest.getParameter("truststoreType");
+                    String truststoreFile = actionRequest.getParameter("truststoreFile");
+                    String truststorePass = actionRequest.getParameter("truststorePassword");
+                    boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
+                    SecureConnector secure = (SecureConnector) connector;
+                    if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
+                    if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
+                    if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
+                    if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
+                    if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
+                    secure.setClientAuthRequired(clientAuth);
+                    if(server.equals(WEB_SERVER_JETTY)) {
+                        if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
+                    }
+                    else if (server.equals(WEB_SERVER_TOMCAT)) {
+                        if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
+                        if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
+                        if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
+                    }
+                    else {
+                        //todo:   Handle "should not occur" condition
+                    }
+                }
+            }
+            actionResponse.setRenderParameter("mode", "list");
+        } else if(mode.equals("start")) {
+            String objectName = actionRequest.getParameter("name");
+            // work with the current connector to start it.
+            WebConnector connector = null;
+            WebConnector all[] = PortletManager.getWebConnectors(actionRequest, managerName);
+            for (int i = 0; i < all.length; i++) {
+                WebConnector conn = all[i];
+                if(((GeronimoManagedBean)conn).getObjectName().equals(objectName)) {
+                    connector = conn;
+                    break;
+                }
+            }
+            if(connector != null) {
+                try {
+                    ((GeronimoManagedBean)connector).startRecursive();
+                } catch (Exception e) {
+                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
+                }
+            }
+            else {
+                log.error("Incorrect connector reference"); //Replace this with correct error processing
+            }
+            actionResponse.setRenderParameter("name", objectName);
+            actionResponse.setRenderParameter("mode", "list");
+        } else if(mode.equals("stop")) {
+            String objectName = actionRequest.getParameter("name");
+            // work with the current connector to stop it.
+            WebConnector connector = null;
+            WebConnector all[] = PortletManager.getWebConnectors(actionRequest, managerName);
+            for (int i = 0; i < all.length; i++) {
+                WebConnector conn = all[i];
+                if(((GeronimoManagedBean)conn).getObjectName().equals(objectName)) {
+                    connector = conn;
+                    break;
+                }
+            }
+            if(connector != null) {
+                try {
+                    ((GeronimoManagedBean)connector).stop();
+                } catch (Exception e) {
+                    log.error("Unable to stop connector", e); //todo: get into rendered page somehow?
+                }
+            }
+            else {
+                log.error("Incorrect connector reference"); //Replace this with correct error processing
+            }
+            actionResponse.setRenderParameter("name", objectName);
+            actionResponse.setRenderParameter("mode", "list");
+        } else if(mode.equals("edit")) {
+            String objectName = actionRequest.getParameter("name");
+            actionResponse.setRenderParameter("objectName", objectName);
+            actionResponse.setRenderParameter("mode", "edit");
+
+        } else if(mode.equals("delete")) { // User chose to delete a connector
+            String objectName = actionRequest.getParameter("name");
+            PortletManager.getWebManager(actionRequest, managerName).removeConnector(objectName);
+            actionResponse.setRenderParameter("mode", "list");
+        }
+    }
+
+    private Integer getInteger(ActionRequest actionRequest, String key) {
+        String value = actionRequest.getParameter(key);
+        if(value == null || value.equals("")) {
+            return null;
+        }
+        return new Integer(value);
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+        String mode = renderRequest.getParameter("mode");
+        if(mode == null || mode.equals("")) {
+            mode = "list";
+        }
+
+
+        if(mode.equals("list")) {
+            doList(renderRequest, renderResponse);
+        } else {
+            String managerName = renderRequest.getParameter("managerObjectName");
+            String containerName = renderRequest.getParameter("containerObjectName");
+            if(managerName != null) renderRequest.setAttribute("managerObjectName", managerName);
+            if(containerName != null) renderRequest.setAttribute("containerObjectName", containerName);
+
+            WebContainer container = PortletManager.getWebContainer(renderRequest, containerName);
+            String server = getWebServerType(container.getClass());
+            renderRequest.setAttribute("server", server);
+
+            if(mode.equals("new")) {
+                String protocol = renderRequest.getParameter("protocol");
+                String containerDisplayName = renderRequest.getParameter("containerDisplayName");
+                renderRequest.setAttribute("maxThreads", "50");
+                if(server.equals(WEB_SERVER_JETTY)) {
+                    renderRequest.setAttribute("minThreads", "10");
+                }
+                else if (server.equals(WEB_SERVER_TOMCAT)) {
+                    //todo:   Any Tomcat specific processing?
+                }
+                else {
+                    //todo:   Handle "should not occur" condition
+                }
+                renderRequest.setAttribute("protocol", protocol);
+                renderRequest.setAttribute("mode", "add");
+                renderRequest.setAttribute("containerDisplayName", containerDisplayName);
+                if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
+                    editHttpsView.include(renderRequest, renderResponse);
+                } else {
+                    editHttpView.include(renderRequest, renderResponse);
+                }
+
+            } else if(mode.equals("edit")) {
+                String objectName = renderRequest.getParameter("objectName");
+                WebConnector connector = null;
+                WebConnector all[] = PortletManager.getWebConnectors(renderRequest, managerName);
+                for (int i = 0; i < all.length; i++) {
+                    WebConnector conn = all[i];
+                    if(((GeronimoManagedBean)conn).getObjectName().equals(objectName)) {
+                        connector = conn;
+                        break;
+                    }
+                }
+                if(connector == null) {
+                    doList(renderRequest, renderResponse);
+                } else {
+                    String displayName = PortletManager.getGBeanDescription(renderRequest, objectName);
+                    try {
+                        ObjectName realName = ObjectName.getInstance(objectName);
+                        displayName = realName.getKeyProperty("name");
+                    } catch (MalformedObjectNameException e) {
+                        log.error("Bad object name for web connector", e);
+                    }
+                    renderRequest.setAttribute("name", displayName);
+                    renderRequest.setAttribute("objectName", objectName);
+                    renderRequest.setAttribute("port", new Integer(connector.getPort()));
+                    renderRequest.setAttribute("host", connector.getHost());
+                    int maxThreads = connector.getMaxThreads();
+                    renderRequest.setAttribute("maxThreads", Integer.toString(maxThreads));
+                    if(server.equals(WEB_SERVER_JETTY)) {
+                        int minThreads = ((Number)getProperty(connector, "minThreads")).intValue();
+                        renderRequest.setAttribute("minThreads", String.valueOf(minThreads));
+                    }
+                    else if (server.equals(WEB_SERVER_TOMCAT)) {
+                        //todo:   Any Tomcat specific processing?
+                    }
+                    else {
+                        //todo:   Handle "should not occur" condition
+                    }
+                    renderRequest.setAttribute("mode", "save");
+
+                    if(connector instanceof SecureConnector) {
+                        SecureConnector secure = (SecureConnector) connector;
+                        renderRequest.setAttribute("keystoreFile",secure.getKeystoreFileName());
+                        renderRequest.setAttribute("keystoreType",secure.getKeystoreType());
+                        renderRequest.setAttribute("algorithm",secure.getAlgorithm());
+                        renderRequest.setAttribute("secureProtocol",secure.getSecureProtocol());
+                        if(secure.isClientAuthRequired()) {
+                            renderRequest.setAttribute("clientAuth", Boolean.TRUE);
+                        }
+                        if(server.equals(WEB_SERVER_TOMCAT)) {
+                            String truststoreFile = (String)getProperty(secure, "truststoreFileName");
+                            String truststoreType = (String)getProperty(secure, "truststoreType");
+                            renderRequest.setAttribute("truststoreFile", truststoreFile);
+                            renderRequest.setAttribute("truststoreType", truststoreType);
+                        }
+                    }
+
+                    if(connector.getProtocol().equals(WebManager.PROTOCOL_HTTPS)) {
+                        editHttpsView.include(renderRequest, renderResponse);
+                    } else {
+                        editHttpView.include(renderRequest, renderResponse);
+                    }
+                }
+            }
+        }
+
+    }
+
+    private void doList(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
+        WebManager[] managers = PortletManager.getWebManagers(renderRequest);
+        List all = new ArrayList();
+        for (int i = 0; i < managers.length; i++) {
+            WebManager manager = managers[i];
+            String webManagerName = ((GeronimoManagedBean)manager).getObjectName();
+
+            String[] containers = PortletManager.getWebContainerNames(renderRequest, webManagerName);
+            for (int j = 0; j < containers.length; j++) {
+                try {
+                    List beans = new ArrayList();
+                    String containerName = containers[j];
+                    String id;
+                    if(containers.length == 1) {
+                        id = manager.getProductName();
+                    } else {
+                        ObjectName containerON = ObjectName.getInstance(containerName);
+                        id = manager.getProductName() + " (" + containerON.getKeyProperty(NameFactory.J2EE_NAME) + ")";
+                    }
+                    ContainerStatus result = new ContainerStatus(id, webManagerName, containerName);
+
+                    WebConnector[] connectors = PortletManager.getWebConnectorsForContainer(renderRequest, webManagerName, containerName);
+                    for (int k = 0; k < connectors.length; k++) {
+                        WebConnector connector = connectors[k];
+                        ConnectorInfo info = new ConnectorInfo();
+                            String objectName = ((GeronimoManagedBean)connector).getObjectName();
+                            info.setObjectName(objectName);
+                            info.setDescription(PortletManager.getGBeanDescription(renderRequest, objectName));
+                            try {
+                                ObjectName realName = ObjectName.getInstance(objectName);
+                                info.setDisplayName(realName.getKeyProperty("name"));
+                            } catch (MalformedObjectNameException e) {
+                                log.error("Bad object name for web connector", e);
+                                info.setDisplayName(info.getDescription());
+                            }
+                            info.setState(((GeronimoManagedBean)connector).getState());
+                            info.setPort(connector.getPort());
+                        try {
+                            info.setProtocol(connector.getProtocol());
+                        } catch (IllegalStateException e) {
+                            info.setProtocol("unknown");
+                        }
+                        beans.add(info);
+                    }
+                    result.setConnectors(beans);
+                    result.setProtocols(manager.getSupportedProtocols());
+                    all.add(result);
+                } catch (MalformedObjectNameException e) {
+                    log.error("Unable to parse ObjectName", e);
+                }
+            }
+        }
+        renderRequest.setAttribute("containers", all);
+
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+
+    public final static class ContainerStatus {
+        private String name;
+        private String managerObjectName;
+        private String containerObjectName;
+        private String[] protocols;
+        private List connectors;
+
+        public ContainerStatus(String name, String managerObjectName, String containerObjectName) {
+            this.name = name;
+            this.managerObjectName = managerObjectName;
+            this.containerObjectName = containerObjectName;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String[] getProtocols() {
+            return protocols;
+        }
+
+        public void setProtocols(String[] protocols) {
+            this.protocols = protocols;
+        }
+
+        public List getConnectors() {
+            return connectors;
+        }
+
+        public void setConnectors(List connectors) {
+            this.connectors = connectors;
+        }
+
+        public String getManagerObjectName() {
+            return managerObjectName;
+        }
+
+        public String getContainerObjectName() {
+            return containerObjectName;
+        }
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        PortletContext pc = portletConfig.getPortletContext();
+        normalView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/normal.jsp");
+        maximizedView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/maximized.jsp");
+        helpView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/help.jsp");
+        editHttpView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/editHTTP.jsp");
+        editHttpsView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/editHTTPS.jsp");
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        helpView = null;
+        editHttpsView = null;
+        editHttpView = null;
+        super.destroy();
+    }
+
+    public final static boolean isValid(String s) {
+        return s != null && !s.equals("");
+    }
+
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,32 @@
+package org.apache.geronimo.console.webmanager;
+
+import javax.portlet.RenderRequest;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.jetty.JettyContainer;
+
+/**
+ * @version $Revision: 1.0$
+ */
+public class JettyStatisticsHelper implements StatisticsHelper {
+    public void gatherStatistics(WebContainer container, RenderRequest renderRequest) {
+        JettyContainer jetty = ((JettyContainer)container);
+        boolean statsOn = jetty.getCollectStatistics();
+        renderRequest.setAttribute("statsOn", statsOn ? Boolean.TRUE : Boolean.FALSE);
+        if (statsOn) {
+            renderRequest.setAttribute("connections", new Integer(jetty.getConnections()));
+            renderRequest.setAttribute("connectionsOpen", new Integer(jetty.getConnectionsOpen()));
+            renderRequest.setAttribute("connectionsOpenMax", new Integer(jetty.getConnectionsOpenMax()));
+            renderRequest.setAttribute("connectionsDurationAve", new Long(jetty.getConnectionsDurationAve()));
+            renderRequest.setAttribute("connectionsDurationMax", new Long(jetty.getConnectionsDurationMax()));
+            renderRequest.setAttribute("connectionsRequestsAve", new Integer(jetty.getConnectionsRequestsAve()));
+            renderRequest.setAttribute("connectionsRequestsMax", new Integer(jetty.getConnectionsRequestsMax()));
+            renderRequest.setAttribute("errors", new Integer(jetty.getErrors()));
+            renderRequest.setAttribute("requests", new Integer(jetty.getRequests()));
+            renderRequest.setAttribute("requestsActive", new Integer(jetty.getRequestsActive()));
+            renderRequest.setAttribute("requestsActiveMax", new Integer(jetty.getRequestsActiveMax()));
+            renderRequest.setAttribute("requestsDurationAve", new Long(jetty.getRequestsDurationAve()));
+            renderRequest.setAttribute("requestsDurationMax", new Long(jetty.getRequestsDurationMax()));
+        }
+    }
+
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/JettyStatisticsHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,11 @@
+package org.apache.geronimo.console.webmanager;
+
+import javax.portlet.RenderRequest;
+import org.apache.geronimo.management.geronimo.WebContainer;
+
+/**
+ * @version $Revision: 1.0$
+ */
+public interface StatisticsHelper {
+    public void gatherStatistics(WebContainer container, RenderRequest renderRequest);
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/webmanager/StatisticsHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message