Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleTODO

Show the recommended way to set system properties or this property (if a gbean attribute is added)

Setting the JNDI name

It's possible to set the desired jndi name format for the whole server level, an ejb, an ejb's "local" interface (local/remote/local-home/home), and for an individual interface the ejb implements. More specific jndi name formats act as an override to any more general formats. The most specific format dictates the jndi name that will be used for any given interface of an ejb. It's possible to specify a general format for your server, override it at an ejb level and override that further for a specific interface of that ejb.

Via the <jndi> tag for a specific ejb

The following sets the name specifically for the interface org.superbiz.Foo.

Code Block
xml
xml

<openejb-jar>
  ...

  <session>
    ...

    <jndi name="foo" interface="org.superbiz.Foo"/>  
  </session>
</openejb-jar>

Or more generally...

Code Block
xml
xml

<openejb-jar>
  ...

  <session>
    ...

    <jndi name="foo" interface="Remote"/> 
  </session>
</openejb-jar>

Or more generally still...

Code Block
xml
xml

<openejb-jar>
  ...

  <session>
    ...

    <jndi name="foo"/> 
  </session>
</openejb-jar>

The 'name' attribute can still use templates if it likes, such as:

Code Block
xml
xml

<openejb-jar>
  ...

  <session>
    ...

    <jndi name="ejb/{interfaceClass.simpleName}" interface="org.superbiz.Foo"/> 
  </session>
</openejb-jar>

Multiple <jndi> tags

Multiple <jndi> tags are allowed making it possible for you to be as specific as you need about the jndi name of each interface or each logical group of iterfaces (Local, Remote, LocalHome, RemoteHome).

Given an ejb, FooBean, with the following interfaces:

  • business-local: org.superbiz.LocalOne
  • business-local: org.superbiz.LocalTwo
  • business-remote: org.superbiz.RemoteOne
  • business-remote: org.superbiz.RemoteTwo
  • home: org.superbiz.FooHome
  • local-home: org.superbiz.FooLocalHome

The following four examples would yield the same jndi names. The intention with these examples is to show the various ways you can isolate specific interfaces or types of interfaces to gain more specific control on how they are named.

Code Block
xml
xml
title#1

<openejb-jar>
  ...

  <session>
    ...

    <jndi name="LocalOne" interface="org.superbiz.LocalOne"/> 
    <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/> 
    <jndi name="RemoteOne" interface="org.superbiz.RemoteOne"/> 
    <jndi name="RemoteTwo" interface="org.superbiz.RemoteTwo"/> 
    <jndi name="FooHome" interface="org.superbiz.FooHome"/> 
    <jndi name="FooLocalHome" interface="org.superbiz.FooLocalHome"/> 
  </session>
</openejb-jar>
Code Block
xml
xml
title#2

<openejb-jar>
  ...

  <session>
    ...

    <!-- applies to LocalOne and LocalTwo -->
    <jndi name="{interfaceClass.simpleName}" interface="Local"/> 

    <!-- applies to RemoteOne and RemoteTwo -->
    <jndi name="{interfaceClass.simpleName}" interface="Remote"/> 

    <!-- applies to FooHome -->
    <jndi name="{interfaceClass.simpleName}" interface="RemoteHome"/> 

    <!-- applies to FooLocalHome -->
    <jndi name="{interfaceClass.simpleName}" interface="LocalHome"/> 
  </session>
</openejb-jar>
Code Block
xml
xml
title#3

<openejb-jar>
  ...

  <session>
    ...

    <!-- applies to RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
    <jndi name="{interfaceClass.simpleName}"/> 

    <!-- these two would count as an override on the above format -->
    <jndi name="LocalOne" interface="org.superbiz.LocalOne"/> 
    <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/> 
  </session>
</openejb-jar>
Code Block
xml
xml
title#4

<openejb-jar>
  ...

  <session>
    ...

    <!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
    <jndi name="{interfaceClass.simpleName}"/> 
  </session>
</openejb-jar>

Settings

You are responsible for ensuring the names don't conflict.

...