Thomas, would you mind to document the database autodetect feature (e.g.
in
/torque-site/src/site/xdoc/documentation/modules/runtime/reference/initialisation-configuration.xml)
?
Thanks,
Thomas
> Author: tv
> Date: Sat Sep 10 10:58:10 2011
> New Revision: 1167496
>
> URL: http://svn.apache.org/viewvc?rev=1167496&view=rev
> Log:
> Need to re-arrange the handling of the default database entry to
> include it in the auto-detection
>
> Modified:
> db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/
> torque/TorqueInstance.java
>
> Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/
> apache/torque/TorqueInstance.java
> URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-
> runtime/src/main/java/org/apache/torque/TorqueInstance.java?
> rev=1167496&r1=1167495&r2=1167496&view=diff
>
==============================================================================
> --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/
> torque/TorqueInstance.java (original)
> +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/
> torque/TorqueInstance.java Sat Sep 10 10:58:10 2011
> @@ -147,6 +147,39 @@ public class TorqueInstance
> initDataSourceFactories(conf);
> initAdapters(conf);
>
> + // As there might be a default database configured
> + // to map "default" onto an existing datasource, we
> + // must check, whether there _is_ really an entry for
> + // the "default" in the dsFactoryMap or not. If it is
> + // not, then add a dummy entry for the "default"
> + //
> + // Without this, you can't actually access the "default"
> + // data-source, even if you have an entry like
> + //
> + // database.default = bookstore
> + //
> + // in your Torque.properties
> + //
> +
> + {
> + Database defaultDatabase = databases.get(defaultDBName);
> + Database databaseInfoForKeyDefault
> + = getOrCreateDatabase(DEFAULT_NAME);
> + if ((!defaultDBName.equals(DEFAULT_NAME))
> + && databaseInfoForKeyDefault.getDataSourceFactory() ==
null)
> + {
> + log.debug("Adding the DatasourceFactory and
> DatabaseAdapter from database "
> + + defaultDBName
> + + " onto database " + DEFAULT_NAME);
> + databaseInfoForKeyDefault.setDataSourceFactory(
> + defaultDatabase.getDataSourceFactory());
> + databaseInfoForKeyDefault.setAdapter(
> + defaultDatabase.getAdapter());
> +
> + this.defaultDsfIsReference = true;
> + }
> + }
> +
> // setup manager mappings
> initManagerMappings(conf);
>
> @@ -409,39 +442,6 @@ public class TorqueInstance
> log.error(error);
> throw new TorqueException(error);
> }
> -
> - // As there might be a default database configured
> - // to map "default" onto an existing datasource, we
> - // must check, whether there _is_ really an entry for
> - // the "default" in the dsFactoryMap or not. If it is
> - // not, then add a dummy entry for the "default"
> - //
> - // Without this, you can't actually access the "default"
> - // data-source, even if you have an entry like
> - //
> - // database.default = bookstore
> - //
> - // in your Torque.properties
> - //
> -
> - {
> - Database databaseInfoForKeyDefault
> - = getOrCreateDatabase(DEFAULT_NAME);
> - if ((!defaultDBName.equals(DEFAULT_NAME))
> - && databaseInfoForKeyDefault.getDataSourceFactory() ==
null)
> - {
> - log.debug("Adding the DatasourceFactory and
> DatabaseAdapter from database "
> - + defaultDBName
> - + " onto database " + DEFAULT_NAME);
> - databaseInfoForKeyDefault.setDataSourceFactory(
> - defaultDatabase.getDataSourceFactory());
> - databaseInfoForKeyDefault.setAdapter(
> - defaultDatabase.getAdapter());
> -
> - this.defaultDsfIsReference = true;
> - }
> - }
> -
> }
>
> /**
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]