You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/12/10 06:08:43 UTC
svn commit: r1419199 [22/35] - in /openejb/trunk/openejb/container:
openejb-jee-accessors/ openejb-jee-accessors/src/main/
openejb-jee-accessors/src/main/java/ openejb-jee-accessors/src/main/java/org/
openejb-jee-accessors/src/main/java/org/apache/ ope...
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,1073 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.openejb.jee.ActivationConfig$JAXB.readActivationConfig;
+import static org.apache.openejb.jee.ActivationConfig$JAXB.writeActivationConfig;
+import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke;
+import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke;
+import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout;
+import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout;
+import static org.apache.openejb.jee.DataSource$JAXB.readDataSource;
+import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource;
+import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef;
+import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef;
+import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef;
+import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef;
+import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry;
+import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry;
+import static org.apache.openejb.jee.Icon$JAXB.readIcon;
+import static org.apache.openejb.jee.Icon$JAXB.writeIcon;
+import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback;
+import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback;
+import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef;
+import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef;
+import static org.apache.openejb.jee.MessageDrivenDestination$JAXB.readMessageDrivenDestination;
+import static org.apache.openejb.jee.MessageDrivenDestination$JAXB.writeMessageDrivenDestination;
+import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod;
+import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod;
+import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef;
+import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef;
+import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef;
+import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef;
+import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef;
+import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef;
+import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef;
+import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef;
+import static org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity;
+import static org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity;
+import static org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef;
+import static org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef;
+import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef;
+import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef;
+import static org.apache.openejb.jee.Text$JAXB.readText;
+import static org.apache.openejb.jee.Text$JAXB.writeText;
+import static org.apache.openejb.jee.Timer$JAXB.readTimer;
+import static org.apache.openejb.jee.Timer$JAXB.writeTimer;
+import static org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType;
+import static org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class MessageDrivenBean$JAXB
+ extends JAXBObject<MessageDrivenBean> {
+
+
+ public MessageDrivenBean$JAXB() {
+ super(MessageDrivenBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, TransactionType$JAXB.class, MessageDrivenDestination$JAXB.class, ActivationConfig$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class);
+ }
+
+ public static MessageDrivenBean readMessageDrivenBean(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeMessageDrivenBean(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageDrivenBean, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageDrivenBean, context);
+ }
+
+ public final static MessageDrivenBean _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ MessageDrivenBean messageDrivenBean = new MessageDrivenBean();
+ context.beforeUnmarshal(messageDrivenBean, com.envoisolutions.sxc.jaxb.LifecycleCallback.NONE);
+
+ ArrayList<Text> descriptions = null;
+ ArrayList<Text> displayNames = null;
+ LocalCollection<Icon> icon = null;
+ List<Timer> timer = null;
+ List<AroundInvoke> aroundInvoke = null;
+ List<AroundTimeout> aroundTimeout = null;
+ KeyedCollection<String, EnvEntry> envEntry = null;
+ KeyedCollection<String, EjbRef> ejbRef = null;
+ KeyedCollection<String, EjbLocalRef> ejbLocalRef = null;
+ KeyedCollection<String, ServiceRef> serviceRef = null;
+ KeyedCollection<String, ResourceRef> resourceRef = null;
+ KeyedCollection<String, ResourceEnvRef> resourceEnvRef = null;
+ KeyedCollection<String, MessageDestinationRef> messageDestinationRef = null;
+ KeyedCollection<String, PersistenceContextRef> persistenceContextRef = null;
+ KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef = null;
+ List<org.apache.openejb.jee.LifecycleCallback> postConstruct = null;
+ List<org.apache.openejb.jee.LifecycleCallback> preDestroy = null;
+ KeyedCollection<String, DataSource> dataSource = null;
+ List<SecurityRoleRef> securityRoleRef = null;
+
+ // Check xsi:type
+ QName xsiType = reader.getXsiType();
+ if (xsiType != null) {
+ if (("message-driven-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
+ return context.unexpectedXsiType(reader, MessageDrivenBean.class);
+ }
+ }
+
+ // Read attributes
+ for (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
+ context.addXmlId(reader, id, messageDrivenBean);
+ messageDrivenBean.id = id;
+ } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
+ context.unexpectedAttribute(attribute, new QName("", "id"));
+ }
+ }
+
+ // Read elements
+ for (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: descriptions
+ Text descriptionsItem = readText(elementReader, context);
+ if (descriptions == null) {
+ descriptions = new ArrayList<Text>();
+ }
+ descriptions.add(descriptionsItem);
+ } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: displayNames
+ Text displayNamesItem = readText(elementReader, context);
+ if (displayNames == null) {
+ displayNames = new ArrayList<Text>();
+ }
+ displayNames.add(displayNamesItem);
+ } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: icon
+ Icon iconItem = readIcon(elementReader, context);
+ if (icon == null) {
+ icon = messageDrivenBean.icon;
+ if (icon != null) {
+ icon.clear();
+ } else {
+ icon = new LocalCollection<Icon>();
+ }
+ }
+ icon.add(iconItem);
+ } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: ejbName
+ String ejbNameRaw = elementReader.getElementAsString();
+
+ String ejbName;
+ try {
+ ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.ejbName = ejbName;
+ } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: mappedName
+ String mappedNameRaw = elementReader.getElementAsString();
+
+ String mappedName;
+ try {
+ mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.mappedName = mappedName;
+ } else if (("ejb-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: ejbClass
+ String ejbClassRaw = elementReader.getElementAsString();
+
+ String ejbClass;
+ try {
+ ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.ejbClass = ejbClass;
+ } else if (("messaging-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messagingType
+ String messagingTypeRaw = elementReader.getElementAsString();
+
+ String messagingType;
+ try {
+ messagingType = Adapters.collapsedStringAdapterAdapter.unmarshal(messagingTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.messagingType = messagingType;
+ } else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: timeoutMethod
+ NamedMethod timeoutMethod = readNamedMethod(elementReader, context);
+ messageDrivenBean.timeoutMethod = timeoutMethod;
+ } else if (("timer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: timer
+ Timer timerItem = readTimer(elementReader, context);
+ if (timer == null) {
+ timer = messageDrivenBean.timer;
+ if (timer != null) {
+ timer.clear();
+ } else {
+ timer = new ArrayList<Timer>();
+ }
+ }
+ timer.add(timerItem);
+ } else if (("transaction-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: transactionType
+ TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementAsString());
+ if (transactionType != null) {
+ messageDrivenBean.transactionType = transactionType;
+ }
+ } else if (("message-selector" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageSelector
+ String messageSelectorRaw = elementReader.getElementAsString();
+
+ String messageSelector;
+ try {
+ messageSelector = Adapters.collapsedStringAdapterAdapter.unmarshal(messageSelectorRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ try {
+ messageDrivenBean.setMessageSelector(messageSelector);
+ } catch (Exception e) {
+ context.setterError(reader, MessageDrivenBean.class, "setMessageSelector", String.class, e);
+ }
+ } else if (("acknowledge-mode" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: acknowledgeMode
+ String acknowledgeModeRaw = elementReader.getElementAsString();
+
+ String acknowledgeMode;
+ try {
+ acknowledgeMode = Adapters.collapsedStringAdapterAdapter.unmarshal(acknowledgeModeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ try {
+ messageDrivenBean.setAcknowledgeMode(acknowledgeMode);
+ } catch (Exception e) {
+ context.setterError(reader, MessageDrivenBean.class, "setAcknowledgeMode", String.class, e);
+ }
+ } else if (("message-driven-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageDrivenDestination
+ MessageDrivenDestination messageDrivenDestination = readMessageDrivenDestination(elementReader, context);
+ try {
+ messageDrivenBean.setMessageDrivenDestination(messageDrivenDestination);
+ } catch (Exception e) {
+ context.setterError(reader, MessageDrivenBean.class, "setMessageDrivenDestination", MessageDrivenDestination.class, e);
+ }
+ } else if (("message-destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageDestinationType
+ String messageDestinationTypeRaw = elementReader.getElementAsString();
+
+ String messageDestinationType;
+ try {
+ messageDestinationType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.messageDestinationType = messageDestinationType;
+ } else if (("message-destination-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageDestinationLink
+ String messageDestinationLinkRaw = elementReader.getElementAsString();
+
+ String messageDestinationLink;
+ try {
+ messageDestinationLink = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationLinkRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageDrivenBean.messageDestinationLink = messageDestinationLink;
+ } else if (("activation-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: activationConfig
+ ActivationConfig activationConfig = readActivationConfig(elementReader, context);
+ messageDrivenBean.activationConfig = activationConfig;
+ } else if (("around-invoke" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: aroundInvoke
+ AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context);
+ if (aroundInvoke == null) {
+ aroundInvoke = messageDrivenBean.aroundInvoke;
+ if (aroundInvoke != null) {
+ aroundInvoke.clear();
+ } else {
+ aroundInvoke = new ArrayList<AroundInvoke>();
+ }
+ }
+ aroundInvoke.add(aroundInvokeItem);
+ } else if (("around-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: aroundTimeout
+ AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context);
+ if (aroundTimeout == null) {
+ aroundTimeout = messageDrivenBean.aroundTimeout;
+ if (aroundTimeout != null) {
+ aroundTimeout.clear();
+ } else {
+ aroundTimeout = new ArrayList<AroundTimeout>();
+ }
+ }
+ aroundTimeout.add(aroundTimeoutItem);
+ } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: envEntry
+ EnvEntry envEntryItem = readEnvEntry(elementReader, context);
+ if (envEntry == null) {
+ envEntry = messageDrivenBean.envEntry;
+ if (envEntry != null) {
+ envEntry.clear();
+ } else {
+ envEntry = new KeyedCollection<String, EnvEntry>();
+ }
+ }
+ envEntry.add(envEntryItem);
+ } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: ejbRef
+ EjbRef ejbRefItem = readEjbRef(elementReader, context);
+ if (ejbRef == null) {
+ ejbRef = messageDrivenBean.ejbRef;
+ if (ejbRef != null) {
+ ejbRef.clear();
+ } else {
+ ejbRef = new KeyedCollection<String, EjbRef>();
+ }
+ }
+ ejbRef.add(ejbRefItem);
+ } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: ejbLocalRef
+ EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context);
+ if (ejbLocalRef == null) {
+ ejbLocalRef = messageDrivenBean.ejbLocalRef;
+ if (ejbLocalRef != null) {
+ ejbLocalRef.clear();
+ } else {
+ ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
+ }
+ }
+ ejbLocalRef.add(ejbLocalRefItem);
+ } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: serviceRef
+ ServiceRef serviceRefItem = readServiceRef(elementReader, context);
+ if (serviceRef == null) {
+ serviceRef = messageDrivenBean.serviceRef;
+ if (serviceRef != null) {
+ serviceRef.clear();
+ } else {
+ serviceRef = new KeyedCollection<String, ServiceRef>();
+ }
+ }
+ serviceRef.add(serviceRefItem);
+ } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: resourceRef
+ ResourceRef resourceRefItem = readResourceRef(elementReader, context);
+ if (resourceRef == null) {
+ resourceRef = messageDrivenBean.resourceRef;
+ if (resourceRef != null) {
+ resourceRef.clear();
+ } else {
+ resourceRef = new KeyedCollection<String, ResourceRef>();
+ }
+ }
+ resourceRef.add(resourceRefItem);
+ } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: resourceEnvRef
+ ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context);
+ if (resourceEnvRef == null) {
+ resourceEnvRef = messageDrivenBean.resourceEnvRef;
+ if (resourceEnvRef != null) {
+ resourceEnvRef.clear();
+ } else {
+ resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
+ }
+ }
+ resourceEnvRef.add(resourceEnvRefItem);
+ } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageDestinationRef
+ MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context);
+ if (messageDestinationRef == null) {
+ messageDestinationRef = messageDrivenBean.messageDestinationRef;
+ if (messageDestinationRef != null) {
+ messageDestinationRef.clear();
+ } else {
+ messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
+ }
+ }
+ messageDestinationRef.add(messageDestinationRefItem);
+ } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: persistenceContextRef
+ PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context);
+ if (persistenceContextRef == null) {
+ persistenceContextRef = messageDrivenBean.persistenceContextRef;
+ if (persistenceContextRef != null) {
+ persistenceContextRef.clear();
+ } else {
+ persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
+ }
+ }
+ persistenceContextRef.add(persistenceContextRefItem);
+ } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: persistenceUnitRef
+ PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context);
+ if (persistenceUnitRef == null) {
+ persistenceUnitRef = messageDrivenBean.persistenceUnitRef;
+ if (persistenceUnitRef != null) {
+ persistenceUnitRef.clear();
+ } else {
+ persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
+ }
+ }
+ persistenceUnitRef.add(persistenceUnitRefItem);
+ } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: postConstruct
+ org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context);
+ if (postConstruct == null) {
+ postConstruct = messageDrivenBean.postConstruct;
+ if (postConstruct != null) {
+ postConstruct.clear();
+ } else {
+ postConstruct = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
+ }
+ }
+ postConstruct.add(postConstructItem);
+ } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: preDestroy
+ org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context);
+ if (preDestroy == null) {
+ preDestroy = messageDrivenBean.preDestroy;
+ if (preDestroy != null) {
+ preDestroy.clear();
+ } else {
+ preDestroy = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
+ }
+ }
+ preDestroy.add(preDestroyItem);
+ } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: dataSource
+ DataSource dataSourceItem = readDataSource(elementReader, context);
+ if (dataSource == null) {
+ dataSource = messageDrivenBean.dataSource;
+ if (dataSource != null) {
+ dataSource.clear();
+ } else {
+ dataSource = new KeyedCollection<String, DataSource>();
+ }
+ }
+ dataSource.add(dataSourceItem);
+ } else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: securityRoleRef
+ SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context);
+ if (securityRoleRef == null) {
+ securityRoleRef = messageDrivenBean.securityRoleRef;
+ if (securityRoleRef != null) {
+ securityRoleRef.clear();
+ } else {
+ securityRoleRef = new ArrayList<SecurityRoleRef>();
+ }
+ }
+ securityRoleRef.add(securityRoleRefItem);
+ } else if (("security-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: securityIdentity
+ SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context);
+ messageDrivenBean.securityIdentity = securityIdentity;
+ } else {
+ context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "messaging-type"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-selector"), new QName("http://java.sun.com/xml/ns/javaee", "acknowledge-mode"), new QName("http://java.sun.com/xml/ns/javaee", "message-driven-destination"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-type"), new QName("http://
java.sun.com/xml/ns/javaee", "message-destination-link"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-local-ref"), new QName("http://java.sun.com/xml/ns/javaee", "service-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-ref"), new QName("http://java.sun.com/xml/ns/javaee", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"),
new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"));
+ }
+ }
+ if (descriptions != null) {
+ try {
+ messageDrivenBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
+ } catch (Exception e) {
+ context.setterError(reader, MessageDrivenBean.class, "setDescriptions", Text[].class, e);
+ }
+ }
+ if (displayNames != null) {
+ try {
+ messageDrivenBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
+ } catch (Exception e) {
+ context.setterError(reader, MessageDrivenBean.class, "setDisplayNames", Text[].class, e);
+ }
+ }
+ if (icon != null) {
+ messageDrivenBean.icon = icon;
+ }
+ if (timer != null) {
+ messageDrivenBean.timer = timer;
+ }
+ if (aroundInvoke != null) {
+ messageDrivenBean.aroundInvoke = aroundInvoke;
+ }
+ if (aroundTimeout != null) {
+ messageDrivenBean.aroundTimeout = aroundTimeout;
+ }
+ if (envEntry != null) {
+ messageDrivenBean.envEntry = envEntry;
+ }
+ if (ejbRef != null) {
+ messageDrivenBean.ejbRef = ejbRef;
+ }
+ if (ejbLocalRef != null) {
+ messageDrivenBean.ejbLocalRef = ejbLocalRef;
+ }
+ if (serviceRef != null) {
+ messageDrivenBean.serviceRef = serviceRef;
+ }
+ if (resourceRef != null) {
+ messageDrivenBean.resourceRef = resourceRef;
+ }
+ if (resourceEnvRef != null) {
+ messageDrivenBean.resourceEnvRef = resourceEnvRef;
+ }
+ if (messageDestinationRef != null) {
+ messageDrivenBean.messageDestinationRef = messageDestinationRef;
+ }
+ if (persistenceContextRef != null) {
+ messageDrivenBean.persistenceContextRef = persistenceContextRef;
+ }
+ if (persistenceUnitRef != null) {
+ messageDrivenBean.persistenceUnitRef = persistenceUnitRef;
+ }
+ if (postConstruct != null) {
+ messageDrivenBean.postConstruct = postConstruct;
+ }
+ if (preDestroy != null) {
+ messageDrivenBean.preDestroy = preDestroy;
+ }
+ if (dataSource != null) {
+ messageDrivenBean.dataSource = dataSource;
+ }
+ if (securityRoleRef != null) {
+ messageDrivenBean.securityRoleRef = securityRoleRef;
+ }
+
+ context.afterUnmarshal(messageDrivenBean, com.envoisolutions.sxc.jaxb.LifecycleCallback.NONE);
+
+ return messageDrivenBean;
+ }
+
+ public final MessageDrivenBean read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context)
+ throws Exception {
+ if (messageDrivenBean == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
+ if (MessageDrivenBean.class != messageDrivenBean.getClass()) {
+ context.unexpectedSubclass(writer, messageDrivenBean, MessageDrivenBean.class);
+ return;
+ }
+
+ context.beforeMarshal(messageDrivenBean, com.envoisolutions.sxc.jaxb.LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = messageDrivenBean.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ELEMENT: descriptions
+ Text[] descriptions = null;
+ try {
+ descriptions = messageDrivenBean.getDescriptions();
+ } catch (Exception e) {
+ context.getterError(messageDrivenBean, "descriptions", MessageDrivenBean.class, "getDescriptions", e);
+ }
+ if (descriptions != null) {
+ for (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(messageDrivenBean, "descriptions");
+ }
+ }
+ }
+
+ // ELEMENT: displayNames
+ Text[] displayNames = null;
+ try {
+ displayNames = messageDrivenBean.getDisplayNames();
+ } catch (Exception e) {
+ context.getterError(messageDrivenBean, "displayNames", MessageDrivenBean.class, "getDisplayNames", e);
+ }
+ if (displayNames != null) {
+ for (Text displayNamesItem : displayNames) {
+ if (displayNamesItem != null) {
+ writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
+ writeText(writer, displayNamesItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "displayNames");
+ }
+ }
+ }
+
+ // ELEMENT: icon
+ LocalCollection<Icon> icon = messageDrivenBean.icon;
+ if (icon != null) {
+ for (Icon iconItem : icon) {
+ if (iconItem != null) {
+ writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
+ writeIcon(writer, iconItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "icon");
+ }
+ }
+ }
+
+ // ELEMENT: ejbName
+ String ejbNameRaw = messageDrivenBean.ejbName;
+ String ejbName = null;
+ try {
+ ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (ejbName != null) {
+ writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(ejbName);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "ejbName");
+ }
+
+ // ELEMENT: mappedName
+ String mappedNameRaw = messageDrivenBean.mappedName;
+ String mappedName = null;
+ try {
+ mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (mappedName != null) {
+ writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(mappedName);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: ejbClass
+ String ejbClassRaw = messageDrivenBean.ejbClass;
+ String ejbClass = null;
+ try {
+ ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (ejbClass != null) {
+ writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(ejbClass);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: messagingType
+ String messagingTypeRaw = messageDrivenBean.messagingType;
+ String messagingType = null;
+ try {
+ messagingType = Adapters.collapsedStringAdapterAdapter.marshal(messagingTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "messagingType", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (messagingType != null) {
+ writer.writeStartElement(prefix, "messaging-type", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(messagingType);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: timeoutMethod
+ NamedMethod timeoutMethod = messageDrivenBean.timeoutMethod;
+ if (timeoutMethod != null) {
+ writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee");
+ writeNamedMethod(writer, timeoutMethod, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: timer
+ List<Timer> timer = messageDrivenBean.timer;
+ if (timer != null) {
+ for (Timer timerItem : timer) {
+ writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee");
+ if (timerItem != null) {
+ writeTimer(writer, timerItem, context);
+ } else {
+ writer.writeXsiNil();
+ }
+ writer.writeEndElement();
+ }
+ }
+
+ // ELEMENT: transactionType
+ TransactionType transactionType = messageDrivenBean.transactionType;
+ if (transactionType != null) {
+ writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(toStringTransactionType(messageDrivenBean, null, context, transactionType));
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: messageSelector
+ String messageSelectorRaw = null;
+ try {
+ messageSelectorRaw = messageDrivenBean.getMessageSelector();
+ } catch (Exception e) {
+ context.getterError(messageDrivenBean, "messageSelector", MessageDrivenBean.class, "getMessageSelector", e);
+ }
+ String messageSelector = null;
+ try {
+ messageSelector = Adapters.collapsedStringAdapterAdapter.marshal(messageSelectorRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "messageSelector", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (messageSelector != null) {
+ writer.writeStartElement(prefix, "message-selector", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(messageSelector);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: acknowledgeMode
+ String acknowledgeModeRaw = null;
+ try {
+ acknowledgeModeRaw = messageDrivenBean.getAcknowledgeMode();
+ } catch (Exception e) {
+ context.getterError(messageDrivenBean, "acknowledgeMode", MessageDrivenBean.class, "getAcknowledgeMode", e);
+ }
+ String acknowledgeMode = null;
+ try {
+ acknowledgeMode = Adapters.collapsedStringAdapterAdapter.marshal(acknowledgeModeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "acknowledgeMode", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (acknowledgeMode != null) {
+ writer.writeStartElement(prefix, "acknowledge-mode", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(acknowledgeMode);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: messageDrivenDestination
+ MessageDrivenDestination messageDrivenDestination = null;
+ try {
+ messageDrivenDestination = messageDrivenBean.getMessageDrivenDestination();
+ } catch (Exception e) {
+ context.getterError(messageDrivenBean, "messageDrivenDestination", MessageDrivenBean.class, "getMessageDrivenDestination", e);
+ }
+ if (messageDrivenDestination != null) {
+ writer.writeStartElement(prefix, "message-driven-destination", "http://java.sun.com/xml/ns/javaee");
+ writeMessageDrivenDestination(writer, messageDrivenDestination, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: messageDestinationType
+ String messageDestinationTypeRaw = messageDrivenBean.messageDestinationType;
+ String messageDestinationType = null;
+ try {
+ messageDestinationType = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "messageDestinationType", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (messageDestinationType != null) {
+ writer.writeStartElement(prefix, "message-destination-type", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(messageDestinationType);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: messageDestinationLink
+ String messageDestinationLinkRaw = messageDrivenBean.messageDestinationLink;
+ String messageDestinationLink = null;
+ try {
+ messageDestinationLink = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationLinkRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenBean, "messageDestinationLink", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (messageDestinationLink != null) {
+ writer.writeStartElement(prefix, "message-destination-link", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(messageDestinationLink);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: activationConfig
+ ActivationConfig activationConfig = messageDrivenBean.activationConfig;
+ if (activationConfig != null) {
+ writer.writeStartElement(prefix, "activation-config", "http://java.sun.com/xml/ns/javaee");
+ writeActivationConfig(writer, activationConfig, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: aroundInvoke
+ List<AroundInvoke> aroundInvoke = messageDrivenBean.aroundInvoke;
+ if (aroundInvoke != null) {
+ for (AroundInvoke aroundInvokeItem : aroundInvoke) {
+ if (aroundInvokeItem != null) {
+ writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee");
+ writeAroundInvoke(writer, aroundInvokeItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "aroundInvoke");
+ }
+ }
+ }
+
+ // ELEMENT: aroundTimeout
+ List<AroundTimeout> aroundTimeout = messageDrivenBean.aroundTimeout;
+ if (aroundTimeout != null) {
+ for (AroundTimeout aroundTimeoutItem : aroundTimeout) {
+ if (aroundTimeoutItem != null) {
+ writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee");
+ writeAroundTimeout(writer, aroundTimeoutItem, context);
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ // ELEMENT: envEntry
+ KeyedCollection<String, EnvEntry> envEntry = messageDrivenBean.envEntry;
+ if (envEntry != null) {
+ for (EnvEntry envEntryItem : envEntry) {
+ if (envEntryItem != null) {
+ writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee");
+ writeEnvEntry(writer, envEntryItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "envEntry");
+ }
+ }
+ }
+
+ // ELEMENT: ejbRef
+ KeyedCollection<String, EjbRef> ejbRef = messageDrivenBean.ejbRef;
+ if (ejbRef != null) {
+ for (EjbRef ejbRefItem : ejbRef) {
+ if (ejbRefItem != null) {
+ writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee");
+ writeEjbRef(writer, ejbRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "ejbRef");
+ }
+ }
+ }
+
+ // ELEMENT: ejbLocalRef
+ KeyedCollection<String, EjbLocalRef> ejbLocalRef = messageDrivenBean.ejbLocalRef;
+ if (ejbLocalRef != null) {
+ for (EjbLocalRef ejbLocalRefItem : ejbLocalRef) {
+ if (ejbLocalRefItem != null) {
+ writer.writeStartElement(prefix, "ejb-local-ref", "http://java.sun.com/xml/ns/javaee");
+ writeEjbLocalRef(writer, ejbLocalRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "ejbLocalRef");
+ }
+ }
+ }
+
+ // ELEMENT: serviceRef
+ KeyedCollection<String, ServiceRef> serviceRef = messageDrivenBean.serviceRef;
+ if (serviceRef != null) {
+ for (ServiceRef serviceRefItem : serviceRef) {
+ if (serviceRefItem != null) {
+ writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee");
+ writeServiceRef(writer, serviceRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "serviceRef");
+ }
+ }
+ }
+
+ // ELEMENT: resourceRef
+ KeyedCollection<String, ResourceRef> resourceRef = messageDrivenBean.resourceRef;
+ if (resourceRef != null) {
+ for (ResourceRef resourceRefItem : resourceRef) {
+ if (resourceRefItem != null) {
+ writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee");
+ writeResourceRef(writer, resourceRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "resourceRef");
+ }
+ }
+ }
+
+ // ELEMENT: resourceEnvRef
+ KeyedCollection<String, ResourceEnvRef> resourceEnvRef = messageDrivenBean.resourceEnvRef;
+ if (resourceEnvRef != null) {
+ for (ResourceEnvRef resourceEnvRefItem : resourceEnvRef) {
+ if (resourceEnvRefItem != null) {
+ writer.writeStartElement(prefix, "resource-env-ref", "http://java.sun.com/xml/ns/javaee");
+ writeResourceEnvRef(writer, resourceEnvRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "resourceEnvRef");
+ }
+ }
+ }
+
+ // ELEMENT: messageDestinationRef
+ KeyedCollection<String, MessageDestinationRef> messageDestinationRef = messageDrivenBean.messageDestinationRef;
+ if (messageDestinationRef != null) {
+ for (MessageDestinationRef messageDestinationRefItem : messageDestinationRef) {
+ if (messageDestinationRefItem != null) {
+ writer.writeStartElement(prefix, "message-destination-ref", "http://java.sun.com/xml/ns/javaee");
+ writeMessageDestinationRef(writer, messageDestinationRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "messageDestinationRef");
+ }
+ }
+ }
+
+ // ELEMENT: persistenceContextRef
+ KeyedCollection<String, PersistenceContextRef> persistenceContextRef = messageDrivenBean.persistenceContextRef;
+ if (persistenceContextRef != null) {
+ for (PersistenceContextRef persistenceContextRefItem : persistenceContextRef) {
+ if (persistenceContextRefItem != null) {
+ writer.writeStartElement(prefix, "persistence-context-ref", "http://java.sun.com/xml/ns/javaee");
+ writePersistenceContextRef(writer, persistenceContextRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "persistenceContextRef");
+ }
+ }
+ }
+
+ // ELEMENT: persistenceUnitRef
+ KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef = messageDrivenBean.persistenceUnitRef;
+ if (persistenceUnitRef != null) {
+ for (PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) {
+ if (persistenceUnitRefItem != null) {
+ writer.writeStartElement(prefix, "persistence-unit-ref", "http://java.sun.com/xml/ns/javaee");
+ writePersistenceUnitRef(writer, persistenceUnitRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "persistenceUnitRef");
+ }
+ }
+ }
+
+ // ELEMENT: postConstruct
+ List<org.apache.openejb.jee.LifecycleCallback> postConstruct = messageDrivenBean.postConstruct;
+ if (postConstruct != null) {
+ for (org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) {
+ if (postConstructItem != null) {
+ writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee");
+ writeLifecycleCallback(writer, postConstructItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "postConstruct");
+ }
+ }
+ }
+
+ // ELEMENT: preDestroy
+ List<org.apache.openejb.jee.LifecycleCallback> preDestroy = messageDrivenBean.preDestroy;
+ if (preDestroy != null) {
+ for (org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) {
+ if (preDestroyItem != null) {
+ writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee");
+ writeLifecycleCallback(writer, preDestroyItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "preDestroy");
+ }
+ }
+ }
+
+ // ELEMENT: dataSource
+ KeyedCollection<String, DataSource> dataSource = messageDrivenBean.dataSource;
+ if (dataSource != null) {
+ for (DataSource dataSourceItem : dataSource) {
+ if (dataSourceItem != null) {
+ writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee");
+ writeDataSource(writer, dataSourceItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "dataSource");
+ }
+ }
+ }
+
+ // ELEMENT: securityRoleRef
+ List<SecurityRoleRef> securityRoleRef = messageDrivenBean.securityRoleRef;
+ if (securityRoleRef != null) {
+ for (SecurityRoleRef securityRoleRefItem : securityRoleRef) {
+ if (securityRoleRefItem != null) {
+ writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee");
+ writeSecurityRoleRef(writer, securityRoleRefItem, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenBean, "securityRoleRef");
+ }
+ }
+ }
+
+ // ELEMENT: securityIdentity
+ SecurityIdentity securityIdentity = messageDrivenBean.securityIdentity;
+ if (securityIdentity != null) {
+ writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee");
+ writeSecurityIdentity(writer, securityIdentity, context);
+ writer.writeEndElement();
+ }
+
+ context.afterMarshal(messageDrivenBean, com.envoisolutions.sxc.jaxb.LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+
+import static org.apache.openejb.jee.DestinationType$JAXB.readDestinationType;
+import static org.apache.openejb.jee.DestinationType$JAXB.writeDestinationType;
+import static org.apache.openejb.jee.SubscriptionDurability$JAXB.readSubscriptionDurability;
+import static org.apache.openejb.jee.SubscriptionDurability$JAXB.writeSubscriptionDurability;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class MessageDrivenDestination$JAXB
+ extends JAXBObject<MessageDrivenDestination> {
+
+
+ public MessageDrivenDestination$JAXB() {
+ super(MessageDrivenDestination.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-destination".intern()), null, DestinationType$JAXB.class, SubscriptionDurability$JAXB.class);
+ }
+
+ public static MessageDrivenDestination readMessageDrivenDestination(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeMessageDrivenDestination(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageDrivenDestination, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageDrivenDestination, context);
+ }
+
+ public final static MessageDrivenDestination _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ MessageDrivenDestination messageDrivenDestination = new MessageDrivenDestination();
+ context.beforeUnmarshal(messageDrivenDestination, LifecycleCallback.NONE);
+
+
+ // Check xsi:type
+ QName xsiType = reader.getXsiType();
+ if (xsiType != null) {
+ return context.unexpectedXsiType(reader, MessageDrivenDestination.class);
+ }
+
+ // Read attributes
+ for (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
+ context.addXmlId(reader, id, messageDrivenDestination);
+ messageDrivenDestination.id = id;
+ } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
+ context.unexpectedAttribute(attribute, new QName("", "id"));
+ }
+ }
+
+ // Read elements
+ for (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: destinationType
+ DestinationType destinationType = readDestinationType(elementReader, context);
+ messageDrivenDestination.destinationType = destinationType;
+ } else if (("subscription-durability" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: subscriptionDurability
+ SubscriptionDurability subscriptionDurability = readSubscriptionDurability(elementReader, context);
+ messageDrivenDestination.subscriptionDurability = subscriptionDurability;
+ } else {
+ context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "subscription-durability"));
+ }
+ }
+
+ context.afterUnmarshal(messageDrivenDestination, LifecycleCallback.NONE);
+
+ return messageDrivenDestination;
+ }
+
+ public final MessageDrivenDestination read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context)
+ throws Exception {
+ if (messageDrivenDestination == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
+ if (MessageDrivenDestination.class != messageDrivenDestination.getClass()) {
+ context.unexpectedSubclass(writer, messageDrivenDestination, MessageDrivenDestination.class);
+ return;
+ }
+
+ context.beforeMarshal(messageDrivenDestination, LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = messageDrivenDestination.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageDrivenDestination, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ELEMENT: destinationType
+ DestinationType destinationType = messageDrivenDestination.destinationType;
+ if (destinationType != null) {
+ writer.writeStartElement(prefix, "destination-type", "http://java.sun.com/xml/ns/javaee");
+ writeDestinationType(writer, destinationType, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageDrivenDestination, "destinationType");
+ }
+
+ // ELEMENT: subscriptionDurability
+ SubscriptionDurability subscriptionDurability = messageDrivenDestination.subscriptionDurability;
+ if (subscriptionDurability != null) {
+ writer.writeStartElement(prefix, "subscription-durability", "http://java.sun.com/xml/ns/javaee");
+ writeSubscriptionDurability(writer, subscriptionDurability, context);
+ writer.writeEndElement();
+ }
+
+ context.afterMarshal(messageDrivenDestination, LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+
+import static org.apache.openejb.jee.ActivationSpec$JAXB.readActivationSpec;
+import static org.apache.openejb.jee.ActivationSpec$JAXB.writeActivationSpec;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class MessageListener$JAXB
+ extends JAXBObject<MessageListener> {
+
+
+ public MessageListener$JAXB() {
+ super(MessageListener.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "messagelistenerType".intern()), ActivationSpec$JAXB.class);
+ }
+
+ public static MessageListener readMessageListener(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeMessageListener(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageListener, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context)
+ throws Exception {
+ _write(writer, messageListener, context);
+ }
+
+ public final static MessageListener _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ MessageListener messageListener = new MessageListener();
+ context.beforeUnmarshal(messageListener, LifecycleCallback.NONE);
+
+
+ // Check xsi:type
+ QName xsiType = reader.getXsiType();
+ if (xsiType != null) {
+ if (("messagelistenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
+ return context.unexpectedXsiType(reader, MessageListener.class);
+ }
+ }
+
+ // Read attributes
+ for (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
+ context.addXmlId(reader, id, messageListener);
+ messageListener.id = id;
+ } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
+ context.unexpectedAttribute(attribute, new QName("", "id"));
+ }
+ }
+
+ // Read elements
+ for (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("messagelistener-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: messageListenerType
+ String messageListenerTypeRaw = elementReader.getElementAsString();
+
+ String messageListenerType;
+ try {
+ messageListenerType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageListenerTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ messageListener.messageListenerType = messageListenerType;
+ } else if (("activationspec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: activationSpec
+ ActivationSpec activationSpec = readActivationSpec(elementReader, context);
+ messageListener.activationSpec = activationSpec;
+ } else {
+ context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messagelistener-type"), new QName("http://java.sun.com/xml/ns/javaee", "activationspec"));
+ }
+ }
+
+ context.afterUnmarshal(messageListener, LifecycleCallback.NONE);
+
+ return messageListener;
+ }
+
+ public final MessageListener read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context)
+ throws Exception {
+ if (messageListener == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
+ if (MessageListener.class != messageListener.getClass()) {
+ context.unexpectedSubclass(writer, messageListener, MessageListener.class);
+ return;
+ }
+
+ context.beforeMarshal(messageListener, LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = messageListener.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageListener, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ELEMENT: messageListenerType
+ String messageListenerTypeRaw = messageListener.messageListenerType;
+ String messageListenerType = null;
+ try {
+ messageListenerType = Adapters.collapsedStringAdapterAdapter.marshal(messageListenerTypeRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(messageListener, "messageListenerType", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (messageListenerType != null) {
+ writer.writeStartElement(prefix, "messagelistener-type", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(messageListenerType);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageListener, "messageListenerType");
+ }
+
+ // ELEMENT: activationSpec
+ ActivationSpec activationSpec = messageListener.activationSpec;
+ if (activationSpec != null) {
+ writer.writeStartElement(prefix, "activationspec", "http://java.sun.com/xml/ns/javaee");
+ writeActivationSpec(writer, activationSpec, context);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(messageListener, "activationSpec");
+ }
+
+ context.afterMarshal(messageListener, LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+
+import static org.apache.openejb.jee.MethodIntf$JAXB.parseMethodIntf;
+import static org.apache.openejb.jee.MethodIntf$JAXB.toStringMethodIntf;
+import static org.apache.openejb.jee.MethodParams$JAXB.readMethodParams;
+import static org.apache.openejb.jee.MethodParams$JAXB.writeMethodParams;
+import static org.apache.openejb.jee.Text$JAXB.readText;
+import static org.apache.openejb.jee.Text$JAXB.writeText;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class Method$JAXB
+ extends JAXBObject<Method> {
+
+
+ public Method$JAXB() {
+ super(Method.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "methodType".intern()), Text$JAXB.class, MethodIntf$JAXB.class, MethodParams$JAXB.class);
+ }
+
+ public static Method readMethod(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeMethod(XoXMLStreamWriter writer, Method method, RuntimeContext context)
+ throws Exception {
+ _write(writer, method, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, Method method, RuntimeContext context)
+ throws Exception {
+ _write(writer, method, context);
+ }
+
+ public final static Method _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ Method method = new Method();
+ context.beforeUnmarshal(method, LifecycleCallback.NONE);
+
+ ArrayList<Text> descriptions = null;
+
+ // Check xsi:type
+ QName xsiType = reader.getXsiType();
+ if (xsiType != null) {
+ if (("methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
+ return context.unexpectedXsiType(reader, Method.class);
+ }
+ }
+
+ // Read attributes
+ for (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
+ context.addXmlId(reader, id, method);
+ method.id = id;
+ } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
+ context.unexpectedAttribute(attribute, new QName("", "id"));
+ }
+ }
+
+ // Read elements
+ for (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: descriptions
+ Text descriptionsItem = readText(elementReader, context);
+ if (descriptions == null) {
+ descriptions = new ArrayList<Text>();
+ }
+ descriptions.add(descriptionsItem);
+ } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: ejbName
+ String ejbNameRaw = elementReader.getElementAsString();
+
+ String ejbName;
+ try {
+ ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ method.ejbName = ejbName;
+ } else if (("method-intf" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: methodIntf
+ MethodIntf methodIntf = parseMethodIntf(elementReader, context, elementReader.getElementAsString());
+ if (methodIntf != null) {
+ method.methodIntf = methodIntf;
+ }
+ } else if (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: methodName
+ String methodNameRaw = elementReader.getElementAsString();
+
+ String methodName;
+ try {
+ methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+ continue;
+ }
+
+ method.methodName = methodName;
+ } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: methodParams
+ MethodParams methodParams = readMethodParams(elementReader, context);
+ method.methodParams = methodParams;
+ } else {
+ context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-intf"), new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params"));
+ }
+ }
+ if (descriptions != null) {
+ try {
+ method.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
+ } catch (Exception e) {
+ context.setterError(reader, Method.class, "setDescriptions", Text[].class, e);
+ }
+ }
+
+ context.afterUnmarshal(method, LifecycleCallback.NONE);
+
+ return method;
+ }
+
+ public final Method read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, Method method, RuntimeContext context)
+ throws Exception {
+ if (method == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
+ if (Method.class != method.getClass()) {
+ context.unexpectedSubclass(writer, method, Method.class);
+ return;
+ }
+
+ context.beforeMarshal(method, LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = method.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(method, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ELEMENT: descriptions
+ Text[] descriptions = null;
+ try {
+ descriptions = method.getDescriptions();
+ } catch (Exception e) {
+ context.getterError(method, "descriptions", Method.class, "getDescriptions", e);
+ }
+ if (descriptions != null) {
+ for (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(method, "descriptions");
+ }
+ }
+ }
+
+ // ELEMENT: ejbName
+ String ejbNameRaw = method.ejbName;
+ String ejbName = null;
+ try {
+ ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(method, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (ejbName != null) {
+ writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(ejbName);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(method, "ejbName");
+ }
+
+ // ELEMENT: methodIntf
+ MethodIntf methodIntf = method.methodIntf;
+ if (methodIntf != null) {
+ writer.writeStartElement(prefix, "method-intf", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(toStringMethodIntf(method, null, context, methodIntf));
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: methodName
+ String methodNameRaw = method.methodName;
+ String methodName = null;
+ try {
+ methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(method, "methodName", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (methodName != null) {
+ writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(methodName);
+ writer.writeEndElement();
+ } else {
+ context.unexpectedNullValue(method, "methodName");
+ }
+
+ // ELEMENT: methodParams
+ MethodParams methodParams = method.methodParams;
+ if (methodParams != null) {
+ writer.writeStartElement(prefix, "method-params", "http://java.sun.com/xml/ns/javaee");
+ writeMethodParams(writer, methodParams, context);
+ writer.writeEndElement();
+ }
+
+ context.afterMarshal(method, LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native