Search in sources :

Example 76 with Text$JAXB.writeText

use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.

the class Validator$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Validator validator, RuntimeContext context) throws Exception {
    if (validator == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Validator.class != validator.getClass()) {
        context.unexpectedSubclass(writer, validator, Validator.class);
        return;
    }
    context.beforeMarshal(validator, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = validator.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(validator, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = validator.getDescriptions();
    } catch (final Exception e) {
        context.getterError(validator, "descriptions", Validator.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(validator, "descriptions");
            }
        }
    }
    // ELEMENT: validatorClass
    final String validatorClassRaw = validator.validatorClass;
    String validatorClass = null;
    try {
        validatorClass = Adapters.collapsedStringAdapterAdapter.marshal(validatorClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(validator, "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(validator, "validatorClass");
    }
    // ELEMENT: initParam
    final List<ParamValue> initParam = validator.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();
            }
        }
    }
    context.afterMarshal(validator, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) 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) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 77 with Text$JAXB.writeText

use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.

the class WebResourceCollection$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final WebResourceCollection webResourceCollection, RuntimeContext context) throws Exception {
    if (webResourceCollection == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (WebResourceCollection.class != webResourceCollection.getClass()) {
        context.unexpectedSubclass(writer, webResourceCollection, WebResourceCollection.class);
        return;
    }
    context.beforeMarshal(webResourceCollection, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = webResourceCollection.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webResourceCollection, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: webResourceName
    final String webResourceNameRaw = webResourceCollection.webResourceName;
    String webResourceName = null;
    try {
        webResourceName = Adapters.collapsedStringAdapterAdapter.marshal(webResourceNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webResourceCollection, "webResourceName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (webResourceName != null) {
        writer.writeStartElement(prefix, "web-resource-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(webResourceName);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(webResourceCollection, "webResourceName");
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = webResourceCollection.getDescriptions();
    } catch (final Exception e) {
        context.getterError(webResourceCollection, "descriptions", WebResourceCollection.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(webResourceCollection, "descriptions");
            }
        }
    }
    // ELEMENT: urlPattern
    final List<String> urlPatternRaw = webResourceCollection.urlPattern;
    if (urlPatternRaw != null) {
        for (final String urlPatternItem : urlPatternRaw) {
            String urlPattern = null;
            try {
                urlPattern = Adapters.trimStringAdapterAdapter.marshal(urlPatternItem);
            } catch (final Exception e) {
                context.xmlAdapterError(webResourceCollection, "urlPattern", TrimStringAdapter.class, List.class, List.class, e);
            }
            if (urlPattern != null) {
                writer.writeStartElement(prefix, "url-pattern", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(urlPattern);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webResourceCollection, "urlPattern");
            }
        }
    }
    // ELEMENT: httpMethod
    final List<String> httpMethodRaw = webResourceCollection.httpMethod;
    if (httpMethodRaw != null) {
        for (final String httpMethodItem : httpMethodRaw) {
            String httpMethod = null;
            try {
                httpMethod = Adapters.collapsedStringAdapterAdapter.marshal(httpMethodItem);
            } catch (final Exception e) {
                context.xmlAdapterError(webResourceCollection, "httpMethod", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (httpMethod != null) {
                writer.writeStartElement(prefix, "http-method", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(httpMethod);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: httpMethodOmission
    final List<String> httpMethodOmissionRaw = webResourceCollection.httpMethodOmission;
    if (httpMethodOmissionRaw != null) {
        for (final String httpMethodOmissionItem : httpMethodOmissionRaw) {
            String httpMethodOmission = null;
            try {
                httpMethodOmission = Adapters.collapsedStringAdapterAdapter.marshal(httpMethodOmissionItem);
            } catch (final Exception e) {
                context.xmlAdapterError(webResourceCollection, "httpMethodOmission", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (httpMethodOmission != null) {
                writer.writeStartElement(prefix, "http-method-omission", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(httpMethodOmission);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(webResourceCollection, 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) ArrayList(java.util.ArrayList) List(java.util.List) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 78 with Text$JAXB.writeText

use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.

the class WebResourceCollection$JAXB method _read.

public static final WebResourceCollection _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final WebResourceCollection webResourceCollection = new WebResourceCollection();
    context.beforeUnmarshal(webResourceCollection, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    List<String> urlPattern = null;
    List<String> httpMethod = null;
    List<String> httpMethodOmission = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("web-resource-collectionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, WebResourceCollection.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, webResourceCollection);
            webResourceCollection.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 (("web-resource-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: webResourceName
            final String webResourceNameRaw = elementReader.getElementAsString();
            final String webResourceName;
            try {
                webResourceName = Adapters.collapsedStringAdapterAdapter.unmarshal(webResourceNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            webResourceCollection.webResourceName = webResourceName;
        } 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 (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: urlPattern
            final String urlPatternItemRaw = elementReader.getElementAsString();
            final String urlPatternItem;
            try {
                urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (urlPattern == null) {
                urlPattern = webResourceCollection.urlPattern;
                if (urlPattern != null) {
                    urlPattern.clear();
                } else {
                    urlPattern = new ArrayList<String>();
                }
            }
            urlPattern.add(urlPatternItem);
        } else if (("http-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: httpMethod
            final String httpMethodItemRaw = elementReader.getElementAsString();
            final String httpMethodItem;
            try {
                httpMethodItem = Adapters.collapsedStringAdapterAdapter.unmarshal(httpMethodItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (httpMethod == null) {
                httpMethod = webResourceCollection.httpMethod;
                if (httpMethod != null) {
                    httpMethod.clear();
                } else {
                    httpMethod = new ArrayList<String>();
                }
            }
            httpMethod.add(httpMethodItem);
        } else if (("http-method-omission" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: httpMethodOmission
            final String httpMethodOmissionItemRaw = elementReader.getElementAsString();
            final String httpMethodOmissionItem;
            try {
                httpMethodOmissionItem = Adapters.collapsedStringAdapterAdapter.unmarshal(httpMethodOmissionItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            if (httpMethodOmission == null) {
                httpMethodOmission = webResourceCollection.httpMethodOmission;
                if (httpMethodOmission != null) {
                    httpMethodOmission.clear();
                } else {
                    httpMethodOmission = new ArrayList<String>();
                }
            }
            httpMethodOmission.add(httpMethodOmissionItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "web-resource-name"), new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "url-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "http-method"), new QName("http://java.sun.com/xml/ns/javaee", "http-method-omission"));
        }
    }
    if (descriptions != null) {
        try {
            webResourceCollection.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, WebResourceCollection.class, "setDescriptions", Text[].class, e);
        }
    }
    if (urlPattern != null) {
        webResourceCollection.urlPattern = urlPattern;
    }
    if (httpMethod != null) {
        webResourceCollection.httpMethod = httpMethod;
    }
    if (httpMethodOmission != null) {
        webResourceCollection.httpMethodOmission = httpMethodOmission;
    }
    context.afterUnmarshal(webResourceCollection, LifecycleCallback.NONE);
    return webResourceCollection;
}
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) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 79 with Text$JAXB.writeText

use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.

the class Webservices$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Webservices webservices, RuntimeContext context) throws Exception {
    if (webservices == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Webservices.class != webservices.getClass()) {
        context.unexpectedSubclass(writer, webservices, Webservices.class);
        return;
    }
    context.beforeMarshal(webservices, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = webservices.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webservices, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ATTRIBUTE: version
    final String versionRaw = webservices.version;
    if (versionRaw != null) {
        String version = null;
        try {
            version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webservices, "version", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "version", version);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = webservices.getDescriptions();
    } catch (final Exception e) {
        context.getterError(webservices, "descriptions", Webservices.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(webservices, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = webservices.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(webservices, "displayNames", Webservices.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(webservices, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = webservices.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(webservices, "icon");
            }
        }
    }
    // ELEMENT: webserviceDescription
    final KeyedCollection<String, WebserviceDescription> webserviceDescription = webservices.webserviceDescription;
    if (webserviceDescription != null) {
        for (final WebserviceDescription webserviceDescriptionItem : webserviceDescription) {
            if (webserviceDescriptionItem != null) {
                writer.writeStartElement(prefix, "webservice-description", "http://java.sun.com/xml/ns/javaee");
                writeWebserviceDescription(writer, webserviceDescriptionItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webservices, "webserviceDescription");
            }
        }
    }
    context.afterMarshal(webservices, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) WebserviceDescription$JAXB.writeWebserviceDescription(org.apache.openejb.jee.WebserviceDescription$JAXB.writeWebserviceDescription) WebserviceDescription$JAXB.readWebserviceDescription(org.apache.openejb.jee.WebserviceDescription$JAXB.readWebserviceDescription) 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)

Example 80 with Text$JAXB.writeText

use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.

the class DataSource$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final DataSource dataSource, RuntimeContext context) throws Exception {
    if (dataSource == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (DataSource.class != dataSource.getClass()) {
        context.unexpectedSubclass(writer, dataSource, DataSource.class);
        return;
    }
    context.beforeMarshal(dataSource, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = dataSource.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(dataSource, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = dataSource.getDescriptions();
    } catch (final Exception e) {
        context.getterError(dataSource, "descriptions", DataSource.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();
            }
        }
    }
    // ELEMENT: name
    final String nameRaw = dataSource.name;
    String name = null;
    try {
        name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "name", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (name != null) {
        writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(name);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(dataSource, "name");
    }
    // ELEMENT: className
    final String classNameRaw = dataSource.className;
    String className = null;
    try {
        className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "className", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (className != null) {
        writer.writeStartElement(prefix, "class-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(className);
        writer.writeEndElement();
    }
    // ELEMENT: serverName
    final String serverNameRaw = dataSource.serverName;
    String serverName = null;
    try {
        serverName = Adapters.collapsedStringAdapterAdapter.marshal(serverNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "serverName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (serverName != null) {
        writer.writeStartElement(prefix, "server-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(serverName);
        writer.writeEndElement();
    }
    // ELEMENT: portNumber
    final Integer portNumber = dataSource.portNumber;
    if (portNumber != null) {
        writer.writeStartElement(prefix, "port-number", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(portNumber));
        writer.writeEndElement();
    }
    // ELEMENT: databaseName
    final String databaseNameRaw = dataSource.databaseName;
    String databaseName = null;
    try {
        databaseName = Adapters.collapsedStringAdapterAdapter.marshal(databaseNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "databaseName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (databaseName != null) {
        writer.writeStartElement(prefix, "database-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(databaseName);
        writer.writeEndElement();
    }
    // ELEMENT: url
    final String urlRaw = dataSource.url;
    String url = null;
    try {
        url = Adapters.collapsedStringAdapterAdapter.marshal(urlRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "url", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (url != null) {
        writer.writeStartElement(prefix, "url", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(url);
        writer.writeEndElement();
    }
    // ELEMENT: user
    final String userRaw = dataSource.user;
    String user = null;
    try {
        user = Adapters.collapsedStringAdapterAdapter.marshal(userRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "user", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (user != null) {
        writer.writeStartElement(prefix, "user", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(user);
        writer.writeEndElement();
    }
    // ELEMENT: password
    final String passwordRaw = dataSource.password;
    String password = null;
    try {
        password = Adapters.collapsedStringAdapterAdapter.marshal(passwordRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(dataSource, "password", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (password != null) {
        writer.writeStartElement(prefix, "password", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(password);
        writer.writeEndElement();
    }
    // ELEMENT: property
    final List<Property> property = dataSource.property;
    if (property != null) {
        for (final Property propertyItem : property) {
            writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee");
            if (propertyItem != null) {
                writeProperty(writer, propertyItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: loginTimeout
    final Integer loginTimeout = dataSource.loginTimeout;
    if (loginTimeout != null) {
        writer.writeStartElement(prefix, "login-timeout", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(loginTimeout));
        writer.writeEndElement();
    }
    // ELEMENT: transactional
    final Boolean transactional = dataSource.transactional;
    if (transactional != null) {
        writer.writeStartElement(prefix, "transactional", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Boolean.toString(transactional));
        writer.writeEndElement();
    }
    // ELEMENT: isolationLevel
    final IsolationLevel isolationLevel = dataSource.isolationLevel;
    if (isolationLevel != null) {
        writer.writeStartElement(prefix, "isolation-level", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(toStringIsolationLevel(dataSource, null, context, isolationLevel));
        writer.writeEndElement();
    }
    // ELEMENT: initialPoolSize
    final Integer initialPoolSize = dataSource.initialPoolSize;
    if (initialPoolSize != null) {
        writer.writeStartElement(prefix, "initial-pool-size", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(initialPoolSize));
        writer.writeEndElement();
    }
    // ELEMENT: maxPoolSize
    final Integer maxPoolSize = dataSource.maxPoolSize;
    if (maxPoolSize != null) {
        writer.writeStartElement(prefix, "max-pool-size", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(maxPoolSize));
        writer.writeEndElement();
    }
    // ELEMENT: minPoolSize
    final Integer minPoolSize = dataSource.minPoolSize;
    if (minPoolSize != null) {
        writer.writeStartElement(prefix, "min-pool-size", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(minPoolSize));
        writer.writeEndElement();
    }
    // ELEMENT: maxIdleTime
    final Integer maxIdleTime = dataSource.maxIdleTime;
    if (maxIdleTime != null) {
        writer.writeStartElement(prefix, "max-idle-time", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(maxIdleTime));
        writer.writeEndElement();
    }
    // ELEMENT: maxStatements
    final Integer maxStatements = dataSource.maxStatements;
    if (maxStatements != null) {
        writer.writeStartElement(prefix, "max-statements", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(maxStatements));
        writer.writeEndElement();
    }
    context.afterMarshal(dataSource, LifecycleCallback.NONE);
}
Also used : IsolationLevel$JAXB.toStringIsolationLevel(org.apache.openejb.jee.IsolationLevel$JAXB.toStringIsolationLevel) IsolationLevel$JAXB.parseIsolationLevel(org.apache.openejb.jee.IsolationLevel$JAXB.parseIsolationLevel) 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) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) Property$JAXB.writeProperty(org.apache.openejb.jee.Property$JAXB.writeProperty) Property$JAXB.readProperty(org.apache.openejb.jee.Property$JAXB.readProperty)

Aggregations

Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)155 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)155 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)154 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)126 QName (javax.xml.namespace.QName)80 Attribute (org.metatype.sxc.util.Attribute)78 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)78 Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)70 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)70 ArrayList (java.util.ArrayList)56 InjectionTarget$JAXB.readInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget)18 InjectionTarget$JAXB.writeInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget)18 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)14 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)14 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)14 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)14 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)14 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)14 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)14 EnvEntry$JAXB.writeEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry)14