In GemStone/J we do exactly what you are suggesting using
com.gemstone.security.ThreadOwner. This class maintains the association
between all Threads and the Principal that owns them.
Unfortunately the spec is open to interpretation in this area, so your
implementation depends on the EJB server you are using. You could add a
layer of indirection to protect yourself from this ...
Another way would be to have your Java classes use a statless session bean
to provide this service.
-Chis.
> -----Original Message-----
> From: Uday Bhanu T [SMTP:[EMAIL PROTECTED]]
> Sent: Sunday, December 12, 1999 7:01 AM
> To: [EMAIL PROTECTED]
> Subject: Caller identity
>
> Hi All,
> Hi have a problem with the following scenario....
>
> We have a stateful session bean (A) talking to stateless session bean(B)
> which intern may talk to Entity beans or plain Java classes.
>
> What we need is each class in the calling hierarchy should know who is the
> caller...
>
> This is simple when a bean talking to another bean, by using EJB's
> Entity/Session context information we can get the caller identity.
> e.g. A talking to B I am able to know the caller identity.
>
> But in my plain Java classes I need to know the caller. How can I do this?
>
> One solution we thought is setting a thread name in each bean, and
> whenever
> the bean calls a plain class, the plain class should get the thread name
> to
> identity the caller. As when a bean invokes a plain Java class it will be
> on
> the same thread(I hope so!!!) not like beans.
>
> Where beans may be running on different threads, (Depends on container
> implementation), but anyway context information is there to save us.
>
> Is there any other way of doing this? Will our solution work?
>
>
> I hope I am clear about my problem....???
>
> Regards,
> UDay
>
> --------------------------------------------------------------------------
> --
> T.UDayabhanu
> Sr. Systems Engineer,
> BFL Software Limited,
> #651, 11th cross, Kanakapura Rd,
> 7th block, Jayanagar,
> Bangalore - 560 082
> India
> Phone: 91-80-6648860/892/941
> 91-80-6637743/758
> Fax: 91-80-6648930
> e-mail: [EMAIL PROTECTED]
> Web site: http://www.bflsoftware.com
> --------------------------------------------------------------------------
> --
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".