Hi David... On 8/8/06, David Blevins <[EMAIL PROTECTED]> wrote:
On Aug 6, 2006, at 8:40 AM, Mohammed Nour wrote: > Hi DJencks... > > On 8/6/06, David Jencks <[EMAIL PROTECTED]> wrote: > >> >> On Aug 6, 2006, at 5:39 AM, Mohammed Nour wrote: >> >> > Hi dblevins... >> > >> > On 8/6/06, David Blevins <[EMAIL PROTECTED]> wrote: >> > >> >> >> >> On Aug 5, 2006, at 2:05 PM, Mohammed Nour wrote: >> >> >> >> > Hi Dave... >> >> > >> >> > On 8/5/06, David Blevins < [EMAIL PROTECTED]> wrote: >> >> >> When you want the javax.ejb.EJBHome, you use the name you >> gave it. >> >> >> When you want the LocalHome, you tack on "Local" to the JNDI >> name. >> >> >> Also note, you can't lookup LocalHomes over the >> >> >> RemoteInitialContextFactory. >> >> > >> >> > >> >> > :), These info I already know, but my main question is why?, the >> >> > client >> >> > should provide the JNDI that he\she has provided in the openejb- >> >> > jar.xml, and >> >> > if the EJB is providing a Local Home interface this lookup >> should >> >> > return the >> >> > local Home, and when it is providing the remote Home >> interface the >> >> > lookup >> >> > should return the remote one [...] >> >> >> >> The answer to that is another question. A bean can have both >> remote >> >> and local interfaces, so when they look something up from JNDI, >> which >> >> set of interfaces should they get? >> >> >> >> The answer is probably that we should allow them to explicitly >> >> specify the the jndi name for each interface, rather than assuming >> >> the jndi name is for the remote interface and creating a jndi name >> >> for the local interface by tacking "Local" on to it. >> >> >> >> That'd definitely be a good feature to add to jira. Would you >> like >> >> the honors? >> > >> > >> > Yeah man :D, it is my honor to open the JIRA and implement it, >> and you >> > really read my mind, cause we need this feature to help clients >> > explicitly >> > define separate JNDI name for separate interfaces, including Local >> > \Remote >> > Home\Business interfaces, I suggest to change the schema of >> > *openeb-jar.xml*to help clients use this feature explicitly as >> > follows: >> > >> > For an SLSB\SFSB we need to define a new XML element that is >> > *mandatory* to >> > be specified under the *<ejb-deployment>* element so the client can >> > explicitly specify the *<deployment-id>* that will have 2\3 >> > attributes: >> > >> > 1. jndi-name (The JNDI name by which the client can look up the >> > specified interface). >> > 2. interface-name (The fully qualified Java name of the >> interface - >> > being Local\Remote can be known from the ejb-jar.xml or we can >> > define >> > an additional optional attribute that can be used with *business >> > interfaces*, see #3 next). >> > 3. isRemote (an optional boolean attribute to specify the >> > interface as >> > being Local\Remote - we don't need it with 2.1 Home interface >> as we >> > can know whether the interface extends Local\Remote EJBHome or >> not). >> > >> > An example ejb-deployment: >> > >> > <ejb-deployment ejb-name="ExampleStatelessBean" container- >> id="Default >> > Stateless Container"> >> > >> > <deployment-id >> > >> > jndi-name="client/tests/stateless/BasicStatelessHomeInterface" >> > interface- >> > name="ejb3.beans.interfaces.BeanLocalHomeInterface" >> > /> >> > >> > <deployment-id >> > jndi-name="client/tests/stateless/ >> > BasicStatelessBizInterface" >> > interface- >> > name="ejb3.beans.interfaces.BeanLocalBizInterface" >> > isRemote="false" /> >> > >> > </ejb-deployment> >> > >> > Please I need feedback from all the team on the validity of this >> idea. >> >> Is this for binding ejb homes into global jndi for access through >> non- >> jee mechanisms? If so it makes sense to me. You might consider >> using > > > No this is for binding different interfaces of an EJB into global > JNDI, this > applys for Local\Remote Home\Business interfaces. That was really more of a yes than a no :) David was basically asking if this was the non-standard way to lookup ejbs, which it is. But you are right in that it applies to more than homes as EJBs in the 3.0 spec aren't required to have homes. > >> jndi-name >> and >> local-jndi-name >> >> instead of the jndi-name + [isRemote] > > > +1 on that, I like this :) so we have the *deployment-id* element > can look > like this > > <ejb-deployment ...> > > <deployment-id jndi-name="some/jndi/name/SomeBeanHome" interface- > name=" > some.bean.SomeBeanHomeInterface" /> > > <deployment-id jndi-name="some/jndi/name/SomeBeanBizIntfc" > interface-name=" > some.bean.SomeBeanBusinessInterface" /> > This approach is ok, though we don't need the "local-" prefix as we'll know what kind of interface it is based on the data in the ejb- jar.xml. We need to keep "deployment-id" as an attribute on "<ejb- deployment>" as it's job is to identify the ejb iteself in the system -- i.e. it's not specific to a particular interface. Beans in the EJB 1.1 world only had one interface so it was just nice to use the deployment-id as a convenience, but that is no longer appropriate. So maybe something like this: <ejb-deployment deployment-id="SomeBean" ...> <jndi-name interface="some.bean.SomeBeanLocalHomeInterface">some/ jndi/name/SomeBeanLocalHome</jndi-name> <jndi-name interface="some.bean.SomeBeanRemoteHomeInterface">some/ jndi/name/SomeBeanRemoteHome</jndi-name> <jndi-name interface="some.bean.SomeBeanRemoteBusinessInterface">some/jndi/name/ SomeBeanRemoteBizIntfc</jndi-name> <jndi-name interface="some.bean.SomeBeanLocalBusinessInterface">some/jndi/name/ SomeBeanLocalBizIntfc</jndi-name> </ejb-deployment> What do you think about something along those lines? As far as specifying the names goes, we should still have some sort of strategy for automatically creating the jndi-names for each interfaces for people who don't really care as long as they don't have to type them in. This has been something i've wanted to do for a while. We do it already, but it should be completely configurable at a system or ejb-jar. The explicitly set names would always win over the templated names. Thoughts on that?
We can use the fully qualified Java names of the interfaces to create an automatic JNDI names for them, like this *some.bean.SomeBeanLocalHomeInterface* will have a JNDI name like this *some/bean/SomeBeanLocalHomeInterface* what do you think ? Thanks and best regards... Mohammad Nour El-Din
-David
