use of org.apache.openejb.jee.oejb2.ActivationConfigType in project tomee by apache.
the class OpenEjb2Conversion method convertMdbConfigs.
public final void convertMdbConfigs(final EjbJar ejbJar, final OpenejbJarType openejbJarType) {
final Map<String, MessageDrivenBean> mdbs = new TreeMap<>();
for (final EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
if (!(enterpriseBean instanceof MessageDrivenBean)) {
continue;
}
mdbs.put(enterpriseBean.getEjbName(), (MessageDrivenBean) enterpriseBean);
}
for (final org.apache.openejb.jee.oejb2.EnterpriseBean enterpriseBean : openejbJarType.getEnterpriseBeans()) {
if (!(enterpriseBean instanceof MessageDrivenBeanType)) {
continue;
}
final MessageDrivenBeanType bean = (MessageDrivenBeanType) enterpriseBean;
final MessageDrivenBean mdb = mdbs.get(bean.getEjbName());
if (mdb == null) {
// todo warn no such ejb in the ejb-jar.xml
continue;
}
final ActivationConfigType activationConfigType = bean.getActivationConfig();
if (activationConfigType != null) {
ActivationConfig activationConfig = mdb.getActivationConfig();
if (activationConfig == null) {
activationConfig = new ActivationConfig();
mdb.setActivationConfig(activationConfig);
}
for (final ActivationConfigPropertyType propertyType : activationConfigType.getActivationConfigProperty()) {
final ActivationConfigProperty property = new ActivationConfigProperty(propertyType.getActivationConfigPropertyName(), propertyType.getActivationConfigPropertyValue());
activationConfig.getActivationConfigProperty().add(property);
}
}
}
}
Aggregations