geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r331239 [1/2] - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-ear/src/plan/ applications/console-framework/src/webapp/WEB-INF/data/ applications/console-standard/ applications/...
Date Mon, 07 Nov 2005 08:13:00 GMT
Author: ammulder
Date: Mon Nov  7 00:12:29 2005
New Revision: 331239

URL: http://svn.apache.org/viewcvs?rev=331239&view=rev
Log:
Revised database pool portlet with more of a wizard-style interface
  and using the management API and JSR-88 for configuration and
  deployment.  GERONIMO-1138.
Add repositories and JSR-88 to the management API.
  Use a fancier repository rather than direct filesystem access
  to deal with database driver JARs, etc.
Reduce per-web-page logging a bit.

Added:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/testConnection.jsp   (with props)
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/LocalDeploymentManager.java   (with props)
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java   (with props)
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java   (with props)
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java   (with props)
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java   (with props)
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/FileSystemRepository.java   (with props)
Modified:
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
    geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml
    geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
    geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
    geronimo/trunk/applications/console-standard/project.xml
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
    geronimo/trunk/modules/assembly/project.xml
    geronimo/trunk/modules/assembly/src/plan/system-plan.xml
    geronimo/trunk/modules/assembly/src/plan/webconsole-jetty-plan.xml
    geronimo/trunk/modules/assembly/src/plan/webconsole-tomcat-plan.xml
    geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_5DConfigBeanTest.java
    geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
    geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
    geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java Mon Nov  7 00:12:29 2005
@@ -22,7 +22,6 @@
 import javax.management.ObjectName;
 import javax.management.MalformedObjectNameException;
 
-import org.apache.geronimo.management.geronimo.*;
 import org.apache.geronimo.management.J2EEDomain;
 import org.apache.geronimo.management.J2EEDeployedObject;
 import org.apache.geronimo.management.AppClientModule;
@@ -40,11 +39,24 @@
 import org.apache.geronimo.management.JDBCDataSource;
 import org.apache.geronimo.management.JDBCDriver;
 import org.apache.geronimo.management.JCAConnectionFactory;
-import org.apache.geronimo.management.JCAManagedConnectionFactory;
+import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.geronimo.J2EEApplication;
+import org.apache.geronimo.management.geronimo.JVM;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.management.geronimo.WebAccessLog;
+import org.apache.geronimo.management.geronimo.EJBManager;
+import org.apache.geronimo.management.geronimo.EJBConnector;
+import org.apache.geronimo.management.geronimo.JMSManager;
+import org.apache.geronimo.management.geronimo.JMSBroker;
+import org.apache.geronimo.management.geronimo.JMSConnector;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
 import org.apache.geronimo.j2ee.management.impl.Util;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.pool.GeronimoExecutor;
@@ -192,6 +204,89 @@
         return (ResourceAdapterModule[]) list.toArray(new ResourceAdapterModule[list.size()]);
     }
 
