geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r219976 [5/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/databasemanager/DatabaseManagerHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,263 @@
+/**
+ *
+ * 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.databasemanager;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class DatabaseManagerHelper {
+    private final static File REPO_FOLDER;
+
+    private final static String PLAN_FILE;
+
+    private final static String MODULE_FILE;
+
+    private final static String TRANQL_RAR = "/tranql/rars/tranql-connector-1.0-SNAPSHOT.rar";
+
+    private final static String PLAN_XML = "/tranql/rars/datasourcePlan.xml";
+
+    private static final String LINE_SEP = System.getProperty("line.separator");
+
+    private static final String PLAN_TEMPLATE = getPlanTemplate();
+
+    // Deployer
+    private static final ObjectName DEPLOYER_NAME = JMXUtil
+            .getObjectName(ObjectNameConstants.DEPLOYER_OBJECT_NAME);
+
+    private static final String[] DEPLOYER_ARGS = { File.class.getName(),
+            File.class.getName() };
+
+    private static final String DEPLOY_METHOD = "deploy";
+
+    // Repository
+    private static final ObjectName REPO_NAME = JMXUtil
+            .getObjectName(ObjectNameConstants.REPO_OBJECT_NAME);
+
+    private static final String[] REPO_ARGS = { URI.class.getName() };
+
+    private static final String GETURL_METHOD = "getURL";
+
+    private List dependencies;
+
+    static {
+        // Initialize static vars
+        REPO_FOLDER = getRepositoryFile();
+        MODULE_FILE = REPO_FOLDER.getAbsolutePath() + TRANQL_RAR;
+        PLAN_FILE = REPO_FOLDER.getAbsolutePath() + PLAN_XML;
+    }
+
+    private static File getRepositoryFile() {
+        File repoFile = null;
+
+        try {
+            Kernel kernel = KernelRegistry.getSingleKernel();
+            URI uri = new URI(".");
+            URL rootURL = (URL) kernel.invoke(REPO_NAME, GETURL_METHOD,
+                    new Object[] { uri }, REPO_ARGS);
+            uri = new URI(rootURL.toString());
+            repoFile = new File(uri);
+        } catch (URISyntaxException e) {
+            System.out.println("ERROR: Invalid repository URL");
+            e.printStackTrace();
+        } catch (Exception e) {
+            System.out.println("ERROR: Problem getting repository location");
+            e.printStackTrace();
+        }
+
+        return repoFile;
+    }
+
+    private static String getPlanTemplate() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("<?xml version=\"1.0\"?>\n");
+        sb
+                .append("<connector xmlns=\"http://geronimo.apache.org/xml/ns/j2ee/connector\"\n");
+        sb.append("    version=\"1.5\" configId=\"{0}\" parentId=\"{1}\">\n");
+        sb.append("  <dependency>\n");
+        sb.append("    <uri>{2}</uri>\n");
+        sb.append("  </dependency>\n");
+        sb.append("  <resourceadapter>\n");
+        sb.append("    <outbound-resourceadapter>\n");
+        sb.append("      <connection-definition>\n");
+        sb
+                .append("        <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>\n");
+        sb.append("        <connectiondefinition-instance>\n");
+        sb.append("          <name>{3}</name>\n");
+        sb
+                .append("          <config-property-setting name=\"UserName\">{4}</config-property-setting>\n");
+        sb
+                .append("          <config-property-setting name=\"Password\">{5}</config-property-setting>\n");
+        sb
+                .append("          <config-property-setting name=\"Driver\">{6}</config-property-setting>\n");
+        sb
+                .append("          <config-property-setting name=\"ConnectionURL\">{7}</config-property-setting>\n");
+        sb.append("          <connectionmanager>\n");
+        sb.append("            <single-pool>\n");
+        sb.append("              <max-size>{8}</max-size>\n");
+        sb.append("              <min-size>{9}</min-size>\n");
+        sb.append("              <match-one/>\n");
+        sb.append("            </single-pool>\n");
+        sb.append("          </connectionmanager>\n");
+        sb.append("          <global-jndi-name>{10}</global-jndi-name>\n");
+        sb.append("        </connectiondefinition-instance>\n");
+        sb.append("      </connection-definition>\n");
+        sb.append("    </outbound-resourceadapter>\n");
+        sb.append("  </resourceadapter>\n");
+        sb.append("</connector>\n");
+
+        return sb.toString();
+    }
+
+    private void savePlan(String filename, Object[] args) {
+        MessageFormat mf = new MessageFormat(PLAN_TEMPLATE);
+        String plan = mf.format(args);
+
+        try {
+            File f = new File(filename);
+            f.createNewFile();
+            FileOutputStream fos = new FileOutputStream(f);
+            OutputStreamWriter osw = new OutputStreamWriter(fos);
+            Writer out = new BufferedWriter(osw);
+            out.write(plan);
+            out.flush();
+            out.close();
+            osw.close();
+            fos.close();
+        } catch (Exception e) {
+            System.out.println("ERROR: Problem creating the plan file");
+            e.printStackTrace();
+        }
+    }
+
+    public void deployPlan(Object[] args) {
+        savePlan(PLAN_FILE, args);
+        deployPlan(new File(MODULE_FILE), new File(PLAN_FILE));
+    }
+
+    public void deployPlan(File moduleFile, File planFile) {
+        try {
+            Kernel kernel = KernelRegistry.getSingleKernel();
+            List list = (List) kernel.invoke(DEPLOYER_NAME, DEPLOY_METHOD,
+                    new Object[] { moduleFile, planFile }, DEPLOYER_ARGS);
+            System.out.println("Deployed: " + moduleFile + " : " + planFile);
+            ConfigurationManager configurationManager = ConfigurationUtil
+                    .getConfigurationManager(kernel);
+            // start installed app/s
+            int size = list.size();
+            for (int i = 0; i < size; i++) {
+                String config = (String) list.get(i);
+                //URI configID = new URI(config);
+                //kernel.startConfiguration(configID);
+                ObjectName configName = null;
+                if (configurationManager.isLoaded(URI.create(config))) {
+                    configName = JMXUtil
+                            .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
+                                    + "\"" + config + "\"");
+                } else {
+                    configName = configurationManager.load(URI.create(config));
+                }
+                kernel.startRecursiveGBean(configName);
+            }
+        } catch (DeploymentException e) {
+            StringBuffer buf = new StringBuffer(256);
+            Throwable cause = e;
+            while (cause != null) {
+                buf.append(cause.getMessage());
+                buf.append(LINE_SEP);
+                cause = cause.getCause();
+            }
+            System.out
+                    .println("ERROR: Problem deploying the TranQL connector: "
+                            + buf.toString());
+            e.printStackTrace();
+        } catch (URISyntaxException e) {
+            System.out
+                    .println("ERROR: Newly installed app has invalid config ID");
+            e.printStackTrace();
+        } catch (Exception e) {
+            System.out.println("ERROR: Problem creating the datasource");
+            e.printStackTrace();
+        }
+    }
+
+    public List getDependencies() {
+        List dependencies = null;
+
+        try {
+            dependencies = getListing(REPO_FOLDER, REPO_FOLDER
+                    .getCanonicalPath());
+            Collections.sort(dependencies);
+        } catch (Exception e) {
+            System.out.println("ERROR: Problem getting dependencies");
+            e.printStackTrace();
+        }
+
+        return dependencies;
+    }
+
+    private List getListing(File dir, String basepath)
+            throws java.io.IOException {
+        if (dir == null) {
+            throw new IllegalArgumentException("directory argument is null");
+        }
+
+        if (!dir.isDirectory()) {
+            throw new IllegalArgumentException("directory argument expected");
+        }
+
+        List listing = new ArrayList();
+
+        List ls = Arrays.asList(dir.listFiles());
+        Iterator iter = ls.iterator();
+
+        while (iter.hasNext()) {
+            File f = (File) iter.next();
+
+            if (f.isDirectory()) {
+                List listing1 = getListing(f, basepath);
+                listing.addAll(listing1);
+            } else {
+                listing.add(f.getCanonicalPath().substring(
+                        basepath.length() + 1).replace('\\', '/'));
+            }
+        }
+        return listing;
+    }
+}
\ No newline at end of file

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,58 @@
+/**
+ *
+ * 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.databasemanager;
+
+import java.sql.Connection;
+
+import javax.portlet.PortletContext;
+import javax.sql.DataSource;
+
+import org.apache.geronimo.console.databasemanager.derby.DerbyConnectorRenderer;
+import org.apache.geronimo.console.databasemanager.mssql.MSSQLConnectorRenderer;
+import org.apache.geronimo.console.databasemanager.tranql.TranQLConnectorRenderer;
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+public class DatabaseManagerPortlet extends
+        AbstractConnectionFactoryManagerPortlet {
+
+    public DatabaseManagerPortlet() {
+        super(JMXUtil.getObjectName(ObjectNameConstants.JCA_MANAGED_CF_QUERY),
+                "/WEB-INF/view/databasemanager/normal.jsp",
+                "/WEB-INF/view/databasemanager/help.jsp", DataSource.class);
+    }
+
+    protected void setUpExplicitRenderers(PortletContext context) {
+        RENDERERS.put("org.tranql.connector.jdbc.JDBCDriverMCF",
+                new TranQLConnectorRenderer(kernel, context));
+        RENDERERS
+                .put(
+                        "org.apache.geronimo.derby.connector.DerbyXAManagedConnectionFactory",
+                        new DerbyConnectorRenderer(kernel, context));
+        RENDERERS
+                .put(
+                        "com.gluecode.se.mssql.connector.MSSQLXAManagedConnectionFactory",
+                        new MSSQLConnectorRenderer(kernel, context));
+    }
+
+    protected void testConnection(Object cf) throws Exception {
+        DataSource ds = (DataSource) cf;
+        Connection c = ds.getConnection();
+        c.close();
+    }
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DetailViewRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DetailViewRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DetailViewRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/DetailViewRenderer.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.databasemanager;
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+public interface DetailViewRenderer {
+    void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException;
+
+    void render(RenderRequest request, RenderResponse response,
+            ObjectName gbeanName) throws PortletException, IOException;
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerInfo.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerInfo.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerInfo.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,92 @@
+/**
+ *
+ * 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.databasemanager.connectionmanager;
+
+public class ConnectionManagerInfo {
+
+    private final int partitionCount;
+
+    private final int connectionCount;
+
+    private final int idleConnectionCount;
+
+    private final int partitionMaxSize;
+
+    private final int partitionMinSize;
+
+    private final int blockingTimeoutMilliseconds;
+
+    private final int idleTimeoutMinutes;
+
+    public ConnectionManagerInfo(int partitionCount, int connectionCount,
+            int idleConnectionCount, int partitionMaxSize,
+            int partitionMinSize, int blockingTimeoutMilliseconds,
+            int idleTimeoutMinutes) {
+        this.partitionCount = partitionCount;
+        this.connectionCount = connectionCount;
+        this.idleConnectionCount = idleConnectionCount;
+        this.partitionMaxSize = partitionMaxSize;
+        this.partitionMinSize = partitionMinSize;
+        this.blockingTimeoutMilliseconds = blockingTimeoutMilliseconds;
+        this.idleTimeoutMinutes = idleTimeoutMinutes;
+    }
+
+    public int getPartitionCount() {
+        return partitionCount;
+    }
+
+    public int getConnectionCount() {
+        return connectionCount;
+    }
+
+    public int getIdleConnectionCount() {
+        return idleConnectionCount;
+    }
+
+    public int getPartitionMaxSize() {
+        return partitionMaxSize;
+    }
+
+    public int getPartitionMinSize() {
+        return partitionMinSize;
+    }
+
+    public int getBlockingTimeoutMilliseconds() {
+        return blockingTimeoutMilliseconds;
+    }
+
+    public int getIdleTimeoutMinutes() {
+        return idleTimeoutMinutes;
+    }
+
+    public String toString() {
+        StringBuffer buff = new StringBuffer("ConnectionManagerInfo:\n");
+        buff.append("partitionCount: ").append(partitionCount).append("\n");
+        buff.append("connectionCount: ").append(connectionCount).append("\n");
+        buff.append("idleConnectionCount: ").append(idleConnectionCount)
+                .append("\n");
+        buff.append("partitionMaxSize: ").append(partitionMaxSize).append("\n");
+        buff.append("partitionMinSize: ").append(partitionMinSize).append("\n");
+        buff.append("blockingTimeoutMilliseconds: ").append(
+                blockingTimeoutMilliseconds).append("\n");
+        buff.append("idleTimeoutMinutes: ").append(idleTimeoutMinutes).append(
+                "\n");
+
+        return buff.toString();
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerRenderer.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,122 @@
+/**
+ *
+ * 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.databasemanager.connectionmanager;
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+
+public class ConnectionManagerRenderer {
+    private final Kernel kernel;
+
+    public ConnectionManagerRenderer(Kernel kernel) {
+        this.kernel = kernel;
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException {
+        if (!"detail".equals(actionRequest.getParameter("mode"))) {
+            try {
+                J2eeContext j2eeContext = J2eeContextImpl.newContext(gbeanName,
+                        NameFactory.JCA_RESOURCE);
+                ObjectName connectionManagerName = NameFactory
+                        .getComponentName(null, null, null, null, null, null,
+                                NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
+                Integer newPartitionMaxSize = Integer.decode(actionRequest
+                        .getParameter("partitionMaxSize"));
+                Integer oldPartitionMaxSize = (Integer) kernel.getAttribute(
+                        connectionManagerName, "partitionMaxSize");
+                if (!newPartitionMaxSize.equals(oldPartitionMaxSize)) {
+                    kernel.setAttribute(connectionManagerName,
+                            "partitionMaxSize", newPartitionMaxSize);
+                }
+                Integer newPartitionMinSize = Integer.decode(actionRequest
+                        .getParameter("partitionMinSize"));
+                Integer oldPartitionMinSize = (Integer) kernel.getAttribute(
+                        connectionManagerName, "partitionMinSize");
+                if (!newPartitionMinSize.equals(oldPartitionMinSize)) {
+                    kernel.setAttribute(connectionManagerName,
+                            "partitionMinSize", newPartitionMinSize);
+                }
+                Integer newblockingTimeoutMilliseconds = Integer
+                        .decode(actionRequest
+                                .getParameter("blockingTimeoutMilliseconds"));
+                Integer oldblockingTimeoutMilliseconds = (Integer) kernel
+                        .getAttribute(connectionManagerName,
+                                "blockingTimeoutMilliseconds");
+                if (!newblockingTimeoutMilliseconds
+                        .equals(oldblockingTimeoutMilliseconds)) {
+                    kernel.setAttribute(connectionManagerName,
+                            "blockingTimeoutMilliseconds",
+                            newblockingTimeoutMilliseconds);
+                }
+                Integer newidleTimeoutMinutes = Integer.decode(actionRequest
+                        .getParameter("idleTimeoutMinutes"));
+                Integer oldidleTimeoutMinutes = (Integer) kernel.getAttribute(
+                        connectionManagerName, "idleTimeoutMinutes");
+                if (!newidleTimeoutMinutes.equals(oldidleTimeoutMinutes)) {
+                    kernel.setAttribute(connectionManagerName,
+                            "idleTimeoutMinutes", newidleTimeoutMinutes);
+                }
+            } catch (Exception e) {
+                throw new PortletException(e);
+            }
+        }
+    }
+
+    public void addConnectionManagerInfo(RenderRequest request,
+            ObjectName gbeanName) throws PortletException, IOException {
+        J2eeContext j2eeContext = J2eeContextImpl.newContext(gbeanName,
+                NameFactory.JCA_RESOURCE);
+        ConnectionManagerInfo info = null;
+
+        try {
+            ObjectName connectionManagerName = NameFactory.getComponentName(
+                    null, null, null, null, null, null,
+                    NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
+            info = new ConnectionManagerInfo(((Integer) kernel.getAttribute(
+                    connectionManagerName, "partitionCount")).intValue(),
+                    ((Integer) kernel.getAttribute(connectionManagerName,
+                            "connectionCount")).intValue(), ((Integer) kernel
+                            .getAttribute(connectionManagerName,
+                                    "idleConnectionCount")).intValue(),
+                    ((Integer) kernel.getAttribute(connectionManagerName,
+                            "partitionMaxSize")).intValue(), ((Integer) kernel
+                            .getAttribute(connectionManagerName,
+                                    "partitionMinSize")).intValue(),
+                    ((Integer) kernel.getAttribute(connectionManagerName,
+                            "blockingTimeoutMilliseconds")).intValue(),
+                    ((Integer) kernel.getAttribute(connectionManagerName,
+                            "idleTimeoutMinutes")).intValue());
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+
+        request.setAttribute("connectionManagerInfo", info);
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/connectionmanager/ConnectionManagerRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyConnectorRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyConnectorRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyConnectorRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyConnectorRenderer.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.databasemanager.derby;
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.geronimo.console.databasemanager.DetailViewRenderer;
+import org.apache.geronimo.kernel.Kernel;
+
+public class DerbyConnectorRenderer implements DetailViewRenderer {
+    private final Kernel kernel;
+
+    private final PortletRequestDispatcher detailView;
+
+    private final PortletRequestDispatcher configView;
+
+    public DerbyConnectorRenderer(Kernel kernel, PortletContext context) {
+        this.kernel = kernel;
+        detailView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/derby/normal.jsp");
+        configView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/derby/config.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException {
+        String password1 = actionRequest.getParameter("password1");
+        if (!password1.equals(actionRequest.getParameter("password2"))) {
+            actionResponse.setRenderParameter("badPassword", "true");
+            actionResponse.setRenderParameter("mode", "config");
+        } else {
+            if (!"detail".equals(actionRequest.getParameter("mode"))) {
+                try {
+                    System.out.println("gbean = " + gbeanName.toString());
+                    kernel.setAttribute(gbeanName, "UserName", actionRequest
+                            .getParameter("UserName"));
+                    kernel.setAttribute(gbeanName, "Password", password1);
+                    kernel.setAttribute(gbeanName, "DatabaseName",
+                            actionRequest.getParameter("DatabaseName"));
+
+                    try {
+                        kernel.setAttribute(gbeanName, "LoginTimeout", Integer
+                                .valueOf(actionRequest
+                                        .getParameter("LoginTimeout")));
+                    } catch (NumberFormatException e) {
+                        // do nothing
+                    }
+                } catch (Exception e) {
+                    throw new PortletException(e);
+                }
+            }
+            actionResponse.setRenderParameter("mode", "detail");
+        }
+        actionResponse.setRenderParameter("name", actionRequest
+                .getParameter("name"));
+    }
+
+    public void render(RenderRequest request, RenderResponse response,
+            ObjectName gbeanName) throws PortletException, IOException {
+        request.setAttribute("badPassword", Boolean.valueOf(request
+                .getParameter("badPassword")));
+        DerbyInfo info = new DerbyInfo();
+        try {
+            info.setObjectName(gbeanName.toString());
+            info.setName(gbeanName.getKeyProperty("name"));
+            info.setUserName((String) kernel
+                    .getAttribute(gbeanName, "UserName"));
+            info.setDatabaseName((String) kernel.getAttribute(gbeanName,
+                    "DatabaseName"));
+            info.setCreateDatabase((String) kernel.getAttribute(gbeanName,
+                    "CreateDatabase"));
+            info.setLoginTimeout((Integer) kernel.getAttribute(gbeanName,
+                    "LoginTimeout"));
+            info.setJndiName((String) kernel.getAttribute(gbeanName,
+                    "globalJNDIName"));
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+        request.setAttribute("ds", info);
+        if ("config".equals(request.getParameter("mode"))) {
+            configView.include(request, response);
+        } else {
+            detailView.include(request, response);
+        }
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyConnectorRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyInfo.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyInfo.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyInfo.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,90 @@
+/**
+ *
+ * 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.databasemanager.derby;
+
+public class DerbyInfo {
+    private String objectName;
+
+    private String name;
+
+    private String jndiName;
+
+    private String databaseName;
+
+    private String userName;
+
+    private String createDatabase;
+
+    private Integer loginTimeout;
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getJndiName() {
+        return jndiName;
+    }
+
+    public void setJndiName(String jndiName) {
+        this.jndiName = jndiName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getDatabaseName() {
+        return databaseName;
+    }
+
+    public void setDatabaseName(String databaseName) {
+        this.databaseName = databaseName;
+    }
+
+    public String getCreateDatabase() {
+        return createDatabase;
+    }
+
+    public void setCreateDatabase(String createDatabase) {
+        this.createDatabase = createDatabase;
+    }
+
+    public Integer getLoginTimeout() {
+        return loginTimeout;
+    }
+
+    public void setLoginTimeout(Integer loginTimeout) {
+        this.loginTimeout = loginTimeout;
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/derby/DerbyInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/generic/ConnectorRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/generic/ConnectorRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/generic/ConnectorRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/generic/ConnectorRenderer.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,101 @@
+/**
+ *
+ * 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.databasemanager.generic;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.geronimo.console.databasemanager.DetailViewRenderer;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Kernel;
+
+public class ConnectorRenderer implements DetailViewRenderer {
+    private static final Set HIDDEN_ATTRIBUTES;
+
+    static {
+        HIDDEN_ATTRIBUTES = new HashSet();
+        HIDDEN_ATTRIBUTES.add("kernel");
+        HIDDEN_ATTRIBUTES.add("connectionImplClass");
+        HIDDEN_ATTRIBUTES.add("connectionInterface");
+        HIDDEN_ATTRIBUTES.add("connectionFactoryInterface");
+        HIDDEN_ATTRIBUTES.add("connectionFactoryImplClass");
+        HIDDEN_ATTRIBUTES.add("implementedInterfaces");
+        HIDDEN_ATTRIBUTES.add("managedConnectionFactoryClass");
+        HIDDEN_ATTRIBUTES.add("recoveryXAResources");
+    }
+
+    private final Kernel kernel;
+
+    private final PortletRequestDispatcher normalView;
+
+    private final PortletRequestDispatcher configView;
+
+    public ConnectorRenderer(Kernel kernel, PortletContext context) {
+        this.kernel = kernel;
+        normalView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/generic/normal.jsp");
+        configView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/generic/config.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void render(RenderRequest request, RenderResponse response,
+            ObjectName gbeanName) throws PortletException, IOException {
+        try {
+            GBeanInfo gbeanInfo = kernel.getGBeanInfo(gbeanName);
+            Set attributes = gbeanInfo.getAttributes();
+            Map values = new HashMap(attributes.size());
+            for (Iterator i = attributes.iterator(); i.hasNext();) {
+                GAttributeInfo attribute = (GAttributeInfo) i.next();
+                String name = attribute.getName();
+                if (HIDDEN_ATTRIBUTES.contains(name)) {
+                    continue;
+                }
+                Object value = kernel.getAttribute(gbeanName, name);
+                values.put(name, value);
+            }
+            request.setAttribute("attributeMap", values);
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+        if ("config".equals(request.getParameter("mode"))) {
+            configView.include(request, response);
+        } else {
+            normalView.include(request, response);
+        }
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/generic/ConnectorRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLConnectorRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLConnectorRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLConnectorRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLConnectorRenderer.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,107 @@
+/**
+ *
+ * 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.databasemanager.mssql;
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.geronimo.console.databasemanager.DetailViewRenderer;
+import org.apache.geronimo.kernel.Kernel;
+
+public class MSSQLConnectorRenderer implements DetailViewRenderer {
+    private final Kernel kernel;
+
+    private final PortletRequestDispatcher detailView;
+
+    private final PortletRequestDispatcher configView;
+
+    public MSSQLConnectorRenderer(Kernel kernel, PortletContext context) {
+        this.kernel = kernel;
+        detailView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/mssql/normal.jsp");
+        configView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/mssql/config.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException {
+        String password1 = actionRequest.getParameter("password1");
+        if (!password1.equals(actionRequest.getParameter("password2"))) {
+            actionResponse.setRenderParameter("badPassword", "true");
+            actionResponse.setRenderParameter("mode", "config");
+        } else {
+            if (!"detail".equals(actionRequest.getParameter("mode"))) {
+                try {
+                    kernel.setAttribute(gbeanName, "User", actionRequest
+                            .getParameter("user"));
+                    kernel.setAttribute(gbeanName, "Password", password1);
+                    kernel.setAttribute(gbeanName, "ServerName", actionRequest
+                            .getParameter("serverName"));
+                    kernel.setAttribute(gbeanName, "PortNumber", new Integer(
+                            actionRequest.getParameter("portNumber")));
+                    kernel.setAttribute(gbeanName, "DatabaseName",
+                            actionRequest.getParameter("databaseName"));
+                } catch (Exception e) {
+                    throw new PortletException(e);
+                }
+            }
+            actionResponse.setRenderParameter("mode", "detail");
+        }
+        actionResponse.setRenderParameter("name", actionRequest
+                .getParameter("name"));
+    }
+
+    public void render(RenderRequest request, RenderResponse response,
+            ObjectName gbeanName) throws PortletException, IOException {
+        request.setAttribute("badPassword", Boolean.valueOf(request
+                .getParameter("badPassword")));
+        MSSQLInfo info = new MSSQLInfo();
+        try {
+            info.setObjectName(gbeanName.toString());
+            info.setName(gbeanName.getKeyProperty("name"));
+            info.setUser((String) kernel.getAttribute(gbeanName, "User"));
+            info.setPassword((String) kernel
+                    .getAttribute(gbeanName, "Password"));
+            info.setServerName((String) kernel.getAttribute(gbeanName,
+                    "ServerName"));
+            info.setPortNumber(kernel.getAttribute(gbeanName, "PortNumber")
+                    .toString());
+            info.setDatabaseName((String) kernel.getAttribute(gbeanName,
+                    "DatabaseName"));
+            info.setGlobalJNDIName((String) kernel.getAttribute(gbeanName,
+                    "globalJNDIName"));
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+        request.setAttribute("ds", info);
+        if ("config".equals(request.getParameter("mode"))) {
+            configView.include(request, response);
+        } else {
+            detailView.include(request, response);
+        }
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLConnectorRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLInfo.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLInfo.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLInfo.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,209 @@
+/**
+ *
+ * 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.databasemanager.mssql;
+
+public class MSSQLInfo {
+    // Used
+    private String user;
+
+    private String password;
+
+    private String serverName;
+
+    private String portNumber;
+
+    private String databaseName;
+
+    private String globalJNDIName;
+
+    // Not used
+    private String objectName;
+
+    private String name;
+
+    private String driver;
+
+    private String connectionURL;
+
+    private String exceptionSorterClass;
+
+    /**
+     * @return Returns the connectionURL.
+     */
+    public String getConnectionURL() {
+        return connectionURL;
+    }
+
+    /**
+     * @param connectionURL
+     *            The connectionURL to set.
+     */
+    public void setConnectionURL(String connectionURL) {
+        this.connectionURL = connectionURL;
+    }
+
+    /**
+     * @return Returns the exceptionSorterClass.
+     */
+    public String getExceptionSorterClass() {
+        return exceptionSorterClass;
+    }
+
+    /**
+     * @param exceptionSorterClass
+     *            The exceptionSorterClass to set.
+     */
+    public void setExceptionSorterClass(String exceptionSorterClass) {
+        this.exceptionSorterClass = exceptionSorterClass;
+    }
+
+    /**
+     * @return Returns the databaseName.
+     */
+    public String getDatabaseName() {
+        return databaseName;
+    }
+
+    /**
+     * @param databaseName
+     *            The databaseName to set.
+     */
+    public void setDatabaseName(String databaseName) {
+        this.databaseName = databaseName;
+    }
+
+    /**
+     * @return Returns the globalJNDIName.
+     */
+    public String getGlobalJNDIName() {
+        return globalJNDIName;
+    }
+
+    /**
+     * @param globalJNDIName
+     *            The globalJNDIName to set.
+     */
+    public void setGlobalJNDIName(String globalJNDIName) {
+        this.globalJNDIName = globalJNDIName;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name
+     *            The name to set.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return Returns the objectName.
+     */
+    public String getObjectName() {
+        return objectName;
+    }
+
+    /**
+     * @param objectName
+     *            The objectName to set.
+     */
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+
+    /**
+     * @return Returns the password.
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    /**
+     * @param password
+     *            The password to set.
+     */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * @return Returns the portNumber.
+     */
+    public String getPortNumber() {
+        return portNumber;
+    }
+
+    /**
+     * @param portNumber
+     *            The portNumber to set.
+     */
+    public void setPortNumber(String portNumber) {
+        this.portNumber = portNumber;
+    }
+
+    /**
+     * @return Returns the serverName.
+     */
+    public String getServerName() {
+        return serverName;
+    }
+
+    /**
+     * @param serverName
+     *            The serverName to set.
+     */
+    public void setServerName(String serverName) {
+        this.serverName = serverName;
+    }
+
+    /**
+     * @return Returns the user.
+     */
+    public String getUser() {
+        return user;
+    }
+
+    /**
+     * @param user
+     *            The user to set.
+     */
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    /**
+     * @return Returns the driver.
+     */
+    public String getDriver() {
+        return driver;
+    }
+
+    /**
+     * @param driver
+     *            The driver to set.
+     */
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/mssql/MSSQLInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLConnectorRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLConnectorRenderer.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLConnectorRenderer.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLConnectorRenderer.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,105 @@
+/**
+ *
+ * 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.databasemanager.tranql;
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.geronimo.console.databasemanager.DetailViewRenderer;
+import org.apache.geronimo.kernel.Kernel;
+
+public class TranQLConnectorRenderer implements DetailViewRenderer {
+    private final Kernel kernel;
+
+    private final PortletRequestDispatcher detailView;
+
+    private final PortletRequestDispatcher configView;
+
+    public TranQLConnectorRenderer(Kernel kernel, PortletContext context) {
+        this.kernel = kernel;
+        detailView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/tranql/normal.jsp");
+        configView = context
+                .getRequestDispatcher("/WEB-INF/view/databasemanager/tranql/config.jsp");
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse, ObjectName gbeanName)
+            throws PortletException, IOException {
+        String password1 = actionRequest.getParameter("password1");
+        if (!password1.equals(actionRequest.getParameter("password2"))) {
+            actionResponse.setRenderParameter("badPassword", "true");
+            actionResponse.setRenderParameter("mode", "config");
+        } else {
+            if (!"detail".equals(actionRequest.getParameter("mode"))) {
+                try {
+                    kernel.setAttribute(gbeanName, "UserName", actionRequest
+                            .getParameter("UserName"));
+                    kernel.setAttribute(gbeanName, "Password", password1);
+                    kernel.setAttribute(gbeanName, "Driver", actionRequest
+                            .getParameter("Driver"));
+                    kernel.setAttribute(gbeanName, "ConnectionURL",
+                            actionRequest.getParameter("ConnectionURL"));
+                    kernel.setAttribute(gbeanName, "ExceptionSorterClass",
+                            actionRequest.getParameter("ExceptionSorterClass"));
+                } catch (Exception e) {
+                    throw new PortletException(e);
+                }
+            }
+            actionResponse.setRenderParameter("mode", "detail");
+        }
+        actionResponse.setRenderParameter("name", actionRequest
+                .getParameter("name"));
+    }
+
+    public void render(RenderRequest request, RenderResponse response,
+            ObjectName gbeanName) throws PortletException, IOException {
+        request.setAttribute("badPassword", Boolean.valueOf(request
+                .getParameter("badPassword")));
+        TranQLInfo info = new TranQLInfo();
+        try {
+            info.setObjectName(gbeanName.toString());
+            info.setName(gbeanName.getKeyProperty("name"));
+            info.setDriver((String) kernel.getAttribute(gbeanName, "Driver"));
+            info.setConnectionURL((String) kernel.getAttribute(gbeanName,
+                    "ConnectionURL"));
+            info.setUserName((String) kernel
+                    .getAttribute(gbeanName, "UserName"));
+            info.setExceptionSorterClass((String) kernel.getAttribute(
+                    gbeanName, "ExceptionSorterClass"));
+            info.setjndiName((String) kernel.getAttribute(gbeanName,
+                    "globalJNDIName"));
+        } catch (Exception e) {
+            throw new PortletException(e);
+        }
+        request.setAttribute("ds", info);
+        if ("config".equals(request.getParameter("mode"))) {
+            configView.include(request, response);
+        } else {
+            detailView.include(request, response);
+        }
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLConnectorRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLInfo.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLInfo.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLInfo.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,90 @@
+/**
+ *
+ * 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.databasemanager.tranql;
+
+public class TranQLInfo {
+    private String objectName;
+
+    private String name;
+
+    private String jndiName;
+
+    private String userName;
+
+    private String driver;
+
+    private String connectionURL;
+
+    private String exceptionSorterClass;
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getjndiName() {
+        return jndiName;
+    }
+
+    public void setjndiName(String jndiName) {
+        this.jndiName = jndiName;
+    }
+
+    public String getDriver() {
+        return driver;
+    }
+
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+
+    public String getConnectionURL() {
+        return connectionURL;
+    }
+
+    public void setConnectionURL(String connectionURL) {
+        this.connectionURL = connectionURL;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getExceptionSorterClass() {
+        return exceptionSorterClass;
+    }
+
+    public void setExceptionSorterClass(String exceptionSorterClass) {
+        this.exceptionSorterClass = exceptionSorterClass;
+    }
+}

Propchange: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/databasemanager/tranql/TranQLInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogHelper.java Wed Jul 20 18:38:12 2005
@@ -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.derbylogmanager;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Stack;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.console.util.KernelHelper;
+import org.apache.geronimo.console.util.ObjectNameConstants;
+
+public class DerbyLogHelper extends KernelHelper {
+    private static ObjectName objName;
+
+    private static ArrayList logs = new ArrayList();
+
+    private static boolean cached = false;
+
+    private static int lineCount = 0;
+
+    private static final String DATE_PATTERN_REGEX = "2004";
+
+    private static final String DERBY_SYSTEM_HOME = "derby.system.home";
+
+    private static final String DERBY_SYS_HOME_PROP = "derbySystemHome";
+
+    private static final String LOG_FILENAME = "derby.log";
+
+    public static Collection getLogs() throws IOException {
+        if (!cached) {
+            refresh();
+        }
+        return logs;
+    }
+
+    public static void refresh() throws IOException {
+        cached = false;
+        logs.clear();
+        BufferedReader in = new BufferedReader(getFileReader());
+        lineCount = 0;
+        Stack holder = new Stack();
+        for (String line = in.readLine(); line != null; line = in.readLine()) {
+            holder.push(line);
+            lineCount++;
+        }
+        logs.addAll(holder);
+        cached = true;
+    }
+
+    public static int getLineCount() {
+        return lineCount;
+    }
+
+    private static InputStreamReader getFileReader() throws IOException {
+        String pathToFile = getSystemHome() + File.separator + LOG_FILENAME;
+        return new FileReader(new File(pathToFile));
+    }
+
+    public static String getSystemHome() {
+        return System.getProperty(DERBY_SYSTEM_HOME);
+    }
+
+    static {
+        try {
+            objName = new ObjectName(ObjectNameConstants.DERBY_OBJECT_NAME);
+        } catch (MalformedObjectNameException e) {
+
+        }
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,75 @@
+/**
+ *
+ * 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.derbylogmanager;
+
+import java.io.IOException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+public class DerbyLogViewerPortlet extends GenericPortlet {
+
+    protected PortletRequestDispatcher normalView;
+
+    protected PortletRequestDispatcher helpView;
+
+    public void destroy() {
+        super.destroy();
+        normalView = null;
+        helpView = null;
+    }
+
+    protected void doHelp(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    protected void doView(RenderRequest renderRequest,
+            RenderResponse renderResponse) throws PortletException, IOException {
+        String action = renderRequest.getParameter("action");
+        if ("refresh".equals(action)) {
+            DerbyLogHelper.refresh();
+        }
+        try {
+            renderRequest.setAttribute("logs", DerbyLogHelper.getLogs());
+            renderRequest.setAttribute("lines", new Integer(DerbyLogHelper
+                    .getLineCount()));
+            normalView.include(renderRequest, renderResponse);
+        } catch (Exception e) {
+            renderResponse.setContentType("text/html");
+            renderResponse.getWriter().println(
+                    "<b>Could not load portlet: " + e.getMessage()
+                            + "</b></br>");
+            throw new PortletException(e);
+        }
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        PortletContext pc = portletConfig.getPortletContext();
+        normalView = pc
+                .getRequestDispatcher("/WEB-INF/view/derbylogmanager/view.jsp");
+        helpView = pc
+                .getRequestDispatcher("/WEB-INF/view/derbylogmanager/help.jsp");
+        super.init(portletConfig);
+    }
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,120 @@
+/**
+ *
+ * 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.infomanager;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+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;
+
+public class JavaSystemInfoPortlet extends GenericPortlet {
+
+    private static final String NORMALVIEW_JSP = "/WEB-INF/view/infomanager/javaSysNormal.jsp";
+
+    private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/infomanager/javaSysMaximized.jsp";
+
+    private static final String HELPVIEW_JSP = "/WEB-INF/view/infomanager/javaSysHelp.jsp";
+
+    private static Map javaSysProps;
+
+    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;
+        }
+
+        javaSysProps = System.getProperties();
+        renderRequest.setAttribute("javaSysProps", javaSysProps);
+
+        String sep = (String) javaSysProps.get("path.separator");
+
+        String cp = (String) javaSysProps.get("sun.boot.class.path");
+        if (cp != null) {
+            renderRequest.setAttribute("bootClassPathList", split(cp, sep));
+        }
+        cp = (String) javaSysProps.get("java.library.path");
+        if (cp != null) {
+            renderRequest.setAttribute("javaLibraryPath", split(cp, sep));
+        }
+        cp = (String) javaSysProps.get("java.class.path");
+        if (cp != null) {
+            renderRequest.setAttribute("javaClassPath", split(cp, sep));
+        }
+
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+
+    private List split(String path, String sep) {
+        StringTokenizer st = new StringTokenizer(path, sep);
+
+        List l = new ArrayList();
+
+        while (st.hasMoreTokens()) {
+            l.add(st.nextToken());
+        }
+        return l;
+    }
+
+    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(
+                NORMALVIEW_JSP);
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
+                MAXIMIZEDVIEW_JSP);
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                HELPVIEW_JSP);
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        helpView = null;
+        super.destroy();
+    }
+
+}
\ No newline at end of file

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/ServerInfoPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/ServerInfoPortlet.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/ServerInfoPortlet.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/infomanager/ServerInfoPortlet.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,235 @@
+/**
+ *
+ * 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.infomanager;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+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.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+
+public class ServerInfoPortlet extends GenericPortlet {
+
+    public static final String SVRINFO_BASEDIR = "baseDirectory";
+
+    public static final String SVRINFO_VERSION = "version";
+
+    public static final String SVRINFO_BUILDDATE = "buildDate";
+
+    public static final String SVRINFO_BUILDTIME = "buildTime";
+
+    public static final String SVRINFO_COPYRIGHT = "copyright";
+
+    public static final String SVRINFO_PLATFORMARCH = "platformArch";
+
+    public static final String SVRINFO_GERONIMO_BUILD_VERSION = "geronimoBuildVersion";
+
+    public static final String SVRINFO_GERONIMO_SPEC_VERSION = "geronimoSpecVersion";
+
+    public static final String SVRINFO_PORTAL_CORE_VERSION = "portalCoreVersion";
+
+    public static final String JVMIMPL_JAVAVER = "javaVersion";
+
+    public static final String JVMIMPL_JAVAVENDOR = "javaVendor";
+
+    public static final String JVMIMPL_NODE = "node";
+
+    public static final String JVMIMPL_FREEMEM = "freeMemory";
+
+    public static final String JVMIMPL_MAXMEM = "maxMemory";
+
+    public static final String JVMIMPL_TOTALMEM = "totalMemory";
+
+    public static final String JVMIMPL_AVAILABLEPROCS = "availableProcessors";
+
+    private static final String NORMALVIEW_JSP = "/WEB-INF/view/infomanager/svrInfoNormal.jsp";
+
+    private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/infomanager/svrInfoMaximized.jsp";
+
+    private static final String HELPVIEW_JSP = "/WEB-INF/view/infomanager/svrInfoHelp.jsp";
+
+    private static Map svrProps = new HashMap();
+
+    private static Map jvmProps = new HashMap();
+
+    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;
+        }
+
+        try {
+            Object o = null;
+
+            // Kernel boot time
+            Date bootDate = kernel.getBootTime();
+            long bootTime = bootDate.getTime() / 1000;
+            long currentTime = System.currentTimeMillis() / 1000;
+            long elapsedTime = currentTime - bootTime;
+            svrProps.put("Kernel Boot Time", bootDate);
+            svrProps.put("Kernel Up Time", calcElapsedTime(elapsedTime));
+
+            // Server info
+            /*
+             * ObjectName svrInfo = new
+             * ObjectName(ObjectNameConstants.SERVER_INFO_OBJECT_NAME); o =
+             * kernel.getAttribute(svrInfo, SVRINFO_BASEDIR); svrProps.put("Base
+             * Directory", o); ObjectName joeSvrInfo = new
+             * ObjectName(ObjectNameConstants.SE_SERVER_INFO_NAME); o =
+             * kernel.getAttribute(joeSvrInfo, SVRINFO_PLATFORMARCH);
+             * svrProps.put("Platform Architecture", o); o =
+             * kernel.getAttribute(joeSvrInfo, SVRINFO_VERSION);
+             * svrProps.put("Version", o); o = kernel.getAttribute(joeSvrInfo,
+             * SVRINFO_GERONIMO_BUILD_VERSION); svrProps.put("Apache Geronimo
+             * Build Version", o); o = kernel.getAttribute(joeSvrInfo,
+             * SVRINFO_GERONIMO_SPEC_VERSION); svrProps.put("J2EE Specifications
+             * Version", o); o = kernel.getAttribute(joeSvrInfo,
+             * SVRINFO_PORTAL_CORE_VERSION); svrProps.put("JSR 168 Portal
+             * Version", o); o = kernel.getAttribute(joeSvrInfo,
+             * SVRINFO_BUILDDATE); svrProps.put("Build Date", o); o =
+             * kernel.getAttribute(joeSvrInfo, SVRINFO_BUILDTIME);
+             * svrProps.put("Build Time", o); o =
+             * kernel.getAttribute(joeSvrInfo, SVRINFO_COPYRIGHT);
+             * svrProps.put("Copyright", o);
+             */
+            renderRequest.setAttribute("svrProps", svrProps);
+
+            // JVM info
+            ObjectName jvmImpl = new ObjectName(
+                    ObjectNameConstants.JVM_IMPL_NAME);
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_JAVAVER);
+            jvmProps.put("Java Version", o);
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_JAVAVENDOR);
+            jvmProps.put("Java Vendor", o);
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_NODE);
+            jvmProps.put("Node", o);
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_MAXMEM);
+            jvmProps.put("Max Memory", calcMemory((Long) o));
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_TOTALMEM);
+            jvmProps.put("Total Memory", calcMemory((Long) o));
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_FREEMEM);
+            jvmProps.put("Free Memory", calcMemory((Long) o));
+            o = kernel.getAttribute(jvmImpl, JVMIMPL_AVAILABLEPROCS);
+            jvmProps.put("Available Processors", o);
+            renderRequest.setAttribute("jvmProps", jvmProps);
+        } catch (Exception e) {
+            e.printStackTrace();
+            //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(
+                NORMALVIEW_JSP);
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
+                MAXIMIZEDVIEW_JSP);
+        helpView = portletConfig.getPortletContext().getRequestDispatcher(
+                HELPVIEW_JSP);
+    }
+
+    public void destroy() {
+        kernel = null;
+        normalView = null;
+        maximizedView = null;
+        helpView = null;
+        super.destroy();
+    }
+
+    public static Map getServerInfo() {
+        return svrProps;
+    }
+
+    public static Map getJVMInfo() {
+        return jvmProps;
+    }
+
+    private String calcElapsedTime(long timeInSeconds) {
+        long days, hrs, mins, secs;
+        days = timeInSeconds / 86400;
+        timeInSeconds = timeInSeconds - (days * 86400);
+        hrs = timeInSeconds / 3600;
+        timeInSeconds = timeInSeconds - (hrs * 3600);
+        mins = timeInSeconds / 60;
+        timeInSeconds = timeInSeconds - (mins * 60);
+        secs = timeInSeconds;
+
+        StringBuffer sb = new StringBuffer();
+        sb.append(days);
+        sb.append(" day(s) ");
+        sb.append(hrs);
+        sb.append(" hour(s) ");
+        sb.append(mins);
+        sb.append(" minute(s) ");
+        sb.append(secs);
+        sb.append(" second(s)");
+
+        return sb.toString();
+    }
+
+    private String calcMemory(Long memory) {
+        long mb, kb;
+        long mem = memory.longValue();
+        mb = mem / 1048576;
+        // If less than 10MB return as KB
+        if (mb < 10) {
+            kb = mem / 1024;
+            return kb + "KB";
+        }
+        return mb + "MB";
+    }
+
+}

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

