geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r701411 - in /geronimo/server/branches/2.1/plugins/system-database: sysdb-console-jetty/src/main/plan/ sysdb-console-tomcat/src/main/plan/ sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/ sysdb-portlets/src/main/resource...
Date Fri, 03 Oct 2008 15:21:40 GMT
Author: dwoods
Date: Fri Oct  3 08:21:40 2008
New Revision: 701411

URL: http://svn.apache.org/viewvc?rev=701411&view=rev
Log:
GERONIMO-4225 refactor patch to keep DB Manager -> Run SQL db centric while adding an init-param
so we can also have a datasource centric DB Pools -> Run SQL instance from the same code

Modified:
    geronimo/server/branches/2.1/plugins/system-database/sysdb-console-jetty/src/main/plan/plan.xml
    geronimo/server/branches/2.1/plugins/system-database/sysdb-console-tomcat/src/main/plan/plan.xml
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLHelper.java
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLPortlet.java
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase.properties
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase_zh.properties
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/portlet.xml
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/internalDBNormal.jsp
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/listDatabases.jsp
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLHelp.jsp
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLNormal.jsp
    geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/web.xml

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-console-jetty/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-console-jetty/src/main/plan/plan.xml?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-console-jetty/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-console-jetty/src/main/plan/plan.xml
Fri Oct  3 08:21:40 2008
@@ -40,7 +40,7 @@
     <gbean name="DBWizard" class="org.apache.geronimo.pluto.AdminConsoleExtensionGBean">
         <attribute name="pageTitle">Services/Database Pools</attribute>
         <attribute name="portletContext">/system-database</attribute>
-        <attribute name="portletList">[DBWizard]</attribute>
+        <attribute name="portletList">[DBWizard,RunSQLDS]</attribute>
         <attribute name="icon">/images/ico_db_16x16.gif</attribute>
         <reference name="PortalContainerServices">
             <name>PlutoPortalServices</name>

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-console-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-console-tomcat/src/main/plan/plan.xml?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-console-tomcat/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-console-tomcat/src/main/plan/plan.xml
Fri Oct  3 08:21:40 2008
@@ -41,7 +41,7 @@
     <gbean name="DBWizard" class="org.apache.geronimo.pluto.AdminConsoleExtensionGBean">
         <attribute name="pageTitle">Services/Database Pools</attribute>
         <attribute name="portletContext">/system-database</attribute>
-        <attribute name="portletList">[DBWizard]</attribute>
+        <attribute name="portletList">[DBWizard,RunSQLDS]</attribute>
         <attribute name="icon">/images/ico_db_16x16.gif</attribute>
         <reference name="PortalContainerServices">
             <name>PlutoPortalServices</name>

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/DBViewerHelper.java
Fri Oct  3 08:21:40 2008
@@ -72,8 +72,8 @@
      * @param derbySysHome
      * @return
      */
