commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcna...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool TorqueClassicDataSource.java
Date Tue, 21 May 2002 19:43:28 GMT
jmcnally    02/05/21 12:43:28

  Modified:    jdbc2pool/src/java/org/apache/commons/jdbc2pool
                        TorqueClassicDataSource.java
  Log:
  adopt the named property syntax of commons-beanutils
  
  Revision  Changes    Path
  1.4       +20 -10    jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/TorqueClassicDataSource.java
  
  Index: TorqueClassicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/TorqueClassicDataSource.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TorqueClassicDataSource.java	19 May 2002 23:22:54 -0000	1.3
  +++ TorqueClassicDataSource.java	21 May 2002 19:43:28 -0000	1.4
  @@ -86,7 +86,7 @@
    * Torque's default connection pool DataSource
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  - * @version $Id: TorqueClassicDataSource.java,v 1.3 2002/05/19 23:22:54 jmcnally Exp $
  + * @version $Id: TorqueClassicDataSource.java,v 1.4 2002/05/21 19:43:28 jmcnally Exp $
    */
   public class TorqueClassicDataSource
       implements DataSource, Referenceable, Serializable, ObjectFactory
  @@ -350,7 +350,8 @@
       {
           this.description = v;
       }
  -        
  +
  +
       /**
        * Get the value of jndiEnvironment which is used when instantiating
        * a jndi InitialContext.  This InitialContext is used to locate the
  @@ -358,9 +359,14 @@
        *
        * @return value of jndiEnvironment.
        */
  -    public Properties getJndiEnvironment() 
  +    public String getJndiEnvironment(String key) 
       {
  -        return jndiEnvironment;
  +        String value = null;
  +        if (jndiEnvironment != null) 
  +        {
  +            value = jndiEnvironment.getProperty(key);
  +        }
  +        return value;
       }
       
       /**
  @@ -370,10 +376,15 @@
        *
        * @param v  Value to assign to jndiEnvironment.
        */
  -    public void setJndiEnvironment(Properties  v) 
  +    public void setJndiEnvironment(String key, String value) 
       {
  -        this.jndiEnvironment = v;
  +        if (jndiEnvironment == null) 
  +        {
  +            jndiEnvironment = new Properties();
  +        }
  +        jndiEnvironment.setProperty(key, value);
       }
  +
       
       /**
        * Get the value of connectionPoolDataSource.  This method will return
  @@ -550,11 +561,11 @@
   
           byte[] serJndiEnv = null;
           // BinaryRefAddr does not allow null byte[].
  -        if ( getJndiEnvironment() != null ) 
  +        if ( jndiEnvironment != null ) 
           {
               try
               {
  -                serJndiEnv = serialize(getJndiEnvironment());
  +                serJndiEnv = serialize(jndiEnvironment);
                   ref.add(new BinaryRefAddr("jndiEnvironment", serJndiEnv));
               }
               catch (IOException ioe)
  @@ -610,8 +621,7 @@
               if ( refAddr != null ) 
               {
                   byte[] serialized = (byte[])refAddr.getContent();
  -                setJndiEnvironment( 
  -                    (Properties)Objects.deserialize(serialized) );
  +                jndiEnvironment = (Properties)Objects.deserialize(serialized);
               }
   
               refAddr = ref.get("perUserMaxConnections");
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message