// base-name/remote(-iface) || mappedName
case BUSINESS_REMOTE :
case UNKNOWN :
JBossEnterpriseBeanMetaData md = summary.getBeanMD();
String mappedName = null;
if (md.isSession())
{
mappedName = ((JBossSessionBeanMetaData) md).getJndiName();
}
String setMappedName = md.getMappedName();
if (setMappedName != null && setMappedName.trim().length() > 0)
{
mappedName = md.getMappedName();
}
// JBMETA-75
// Use mappedName if it's specified
if (mappedName != null && iface == null)
{
jndiName = mappedName;
}
// JBMETA-75
// Fall back on base JNDI Name + type suffix
else if (iface == null)
jndiName = baseJndiName + "/" + ifaceType.toSuffix();
else
jndiName = baseJndiName + "/" + ifaceType.toSuffix() + "-" + iface;
break;
case LOCAL_HOME :
// base-name / (local|remote)Home
jndiName = baseJndiName + "/" + ifaceType.toSuffix();
break;
case REMOTE_HOME :
/*
* First ensure that the Home binding has not been explicitly-defined
* (JBMETA-82)
*/
// Obtain the MD
JBossEnterpriseBeanMetaData beanMd = summary.getBeanMD();
// If a Session Bean
if (beanMd.isSession())
{
JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) beanMd;
String explicitHomeJndiName = smd.getHomeJndiName();
// If explicitly-defined
if (explicitHomeJndiName != null && explicitHomeJndiName.length() > 0)
{
jndiName = explicitHomeJndiName;
break;
}
}
// base-name / (local|remote)Home
jndiName = baseJndiName + "/" + ifaceType.toSuffix();
break;
}
}
else
{
// EJB 2.x
switch (ifaceType)
{
// The local home jndi name (same for getLocalJndiName and getLocalHomeJndiName)
case BUSINESS_LOCAL :
case LOCAL_HOME :
// Use the bean local jndi name or a generated name for ejb2.x local homes
jndiName = summary.getBeanMD().getLocalJndiName();
if (jndiName != null && jndiName.trim().length() > 0)
{
return jndiName;
}
String ejbName = summary.getBeanMD().getEjbName();
jndiName = "local/" + ejbName + '@' + System.identityHashCode(ejbName);
break;
// The home jndi name (same for getJndiName and getHomeJndiName)
case BUSINESS_REMOTE :
case REMOTE_HOME :
// Don't append the iface suffix for ejb2.x homes
// JBMETA-79, use any explicit jndi-name/mapped-name
JBossEnterpriseBeanMetaData md = summary.getBeanMD();
String mappedName = md.getMappedName();
if (mappedName == null || mappedName.length() == 0)
{
if (md.isSession())
{
mappedName = ((JBossSessionBeanMetaData) md).getJndiName();
}
else if (md.isEntity())
{
mappedName = ((JBossEntityBeanMetaData) md).getJndiName();
}
}
jndiName = mappedName;