-    public Collection getDerbyDatabases(String derbySysHome) {
-        Vector databases = new Vector();
+    public Collection<String> getDerbyDatabases(String derbySysHome) {
+        List<String> databases = new ArrayList<String>();
         File f = new File(derbySysHome);
         // Check if this is a directory
         if (f.isDirectory()) {

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLHelper.java?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLHelper.java
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLHelper.java
Fri Oct  3 08:21:40 2008
@@ -132,7 +132,7 @@
         return result;
     }
 
-    public String runSQL(String dsName, String sql) {
+    public String runSQL(String connName, String sql, Boolean dsConn) {
         String result = SQL_SUCCESS_MSG;
 
         if ((sql == null) || (sql.trim().length() == 0)) {
@@ -144,8 +144,11 @@
         Connection conn = null;
         Statement s = null;
         try {
-
-            conn = DerbyConnectionUtil.getDataSourceConnection(dsName);
+            if (dsConn) {
+                conn = DerbyConnectionUtil.getDataSourceConnection(connName);
+            } else {
+                conn = DerbyConnectionUtil.getDerbyConnection(connName);
+            }
             conn.setAutoCommit(false);
 
             s = conn.createStatement();
@@ -218,6 +221,6 @@
                 "create table derbyTbl1(num int, addr varchar(40));"
                         + "create table derbyTbl2(num int, addr varchar(40));"
                         + "create table derbyTbl3(num int, addr varchar(40));"
-                        + "insert into derb");
+                        + "insert into derb", false);
     }
 }

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLPortlet.java?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLPortlet.java
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/internaldb/RunSQLPortlet.java
Fri Oct  3 08:21:40 2008
@@ -49,6 +49,10 @@
 
     private static final String RESTOREDB_ACTION = "Restore";
 
+    private static final String DATASOURCE_MODE = "datasource";
+
+    private static final String DATABASE_MODE = "database";
+
     private static RunSQLHelper sqlHelper = new RunSQLHelper();
 
     private static DBViewerHelper dbHelper = new DBViewerHelper();
@@ -59,7 +63,7 @@
 
     private PortletRequestDispatcher helpView;
 
-    private Collection databases;
+    private Collection<String> databases;
     
     private Collection<String> dataSourceNames;
 
@@ -79,6 +83,8 @@
 
     private String actionResult;
 
+    private String connectionMode;  // either datasource or database
+
     public void processAction(ActionRequest actionRequest,
             ActionResponse actionResponse) throws PortletException, IOException {
         // Getting parameters here because it fails on doView()
@@ -95,7 +101,7 @@
         } else if (DELETEDB_ACTION.equals(action)) {
             actionResult = sqlHelper.deleteDB(DerbyConnectionUtil.getDerbyHome(), deleteDB);
         } else if (RUNSQL_ACTION.equals(action)) {
-            actionResult = sqlHelper.runSQL(useDB, sqlStmts);
+            actionResult = sqlHelper.runSQL(useDB, sqlStmts, RunSQLPortlet.DATASOURCE_MODE.equals(connectionMode));
         } else if (BACKUPDB_ACTION.equals(action)) {
             actionResult = sqlHelper.backupDB(DerbyConnectionUtil.getDerbyHome(), backupDB);
         } else if (RESTOREDB_ACTION.equals(action)) {
@@ -116,6 +122,7 @@
         renderRequest.setAttribute("dataSourceNames", dataSourceNames);
         renderRequest.setAttribute("sqlStmts", sqlStmts);
         renderRequest.setAttribute("useDB", useDB);	
+        renderRequest.setAttribute("connectionMode", connectionMode);
         if (RUNSQL_ACTION.equals(action)) {
             // check if it's a single Select statement
             if ((sqlStmts != null) && (sqlStmts.trim().indexOf(';') == -1)
@@ -148,6 +155,7 @@
 
     protected void doHelp(RenderRequest renderRequest,
             RenderResponse renderResponse) throws PortletException, IOException {
+        renderRequest.setAttribute("connectionMode", connectionMode);
         helpView.include(renderRequest, renderResponse);
     }
 
@@ -161,12 +169,26 @@
                 HELPVIEW_JSP);
         databases = dbHelper.getDerbyDatabases(DerbyConnectionUtil.getDerbyHome());
         dataSourceNames = dbHelper.getDataSourceNames();
+        String mode = portletConfig.getInitParameter("connectionMode");
+        if ((mode != null) && (mode.trim().equalsIgnoreCase(RunSQLPortlet.DATASOURCE_MODE)))
{
+            connectionMode = RunSQLPortlet.DATASOURCE_MODE;
+        } else {
+            connectionMode = RunSQLPortlet.DATABASE_MODE;
+        }
     }
 
     public void destroy() {
         normalView = null;
         maximizedView = null;
         helpView = null;
+        if (databases != null) {
+            databases.clear();
+            databases = null;
+        }
+        if (dataSourceNames != null) {
+            dataSourceNames.clear();
+            dataSourceNames = null;
+        }
         super.destroy();
     }
 

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase.properties?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase.properties
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase.properties
Fri Oct  3 08:21:40 2008
@@ -199,11 +199,14 @@
 internaldb.common.tableTypes                  = Table Types
 internaldb.common.tables                      = Tables
 internaldb.common.timeDateFunctions           = Time Date Functions
-internaldb.common.useDB                       = Use DataSource
+internaldb.common.useDB                       = Use DB
+internaldb.common.useDS                       = Use DataSource
 internaldb.common.userName                    = Username
 internaldb.common.viewContents                = View Contents
 internaldb.common.viewDatabases               = View Databases
 internaldb.common.viewTables                  = View Tables
+internaldb.common.Item                        = Item
+internaldb.common.Value                       = Value
 internaldb.dbViewerHelp.content               = Displays all the available databases and
their tables and displays the contents of the tables. From the main window, to view the tables
in a database, click on the database link. This will show all the tables in the database.
To view the contents of the tables, click on the "View Contents" link. At the bottom of the
DB Viewer window pane there will be links to take the user back to other views, e.g., "View
Databases" and/or "View Tables."
 internaldb.internalDBHelp.content             = This page provides information about the
internal database, such as, the product name, the version of the database, the supported functions
and the supported SQL commands, among other things. Scroll to the bottom to see all the information.
 internaldb.listDatabases.nodatabases          = No databases
@@ -213,7 +216,8 @@
 internaldb.runSQLHelp.deleteDBExp             = Delete an existing database, by selecting
it from the pull-down menu and then clicking on &quot;Delete.&quot;
 internaldb.runSQLHelp.runSQLExp               = Enter the SQL commands, separated by semicolons,
in the "SQL Command/s" text box. To run the SQL command(s), click on the "Run SQL" button.
 internaldb.runSQLHelp.summary                 = Allows the user to run SQL commands to manipulate
the data in the tables, create a new database or delete a database. The user can enter the
SQL commands in the &quot;SQL Command(s)&quot; text box and click on &quot;Run
SQL.&quot;
-internaldb.runSQLHelp.useDBExp                = Select a database to update from the pull-down
menu.
+internaldb.runSQLHelp.useDBExp                = Select a database to use from the pull-down
menu.
+internaldb.runSQLHelp.useDSExp                = Select a datasource to use from the pull-down
menu.
 internaldb.runSQLNormal.note1                 = 1) Use ';' to separate multiple statements
 internaldb.runSQLNormal.note2                 = 2) Query results will be displayed for single
'Select' statement
 internaldb.runSQLNormal.note3                 = 3) Use single quotes to encapsulate literal
