Java Code Examples for javax.xml.XMLConstants#W3C_XML_SCHEMA_INSTANCE_NS_URI

The following examples show how to use javax.xml.XMLConstants#W3C_XML_SCHEMA_INSTANCE_NS_URI . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InterceptorOrder$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static InterceptorOrder _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final InterceptorOrder interceptorOrder = new InterceptorOrder();
    context.beforeUnmarshal(interceptorOrder, LifecycleCallback.NONE);

    List<String> interceptorClass = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("interceptor-orderType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, InterceptorOrder.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, interceptorOrder);
            interceptorOrder.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 (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: interceptorClass
            final String interceptorClassItemRaw = elementReader.getElementAsString();

            final String interceptorClassItem;
            try {
                interceptorClassItem = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (interceptorClass == null) {
                interceptorClass = interceptorOrder.interceptorClass;
                if (interceptorClass != null) {
                    interceptorClass.clear();
                } else {
                    interceptorClass = new ArrayList<String>();
                }
            }
            interceptorClass.add(interceptorClassItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"));
        }
    }
    if (interceptorClass != null) {
        interceptorOrder.interceptorClass = interceptorClass;
    }

    context.afterUnmarshal(interceptorOrder, LifecycleCallback.NONE);

    return interceptorOrder;
}
 
Example 2
Source File: FacesFactoryExtension$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesFactoryExtension _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesFactoryExtension facesFactoryExtension = new FacesFactoryExtension();
    context.beforeUnmarshal(facesFactoryExtension, LifecycleCallback.NONE);

    List<Object> any = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-factory-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesFactoryExtension.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, facesFactoryExtension);
            facesFactoryExtension.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()) {
        // ELEMENT_REF: any
        if (any == null) {
            any = facesFactoryExtension.any;
            if (any != null) {
                any.clear();
            } else {
                any = new ArrayList<Object>();
            }
        }
        any.add(context.readXmlAny(elementReader, Object.class, true));
    }
    if (any != null) {
        facesFactoryExtension.any = any;
    }

    context.afterUnmarshal(facesFactoryExtension, LifecycleCallback.NONE);

    return facesFactoryExtension;
}
 
Example 3
Source File: ActivationSpec$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static ActivationSpec _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final ActivationSpec activationSpec = new ActivationSpec();
    context.beforeUnmarshal(activationSpec, LifecycleCallback.NONE);

    List<RequiredConfigProperty> requiredConfigProperty = null;
    List<ConfigProperty> configProperty = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("activationspecType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, ActivationSpec.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, activationSpec);
            activationSpec.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 (("activationspec-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: activationSpecClass
            final String activationSpecClassRaw = elementReader.getElementAsString();

            final String activationSpecClass;
            try {
                activationSpecClass = Adapters.collapsedStringAdapterAdapter.unmarshal(activationSpecClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            activationSpec.activationSpecClass = activationSpecClass;
        } else if (("required-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: requiredConfigProperty
            final RequiredConfigProperty requiredConfigPropertyItem = readRequiredConfigProperty(elementReader, context);
            if (requiredConfigProperty == null) {
                requiredConfigProperty = activationSpec.requiredConfigProperty;
                if (requiredConfigProperty != null) {
                    requiredConfigProperty.clear();
                } else {
                    requiredConfigProperty = new ArrayList<RequiredConfigProperty>();
                }
            }
            requiredConfigProperty.add(requiredConfigPropertyItem);
        } else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: configProperty
            final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context);
            if (configProperty == null) {
                configProperty = activationSpec.configProperty;
                if (configProperty != null) {
                    configProperty.clear();
                } else {
                    configProperty = new ArrayList<ConfigProperty>();
                }
            }
            configProperty.add(configPropertyItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "activationspec-class"), new QName("http://java.sun.com/xml/ns/javaee", "required-config-property"), new QName("http://java.sun.com/xml/ns/javaee", "config-property"));
        }
    }
    if (requiredConfigProperty != null) {
        activationSpec.requiredConfigProperty = requiredConfigProperty;
    }
    if (configProperty != null) {
        activationSpec.configProperty = configProperty;
    }

    context.afterUnmarshal(activationSpec, LifecycleCallback.NONE);

    return activationSpec;
}
 
