if (getInit() != null)
bean.setInit(getInit());
String loc = getInstanceClass().getName() + ": ";
InjectManager webBeans = InjectManager.create();
bean.setMessageConsumerMax(_messageConsumerMax);
if (_destination != null) {
bean.setDestinationValue((Destination) _destination);
}
else if (_activationSpec != null) {
bean.setActivationSpec(_activationSpec);
}
else {
Class destinationType = _destinationType;
if (_destinationType == null)
destinationType = Destination.class;
Set<Bean<?>> beanSet;
if (_destinationName != null)
beanSet = webBeans.getBeans(_destinationName);
else
beanSet = webBeans.getBeans(destinationType);
Object destComp = null;
if (beanSet.size() > 0) {
Bean destBean = webBeans.resolve(beanSet);
CreationalContext env = webBeans.createCreationalContext(destBean);
destComp
= webBeans.getReference(destBean, destBean.getBeanClass(), env);
}
if (destComp == null)
throw new ConfigException(L.l("{0}: '{1}' is an unknown destination type '{2}'",
loc,
_destinationName,
_destinationType.getName()));
bean.setDestinationValue((Destination) destComp);
beanSet = webBeans.getBeans(ConnectionFactory.class);
Bean factoryBean = webBeans.resolve(beanSet);
CreationalContext env = webBeans.createCreationalContext(factoryBean);
Object comp = webBeans.getReference(factoryBean);
if (comp == null)
throw new ConfigException(L.l("ejb-message-bean requires a configured JMS ConnectionFactory"));
bean.setConnectionFactoryValue((ConnectionFactory) comp);
}