you're splanin n' splanin n' splanin
am readin n' readin n' readin
ma heads spinnin n' spinnin n' spinnin

Thanks, once again, very detailed. I didn't even know we could
customize JNDI names to such an extent.

On 9/13/07, David Blevins <[EMAIL PROTECTED]> wrote:
>
> On Sep 13, 2007, at 3:56 AM, Karan Malhi wrote:
>
> > What would be the name in the case I had two SuperBadBean EJB's in
> > different packages i.e.
> >
> > org.packageone.SuperBadBean
> > org.packagetwo.SuperBadBean
> >
> > Both of the SuperBadBean EJB's implement the same interfaces.
>
> The openejb.jndiname.format would actually be:
>
>   openejb.jndiname.format={deploymentId}{interfaceType.annotationName}
>
> The thing that controls what your deploymentId is the
> openejb.deploymentId.format which is currently set to:
>
>   openejb.deploymentId.format={ejbName}
>
> And per EJB 3.0 spec rules, the default ejbName is the simple name of
> the bean class.
>
> Phew, done.  Lot's of hops to get there.  With the default settings,
> both would wind up with the same deploymentId and we won't deploy an
> app that duplicates a deploymentId.
>
> That said, it's easy to change the openejb.deploymentId.format to
> include:
>
>          contextData.put("appId", appModule.getModuleId());
>          contextData.put("ejbJarId", ejbModule.getModuleId());
>          contextData.put("moduleId", ejbModule.getModuleId());
>          contextData.put("ejbType", bean.getClass().getSimpleName());
>          contextData.put("ejbClass", bean.getClass().getName());
>          contextData.put("ejbClass.simpleName", bean.getClass
> ().getSimpleName());
>          contextData.put("ejbName", bean.getEjbName());
>
>
> There are also a ton of "variables" available for building up your
> dream jndi name format and you can combine as many of them as you
> like to be as unique as you want them to be:
>
>          contextData.put("moduleId", deploymentInfo.getModuleID());
>          contextData.put("ejbType", deploymentInfo.getComponentType
> ().name());
>          contextData.put("ejbClass", deploymentInfo.getBeanClass
> ().getName());
>          contextData.put("ejbClass.simpleName",
> deploymentInfo.getBeanClass().getSimpleName());
>          contextData.put("ejbName", deploymentInfo.getEjbName());
>          contextData.put("deploymentId",
> deploymentInfo.getDeploymentID().toString());
>          contextData.put("interfaceType", type.getAnnotatedName());
>          contextData.put("interfaceType.annotatedName",
> type.getAnnotatedName());
>          contextData.put("interfaceType.xmlName", type.getXmlName());
>          contextData.put("interfaceType.xmlNameCc", type.getXmlNameCc
> ());
>          contextData.put("interfaceType.openejbLegacyName",
> type.getOpenejbLegacy());
>          contextData.put("interfaceClass", interfce.getName());
>          contextData.put("interfaceClass.simpleName",
> interfce.getSimpleName());
>
> And you are welcome to embellish the format with more than just
> variable references, such as:
>
>    ejb/{ejbName}/interface/{interfaceClass}
>
> However you want you JNDI layout to be, you should be able to get it
> and you can set it at either a server or ejb-jar level depending on
> how much consistency you want.
>
> Now that I think about it we should add the package name of the
> ejbClass and the package name of the interface, just for good measure.
>
> -David
>
>


-- 
Karan Singh Malhi

Reply via email to