if (bean instanceof MessageDrivenBean) {
/*
* @ActivationConfigProperty
*/
MessageDrivenBean mdb = (MessageDrivenBean) bean;
MessageDriven messageDriven = clazz.getAnnotation(MessageDriven.class);
if (messageDriven != null) {
ActivationConfig activationConfig = mdb.getActivationConfig();
if (activationConfig == null) {
activationConfig = new ActivationConfig();
}
if (!messageDriven.mappedName().isEmpty()) {
if (mdb.getActivationConfig() == null) {
mdb.setActivationConfig(activationConfig);
}
activationConfig.addProperty("destinationType", Queue.class.getName());
activationConfig.addProperty("destination", messageDriven.mappedName());
}
javax.ejb.ActivationConfigProperty[] configProperties = messageDriven.activationConfig();
if (configProperties != null) {
if (mdb.getActivationConfig() == null) {
mdb.setActivationConfig(activationConfig);
}
Properties properties = activationConfig.toProperties();
for (javax.ejb.ActivationConfigProperty property : configProperties) {
if (!properties.containsKey(property.propertyName())) {
activationConfig.addProperty(property.propertyName(), property.propertyValue());
}
}
}
if (mdb.getMessagingType() == null) {
Class<?> interfce = messageDriven.messageListenerInterface();
if (interfce != null && !interfce.equals(Object.class)) {
if (!interfce.isInterface()) {
// TODO: Move this check to o.a.o.c.rules.CheckClasses and do it for all MDBs, annotated or not
throw new OpenEJBException("MessageListenerInterface property of @MessageDriven is not an interface");
}