If I understand correctly your java code is in a j2ee application
rather than a gbean? If your code is in or called by a gbean you
should use the technique Guglielmo mentions. If your code is in a j2ee
application you have to work harder, and you have to find or know the
gbean name of the transaction manager.
static final ObjectName TM_NAME = new
ObjectName("geronimo.server:J2EEApplication=null,J2EEModule=geronimo/
j2ee-server/1.0-SNAPSHOT/
car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMana
ger");
Kernel kernel = KernelRegistry.getSingleKernel();
TransactionManager tm = kernel.getProxyManager().createProxy(TM_NAME,
TransactionManager.class);
I just wrote this code right here in this email so it is probably full
of typos and bugs but it shows the technique to use. If you want to
allow the transaction manager to be found even it it is in a different
module you can use a object name pattern, list the names satisfying it
and pick one.
thanks
david jencks
On Dec 7, 2005, at 8:19 PM, Ranjan, Rakesh ((Cognizant)) wrote:
Thanks Guglielmo,
But I want to get the reference to TransactionManager through java
code only. Isn’t it possible to get it using the Transaction manager
GBean name.
With Regards,
Rakess Ranjan
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 07, 2005 10:41 PM
To: [email protected]
Cc: [email protected]
Subject: Re: Reference to TransactionManager
I had the same question. As per David Jencks:
==================================
In your gbean info building code include something like this:
infoFactory.addReference("TransactionManager",
ExtendedTransactionManager.class, NameFactory.TRANSACTION_MANAGER);
Then you won't have to specify the <type> in the reference.
In the xml plan,
<reference name="TransactionManager">
<module>org/apache/geronimo/Server</module>
<name>TransactionManager</name>
</reference>
assuming you are not using the patch I posted a few days ago that
includes new-style configIds.
"Ranjan, Rakesh \(Cognizant\)" <[EMAIL PROTECTED]>
12/07/2005 05:11 AM
Please respond to user
To: <[email protected]>
cc:
Subject: Reference to TransactionManager
Hi,
I need a reference to the TransactionManager in one of java class. But
I don't know the GBean name corresponding to the TransactionManager.
Can anybody please help me how to get a reference to
TransactionManager in Java code.
Regards,
Rakesh Ranjan
This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on
this e-mail is strictly
prohibited and may be unlawful.
Visit us at http://www.cognizant.com
*****************************************************************
<<>>
In compliance with applicable rules and regulations, Instinet
reviews and archives incoming and outgoing email communications,
copies of which may be produced at the request of regulators.
This message is intended only for the personal and confidential
use of the recipients named above. If the reader of this email
is not the intended recipient, you have received this email in
error and any review, dissemination, distribution or copying is
strictly prohibited. If you have received this email in error,
please notify the sender immediately by return email and
permanently delete the copy you received.
Instinet accepts no liability for any content contained in the
email, or any errors or omissions arising as a result of email
transmission. Any opinions contained in this email constitute
the sender's best judgment at this time and are subject to change
without notice. Instinet does not make recommendations of a
particular security and the information contained in this email
should not be considered as a recommendation, an offer or a
solicitation of an offer to buy and sell securities.
*****************************************************************
This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on
this e-mail is strictly
prohibited and may be unlawful.
Visit us at http://www.cognizant.com