use of org.apache.openejb.jee.ActivationConfigProperty in project tomee by apache.
the class ActivationConfig$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ActivationConfig activationConfig, RuntimeContext context) throws Exception {
if (activationConfig == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ActivationConfig.class != activationConfig.getClass()) {
context.unexpectedSubclass(writer, activationConfig, ActivationConfig.class);
return;
}
context.beforeMarshal(activationConfig, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = activationConfig.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(activationConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = activationConfig.getDescriptions();
} catch (final Exception e) {
context.getterError(activationConfig, "descriptions", ActivationConfig.class, "getDescriptions", e);
}
if (descriptions != null) {
for (final Text descriptionsItem : descriptions) {
if (descriptionsItem != null) {
writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
writeText(writer, descriptionsItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(activationConfig, "descriptions");
}
}
}
// ELEMENT: activationConfigProperty
final List<ActivationConfigProperty> activationConfigProperty = activationConfig.activationConfigProperty;
if (activationConfigProperty != null) {
for (final ActivationConfigProperty activationConfigPropertyItem : activationConfigProperty) {
if (activationConfigPropertyItem != null) {
writer.writeStartElement(prefix, "activation-config-property", "http://java.sun.com/xml/ns/javaee");
writeActivationConfigProperty(writer, activationConfigPropertyItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(activationConfig, "activationConfigProperty");
}
}
}
context.afterMarshal(activationConfig, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.ActivationConfigProperty 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