Search in sources :

Example 21 with Attribute

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

the class JavaWsdlMapping$JAXB method _read.

public static final JavaWsdlMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
    context.beforeUnmarshal(javaWsdlMapping, LifecycleCallback.NONE);
    KeyedCollection<String, PackageMapping> packageMapping = null;
    List<JavaXmlTypeMapping> javaXmlTypeMapping = null;
    KeyedCollection<QName, ExceptionMapping> exceptionMapping = null;
    List<ServiceInterfaceMapping> serviceInterfaceMapping = null;
    KeyedCollection<String, ServiceEndpointInterfaceMapping> serviceEndpointInterfaceMapping = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("java-wsdl-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, JavaWsdlMapping.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, javaWsdlMapping);
            javaWsdlMapping.id = id;
        } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: version
            javaWsdlMapping.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("package-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: packageMapping
            final PackageMapping packageMappingItem = readPackageMapping(elementReader, context);
            if (packageMapping == null) {
                packageMapping = javaWsdlMapping.packageMapping;
                if (packageMapping != null) {
                    packageMapping.clear();
                } else {
                    packageMapping = new KeyedCollection<String, PackageMapping>();
                }
            }
            packageMapping.add(packageMappingItem);
        } else if (("java-xml-type-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: javaXmlTypeMapping
            final JavaXmlTypeMapping javaXmlTypeMappingItem = readJavaXmlTypeMapping(elementReader, context);
            if (javaXmlTypeMapping == null) {
                javaXmlTypeMapping = javaWsdlMapping.javaXmlTypeMapping;
                if (javaXmlTypeMapping != null) {
                    javaXmlTypeMapping.clear();
                } else {
                    javaXmlTypeMapping = new ArrayList<JavaXmlTypeMapping>();
                }
            }
            javaXmlTypeMapping.add(javaXmlTypeMappingItem);
        } else if (("exception-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: exceptionMapping
            final ExceptionMapping exceptionMappingItem = readExceptionMapping(elementReader, context);
            if (exceptionMapping == null) {
                exceptionMapping = javaWsdlMapping.exceptionMapping;
                if (exceptionMapping != null) {
                    exceptionMapping.clear();
                } else {
                    exceptionMapping = new KeyedCollection<QName, ExceptionMapping>();
                }
            }
            exceptionMapping.add(exceptionMappingItem);
        } else if (("service-interface-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serviceInterfaceMapping
            final ServiceInterfaceMapping serviceInterfaceMappingItem = readServiceInterfaceMapping(elementReader, context);
            if (serviceInterfaceMapping == null) {
                serviceInterfaceMapping = javaWsdlMapping.serviceInterfaceMapping;
                if (serviceInterfaceMapping != null) {
                    serviceInterfaceMapping.clear();
                } else {
                    serviceInterfaceMapping = new ArrayList<ServiceInterfaceMapping>();
                }
            }
            serviceInterfaceMapping.add(serviceInterfaceMappingItem);
        } else if (("service-endpoint-interface-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serviceEndpointInterfaceMapping
            final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMappingItem = readServiceEndpointInterfaceMapping(elementReader, context);
            if (serviceEndpointInterfaceMapping == null) {
                serviceEndpointInterfaceMapping = javaWsdlMapping.serviceEndpointInterfaceMapping;
                if (serviceEndpointInterfaceMapping != null) {
                    serviceEndpointInterfaceMapping.clear();
                } else {
                    serviceEndpointInterfaceMapping = new KeyedCollection<String, ServiceEndpointInterfaceMapping>();
                }
            }
            serviceEndpointInterfaceMapping.add(serviceEndpointInterfaceMappingItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "package-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "java-xml-type-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "exception-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "service-interface-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface-mapping"));
        }
    }
    if (packageMapping != null) {
        javaWsdlMapping.packageMapping = packageMapping;
    }
    if (javaXmlTypeMapping != null) {
        javaWsdlMapping.javaXmlTypeMapping = javaXmlTypeMapping;
    }
    if (exceptionMapping != null) {
        javaWsdlMapping.exceptionMapping = exceptionMapping;
    }
    if (serviceInterfaceMapping != null) {
        javaWsdlMapping.serviceInterfaceMapping = serviceInterfaceMapping;
    }
    if (serviceEndpointInterfaceMapping != null) {
        javaWsdlMapping.serviceEndpointInterfaceMapping = serviceEndpointInterfaceMapping;
    }
    context.afterUnmarshal(javaWsdlMapping, LifecycleCallback.NONE);
    return javaWsdlMapping;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) JavaXmlTypeMapping$JAXB.readJavaXmlTypeMapping(org.apache.openejb.jee.JavaXmlTypeMapping$JAXB.readJavaXmlTypeMapping) JavaXmlTypeMapping$JAXB.writeJavaXmlTypeMapping(org.apache.openejb.jee.JavaXmlTypeMapping$JAXB.writeJavaXmlTypeMapping) ExceptionMapping$JAXB.readExceptionMapping(org.apache.openejb.jee.ExceptionMapping$JAXB.readExceptionMapping) ExceptionMapping$JAXB.writeExceptionMapping(org.apache.openejb.jee.ExceptionMapping$JAXB.writeExceptionMapping) ServiceEndpointInterfaceMapping$JAXB.writeServiceEndpointInterfaceMapping(org.apache.openejb.jee.ServiceEndpointInterfaceMapping$JAXB.writeServiceEndpointInterfaceMapping) ServiceEndpointInterfaceMapping$JAXB.readServiceEndpointInterfaceMapping(org.apache.openejb.jee.ServiceEndpointInterfaceMapping$JAXB.readServiceEndpointInterfaceMapping) ServiceInterfaceMapping$JAXB.readServiceInterfaceMapping(org.apache.openejb.jee.ServiceInterfaceMapping$JAXB.readServiceInterfaceMapping) ServiceInterfaceMapping$JAXB.writeServiceInterfaceMapping(org.apache.openejb.jee.ServiceInterfaceMapping$JAXB.writeServiceInterfaceMapping) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) PackageMapping$JAXB.readPackageMapping(org.apache.openejb.jee.PackageMapping$JAXB.readPackageMapping) PackageMapping$JAXB.writePackageMapping(org.apache.openejb.jee.PackageMapping$JAXB.writePackageMapping) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 22 with Attribute

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

the class JavaXmlTypeMapping$JAXB method _read.

public static final JavaXmlTypeMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final JavaXmlTypeMapping javaXmlTypeMapping = new JavaXmlTypeMapping();
    context.beforeUnmarshal(javaXmlTypeMapping, LifecycleCallback.NONE);
    List<VariableMapping> variableMapping = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("java-xml-type-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, JavaXmlTypeMapping.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, javaXmlTypeMapping);
            javaXmlTypeMapping.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 (("java-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: javaType
            final String javaTypeRaw = elementReader.getElementAsString();
            final String javaType;
            try {
                javaType = Adapters.collapsedStringAdapterAdapter.unmarshal(javaTypeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            javaXmlTypeMapping.javaType = javaType;
        } else if (("root-type-qname" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: rootTypeQname
            final QName rootTypeQname = elementReader.getElementAsQName();
            javaXmlTypeMapping.rootTypeQname = rootTypeQname;
        } else if (("anonymous-type-qname" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: anonymousTypeQname
            final String anonymousTypeQnameRaw = elementReader.getElementAsString();
            final String anonymousTypeQname;
            try {
                anonymousTypeQname = Adapters.collapsedStringAdapterAdapter.unmarshal(anonymousTypeQnameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            javaXmlTypeMapping.anonymousTypeQname = anonymousTypeQname;
        } else if (("qname-scope" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: qnameScope
            final String qnameScopeRaw = elementReader.getElementAsString();
            final String qnameScope;
            try {
                qnameScope = Adapters.collapsedStringAdapterAdapter.unmarshal(qnameScopeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            javaXmlTypeMapping.qnameScope = qnameScope;
        } else if (("variable-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: variableMapping
            final VariableMapping variableMappingItem = readVariableMapping(elementReader, context);
            if (variableMapping == null) {
                variableMapping = javaXmlTypeMapping.variableMapping;
                if (variableMapping != null) {
                    variableMapping.clear();
                } else {
                    variableMapping = new ArrayList<VariableMapping>();
                }
            }
            variableMapping.add(variableMappingItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "java-type"), new QName("http://java.sun.com/xml/ns/javaee", "root-type-qname"), new QName("http://java.sun.com/xml/ns/javaee", "anonymous-type-qname"), new QName("http://java.sun.com/xml/ns/javaee", "qname-scope"), new QName("http://java.sun.com/xml/ns/javaee", "variable-mapping"));
        }
    }
    if (variableMapping != null) {
        javaXmlTypeMapping.variableMapping = variableMapping;
    }
    context.afterUnmarshal(javaXmlTypeMapping, LifecycleCallback.NONE);
    return javaXmlTypeMapping;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) VariableMapping$JAXB.readVariableMapping(org.apache.openejb.jee.VariableMapping$JAXB.readVariableMapping) VariableMapping$JAXB.writeVariableMapping(org.apache.openejb.jee.VariableMapping$JAXB.writeVariableMapping) QName(javax.xml.namespace.QName) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 23 with Attribute

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

the class JspConfig$JAXB method _read.

public static final JspConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final JspConfig jspConfig = new JspConfig();
    context.beforeUnmarshal(jspConfig, LifecycleCallback.NONE);
    List<Taglib> taglib = null;
    List<JspPropertyGroup> jspPropertyGroup = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("jsp-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, JspConfig.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, jspConfig);
            jspConfig.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 (("taglib" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: taglib
            final Taglib taglibItem = readTaglib(elementReader, context);
            if (taglib == null) {
                taglib = jspConfig.taglib;
                if (taglib != null) {
                    taglib.clear();
                } else {
                    taglib = new ArrayList<Taglib>();
                }
            }
            taglib.add(taglibItem);
        } else if (("jsp-property-group" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: jspPropertyGroup
            final JspPropertyGroup jspPropertyGroupItem = readJspPropertyGroup(elementReader, context);
            if (jspPropertyGroup == null) {
                jspPropertyGroup = jspConfig.jspPropertyGroup;
                if (jspPropertyGroup != null) {
                    jspPropertyGroup.clear();
                } else {
                    jspPropertyGroup = new ArrayList<JspPropertyGroup>();
                }
            }
            jspPropertyGroup.add(jspPropertyGroupItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "taglib"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-property-group"));
        }
    }
    if (taglib != null) {
        jspConfig.taglib = taglib;
    }
    if (jspPropertyGroup != null) {
        jspConfig.jspPropertyGroup = jspPropertyGroup;
    }
    context.afterUnmarshal(jspConfig, LifecycleCallback.NONE);
    return jspConfig;
}
Also used : Taglib$JAXB.writeTaglib(org.apache.openejb.jee.Taglib$JAXB.writeTaglib) Taglib$JAXB.readTaglib(org.apache.openejb.jee.Taglib$JAXB.readTaglib) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) JspPropertyGroup$JAXB.readJspPropertyGroup(org.apache.openejb.jee.JspPropertyGroup$JAXB.readJspPropertyGroup) JspPropertyGroup$JAXB.writeJspPropertyGroup(org.apache.openejb.jee.JspPropertyGroup$JAXB.writeJspPropertyGroup) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 24 with Attribute

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

the class FacesFacetExtension$JAXB method _read.

public static final FacesFacetExtension _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesFacetExtension facesFacetExtension = new FacesFacetExtension();
    context.beforeUnmarshal(facesFacetExtension, LifecycleCallback.NONE);
    List<Object> any = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-facet-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesFacetExtension.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, facesFacetExtension);
            facesFacetExtension.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 = facesFacetExtension.any;
            if (any != null) {
                any.clear();
            } else {
                any = new ArrayList<Object>();
            }
        }
        any.add(context.readXmlAny(elementReader, Object.class, true));
    }
    if (any != null) {
        facesFacetExtension.any = any;
    }
    context.afterUnmarshal(facesFacetExtension, LifecycleCallback.NONE);
    return facesFacetExtension;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) JAXBObject(org.metatype.sxc.jaxb.JAXBObject) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 25 with Attribute

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

the class FacesFactory$JAXB method _read.

public static final FacesFactory _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesFactory facesFactory = new FacesFactory();
    context.beforeUnmarshal(facesFactory, LifecycleCallback.NONE);
    List<String> applicationFactory = null;
    List<String> exceptionHandlerFactory = null;
    List<String> externalContextFactory = null;
    List<String> facesContextFactory = null;
    List<String> partialViewContextFactory = null;
    List<String> lifecycleFactory = null;
    List<String> viewDeclarationLanguageFactory = null;
    List<String> tagHandlerDelegateFactory = null;
    List<String> renderKitFactory = null;
    List<String> visitContextFactory = null;
    List<FacesFactoryExtension> factoryExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-factoryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesFactory.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, facesFactory);
            facesFactory.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 (("application-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: applicationFactory
            final String applicationFactoryItemRaw = elementReader.getElementAsString();
            final String applicationFactoryItem;
            try {
                applicationFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(applicationFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (applicationFactory == null) {
                applicationFactory = facesFactory.applicationFactory;
                if (applicationFactory != null) {
                    applicationFactory.clear();
                } else {
                    applicationFactory = new ArrayList<String>();
                }
            }
            applicationFactory.add(applicationFactoryItem);
        } else if (("exception-handler-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: exceptionHandlerFactory
            final String exceptionHandlerFactoryItemRaw = elementReader.getElementAsString();
            final String exceptionHandlerFactoryItem;
            try {
                exceptionHandlerFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(exceptionHandlerFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (exceptionHandlerFactory == null) {
                exceptionHandlerFactory = facesFactory.exceptionHandlerFactory;
                if (exceptionHandlerFactory != null) {
                    exceptionHandlerFactory.clear();
                } else {
                    exceptionHandlerFactory = new ArrayList<String>();
                }
            }
            exceptionHandlerFactory.add(exceptionHandlerFactoryItem);
        } else if (("external-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: externalContextFactory
            final String externalContextFactoryItemRaw = elementReader.getElementAsString();
            final String externalContextFactoryItem;
            try {
                externalContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(externalContextFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (externalContextFactory == null) {
                externalContextFactory = facesFactory.externalContextFactory;
                if (externalContextFactory != null) {
                    externalContextFactory.clear();
                } else {
                    externalContextFactory = new ArrayList<String>();
                }
            }
            externalContextFactory.add(externalContextFactoryItem);
        } else if (("faces-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: facesContextFactory
            final String facesContextFactoryItemRaw = elementReader.getElementAsString();
            final String facesContextFactoryItem;
            try {
                facesContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(facesContextFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (facesContextFactory == null) {
                facesContextFactory = facesFactory.facesContextFactory;
                if (facesContextFactory != null) {
                    facesContextFactory.clear();
                } else {
                    facesContextFactory = new ArrayList<String>();
                }
            }
            facesContextFactory.add(facesContextFactoryItem);
        } else if (("partial-view-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: partialViewContextFactory
            final String partialViewContextFactoryItemRaw = elementReader.getElementAsString();
            final String partialViewContextFactoryItem;
            try {
                partialViewContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(partialViewContextFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (partialViewContextFactory == null) {
                partialViewContextFactory = facesFactory.partialViewContextFactory;
                if (partialViewContextFactory != null) {
                    partialViewContextFactory.clear();
                } else {
                    partialViewContextFactory = new ArrayList<String>();
                }
            }
            partialViewContextFactory.add(partialViewContextFactoryItem);
        } else if (("lifecycle-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: lifecycleFactory
            final String lifecycleFactoryItemRaw = elementReader.getElementAsString();
            final String lifecycleFactoryItem;
            try {
                lifecycleFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (lifecycleFactory == null) {
                lifecycleFactory = facesFactory.lifecycleFactory;
                if (lifecycleFactory != null) {
                    lifecycleFactory.clear();
                } else {
                    lifecycleFactory = new ArrayList<String>();
                }
            }
            lifecycleFactory.add(lifecycleFactoryItem);
        } else if (("view-declaration-language-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: viewDeclarationLanguageFactory
            final String viewDeclarationLanguageFactoryItemRaw = elementReader.getElementAsString();
            final String viewDeclarationLanguageFactoryItem;
            try {
                viewDeclarationLanguageFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(viewDeclarationLanguageFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (viewDeclarationLanguageFactory == null) {
                viewDeclarationLanguageFactory = facesFactory.viewDeclarationLanguageFactory;
                if (viewDeclarationLanguageFactory != null) {
                    viewDeclarationLanguageFactory.clear();
                } else {
                    viewDeclarationLanguageFactory = new ArrayList<String>();
                }
            }
            viewDeclarationLanguageFactory.add(viewDeclarationLanguageFactoryItem);
        } else if (("tag-handler-delegate-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: tagHandlerDelegateFactory
            final String tagHandlerDelegateFactoryItemRaw = elementReader.getElementAsString();
            final String tagHandlerDelegateFactoryItem;
            try {
                tagHandlerDelegateFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(tagHandlerDelegateFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (tagHandlerDelegateFactory == null) {
                tagHandlerDelegateFactory = facesFactory.tagHandlerDelegateFactory;
                if (tagHandlerDelegateFactory != null) {
                    tagHandlerDelegateFactory.clear();
                } else {
                    tagHandlerDelegateFactory = new ArrayList<String>();
                }
            }
            tagHandlerDelegateFactory.add(tagHandlerDelegateFactoryItem);
        } else if (("render-kit-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: renderKitFactory
            final String renderKitFactoryItemRaw = elementReader.getElementAsString();
            final String renderKitFactoryItem;
            try {
                renderKitFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(renderKitFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (renderKitFactory == null) {
                renderKitFactory = facesFactory.renderKitFactory;
                if (renderKitFactory != null) {
                    renderKitFactory.clear();
                } else {
                    renderKitFactory = new ArrayList<String>();
                }
            }
            renderKitFactory.add(renderKitFactoryItem);
        } else if (("visit-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: visitContextFactory
            final String visitContextFactoryItemRaw = elementReader.getElementAsString();
            final String visitContextFactoryItem;
            try {
                visitContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(visitContextFactoryItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (visitContextFactory == null) {
                visitContextFactory = facesFactory.visitContextFactory;
                if (visitContextFactory != null) {
                    visitContextFactory.clear();
                } else {
                    visitContextFactory = new ArrayList<String>();
                }
            }
            visitContextFactory.add(visitContextFactoryItem);
        } else if (("factory-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: factoryExtension
            final FacesFactoryExtension factoryExtensionItem = readFacesFactoryExtension(elementReader, context);
            if (factoryExtension == null) {
                factoryExtension = facesFactory.factoryExtension;
                if (factoryExtension != null) {
                    factoryExtension.clear();
                } else {
                    factoryExtension = new ArrayList<FacesFactoryExtension>();
                }
            }
            factoryExtension.add(factoryExtensionItem);
        } 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", "application-factory"), new QName("http://java.sun.com/xml/ns/javaee", "exception-handler-factory"), new QName("http://java.sun.com/xml/ns/javaee", "external-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "faces-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "partial-view-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-factory"), new QName("http://java.sun.com/xml/ns/javaee", "view-declaration-language-factory"), new QName("http://java.sun.com/xml/ns/javaee", "tag-handler-delegate-factory"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-factory"), new QName("http://java.sun.com/xml/ns/javaee", "visit-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "factory-extension"));
        }
    }
    if (applicationFactory != null) {
        facesFactory.applicationFactory = applicationFactory;
    }
    if (exceptionHandlerFactory != null) {
        facesFactory.exceptionHandlerFactory = exceptionHandlerFactory;
    }
    if (externalContextFactory != null) {
        facesFactory.externalContextFactory = externalContextFactory;
    }
    if (facesContextFactory != null) {
        facesFactory.facesContextFactory = facesContextFactory;
    }
    if (partialViewContextFactory != null) {
        facesFactory.partialViewContextFactory = partialViewContextFactory;
    }
    if (lifecycleFactory != null) {
        facesFactory.lifecycleFactory = lifecycleFactory;
    }
    if (viewDeclarationLanguageFactory != null) {
        facesFactory.viewDeclarationLanguageFactory = viewDeclarationLanguageFactory;
    }
    if (tagHandlerDelegateFactory != null) {
        facesFactory.tagHandlerDelegateFactory = tagHandlerDelegateFactory;
    }
    if (renderKitFactory != null) {
        facesFactory.renderKitFactory = renderKitFactory;
    }
    if (visitContextFactory != null) {
        facesFactory.visitContextFactory = visitContextFactory;
    }
    if (factoryExtension != null) {
        facesFactory.factoryExtension = factoryExtension;
    }
    context.afterUnmarshal(facesFactory, LifecycleCallback.NONE);
    return facesFactory;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) FacesFactoryExtension$JAXB.writeFacesFactoryExtension(org.apache.openejb.jee.FacesFactoryExtension$JAXB.writeFacesFactoryExtension) FacesFactoryExtension$JAXB.readFacesFactoryExtension(org.apache.openejb.jee.FacesFactoryExtension$JAXB.readFacesFactoryExtension) 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