strings

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase_zh.properties?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase_zh.properties
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/resources/systemdatabase_zh.properties
Fri Oct  3 08:21:40 2008
@@ -198,10 +198,13 @@
 internaldb.common.tables                      = \u8868
 internaldb.common.timeDateFunctions           = \u65F6\u95F4/\u65E5\u671F\u51FD\u6570
 internaldb.common.useDB                       = \u4F7F\u7528\u6570\u636E\u5E93
+internaldb.common.useDS                       = Use DataSource
 internaldb.common.userName                    = \u7528\u6237\u540D
 internaldb.common.viewContents                = \u67E5\u770B\u5185\u5BB9
 internaldb.common.viewDatabases               = \u67E5\u770B\u6570\u636E\u5E93
 internaldb.common.viewTables                  = \u67E5\u770B\u8868
+internaldb.common.Item                        = \u9879
+internaldb.common.Value                       = \u503c
 internaldb.dbViewerHelp.content               = \u663E\u793A\u6240\u6709\u53EF\u7528\u7684\u6570\u636E\u5E93\uFF0C\u4EE5\u53CA\u6570\u636E\u5E93\u4E2D\u7684\u8868\u548C\u8868\u7684\u5185\u5BB9\u3002\u8981\u67E5\u770B\u6570\u636E\u5E93\u4E2D\u7684\u8868\uFF0C\u5728\u4E3B\u7A97\u53E3\u4E2D\uFF0C\u70B9\u51FB\u6570\u636E\u5E93\u7684\u94FE\u63A5\u3002\u8FD9\u4F1A\u663E\u793A\u6570\u636E\u5E93\u4E2D\u7684\u6240\u6709\u8868\u3002\u8981\u67E5\u770B\u8868\u4E2D\u7684\u5185\u5BB9\uFF0C\u70B9\u51FB"\u67E5\u770B\u5185\u5BB9"\u94FE\u63A5\uFF0C\u5728"\u67E5\u770B\u6570\u636E\u5E93"\u9762\u677F\u7684\u5E95\u90E8\uFF0C\u6709\u4E00\u4E9B\u94FE\u63A5\u7528\u4E8E\u628A\u7528\u6237\u5E26\u5230\u5176\u5B83\u89C6\u56FE\u3002\u6BD4\u5982\uFF1A"\u67E5\u770B\u6570\u636E\u5E93"\u548C/\u6216"\u67E5\u770B\u8868"\u3002
 internaldb.internalDBHelp.content             = \u8FD9\u4E2A\u9875\u9762\u63D0\u4F9B\u4E86\u5185\u90E8\u6570\u636E\u5E93\u7684\u4FE1\u606F\uFF0C\u6BD4\u5982\uFF1A\u4EA7\u54C1\u540D\u79F0\uFF0C\u6570\u636E\u5E93\u7248\u672C\uFF0C\u652F\u6301\u7684\u51FD\u6570\uFF0C\u652F\u6301\u7684\uFF33\uFF31\uFF2C\u547D\u4EE4\u7B49\u7B49\u3002\u6EDA\u52A8\u5230\u5E95\u90E8\u53BB\u67E5\u770B\u6240\u6709\u4FE1\u606F\u3002
 internaldb.listDatabases.nodatabases          = \u6CA1\u6709\u6570\u636E\u5E93
