closing Datasources at Torque.shutdown()

2005-06-26 Thread Thomas Fischer

Hi,

I would like to close DataSources initialized by Torque if 
Torque.shutdown() is called. To do this, I'd like to add a close()-method 
to the interface DataSourceFactory.


Closing works fine for SharedPoolDataSourceFactory and 
PerUserPoolDataSourceFactory. It does not work, however, for 
DataSourceFactories deployed/retrieved via JNDI. This has two reasons:
- First, one does not want to close Pools retrieved via JNDI. Other 
applications might use the same Datasource. Also, because we have not 
deployed the Datasource, we are not responsible for shutting it down.
- Second, even if we have deployed the Datasource, it is very problematic 
to shut it down because the interface DataSource does not have a close() 
method or anything similar. As any DataSource can be deployed, we do not 
know how to shut it down. One might think See if it is a DBCP Datasource, 
if yes, we know how to shut it down, let's do it is also no good solution 
because it is a very unintuitive behaviour and can lead to very strange 
errors.


Does anybody have any problems with that, or any suggestions to improve 
the behaviour ?


Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Torque.shutdown

2005-06-26 Thread Thomas Fischer

Hi,

At the moment, Torque.shutdown only stops any IdBrokers started by Torque. 
I'd like also to shutdown any data sources set up by Torque (see my 
previous mail). While doing this, I have come across the following 
questions:


- Why not releasing the TorqueInstance instance referenced by the Torque 
class ? After closing the DataSources, it should not hold any resources 
which need to be shut down (I am not 100% sure about the Managers, 
though). Releasing the TirqueInstance might make it possible to 
re-initialize Torque after shutdown.


- What should be done with an exception occuring while closing down the 
DataSources ? My current solution is to log every exception. The first 
exception which occurs is kept in memory, and Torqe tries to close the 
remaining DataSources. Any Excetion which occurs then is logged but 
ignored otherwise. Only the Datasources which are closed cleanly are 
removed from the map, and the first Exception is rethrown after all 
DataSources have been processed.


Any comments and suggestions are welcome.

   Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOURCE] Issue #TRQS311 - Throw an error if a connection is explicitly supplied as...

2005-06-26 Thread thomas fischer
You can view the issue detail at the following URL:

http://issues.apache.org/scarab/issues/id/TRQS311

Type
 Enhancement

Issue ID
 TRQS311 (Throw an error if a connection is explicitly supplied as zero)

Reported by
 thomas fischer
 [EMAIL PROTECTED] ([EMAIL PROTECTED])

New issue details:
-

Priority set to Low
Status set to New
Description set to In methods which access the da...
Summary set to  Throw an error if a connectio...
Issue created

-
This message is automatically generated by the Scarab
issue tracking system.  For more information:
http://scarab.tigris.org/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOURCE] Issue #TRQS311 modified

2005-06-26 Thread thomas fischer
You can view the issue detail at the following URL:

http://issues.apache.org/scarab/issues/id/TRQS311

Type
 Enhancement

Issue ID
 TRQS311 (Throw an error if a connection is explicitly supplied as zero)

Modified by
 thomas fischer
 [EMAIL PROTECTED] ([EMAIL PROTECTED])

The following modifications were made to this issue:
-

Added comment to issue 'My favourite implementation would be to implement a 
method(otherArguments, Connection con, boolean acceptNullConnection)
whicht throws an error if (con == null  !acceptNullConnection)'


-
This message is automatically generated by the Scarab
issue tracking system.  For more information:
http://scarab.tigris.org/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOURCE] Issue #TRQS252 modified

2005-06-26 Thread thomas fischer
You can view the issue detail at the following URL:

http://issues.apache.org/scarab/issues/id/TRQS252

Type
 Enhancement

Issue ID
 TRQS252 (Criteria getAsColumns   as ordered Hashtable)

Modified by
 thomas fischer
 [EMAIL PROTECTED] ([EMAIL PROTECTED])

The following modifications were made to this issue:
-

Added comment to issue 'Do you think it is necessary to use a HashMap as 
asColumns ? There are other properties in Criteria which are not synchronized, 
si I see no reason why asColumns should be a Hashtable and not a HashMap in the 
first place.

I'...'


-
This message is automatically generated by the Scarab
issue tracking system.  For more information:
http://scarab.tigris.org/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: db-torque/src/rttest bookstore-schema.xml

