geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r810493 - in /geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main: java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java webapp/WEB-INF/view/dbwizard/testConnection.jsp
Date Wed, 02 Sep 2009 12:55:00 GMT
Author: xuhaihong
Date: Wed Sep  2 12:54:59 2009
New Revision: 810493

URL: http://svn.apache.org/viewvc?rev=810493&view=rev
Log:
GERONIMO-4835 Can not import datasource from JBOSS4

Modified:
    geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
    geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/testConnection.jsp

Modified: geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?rev=810493&r1=810492&r2=810493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
(original)
+++ geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
Wed Sep  2 12:54:59 2009
@@ -366,21 +366,20 @@
             }
         } 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;
+            if (test == null || test.equals("true")) {                              
                 try {
-                    result = attemptConnect(actionRequest, data);
+                    String targetDBInfo = attemptConnect(actionRequest, data);
+                    actionResponse.setRenderParameter("targetDBInfo", targetDBInfo);
+                    actionResponse.setRenderParameter("connected", "true");
                 } 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);
+                    temp.close();                   
+                    addErrorMessage(actionRequest, getLocalizedString(actionRequest, "dbwizard.testConnection.connectionError"),
writer.getBuffer().toString());
+                    actionResponse.setRenderParameter("connected", "false");
+                }                             
                 actionResponse.setRenderParameter(MODE_KEY, TEST_CONNECTION_MODE);
             } else {
                 save(actionRequest, actionResponse, data, false);
@@ -884,8 +883,8 @@
 
     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"));
+        renderRequest.setAttribute("targetDBInfo", renderRequest.getParameter("targetDBInfo"));
+        renderRequest.setAttribute("connected", Boolean.valueOf(renderRequest.getParameter("connected")));
         testConnectionView.include(renderRequest, renderResponse);
     }
 

Modified: geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/testConnection.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/testConnection.jsp?rev=810493&r1=810492&r2=810493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/testConnection.jsp
(original)
+++ geronimo/server/trunk/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/testConnection.jsp
Wed Sep  2 12:54:59 2009
@@ -21,7 +21,6 @@
 <fmt:setBundle basename="systemdatabase"/>
 <portlet:defineObjects/>
 
-<CommonMsg:commonMsg/>
 
 <p><fmt:message key="dbwizard.testConnection.title"/></p>
 
@@ -37,7 +36,8 @@
     <input type="hidden" name="urlPrototype" value="${pool.urlPrototype}" />
     <c:forEach var="jar" items="${pool.jars}">
      <input type="hidden" name="jars" value="${jar}" />
-    </c:forEach>    <input type="hidden" name="adapterDisplayName" value="${pool.adapterDisplayName}"
/>
+    </c:forEach>    
+    <input type="hidden" name="adapterDisplayName" value="${pool.adapterDisplayName}"
/>
     <input type="hidden" name="minSize" value="${pool.minSize}" />
     <input type="hidden" name="maxSize" value="${pool.maxSize}" />
     <input type="hidden" name="idleTimeout" value="${pool.idleTimeout}" />
@@ -46,25 +46,40 @@
     <input type="hidden" name="adapterDescription" value="${pool.adapterDescription}"
/>
     <input type="hidden" name="rarPath" value="${pool.rarPath}" />
     <input type="hidden" name="transactionType" value="${pool.transactionType}" />
-  <c:forEach var="prop" items="${pool.properties}">
-    <input type="hidden" name="${prop.key}" value="${prop.value}" />
-  </c:forEach>
-  <c:forEach var="prop" items="${pool.urlProperties}">
-    <input type="hidden" name="${prop.key}" value="${prop.value}" />
-  </c:forEach>
+    <c:forEach var="prop" items="${pool.properties}">
+        <input type="hidden" name="${prop.key}" value="${prop.value}" />
+    </c:forEach>
+    <c:forEach var="prop" items="${pool.urlProperties}">
+        <input type="hidden" name="${prop.key}" value="${prop.value}" />
+    </c:forEach>
     <table border="0">
+        <tr>
+            <td style="min-width: 140px"><div align="right"><fmt:message key="dbwizard.testConnection.testResult"/>:</div></td>
+                <td>
+                    <c:choose>
+                        <c:when test="${connected}">
+                            <fmt:message key="dbwizard.testConnection.connectedTo"/>
${targetDBInfo}              
+                        </c:when>
+                        <c:otherwise>
+                            <font color="red"><i><fmt:message key="dbwizard.testConnection.connectionError"/></i></font>
+                            <CommonMsg:commonMsg/>
+                        </c:otherwise>
+                    </c:choose>
+                </td>
+      </tr>
     <!-- SUBMIT BUTTON -->
       <tr>
-        <td></td>
+        <td>&nbsp;</td>
         <td>
           <c:choose>
-            <c:when test="${empty connectResult}">
-<input type="submit" value='<fmt:message key="dbwizard.testConnection.deployAnyway"/>'
/>
-<input type="button" value='<fmt:message key="dbwizard.common.editSettings"/>' onclick="document.<portlet:namespace/>DatabaseForm.mode.value='edit';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />
-<input type="button" value='<fmt:message key="dbwizard.testConnection.testAgain"/>'
onclick="document.<portlet:namespace/>DatabaseForm.mode.value='process-url';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />
-            </c:when><c:otherwise>
-<input type="submit" value='<fmt:message key="dbwizard.common.deploy"/>' />
-<input type="button" value='<fmt:message key="dbwizard.common.showPlan"/>' onclick="document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />
+            <c:when test="${connected}">
+                <input type="submit" value='<fmt:message key="dbwizard.common.deploy"/>'
/>
+                <input type="button" value='<fmt:message key="dbwizard.common.showPlan"/>'
onclick="document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />                
+            </c:when>
+            <c:otherwise>               
+                <input type="submit" value='<fmt:message key="dbwizard.testConnection.deployAnyway"/>'
/>
+                <input type="button" value='<fmt:message key="dbwizard.common.editSettings"/>'
onclick="document.<portlet:namespace/>DatabaseForm.mode.value='edit';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />
+                <input type="button" value='<fmt:message key="dbwizard.testConnection.testAgain"/>'
onclick="document.<portlet:namespace/>DatabaseForm.mode.value='process-url';document.<portlet:namespace/>DatabaseForm.submit();return
false;" />
             </c:otherwise>
           </c:choose>
         </td>



Mime
View raw message