@@ -212,6 +215,7 @@
 internaldb.runSQLHelp.runSQLExp               = \u5728"SQL\u547D\u4EE4"\u6587\u672C\u6846\u4E2D\uFF0C\u8F93\u5165\u7528\u5206\u53F7\u5206\u5272\u7684SQL\u547D\u4EE4\uFF0C\u70B9\u51FB"\u8FD0\u884C
SQL"\u6309\u94AE\u6765\u8FD0\u884CSQL\u547D\u4EE4\u3002
 internaldb.runSQLHelp.summary                 = \u5141\u8BB8\u7528\u6237\u8FD0\u884C\uFF33\uFF31\uFF2C\u547D\u4EE4\u53BB\u64CD\u4F5C\u8868\u4E2D\u7684\u6570\u636E\uFF0C\u521B\u5EFA\u6216\u5220\u9664\u6570\u636E\u5E93\u3002\u5728&quot;SQL\u547D\u4EE4&quot;\u6587\u672C\u6846\u4E2D\uFF0C\u7528\u6237\u53EF\u4EE5\u8F93\u5165SQL\u547D\u4EE4,\u5E76\u70B9\u51FB&quot;\u8FD0\u884CSQL.&quot;
 internaldb.runSQLHelp.useDBExp                = \u4ECE\u4E0B\u62C9\u6846\u4E2D\u9009\u62E9\u8981\u66F4\u65B0\u7684\u6570\u636E\u5E93\u3002
+internaldb.runSQLHelp.useDSExp                = Select a datasource to use from the pull-down
menu.
 internaldb.runSQLNormal.note1                 = 1) \u4F7F\u7528';'\u5206\u5F00\u591A\u4E2A\u8BED\u53E5
 internaldb.runSQLNormal.note2                 = 2) \u5355\u4E2A'Select'\u8BED\u53E5\u7684\u67E5\u8BE2\u7ED3\u679C\u4F1A\u88AB\u663E\u793A
 internaldb.runSQLNormal.note3                 = 3) \u4F7F\u7528\u5355\u5F15\u53F7\u62EC\u4F4F\u6587\u672C\u5B57\u7B26\u4E32

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/portlet.xml?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/portlet.xml
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/portlet.xml
Fri Oct  3 08:21:40 2008
@@ -96,6 +96,33 @@
             <short-title>Run SQL</short-title>
             <keywords>Run SQL</keywords>
         </portlet-info>
