Yep. To start out with, you'll at least have to know the name of the EJB
instance you're looking for (that is, what it's listed as in your JNDI
naming service). Then, you get the EJBHome reference to the EJB you're
looking for from the naming context, and .narrow() it to the type "EJBHome".
This gets you to a point where you can get the EJBMetaData object, which you
can then use to get the *real* EJBHome class, as well as the EJBObject
(remote interface) class. At this point, it's reflection as usual (i.e.,
interrogate the class objects to get the methods you're looking for, etc.
etc.). This way, you can have very little code, and allow everything to be
dynamically configured at runtime. Pretty slick, actually, depending on what
you're trying to accomplish.
Is this answering any of your questions?
KurtC
-----Original Message-----
From: Pedro Garcia Lopez [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 16, 2000 5:41 PM
To: [EMAIL PROTECTED]
Subject: Loose coupling: EJBMetadata
Hi all,
How can I achieve loose coupling ?
In the EJB spec they say:
"The javax.ejb.EJBMetaData interface is intended to allow applications
assembly tools to discover informationabout the session bean, and to
allow loose client/server binding and client-side scripting."
I want to use a EJB from an application client *without* having to
reference it in the application-client.xml file.
But how can I do that ?
This is the EJBMetadata API:
EJBHome getEJBHome()
java.lang.Class getHomeInterfaceClass()
java.lang.Class getPrimaryKeyClass()
java.lang.Class getRemoteInterfaceClass()
boolean isSession()
boolean isStatelessSession()
The only thing I can only do with this is getting methods information
from my EJB using the RemoteInterfaceClass.
And, in order to obtain this EJBMetaData I need the home interface of
the EJB (getEJBMEtadata).
PlaceHome home = (PlaceHome)PortableRemoteObject.narrow(homeObject,
PlaceHome.class);
Place thePlace =
(Place)PortableRemoteObject.narrow(home.create("pedro"), Place.class);
Where should I use this class ?
Has anybody achieved this loose coupling ?
Regards,
Pedro
===========================================================================
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".