2005-06-26 Thread tfischer
tfischer2005/06/26 02:35:23

  Modified:src/rttest bookstore-schema.xml
  Log:
  Fixed description for c table
  
  Revision  ChangesPath
  1.21  +1 -1  db-torque/src/rttest/bookstore-schema.xml
  
  Index: bookstore-schema.xml
  ===
  RCS file: /home/cvs/db-torque/src/rttest/bookstore-schema.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- bookstore-schema.xml  22 May 2005 14:50:48 -  1.20
  +++ bookstore-schema.xml  26 Jun 2005 09:35:23 -  1.21
  @@ -165,7 +165,7 @@
 !-- C  T A B L E   --
 !-- === --
   
  -  table name=c description=c table contains fk to r_ab and to b
  +  table name=c description=c table contains fk to ar_ab, a and b
   column
 name=c_id
 required=true
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOURCE] Issue #TRQS262 modified

2005-06-26 Thread thomas fischer
You can view the issue detail at the following URL:

http://issues.apache.org/scarab/issues/id/TRQS262

Type
 Defect

Issue ID
 TRQS262 (useManagers functionality in generator clashes with generated 
doSelectJoinY methods)

Modified by
 thomas fischer
 [EMAIL PROTECTED] ([EMAIL PROTECTED])

The following modifications were made to this issue:
-

Resolution set to Worksforme
Status changed from New to Closed

Reason:
I could not reproduce the behaviour. A testcase for this is now in DataTest

-
This message is automatically generated by the Scarab
issue tracking system.  For more information:
http://scarab.tigris.org/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: db-torque/src/rttest/org/apache/torque DataTest.java

2005-06-26 Thread tfischer
tfischer2005/06/26 03:46:48

  Modified:src/rttest/org/apache/torque DataTest.java
  Log:
  Added a Testcase for XPeer.DoSelectJoinY and another one for invoking 
Torque.shutdown()
  
  Revision  ChangesPath
  1.26  +44 -3 db-torque/src/rttest/org/apache/torque/DataTest.java
  
  Index: DataTest.java
  ===
  RCS file: /home/cvs/db-torque/src/rttest/org/apache/torque/DataTest.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DataTest.java 11 Jun 2005 06:31:27 -  1.25
  +++ DataTest.java 26 Jun 2005 10:46:48 -  1.26
  @@ -580,6 +580,26 @@
+ , should be 11);
   }
   }
  +
  +
  +/**
  + * Test joins using the XPeer.DoSelectJoinYYY methods
  + * @throws Exception if the Test fails
  + */
  +public void testDoSelectJoinY() throws Exception
  +{
  +// using the test data from testJoins()
  +Criteria criteria = new Criteria();
  +criteria.addAscendingOrderByColumn(BookPeer.TITLE);
  +List books = MyBookPeer.doSelectJoinAuthor(criteria);
  +assertTrue(books should contain 4 books but contains  
  ++ books.size(), books.size() == 4);
  +Book bookTwo = (Book) books.get(1);
  +Book bookThree = (Book) books.get(2);
  +assertTrue (the authors of BookTwo and BookThree
  ++  should point to the same instance,
  +bookTwo.getAuthor() == bookThree.getAuthor());
  +}
   
   /**
* test the order by, especially in joins and with aliases
  @@ -1101,8 +1121,16 @@
   assertTrue(read and written clobs should be equal, 
   clobTest.getClobValue().equals(readClobTest.getClobValue()));
   }
  -
  -
  +
  +/**
  + * Tests whether shutdown complains about anything
  + * @throws TorqueException if shutdown does not exit cleanly
  + */
  +public void testShutdown() throws TorqueException
  +{
  +Torque.shutdown();
  +}
  +
   /**
* Deletes all authors and books in the bookstore tables
* @throws Exception if the bookstore could not be cleaned
  @@ -1140,4 +1168,17 @@
   fullyQualifiedColumnName.length());
   return result;
   }
  +
  +
  +/**
  + * Subclass of BookPeer to make the doSelectJoinAuthors() visible
  + */
  +static class MyBookPeer extends BookPeer 
  +{
  +public static List doSelectJoinAuthor(Criteria criteria)
  +throws TorqueException
  +{
  +return BookPeer.doSelectJoinAuthor(criteria);
  +}
  +}
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]