+        <init-param>
+            <name>connectionMode</name>
+            <value>database</value>
+        </init-param>
+    </portlet>
+
+    <portlet>
+        <description>Portlet for running DataSource SQL commands</description>
+        <portlet-name>RunSQLDS</portlet-name>
+        <display-name>DataSource Run SQL Portlet</display-name>
+        <portlet-class>org.apache.geronimo.console.internaldb.RunSQLPortlet</portlet-class>
+        <expiration-cache>-1</expiration-cache>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <portlet-mode>HELP</portlet-mode>
+        </supports>
+        <supported-locale>en</supported-locale>
+        <portlet-info>
+            <title>Run SQL</title>
+            <short-title>Run SQL</short-title>
+            <keywords>Run SQL</keywords>
+        </portlet-info>
+        <init-param>
+            <name>connectionMode</name>
+            <value>datasource</value>
+        </init-param>
     </portlet>
 
     <portlet>

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/internalDBNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/internalDBNormal.jsp?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/internalDBNormal.jsp
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/internalDBNormal.jsp
Fri Oct  3 08:21:40 2008
@@ -48,13 +48,13 @@
   </c:otherwise>
 </c:choose>
 --%>
-
-<table width="100%">
+<b><fmt:message key="internaldb.common.DB"/>:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="DB">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center"><fmt:message
key="internaldb.common.DB"/></td> 
+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
-  <tr> 
     <td class="LightBackground" width="20%" nowrap><fmt:message key="internaldb.common.DBProductName"/></td>

     <td class="LightBackground" width="80%">${internalDB['DB Product Name']}</td>

   </tr> 
@@ -72,12 +72,13 @@
   </tr> 
 </table>
 <br>
-<table width="100%">
+<b><fmt:message key="internaldb.common.driver"/>:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="Driver">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center"><fmt:message
key="internaldb.common.driver"/></td> 
+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
-  <tr> 
     <td class="LightBackground" width="20%" nowrap><fmt:message key="internaldb.common.driverName"/></td>

     <td class="LightBackground" width="80%">${internalDB['Driver Name']}</td>

   </tr> 
@@ -95,12 +96,13 @@
   </tr> 
 </table>
 <br>  
-<table width="100%">
+<b>JDBC:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="JDBC">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center">JDBC</td>

+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
-  <tr> 
     <td class="LightBackground" width="20%" nowrap><fmt:message key="internaldb.common.JDBCMajorVersion"/></td>

     <td class="LightBackground" width="80%">${internalDB['JDBC Major Version']}</td>

   </tr> 
@@ -110,9 +112,11 @@
   </tr> 
 </table>
 <br>
-<table width="100%">
+<b><fmt:message key="internaldb.common.etc"/>:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="ETC">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center"><fmt:message
key="internaldb.common.etc"/></td> 
+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
     <td class="LightBackground" width="20%" nowrap>URL</td> 
@@ -128,12 +132,13 @@
   </tr> 
 </table>
 <br>
-<table width="100%">
+<b><fmt:message key="internaldb.common.functions"/>:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="Functions">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center"><fmt:message
key="internaldb.common.functions"/></td> 
+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
-  <tr> 
     <td class="LightBackground" width="20%" nowrap><fmt:message key="internaldb.common.numericFunctions"/></td>

     <td class="LightBackground" width="80%">${internalDB['Numeric Functions']}</td>

   </tr> 
@@ -151,12 +156,13 @@
   </tr> 
 </table>
 <br>  
-<table width="100%">
+<b>SQL:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="SQL">
   <tr> 
-    <td class="DarkBackground" width="100%" colspan="2" align="center">SQL</td>

+    <th scope="col" class="DarkBackground" width="20%" align="center"><fmt:message
key="internaldb.common.Item"/></th>
+    <th scope="col" class="DarkBackground" width="80%" align="center"><fmt:message
key="internaldb.common.Value"/></th>
   </tr> 
   <tr> 
-  <tr> 
     <td class="LightBackground" width="20%" nowrap><fmt:message key="internaldb.common.supportedSQLKeywords"/></td>

     <td class="LightBackground" width="80%">${internalDB['Supported SQL Keywords']}</td>

   </tr> 

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/listDatabases.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/listDatabases.jsp?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/listDatabases.jsp
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/listDatabases.jsp
Fri Oct  3 08:21:40 2008
@@ -21,11 +21,11 @@
 <fmt:setBundle basename="systemdatabase"/>
 <portlet:defineObjects/>
 
