|
From: Jonathan H. <jon...@re...> - 2007-06-11 13:41:43
|
Hello Spring developers I'm looking at how best to integrate the JBossTS transaction manager with Spring2 for usage outside the application server i.e. when no JNDI is available. It seems I need to provide a factory or factories that know about the JBossTS implementation and can return the classes which implement TransactionManager and UserTransaction. This is the way the Jotm integration appears to work, although it's slightly different in that the same object implements both interfaces in Jotm. Would someone (Juergen?) please indicate if this is indeed the preferred approach? Also, is there a way to configure the unit tests so that they exercise this new code path? If not I guess I'll have to write specific tests for it. Thanks Jonathan Halliday JBossTS developer JBoss, a division of Red Hat. ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) |
|
From: Mark P. <mpo...@in...> - 2007-06-11 13:57:09
|
Hi, As a starting point, there was an article on Javaworld http://www.javaworld.com/javaworld/jw-04-2007/jw-04-xa.html?nhtje=050807entj ava& that showed some example integration. Cheers, Mark -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Jonathan Halliday Sent: Monday, June 11, 2007 9:42 AM To: spr...@li... Subject: [Springframework-developer] Spring - JBossTS integration Hello Spring developers I'm looking at how best to integrate the JBossTS transaction manager with Spring2 for usage outside the application server i.e. when no JNDI is available. It seems I need to provide a factory or factories that know about the JBossTS implementation and can return the classes which implement TransactionManager and UserTransaction. This is the way the Jotm integration appears to work, although it's slightly different in that the same object implements both interfaces in Jotm. Would someone (Juergen?) please indicate if this is indeed the preferred approach? Also, is there a way to configure the unit tests so that they exercise this new code path? If not I guess I'll have to write specific tests for it. Thanks Jonathan Halliday JBossTS developer JBoss, a division of Red Hat. ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Jonathan H. <jon...@re...> - 2007-06-11 14:12:58
|
Thanks Mark. In that article I think they used the approach of wiring up the TransactionManager and UserTransaction implementations as beans and linking them to the JtaTransactionManager in the .xml config file. That will work fine as long as no additional setup code is needed. I guess the reason Jotm is different is that its implementation class cannot work as a bean in this way. The .xml config approach has some nice effects, like not requiring JBossTS build to depend on Spring classes or v.v. I may stick with it if it proves flexible enough. I guess there is also a middle ground where any setup that is needed is put into the constructor or static block in a bean class that subclasses the TM/UT implementations. Seems odd Jotm integration did not go down that path - there must be some reason for requiring the compile code coupling that currently exists here. Jonathan. Mark Pollack wrote: > Hi, > > As a starting point, there was an article on Javaworld > > http://www.javaworld.com/javaworld/jw-04-2007/jw-04-xa.html?nhtje=050807entj > ava& > > that showed some example integration. > > Cheers, > Mark > > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On Behalf > Of Jonathan Halliday > Sent: Monday, June 11, 2007 9:42 AM > To: spr...@li... > Subject: [Springframework-developer] Spring - JBossTS integration > > > Hello Spring developers > > I'm looking at how best to integrate the JBossTS transaction > manager with Spring2 for usage outside the application > server i.e. when no JNDI is available. > > It seems I need to provide a factory or factories that know > about the JBossTS implementation and can return the classes > which implement TransactionManager and UserTransaction. This > is the way the Jotm integration appears to work, although > it's slightly different in that the same object implements > both interfaces in Jotm. > > Would someone (Juergen?) please indicate if this is indeed > the preferred approach? > > Also, is there a way to configure the unit tests so that > they exercise this new code path? If not I guess I'll have > to write specific tests for it. > > Thanks > > Jonathan Halliday > JBossTS developer > JBoss, a division of Red Hat. > -- ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) |
|
From: Juergen H. <jue...@in...> - 2007-06-11 14:26:28
|
Indeed, the standard way of integrating a JTA provider is via UserTransaction and TransactionManager objects that are simply linked into Spring's JtaTransactionManager (as shown in that article). That said, note that JtaTransactionManager can work with a plain UserTransaction reference as well (not supporting transaction suspension then), and also with a plain TransactionManager reference (in which case it will simply delegate all calls to the TransactionManager directly). So in case of a standalone JTA setup, it would usually be sufficient to set up the TransactionManager handle only, passing it to the Spring JtaTransactionManager's "transactionManager" property. Unless the JTA provider does special stuff in its UserTransaction implementation, it is not necessary to explicitly set up the UserTransaction handle at all. As for JotmFactoryBean: JOTM is a bit different there in that it has this notion of a Jotm object and a Current handle. While that stuff could be set up in a completely decoupled fashion using factory methods and property-path navigation, that approach is not very intuitive. The Spring-provided JotmFactoryBean is simply a convenience shortcut for this. JTA providers with straightforward setup do not require such convenience glue. That applies to Atomikos, for example, which doesn't offer special Spring glue in its Spring support, rather 'just' facilities that are somewhat tailored for use in a Spring environment. To the best of my knowledge, Atomikos does *not* have direct Spring dependencies in any of its code. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Mark Pollack Sent: Monday, June 11, 2007 3:57 PM To: spr...@li... Subject: Re: [Springframework-developer] Spring - JBossTS integration Hi, As a starting point, there was an article on Javaworld http://www.javaworld.com/javaworld/jw-04-2007/jw-04-xa.html?nhtje=050807entj ava& that showed some example integration. Cheers, Mark -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Jonathan Halliday Sent: Monday, June 11, 2007 9:42 AM To: spr...@li... Subject: [Springframework-developer] Spring - JBossTS integration Hello Spring developers I'm looking at how best to integrate the JBossTS transaction manager with Spring2 for usage outside the application server i.e. when no JNDI is available. It seems I need to provide a factory or factories that know about the JBossTS implementation and can return the classes which implement TransactionManager and UserTransaction. This is the way the Jotm integration appears to work, although it's slightly different in that the same object implements both interfaces in Jotm. Would someone (Juergen?) please indicate if this is indeed the preferred approach? Also, is there a way to configure the unit tests so that they exercise this new code path? If not I guess I'll have to write specific tests for it. Thanks Jonathan Halliday JBossTS developer JBoss, a division of Red Hat. ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Juergen H. <jue...@in...> - 2007-06-11 14:32:34
|
Hi Jonathan, As outlined in my previous mail on JTA setup, the preferred approach is setting up a TransactionManager handle as bean and passing it into the "transactionManager" property of Spring's JtaTransactionManager. There is usually no need for explicitly setting up a UserTransaction handle as well. Our unit tests just test Spring's JtaTransactionManager against UserTransaction and TransactionManager mocks. So for integration tests, you'll have to set up an application context with full tx and resource setup. Should be straightforward when using Spring's ClassPathXmlApplicationContext class for bootstrapping. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Jonathan Halliday Sent: Monday, June 11, 2007 3:42 PM To: spr...@li... Subject: [Springframework-developer] Spring - JBossTS integration Hello Spring developers I'm looking at how best to integrate the JBossTS transaction manager with Spring2 for usage outside the application server i.e. when no JNDI is available. It seems I need to provide a factory or factories that know about the JBossTS implementation and can return the classes which implement TransactionManager and UserTransaction. This is the way the Jotm integration appears to work, although it's slightly different in that the same object implements both interfaces in Jotm. Would someone (Juergen?) please indicate if this is indeed the preferred approach? Also, is there a way to configure the unit tests so that they exercise this new code path? If not I guess I'll have to write specific tests for it. Thanks Jonathan Halliday JBossTS developer JBoss, a division of Red Hat. ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Jonathan H. <jon...@re...> - 2007-06-11 15:02:38
|
Thanks Juergen For our JTA implementation I think the bean wiring is sufficient. No new Java code is usually a good thing! For our JTS it's a bit more complicated as we require the ORB to be configured through our own API. I think though that this initialization code does not belong hidden in the integration at all - I'll probably just document the requirement and leave it to the users to decide where to put the calls. Only a handful of them will need JTS outside the app server anyhow, it's a pretty unusual requirement compared to JTA. So, hopefully the changes needed for integration are limited to documentation and testing. Jonathan. Juergen Hoeller wrote: > Hi Jonathan, > > As outlined in my previous mail on JTA setup, the preferred approach is > setting up a TransactionManager handle as bean and passing it into the > "transactionManager" property of Spring's JtaTransactionManager. There is > usually no need for explicitly setting up a UserTransaction handle as well. > > Our unit tests just test Spring's JtaTransactionManager against > UserTransaction and TransactionManager mocks. So for integration tests, > you'll have to set up an application context with full tx and resource > setup. Should be straightforward when using Spring's > ClassPathXmlApplicationContext class for bootstrapping. > > Juergen > > > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On Behalf > Of Jonathan Halliday > Sent: Monday, June 11, 2007 3:42 PM > To: spr...@li... > Subject: [Springframework-developer] Spring - JBossTS integration > > > Hello Spring developers > > I'm looking at how best to integrate the JBossTS transaction manager with > Spring2 for usage outside the application server i.e. when no JNDI is > available. > > It seems I need to provide a factory or factories that know about the > JBossTS implementation and can return the classes which implement > TransactionManager and UserTransaction. This is the way the Jotm integration > appears to work, although it's slightly different in that the same object > implements both interfaces in Jotm. > > Would someone (Juergen?) please indicate if this is indeed the preferred > approach? > > Also, is there a way to configure the unit tests so that they exercise this > new code path? If not I guess I'll have to write specific tests for it. > > Thanks > > Jonathan Halliday > JBossTS developer > JBoss, a division of Red Hat. > -- ------------------------------------------------------------ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) |