geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r393787 [11/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/jmsmanager/wizard/JMSProviderData.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSProviderData.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSProviderData.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSProviderData.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,376 @@
+/**
+ *
+ * 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.jmsmanager.wizard;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.util.PortletManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+import java.io.Serializable;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.*;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipEntry;
+import java.net.URL;
+import javax.portlet.PortletRequest;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+
+/**
+ * Loads data on JMS providers known to the console.  Reads from a properties
+ * file on the class path.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSProviderData implements Serializable {
+    private final static Log log = LogFactory.getLog(JMSProviderData.class);
+    private String name;
+    private final String raURI;
+    private final String dependency;
+    private String defaultTransaction;
+    private ConfigPropertyData[] instanceConfigProperties;
+    private ConnectionDefinition[] connectionDefinitions;
+    private AdminObjectDefinition[] adminObjectDefinitions;
+
+    public JMSProviderData(String name, String raURI, String dependency) {
+        this.name = name;
+        this.raURI = raURI;
+        this.dependency = dependency;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getRaURI() {
+        return raURI;
+    }
+
+    public String getDependency() {
+        return dependency;
+    }
+
+    public String getDefaultTransaction() {
+        return defaultTransaction;
+    }
+
+    public ConfigPropertyData[] getInstanceConfigProperties() {
+        return instanceConfigProperties;
+    }
+
+    public ConnectionDefinition[] getConnectionDefinitions() {
+        return connectionDefinitions;
+    }
+
+    public AdminObjectDefinition[] getAdminObjectDefinitions() {
+        return adminObjectDefinitions;
+    }
+
+    public static class ConfigPropertyData implements Serializable {
+        private final String name;
+        private final String type;
+        private final String defaultValue;
+        private final String description;
+
+        public ConfigPropertyData(String name, String type, String defaultValue, String description) {
+            this.name = name;
+            this.type = type;
+            this.defaultValue = defaultValue;
+            this.description = description;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public String getDefaultValue() {
+            return defaultValue;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+    }
+
+    public static class ConnectionDefinition implements Serializable {
+        private final String connectionFactoryInterface;
+        private final ConfigPropertyData[] configProperties;
+
+        public ConnectionDefinition(String connectionFactoryInterface, ConfigPropertyData[] configProperties) {
+            this.connectionFactoryInterface = connectionFactoryInterface;
+            this.configProperties = configProperties;
+        }
+
+        public String getConnectionFactoryInterface() {
+            return connectionFactoryInterface;
+        }
+
+        public ConfigPropertyData[] getConfigProperties() {
+            return configProperties;
+        }
+    }
+
+    public static class AdminObjectDefinition implements Serializable {
+        private final String adminObjectInterface;
+        private final String adminObjectClass;
+        private final ConfigPropertyData[] configProperties;
+
+        public AdminObjectDefinition(String adminObjectInterface, String adminObjectClass, ConfigPropertyData[] configProperties) {
+            this.adminObjectInterface = adminObjectInterface;
+            this.adminObjectClass = adminObjectClass;
+            this.configProperties = configProperties;
+        }
+
+        public String getAdminObjectInterface() {
+            return adminObjectInterface;
+        }
+
+        public String getAdminObjectClass() {
+            return adminObjectClass;
+        }
+
+        public ConfigPropertyData[] getConfigProperties() {
+            return configProperties;
+        }
+    }
+
+
+    // *************** Static methods to access the data ****************
+
+    private static List all = null;
+    public static JMSProviderData[] getAllProviders() {
+        if(all == null) {
+            loadProviders();
+        }
+        return (JMSProviderData[]) all.toArray(new JMSProviderData[all.size()]);
+    }
+
+    public static JMSProviderData getProviderByName(String name) {
+        if(all == null) {
+            loadProviders();
+        }
+        for (int i = 0; i < all.size(); i++) {
+            JMSProviderData data = (JMSProviderData) all.get(i);
+            if(data.getName().equals(name)) {
+                return data;
+            }
+        }
+        return null;
+    }
+
+    public static JMSProviderData getProviderData(String rar, PortletRequest request) throws IOException {
+        if(all == null) {
+            loadProviders();
+        }
+        for (int i = 0; i < all.size(); i++) {
+            JMSProviderData data = (JMSProviderData) all.get(i);
+            if(data.getRaURI().equals(rar)) {
+                if(data.instanceConfigProperties == null) {
+                    loadRARData(data, request);
+                }
+                return data;
+            }
+        }
+        JMSProviderData data = new JMSProviderData(null, rar, null);
+        loadRARData(data, request);
+        all.add(data);
+        return data;
+    }
+
+    private static void loadRARData(JMSProviderData data, PortletRequest request) throws IOException {
+        URL url = PortletManager.getRepositoryEntry(request, data.getRaURI());
+        ZipInputStream in = new ZipInputStream(url.openStream());
+        ZipEntry entry;
+        Document doc = null;
+        try {
+            while((entry = in.getNextEntry()) != null) {
+                if(entry.getName().equals("META-INF/ra.xml")) {
+                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                    factory.setValidating(false);
+                    DocumentBuilder builder = factory.newDocumentBuilder();
+                    doc = builder.parse(in);
+                    in.close();
+                    break;
+                } else in.closeEntry();
+            }
+        } catch (ParserConfigurationException e) {
+            log.error("Unable to read META-INF/ra.xml in RAR file '"+data.getRaURI()+"'", e);
+        } catch (SAXException e) {
+            log.error("Unable to read META-INF/ra.xml in RAR file '"+data.getRaURI()+"'", e);
+        }
+        if(doc == null) {
+            throw new IOException("Unable to locate META-INF/ra.xml in RAR file '"+data.getRaURI()+"'");
+        }
+        Element root = doc.getDocumentElement();
+        if(data.getName() == null) {
+            NodeList displays = getChildren(root, "display-name");
+            if(displays != null && displays.getLength() > 0) {
+                data.name = getText(displays.item(0));
+            }
+        }
+        Element ra = (Element) getChildren(root, "resourceadapter").item(0);
+        data.instanceConfigProperties = loadConfigs(ra);
+        Element outbound = (Element) getChildren(ra, "outbound-resourceadapter").item(0);
+        data.defaultTransaction = getTransactionSetting(getChildText(outbound, "transaction-support"));
+        data.connectionDefinitions = loadConnections(outbound);
+        data.adminObjectDefinitions = loadAdmins(ra);
+    }
+
+    private static String getTransactionSetting(String text) {
+        if(text == null) {
+            return null;
+        }
+        if(text.equals("XATransaction")) return "xa";
+        if(text.equals("LocalTransaction")) return "local";
+        if(text.equals("NoTransaction")) return "none";
+        return null;
+    }
+
+    private static ConfigPropertyData[] loadConfigs(Element parent) {
+        NodeList configs = getChildren(parent, "config-property");
+        if(configs == null || configs.getLength() == 0) {
+            return new ConfigPropertyData[0];
+        }
+        ConfigPropertyData[] results = new ConfigPropertyData[configs.getLength()];
+        for (int i = 0; i < results.length; i++) {
+            Element root = (Element) configs.item(i);
+            results[i] = new ConfigPropertyData(getChildText(root, "config-property-name"),
+                    getChildText(root, "config-property-type"), getChildText(root, "config-property-value"),
+                    getChildText(root, "description"));
+        }
+        return results;
+    }
+
+    private static NodeList getChildren(Element parent, String child) {
+        final List list = new ArrayList();
+        NodeList nodes = parent.getChildNodes();
+        for(int i=0; i<nodes.getLength(); i++) {
+            Node node = nodes.item(i);
+            if(node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(child)) {
+                list.add(node);
+            }
+        }
+        return new NodeList() {
+            public Node item(int index) {
+                return (Node) list.get(index);
+            }
+
+            public int getLength() {
+                return list.size();
+            }
+        };
+    }
+
+    private static ConnectionDefinition[] loadConnections(Element outbound) {
+        NodeList defs = getChildren(outbound, "connection-definition");
+        if(defs == null || defs.getLength() == 0) {
+            return new ConnectionDefinition[0];
+        }
+        ConnectionDefinition[] results = new ConnectionDefinition[defs.getLength()];
+        for (int i = 0; i < results.length; i++) {
+            Element def = (Element) defs.item(i);
+            results[i] = new ConnectionDefinition(getChildText(def, "connectionfactory-interface"), loadConfigs(def));
+        }
+        return results;
+    }
+
+    private static AdminObjectDefinition[] loadAdmins(Element ra) {
+        NodeList defs = getChildren(ra, "adminobject");
+        if(defs == null || defs.getLength() == 0) {
+            return new AdminObjectDefinition[0];
+        }
+        AdminObjectDefinition[] results = new AdminObjectDefinition[defs.getLength()];
+        for (int i = 0; i < results.length; i++) {
+            Element def = (Element) defs.item(i);
+            results[i] = new AdminObjectDefinition(getChildText(def, "adminobject-interface"),
+                    getChildText(def, "adminobject-class"), loadConfigs(def));
+        }
+        return results;
+    }
+
+    private static String getChildText(Element root, String name) {
+        NodeList list = getChildren(root, name);
+        if(list == null || list.getLength() == 0) {
+            return null;
+        }
+        return getText(list.item(0));
+    }
+
+    private static String getText(Node node) {
+        StringBuffer buf = null;
+        NodeList list = node.getChildNodes();
+        if(list != null) {
+            for(int i=0; i<list.getLength(); i++) {
+                Node current = list.item(i);
+                if(current.getNodeType() == Node.TEXT_NODE) {
+                    if(buf == null) {
+                        buf = new StringBuffer();
+                    }
+                    buf.append(current.getNodeValue());
+                }
+            }
+        }
+        return buf == null ? null : buf.toString();
+    }
+
+
+    private static void loadProviders() {
+        InputStream in = JMSProviderData.class.getResourceAsStream("/jms-resource-providers.properties");
+        if(in == null) {
+            log.error("Unable to locate JMS provider properties file");
+            return;
+        }
+        Properties props = new Properties();
+        try {
+            props.load(in);
+            in.close();
+        } catch (IOException e) {
+            log.error("Unable to read JMS provider properties file", e);
+        }
+        Set set = new HashSet();
+        // Find the names of the provider entries
+        for (Iterator it = props.keySet().iterator(); it.hasNext();) {
+            String key = (String) it.next();
+            int start = key.indexOf('.');
+            int end = key.indexOf('.', start+1);
+            if(start < 0 || end < 0) {
+                continue;
+            }
+            set.add(key.substring(start+1, end));
+        }
+        List list = new ArrayList(set.size());
+        for (Iterator it = set.iterator(); it.hasNext();) {
+            String key = (String) it.next();
+            String name = props.getProperty("provider."+key+".name");
+            String rar = props.getProperty("provider."+key+".rar");
+            String dep = props.getProperty("provider."+key+".dependency");
+            list.add(new JMSProviderData(name, rar, dep));
+        }
+        all = list;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSProviderData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSProviderData.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import javax.portlet.PortletException;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionRequest;
+import javax.portlet.WindowState;
+import javax.portlet.PortletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.MultiPagePortlet;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A portlet that lets you configure and deploy JDBC connection pools.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSResourcePortlet extends MultiPagePortlet {
+    public void init(PortletConfig config) throws PortletException {
+        super.init(config);
+        addHelper(new ListScreenHandler(), config);
+        addHelper(new SelectProviderHandler(), config);
+        addHelper(new ConfigureRAInstanceHandler(), config);
+        addHelper(new SelectConnectionFactoryTypeHandler(), config);
+        addHelper(new CreateConnectionFactoryHandler(), config);
+        addHelper(new SelectDestinationTypeHandler(), config);
+        addHelper(new CreateDestinationHandler(), config);
+        addHelper(new ShowPlanHandler(), config);
+        addHelper(new DeployHandler(), config);
+        addHelper(new ReviewHandler(), config);
+    }
+
+    protected MultiPageModel getModel(PortletRequest request) {
+        return new AbstractHandler.JMSResourceData(request);
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,321 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.ResourceAdapter;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.*;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * A handles for the front page that lists available resources.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ListScreenHandler extends AbstractHandler {
+    public ListScreenHandler() {
+        super(LIST_MODE, "/WEB-INF/view/jmswizard/list.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        populateExistingList(request);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        String provider = request.getParameter(PROVIDER_PARAMETER);
+        if(isEmpty(provider)) {
+            return SELECT_PROVIDER_MODE+BEFORE_ACTION;
+        }
+        JMSProviderData providerData = JMSProviderData.getProviderByName(provider);
+        data.setRarURI(providerData.getRaURI());
+        data.setDependency(providerData.getDependency());
+        return CONFIGURE_RA_MODE+BEFORE_ACTION;
+    }
+
+
+
+    private void populateExistingList(PortletRequest renderRequest) {
+        // Prepare a list of JMS configurations
+        List resources = new ArrayList();
+
+        // Get the list of connection factories
+        ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(renderRequest, new String[]{
+                "javax.jms.ConnectionFactory","javax.jms.QueueConnectionFactory","javax.jms.TopicConnectionFactory",});
+        try {
+            for (int i = 0; i < modules.length; i++) {
+                ResourceAdapterModule module = modules[i];
+
+                JMSResourceSummary target = null;
+                for (int j = 0; j < resources.size(); j++) {
+                    JMSResourceSummary data = (JMSResourceSummary) resources.get(j);
+                    if(data.adapterObjectName.equals(module.getObjectName())) {
+                        target = data;
+                        break;
+                    }
+                }
+                if(target == null) {
+                    ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest, module);
+                    String name = null;
+                    if(adapters.length == 1 && adapters[0].getJCAResources().length == 1) {
+                        JCAResource[] resource = PortletManager.getJCAResources(renderRequest, adapters[0]);
+                        if(resource.length == 1 && resource[0].getResourceAdapterInstances().length == 1) {
+                            name = ObjectName.getInstance(resource[0].getResourceAdapterInstances()[0]).getKeyProperty(NameFactory.J2EE_NAME);
+                        }
+                    }
+                    if(name == null) {
+                        name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
+                    }
+                    target = new JMSResourceSummary(PortletManager.getConfigurationFor(renderRequest, module.getObjectName()).toString(),
+                                                    module.getObjectName(), name, ((GeronimoManagedBean)module).getState());
+                    resources.add(target);
+                }
+
+                JCAManagedConnectionFactory[] factories = PortletManager.getOutboundFactoriesForRA(renderRequest, module, new String[]{
+                        "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory", "javax.jms.TopicConnectionFactory", });
+                for (int j = 0; j < factories.length; j++) {
+                    JCAManagedConnectionFactory factory = factories[j];
+                    ObjectName name = ObjectName.getInstance(factory.getObjectName());
+                    target.getConnectionFactories().add(new ConnectionFactorySummary(factory.getObjectName(), name.getKeyProperty(NameFactory.J2EE_NAME),
+                                                      ((GeronimoManagedBean)factory).getState()));
+                }
+            }
+
+            // Get the list of admin objects
+            modules = PortletManager.getAdminObjectModules(renderRequest, new String[]{"javax.jms.Queue","javax.jms.Topic"});
+            for (int i = 0; i < modules.length; i++) {
+                ResourceAdapterModule module = modules[i];
+
+                JMSResourceSummary target = null;
+                for (int j = 0; j < resources.size(); j++) {
+                    JMSResourceSummary data = (JMSResourceSummary) resources.get(j);
+                    if(data.adapterObjectName.equals(module.getObjectName())) {
+                        target = data;
+                        break;
+                    }
+                }
+                if(target == null) {
+                    ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest, module);
+                    String name = null;
+                    if(adapters.length == 1 && adapters[0].getJCAResources().length == 1) {
+                        JCAResource[] resource = PortletManager.getJCAResources(renderRequest, adapters[0]);
+                        if(resource.length == 1 && resource[0].getResourceAdapterInstances().length == 1) {
+                            name = ObjectName.getInstance(resource[0].getResourceAdapterInstances()[0]).getKeyProperty(NameFactory.J2EE_NAME);
+                        }
+                    }
+                    if(name == null) {
+                        name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
+                    }
+                    target = new JMSResourceSummary(PortletManager.getConfigurationFor(renderRequest, module.getObjectName()).toString(),
+                                                    module.getObjectName(), name, ((GeronimoManagedBean)module).getState());
+                    resources.add(target);
+                }
+
+                JCAAdminObject[] admins = PortletManager.getAdminObjectsForRA(renderRequest, module, new String[]{"javax.jms.Queue","javax.jms.Topic"});
+                for (int j = 0; j < admins.length; j++) {
+                    GeronimoManagedBean bean = (GeronimoManagedBean) admins[j];
+                    ObjectName name = ObjectName.getInstance(bean.getObjectName());
+                    target.getAdminObjects().add(new AdminObjectSummary(bean.getObjectName(), name.getKeyProperty(NameFactory.J2EE_NAME),
+                                                      admins[j].getAdminObjectInterface().indexOf("Queue") > -1 ? "Queue" : "Topic",
+                                                      bean.getState()));
+                }
+            }
+        } catch (MalformedObjectNameException e) {
+            e.printStackTrace();
+        }
+
+        renderRequest.setAttribute("resources", resources);
+        // Get the list of JMS providers
+        renderRequest.setAttribute("providers", JMSProviderData.getAllProviders());
+    }
+
+
+
+    public static class JMSResourceSummary implements Serializable, Comparable {
+        private final String configurationName;
+        private final String adapterObjectName;
+        private final String name;
+        private final String parentName;
+        private final int state;
+        private final List connectionFactories = new ArrayList();
+        private final List adminObjects = new ArrayList();
+
+        public JMSResourceSummary(String configurationName, String adapterObjectName, String name, int state) {
+            this.configurationName = configurationName;
+            this.adapterObjectName = adapterObjectName;
+            this.state = state;
+            try {
+                ObjectName objectName = ObjectName.getInstance(adapterObjectName);
+                String parent = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION);
+                if(parent != null && parent.equals("null")) {
+                    parent = null;
+                }
+                parentName = parent;
+                this.name = name;
+            } catch (MalformedObjectNameException e) {
+                throw new RuntimeException("Can't parse ObjectName", e);
+            }
+        }
+
+        public String getConfigurationName() {
+            return configurationName;
+        }
+
+        public String getAdapterObjectName() {
+            return adapterObjectName;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getParentName() {
+            return parentName;
+        }
+
+        public int getState() {
+            return state;
+        }
+
+        public List getConnectionFactories() {
+            return connectionFactories;
+        }
+
+        public List getAdminObjects() {
+            return adminObjects;
+        }
+
+        public String getStateName() {
+            return State.toString(state);
+        }
+
+        public int compareTo(Object o) {
+            final JMSResourceSummary pool = (JMSResourceSummary)o;
+            int names = configurationName.compareTo(pool.configurationName);
+            if(parentName == null) {
+                if(pool.parentName == null) {
+                    return names;
+                } else {
+                    return -1;
+                }
+            } else {
+                if(pool.parentName == null) {
+                    return 1;
+                } else {
+                    int test = parentName.compareTo(pool.parentName);
+                    if(test != 0) {
+                        return test;
+                    } else {
+                        return names;
+                    }
+                }
+            }
+        }
+    }
+
+    public static class ConnectionFactorySummary implements Serializable, Comparable {
+        private final String factoryObjectName;
+        private final String name;
+        private final int state;
+
+        public ConnectionFactorySummary(String factoryObjectName, String name, int state) {
+            this.factoryObjectName = factoryObjectName;
+            this.name = name;
+            this.state = state;
+        }
+
+        public String getFactoryObjectName() {
+            return factoryObjectName;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public int getState() {
+            return state;
+        }
+
+        public String getStateName() {
+            return State.toString(state);
+        }
+
+        public int compareTo(Object o) {
+            final ConnectionFactorySummary pool = (ConnectionFactorySummary)o;
+            return name.compareTo(pool.name);
+        }
+    }
+
+
+    public static class AdminObjectSummary implements Serializable, Comparable {
+        private final String adminObjectName;
+        private final String name;
+        private final String type;
+        private final int state;
+
+        public AdminObjectSummary(String adminObjectName, String name, String type, int state) {
+            this.adminObjectName = adminObjectName;
+            this.name = name;
+            this.type = type;
+            this.state = state;
+        }
+
+        public String getAdminObjectName() {
+            return adminObjectName;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public int getState() {
+            return state;
+        }
+
+        public String getStateName() {
+            return State.toString(state);
+        }
+
+        public int compareTo(Object o) {
+            final AdminObjectSummary pool = (AdminObjectSummary)o;
+            int result = name.compareTo(pool.name);
+            return result == 0 ? type.compareTo(pool.type) : result;
+        }
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import java.io.IOException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * HAndles the screen where you review your progress so far
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReviewHandler extends AbstractHandler {
+    public ReviewHandler() {
+        super(REVIEW_MODE, "/WEB-INF/view/jmswizard/status.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
+        request.setAttribute("provider", provider);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        String next = request.getParameter("nextAction");
+        if(next.equals(SELECT_DESTINATION_TYPE_MODE)) {
+            data.setCurrentDestinationID(data.getAdminObjects().size());
+        } else if(next.equals(SELECT_FACTORY_TYPE_MODE)) {
+            data.setCurrentFactoryID(data.getConnectionFactories().size());
+        }
+        return next+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import java.io.IOException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * Handler for the screen that creates a new connection factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class SelectConnectionFactoryTypeHandler extends AbstractHandler {
+    public SelectConnectionFactoryTypeHandler() {
+        super(SELECT_FACTORY_TYPE_MODE, "/WEB-INF/view/jmswizard/factoryType.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        data.createIfNecessary();
+        JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
+        if(data.getCurrentFactory().getTransaction() == null || data.getCurrentFactory().getTransaction().equals("")) {
+            data.getCurrentFactory().setTransaction(provider.getDefaultTransaction());
+        }
+        // If there's only one factory type, skip this step
+        if(provider.getConnectionDefinitions().length == 1) {
+            data.setFactoryType(0);
+            return ADD_FACTORY_MODE+BEFORE_ACTION;
+        }
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
+        request.setAttribute("provider", provider);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return ADD_FACTORY_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import java.io.IOException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * Handler for the screen that creates a new connection factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class SelectDestinationTypeHandler extends AbstractHandler {
+    public SelectDestinationTypeHandler() {
+        super(SELECT_DESTINATION_TYPE_MODE, "/WEB-INF/view/jmswizard/destinationType.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        data.createIfNecessary();
+        JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
+        // If there's only one factory type, skip this step
+        if(provider.getAdminObjectDefinitions().length == 1) {
+            data.setDestinationType(0);
+            return ADD_DESTINATION_MODE+BEFORE_ACTION;
+        }
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
+        request.setAttribute("provider", provider);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return ADD_DESTINATION_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,97 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.net.URI;
+import java.net.URISyntaxException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * Handler for the screen where you select a JMS provider (because
+ * you didn't want one of the ones we know about).
+ *
+ * @version $Rev$ $Date$
+ */
+public class SelectProviderHandler extends AbstractHandler {
+    private final static String[] SKIP_RARS_CONTAINING = new String[]{"tranql"};
+
+    public SelectProviderHandler() {
+        super(SELECT_PROVIDER_MODE, "/WEB-INF/view/jmswizard/provider.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        loadRARList(request);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        String rar = request.getParameter(RAR_FILE_PARAMETER);
+        if(isEmpty(rar)) {
+            return SELECT_PROVIDER_MODE+BEFORE_ACTION;
+        }
+        data.setRarURI(rar);
+        return CONFIGURE_RA_MODE+BEFORE_ACTION;
+    }
+
+    private void loadRARList(RenderRequest renderRequest) {
+        // List the available RARs
+        List list = new ArrayList();
+        ListableRepository[] repos = PortletManager.getListableRepositories(renderRequest);
+        for (int i = 0; i < repos.length; i++) {
+            ListableRepository repo = repos[i];
+            try {
+                final URI[] uris = repo.listURIs();
+                outer:
+                for (int j = 0; j < uris.length; j++) {
+                    if(uris[j] == null) {
+                        continue; // probably a JAR lacks a version number in the name, etc.
+                    }
+                    String test = uris[j].toString();
+                    if(!test.endsWith("/rar")) { //todo: may need to change this logic if configId format changes
+                        continue;
+                    }
+                    for (int k = 0; k < SKIP_RARS_CONTAINING.length; k++) {
+                        String skip = SKIP_RARS_CONTAINING[k];
+                        if(test.indexOf(skip) > -1) {
+                            continue outer;
+                        }
+                    }
+                    list.add(test);
+                }
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+            }
+        }
+        Collections.sort(list);
+        renderRequest.setAttribute("rars", list);
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2005 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.jmsmanager.wizard;
+
+import java.io.IOException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * Handles the page that shows a deployment plan
+ *
+ * @version $Rev$ $Date$
+ */
+public class ShowPlanHandler extends AbstractHandler {
+    public ShowPlanHandler() {
+        super(SHOW_PLAN_MODE, "/WEB-INF/view/jmswizard/plan.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        String plan = save(request, response, data, true);
+        request.getPortletSession(true).setAttribute("deploymentPlan", plan);
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        request.setAttribute("deploymentPlan", request.getPortletSession().getAttribute("deploymentPlan"));
+        String path = PortletManager.getRepositoryEntry(request, data.getRarURI()).getPath();
+        String base = PortletManager.getServerInfo(request).getCurrentBaseDirectory();
+        if(base != null && path.startsWith(base)) {
+            path = path.substring(base.length());
+            if(path.startsWith("/")) {
+                path = path.substring(1);
+            }
+        } else {
+            int pos = path.lastIndexOf('/');
+            path = path.substring(pos+1);
+        }
+        request.setAttribute("rarURL", path);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
+        request.getPortletSession(true).removeAttribute("deploymentPlan");
+        String next = request.getParameter("nextAction");
+        if(next.equals(SELECT_DESTINATION_TYPE_MODE)) {
+            data.setCurrentDestinationID(data.getAdminObjects().size());
+        } else if(next.equals(SELECT_FACTORY_TYPE_MODE)) {
+            data.setCurrentFactoryID(data.getConnectionFactories().size());
+        }
+        return next+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,119 @@
+/**
+ *
+ * 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.jsr77;
+
+import java.io.Serializable;
+import java.text.NumberFormat;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DynamicServerInfo implements Serializable {
+    private final static long BYTES_MAX = 2048;
+    private final static long KB_MAX = BYTES_MAX * 1024l;
+    private final static long MB_MAX = KB_MAX * 1024l;
+    private final static long GB_MAX = MB_MAX * 1024l;
+    private final static long TB_MAX = GB_MAX * 1024l;
+    private final static double KB_DIV = 1024;
+    private final static double MB_DIV = KB_DIV*1024d;
+    private final static double GB_DIV = MB_DIV*1024d;
+    private final static double TB_DIV = GB_DIV*1024d;
+    private NumberFormat dec2Format;
+    private String memoryCurrent;
+    private String memoryMost;
+    private String memoryAllocated;
+    private String upTime;
+
+    public DynamicServerInfo(long upTime) {
+        this.upTime = calculateTime(upTime);
+        memoryAllocated = memoryCurrent = memoryMost = "Unknown";
+    }
+
+    public DynamicServerInfo(long memoryCurrent, long memoryMost, long memoryAllocated, long upTime) {
+        dec2Format = NumberFormat.getNumberInstance();
+        dec2Format.setMaximumFractionDigits(2);
+        this.memoryCurrent = calculateMemory(memoryCurrent);
+        this.memoryMost = calculateMemory(memoryMost);
+        this.memoryAllocated = calculateMemory(memoryAllocated);
+        this.upTime = calculateTime(upTime);
+    }
+
+    private String calculateMemory(long bytes) {
+        if(bytes < BYTES_MAX) {
+            return bytes+" B";
+        } else if(bytes < KB_MAX) {
+            return dec2Format.format((double)bytes/KB_DIV)+" kB";
+        } else if(bytes < MB_MAX) {
+            return dec2Format.format((double)bytes/MB_DIV)+" MB";
+        } else if(bytes < GB_MAX) {
+            return dec2Format.format((double)bytes/GB_DIV)+" GB";
+        } else if(bytes < TB_MAX) {
+            return dec2Format.format((double)bytes/TB_DIV)+" TB";
+        } else {
+            return "Out of range";
+        }
+    }
+
+    private String calculateTime(long millis) {
+        int secs = (int)(millis/1000L);
+        int days = secs/86400;
+        secs = secs % 86400;
+        int hours = secs/3600;
+        secs = secs % 3600;
+        int minutes = secs / 60;
+        secs = secs % 60;
+        StringBuffer buf = new StringBuffer();
+        if(days > 1) {
+            buf.append(' ').append(days).append(" days");
+        } else if(days > 0) {
+            buf.append(' ').append(days).append(" day");
+        }
+        if(hours > 1) {
+            buf.append(' ').append(hours).append(" hours");
+        } else if(hours > 0) {
+            buf.append(' ').append(hours).append(" hour");
+        }
+        if(minutes > 1) {
+            buf.append(' ').append(minutes).append(" minutes");
+        } else if(minutes > 0) {
+            buf.append(' ').append(minutes).append(" minute");
+        }
+        if(secs > 1) {
+            buf.append(' ').append(secs).append(" seconds");
+        } else if(secs > 0) {
+            buf.append(' ').append(secs).append(" second");
+        }
+        buf.delete(0,1);
+        return buf.toString();
+    }
+
+    public String getMemoryCurrent() {
+        return memoryCurrent;
+    }
+
+    public String getMemoryMost() {
+        return memoryMost;
+    }
+
+    public String getMemoryAllocated() {
+        return memoryAllocated;
+    }
+
+    public String getUpTime() {
+        return upTime;
+    }
+}

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

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

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/Jsr77Lookup.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/Jsr77Lookup.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/Jsr77Lookup.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/jsr77/Jsr77Lookup.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.jsr77;
+
+import javax.servlet.http.HttpSession;
+import javax.management.j2ee.statistics.JVMStats;
+import javax.management.j2ee.statistics.BoundedRangeStatistic;
+import uk.ltd.getahead.dwr.ExecutionContext;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.util.ManagementHelper;
+import org.apache.geronimo.management.J2EEDomain;
+import org.apache.geronimo.management.StatisticsProvider;
+import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.geronimo.JVM;
+
+/**
+ * Looks up JSR-77 statistics in response to AJAX calls from portlets.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Jsr77Lookup {
+    public DynamicServerInfo getJavaVMStatistics() {
+        HttpSession session = ExecutionContext.get().getSession();
+        ManagementHelper helper = PortletManager.getManagementHelper(session);
+        J2EEDomain[] domains = helper.getDomains();
+        J2EEServer[] servers = helper.getServers(domains[0]);
+        JVM[] jvms = helper.getJavaVMs(servers[0]);
+        long elapsed = System.currentTimeMillis() - jvms[0].getKernelBootTime().getTime();
+        if(jvms[0].isStatisticsProvider()) {
+            JVMStats stats = (JVMStats) ((StatisticsProvider)jvms[0]).getStats();
+            BoundedRangeStatistic heap = stats.getHeapSize();
+            return new DynamicServerInfo(heap.getCurrent(), heap.getHighWaterMark(), heap.getUpperBound(), elapsed);
+        } else {
+            return new DynamicServerInfo(elapsed);
+        }
+    }
+}

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

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

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogManagerPortlet.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogManagerPortlet.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogManagerPortlet.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,94 @@
+/**
+ *
+ * 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.logmanager;
+
+import java.io.IOException;
+
+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 org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.system.logging.SystemLog;
+
+public class LogManagerPortlet extends BasePortlet {
+
+    protected PortletRequestDispatcher normalView;
+
+    protected PortletRequestDispatcher helpView;
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderRespose) throws PortletException, IOException {
+        helpView.include(renderRequest, renderRespose);
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderRespose) throws PortletException, IOException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
+        renderRequest.setAttribute("configFile", log.getConfigFileName());
+//        renderRequest.setAttribute("configuration", LogHelper.getConfiguration());
+        renderRequest.setAttribute("logLevel", log.getRootLoggerLevel());
+        renderRequest.setAttribute("refreshPeriod", new Integer(log.getRefreshPeriodSeconds()));
+
+        normalView.include(renderRequest, renderRespose);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        PortletContext pc = portletConfig.getPortletContext();
+        normalView = pc.getRequestDispatcher("/WEB-INF/view/logmanager/view.jsp");
+        helpView = pc.getRequestDispatcher("/WEB-INF/view/logmanager/help.jsp");
+        super.init(portletConfig);
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        SystemLog log = PortletManager.getCurrentSystemLog(actionRequest);
+
+        String action = actionRequest.getParameter("action");
+        String logLevel = actionRequest.getParameter("logLevel");
+        String configFile = actionRequest.getParameter("configFile");
+        String configuration = actionRequest.getParameter("append");
+        String refreshPeriod = actionRequest.getParameter("refreshPeriod");
+        String currentLevel = log.getRootLoggerLevel();
+
+        if ("update".equals(action)) {
+            if (refreshPeriod != null) {
+                int refreshPeriodInt = Integer.parseInt(refreshPeriod);
+                if (refreshPeriodInt != log.getRefreshPeriodSeconds()) {
+                    log.setRefreshPeriodSeconds(refreshPeriodInt);
+                }
+            }
+            if (!log.getConfigFileName().equals(configFile)) {
+                log.setConfigFileName(configFile);
+            }
+            if (!currentLevel.equals(logLevel)) {
+                log.setRootLoggerLevel(logLevel);
+            }
+        }
+    }
+}
\ No newline at end of file

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

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

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

Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java?rev=393787&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java Thu Apr 13 04:34:08 2006
@@ -0,0 +1,156 @@
+/**
+ *
+ * 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.logmanager;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.File;
+
+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 javax.portlet.PortletSession;
+
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.system.logging.SystemLog;
+
+public class LogViewerPortlet extends BasePortlet {
+    private final static String CRITERIA_KEY = "org.apache.geronimo.console.log.CRITERIA";
+
+    protected PortletRequestDispatcher searchView;
+
+    protected PortletRequestDispatcher helpView;
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderRespose) throws PortletException, IOException {
+        helpView.include(renderRequest, renderRespose);
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderRespose) throws PortletException, IOException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+        String action = renderRequest.getParameter("action");
+
+        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
+        String[] logFiles = log.getLogFileNames();
+        LogFile[] files = new LogFile[logFiles.length];
+        for (int i = 0; i < files.length; i++) {
+            files[i] = new LogFile(logFiles[i]);
+        }
+        Criteria criteria;
+        if ("refresh".equals(action)) {
+            criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY, PortletSession.PORTLET_SCOPE);
+        } else {
+            String startPos = renderRequest.getParameter("startPos");
+            String endPos = renderRequest.getParameter("endPos");
+            String maxRows = renderRequest.getParameter("maxRows");
+            String logLevel = renderRequest.getParameter("logLevel");
+            String searchString = renderRequest.getParameter("searchString");
+            String stackTraces = renderRequest.getParameter("stackTraces");
+            String logFile = renderRequest.getParameter("logFile");
+            if(logFile == null || logFile.equals("")) {
+                logFile = logFiles[0];
+            }
+            if(logLevel == null || logLevel.equals("")) {
+                logLevel = "WARN";
+            }
+            if(maxRows == null || maxRows.equals("")) {
+                maxRows = "10";
+            }
+            criteria = new Criteria();
+            criteria.max = Integer.parseInt(maxRows);
+            criteria.start = startPos == null || startPos.equals("") ? null : new Integer(startPos);
+            criteria.stop = endPos == null || endPos.equals("") ? null : new Integer(endPos);
+            criteria.logFile = logFile;
+            criteria.stackTraces = stackTraces != null && !stackTraces.equals("");
+            criteria.level = logLevel;
+            criteria.text = searchString == null || searchString.equals("") ? null : searchString;
+            renderRequest.getPortletSession(true).setAttribute(CRITERIA_KEY, criteria, PortletSession.PORTLET_SCOPE);
+        }
+
+        SystemLog.SearchResults results = log.getMatchingItems(criteria.logFile, criteria.start, criteria.stop,
+                        criteria.level, criteria.text, criteria.max, criteria.stackTraces);
+        renderRequest.setAttribute("searchResults", results.getResults());
+        renderRequest.setAttribute("lineCount", new Integer(results.getLineCount()));
+        renderRequest.setAttribute("startPos", criteria.start);
+        renderRequest.setAttribute("endPos", criteria.stop);
+        renderRequest.setAttribute("logLevel", criteria.level);
+        renderRequest.setAttribute("searchString", criteria.text);
+        renderRequest.setAttribute("maxRows", Integer.toString(criteria.max));
+        renderRequest.setAttribute("logFile", criteria.logFile);
+        renderRequest.setAttribute("logFiles", files);
+        if(criteria.stackTraces) {
+            renderRequest.setAttribute("stackTraces", Boolean.TRUE);
+        }
+        if(results.isCapped()) {
+            renderRequest.setAttribute("capped", Boolean.TRUE);
+        }
+
+        searchView.include(renderRequest, renderRespose);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        PortletContext pc = portletConfig.getPortletContext();
+        searchView = pc
+                .getRequestDispatcher("/WEB-INF/view/logmanager/search.jsp");
+        helpView = pc
+                .getRequestDispatcher("/WEB-INF/view/logmanager/viewhelp.jsp");
+        super.init(portletConfig);
+    }
+
+    private static class Criteria implements Serializable {
+        int max;
+        Integer start;
+        Integer stop;
+        String text;
+        String level;
+        String logFile;
+        boolean stackTraces;
+    }
+
+    public static class LogFile {
+        private String fullName;
+        private String name;
+
+        public LogFile(String fullName) {
+            this.fullName = fullName;
+            //todo: what if portla JVM has different separator than server JVM?
+            int pos = fullName.lastIndexOf(File.separatorChar);
+            if(pos > -1) {
+                name = fullName.substring(pos+1);
+            } else {
+                name = fullName;
+            }
+        }
+
+        public String getFullName() {
+            return fullName;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+}
\ No newline at end of file

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

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

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



Mime
View raw message