tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources ResourceUtils.java SetUpDataSourceAction.java
Date Fri, 30 Apr 2004 17:54:00 GMT
amyroh      2004/04/30 10:54:00

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources
                        ResourceUtils.java SetUpDataSourceAction.java
  Log:
  Change to list any additionally JNDI data-sources that are present
  in the web.xml file, but not defined either globally or at the context level,
  on the context level maintenance page to make it possible to click on the
  data-source and edit it.
  
  Revision  Changes    Path
  1.11      +4 -15     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/ResourceUtils.java
  
  Index: ResourceUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/ResourceUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ResourceUtils.java	28 Apr 2004 16:46:03 -0000	1.10
  +++ ResourceUtils.java	30 Apr 2004 17:53:59 -0000	1.11
  @@ -22,6 +22,7 @@
   import java.util.Iterator;
   import java.util.Collections;
   
  +import javax.management.Attribute;
   import javax.management.AttributeNotFoundException;
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
  @@ -205,20 +206,8 @@
                   mserver.getAttribute(oname, "driverClassName");
                   results.add(oname.toString());
               } catch (AttributeNotFoundException ex) {
  -                // if context resource definition doesn't exist
  -                // get the global resource definition
  -                if (resourcetype.equals("Context")) {
  -                    rname = new ObjectName( domain + RESOURCE_TYPE + 
  -                        GLOBAL_TYPE + ",class=" + DATASOURCE_CLASS + ",*");
  -                    Iterator globalIter = (mserver.queryMBeans(rname, null).iterator());
  -                    while (globalIter.hasNext()) {
  -                        ObjectInstance globalInstance = 
  -                            (ObjectInstance) globalIter.next();
  -                        ObjectName globalOname = globalInstance.getObjectName();
  -                        mserver.getAttribute(globalOname, "driverClassName");
  -                        results.add(globalOname.toString());
  -                    }
  -                }
  +                mserver.setAttribute(oname, 
  +                    new Attribute("driverClassName", ""));
               }
           }
   
  
  
  
  1.5       +27 -26    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SetUpDataSourceAction.java	27 Feb 2004 14:59:04 -0000	1.4
  +++ SetUpDataSourceAction.java	30 Apr 2004 17:53:59 -0000	1.5
  @@ -21,6 +21,7 @@
   import java.util.Iterator;
   import java.util.Locale;
   import javax.management.Attribute;
  +import javax.management.AttributeNotFoundException;
   import javax.management.MBeanServer;
   import javax.management.MBeanServerFactory;
   import javax.management.QueryExp;
  @@ -136,26 +137,33 @@
               String attribute = null;
               try {
                   ObjectName oname = new ObjectName(objectName);
  -                attribute = "name";
  -                dataSourceForm.setJndiName
  -                    ((String) mserver.getAttribute(oname, attribute));
  -                attribute = "url";
  -                dataSourceForm.setUrl
  -                    ((String) mserver.getAttribute(oname, attribute));
  -                attribute = "driverClassName";
  -                dataSourceForm.setDriverClass
  -                    ((String) mserver.getAttribute(oname, attribute));
  -                attribute = "username";
  -                dataSourceForm.setUsername
  -                    ((String) mserver.getAttribute(oname, attribute));
  -                attribute = "password";
  -                dataSourceForm.setPassword
  -                    ((String) mserver.getAttribute(oname, attribute));
  +                try {
  +                    attribute = "name";
  +                    dataSourceForm.setJndiName
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                    attribute = "url";
  +                    dataSourceForm.setUrl
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                    attribute = "driverClassName";
  +                    dataSourceForm.setDriverClass
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                    attribute = "username";
  +                    dataSourceForm.setUsername
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                    attribute = "password";
  +                    dataSourceForm.setPassword
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                    attribute = "validationQuery";
  +                    dataSourceForm.setQuery
  +                        ((String) mserver.getAttribute(oname, attribute));
  +                } catch (AttributeNotFoundException ex) {
  +                    // disply empty if attribute is not set yet
  +                }
                   try {
                       attribute = "maxActive";
                       dataSourceForm.setActive
                           ((String) mserver.getAttribute(oname, attribute));
  -                } catch (Exception e) {
  +                } catch (AttributeNotFoundException e) {
                       // if maxActive not defined, display default value
                       dataSourceForm.setActive("4");
                   }
  @@ -163,7 +171,7 @@
                       attribute = "maxIdle";
                       dataSourceForm.setIdle
                           ((String) mserver.getAttribute(oname, attribute));
  -                } catch (Exception e) {
  +                } catch (AttributeNotFoundException e) {
                       // if maxIdle not defined, display default value
                       dataSourceForm.setIdle("2");
                   }
  @@ -171,16 +179,9 @@
                       attribute = "maxWait";
                       dataSourceForm.setWait
                           ((String) mserver.getAttribute(oname, attribute));
  -                } catch (Exception e) {
  +                } catch (AttributeNotFoundException e) {
                       // if maxWait not defined, display default value
                       dataSourceForm.setWait("5000");
  -                }
  -                try {
  -                    attribute = "validationQuery";
  -                    dataSourceForm.setQuery
  -                        ((String) mserver.getAttribute(oname, attribute));
  -                } catch (Exception e) {
  -                    // don't display anything
                   }
               } catch (Exception e) {
                   getServlet().log
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message