-<center><b><fmt:message key="internaldb.listDatabases.title"/></b></center>
-<table width="100%">
+<b><fmt:message key="internaldb.listDatabases.title"/>:</b>
+<table width="100%" style="border-style: solid;border-width: 1px;" summary="DB Viewer
- DB List">
   <tr>
-    <td class="DarkBackground" colspan="1" align="center"><fmt:message key="internaldb.common.databases"/></td>
-    <td class="DarkBackground" colspan="2" align="center"><fmt:message key="internaldb.common.viewTables"/></td>
+    <th scope="col" class="DarkBackground" colspan="1" align="center"><fmt:message
key="internaldb.common.databases"/></th>
+    <th scope="col" class="DarkBackground" colspan="2" align="center"><fmt:message
key="internaldb.common.viewTables"/></th>
   </tr>
   <%-- Check if there are databases to display  --%>
   <c:choose>

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLHelp.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLHelp.jsp?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLHelp.jsp
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLHelp.jsp
Fri Oct  3 08:21:40 2008
@@ -14,11 +14,25 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
 <fmt:setBundle basename="systemdatabase"/>
 <p><fmt:message key="internaldb.runSQLHelp.summary"/><br>
   </p>
 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
+<c:choose>
+ <c:when test="${connectionMode == 'datasource'}">
+  <tr>
+    <td class="MediumBackground" style="padding: 10px 10px 10px 5px; color: #1E1E52;"
width="150" align="right" valign="top"><fmt:message key="internaldb.common.useDS"/>:</td>
+    <td class="LightBackground" style="padding: 10px 5px 10px 10px" valign="top"><fmt:message
key="internaldb.runSQLHelp.useDSExp"/></td>
+  </tr>
+  <tr>
+    <td class="MediumBackground" style="padding: 10px 10px 10px 5px; color: #1E1E52;"
width="150" align="right" valign="top">
+      <img src="/console/images/run_sql.gif" alt="Run SQL"/></td>
+    <td class="LightBackground" style="padding: 10px 5px 10px 10px" valign="top"><fmt:message
key="internaldb.runSQLHelp.runSQLExp"/></td>
+  </tr>
+ </c:when>
+ <c:otherwise>
   <tr>
     <td class="MediumBackground" style="padding: 10px 10px 10px 5px; color: #1E1E52;"
width="150" align="right" valign="top"><fmt:message key="internaldb.common.createDB"/>:
/ <br>      
       <img src="/console/images/create.gif" alt="Create"/></td>
@@ -38,4 +52,6 @@
       <img src="/console/images/run_sql.gif" alt="Run SQL"/></td>
     <td class="LightBackground" style="padding: 10px 5px 10px 10px" valign="top"><fmt:message
key="internaldb.runSQLHelp.runSQLExp"/></td>
   </tr>
+ </c:otherwise>
+</c:choose>
 </table>

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLNormal.jsp?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLNormal.jsp
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/internaldb/runSQLNormal.jsp
Fri Oct  3 08:21:40 2008
@@ -47,15 +47,17 @@
 <form name="<portlet:namespace/>DBForm" action="<portlet:actionURL portletMode='view'/>"
method="post">
 <input type="hidden" name="action" value="" />
 <table width="100%"  border="0">
+<c:choose>
+ <c:when test="${connectionMode == 'database'}">
   <tr>
-    <td><div align="right"><fmt:message key="internaldb.common.createDB"/>:</div></td>
-    <td><input name="createDB" type="text" size="30">&nbsp;
+    <td><div align="right"><label for="<portlet:namespace/>createDB"><fmt:message
key="internaldb.common.createDB"/></label>:</div></td>
+    <td><input name="createDB" id="<portlet:namespace/>createDB" type="text"
size="30">&nbsp;
       <input type="submit" value='<fmt:message key="internaldb.common.create"/>'
onClick="return <portlet:namespace/>validateForm1();"></td>
     </tr>
   <tr>
-    <td><div align="right"><fmt:message key="internaldb.common.deleteDB"/>:</div></td>
+    <td><div align="right"><label for="<portlet:namespace/>deleteDB"><fmt:message
key="internaldb.common.deleteDB"/></label>:</div></td>
     <td>
-      <select name="deleteDB">
+      <select name="deleteDB" id="<portlet:namespace/>deleteDB">
       <c:forEach var="db" items="${databases}" varStatus="status">
         <option value="${db}">${db}</option>
       </c:forEach>
