It certainly *sounds* feasible, but I don't know if (a) it's portable and
(b) allowed by the spec. In particular (I was thinking about this last
night), I could see a container generating one type of proxy, with a field
in it indicating whether it's remote or local. That would defeat both of our
approaches, it would seem to me.

Ted Neward
{.NET || Java} Course Author & Instructor, DevelopMentor
(http://www.develop.com)
http://www.javageeks.com/tneward
http://www.clrgeeks.com/tneward

----- Original Message -----
From: "Krishnan Subramanian" <[EMAIL PROTECTED]>
To: "Ted Neward" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 8:20 AM
Subject: RE: location transparancy


> Ted,
>
> I'm just fishing here, but I'm going to take a different view. What
> if local (home) interfaces were _not_ accessible from the remotable JNDI.
> What I'm trying to say is that if you had an EJB with remote interfaces,
> it could be registered in the JNDI under a name - say "EjbA". That
> implies that clients anywhere (other VMs etc) could look this up
> this EJB by performing a lookup directly under the name "EjbA". If the EJB
> had local interfaces and if it was registered in the JNDI, then
> any client [in possibly any VM] could look up this bean as well.
> (Though it would not be able to do anything useful with it if
> the local bean was in another VM).
>
> So, you could think of local interfaces as being 'semi-registered' in
> the JNDI. That is, not accessible via a direct lookup, but only via
> EJB Local References. (java:comp/env/..... and defined in the DD under
> the <ejb-local-ref> tag). In fact, the EJB 2.0 spec seems to imply
> something along these lines as well. (at least the examples in the spec
> for local lookups had the same concept).
>
> But shouldn't it be possible to test for local interfaces if you
> do something similar to the pseudo code below:
>
> javax.naming.Context context = new javax.naming.InitialContext();
> Object object = context.lookup("java:comp/env/ejb/LocalBean");
> if (javax.ejb.EJBLocalHome.class.isAssignableFrom(object.getClass())) {
>   System.err.println("Local interface");
> } else {
>   System.err.println("Not a Local interface");
> }
>
> -krish
>
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Ted Neward
> > Sent: Monday, March 11, 2002 11:57 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: location transparancy
> >
> >
> > Not precisely; you can write code to require a local vs. distributed
bean
> > reference, and the container must comply, but given a reference to a
remote
> > interface, the other side of which is a bean, as in:
> >
> > MyBeanIntf mbi = ctx.lookup("somebeanname");
> > // is mbi local or remote?
> >
> > there's no spec-supported way to tell.
> >
> > If you know your target vendor, and you do some spelunking, you might
look
> > at the actual object on the other side of the reference (via
> > mbi.getClass().getName()) and see if you can deduce some hints about
whether
> > its remote or not (as in, if the actual object's classname is
"MyBeanProxy"
> > or "abbcd1123_MyBeanItf", it's probably remote), but that's completely
> > nonstandard and wouldn't hold up in another vendor's implementation.
> >
> > Ted Neward
> > {.NET || Java} Course Author & Instructor, DevelopMentor
> > (http://www.develop.com)
> > http://www.javageeks.com/tneward
> > http://www.clrgeeks.com/tneward
> >
> > ----- Original Message -----
> > From: "daniel legziel" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, March 09, 2002 1:47 PM
> > Subject: [EJB-INT] location transparancy
> >
> >
> > > Hello Fellows,
> > >
> > > my question:
> > >
> > > If location transparancy will not allow me to check if the object I am
> > > targeting is in my partition, is there a way to query the object
directory
> > > anyway to get that info so that I can code a condition on either a
remote
> > or
> > > local invocation?
> > >
> > > Thank's
> > >
> > > Daniel
> > >
> > > _________________________________________________________________
> > > Join the world's largest e-mail service with MSN Hotmail.
> > > http://www.hotmail.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".
> >
> >
>

===========================================================================
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".

Reply via email to