You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2002/08/17 01:25:31 UTC
cvs commit: jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources SaveDataSourceAction.java SetUpDataSourceAction.java
amyroh 2002/08/16 16:25:31
Modified: webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources
SaveDataSourceAction.java
SetUpDataSourceAction.java
Log:
Change to look for "username" attribute insted of "user" in JNDI datasource
since DBCP no longer supports the "user" attribute.
Fix for bugzilla 11775.
Revision Changes Path
1.2 +17 -17 jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SaveDataSourceAction.java
Index: SaveDataSourceAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SaveDataSourceAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveDataSourceAction.java 18 Jul 2002 16:48:27 -0000 1.1
+++ SaveDataSourceAction.java 16 Aug 2002 23:25:31 -0000 1.2
@@ -176,26 +176,26 @@
Object params[] = new Object[2];
params[0] = dataSourceForm.getJndiName();
- params[1] = ResourceUtils.DATASOURCE_CLASS;
-
+ params[1] = ResourceUtils.DATASOURCE_CLASS;
+
String resourcetype = dataSourceForm.getResourcetype();
String path = dataSourceForm.getPath();
String host = dataSourceForm.getHost();
String service = dataSourceForm.getService();
-
+
ObjectName oname = null;
try {
if (resourcetype!=null) {
// Construct the MBean Name for the naming source
if (resourcetype.equals("Global")) {
- oname =
+ oname =
new ObjectName(ResourceUtils.NAMINGRESOURCES_TYPE +
ResourceUtils.GLOBAL_TYPE);
- } else if (resourcetype.equals("Context")) {
- oname =
- new ObjectName (ResourceUtils.NAMINGRESOURCES_TYPE +
- ResourceUtils.CONTEXT_TYPE + ",path=" + path +
+ } else if (resourcetype.equals("Context")) {
+ oname =
+ new ObjectName (ResourceUtils.NAMINGRESOURCES_TYPE +
+ ResourceUtils.CONTEXT_TYPE + ",path=" + path +
",host=" + host + ",service=" + service);
} else if (resourcetype.equals("DefaultContext")) {
// add defaultcontext support later
@@ -205,7 +205,7 @@
// Create the new object and associated MBean
objectName = (String) mserver.invoke(oname, "addResource",
params, signature);
-
+
} catch (Exception e) {
getServlet().log
@@ -219,11 +219,11 @@
}
}
-
+
// Perform an "Update User database" transaction
String attribute = null;
try {
-
+
ObjectName oname = new ObjectName(objectName);
attribute = "url";
@@ -234,7 +234,7 @@
mserver.setAttribute
(oname,
new Attribute(attribute, dataSourceForm.getDriverClass()));
- attribute = "user";
+ attribute = "username";
mserver.setAttribute
(oname,
new Attribute(attribute, dataSourceForm.getUsername()));
@@ -271,7 +271,7 @@
return (null);
}
-
+
// Proceed to the list entries screen
return (mapping.findForward("DataSources List Setup"));
1.2 +15 -15 jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SetUpDataSourceAction.java
Index: SetUpDataSourceAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/SetUpDataSourceAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetUpDataSourceAction.java 18 Jul 2002 16:48:27 -0000 1.1
+++ SetUpDataSourceAction.java 16 Aug 2002 23:25:31 -0000 1.2
@@ -115,7 +115,7 @@
* The MessageResources we will be retrieving messages from.
*/
private MessageResources resources = null;
-
+
// --------------------------------------------------------- Public Methods
@@ -156,8 +156,8 @@
String path = request.getParameter("path");
String host = request.getParameter("host");
String service = request.getParameter("service");
-
- DataSourceForm dataSourceForm = new DataSourceForm();
+
+ DataSourceForm dataSourceForm = new DataSourceForm();
dataSourceForm.setResourcetype(resourcetype);
dataSourceForm.setPath(path);
dataSourceForm.setHost(host);
@@ -172,12 +172,12 @@
dataSourceForm.setIdle("2");
dataSourceForm.setWait("5000");
dataSourceForm.setType(ResourceUtils.DATASOURCE_CLASS);
-
+
} else {
dataSourceForm.setNodeLabel
(resources.getMessage(locale, "resources.actions.datasrc.edit"));
dataSourceForm.setObjectName(objectName);
-
+
String attribute = null;
try {
ObjectName oname = new ObjectName(objectName);
@@ -190,7 +190,7 @@
attribute = "driverClassName";
dataSourceForm.setDriverClass
((String) mserver.getAttribute(oname, attribute));
- attribute = "user";
+ attribute = "username";
dataSourceForm.setUsername
((String) mserver.getAttribute(oname, attribute));
attribute = "password";
@@ -199,7 +199,7 @@
try {
attribute = "maxActive";
dataSourceForm.setActive
- ((String) mserver.getAttribute(oname, attribute));
+ ((String) mserver.getAttribute(oname, attribute));
} catch (Exception e) {
// if maxActive not defined, display default value
dataSourceForm.setActive("4");
@@ -207,11 +207,11 @@
try {
attribute = "maxIdle";
dataSourceForm.setIdle
- ((String) mserver.getAttribute(oname, attribute));
+ ((String) mserver.getAttribute(oname, attribute));
} catch (Exception e) {
// if maxIdle not defined, display default value
dataSourceForm.setIdle("2");
- }
+ }
try {
attribute = "maxWait";
dataSourceForm.setWait
@@ -236,9 +236,9 @@
resources.getMessage
(locale, "users.error.attribute.get", attribute));
return (null);
- }
+ }
}
-
+
// Stash the form bean and forward to the display page
saveToken(request);
request.setAttribute("dataSourceForm", dataSourceForm);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>