geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r219976 [8/12] - in /geronimo/trunk: ./ etc/ sandbox/console-core/ sandbox/console-core/src/ sandbox/console-core/src/java/ sandbox/console-core/src/java/org/ sandbox/console-core/src/java/org/apache/ sandbox/console-core/src/java/org/apach...
Date Thu, 21 Jul 2005 01:38:23 GMT
Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,144 @@
+/**
+ *
+ * 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.securitymanager;
+
+import java.io.IOException;
+import java.util.Hashtable;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.console.util.SERealmGroupHelper;
+import org.apache.geronimo.console.util.SERealmUserHelper;
+
+public class SEGroupsPortlet extends AbstractSecurityManagerPortlet {
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        String errorMessage = renderRequest.getParameter("errorMessage");
+
+        if (errorMessage != null) {
+            renderRequest.setAttribute("errorMessage", errorMessage);
+            errorView.include(renderRequest, renderResponse);
+        } else {
+            String currAction = renderRequest.getParameter("currAction");
+            String message = renderRequest.getParameter("message");
+            renderRequest.setAttribute("message", message);
+
+            try {
+                if ("new".equals(currAction)) {
+                    renderRequest.setAttribute("users", SERealmUserHelper
+                            .getUsers());
+                    addMaximizedView.include(renderRequest, renderResponse);
+                } else if ("edit".equals(currAction)) {
+                    String group = renderRequest.getParameter("group");
+                    renderRequest.setAttribute("group", group);
+                    renderRequest.setAttribute("users", SERealmUserHelper
+                            .getUsers());
+                    addMaximizedView.include(renderRequest, renderResponse);
+                } else {
+                    String[] groups = SERealmGroupHelper.getGroups();
+                    Hashtable groupsInfo = new Hashtable();
+                    for (int i = 0; i < groups.length; i++) {
+                        String currentGroup = groups[i];
+                        groupsInfo.put(currentGroup, SERealmGroupHelper
+                                .getUsers(currentGroup));
+                    }
+                    renderRequest.setAttribute("groupsInfo", groupsInfo);
+
+                    if (WindowState.NORMAL.equals(renderRequest
+                            .getWindowState())) {
+                        normalView.include(renderRequest, renderResponse);
+                    } else {
+                        maximizedView.include(renderRequest, renderResponse);
+                    }
+                }
+            } catch (Exception e) {
+                errorMessage = e.getMessage();
+                renderRequest.setAttribute("errorMessage", errorMessage);
+                errorView.include(renderRequest, renderResponse);
+            }
+        }
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        PortletContext pc = portletConfig.getPortletContext();
+        normalView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/normal.jsp");
+        addNormalView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/addnormal.jsp");
+        maximizedView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp");
+        addMaximizedView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/addmaximized.jsp");
+        helpView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/help.jsp");
+        errorView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/groups/error.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        String action = actionRequest.getParameter("action").trim();
+        String cancel = actionRequest.getParameter("cancel");
+        String currAction = "";
+        if (cancel != null) {
+            action = "";
+        }
+        String group = actionRequest.getParameter("group");
+        String[] users = actionRequest.getParameterValues("users");
+
+        try {
+            if ("delete".equals(action)) {
+                SERealmGroupHelper.deleteGroup(group);
+            } else if ("update".equals(action)) {
+                SERealmGroupHelper.updateGroup(group, users);
+            } else if ("add".equals(action)) {
+                try {
+                    SERealmGroupHelper.addGroup(group, users);
+                } catch (Exception e) {
+                    actionResponse.setRenderParameter("message",
+                            "ERROR: Group already exists");
+                }
+            } else if ("new".equals(action)) {
+                currAction = "new";
+            } else if ("edit".equals(action)) {
+                currAction = "edit";
+            }
+            actionResponse.setRenderParameter("currAction", currAction);
+            if (group != null) {
+                actionResponse.setRenderParameter("group", group);
+            }
+        } catch (Exception e) {
+            actionResponse.setRenderParameter("errorMessage",
+                    "Error encountered in DerbyGroupsPortlet: "
+                            + e.getMessage());
+        }
+    }
+}
\ No newline at end of file

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,144 @@
+/**
+ *
+ * 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.securitymanager;
+
+import java.io.IOException;
+import java.util.Hashtable;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.console.util.SERealmUserHelper;
+
+public class SEUsersPortlet extends AbstractSecurityManagerPortlet {
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        String errorMessage = renderRequest.getParameter("errorMessage");
+
+        if (errorMessage != null) {
+            renderRequest.setAttribute("errorMessage", errorMessage);
+            errorView.include(renderRequest, renderResponse);
+        } else {
+            try {
+                String[] users = SERealmUserHelper.getUsers();
+
+                Hashtable userInfo = new Hashtable();
+                for (int i = 0; i < users.length; i++) {
+                    String currentUser = users[i];
+                    userInfo.put(currentUser, SERealmUserHelper
+                            .getPassword(currentUser.toString()));
+                }
+
+                String currAction = renderRequest.getParameter("currAction");
+                renderRequest.setAttribute("message", renderRequest
+                        .getParameter("message"));
+
+                if ("new".equals(currAction) || "edit".equals(currAction)) {
+                    if (currAction.equals("edit")) {
+                        String user = renderRequest.getParameter("user");
+                        renderRequest.setAttribute("userID", user);
+                        renderRequest.setAttribute("password",
+                                SERealmUserHelper.getPassword(user));
+                    }
+                    addMaximizedView.include(renderRequest, renderResponse);
+                } else {
+                    if (WindowState.NORMAL.equals(renderRequest
+                            .getWindowState())) {
+                        renderRequest.setAttribute("userInfo", userInfo);
+                        normalView.include(renderRequest, renderResponse);
+                    } else {
+                        renderRequest.setAttribute("userInfo", userInfo);
+                        maximizedView.include(renderRequest, renderResponse);
+                    }
+                }
+            } catch (Exception e) {
+                errorMessage = e.getMessage();
+                renderRequest.setAttribute("errorMessage", errorMessage);
+                errorView.include(renderRequest, renderResponse);
+            }
+        }
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        PortletContext pc = portletConfig.getPortletContext();
+        normalView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/users/normal.jsp");
+        addNormalView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/users/addnormal.jsp");
+        maximizedView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp");
+        addMaximizedView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp");
+        helpView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/se/users/help.jsp");
+        errorView = pc
+                .getRequestDispatcher("/WEB-INF/view/securityrealmmanager/derby/groups/error.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        String action = actionRequest.getParameter("action").trim();
+        String cancel = actionRequest.getParameter("cancel");
+        String currAction = "";
+        if (cancel != null) {
+            action = "";
+        }
+        String user = actionRequest.getParameter("userId");
+        String password = actionRequest.getParameter("password");
+
+        try {
+            if ("delete".equals(action)) {
+                SERealmUserHelper.deleteUser(user);
+            } else if ("update".equals(action)) {
+                SERealmUserHelper.updateUser(user, password);
+            } else if ("add".equals(action)) {
+                try {
+                    SERealmUserHelper.addUser(user, password);
+                } catch (Exception e) {
+                    actionResponse.setRenderParameter("message",
+                            "ERROR: User already exists");
+                }
+            } else if ("new".equals(action)) {
+                currAction = "new";
+            } else if ("edit".equals(action)) {
+                currAction = "edit";
+            }
+            actionResponse.setRenderParameter("currAction", currAction);
+            if (user != null) {
+                actionResponse.setRenderParameter("user", user);
+            }
+        } catch (Exception e) {
+            actionResponse.setRenderParameter("errorMessage",
+                    "Error encountered in DerbyGroupsPortlet: "
+                            + e.getMessage());
+        }
+    }
+
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,104 @@
+/**
+ *
+ * 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.servermanager;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.system.main.Daemon;
+
+public class ServerManagerPortlet extends GenericPortlet {
+
+    private static final Log log = LogFactory.getLog("ServerManager");
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher shutdownView;
+
+    private PortletRequestDispatcher helpView;
+
+    private Kernel kernel;
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        if (actionRequest.getParameter("reboot") != null) {
+            log.info("Reboot initiated by user request: "
+                    + actionRequest.getUserPrincipal());
+            new Thread() {
+                public void run() {
+                    try {
+                        Thread.sleep(2000);
+                    } catch (InterruptedException e) {
+                    }
+                    kernel.shutdown();
+                    Daemon.main(new String[0]);
+                }
+            }.start();
+        }
+    }
+
+    protected void doView(RenderRequest request, RenderResponse response)
+            throws PortletException, IOException {
+        if (request.getParameter("shutdown") != null) {
+            log.info("Shutting down by user request: "
+                    + request.getUserPrincipal());
+            shutdownView.include(request, response);
+            response.flushBuffer();
+            kernel.shutdown();
+            System.exit(0);
+        } else {
+            normalView.include(request, response);
+        }
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        normalView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/servermanager/normal.jsp");
+        shutdownView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/servermanager/shutdown.jsp");
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/servermanager/help.jsp");
+        kernel = KernelRegistry.getSingleKernel();
+    }
+
+    public void destroy() {
+        normalView = null;
+        shutdownView = null;
+        helpView = null;
+        super.destroy();
+    }
+
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/servermanager/ServerManagerPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/CollectionHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/CollectionHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/CollectionHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/CollectionHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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 java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author dimperial
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public abstract class CollectionHelper {
+
+    public static Hashtable parameterMapToHashtable(Map m) {
+        Hashtable ret = new Hashtable();
+        ret.putAll(m);
+        for (Iterator i = ret.keySet().iterator(); i.hasNext();) {
+            Object key = i.next();
+            String[] value = (String[]) ret.get(key);
+            try {
+                ret.put(key, value[0]);
+            } catch (ArrayIndexOutOfBoundsException e) {
+                // This should not happen but if it does just continue
+                // processing.
+            }
+        }
+        return ret;
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/KernelHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/KernelHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/KernelHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/KernelHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,63 @@
+/**
+ *
+ * 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 javax.management.ObjectName;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+
+public class KernelHelper {
+
+    protected static Kernel kernel = KernelRegistry.getSingleKernel();
+
+    protected static Object invoke(ObjectName mBeanName, String function)
+            throws Exception {
+        Object[] NO_ARGS = new Object[0];
+        String[] NO_PARAMS = new String[0];
+        return invoke(mBeanName, function, NO_ARGS, NO_PARAMS);
+    }
+
+    protected static Object invoke(ObjectName mBeanName, String function,
+            Object[] args, String[] types) throws Exception {
+        Object ret = null;
+        ret = kernel.invoke(mBeanName, function, args, types);
+        return ret;
+    }
+
+    protected static Object get(ObjectName mBeanName, String attributeName) {
+        Object ret = null;
+        try {
+            ret = kernel.getAttribute(mBeanName, attributeName);
+        } catch (Exception e) {
+            e.printStackTrace(System.out);
+        }
+        return ret;
+    }
+
+    protected static void set(ObjectName mBeanName, String attributeName,
+            Object value) {
+        Object ret = null;
+        try {
+            kernel.setAttribute(mBeanName, attributeName, value);
+        } catch (Exception e) {
+            e.printStackTrace(System.out);
+        }
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/LogHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/LogHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/LogHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/LogHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,198 @@
+/**
+ *
+ * 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 javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.Iterator;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.SequenceInputStream;
+import java.util.Enumeration;
+
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Logger;
+
+public class LogHelper extends KernelHelper {
+
+    private static ObjectName loggerObjName;
+
+    private static final String LOGGER_LOG_LEVEL_ATTR = "rootLoggerLevel";
+
+    private static final String LOGGER_CONFIG_FILE_ATTR = "configurationFile";
+
+    private static final String LOGGER_REFRESH_PERIOD_ATTR = "refreshPeriod";
+
+    private static final String LOGGER_CONFIG_ATTR = "configuration";
+
+    private static final String LOGGER_RECONFIG_FUNC = "reconfigure";
+
+    private static int lineCount = 0;
+
+    private static ArrayList logs = new ArrayList();
+
+    private static boolean started;
+
+    public static String getLogLevel() {
+        return get(loggerObjName, LOGGER_LOG_LEVEL_ATTR).toString();
+    }
+
+    public static void setLogLevel(String newLevel) {
+        set(loggerObjName, LOGGER_LOG_LEVEL_ATTR, newLevel);
+    }
+
+    public static String getConfigFile() {
+        return (String) get(loggerObjName, LOGGER_CONFIG_FILE_ATTR);
+    }
+
+    public static void setConfigFile(String newFile) {
+        set(loggerObjName, LOGGER_CONFIG_FILE_ATTR, newFile);
+    }
+
+    public static Integer getRefreshPeriod() {
+        Object ref = get(loggerObjName, LOGGER_REFRESH_PERIOD_ATTR);
+        return (ref != null ? new Integer(ref.toString()) : null);
+    }
+
+    public static void setRefreshPeriod(int refreshPeriod) {
+        set(loggerObjName, LOGGER_REFRESH_PERIOD_ATTR, new Integer(
+                refreshPeriod));
+    }
+
+    public static String getConfiguration() {
+        return (String) get(loggerObjName, LOGGER_CONFIG_ATTR);
+    }
+
+    public static void setConfiguration(String newConfig) {
+        set(loggerObjName, LOGGER_CONFIG_ATTR, newConfig);
+    }
+
+    public static void reconfigure() throws Exception {
+        invoke(loggerObjName, LOGGER_RECONFIG_FUNC);
+    }
+
+    public static void refresh() throws IOException {
+        logs.clear();
+        lineCount = 0;
+        started = false;
+        BufferedReader in = new BufferedReader(getFileReader());
+        if (in != null) {
+            Stack holder = new Stack();
+            for (String line = in.readLine(); line != null; line = in
+                    .readLine()) {
+                if (line.indexOf("DEBUG") > -1 || line.indexOf("INFO") > -1
+                        || line.indexOf("WARN") > -1
+                        || line.indexOf("ERROR") > -1
+                        || line.indexOf("FATAL") > -1
+                        || line.indexOf("TRACE") > -1) {
+                    holder.push(line);
+                    lineCount++;
+                } else {
+                    String top = (String) holder.pop();
+                    holder.push(top + "\n" + line);
+                }
+            }
+            logs.addAll(holder);
+        }
+        started = true;
+    }
+
+    public static ArrayList getLogs() throws IOException {
+        if (!started) {
+            refresh();
+        }
+        return logs;
+    }
+
+    public static List searchLogs(int startLine, int endLine, String logLevel,
+            String searchString) throws IOException {
+        return filterLogs(getLogs().subList(startLine - 1, endLine), logLevel,
+                searchString);
+    }
+
+    public static List searchLogs(int startLine, int endLine)
+            throws IOException {
+        return searchLogs(startLine, endLine, null, null);
+    }
+
+    public static int getLineCount() throws IOException {
+        if (!started) {
+            refresh();
+        }
+        return lineCount;
+    }
+
+    private static ArrayList filterLogs(List listToFilter, String logLevel,
+            String searchString) {
+        ArrayList ret = new ArrayList();
+        for (Iterator i = listToFilter.iterator(); i.hasNext();) {
+            String msg = i.next().toString();
+            boolean passed = true;
+            passed = (logLevel == null || logLevel.trim().length() < 1 || msg
+                    .indexOf(logLevel) > -1)
+                    && (searchString == null
+                            || searchString.trim().length() < 1 || msg
+                            .toLowerCase().indexOf(searchString.toLowerCase()) > -1);
+            if (passed) {
+                ret.add(msg);
+            }
+        }
+        return ret;
+    }
+
+    private static InputStreamReader getFileReader() {
+        Stack files = new Stack();
+        for (Enumeration e = Logger.getRootLogger().getAllAppenders(); e
+                .hasMoreElements();) {
+            Object o = e.nextElement();
+            if (o instanceof FileAppender) {
+                File logFile = new File(((FileAppender) o).getFile());
+                if (logFile.isFile() && logFile.canRead()) {
+                    try {
+                        FileInputStream in = new FileInputStream(logFile);
+                        files.push(in);
+                    } catch (IOException ignore) {
+                        /*
+                         * Someone probably made a mistake in configuring the
+                         * loggappender. Keep on processing the others.
+                         */
+                    }
+                }
+            }
+        }
+        return new InputStreamReader(new SequenceInputStream(files.elements()));
+    }
+
+    static {
+        try {
+            loggerObjName = new ObjectName(
+                    ObjectNameConstants.ROOT_LOGGER_OBJECT_NAME);
+        } catch (MalformedObjectNameException e) {
+
+        }
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,54 @@
+/**
+ *
+ * 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 ObjectNameConstants {
+
+    // Security object names
+    public static final String SE_REALM_MBEAN_NAME = "geronimo.server:J2EEApplication=org/apache/geronimo/Console,J2EEModule=null,J2EEServer=geronimo,j2eeType=GBean,name=PropertiesLoginManager";
+
+    public static final String SE_REALM_IMMUTABLE_MBEAN_NAME = "geronimo.server:name=PropertiesLoginManager,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=null";
+
+    public static final String SECURITY_REALM = "geronimo.security:type=SecurityRealm,*";
+
+    public static final String ROOT_LOGGER_OBJECT_NAME = "geronimo.server:name=Logger,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=org/apache/geronimo/System";
+
+    public static final String REQUEST_LOGGER_OBJECT_NAME = "geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=GBean,name=JettyRequestLog";
+
+    public static final String DERBY_OBJECT_NAME = "geronimo.server:name=DerbySystem,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=null";
+
+    public static final String REPO_OBJECT_NAME = "geronimo.server:name=Repository,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=org/apache/geronimo/System";
+
+    public static final String WEBCONTAINER_OBJECT_NAME = "geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=GBean,name=JettyWebContainer";
+
+    public static final String SERVER_INFO_OBJECT_NAME = "geronimo.server:name=ServerInfo,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=org/apache/geronimo/System";
+
+    public static final String JVM_IMPL_NAME = "geronimo.server:j2eeType=JVM,J2EEServer=geronimo,name=JVM";
+
+    public static final String DEPLOYER_OBJECT_NAME = "geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/RuntimeDeployer,J2EEServer=geronimo,j2eeType=Deployer,name=Deployer";
+
+    public static final String JETTY_HTTP_CONNECTOR_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=GBean,name=JettyWebConnector,*";
+
+    // TODO: Put the appropriate name here
+    public static final String JETTY_HTTPS_CONNECTOR_NAME = "geronimo.server:name=JettyWebConnector.HTTPS.8443,J2EEServer=geronimo,j2eeType=GBean,*";
+
+    public static final String JCA_MANAGED_CF_QUERY = "*:j2eeType=JCAManagedConnectionFactory,*";
+
+    public static final String CONFIG_GBEAN_PREFIX = "geronimo.config:name=";
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java Wed Jul 20 18:38:12 2005
@@ -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/sandbox/console-standard/src/java/org/apache/geronimo/console/util/RealmHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmGroupHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,148 @@
+/**
+ *
+ * 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 javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+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 REFRESH = "refresh";
+
+    private static final String START = "doStart";
+
+    private static final String STOP = "doStop";
+
+    private static final String[] STRING_STRING = { "java.lang.String",
+            "java.lang.String" };
+
+    private static final String[] STRING = { "java.lang.String" };
+
+    private static final String[] HASHTABLE = { "java.util.Hashtable" };
+
+    private static ObjectName mBeanName;
+
+    private static final Kernel kernel = KernelRegistry.getSingleKernel();
+
+    public static String[] getGroups() throws Exception {
+        String[] groups = (String[]) invoke(mBeanName, GET_GROUPS_FUNCTION);
+        return groups;
+    }
+
+    private static void refresh() {
+        try {
+
+            kernel.stopGBean(new ObjectName(
+                    ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME));
+            kernel.startGBean(new ObjectName(
+                    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(mBeanName, 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(mBeanName, 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(mBeanName, UPDATE_GROUP_FUNCTION, args, HASHTABLE);
+    }
+
+    public static void deleteGroup(String groupName) throws Exception {
+        String[] args = {groupName};
+        invoke(mBeanName, DELETE_GROUP_FUNCTION, args, STRING);
+        refresh();
+    }
+
+    public static Set getUsers(String groupName) throws Exception {
+        Set ret = null;
+        String[] arg = {groupName};
+        ret = (Set) invoke(mBeanName, 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);
+    }
+
+    static {
+        try {
+            mBeanName = new ObjectName(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+        } catch (MalformedObjectNameException e) {
+        }
+    }
+
+}
\ No newline at end of file

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SERealmUserHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,124 @@
+/**
+ *
+ * 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 javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+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 REFRESH = "refresh";
+
+    private static final String START = "doStart";
+
+    private static final String STOP = "doStop";
+
+    private static final String[] STRING_STRING = { "java.lang.String",
+            "java.lang.String" };
+
+    private static final String[] STRING = { "java.lang.String" };
+
+    private static final String[] HASHTABLE = { "java.util.Hashtable" };
+
+    private static ObjectName mBeanName;
+
+    private static final Kernel kernel = KernelRegistry.getSingleKernel();
+
+    public static String[] getUsers() throws Exception {
+        return (String[]) invoke(mBeanName, GET_USERS_FUNCTION);
+    }
+
+    private static void refresh() {
+        try {
+
+            kernel.stopGBean(new ObjectName(
+                    ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME));
+            kernel.startGBean(new ObjectName(
+                    ObjectNameConstants.SE_REALM_IMMUTABLE_MBEAN_NAME));
+
+        } catch (Exception e) {
+        }
+    }
+
+    public static String getPassword(String username) throws Exception {
+        Object ret;
+        String[] arg = {username};
+        ret = invoke(mBeanName, 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(mBeanName, 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(mBeanName, 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(mBeanName, UPDATE_USER_FUNCTION, args, HASHTABLE);
+        refresh();
+    }
+
+    public static void deleteUser(String username) throws Exception {
+        String[] args = {username};
+        invoke(mBeanName, DELETE_USER_FUNCTION, args, STRING);
+        refresh();
+    }
+
+    static {
+        try {
+            mBeanName = new ObjectName(ObjectNameConstants.SE_REALM_MBEAN_NAME);
+
+        } catch (MalformedObjectNameException e) {
+
+        }
+    }
+
+}
\ No newline at end of file

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java Wed Jul 20 18:38:12 2005
@@ -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/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java Wed Jul 20 18:38:12 2005
@@ -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/sandbox/console-standard/src/java/org/apache/geronimo/console/util/SecurityRealmBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java Wed Jul 20 18:38:12 2005
@@ -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/sandbox/console-standard/src/java/org/apache/geronimo/console/util/StringUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/AJP13ConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/AJP13ConnectorPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/AJP13ConnectorPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/AJP13ConnectorPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,111 @@
+/**
+ *
+ * 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.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class AJP13ConnectorPortlet extends GenericPortlet {
+
+    private static final ObjectName QUERY = JMXUtil
+            .getObjectName("*:type=WebConnector,protocol=AJP13,*");
+
+    private Kernel kernel;
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher maximizedView;
+
+    private PortletRequestDispatcher helpView;
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        Set connectors = kernel.listGBeans(QUERY);
+        ArrayList beans = new ArrayList(connectors.size());
+        for (Iterator i = connectors.iterator(); i.hasNext();) {
+            ObjectName name = (ObjectName) i.next();
+            ConnectorInfo info = new ConnectorInfo();
+            info.setObjectName(name);
+            try {
+                info.setState(((Integer) kernel.getAttribute(name, "state"))
+                        .intValue());
+                info.setPort(((Integer) kernel.getAttribute(name, "port"))
+                        .intValue());
+            } catch (Exception e) {
+                throw new PortletException(e);
+            }
+            beans.add(info);
+        }
+        renderRequest.setAttribute("connectors", beans);
+
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        kernel = KernelRegistry.getSingleKernel();
+        normalView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/ajp13/normal.jsp");
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/ajp13/maximized.jsp");
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/ajp13/help.jsp");
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        kernel = null;
+        super.destroy();
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,62 @@
+/**
+ *
+ * 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 ObjectName objectName;
+
+    private int port;
+
+    private int state;
+
+    public ObjectName getObjectName() {
+        return objectName;
+    }
+
+    public void setObjectName(ObjectName objectName) {
+        this.objectName = objectName;
+    }
+
+    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/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorBean.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorBean.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorBean.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,52 @@
+/**
+ *
+ * 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;
+
+public class HttpConnectorBean {
+
+    private String id;
+
+    private String name;
+
+    private int port;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpConnectorPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,147 @@
+/**
+ *
+ * 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.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class HttpConnectorPortlet extends GenericPortlet {
+
+    private Kernel kernel;
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher maximizedView;
+
+    private PortletRequestDispatcher helpView;
+
+    private ObjectName connector = JMXUtil
+            .getObjectName(ObjectNameConstants.JETTY_HTTP_CONNECTOR_NAME);
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        try {
+            String id = actionRequest.getParameter("gbeanId");
+            ObjectName con = JMXUtil.getObjectName(id);
+            String portStr = actionRequest.getParameter(id);
+            if (portStr != null) {
+                try {
+                    Integer port = Integer.valueOf(portStr);
+                    kernel.setAttribute(con, "port", port);
+                } catch (NumberFormatException nfe) {
+                    throw new PortletException(nfe);
+                }
+            }
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        try {
+            String mode = renderRequest.getParameter("mode");
+            if (mode != null && mode.equals("edit")) {
+                String id = renderRequest.getParameter("gbeanId");
+                ObjectName con = JMXUtil.getObjectName(id);
+                GBeanData gbeanData = kernel.getGBeanData(con);
+                GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+                HttpConnectorBean bean = new HttpConnectorBean();
+                bean.setId(con.toString());
+                bean.setName(gbeanInfo.getName());
+                bean.setPort(((Integer) gbeanData.getAttribute("port"))
+                        .intValue());
+                renderRequest.setAttribute("connector", bean);
+            } else {
+                ArrayList connectors = new ArrayList();
+                Set gbeans = kernel.listGBeans(connector);
+
+                Iterator iterator = gbeans.iterator();
+                while (iterator.hasNext()) {
+                    ObjectName con = (ObjectName) iterator.next();
+                    GBeanData gbeanData = kernel.getGBeanData(con);
+                    GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+                    HttpConnectorBean bean = new HttpConnectorBean();
+                    bean.setId(con.toString());
+                    bean.setName(gbeanInfo.getName());
+                    bean.setPort(((Integer) gbeanData.getAttribute("port"))
+                            .intValue());
+                    connectors.add(bean);
+                }
+                renderRequest.setAttribute("connectors", connectors
+                        .toArray(new HttpConnectorBean[0]));
+            }
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        kernel = KernelRegistry.getSingleKernel();
+        normalView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/http/normal.jsp");
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/http/maximized.jsp");
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/http/help.jsp");
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        kernel = null;
+        super.destroy();
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorBean.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorBean.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorBean.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,112 @@
+/**
+ *
+ * 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;
+
+public class HttpsConnectorBean {
+
+    private String id;
+
+    private String name;
+
+    private int port;
+
+    private String keystore;
+
+    private String password;
+
+    private String keyPassword;
+
+    private String keystoreType;
+
+    private boolean useDefaultTrustStore;
+
+    private boolean needClientAuth;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public String getKeystore() {
+        return keystore;
+    }
+
+    public void setKeystore(String keystore) {
+        this.keystore = keystore;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getKeyPassword() {
+        return keyPassword;
+    }
+
+    public void setKeyPassword(String keyPassword) {
+        this.keyPassword = keyPassword;
+    }
+
+    public String getKeystoreType() {
+        return keystoreType;
+    }
+
+    public void setKeystoreType(String keystoreType) {
+        this.keystoreType = keystoreType;
+    }
+
+    public boolean isUseDefaultTrustStore() {
+        return useDefaultTrustStore;
+    }
+
+    public void setUseDefaultTrustStore(boolean useDefaultTrustStore) {
+        this.useDefaultTrustStore = useDefaultTrustStore;
+    }
+
+    public boolean isNeedClientAuth() {
+        return needClientAuth;
+    }
+
+    public void setNeedClientAuth(boolean needClientAuth) {
+        this.needClientAuth = needClientAuth;
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/webmanager/HttpsConnectorPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,145 @@
+/**
+ *
+ * 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.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class HttpsConnectorPortlet extends GenericPortlet {
+
+    private Kernel kernel;
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher maximizedView;
+
+    private PortletRequestDispatcher helpView;
+
+    private ObjectName connector = JMXUtil
+            .getObjectName(ObjectNameConstants.JETTY_HTTPS_CONNECTOR_NAME);
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        try {
+            String id = actionRequest.getParameter("gbeanId");
+            ObjectName con = JMXUtil.getObjectName(id);
+            kernel.setAttribute(con, "port", Integer.valueOf(actionRequest
+                    .getParameter("port")));
+            kernel.setAttribute(con, "needClientAuth", Boolean
+                    .valueOf(actionRequest.getParameter("needClientAuth")));
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        try {
+            String mode = renderRequest.getParameter("mode");
+            if (mode != null && mode.equals("edit")) {
+                String id = renderRequest.getParameter("gbeanId");
+                ObjectName con = JMXUtil.getObjectName(id);
+                GBeanData gbeanData = kernel.getGBeanData(con);
+                GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+                HttpsConnectorBean bean = new HttpsConnectorBean();
+                bean.setId(con.toString());
+                bean.setName(gbeanInfo.getName());
+                bean.setPort(((Integer) gbeanData.getAttribute("port"))
+                        .intValue());
+                bean.setNeedClientAuth(((Boolean) gbeanData
+                        .getAttribute("needClientAuth")).booleanValue());
+
+                renderRequest.setAttribute("connector", bean);
+            } else {
+                ArrayList connectors = new ArrayList();
+                Set gbeans = kernel.listGBeans(connector);
+
+                Iterator iterator = gbeans.iterator();
+                while (iterator.hasNext()) {
+                    ObjectName con = (ObjectName) iterator.next();
+                    GBeanData gbeanData = kernel.getGBeanData(con);
+                    GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+                    HttpsConnectorBean bean = new HttpsConnectorBean();
+                    bean.setId(con.toString());
+                    bean.setName(gbeanInfo.getName());
+                    bean.setPort(((Integer) gbeanData.getAttribute("port"))
+                            .intValue());
+                    connectors.add(bean);
+                }
+                renderRequest.setAttribute("connectors", connectors
+                        .toArray(new HttpsConnectorBean[0]));
+            }
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        kernel = KernelRegistry.getSingleKernel();
+        normalView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/https/normal.jsp");
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/https/maximized.jsp");
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                "/WEB-INF/view/webmanager/https/help.jsp");
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        kernel = null;
+        super.destroy();
+    }
+
+}

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



Mime
View raw message