Search in sources :

Example 96 with Attribute

use of org.metatype.sxc.util.Attribute in project tomee by apache.

the class MessageDestinationRef$JAXB method _read.

public static final MessageDestinationRef _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final MessageDestinationRef messageDestinationRef = new MessageDestinationRef();
    context.beforeUnmarshal(messageDestinationRef, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    Set<InjectionTarget> injectionTarget = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("message-destination-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, MessageDestinationRef.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, messageDestinationRef);
            messageDestinationRef.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("message-destination-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestinationRefName
            final String messageDestinationRefNameRaw = elementReader.getElementAsString();
            final String messageDestinationRefName;
            try {
                messageDestinationRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationRefNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            messageDestinationRef.messageDestinationRefName = messageDestinationRefName;
        } else if (("message-destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestinationType
            final String messageDestinationTypeRaw = elementReader.getElementAsString();
            final String messageDestinationType;
            try {
                messageDestinationType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationTypeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            messageDestinationRef.messageDestinationType = messageDestinationType;
        } else if (("message-destination-usage" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestinationUsage
            final MessageDestinationUsage messageDestinationUsage = parseMessageDestinationUsage(elementReader, context, elementReader.getElementAsString());
            if (messageDestinationUsage != null) {
                messageDestinationRef.messageDestinationUsage = messageDestinationUsage;
            }
        } else if (("message-destination-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestinationLink
            final String messageDestinationLinkRaw = elementReader.getElementAsString();
            final String messageDestinationLink;
            try {
                messageDestinationLink = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationLinkRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            messageDestinationRef.messageDestinationLink = messageDestinationLink;
        } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: mappedName
            final String mappedNameRaw = elementReader.getElementAsString();
            final String mappedName;
            try {
                mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            messageDestinationRef.mappedName = mappedName;
        } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: injectionTarget
            final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context);
            if (injectionTarget == null) {
                injectionTarget = messageDestinationRef.injectionTarget;
                if (injectionTarget != null) {
                    injectionTarget.clear();
                } else {
                    injectionTarget = new LinkedHashSet<InjectionTarget>();
                }
            }
            injectionTarget.add(injectionTargetItem);
        } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: lookupName
            final String lookupNameRaw = elementReader.getElementAsString();
            final String lookupName;
            try {
                lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            messageDestinationRef.lookupName = lookupName;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-usage"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-link"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "injection-target"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name"));
        }
    }
    if (descriptions != null) {
        try {
            messageDestinationRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, MessageDestinationRef.class, "setDescriptions", Text[].class, e);
        }
    }
    if (injectionTarget != null) {
        messageDestinationRef.injectionTarget = injectionTarget;
    }
    context.afterUnmarshal(messageDestinationRef, LifecycleCallback.NONE);
    return messageDestinationRef;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) MessageDestinationUsage$JAXB.toStringMessageDestinationUsage(org.apache.openejb.jee.MessageDestinationUsage$JAXB.toStringMessageDestinationUsage) MessageDestinationUsage$JAXB.parseMessageDestinationUsage(org.apache.openejb.jee.MessageDestinationUsage$JAXB.parseMessageDestinationUsage) InjectionTarget$JAXB.writeInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget) InjectionTarget$JAXB.readInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 97 with Attribute

use of org.metatype.sxc.util.Attribute in project tomee by apache.

the class MessageDrivenBean$JAXB method _read.

public static final MessageDrivenBean _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final MessageDrivenBean messageDrivenBean = new MessageDrivenBean();
    context.beforeUnmarshal(messageDrivenBean, org.metatype.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
    final 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 (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final 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 (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final 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
            final 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
            final 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
            final String ejbNameRaw = elementReader.getElementAsString();
            final String ejbName;
            try {
                ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw);
            } catch (final 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
            final String mappedNameRaw = elementReader.getElementAsString();
            final String mappedName;
            try {
                mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
            } catch (final 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
            final String ejbClassRaw = elementReader.getElementAsString();
            final String ejbClass;
            try {
                ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw);
            } catch (final 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
            final String messagingTypeRaw = elementReader.getElementAsString();
            final String messagingType;
            try {
                messagingType = Adapters.collapsedStringAdapterAdapter.unmarshal(messagingTypeRaw);
            } catch (final 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
            final NamedMethod timeoutMethod = readNamedMethod(elementReader, context);
            messageDrivenBean.timeoutMethod = timeoutMethod;
        } else if (("timer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: timer
            final 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
            final 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
            final String messageSelectorRaw = elementReader.getElementAsString();
            final String messageSelector;
            try {
                messageSelector = Adapters.collapsedStringAdapterAdapter.unmarshal(messageSelectorRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            try {
                messageDrivenBean.setMessageSelector(messageSelector);
            } catch (final 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
            final String acknowledgeModeRaw = elementReader.getElementAsString();
            final String acknowledgeMode;
            try {
                acknowledgeMode = Adapters.collapsedStringAdapterAdapter.unmarshal(acknowledgeModeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            try {
                messageDrivenBean.setAcknowledgeMode(acknowledgeMode);
            } catch (final 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
            final MessageDrivenDestination messageDrivenDestination = readMessageDrivenDestination(elementReader, context);
            try {
                messageDrivenBean.setMessageDrivenDestination(messageDrivenDestination);
            } catch (final 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
            final String messageDestinationTypeRaw = elementReader.getElementAsString();
            final String messageDestinationType;
            try {
                messageDestinationType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationTypeRaw);
            } catch (final 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
            final String messageDestinationLinkRaw = elementReader.getElementAsString();
            final String messageDestinationLink;
            try {
                messageDestinationLink = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationLinkRaw);
            } catch (final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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
            final 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 (final Exception e) {
            context.setterError(reader, MessageDrivenBean.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            messageDrivenBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final 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, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
    return messageDrivenBean;
}
Also used : ArrayList(java.util.ArrayList) SecurityRoleRef$JAXB.readSecurityRoleRef(org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef) SecurityRoleRef$JAXB.writeSecurityRoleRef(org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef) ResourceEnvRef$JAXB.readResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef) ResourceEnvRef$JAXB.writeResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader) DataSource$JAXB.writeDataSource(org.apache.openejb.jee.DataSource$JAXB.writeDataSource) DataSource$JAXB.readDataSource(org.apache.openejb.jee.DataSource$JAXB.readDataSource) ActivationConfig$JAXB.writeActivationConfig(org.apache.openejb.jee.ActivationConfig$JAXB.writeActivationConfig) ActivationConfig$JAXB.readActivationConfig(org.apache.openejb.jee.ActivationConfig$JAXB.readActivationConfig) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) ServiceRef$JAXB.readServiceRef(org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef) ServiceRef$JAXB.writeServiceRef(org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef) TransactionType$JAXB.toStringTransactionType(org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType) TransactionType$JAXB.parseTransactionType(org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType) Attribute(org.metatype.sxc.util.Attribute) PersistenceContextRef$JAXB.readPersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef) PersistenceContextRef$JAXB.writePersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef) NamedMethod$JAXB.readNamedMethod(org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod) NamedMethod$JAXB.writeNamedMethod(org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod) MessageDestinationRef$JAXB.writeMessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef) MessageDestinationRef$JAXB.readMessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef) EjbRef$JAXB.readEjbRef(org.apache.openejb.jee.EjbRef$JAXB.readEjbRef) EjbRef$JAXB.writeEjbRef(org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef) AroundInvoke$JAXB.writeAroundInvoke(org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke) AroundInvoke$JAXB.readAroundInvoke(org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke) PersistenceUnitRef$JAXB.readPersistenceUnitRef(org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef) PersistenceUnitRef$JAXB.writePersistenceUnitRef(org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef) EnvEntry$JAXB.readEnvEntry(org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry) EnvEntry$JAXB.writeEnvEntry(org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry) EjbLocalRef$JAXB.writeEjbLocalRef(org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef) EjbLocalRef$JAXB.readEjbLocalRef(org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) QName(javax.xml.namespace.QName) MessageDrivenDestination$JAXB.writeMessageDrivenDestination(org.apache.openejb.jee.MessageDrivenDestination$JAXB.writeMessageDrivenDestination) MessageDrivenDestination$JAXB.readMessageDrivenDestination(org.apache.openejb.jee.MessageDrivenDestination$JAXB.readMessageDrivenDestination) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) AroundTimeout$JAXB.readAroundTimeout(org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout) AroundTimeout$JAXB.writeAroundTimeout(org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout) SecurityIdentity$JAXB.readSecurityIdentity(org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity) SecurityIdentity$JAXB.writeSecurityIdentity(org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity) Timer$JAXB.writeTimer(org.apache.openejb.jee.Timer$JAXB.writeTimer) Timer$JAXB.readTimer(org.apache.openejb.jee.Timer$JAXB.readTimer) ResourceRef$JAXB.readResourceRef(org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef) ResourceRef$JAXB.writeResourceRef(org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef) LifecycleCallback$JAXB.writeLifecycleCallback(org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback) LifecycleCallback$JAXB.readLifecycleCallback(org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback)

Example 98 with Attribute

use of org.metatype.sxc.util.Attribute in project tomee by apache.

the class JspPropertyGroup$JAXB method _read.

public static final JspPropertyGroup _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final JspPropertyGroup jspPropertyGroup = new JspPropertyGroup();
    context.beforeUnmarshal(jspPropertyGroup, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<String> urlPattern = null;
    List<String> includePrelude = null;
    List<String> includeCoda = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("jsp-property-groupType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, JspPropertyGroup.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, jspPropertyGroup);
            jspPropertyGroup.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final 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
            final 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
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = jspPropertyGroup.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: urlPattern
            final String urlPatternItemRaw = elementReader.getElementAsString();
            final String urlPatternItem;
            try {
                urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (urlPattern == null) {
                urlPattern = jspPropertyGroup.urlPattern;
                if (urlPattern != null) {
                    urlPattern.clear();
                } else {
                    urlPattern = new ArrayList<String>();
                }
            }
            urlPattern.add(urlPatternItem);
        } else if (("el-ignored" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: elIgnored
            final Boolean elIgnored = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.elIgnored = elIgnored;
        } else if (("page-encoding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: pageEncoding
            final String pageEncodingRaw = elementReader.getElementAsString();
            final String pageEncoding;
            try {
                pageEncoding = Adapters.collapsedStringAdapterAdapter.unmarshal(pageEncodingRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            jspPropertyGroup.pageEncoding = pageEncoding;
        } else if (("scripting-invalid" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: scriptingInvalid
            final Boolean scriptingInvalid = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.scriptingInvalid = scriptingInvalid;
        } else if (("is-xml" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: isXml
            final Boolean isXml = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.isXml = isXml;
        } else if (("include-prelude" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: includePrelude
            final String includePreludeItemRaw = elementReader.getElementAsString();
            final String includePreludeItem;
            try {
                includePreludeItem = Adapters.collapsedStringAdapterAdapter.unmarshal(includePreludeItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (includePrelude == null) {
                includePrelude = jspPropertyGroup.includePrelude;
                if (includePrelude != null) {
                    includePrelude.clear();
                } else {
                    includePrelude = new ArrayList<String>();
                }
            }
            includePrelude.add(includePreludeItem);
        } else if (("include-coda" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: includeCoda
            final String includeCodaItemRaw = elementReader.getElementAsString();
            final String includeCodaItem;
            try {
                includeCodaItem = Adapters.collapsedStringAdapterAdapter.unmarshal(includeCodaItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (includeCoda == null) {
                includeCoda = jspPropertyGroup.includeCoda;
                if (includeCoda != null) {
                    includeCoda.clear();
                } else {
                    includeCoda = new ArrayList<String>();
                }
            }
            includeCoda.add(includeCodaItem);
        } else if (("deferred-syntax-allowed-as-literal" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: deferredSyntaxAllowedAsLiteral
            final Boolean deferredSyntaxAllowedAsLiteral = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.deferredSyntaxAllowedAsLiteral = deferredSyntaxAllowedAsLiteral;
        } else if (("trim-directive-whitespaces" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: trimDirectiveWhitespaces
            final Boolean trimDirectiveWhitespaces = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.trimDirectiveWhitespaces = trimDirectiveWhitespaces;
        } else if (("default-content-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: defaultContentType
            final String defaultContentTypeRaw = elementReader.getElementAsString();
            final String defaultContentType;
            try {
                defaultContentType = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultContentTypeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            jspPropertyGroup.defaultContentType = defaultContentType;
        } else if (("buffer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: buffer
            final String bufferRaw = elementReader.getElementAsString();
            final String buffer;
            try {
                buffer = Adapters.collapsedStringAdapterAdapter.unmarshal(bufferRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            jspPropertyGroup.buffer = buffer;
        } else if (("error-on-undeclared-namespace" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: errorOnUndeclaredNamespace
            final Boolean errorOnUndeclaredNamespace = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            jspPropertyGroup.errorOnUndeclaredNamespace = errorOnUndeclaredNamespace;
        } 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", "url-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "el-ignored"), new QName("http://java.sun.com/xml/ns/javaee", "page-encoding"), new QName("http://java.sun.com/xml/ns/javaee", "scripting-invalid"), new QName("http://java.sun.com/xml/ns/javaee", "is-xml"), new QName("http://java.sun.com/xml/ns/javaee", "include-prelude"), new QName("http://java.sun.com/xml/ns/javaee", "include-coda"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-syntax-allowed-as-literal"), new QName("http://java.sun.com/xml/ns/javaee", "trim-directive-whitespaces"), new QName("http://java.sun.com/xml/ns/javaee", "default-content-type"), new QName("http://java.sun.com/xml/ns/javaee", "buffer"), new QName("http://java.sun.com/xml/ns/javaee", "error-on-undeclared-namespace"));
        }
    }
    if (descriptions != null) {
        try {
            jspPropertyGroup.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, JspPropertyGroup.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            jspPropertyGroup.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, JspPropertyGroup.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        jspPropertyGroup.icon = icon;
    }
    if (urlPattern != null) {
        jspPropertyGroup.urlPattern = urlPattern;
    }
    if (includePrelude != null) {
        jspPropertyGroup.includePrelude = includePrelude;
    }
    if (includeCoda != null) {
        jspPropertyGroup.includeCoda = includeCoda;
    }
    context.afterUnmarshal(jspPropertyGroup, LifecycleCallback.NONE);
    return jspPropertyGroup;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 99 with Attribute

use of org.metatype.sxc.util.Attribute in project tomee by apache.

the class License$JAXB method _read.

public static final License _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final License license = new License();
    context.beforeUnmarshal(license, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("licenseType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, License.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, license);
            license.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("license-required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: licenseRequired
            final Boolean licenseRequired = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            license.licenseRequired = licenseRequired;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "license-required"));
        }
    }
    if (descriptions != null) {
        try {
            license.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, License.class, "setDescriptions", Text[].class, e);
        }
    }
    context.afterUnmarshal(license, LifecycleCallback.NONE);
    return license;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 100 with Attribute

use of org.metatype.sxc.util.Attribute in project tomee by apache.

the class Filter$JAXB method _read.

public static final Filter _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final Filter filter = new Filter();
    context.beforeUnmarshal(filter, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<ParamValue> initParam = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("filterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Filter.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, filter);
            filter.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final 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
            final 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
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = filter.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("filter-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: filterName
            final String filterNameRaw = elementReader.getElementAsString();
            final String filterName;
            try {
                filterName = Adapters.collapsedStringAdapterAdapter.unmarshal(filterNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            filter.filterName = filterName;
        } else if (("filter-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: filterClass
            final String filterClassRaw = elementReader.getElementAsString();
            final String filterClass;
            try {
                filterClass = Adapters.collapsedStringAdapterAdapter.unmarshal(filterClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            filter.filterClass = filterClass;
        } else if (("async-supported" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: asyncSupported
            final Boolean asyncSupported = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            filter.asyncSupported = asyncSupported;
        } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: initParam
            final ParamValue initParamItem = readParamValue(elementReader, context);
            if (initParam == null) {
                initParam = filter.initParam;
                if (initParam != null) {
                    initParam.clear();
                } else {
                    initParam = new ArrayList<ParamValue>();
                }
            }
            initParam.add(initParamItem);
        } 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", "filter-name"), new QName("http://java.sun.com/xml/ns/javaee", "filter-class"), new QName("http://java.sun.com/xml/ns/javaee", "async-supported"), new QName("http://java.sun.com/xml/ns/javaee", "init-param"));
        }
    }
    if (descriptions != null) {
        try {
            filter.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Filter.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            filter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Filter.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        filter.icon = icon;
    }
    if (initParam != null) {
        filter.initParam = initParam;
    }
    context.afterUnmarshal(filter, LifecycleCallback.NONE);
    return filter;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) ParamValue$JAXB.readParamValue(org.apache.openejb.jee.ParamValue$JAXB.readParamValue) ParamValue$JAXB.writeParamValue(org.apache.openejb.jee.ParamValue$JAXB.writeParamValue) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Aggregations

QName (javax.xml.namespace.QName)190 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)190 Attribute (org.metatype.sxc.util.Attribute)190 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)182 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)116 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)78 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)77 ArrayList (java.util.ArrayList)69 Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)37 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)37 JAXBObject (org.metatype.sxc.jaxb.JAXBObject)18 InjectionTarget$JAXB.readInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget)9 InjectionTarget$JAXB.writeInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget)9 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)7 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)7 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)7 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)7 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)7 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)7 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)7