@@ -64,22 +66,36 @@
     </td>
   </tr>
   <tr>
-    <td><div align="right"><fmt:message key="internaldb.common.useDB"/>:</div></td>
+    <td><div align="right"><label for="<portlet:namespace/>useDB"><fmt:message
key="internaldb.common.useDB"/></label>:</div></td>
     <td>
-      <select name="useDB">
+      <select name="useDB" id="<portlet:namespace/>useDB">
+      <c:forEach var="db" items="${databases}" varStatus="status">
+        <option value="${db}"<c:if test="${useDB==db}"> selected="selected"</c:if>>${db}</option>
+      </c:forEach>
+      </select>&nbsp;
+      <input type="submit" value="Run SQL" onClick="return <portlet:namespace/>validateForm3();"></td>
+  </tr>
+ </c:when>
+ <c:otherwise>
+  <tr>
+    <td><div align="right"><label for="<portlet:namespace/>useDB"><fmt:message
key="internaldb.common.useDS"/></label>:</div></td>
+    <td>
+      <select name="useDB" id="<portlet:namespace/>useDB">
       <c:forEach var="dsName" items="${dataSourceNames}" varStatus="status">
         <option value="${dsName}"<c:if test="${useDB==dsName}"> selected="selected"</c:if>>${dsName}</option>
       </c:forEach>
       </select>&nbsp;
       <input type="submit" value="Run SQL" onClick="return <portlet:namespace/>validateForm3();"></td>
   </tr>
+ </c:otherwise>
+</c:choose>
   <tr>
     <td></td>
-    <td><div align="left"><fmt:message key="internaldb.common.SQLCommands"/>:</div></td>
+    <td><div align="left"><label for="<portlet:namespace/>sqlStmts"><fmt:message
key="internaldb.common.SQLCommands"/></label>:</div></td>
   </tr>
   <tr>
     <td></td>
-    <td><textarea name="sqlStmts" cols="65" rows="15"><c:out value="${sqlStmts}"
/></textarea></td>
+    <td><textarea name="sqlStmts" id="<portlet:namespace/>sqlStmts" cols="65"
rows="15"><c:out value="${sqlStmts}" /></textarea></td>
   </tr>
 </table>
 
@@ -113,6 +129,19 @@
 
 <%-- Display query result from single select statement --%>
 <c:if test="${!empty singleSelectStmt}">
+    <%-- If in Database mode, make sure we have a Derby connection --%>
+    <c:if test="${connectionMode == 'database'}">
+      <c:if test="${ds == null}">
+        <%-- Create the connection manually --%>
+        <sql:setDataSource
+          var="ds"
+          driver="org.apache.derby.jdbc.EmbeddedDriver"
+          url="jdbc:derby:${useDB};create=true"
+          user=""
+          password=""
+        />
+      </c:if>
+	</c:if>
 
 <%-- Select statement --%>
 <sql:transaction dataSource="${ds}">

Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/web.xml?rev=701411&r1=701410&r2=701411&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/web.xml
Fri Oct  3 08:21:40 2008
@@ -67,6 +67,16 @@
     </servlet>
 
    <servlet>
+        <display-name>Pluto Wrapper for DataSource Run SQL Portlet</display-name>
+        <servlet-name>RunSQLDS</servlet-name>
+        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+        <init-param>
+            <param-name>portlet-name</param-name>
+            <param-value>RunSQLDS</param-value>
+        </init-param>
+    </servlet>
+
+   <servlet>
         <display-name>Pluto Wrapper for Derby Log Viewer Portlet</display-name>
         <servlet-name>DerbyLogViewer</servlet-name>
         <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
@@ -107,6 +117,11 @@
     </servlet-mapping>
 
     <servlet-mapping>
+        <servlet-name>RunSQLDS</servlet-name>
+        <url-pattern>/PlutoInvoker/RunSQLDS/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
         <servlet-name>DerbyLogViewer</servlet-name>
         <url-pattern>/PlutoInvoker/DerbyLogViewer/*</url-pattern>
     </servlet-mapping>



Mime
View raw message