Example 4
Source File: TldExtension$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final TldExtension tldExtension = new TldExtension();
    context.beforeUnmarshal(tldExtension, LifecycleCallback.NONE);

    List<String> extensionElement = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("tld-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, TldExtension.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, tldExtension);
            tldExtension.id = id;
        } else if (("namespace" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: namespace
            tldExtension.namespace = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "namespace"));
        }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("extension-element" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: extensionElement
            final String extensionElementItemRaw = elementReader.getElementAsString();

            final String extensionElementItem;
            try {
                extensionElementItem = Adapters.collapsedStringAdapterAdapter.unmarshal(extensionElementItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (extensionElement == null) {
                extensionElement = tldExtension.extensionElement;
                if (extensionElement != null) {
                    extensionElement.clear();
                } else {
                    extensionElement = new ArrayList<String>();
                }
            }
            extensionElement.add(extensionElementItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "extension-element"));
        }
    }
    if (extensionElement != null) {
        tldExtension.extensionElement = extensionElement;
    }

    context.afterUnmarshal(tldExtension, LifecycleCallback.NONE);

    return tldExtension;
}
 
Example 5
Source File: Relationships$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static Relationships _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final Relationships relationships = new Relationships();
    context.beforeUnmarshal(relationships, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;
    List<EjbRelation> ejbRelation = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("relationshipsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Relationships.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, relationships);
            relationships.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 (("ejb-relation" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: ejbRelation
            final EjbRelation ejbRelationItem = readEjbRelation(elementReader, context);
            if (ejbRelation == null) {
                ejbRelation = relationships.ejbRelation;
                if (ejbRelation != null) {
                    ejbRelation.clear();
                } else {
                    ejbRelation = new ArrayList<EjbRelation>();
                }
            }
            ejbRelation.add(ejbRelationItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relation"));
        }
    }
    if (descriptions != null) {
        try {
            relationships.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Relationships.class, "setDescriptions", Text[].class, e);
        }
    }
    if (ejbRelation != null) {
        relationships.ejbRelation = ejbRelation;
    }

    context.afterUnmarshal(relationships, LifecycleCallback.NONE);

    return relationships;
}
 
Example 6
Source File: FacesPropertyExtension$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesPropertyExtension _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesPropertyExtension facesPropertyExtension = new FacesPropertyExtension();
    context.beforeUnmarshal(facesPropertyExtension, LifecycleCallback.NONE);

    List<Object> any = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-property-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesPropertyExtension.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, facesPropertyExtension);
            facesPropertyExtension.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()) {
        // ELEMENT_REF: any
        if (any == null) {
            any = facesPropertyExtension.any;
            if (any != null) {
                any.clear();
            } else {
                any = new ArrayList<Object>();
            }
        }
        any.add(context.readXmlAny(elementReader, Object.class, true));
    }
    if (any != null) {
        facesPropertyExtension.any = any;
    }

    context.afterUnmarshal(facesPropertyExtension, LifecycleCallback.NONE);

    return facesPropertyExtension;
}
 
Example 7
Source File: FacesNullValue$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesNullValue _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesNullValue facesNullValue = new FacesNullValue();
    context.beforeUnmarshal(facesNullValue, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-null-valueType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesNullValue.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, facesNullValue);
            facesNullValue.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()) {
        context.unexpectedElement(elementReader);
    }

    context.afterUnmarshal(facesNullValue, LifecycleCallback.NONE);

    return facesNullValue;
}
 
Example 8
Source File: SessionConfig$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static SessionConfig _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final SessionConfig sessionConfig = new SessionConfig();
    context.beforeUnmarshal(sessionConfig, LifecycleCallback.NONE);

    List<TrackingMode> trackingMode = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("session-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, SessionConfig.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, sessionConfig);
            sessionConfig.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 (("session-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: sessionTimeout
            final Integer sessionTimeout = Integer.valueOf(elementReader.getElementAsString());
            sessionConfig.sessionTimeout = sessionTimeout;
        } else if (("cookie-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: cookieConfig
            final CookieConfig cookieConfig = readCookieConfig(elementReader, context);
            sessionConfig.cookieConfig = cookieConfig;
        } else if (("tracking-mode" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: trackingMode
            final TrackingMode trackingModeItem = parseTrackingMode(elementReader, context, elementReader.getElementAsString());
            if (trackingMode == null) {
                trackingMode = sessionConfig.trackingMode;
                if (trackingMode != null) {
                    trackingMode.clear();
                } else {
                    trackingMode = new ArrayList<TrackingMode>();
                }
            }
            trackingMode.add(trackingModeItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "session-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "cookie-config"), new QName("http://java.sun.com/xml/ns/javaee", "tracking-mode"));
        }
    }
    if (trackingMode != null) {
        sessionConfig.trackingMode = trackingMode;
    }

    context.afterUnmarshal(sessionConfig, LifecycleCallback.NONE);

    return sessionConfig;
}
 
Example 9
Source File: FacesOrderingOrdering$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesOrderingOrdering _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesOrderingOrdering facesOrderingOrdering = new FacesOrderingOrdering();
    context.beforeUnmarshal(facesOrderingOrdering, LifecycleCallback.NONE);

    List<String> name = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-ordering-orderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesOrderingOrdering.class);
        }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute);
        }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: name
            String nameItemRaw = null;
            if (!elementReader.isXsiNil()) {
                nameItemRaw = elementReader.getElementAsString();
            }

            final String nameItem;
            try {
                nameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(nameItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (name == null) {
                name = facesOrderingOrdering.name;
                if (name != null) {
                    name.clear();
                } else {
                    name = new ArrayList<String>();
                }
            }
            name.add(nameItem);
        } else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: others
            final FacesOrderingOthers others = readFacesOrderingOthers(elementReader, context);
            facesOrderingOrdering.others = others;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others"));
        }
    }
    if (name != null) {
        facesOrderingOrdering.name = name;
    }

    context.afterUnmarshal(facesOrderingOrdering, LifecycleCallback.NONE);

    return facesOrderingOrdering;
}
 