+    public JCAManagedConnectionFactory[] getOutboundFactories(J2EEServer server, String connectionFactoryInterface) {
+        List list = new ArrayList();
+        try {
+            String[] names = server.getDeployedObjects();
+            for (int i = 0; i < names.length; i++) {
+                ObjectName name = ObjectName.getInstance(names[i]);
+                String type = name.getKeyProperty(NameFactory.J2EE_TYPE);
+                if(type.equals(NameFactory.RESOURCE_ADAPTER_MODULE)) {
+                    ResourceAdapterModule module = (ResourceAdapterModule) pm.createProxy(name, KernelManagementHelper.class.getClassLoader());
+                    ResourceAdapter[] adapters = getResourceAdapters(module);
+                    for (int j = 0; j < adapters.length; j++) {
+                        ResourceAdapter adapter = adapters[j];
+                        JCAResource[] resources = getRAResources(adapter);
+                        for (int k = 0; k < resources.length; k++) {
+                            JCAResource resource = resources[k];
+                            JCAConnectionFactory[] factories = getConnectionFactories(resource);
+                            for (int l = 0; l < factories.length; l++) {
+                                JCAConnectionFactory factory = factories[l];
+                                JCAManagedConnectionFactory mcf = getManagedConnectionFactory(factory);
+                                if(mcf.getConnectionFactoryInterface().equals(connectionFactoryInterface)) {
+                                    list.add(mcf);
+                                    continue;
+                                }
+                                for (int m = 0; m < mcf.getImplementedInterfaces().length; m++) {
+                                    String iface = mcf.getImplementedInterfaces()[m];
+                                    if(iface.equals(connectionFactoryInterface)) {
+                                        list.add(mcf);
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("Unable to look up related GBean", e);
+        }
+        return (JCAManagedConnectionFactory[]) list.toArray(new JCAManagedConnectionFactory[list.size()]);
+    }
+
+    public ResourceAdapterModule[] getOutboundRAModules(J2EEServer server, String connectionFactoryInterface) {
+        List list = new ArrayList();
+        try {
+            String[] names = server.getDeployedObjects();
+            for (int i = 0; i < names.length; i++) {
+                ObjectName name = ObjectName.getInstance(names[i]);
+                String type = name.getKeyProperty(NameFactory.J2EE_TYPE);
+                if(type.equals(NameFactory.RESOURCE_ADAPTER_MODULE)) {
+                    ResourceAdapterModule module = (ResourceAdapterModule) pm.createProxy(name, KernelManagementHelper.class.getClassLoader());
+                    ResourceAdapter[] adapters = getResourceAdapters(module);
+                    outer:
+                    for (int j = 0; j < adapters.length; j++) {
+                        ResourceAdapter adapter = adapters[j];
+                        JCAResource[] resources = getRAResources(adapter);
+                        for (int k = 0; k < resources.length; k++) {
+                            JCAResource resource = resources[k];
+                            JCAConnectionFactory[] factories = getConnectionFactories(resource);
+                            for (int l = 0; l < factories.length; l++) {
+                                JCAConnectionFactory factory = factories[l];
+                                JCAManagedConnectionFactory mcf = getManagedConnectionFactory(factory);
+                                if(mcf.getConnectionFactoryInterface().equals(connectionFactoryInterface)) {
+                                    list.add(module);
+                                    break outer;
+                                }
+                                for (int m = 0; m < mcf.getImplementedInterfaces().length; m++) {
+                                    String iface = mcf.getImplementedInterfaces()[m];
+                                    if(iface.equals(connectionFactoryInterface)) {
+                                        list.add(module);
+                                        break outer;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("Unable to look up related GBean", e);
+        }
+        return (ResourceAdapterModule[]) list.toArray(new ResourceAdapterModule[list.size()]);
+    }
+
     public J2EEResource[] getResources(J2EEServer server) {
         J2EEResource[] result = new J2EEResource[0];
         try {
@@ -237,7 +332,20 @@
             result = new JVM[temp.length];
             System.arraycopy(temp, 0, result, 0, temp.length);
         } catch (Exception e) {
-            log.error("Unable to look up related GBean", e);
+            log.error("Unable to look up JVMs for J2EEServer", e);
+        }
+        return result;
+    }
+
+    public Repository[] getRepositories(J2EEServer server) {
+        Repository[] result = new Repository[0];
+        try {
+            String[] names = server.getRepositories();
+            Object[] temp = pm.createProxies(names, KernelManagementHelper.class.getClassLoader());
+            result = new Repository[temp.length];
+            System.arraycopy(temp, 0, result, 0, temp.length);
+        } catch (Exception e) {
+            log.error("Unable to look up repositories for J2EEServer", e);
         }
         return result;
     }
@@ -250,7 +358,7 @@
             result = new WebManager[temp.length];
             System.arraycopy(temp, 0, result, 0, temp.length);
         } catch (Exception e) {
-            log.error("Unable to look up related GBean", e);
+            log.error("Unable to look up WebManagers for J2EEServer", e);
         }
         return result;
     }
@@ -623,13 +731,31 @@
         return new Servlet[0];  //todo
     }
 
-    public ResourceAdapter getResourceAdapters(ResourceAdapterModule module) {
-        return null;  //todo
+    public ResourceAdapter[] getResourceAdapters(ResourceAdapterModule module) {
+        ResourceAdapter[] result = new ResourceAdapter[0];
+        try {
+            String[] names = module.getResourceAdapters();
+            Object[] temp = pm.createProxies(names, KernelManagementHelper.class.getClassLoader());
+            result = new ResourceAdapter[temp.length];
+            System.arraycopy(temp, 0, result, 0, temp.length);
+        } catch (Exception e) {
+            log.error("Unable to look up resource adapters for module", e);
+        }
+        return result;
     }
 
     // resource adapter properties
     public JCAResource[] getRAResources(ResourceAdapter adapter) {
-        return new JCAResource[0];  //todo
+        JCAResource[] result = new JCAResource[0];
+        try {
+            String[] names = adapter.getJCAResources();
+            Object[] temp = pm.createProxies(names, KernelManagementHelper.class.getClassLoader());
+            result = new JCAResource[temp.length];
+            System.arraycopy(temp, 0, result, 0, temp.length);
+        } catch (Exception e) {
+            log.error("Unable to look up JCA resources for resource adapter", e);
+        }
+        return result;
     }
 
     // resource properties
@@ -642,11 +768,26 @@
     }
 
     public JCAConnectionFactory[] getConnectionFactories(JCAResource resource) {
-        return new JCAConnectionFactory[0];  //todo
+        JCAConnectionFactory[] result = new JCAConnectionFactory[0];
+        try {
+            String[] names = resource.getConnectionFactories();
+            Object[] temp = pm.createProxies(names, KernelManagementHelper.class.getClassLoader());
+            result = new JCAConnectionFactory[temp.length];
+            System.arraycopy(temp, 0, result, 0, temp.length);
+        } catch (Exception e) {
+            log.error("Unable to look up connection factories for JCA resource", e);
+        }
+        return result;
     }
 
     public JCAManagedConnectionFactory getManagedConnectionFactory(JCAConnectionFactory factory) {
-        return null;  //todo
+        try {
+            String name = factory.getManagedConnectionFactory();
+            return (JCAManagedConnectionFactory) pm.createProxy(ObjectName.getInstance(name), KernelManagementHelper.class.getClassLoader());
+        } catch (Exception e) {
+            log.error("Unable to look up managed connection factory for connection factory", e);
+            return null;
+        }
     }
 
     public Object getObject(String objectName) {

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java Mon Nov  7 00:12:29 2005
@@ -30,13 +30,13 @@
 import org.apache.geronimo.management.JDBCDataSource;
 import org.apache.geronimo.management.JDBCDriver;
 import org.apache.geronimo.management.JCAConnectionFactory;
-import org.apache.geronimo.management.JCAManagedConnectionFactory;
 import org.apache.geronimo.management.EJB;
 import org.apache.geronimo.management.Servlet;
 import org.apache.geronimo.management.ResourceAdapter;
 import org.apache.geronimo.management.geronimo.*;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.kernel.repository.Repository;
 
 /**
  * A helper interface to navigate between management objects.  This is not
@@ -59,11 +59,14 @@
     WebModule[] getWebModules(J2EEServer server);
     EJBModule[] getEJBModules(J2EEServer server);
     ResourceAdapterModule[] getRAModules(J2EEServer server);
+    ResourceAdapterModule[] getOutboundRAModules(J2EEServer server, String connectionFactoryInterface);
+    JCAManagedConnectionFactory[] getOutboundFactories(J2EEServer server, String connectionFactoryInterface);
     J2EEResource[] getResources(J2EEServer server);
     JCAResource[] getJCAResources(J2EEServer server);
     JDBCResource[] getJDBCResources(J2EEServer server);
     JMSResource[] getJMSResources(J2EEServer server);
     JVM[] getJavaVMs(J2EEServer server);
+    Repository[] getRepositories(J2EEServer server);
     WebManager[] getWebManagers(J2EEServer server);
     WebAccessLog getWebAccessLog(WebManager manager, WebContainer container);
     WebAccessLog getWebAccessLog(WebManager manager, String containerObjectName);
@@ -108,7 +111,7 @@
     // module properties
     EJB[] getEJBs(EJBModule module);
     Servlet[] getServlets(WebModule module);
-    ResourceAdapter getResourceAdapters(ResourceAdapterModule module);
+    ResourceAdapter[] getResourceAdapters(ResourceAdapterModule module);
 
     // resource adapter properties
     JCAResource[] getRAResources(ResourceAdapter adapter);

Modified: geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml (original)
+++ geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml Mon Nov  7 00:12:29 2005
@@ -20,6 +20,47 @@
         <artifactId>geronimo-console-core</artifactId>
         <version>${geronimo_version}</version>
     </dependency>
+    <!-- The following are for configuration and deployment via JSR-88 -->
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-test-ddbean</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-deploy-jsr88</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-deploy-config</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-service-builder</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-connector-builder</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-j2ee-schema</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>xmlbeans</groupId>
+        <artifactId>xbean</artifactId>
+        <version>${xmlbeans_version}</version>
+    </dependency>
+    <dependency>
+        <groupId>stax</groupId>
+        <artifactId>stax-api</artifactId>
+        <version>${stax_api_version}</version>
+    </dependency>
 
     <!-- Keystore dependency -->
     <dependency>

Modified: geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml (original)
+++ geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml Mon Nov  7 00:12:29 2005
@@ -230,6 +230,21 @@
             </fragment>
         </fragment>
 
+        <fragment name="oldjdbc" type="page">
+            <navigation>
+                <title>Old DB Pools</title>
+                <description>Manage database connections</description>
+            </navigation>
+
+            <fragment name="row1" type="row">
+                <fragment name="col1" type="column">
+                    <fragment name="p1" type="portlet">
+                        <property name="portlet" value="5.2"/>
+                    </fragment>
+                </fragment>
+            </fragment>
+        </fragment>
+
         <fragment name="jdbc" type="page">
             <navigation>
                 <title>Database Pools</title>
@@ -239,7 +254,7 @@
             <fragment name="row1" type="row">
                 <fragment name="col1" type="column">
                     <fragment name="p1" type="portlet">
-                        <property name="portlet" value="5.2"/>
+                        <property name="portlet" value="5.65"/>
                     </fragment>
                 </fragment>
             </fragment>

Modified: geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml (original)
+++ geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml Mon Nov  7 00:12:29 2005
@@ -130,5 +130,8 @@
         <portlet id="64">
             <definition-id>console-standard.JMSConnectorManager</definition-id>
         </portlet>
+        <portlet id="65">
+            <definition-id>console-standard.DBWizard</definition-id>
+        </portlet>
     </application>
 </portlet-entity-registry>

Modified: geronimo/trunk/applications/console-standard/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/project.xml?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/project.xml (original)
+++ geronimo/trunk/applications/console-standard/project.xml Mon Nov  7 00:12:29 2005
@@ -80,6 +80,21 @@
             <artifactId>geronimo-system</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-deploy-jsr88</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-test-ddbean</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-connector-builder</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
 <!--        <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-</artifactId>

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java Mon Nov  7 00:12:29 2005
@@ -0,0 +1,103 @@
+/**
+ *
+ * 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.databasemanager.wizard;
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class DatabaseInfo {
+    public static final DatabaseInfo[] ALL_DATABASES = new DatabaseInfo[]{
+        new DatabaseInfo("DaffodilDB Embedded","jdbc:daffodilDB_embedded:<database>","in.co.daffodil.db.jdbc.DaffodilDBDriver"),
+        new DatabaseInfo("DaffodilDB Server","jdbc:daffodilDB://<host>:<port>/<database>","in.co.daffodil.db.rmi.RmiDaffodilDBDriver", 3456),
+        new DatabaseInfo("DB2","jdbc:db2://<host>:<port>/<database>","com.ibm.db2.jcc.DB2Driver", 50000),
+        new DatabaseInfo("DB2 (DataDirect)","jdbc:datadirect:db2://<host>:<port>;DatabaseName=<database>","com.ddtek.jdbc.db2.DB2Driver", 50000),
+        new DatabaseInfo("FrontBase","jdbc:FrontBase://<host>:<port>/<database>","com.frontbase.jdbc.FBJDriver"),
+        new DatabaseInfo("HSQLDB embedded","jdbc:hsqldb:<database>","org.hsqldb.jdbcDriver"),
+        new DatabaseInfo("HSQLDB server","jdbc:hsqldb:hsql://<host>:<port>/<database>","org.hsqldb.jdbcDriver"),
+        new DatabaseInfo("Informix","jdbc:informix-sqli://<host>:<port>/<database>:informixserver=<dbservername>","com.informix.jdbc.IfxDriver"),
+        new DatabaseInfo("Informix (DataDirect)","jdbc:datadirect:informix://<host>:<port>;informixServer=<dbservername>;DatabaseName=<database>","com.ddtek.jdbc.informix.InformixDriver"),
+        new DatabaseInfo("InterSystems Cache","jdbc:Cache://<host>:<port>/<namespace>","com.intersys.jdbc.CacheDriver"),
+        new DatabaseInfo("JDataStore","jdbc:borland:dslocal:<file>","com.borland.datastore.jdbc.DataStoreDriver"),
+        new DatabaseInfo("JDBC/ODBC Bridge","jdbc:odbc:<datasource>","sun.jdbc.odbc.JdbcOdbcDriver"),
+        new DatabaseInfo("McKoi","jdbc:mckoi://<host>/","com.mckoi.JDBCDriver"),
+        new DatabaseInfo("Mimer","jdbc:mimer://<host>:<port>/<database>","com.mimer.jdbc.Driver"),
+        new DatabaseInfo("MySQL","jdbc:mysql://<host>:<port>/<database>","com.mysql.jdbc.Driver", 3306),
+        new DatabaseInfo("Oracle Thin","jdbc:oracle:thin:@<host>:<port>:<sid>","oracle.jdbc.OracleDriver", 1521),
+        new DatabaseInfo("Oracle OCI","jdbc:oracle:oci:@<host>:<port>:<sid>","oracle.jdbc.OracleDriver", 1521),
+        new DatabaseInfo("Oracle (DataDirect)","jdbc:datadirect:oracle://<host>:<port>;ServiceName=<sid>","com.ddtek.jdbc.oracle.OracleDriver", 1521),
+        new DatabaseInfo("Pervasive","jdbc:pervasive://<host>:<port>/<database>","com.pervasive.jdbc.v2.Driver"),
+        new DatabaseInfo("Pointbase server","jdbc:pointbase:server://<host>:<port>/<database>","com.pointbase.jdbc.jdbcUniversalDriver"),
+        new DatabaseInfo("PostgreSQL","jdbc:postgresql://<host>:<port>/<database>","org.postgresql.Driver", 5432),
+        new DatabaseInfo("Progress","jdbc:jdbcProgress:T:<host>:<port>:<database>","com.progress.sql.jdbc.JdbcProgressDriver"),
+        new DatabaseInfo("MaxDB","jdbc:sapdb://<host>:<port>/<database>","com.sap.dbtech.jdbc.DriverSapDB"),
+        new DatabaseInfo("SQL Server","jdbc:microsoft:sqlserver://<host>:<port>;DatabaseName=<database>","com.microsoft.jdbc.sqlserver.SQLServerDriver", 1433),
+        new DatabaseInfo("SQL Server (jTDS)","jdbc:jtds:sqlserver://<host>:<port>;DatabaseName=<database>","net.sourceforge.jtds.jdbc.Driver", 1433),
+        new DatabaseInfo("SQL Server (DataDirect)","jdbc:datadirect:sqlserver://<host>:<port>;DatabaseName=<database>","com.ddtek.jdbc.sqlserver.SQLServerDriver", 1433),
+        new DatabaseInfo("Sybase ASE","jdbc:sybase:Tds:<host>:<port>/<database>","com.sybase.jdbc3.jdbc.SybDriver", 2048),
+        new DatabaseInfo("Sybase ASA","jdbc:sybase:Tds:<host>:<port>/<database>","com.sybase.jdbc3.jdbc.SybDriver", 2638),
+        new DatabaseInfo("Sybase (DataDirect)","jdbc:datadirect:sybase://<host>:<port>;DatabaseName=<database>","com.ddtek.jdbc.sybase.SybaseDriver"),
+    };
+    private final static Pattern PARAM_PATTERN = Pattern.compile("<.+?>");
+
+    private String name;
+    private String url;
+    private String driverClass;
+    private int defaultPort;
+
+    public DatabaseInfo(String name, String url, String driverClass) {
+        this.name = name;
+        this.url = url;
+        this.driverClass = driverClass;
+    }
+
+    public DatabaseInfo(String name, String url, String driverClass, int defaultPort) {
+        this.name = name;
+        this.url = url;
+        this.driverClass = driverClass;
+        this.defaultPort = defaultPort;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getDriverClass() {
+        return driverClass;
+    }
+
+    public int getDefaultPort() {
+        return defaultPort;
+    }
+
+    public String[] getUrlParameters() {
+        Matcher m = PARAM_PATTERN.matcher(url);
+        List list = new ArrayList();
+        while(m.find()) {
+            list.add(url.substring(m.start()+1, m.end()-1));
+        }
+        return (String[]) list.toArray(new String[list.size()]);
+    }
+}

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

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java Mon Nov  7 00:12:29 2005
@@ -0,0 +1,692 @@
+/**
+ *
+ * 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.databasemanager.wizard;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.File;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Properties;
+import java.net.URISyntaxException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.PortletRequest;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
+import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
+import org.apache.geronimo.connector.deployment.jsr88.Connector15DCBRoot;
+import org.apache.geronimo.connector.deployment.jsr88.ConnectorDCB;
+import org.apache.geronimo.connector.deployment.jsr88.Dependency;
+import org.apache.geronimo.connector.deployment.jsr88.ResourceAdapter;
+import org.apache.geronimo.connector.deployment.jsr88.ConnectionDefinition;
+import org.apache.geronimo.connector.deployment.jsr88.ConnectionDefinitionInstance;
+import org.apache.geronimo.connector.deployment.jsr88.ConfigPropertySetting;
+import org.apache.geronimo.connector.deployment.jsr88.ConnectionManager;
+import org.apache.geronimo.connector.deployment.jsr88.SinglePool;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class DatabasePoolPortlet extends BasePortlet {
+    /**
+     * todo: EVIL!!!  Should be replaced with something, somehow!
+     */
+    private final static String TRANQL_RAR_NAME = "tranql/rars/tranql-connector-1.0.rar";
+
+    private final static Log log = LogFactory.getLog(DatabasePoolPortlet.class);
+    private static final String LIST_VIEW            = "/WEB-INF/view/dbwizard/list.jsp";
+    private static final String EDIT_VIEW            = "/WEB-INF/view/dbwizard/edit.jsp";
+    private static final String SELECT_RDBMS_VIEW    = "/WEB-INF/view/dbwizard/selectDatabase.jsp";
+    private static final String BASIC_PARAMS_VIEW    = "/WEB-INF/view/dbwizard/basicParams.jsp";
+    private static final String CONFIRM_URL_VIEW     = "/WEB-INF/view/dbwizard/confirmURL.jsp";
+    private static final String TEST_CONNECTION_VIEW = "/WEB-INF/view/dbwizard/testConnection.jsp";
+    private static final String LIST_MODE            = "list";
+    private static final String EDIT_MODE            = "edit";
+    private static final String SELECT_RDBMS_MODE    = "rdbms";
+    private static final String BASIC_PARAMS_MODE    = "params";
+    private static final String CONFIRM_URL_MODE     = "url";
+    private static final String TEST_CONNECTION_MODE = "test";
+    private static final String SAVE_MODE            = "save";
+    private static final String MODE_KEY = "mode";
+
+    private PortletRequestDispatcher listView;
+    private PortletRequestDispatcher editView;
+    private PortletRequestDispatcher selectRDBMSView;
+    private PortletRequestDispatcher basicParamsView;
+    private PortletRequestDispatcher confirmURLView;
+    private PortletRequestDispatcher testConnectionView;
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        listView = portletConfig.getPortletContext().getRequestDispatcher(LIST_VIEW);
+        editView = portletConfig.getPortletContext().getRequestDispatcher(EDIT_VIEW);
+        selectRDBMSView = portletConfig.getPortletContext().getRequestDispatcher(SELECT_RDBMS_VIEW);
+        basicParamsView = portletConfig.getPortletContext().getRequestDispatcher(BASIC_PARAMS_VIEW);
+        confirmURLView = portletConfig.getPortletContext().getRequestDispatcher(CONFIRM_URL_VIEW);
+        testConnectionView = portletConfig.getPortletContext().getRequestDispatcher(TEST_CONNECTION_VIEW);
+    }
+
+    public void destroy() {
+        listView = null;
+        editView = null;
+        selectRDBMSView = null;
+        basicParamsView = null;
+        confirmURLView = null;
+        testConnectionView = null;
+        super.destroy();
+    }
+
+    public void processAction(ActionRequest actionRequest,
+            ActionResponse actionResponse) throws PortletException, IOException {
+        String mode = actionRequest.getParameter(MODE_KEY);
+        PoolData data = new PoolData();
+        data.load(actionRequest);
+        if(mode.equals("process-"+SELECT_RDBMS_MODE)) {
+            if(data.getDbtype().equals("Other")) {
+                actionResponse.setRenderParameter(MODE_KEY, EDIT_MODE);
+            } else {
+                DatabaseInfo info = null;
+                info = getDatabaseInfo(data);
+                if(info != null) {
+                    data.driverClass = info.getDriverClass();
+                    data.urlPrototype = info.getUrl();
+                }
+                actionResponse.setRenderParameter(MODE_KEY, BASIC_PARAMS_MODE);
+            }
+        } else if(mode.equals("process-"+BASIC_PARAMS_MODE)) {
+            DatabaseInfo info = null;
+            info = getDatabaseInfo(data);
+            if(info != null) {
+                data.url = populateURL(info.getUrl(), info.getUrlParameters(), data.getProperties());
+            }
+            if(attemptDriverLoad(actionRequest, data) != null) {
+                actionResponse.setRenderParameter(MODE_KEY, CONFIRM_URL_MODE);
+            } else {
+                actionResponse.setRenderParameter("driverError", "Unable to load driver "+data.driverClass);
+                actionResponse.setRenderParameter(MODE_KEY, BASIC_PARAMS_MODE);
+            }
+        } else if(mode.equals("process-"+CONFIRM_URL_MODE)) {
+            String test = actionRequest.getParameter("test");
+            if(test == null || test.equals("true")) {
+                String result = null;
+                String stack = null;
+                try {
+                    result = attemptConnect(actionRequest, data);
+                } catch (Exception e) {
+                    StringWriter writer = new StringWriter();
+                    PrintWriter temp = new PrintWriter(writer);
+                    e.printStackTrace(temp);
+                    temp.flush();
+                    temp.close();
+                    stack = writer.getBuffer().toString();
+                }
+                if(result != null) actionResponse.setRenderParameter("connectResult", result);
+                actionRequest.getPortletSession(true).setAttribute("connectError", stack);
+                actionResponse.setRenderParameter(MODE_KEY, TEST_CONNECTION_MODE);
+            } else {
+                save(actionRequest, data);
+            }
+        } else if(mode.equals(SAVE_MODE)) {
+            save(actionRequest, data);
+        } else {
+            actionResponse.setRenderParameter(MODE_KEY, mode);
+        }
+        data.store(actionResponse);
+    }
+
+    protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+        try {
+            String mode = renderRequest.getParameter(MODE_KEY);
+            PoolData data = new PoolData();
+            data.load(renderRequest);
+            renderRequest.setAttribute("pool", data);
+            if(mode == null || mode.equals("")) {
+                mode = LIST_MODE;
+            }
+            if(mode.equals(LIST_MODE)) {
+                renderList(renderRequest, renderResponse);
+            } else if(mode.equals(EDIT_MODE)) {
+                renderEdit(renderRequest, renderResponse);
+            } else if(mode.equals(SELECT_RDBMS_MODE)) {
+                renderSelectRDBMS(renderRequest, renderResponse);
+            } else if(mode.equals(BASIC_PARAMS_MODE)) {
+                renderBasicParams(renderRequest, renderResponse, data);
+            } else if(mode.equals(CONFIRM_URL_MODE)) {
+                renderConfirmURL(renderRequest, renderResponse);
+            } else if(mode.equals(TEST_CONNECTION_MODE)) {
+                renderTestConnection(renderRequest, renderResponse);
+            }
+        } catch (Throwable e) {
+            log.error("Unable to render portlet", e);
+        }
+    }
+
+    private void renderList(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        JCAManagedConnectionFactory[] databases = PortletManager.getOutboundFactories(renderRequest, "javax.sql.DataSource");
+        ConnectionPool[] pools = new ConnectionPool[databases.length];
+        for (int i = 0; i < databases.length; i++) {
+            JCAManagedConnectionFactory db = databases[i];
+            try {
+                ObjectName name = ObjectName.getInstance(db.getObjectName());
+                pools[i] = new ConnectionPool(name.getCanonicalName(), name.getKeyProperty(NameFactory.J2EE_NAME));
+            } catch (MalformedObjectNameException e) {
+                e.printStackTrace();
+            }
+        }
+        renderRequest.setAttribute("pools", pools);
+        listView.include(renderRequest, renderResponse);
+    }
+
+    private void renderEdit(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        editView.include(renderRequest, renderResponse);
+    }
+
+    private void renderSelectRDBMS(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        renderRequest.setAttribute("databases", DatabaseInfo.ALL_DATABASES);
+        selectRDBMSView.include(renderRequest, renderResponse);
+    }
+
+    private void renderBasicParams(RenderRequest renderRequest, RenderResponse renderResponse, PoolData data) throws IOException, PortletException {
+        // List the available JARs
+        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();
+                final String[] strings = new String[uris.length];
+                for (int j = 0; j < strings.length; j++) {
+                    strings[j] = uris[j].toString();
+                }
+                list.addAll(Arrays.asList(strings));
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+            }
+        }
+        Collections.sort(list);
+        renderRequest.setAttribute("jars", list);
+        // Make sure all properties available for the DB are listed
+        DatabaseInfo info = getDatabaseInfo(data);
+        if(info != null) {
+            String[] params = info.getUrlParameters();
+            for (int i = 0; i < params.length; i++) {
+                String param = params[i];
+                final String key = "property-"+param;
+                if(!data.getProperties().containsKey(key)) {
+                    data.getProperties().put(key, param.equals("port") && info.getDefaultPort() > 0 ? new Integer(info.getDefaultPort()) : null);
+                }
+            }
+        }
+        // Pass on errors
+        renderRequest.setAttribute("driverError", renderRequest.getParameter("driverError"));
+
+        basicParamsView.include(renderRequest, renderResponse);
+    }
+
+    private void renderConfirmURL(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        confirmURLView.include(renderRequest, renderResponse);
+    }
+
+    private void renderTestConnection(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
+        // Pass on results
+        renderRequest.setAttribute("connectResult", renderRequest.getParameter("connectResult"));
+        renderRequest.setAttribute("connectError", renderRequest.getPortletSession().getAttribute("connectError"));
+        testConnectionView.include(renderRequest, renderResponse);
+    }
+
+    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
+        Class driverClass = attemptDriverLoad(request, data);
+        Driver driver = (Driver) driverClass.newInstance();
+        if(driver.acceptsURL(data.url)) {
+            Properties props = new Properties();
+            props.put("user", data.user);
+            props.put("password", data.password);
+            Connection con = null;
+            try {
+                con = driver.connect(data.url, props);
+                final DatabaseMetaData metaData = con.getMetaData();
+                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
+            } finally {
+                if(con != null) try{con.close();}catch(SQLException e) {}
+            }
+        } else throw new SQLException("Driver "+data.getDriverClass()+" does not accept URL "+data.url);
+    }
+
+    private static void save(PortletRequest request, PoolData data) {
+        URL url = getTranQLRAR(request);
+        DeploymentManager mgr = PortletManager.getDeploymentManager(request);
+        try {
+            ConnectorDeployable deployable = new ConnectorDeployable(url);
+            DeploymentConfiguration config = mgr.createConfiguration(deployable);
+            final DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
+            Connector15DCBRoot root = (Connector15DCBRoot) config.getDConfigBeanRoot(ddBeanRoot);
+            ConnectorDCB connector = (ConnectorDCB) root.getDConfigBean(ddBeanRoot.getChildBean(root.getXpaths()[0])[0]);
+            connector.setConfigID("DatabasePool"+data.getName());
+            connector.setParentID("org/apache/geronimo/Server");
+            if(data.jar1 != null && !data.jar1.equals("")) {
+                Dependency dep = new Dependency();
+                connector.setDependency(new Dependency[]{dep});
+                dep.setURI(data.jar1);
+            }
+            if(data.jar2 != null && !data.jar2.equals("")) {
+                Dependency dep = new Dependency();
+                Dependency[] old = connector.getDependency();
+                Dependency[] longer = new Dependency[old.length+1];
+                System.arraycopy(old, 0, longer, 0, old.length);
+                longer[old.length] = dep;
+                connector.setDependency(longer);
+                dep.setURI(data.jar2);
+            }
+            if(data.jar3 != null && !data.jar3.equals("")) {
+                Dependency dep = new Dependency();
+                Dependency[] old = connector.getDependency();
+                Dependency[] longer = new Dependency[old.length+1];
+                System.arraycopy(old, 0, longer, 0, old.length);
+                longer[old.length] = dep;
+                connector.setDependency(longer);
+                dep.setURI(data.jar3);
+            }
+            ResourceAdapter adapter = connector.getResourceAdapter()[0];
+            ConnectionDefinition definition = new ConnectionDefinition();
+            adapter.setConnectionDefinition(new ConnectionDefinition[]{definition});
+            definition.setConnectionFactoryInterface("javax.sql.DataSource");
+            ConnectionDefinitionInstance instance = new ConnectionDefinitionInstance();
+            definition.setConnectionInstance(new ConnectionDefinitionInstance[]{instance});
+            instance.setName(data.getName());
+            ConfigPropertySetting[] settings = instance.getConfigPropertySetting();
+            for (int i = 0; i < settings.length; i++) {
+                ConfigPropertySetting setting = settings[i];
+                if(setting.getName().equals("UserName")) {
+                    setting.setValue(data.user);
+                } else if(setting.getName().equals("Password")) {
+                    setting.setValue(data.password);
+                } else if(setting.getName().equals("ConnectionURL")) {
+                    setting.setValue(data.url);
+                } else if(setting.getName().equals("Driver")) {
+                    setting.setValue(data.driverClass);
+                }
+            }
+            ConnectionManager manager = instance.getConnectionManager();
+            manager.setTransactionLocal(true);
+            SinglePool pool = new SinglePool();
+            manager.setPoolSingle(pool);
+            pool.setMatchOne(true);
+            if(data.minSize != null && !data.minSize.equals("")) {
+                pool.setMinSize(new Integer(data.minSize));
+            }
+            if(data.maxSize != null && !data.maxSize.equals("")) {
+                pool.setMaxSize(new Integer(data.maxSize));
+            }
+            if(data.blockingTimeout != null && !data.blockingTimeout.equals("")) {
+                pool.setBlockingTimeoutMillis(new Integer(data.blockingTimeout));
+            }
+            if(data.idleTimeout != null && !data.idleTimeout.equals("")) {
+                pool.setIdleTimeoutMinutes(new Integer(data.idleTimeout));
+            }
+            File tempFile = File.createTempFile("console-deployment",".xml");
+            tempFile.deleteOnExit();
+            log.debug("Writing database pool deployment plan to "+tempFile.getAbsolutePath());
+            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
+            config.save(out);
+            out.flush();
+            out.close();
+            Target[] targets = mgr.getTargets();
+            ProgressObject po = mgr.distribute(targets, new File(url.getPath()), tempFile);
+            waitForProgress(po);
+            if(po.getDeploymentStatus().isCompleted()) {
+                TargetModuleID[] ids = po.getResultTargetModuleIDs();
+                po = mgr.start(ids);
+                waitForProgress(po);
+                if(po.getDeploymentStatus().isCompleted()) {
+                    System.out.println("Deployment completed successfully!");
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if(mgr != null) mgr.release();
+        }
+    }
+
+    private static void waitForProgress(ProgressObject po) {
+        while(po.getDeploymentStatus().isRunning()) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * todo: This is not ideal...  Should look up the RAR name somehow...
+     * Maybe eventually should not assume the RAR is on the local filesystem...
+     */
+    private static URL getTranQLRAR(PortletRequest request) {
+        try {
+            URI uri = new URI(TRANQL_RAR_NAME);
+            Repository[] repos = PortletManager.getRepositories(request);
+            for (int i = 0; i < repos.length; i++) {
+                Repository repo = repos[i];
+                URL url = repo.getURL(uri);
+                if(url != null && url.getProtocol().equals("file")) {
+                    File file = new File(url.getPath());
+                    if(file.exists() && file.canRead() && !file.isDirectory()) {
+                        return url;
+                    }
+                }
+            }
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * WARNING: This method relies on having access to the same repository
+     * URLs as the server uses.
+     */
+    private static Class attemptDriverLoad(PortletRequest request, PoolData data) {
+        List list = new ArrayList();
+        try {
+            URI one = new URI(data.getJar1());
+            URI two = new URI(data.getJar2());
+            URI three = new URI(data.getJar3());
+
+            ListableRepository[] repos = PortletManager.getListableRepositories(request);
+            for (int i = 0; i < repos.length; i++) {
+                ListableRepository repo = repos[i];
+                if(one != null) {
+                    URL url = repo.getURL(one);
+                    if(url != null) {
+                        list.add(url);
+                        one = null;
+                    }
+                }
+                if(two != null) {
+                    URL url = repo.getURL(two);
+                    if(url != null) {
+                        list.add(url);
+                        two = null;
+                    }
+                }
+                if(three != null) {
+                    URL url = repo.getURL(three);
+                    if(url != null) {
+                        list.add(url);
+                        three = null;
+                    }
+                }
+            }
+            URLClassLoader loader = new URLClassLoader((URL[]) list.toArray(new URL[list.size()]), DatabasePoolPortlet.class.getClassLoader());
+            try {
+                return loader.loadClass(data.driverClass);
+            } catch (ClassNotFoundException e) {
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    private static String populateURL(String url, String[] keys, Map properties) {
+        for (int i = 0; i < keys.length; i++) {
+            String key = keys[i];
+            String value = (String) properties.get("property-"+key);
+            if(value == null) {
+                int begin = url.indexOf("<"+key+">");
+                int end = begin + key.length() + 2;
+                for(int j=begin-1; j>=0; j--) {
+                    char c = url.charAt(j);
+                    if(c == ';' || c == ':') {
+                        begin = j;
+                        break;
+                    } else if(c == '/') {
+                        break;
+                    }
+                }
+                url = url.substring(0, begin)+url.substring(end);
+            } else {
+                url = url.replaceAll("<"+key+">", value);
+            }
+        }
+        return url;
+    }
+
+    private static DatabaseInfo getDatabaseInfo(PoolData data) {
+        DatabaseInfo info = null;
+        for (int i = 0; i < DatabaseInfo.ALL_DATABASES.length; i++) {
+            DatabaseInfo next = DatabaseInfo.ALL_DATABASES[i];
+            if(next.getName().equals(data.getDbtype())) {
+                info = next;
+                break;
+            }
+        }
+        return info;
+    }
+
+    public static class PoolData implements Serializable {
+        private String name;
+        private String dbtype;
+        private String user;
+        private String password;
+        private Map properties = new HashMap();
+        private String driverClass;
+        private String url;
+        private String urlPrototype;
+        private String jar1;
+        private String jar2;
+        private String jar3;
+        private String minSize;
+        private String maxSize;
+        private String blockingTimeout;
+        private String idleTimeout;
+
+        public void load(PortletRequest request) {
+            name = request.getParameter("name");
+            driverClass = request.getParameter("driverClass");
+            dbtype = request.getParameter("dbtype");
+            user = request.getParameter("user");
+            password = request.getParameter("password");
+            url = request.getParameter("url");
+            urlPrototype = request.getParameter("urlPrototype");
+            jar1 = request.getParameter("jar1");
+            jar2 = request.getParameter("jar2");
+            jar3 = request.getParameter("jar3");
+            minSize = request.getParameter("minSize");
+            maxSize = request.getParameter("maxSize");
+            blockingTimeout = request.getParameter("blockingTimeout");
+            idleTimeout = request.getParameter("idleTimeout");
+            Map map = request.getParameterMap();
+            for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+                String key = (String) it.next();
+                if(key.startsWith("property-")) {
+                    properties.put(key, request.getParameter(key));
+                }
+            }
+        }
+
+        public void store(ActionResponse response) {
+            if(name != null) response.setRenderParameter("name", name);
+            if(dbtype != null) response.setRenderParameter("dbtype", dbtype);
+            if(driverClass != null) response.setRenderParameter("driverClass", driverClass);
+            if(user != null) response.setRenderParameter("user", user);
+            if(password != null) response.setRenderParameter("password", password);
+            if(url != null) response.setRenderParameter("urlPrototype", urlPrototype);
+            if(urlPrototype != null) response.setRenderParameter("url", url);
+            if(jar1 != null) response.setRenderParameter("jar1", jar1);
+            if(jar2 != null) response.setRenderParameter("jar2", jar2);
+            if(jar3 != null) response.setRenderParameter("jar3", jar3);
+            if(minSize != null) response.setRenderParameter("minSize", minSize);
+            if(maxSize != null) response.setRenderParameter("maxSize", maxSize);
+            if(blockingTimeout != null) response.setRenderParameter("blockingTimeout", blockingTimeout);
+            if(idleTimeout != null) response.setRenderParameter("idleTimeout", idleTimeout);
+            for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
+                Map.Entry entry = (Map.Entry) it.next();
+                if(entry.getValue() != null) {
+                    response.setRenderParameter((String)entry.getKey(), (String)entry.getValue());
+                }
+            }
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getDbtype() {
+            return dbtype;
+        }
+
+        public String getUser() {
+            return user;
+        }
+
+        public String getPassword() {
+            return password;
+        }
+
+        public Map getProperties() {
+            return properties;
+        }
+
+        public String getUrl() {
+            return url;
+        }
+
+        public String getJar1() {
+            return jar1;
+        }
+
+        public String getJar2() {
+            return jar2;
+        }
+
+        public String getJar3() {
+            return jar3;
+        }
+
+        public String getMinSize() {
+            return minSize;
+        }
+
+        public String getMaxSize() {
+            return maxSize;
+        }
+
+        public String getBlockingTimeout() {
+            return blockingTimeout;
+        }
+
+        public String getIdleTimeout() {
+            return idleTimeout;
+        }
+
+        public String getDriverClass() {
+            return driverClass;
+        }
+
+        public String getUrlPrototype() {
+            return urlPrototype;
+        }
+
+        public String toString() {
+            String temp= "NAME="+name+"\n"+
+                    "DB="+dbtype+"\n"+
+                    "CLASS="+driverClass+"\n"+
+                    "FORMAT="+urlPrototype+"\n"+
+                    "URL="+url+"\n"+
+                    "USER="+user+"\n"+
+                    "PASS="+password+"\n"+
+                    "JAR1="+jar1+"\n"+
+                    "JAR2="+jar2+"\n"+
+                    "JAR3="+jar3+"\n"+
+                    "MIN="+minSize+"\n"+
+                    "MAX="+maxSize+"\n"+
+                    "BLOCK="+blockingTimeout+"\n"+
+                    "IDLE="+idleTimeout;
+            for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
+                Map.Entry entry = (Map.Entry) it.next();
+                temp+="\n"+entry.getKey()+"="+entry.getValue();
+            }
+            return temp;
+        }
+    }
+
+    public static class ConnectionPool implements Serializable {
+        private String objectName;
+        private String name;
+
+        public ConnectionPool(String objectName, String name) {
+            this.objectName = objectName;
+            this.name = name;
+        }
+
+        public String getObjectName() {
+            return objectName;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+}

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

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java Mon Nov  7 00:12:29 2005
@@ -16,18 +16,27 @@
  */
 package org.apache.geronimo.console.util;
 
+import java.util.List;
+import java.util.ArrayList;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletSession;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.http.HttpSession;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.kernel.repository.WriteableRepository;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.management.J2EEDomain;
+import org.apache.geronimo.management.ResourceAdapterModule;
 import org.apache.geronimo.management.geronimo.*;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -60,6 +69,16 @@
         return new KernelManagementHelper(kernel);
     }
 
+    public static DeploymentManager getDeploymentManager(PortletRequest request) {
+        DeploymentFactoryImpl factory = new DeploymentFactoryImpl();
+        try {
+            return factory.getDeploymentManager("deployer:geronimo:inVM", null, null);
+        } catch (DeploymentManagerCreationException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
     public static ManagementHelper getManagementHelper(PortletRequest request) {
         ManagementHelper helper = (ManagementHelper) request.getPortletSession(true).getAttribute(HELPER_KEY, PortletSession.APPLICATION_SCOPE);
         if(helper == null) {
@@ -109,6 +128,47 @@
             request.getPortletSession().setAttribute(JVM_KEY, jvm, PortletSession.APPLICATION_SCOPE);
         }
         return jvm;
+    }
+
+    public static Repository[] getRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getRepositories(getCurrentServer(request));
+    }
+
+    public static ListableRepository[] getListableRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        Repository[] list = helper.getRepositories(getCurrentServer(request));
+        List result = new ArrayList();
+        for (int i = 0; i < list.length; i++) {
+            Repository repository = list[i];
+            if(repository instanceof ListableRepository) {
+                result.add(repository);
+            }
+        }
+        return (ListableRepository[]) result.toArray(new ListableRepository[result.size()]);
+    }
+
+    public static WriteableRepository[] getWritableRepositories(PortletRequest request) {
+        ManagementHelper helper = getManagementHelper(request);
+        Repository[] list = helper.getRepositories(getCurrentServer(request));
+        List result = new ArrayList();
+        for (int i = 0; i < list.length; i++) {
+            Repository repository = list[i];
+            if(repository instanceof WriteableRepository) {
+                result.add(repository);
+            }
+        }
+        return (WriteableRepository[]) result.toArray(new WriteableRepository[result.size()]);
+    }
+
+    public static ResourceAdapterModule[] getOutboundRAModules(PortletRequest request, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundRAModules(getCurrentServer(request), iface);
+    }
+
+    public static JCAManagedConnectionFactory[] getOutboundFactories(PortletRequest request, String iface) {
+        ManagementHelper helper = getManagementHelper(request);
+        return helper.getOutboundFactories(getCurrentServer(request), iface);
     }
 
     public static String[] getWebManagerNames(PortletRequest request) {

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml?rev=331239&r1=331238&r2=331239&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml Mon Nov  7 00:12:29 2005
@@ -483,6 +483,29 @@
     </portlet>
 
     <portlet>
+        <description>Wizard for managing database pools</description>
+        <portlet-name>DBWizard</portlet-name>
+        <display-name>Database Pool Wizard</display-name>
+
+        <portlet-class>org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet</portlet-class>
+
+        <expiration-cache>-1</expiration-cache>
+
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+        </supports>
+
+        <supported-locale>en</supported-locale>
+
+        <portlet-info>
+            <title>Database Pools</title>
+            <short-title>Database Pools</short-title>
+            <keywords>Database Pool Wizard</keywords>
+        </portlet-info>
+    </portlet>
+
+    <portlet>
         <description>Portlet for managing JMS connections</description>
         <portlet-name>JMSConnections</portlet-name>
         <display-name>JMS Connection Factory Portlet</display-name>

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,99 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p><b>Create Database Pool</b> -- Step 2: Select Driver, JAR, Parameters</p>
+
+<!--   FORM TO COLLECT DATA FOR THIS PAGE   -->
+<form name="<portlet:namespace/>" action="<portlet:actionURL/>">
+    <input type="hidden" name="mode" value="process-params" />
+    <input type="hidden" name="name" value="${pool.name}" />
+    <input type="hidden" name="dbtype" value="${pool.dbtype}" />
+    <input type="hidden" name="url" value="${pool.url}" />
+    <input type="hidden" name="urlPrototype" value="${pool.urlPrototype}" />
+    <input type="hidden" name="jar2" value="${pool.jar2}" />
+    <input type="hidden" name="jar3" value="${pool.jar3}" />
+    <input type="hidden" name="minSize" value="${pool.minSize}" />
+    <input type="hidden" name="maxSize" value="${pool.maxSize}" />
+    <input type="hidden" name="idleTimeout" value="${pool.idleTimeout}" />
+    <input type="hidden" name="blockingTimeout" value="${pool.blockingTimeout}" />
+    <table border="0">
+    <!-- ENTRY FIELD: Driver Class -->
+      <tr>
+        <th><div align="right">JDBC Driver Class:</div></th>
+        <td><input name="driverClass" type="text" size="30" value="${pool.driverClass}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>
+          <c:if test="${!(empty driverError)}"><font color="red"><b>Unable to load driver from selected JARs!</b></font></c:if>
+          See the documentation for your JDBC driver.
+        </td>
+      </tr>
+    <!-- ENTRY FIELD: Driver JAR -->
+      <tr>
+        <th><div align="right">Driver JAR:</div></th>
+        <td>
+          <select name="jar1">
+            <option></option>
+        <c:forEach var="jar" items="${jars}">
+            <option <c:if test="${jar == pool.jar1}">selected</c:if>>${jar}</option>
+        </c:forEach>
+            <option>Other</option>
+          </select>
+        </td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The JAR holding the selected JDBC driver.  Should be installed under GERONIMO/repository/</td>
+      </tr>
+    <!-- ENTRY FIELD: Username -->
+      <tr>
+        <th><div align="right">DB User Name:</div></th>
+        <td><input name="user" type="text" size="20" value="${pool.user}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The username used to connect to the database</td>
+      </tr>
+    <!-- ENTRY FIELD: Password -->
+      <tr>
+        <th><div align="right">DB Password:</div></th>
+        <td><input name="password" type="password" size="20" value="${pool.password}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The password used to connect to the database</td>
+      </tr>
+    <!-- ENTRY FIELD: URL Properties -->
+      <tr>
+        <th colspan="2">Driver Connection Properties</th>
+      </tr>
+      <tr>
+        <th><div align="right">Typical JDBC URL:</div></th>
+        <td><c:out value="${pool.urlPrototype}" /></td>
+      </tr>
+  <c:forEach var="prop" items="${pool.properties}">
+      <tr>
+        <th><div align="right">${fn:substringAfter(prop.key,"property-")}:</div></th>
+        <td><input name="${prop.key}" type="text" size="20" value="${prop.value}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>A property used to connect to ${pool.dbtype}.  May be optional (see JDBC driver documentation).</td>
+      </tr>
+  </c:forEach>
+    <!-- SUBMIT BUTTON -->
+      <tr>
+        <td></td>
+        <td><input type="submit" value="Next" /></td>
+      </tr>
+    </table>
+</form>
+<!--   END OF FORM TO COLLECT DATA FOR THIS PAGE   -->
+
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="list" />
+            </portlet:actionURL>">Cancel</a></p>

Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/basicParams.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,99 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p><b>Create Database Pool</b> -- Step 3: Final Pool Configuration</p>
+
+<!--   FORM TO COLLECT DATA FOR THIS PAGE   -->
+<form name="<portlet:namespace/>DatabaseForm" action="<portlet:actionURL/>">
+    <input type="hidden" name="mode" value="process-url" />
+    <input type="hidden" name="test" value="true" />
+    <input type="hidden" name="name" value="${pool.name}" />
+    <input type="hidden" name="dbtype" value="${pool.dbtype}" />
+    <input type="hidden" name="user" value="${pool.user}" />
+    <input type="hidden" name="password" value="${pool.password}" />
+    <input type="hidden" name="urlPrototype" value="${pool.urlPrototype}" />
+    <input type="hidden" name="driverClass" value="${pool.driverClass}" />
+    <input type="hidden" name="jar1" value="${pool.jar1}" />
+    <input type="hidden" name="jar2" value="${pool.jar2}" />
+    <input type="hidden" name="jar3" value="${pool.jar3}" />
+  <c:forEach var="prop" items="${pool.properties}">
+    <input type="hidden" name="${prop.key}" value="${prop.value}" />
+  </c:forEach>
+    <table border="0">
+    <!-- ENTRY FIELD: URL -->
+      <tr>
+        <th><div align="right">JDBC Connect URL:</div></th>
+        <td><input name="url" type="text" size="50" value="${pool.url}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>Make sure the generated URL fits the syntax for your JDBC driver.</td>
+      </tr>
+    <!-- STATUS FIELD: Driver Load -->
+      <tr>
+        <th><div align="right">Driver Status:</div></th>
+        <td><i>Loaded Successfully</i></td>
+      </tr>
+    <!-- HEADER -->
+      <tr>
+        <th colspan="2">Connection Pool Parameters</th>
+      </tr>
+    <!-- ENTRY FIELD: Min Size -->
+      <tr>
+        <th><div align="right">Pool Min Size:</div></th>
+        <td><input name="minSize" type="text" size="5" value="${pool.minSize}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The minimum number of connections in the pool.  Leave blank for default.</td>
+      </tr>
+    <!-- ENTRY FIELD: Max Size -->
+      <tr>
+        <th><div align="right">Pool Max Size:</div></th>
+        <td><input name="maxSize" type="text" size="5" value="${pool.maxSize}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The maximum number of connections in the pool.  Leave blank for default.</td>
+      </tr>
+    <!-- ENTRY FIELD: Blocking Timeout -->
+      <tr>
+        <th><div align="right">Blocking Timeout:</div></th>
+        <td><input name="blockingTimeout" type="text" size="7" value="${pool.blockingTimeout}"> (in milliseconds)</td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The length of time a caller will wait for a connection.  Leave blank for default.</td>
+      </tr>
+    <!-- ENTRY FIELD: Idle timeout -->
+      <tr>
+        <th><div align="right">Idle Timeout:</div></th>
+        <td><input name="idleTimeout" type="text" size="5" value="${pool.idleTimeout}"> (in minutes)</td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>How long a connection can be idle before being closed.  Leave blank for default.</td>
+      </tr>
+    <!-- SUBMIT BUTTON -->
+      <tr>
+        <td></td>
+        <td><input type="submit" value="Test Connection" />
+          <input type="button" value="Skip Test" onclick="document.<portlet:namespace/>DatabaseForm.test.value='false';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+        </td>
+      </tr>
+    </table>
+</form>
+<!--   END OF FORM TO COLLECT DATA FOR THIS PAGE   -->
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="test" />
+            </portlet:actionURL>">Test Connection</a></p>
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="save" />
+            </portlet:actionURL>">Skip Test & Save</a></p>
+
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="list" />
+            </portlet:actionURL>">Cancel</a></p>

Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,17 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p>This page edits a new or existing database pool.</p>
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="test" />
+            </portlet:actionURL>">Test Connection</a></p>
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="save" />
+            </portlet:actionURL>">Skip Test & Save</a></p>
+
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="list" />
+            </portlet:actionURL>">Cancel</a></p>

Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,14 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p>This page lists all the available database pools.</p>
+<ul>
+<c:forEach var="pool" items="${pools}">
+  <li>${pool.name}</li>
+</c:forEach>
+</ul>
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="rdbms" />
+            </portlet:actionURL>">Add new database pool</a></p>

Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/list.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,70 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p><b>Create Database Pool</b> -- Step 1: Select Name and Database</p>
+
+<!--   FORM TO COLLECT DATA FOR THIS PAGE   -->
+<form name="<portlet:namespace/>" action="<portlet:actionURL/>">
+    <input type="hidden" name="mode" value="process-rdbms" />
+    <input type="hidden" name="user" value="${pool.user}" />
+    <input type="hidden" name="password" value="${pool.password}" />
+    <input type="hidden" name="driverClass" value="${pool.driverClass}" />
+    <input type="hidden" name="url" value="${pool.url}" />
+    <input type="hidden" name="urlPrototype" value="${pool.urlPrototype}" />
+    <input type="hidden" name="jar1" value="${pool.jar1}" />
+    <input type="hidden" name="jar2" value="${pool.jar2}" />
+    <input type="hidden" name="jar3" value="${pool.jar3}" />
+    <input type="hidden" name="minSize" value="${pool.minSize}" />
+    <input type="hidden" name="maxSize" value="${pool.maxSize}" />
+    <input type="hidden" name="idleTimeout" value="${pool.idleTimeout}" />
+    <input type="hidden" name="blockingTimeout" value="${pool.blockingTimeout}" />
+  <c:forEach var="prop" items="${pool.properties}">
+    <input type="hidden" name="${prop.key}" value="${prop.value}" />
+  </c:forEach>
+    <table border="0">
+    <!-- ENTRY FIELD: NAME -->
+      <tr>
+        <th><div align="right">Name of Database Pool:</div></th>
+        <td><input name="name" type="text" size="30" value="${pool.name}"></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>A name that is different than the name for any other database pools in the server</td>
+      </tr>
+    <!-- ENTRY FIELD: DB TYPE -->
+      <tr>
+        <th><div align="right">Database Type:</div></th>
+        <td>
+          <select name="dbtype">
+        <c:forEach var="db" items="${databases}">
+            <option <c:if test="${db.name == pool.dbtype}">selected</c:if>>${db.name}</option>
+        </c:forEach>
+            <option>Other</option>
+          </select>
+        </td>
+      </tr>
+      <tr>
+        <td></td>
+        <td>The type of database the pool will connect to.</td>
+      </tr>
+      <tr>
+        <td></td>
+        <td><input type="submit" value="Next" /></td>
+      </tr>
+    </table>
+</form>
+<!--   END OF FORM TO COLLECT DATA FOR THIS PAGE   -->
+
+<%--
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="params" />
+            </portlet:actionURL>">Select predefined database</a></p>
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="edit" />
+            </portlet:actionURL>">Select "other" database</a></p>
+--%>
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="list" />
+            </portlet:actionURL>">Cancel</a></p>

Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/selectDatabase.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/testConnection.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/testConnection.jsp?rev=331239&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/testConnection.jsp (added)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/testConnection.jsp Mon Nov  7 00:12:29 2005
@@ -0,0 +1,69 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p><b>Create Database Pool</b> -- Step 4: Test Connection</p>
+
+<!--   FORM TO COLLECT DATA FOR THIS PAGE   -->
+<form name="<portlet:namespace/>DatabaseForm" action="<portlet:actionURL/>">
+    <input type="hidden" name="mode" value="save" />
+    <input type="hidden" name="user" value="${pool.user}" />
+    <input type="hidden" name="name" value="${pool.name}" />
+    <input type="hidden" name="dbtype" value="${pool.dbtype}" />
+    <input type="hidden" name="password" value="${pool.password}" />
+    <input type="hidden" name="driverClass" value="${pool.driverClass}" />
+    <input type="hidden" name="url" value="${pool.url}" />
+    <input type="hidden" name="urlPrototype" value="${pool.urlPrototype}" />
+    <input type="hidden" name="jar1" value="${pool.jar1}" />
+    <input type="hidden" name="jar2" value="${pool.jar2}" />
+    <input type="hidden" name="jar3" value="${pool.jar3}" />
+    <input type="hidden" name="minSize" value="${pool.minSize}" />
+    <input type="hidden" name="maxSize" value="${pool.maxSize}" />
+    <input type="hidden" name="idleTimeout" value="${pool.idleTimeout}" />
+    <input type="hidden" name="blockingTimeout" value="${pool.blockingTimeout}" />
+  <c:forEach var="prop" items="${pool.properties}">
+    <input type="hidden" name="${prop.key}" value="${prop.value}" />
+  </c:forEach>
+    <table border="0">
+    <!-- STATUS FIELD: Conection Result -->
+      <tr>
+        <th><div align="right">Test Result:</div></th>
+        <td>
+          <c:choose>
+            <c:when test="${empty connectResult}">
+              <font color="red"><i>Connection Error (see below)</i></font>
+            </c:when><c:otherwise>
+              Connected to ${connectResult}
+            </c:otherwise>
+          </c:choose>
+        </td>
+      </tr>
+    <!-- STATUS FIELD: Connection Errors -->
+    <c:if test="${!(empty connectError)}">
+      <tr>
+        <th><div align="right">Test Error:</div></th>
+        <td><textarea rows="30" cols="50">${connectError}</textarea></td>
+      </tr>
+    </c:if>
+    <!-- SUBMIT BUTTON -->
+      <tr>
+        <td></td>
+        <td>
+          <c:choose>
+            <c:when test="${empty connectResult}">
+<input type="submit" value="Save Anyway" />
+<input type="button" value="Edit Settings" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='edit';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+<input type="button" value="Test Again" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='process-url';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+            </c:when><c:otherwise>
+<input type="submit" value="Save" />
+            </c:otherwise>
+          </c:choose>
+        </td>
+      </tr>
+    </table>
+</form>
+<!--   END OF FORM TO COLLECT DATA FOR THIS PAGE   -->
+
+<p><a href="<portlet:actionURL portletMode="view">
+              <portlet:param name="mode" value="list" />
+            </portlet:actionURL>">Cancel</a></p>



Mime
View raw message