Search in sources :

Example 16 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesValidator$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesValidator facesValidator, RuntimeContext context) throws Exception {
    if (facesValidator == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (FacesValidator.class != facesValidator.getClass()) {
        context.unexpectedSubclass(writer, facesValidator, FacesValidator.class);
        return;
    }
    context.beforeMarshal(facesValidator, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesValidator.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesValidator, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = facesValidator.getDescriptions();
    } catch (final Exception e) {
        context.getterError(facesValidator, "descriptions", FacesValidator.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesValidator, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = facesValidator.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(facesValidator, "displayNames", FacesValidator.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesValidator, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = facesValidator.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesValidator, "icon");
            }
        }
    }
    // ELEMENT: validatorId
    final String validatorIdRaw = facesValidator.validatorId;
    String validatorId = null;
    try {
        validatorId = Adapters.collapsedStringAdapterAdapter.marshal(validatorIdRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesValidator, "validatorId", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (validatorId != null) {
        writer.writeStartElement(prefix, "validator-id", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(validatorId);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(facesValidator, "validatorId");
    }
    // ELEMENT: validatorClass
    final String validatorClassRaw = facesValidator.validatorClass;
    String validatorClass = null;
    try {
        validatorClass = Adapters.collapsedStringAdapterAdapter.marshal(validatorClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesValidator, "validatorClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (validatorClass != null) {
        writer.writeStartElement(prefix, "validator-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(validatorClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(facesValidator, "validatorClass");
    }
    // ELEMENT: attribute
    final List<FacesAttribute> attribute = facesValidator.attribute;
    if (attribute != null) {
        for (final FacesAttribute attributeItem : attribute) {
            writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee");
            if (attributeItem != null) {
                writeFacesAttribute(writer, attributeItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: property
    final List<FacesProperty> property = facesValidator.property;
    if (property != null) {
        for (final FacesProperty propertyItem : property) {
            writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee");
            if (propertyItem != null) {
                writeFacesProperty(writer, propertyItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: validatorExtension
    final List<FacesValidatorExtension> validatorExtension = facesValidator.validatorExtension;
    if (validatorExtension != null) {
        for (final FacesValidatorExtension validatorExtensionItem : validatorExtension) {
            if (validatorExtensionItem != null) {
                writer.writeStartElement(prefix, "validator-extension", "http://java.sun.com/xml/ns/javaee");
                writeFacesValidatorExtension(writer, validatorExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(facesValidator, LifecycleCallback.NONE);
}
Also used : FacesValidatorExtension$JAXB.readFacesValidatorExtension(org.apache.openejb.jee.FacesValidatorExtension$JAXB.readFacesValidatorExtension) FacesValidatorExtension$JAXB.writeFacesValidatorExtension(org.apache.openejb.jee.FacesValidatorExtension$JAXB.writeFacesValidatorExtension) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesAttribute$JAXB.readFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute) FacesAttribute$JAXB.writeFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute) 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) FacesProperty$JAXB.readFacesProperty(org.apache.openejb.jee.FacesProperty$JAXB.readFacesProperty) FacesProperty$JAXB.writeFacesProperty(org.apache.openejb.jee.FacesProperty$JAXB.writeFacesProperty)

Example 17 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesFacet$JAXB method _read.

public static final FacesFacet _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesFacet facesFacet = new FacesFacet();
    context.beforeUnmarshal(facesFacet, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<FacesFacetExtension> facetExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-facetType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesFacet.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, facesFacet);
            facesFacet.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 = facesFacet.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("facet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: facetName
            final String facetNameRaw = elementReader.getElementAsString();
            final String facetName;
            try {
                facetName = Adapters.collapsedStringAdapterAdapter.unmarshal(facetNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesFacet.facetName = facetName;
        } else if (("facet-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: facetExtension
            final FacesFacetExtension facetExtensionItem = readFacesFacetExtension(elementReader, context);
            if (facetExtension == null) {
                facetExtension = facesFacet.facetExtension;
                if (facetExtension != null) {
                    facetExtension.clear();
                } else {
                    facetExtension = new ArrayList<FacesFacetExtension>();
                }
            }
            facetExtension.add(facetExtensionItem);
        } 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", "facet-name"), new QName("http://java.sun.com/xml/ns/javaee", "facet-extension"));
        }
    }
    if (descriptions != null) {
        try {
            facesFacet.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesFacet.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            facesFacet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesFacet.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        facesFacet.icon = icon;
    }
    if (facetExtension != null) {
        facesFacet.facetExtension = facetExtension;
    }
    context.afterUnmarshal(facesFacet, LifecycleCallback.NONE);
    return facesFacet;
}
Also used : FacesFacetExtension$JAXB.readFacesFacetExtension(org.apache.openejb.jee.FacesFacetExtension$JAXB.readFacesFacetExtension) FacesFacetExtension$JAXB.writeFacesFacetExtension(org.apache.openejb.jee.FacesFacetExtension$JAXB.writeFacesFacetExtension) 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 18 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class Handler$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Handler handler, RuntimeContext context) throws Exception {
    if (handler == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Handler.class != handler.getClass()) {
        context.unexpectedSubclass(writer, handler, Handler.class);
        return;
    }
    context.beforeMarshal(handler, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = handler.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(handler, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = handler.getDescriptions();
    } catch (final Exception e) {
        context.getterError(handler, "descriptions", Handler.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(handler, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = handler.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(handler, "displayNames", Handler.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(handler, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = handler.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: handlerName
    final String handlerNameRaw = handler.handlerName;
    String handlerName = null;
    try {
        handlerName = Adapters.collapsedStringAdapterAdapter.marshal(handlerNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(handler, "handlerName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (handlerName != null) {
        writer.writeStartElement(prefix, "handler-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(handlerName);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(handler, "handlerName");
    }
    // ELEMENT: handlerClass
    final String handlerClassRaw = handler.handlerClass;
    String handlerClass = null;
    try {
        handlerClass = Adapters.collapsedStringAdapterAdapter.marshal(handlerClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(handler, "handlerClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (handlerClass != null) {
        writer.writeStartElement(prefix, "handler-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(handlerClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(handler, "handlerClass");
    }
    // ELEMENT: initParam
    final List<ParamValue> initParam = handler.initParam;
    if (initParam != null) {
        for (final ParamValue initParamItem : initParam) {
            if (initParamItem != null) {
                writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee");
                writeParamValue(writer, initParamItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: soapHeader
    final List<QName> soapHeader = handler.soapHeader;
    if (soapHeader != null) {
        for (final QName soapHeaderItem : soapHeader) {
            if (soapHeaderItem != null) {
                writer.writeStartElement(prefix, "soap-header", "http://java.sun.com/xml/ns/javaee");
                writer.writeQName(soapHeaderItem);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: soapRole
    final List<String> soapRoleRaw = handler.soapRole;
    if (soapRoleRaw != null) {
        for (final String soapRoleItem : soapRoleRaw) {
            String soapRole = null;
            try {
                soapRole = Adapters.collapsedStringAdapterAdapter.marshal(soapRoleItem);
            } catch (final Exception e) {
                context.xmlAdapterError(handler, "soapRole", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (soapRole != null) {
                writer.writeStartElement(prefix, "soap-role", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(soapRole);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: portName
    final List<String> portNameRaw = handler.portName;
    if (portNameRaw != null) {
        for (final String portNameItem : portNameRaw) {
            String portName = null;
            try {
                portName = Adapters.collapsedStringAdapterAdapter.marshal(portNameItem);
            } catch (final Exception e) {
                context.xmlAdapterError(handler, "portName", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (portName != null) {
                writer.writeStartElement(prefix, "port-name", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(portName);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(handler, "portName");
            }
        }
    }
    context.afterMarshal(handler, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) QName(javax.xml.namespace.QName) 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) ArrayList(java.util.ArrayList) List(java.util.List) 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)

Example 19 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class EjbJar$JAXB method _read.

public static final EjbJar _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final EjbJar ejbJar = new EjbJar();
    context.beforeUnmarshal(ejbJar, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("ejb-jarType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, EjbJar.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, ejbJar);
            ejbJar.id = id;
        } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: metadataComplete
            final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue()));
            ejbJar.metadataComplete = metadataComplete;
        } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: version
            ejbJar.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("", "metadata-complete"), new QName("", "version"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: moduleName
            final String moduleNameRaw = elementReader.getElementAsString();
            final String moduleName;
            try {
                moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            ejbJar.moduleName = moduleName;
        } else 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 = ejbJar.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("enterprise-beans" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT WRAPPER: enterpriseBeans
            _readEnterpriseBeans(elementReader, context, ejbJar);
        } else if (("interceptors" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: interceptors
            final Interceptors interceptors = readInterceptors(elementReader, context);
            ejbJar.interceptors = interceptors;
        } else if (("relationships" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: relationships
            final Relationships relationships = readRelationships(elementReader, context);
            ejbJar.relationships = relationships;
        } else if (("assembly-descriptor" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: assemblyDescriptor
            final AssemblyDescriptor assemblyDescriptor = readAssemblyDescriptor(elementReader, context);
            ejbJar.assemblyDescriptor = assemblyDescriptor;
        } else if (("ejb-client-jar" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: ejbClientJar
            final String ejbClientJarRaw = elementReader.getElementAsString();
            final String ejbClientJar;
            try {
                ejbClientJar = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClientJarRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            ejbJar.ejbClientJar = ejbClientJar;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-name"), 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", "enterprise-beans"), new QName("http://java.sun.com/xml/ns/javaee", "interceptors"), new QName("http://java.sun.com/xml/ns/javaee", "relationships"), new QName("http://java.sun.com/xml/ns/javaee", "assembly-descriptor"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-client-jar"));
        }
    }
    if (descriptions != null) {
        try {
            ejbJar.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, EjbJar.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            ejbJar.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, EjbJar.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        ejbJar.icon = icon;
    }
    context.afterUnmarshal(ejbJar, LifecycleCallback.NONE);
    return ejbJar;
}
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) Relationships$JAXB.readRelationships(org.apache.openejb.jee.Relationships$JAXB.readRelationships) Relationships$JAXB.writeRelationships(org.apache.openejb.jee.Relationships$JAXB.writeRelationships) Interceptors$JAXB.readInterceptors(org.apache.openejb.jee.Interceptors$JAXB.readInterceptors) Interceptors$JAXB.writeInterceptors(org.apache.openejb.jee.Interceptors$JAXB.writeInterceptors) 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) AssemblyDescriptor$JAXB.writeAssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor$JAXB.writeAssemblyDescriptor) AssemblyDescriptor$JAXB.readAssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor$JAXB.readAssemblyDescriptor) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 20 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class Listener$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Listener listener, RuntimeContext context) throws Exception {
    if (listener == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Listener.class != listener.getClass()) {
        context.unexpectedSubclass(writer, listener, Listener.class);
        return;
    }
    context.beforeMarshal(listener, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = listener.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(listener, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = listener.getDescriptions();
    } catch (final Exception e) {
        context.getterError(listener, "descriptions", Listener.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(listener, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = listener.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(listener, "displayNames", Listener.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(listener, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = listener.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(listener, "icon");
            }
        }
    }
    // ELEMENT: listenerClass
    final String listenerClassRaw = listener.listenerClass;
    String listenerClass = null;
    try {
        listenerClass = Adapters.collapsedStringAdapterAdapter.marshal(listenerClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(listener, "listenerClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (listenerClass != null) {
        writer.writeStartElement(prefix, "listener-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(listenerClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(listener, "listenerClass");
    }
    context.afterMarshal(listener, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) 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)

Aggregations

Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)74 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)74 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)74 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)70 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)70 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)69 ArrayList (java.util.ArrayList)40 QName (javax.xml.namespace.QName)40 Attribute (org.metatype.sxc.util.Attribute)37 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)37 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)12 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)12 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)12 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)12 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)12 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)12 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)12 EnvEntry$JAXB.writeEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry)12 MessageDestinationRef$JAXB.readMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef)12 MessageDestinationRef$JAXB.writeMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef)12