Example 10
Source File: FacesLocale$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesLocale _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesLocale facesLocale = new FacesLocale();
    context.beforeUnmarshal(facesLocale, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-localeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesLocale.class);
        }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute);
        }
    }

    // VALUE: value
    final String valueRaw = reader.getElementText();

    String value = null;
    boolean valueConverted;
    try {
        value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
        valueConverted = true;
    } catch (final Exception e) {
        context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e);
        valueConverted = false;
    }

    if (valueConverted) {
        facesLocale.value = value;
    }

    context.afterUnmarshal(facesLocale, LifecycleCallback.NONE);

    return facesLocale;
}
 
Example 11
Source File: UnlimitedInteger.java    From sis with Apache License 2.0 4 votes vote down vote up
/**
 * Returns whether the value should be considered unspecified. An infinite value is considered nil.
 * This method never returns {@code false}; if the value is not nil, then {@code null} is returned.
 */
@XmlAttribute(name = "nil", namespace = XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI)
private Boolean getNil() {
    return (value == null) ? Boolean.TRUE : null;
}
 
Example 12
Source File: FacesAbsoluteOrdering$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesAbsoluteOrdering _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesAbsoluteOrdering facesAbsoluteOrdering = new FacesAbsoluteOrdering();
    context.beforeUnmarshal(facesAbsoluteOrdering, LifecycleCallback.NONE);

    List<Object> nameOrOthers = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-absoluteOrderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesAbsoluteOrdering.class);
        }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute);
        }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: nameOrOthers
            final org.apache.openejb.jee.FacesOrderingOthers nameOrOthersItem = readFacesOrderingOthers(elementReader, context);
            if (nameOrOthers == null) {
                nameOrOthers = facesAbsoluteOrdering.nameOrOthers;
                if (nameOrOthers != null) {
                    nameOrOthers.clear();
                } else {
                    nameOrOthers = new ArrayList<Object>();
                }
            }
            nameOrOthers.add(nameOrOthersItem);
        } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: nameOrOthers
            final java.lang.String nameOrOthersItem1 = elementReader.getElementAsString();
            if (nameOrOthers == null) {
                nameOrOthers = facesAbsoluteOrdering.nameOrOthers;
                if (nameOrOthers != null) {
                    nameOrOthers.clear();
                } else {
                    nameOrOthers = new ArrayList<Object>();
                }
            }
            nameOrOthers.add(nameOrOthersItem1);
        } else {
            // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it
            // TODO: handle it properly
            // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "others"), new QName("http://java.sun.com/xml/ns/javaee", "name"));
        }
    }
    if (nameOrOthers != null) {
        facesAbsoluteOrdering.nameOrOthers = nameOrOthers;
    }

    context.afterUnmarshal(facesAbsoluteOrdering, LifecycleCallback.NONE);

    return facesAbsoluteOrdering;
}
 
Example 13
Source File: Timeout$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static Timeout _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final Timeout timeout = new Timeout();
    context.beforeUnmarshal(timeout, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("access-timeoutType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Timeout.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, timeout);
            timeout.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 (("timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: timeout
            final Long timeout1 = Long.valueOf(elementReader.getElementAsString());
            timeout.timeout = timeout1;
        } else if (("unit" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: unit
            final String unitRaw = elementReader.getElementAsString();

            final TimeUnit unit;
            try {
                unit = Adapters.timeUnitAdapterAdapter.unmarshal(unitRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, TimeUnitAdapter.class, TimeUnit.class, TimeUnit.class, e);
                continue;
            }

            if (unit != null) {
                timeout.unit = unit;
            }
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "timeout"), new QName("http://java.sun.com/xml/ns/javaee", "unit"));
        }
    }

    context.afterUnmarshal(timeout, LifecycleCallback.NONE);

    return timeout;
}
 
