Search in sources :

Example 1 with MessageDrivenBeanType

use of org.apache.openejb.jee.oejb2.MessageDrivenBeanType 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<String, MessageDrivenBean>();
    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);
            }
        }
    }
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) MessageDrivenBeanType(org.apache.openejb.jee.oejb2.MessageDrivenBeanType) TreeMap(java.util.TreeMap) ActivationConfig(org.apache.openejb.jee.ActivationConfig) ActivationConfigProperty(org.apache.openejb.jee.ActivationConfigProperty) ActivationConfigPropertyType(org.apache.openejb.jee.oejb2.ActivationConfigPropertyType) MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) ActivationConfigType(org.apache.openejb.jee.oejb2.ActivationConfigType)

Aggregations

TreeMap (java.util.TreeMap)1 ActivationConfig (org.apache.openejb.jee.ActivationConfig)1 ActivationConfigProperty (org.apache.openejb.jee.ActivationConfigProperty)1 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)1 MessageDrivenBean (org.apache.openejb.jee.MessageDrivenBean)1 ActivationConfigPropertyType (org.apache.openejb.jee.oejb2.ActivationConfigPropertyType)1 ActivationConfigType (org.apache.openejb.jee.oejb2.ActivationConfigType)1 MessageDrivenBeanType (org.apache.openejb.jee.oejb2.MessageDrivenBeanType)1