Added: geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java?rev=219976&view=auto
==============================================================================
--- geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java (added)
+++ geronimo/trunk/sandbox/console-standard/src/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java Wed Jul 20 18:38:12 2005
@@ -0,0 +1,134 @@
+/**
+ *
+ * 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.internaldb;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Vector;
+
+public class DBViewerHelper {
+
+    private static final String SYS_TBL_PREFIX = "SYS.";
+
+    private static final int COUNT_COL = 1;
+
+    /**
+     * List the databases given the derby home directory.
+     *
+     * @param derbySysHome
+     * @return
+     */
+    public Collection getDerbyDatabases(String derbySysHome) {
+        Vector databases = new Vector();
+        File f = new File(derbySysHome);
+        // Check if this is a directory
+        if (f.isDirectory()) {
+            // Check for folders only
+            File[] files = f.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                if (files[i].isDirectory()) {
+                    databases.add(files[i].getName());
+                }
+            }
+        }
+
+        return databases;
+    }
+
+    /**
+     * @param derbySysHome
+     * @param dbName
+     * @return
+     */
+    public boolean isDBValid(String derbySysHome, String dbName) {
+        if ((derbySysHome == null) || (derbySysHome.trim().length() == 0)) {
+            return false;
+        }
+        if ((dbName == null) || (dbName.trim().length() == 0)) {
+            return false;
+        }
+
+        Collection databases = getDerbyDatabases(derbySysHome);
+        return databases.contains(dbName);
+    }
+
+    /**
+     * @param dbName
+     * @param tblName
+     * @return
+     */
+    public boolean isTblValid(String dbName, String tblName) {
+        if ((dbName == null) || (dbName.trim().length() == 0)) {
+            return false;
+        }
+        if ((tblName == null) || (tblName.trim().length() == 0)) {
+            return false;
+        }
+        return true;
+
+        // Removed this code because it doesn't seem necessary and causes a
+        // weird ClassCastException when rs.next() is called.
+        /*
+         else {
+         if (tblName.toUpperCase().startsWith(SYS_TBL_PREFIX)) {
+         tblName = tblName.substring(SYS_TBL_PREFIX.length());
+         }
+         }
+
+         Connection conn = null;
+         PreparedStatement ps = null;
+         ResultSet rs = null;
+         try {
+         conn = DerbyConnectionUtil.getDerbyConnection(dbName);
+         ps = conn.prepareStatement("SELECT count(*) FROM SYS.SYSTABLES"
+         + " WHERE tablename=?");
+         ps.setString(1, tblName.toUpperCase());
+         rs = ps.executeQuery();
+         if (rs.next()) {
+         int count = rs.getInt(COUNT_COL);
+         if (count == 1) {
+         return true;
+         }
+         }
+         } catch (Throwable e) {
+         e.printStackTrace();
+         System.out.println("ERROR: " + e.getMessage());
+         // Assume table is not valid
+         return false;
+         } finally {
+         // close DB connection
+         try {
+         if (rs != null) {
+         rs.close();
+         }
+         if (ps != null) {
+         ps.close();
+         }
+         if (conn != null) {
+         conn.close();
+         }
+         } catch (SQLException e) {
+         // problem closing DB connection
+         }
+         }
+
+         return false;
+         */
+    }
+
+}

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



Mime
View raw message