}
else
{
// Get the invoker specific ejb-ref mappings
Iterator it = beanMetaData.getInvokerBindings();
Reference reference = null;
while (it.hasNext())
{
String invokerBinding = (String)it.next();
// Check for an invoker level jndi-name
String name = ref.getInvokerBinding(invokerBinding);
// Check for an global jndi-name
if (name == null)
name = ref.getJndiName();
if (name == null)
{
throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml or " + "jndi-name in jboss.xml");
}
StringRefAddr addr = new StringRefAddr(invokerBinding, name);
log.debug("adding " + invokerBinding + ":" + name + " to Reference");
if (reference == null)
{
reference = new Reference("javax.naming.LinkRef", ENCThreadLocalKey.class.getName(), null);
}
reference.add(addr);
}
// If there were invoker bindings create bind the reference
if (reference != null)
{
if (ref.getJndiName() != null)
{
// Add default for the bean level ejb-ref/jndi-name
StringRefAddr addr = new StringRefAddr("default", ref.getJndiName());
reference.add(addr);
}
if (reference.size() == 1 && reference.get("default") == null)
{
/* There is only one invoker binding and its not default so
create a default binding to allow the link to have a value
when accessed without an invoker active.
*/
StringRefAddr addr = (StringRefAddr)reference.get(0);
String target = (String)addr.getContent();
StringRefAddr addr1 = new StringRefAddr("default", target);
reference.add(addr1);
}
Util.bind(envCtx, ref.getName(), reference);
}
else
{