Example 14
Source File: MethodParams$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final MethodParams methodParams = new MethodParams();
    context.beforeUnmarshal(methodParams, LifecycleCallback.NONE);

    List<String> methodParam = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("method-paramsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, MethodParams.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, methodParams);
            methodParams.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 (("method-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: methodParam
            final String methodParamItemRaw = elementReader.getElementAsString();

            final String methodParamItem;
            try {
                methodParamItem = Adapters.collapsedStringAdapterAdapter.unmarshal(methodParamItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (methodParam == null) {
                methodParam = methodParams.methodParam;
                if (methodParam != null) {
                    methodParam.clear();
                } else {
                    methodParam = new ArrayList<String>();
                }
            }
            methodParam.add(methodParamItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-param"));
        }
    }
    if (methodParam != null) {
        methodParams.methodParam = methodParam;
    }

    context.afterUnmarshal(methodParams, LifecycleCallback.NONE);

    return methodParams;
}
 
Example 15
Source File: QueryMethod$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static QueryMethod _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final QueryMethod queryMethod = new QueryMethod();
    context.beforeUnmarshal(queryMethod, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("query-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, QueryMethod.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, queryMethod);
            queryMethod.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 (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: methodName
            final String methodNameRaw = elementReader.getElementAsString();

            final String methodName;
            try {
                methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            queryMethod.methodName = methodName;
        } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: methodParams
            final MethodParams methodParams = readMethodParams(elementReader, context);
            queryMethod.methodParams = methodParams;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params"));
        }
    }

    context.afterUnmarshal(queryMethod, LifecycleCallback.NONE);

    return queryMethod;
}
 
Example 16
Source File: Empty$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static Empty _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final Empty empty = new Empty();
    context.beforeUnmarshal(empty, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("emptyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Empty.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, empty);
            empty.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()) {
        context.unexpectedElement(elementReader);
    }

    context.afterUnmarshal(empty, LifecycleCallback.NONE);

    return empty;
}
 
Example 17
Source File: DestinationType$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static DestinationType _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final DestinationType destinationType = new DestinationType();
    context.beforeUnmarshal(destinationType, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        return context.unexpectedXsiType(reader, DestinationType.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, destinationType);
            destinationType.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }

    // VALUE: value
    final String valueRaw = reader.getElementText();

    String value = null;
    boolean valueConverted;
    try {
        value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
        valueConverted = true;
    } catch (final Exception e) {
        context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e);
        valueConverted = false;
    }

    if (valueConverted) {
        destinationType.value = value;
    }

    context.afterUnmarshal(destinationType, LifecycleCallback.NONE);

    return destinationType;
}
 
Example 18
Source File: InboundResourceadapter$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static InboundResourceadapter _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final InboundResourceadapter inboundResourceadapter = new InboundResourceadapter();
    context.beforeUnmarshal(inboundResourceadapter, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("inbound-resourceadapterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, InboundResourceadapter.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, inboundResourceadapter);
            inboundResourceadapter.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 (("messageadapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageAdapter
            final MessageAdapter messageAdapter = readMessageAdapter(elementReader, context);
            inboundResourceadapter.messageAdapter = messageAdapter;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messageadapter"));
        }
    }

    context.afterUnmarshal(inboundResourceadapter, LifecycleCallback.NONE);

    return inboundResourceadapter;
}
 
Example 19
Source File: Addressing$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static Addressing _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final Addressing addressing = new Addressing();
    context.beforeUnmarshal(addressing, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("addressingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Addressing.class);
        }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute);
        }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("enabled" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: enabled
            addressing.enabled = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
        } else if (("required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: required
            addressing.required = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
        } else if (("responses" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: responses
            final AddressingResponses responses = parseAddressingResponses(elementReader, context, elementReader.getElementAsString());
            if (responses != null) {
                addressing.responses = responses;
            }
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "enabled"), new QName("http://java.sun.com/xml/ns/javaee", "required"), new QName("http://java.sun.com/xml/ns/javaee", "responses"));
        }
    }

    context.afterUnmarshal(addressing, LifecycleCallback.NONE);

    return addressing;
}
 
Example 20
Source File: FacesExtension$JAXB.java    From tomee with Apache License 2.0 4 votes vote down vote up
public final static FacesExtension _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesExtension facesExtension = new FacesExtension();
    context.beforeUnmarshal(facesExtension, LifecycleCallback.NONE);

    List<Object> any = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesExtension.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, facesExtension);
            facesExtension.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()) {
        // ELEMENT_REF: any
        if (any == null) {
            any = facesExtension.any;
            if (any != null) {
                any.clear();
            } else {
                any = new ArrayList<Object>();
            }
        }
        any.add(context.readXmlAny(elementReader, Object.class, true));
    }
    if (any != null) {
        facesExtension.any = any;
    }

    context.afterUnmarshal(facesExtension, LifecycleCallback.NONE);

    return facesExtension;
}