I don't like the idea to expose a getDataSource method on JDOManager as
we would then also need to expose a getDriver method. As you know we
still have problems with lifecycle management and exposing those methods
won't make things easier.

I could live with exposing a getConnectionFactory method while i would
still declare it experimental so we are able to change that in the
future without keeping backward compatibility for a long time.

Ralf


Werner Guttmann schrieb:
> Ralf,
> 
> Have a look at the followig rough idea ...
> 
> Index: src/main/java/org/exolab/castor/jdo/JDOManager.java
> =================================================================== ---
> src/main/java/org/exolab/castor/jdo/JDOManager.java   (Revision 6868)
> +++ src/main/java/org/exolab/castor/jdo/JDOManager.java       (Arbeitskopie)
> @@ -70,6 +70,7 @@  import org.castor.jdo.conf.JdoConf;
>  import org.castor.jdo.engine.AbstractConnectionFactory;
>  import org.castor.jdo.engine.ConnectionFactory;
> +import org.castor.jdo.engine.DataSourceConnectionFactory;
>  import org.castor.jdo.engine.DatabaseRegistry;
>  import org.castor.transactionmanager.LocalTransactionManager;
>  import org.castor.util.Messages;
> @@ -882,6 +883,22 @@              LOG.fatal ("Problem closing down
> caches", e);
>          }
>      }
> +    
> +    /**
> +     * Returns the JDBC [EMAIL PROTECTED] DataSource} used internally by this
> Castor [EMAIL PROTECTED] JDOManager} 
> +     * instance; null, if this Castor JDOManager instance does not use
> a JDBC
> +     * [EMAIL PROTECTED] DataSource}. 
> +     * @return the JDBC [EMAIL PROTECTED] DataSource} used internally; null
> otherwise.
> +     * @throws MappingException If there#s a problem loading the JDO
> configuration.
> +     */
> +    public DataSource getDataSource() throws MappingException {
> +        AbstractConnectionFactory factory = 
> +            DatabaseRegistry.getConnectionFactory(_databaseName);
> +        if (factory instanceof DataSourceConnectionFactory) {
> +            return ((DataSourceConnectionFactory)
> factory).getDataSource();
> +        }
> +        return null;
> +    }
>  
> //----------------------------------------------------------------------
> ----
>  }
>  
> Index:
> src/main/java/org/castor/jdo/engine/DataSourceConnectionFactory.java
> =================================================================== ---
> src/main/java/org/castor/jdo/engine/DataSourceConnectionFactory.java
> (Revision 6868) +++
> src/main/java/org/castor/jdo/engine/DataSourceConnectionFactory.java
> (Arbeitskopie) @@ -230,6 +230,14 @@          return
> ConnectionProxyFactory.newConnectionProxy(
>                  _dataSource.getConnection(), getClass().getName());
>      }
> +    
> +    /**
> +     * Returns the JDBC [EMAIL PROTECTED] DataSource} instance used by this
> connection factory.
> +     * @return the JDBC [EMAIL PROTECTED] DataSource} instance currently 
> used.
> +     */
> +    public DataSource getDataSource() {
> +        return _dataSource;
> +    }
>  
>  
> //----------------------------------------------------------------------
> ----
>  }
> 
> To introduce a new getDataSource() method on JDOManager. I have not
> given any though on the return value, or whether an exception should be
> thrown, though.
> 
> Werner
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email

-- 

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to