Search in sources :

Example 46 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class LocaleEncodingMapping$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final LocaleEncodingMapping localeEncodingMapping, RuntimeContext context) throws Exception {
    if (localeEncodingMapping == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (LocaleEncodingMapping.class != localeEncodingMapping.getClass()) {
        context.unexpectedSubclass(writer, localeEncodingMapping, LocaleEncodingMapping.class);
        return;
    }
    context.beforeMarshal(localeEncodingMapping, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = localeEncodingMapping.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(localeEncodingMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: locale
    final String localeRaw = localeEncodingMapping.locale;
    String locale = null;
    try {
        locale = Adapters.collapsedStringAdapterAdapter.marshal(localeRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(localeEncodingMapping, "locale", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (locale != null) {
        writer.writeStartElement(prefix, "locale", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(locale);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(localeEncodingMapping, "locale");
    }
    // ELEMENT: encoding
    final String encodingRaw = localeEncodingMapping.encoding;
    String encoding = null;
    try {
        encoding = Adapters.collapsedStringAdapterAdapter.marshal(encodingRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(localeEncodingMapping, "encoding", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (encoding != null) {
        writer.writeStartElement(prefix, "encoding", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(encoding);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(localeEncodingMapping, "encoding");
    }
    context.afterMarshal(localeEncodingMapping, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 47 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class LocaleEncodingMapping$JAXB method _read.

public static final LocaleEncodingMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final LocaleEncodingMapping localeEncodingMapping = new LocaleEncodingMapping();
    context.beforeUnmarshal(localeEncodingMapping, LifecycleCallback.NONE);
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("locale-encoding-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, LocaleEncodingMapping.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, localeEncodingMapping);
            localeEncodingMapping.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 (("locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: locale
            final String localeRaw = elementReader.getElementAsString();
            final String locale;
            try {
                locale = Adapters.collapsedStringAdapterAdapter.unmarshal(localeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            localeEncodingMapping.locale = locale;
        } else if (("encoding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: encoding
            final String encodingRaw = elementReader.getElementAsString();
            final String encoding;
            try {
                encoding = Adapters.collapsedStringAdapterAdapter.unmarshal(encodingRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            localeEncodingMapping.encoding = encoding;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "locale"), new QName("http://java.sun.com/xml/ns/javaee", "encoding"));
        }
    }
    context.afterUnmarshal(localeEncodingMapping, LifecycleCallback.NONE);
    return localeEncodingMapping;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 48 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class CookieConfig$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final CookieConfig cookieConfig, RuntimeContext context) throws Exception {
    if (cookieConfig == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (CookieConfig.class != cookieConfig.getClass()) {
        context.unexpectedSubclass(writer, cookieConfig, CookieConfig.class);
        return;
    }
    context.beforeMarshal(cookieConfig, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = cookieConfig.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(cookieConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: name
    final String nameRaw = cookieConfig.name;
    String name = null;
    try {
        name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(cookieConfig, "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();
    }
    // ELEMENT: domain
    final String domainRaw = cookieConfig.domain;
    String domain = null;
    try {
        domain = Adapters.collapsedStringAdapterAdapter.marshal(domainRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(cookieConfig, "domain", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (domain != null) {
        writer.writeStartElement(prefix, "domain", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(domain);
        writer.writeEndElement();
    }
    // ELEMENT: path
    final String pathRaw = cookieConfig.path;
    String path = null;
    try {
        path = Adapters.collapsedStringAdapterAdapter.marshal(pathRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(cookieConfig, "path", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (path != null) {
        writer.writeStartElement(prefix, "path", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(path);
        writer.writeEndElement();
    }
    // ELEMENT: comment
    final String commentRaw = cookieConfig.comment;
    String comment = null;
    try {
        comment = Adapters.collapsedStringAdapterAdapter.marshal(commentRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(cookieConfig, "comment", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (comment != null) {
        writer.writeStartElement(prefix, "comment", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(comment);
        writer.writeEndElement();
    }
    // ELEMENT: httpOnly
    final Boolean httpOnly = cookieConfig.httpOnly;
    if (httpOnly != null) {
        writer.writeStartElement(prefix, "http-only", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Boolean.toString(httpOnly));
        writer.writeEndElement();
    }
    // ELEMENT: secure
    final Boolean secure = cookieConfig.secure;
    if (secure != null) {
        writer.writeStartElement(prefix, "secure", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Boolean.toString(secure));
        writer.writeEndElement();
    }
    // ELEMENT: maxAge
    final Integer maxAge = cookieConfig.maxAge;
    if (maxAge != null) {
        writer.writeStartElement(prefix, "max-age", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(Integer.toString(maxAge));
        writer.writeEndElement();
    }
    context.afterMarshal(cookieConfig, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 49 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class CookieConfig$JAXB method _read.

public static final CookieConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final CookieConfig cookieConfig = new CookieConfig();
    context.beforeUnmarshal(cookieConfig, LifecycleCallback.NONE);
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("cookie-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, CookieConfig.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, cookieConfig);
            cookieConfig.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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: name
            final String nameRaw = elementReader.getElementAsString();
            final String name;
            try {
                name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            cookieConfig.name = name;
        } else if (("domain" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: domain
            final String domainRaw = elementReader.getElementAsString();
            final String domain;
            try {
                domain = Adapters.collapsedStringAdapterAdapter.unmarshal(domainRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            cookieConfig.domain = domain;
        } else if (("path" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: path
            final String pathRaw = elementReader.getElementAsString();
            final String path;
            try {
                path = Adapters.collapsedStringAdapterAdapter.unmarshal(pathRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            cookieConfig.path = path;
        } else if (("comment" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: comment
            final String commentRaw = elementReader.getElementAsString();
            final String comment;
            try {
                comment = Adapters.collapsedStringAdapterAdapter.unmarshal(commentRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            cookieConfig.comment = comment;
        } else if (("http-only" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: httpOnly
            final Boolean httpOnly = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            cookieConfig.httpOnly = httpOnly;
        } else if (("secure" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: secure
            final Boolean secure = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            cookieConfig.secure = secure;
        } else if (("max-age" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: maxAge
            final Integer maxAge = Integer.valueOf(elementReader.getElementAsString());
            cookieConfig.maxAge = maxAge;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "domain"), new QName("http://java.sun.com/xml/ns/javaee", "path"), new QName("http://java.sun.com/xml/ns/javaee", "comment"), new QName("http://java.sun.com/xml/ns/javaee", "http-only"), new QName("http://java.sun.com/xml/ns/javaee", "secure"), new QName("http://java.sun.com/xml/ns/javaee", "max-age"));
        }
    }
    context.afterUnmarshal(cookieConfig, LifecycleCallback.NONE);
    return cookieConfig;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 50 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class DataSource$JAXB method _read.

public static final DataSource _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final DataSource dataSource = new DataSource();
    context.beforeUnmarshal(dataSource, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    List<Property> property = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("data-sourceType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, DataSource.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, dataSource);
            dataSource.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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: name
            final String nameRaw = elementReader.getElementAsString();
            final String name;
            try {
                name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.name = name;
        } else if (("class-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: className
            final String classNameRaw = elementReader.getElementAsString();
            final String className;
            try {
                className = Adapters.collapsedStringAdapterAdapter.unmarshal(classNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.className = className;
        } else if (("server-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serverName
            final String serverNameRaw = elementReader.getElementAsString();
            final String serverName;
            try {
                serverName = Adapters.collapsedStringAdapterAdapter.unmarshal(serverNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.serverName = serverName;
        } else if (("port-number" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: portNumber
            final Integer portNumber = Integer.valueOf(elementReader.getElementAsString());
            dataSource.portNumber = portNumber;
        } else if (("database-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: databaseName
            final String databaseNameRaw = elementReader.getElementAsString();
            final String databaseName;
            try {
                databaseName = Adapters.collapsedStringAdapterAdapter.unmarshal(databaseNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.databaseName = databaseName;
        } else if (("url" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: url
            final String urlRaw = elementReader.getElementAsString();
            final String url;
            try {
                url = Adapters.collapsedStringAdapterAdapter.unmarshal(urlRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.url = url;
        } else if (("user" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: user
            final String userRaw = elementReader.getElementAsString();
            final String user;
            try {
                user = Adapters.collapsedStringAdapterAdapter.unmarshal(userRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.user = user;
        } else if (("password" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: password
            final String passwordRaw = elementReader.getElementAsString();
            final String password;
            try {
                password = Adapters.collapsedStringAdapterAdapter.unmarshal(passwordRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            dataSource.password = password;
        } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: property
            final Property propertyItem = readProperty(elementReader, context);
            if (property == null) {
                property = dataSource.property;
                if (property != null) {
                    property.clear();
                } else {
                    property = new ArrayList<Property>();
                }
            }
            property.add(propertyItem);
        } else if (("login-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: loginTimeout
            final Integer loginTimeout = Integer.valueOf(elementReader.getElementAsString());
            dataSource.loginTimeout = loginTimeout;
        } else if (("transactional" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: transactional
            final Boolean transactional = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            dataSource.transactional = transactional;
        } else if (("isolation-level" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: isolationLevel
            final IsolationLevel isolationLevel = parseIsolationLevel(elementReader, context, elementReader.getElementAsString());
            if (isolationLevel != null) {
                dataSource.isolationLevel = isolationLevel;
            }
        } else if (("initial-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: initialPoolSize
            final Integer initialPoolSize = Integer.valueOf(elementReader.getElementAsString());
            dataSource.initialPoolSize = initialPoolSize;
        } else if (("max-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: maxPoolSize
            final Integer maxPoolSize = Integer.valueOf(elementReader.getElementAsString());
            dataSource.maxPoolSize = maxPoolSize;
        } else if (("min-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: minPoolSize
            final Integer minPoolSize = Integer.valueOf(elementReader.getElementAsString());
            dataSource.minPoolSize = minPoolSize;
        } else if (("max-idle-time" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: maxIdleTime
            final Integer maxIdleTime = Integer.valueOf(elementReader.getElementAsString());
            dataSource.maxIdleTime = maxIdleTime;
        } else if (("max-statements" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: maxStatements
            final Integer maxStatements = Integer.valueOf(elementReader.getElementAsString());
            dataSource.maxStatements = maxStatements;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "class-name"), new QName("http://java.sun.com/xml/ns/javaee", "server-name"), new QName("http://java.sun.com/xml/ns/javaee", "port-number"), new QName("http://java.sun.com/xml/ns/javaee", "database-name"), new QName("http://java.sun.com/xml/ns/javaee", "url"), new QName("http://java.sun.com/xml/ns/javaee", "user"), new QName("http://java.sun.com/xml/ns/javaee", "password"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "login-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "transactional"), new QName("http://java.sun.com/xml/ns/javaee", "isolation-level"), new QName("http://java.sun.com/xml/ns/javaee", "initial-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "min-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-idle-time"), new QName("http://java.sun.com/xml/ns/javaee", "max-statements"));
        }
    }
    if (descriptions != null) {
        try {
            dataSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, DataSource.class, "setDescriptions", Text[].class, e);
        }
    }
    if (property != null) {
        dataSource.property = property;
    }
    context.afterUnmarshal(dataSource, LifecycleCallback.NONE);
    return dataSource;
}
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) 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) Property$JAXB.writeProperty(org.apache.openejb.jee.Property$JAXB.writeProperty) Property$JAXB.readProperty(org.apache.openejb.jee.Property$JAXB.readProperty) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Aggregations

RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)380 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)300 QName (javax.xml.namespace.QName)202 Attribute (org.metatype.sxc.util.Attribute)190 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)182 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)155 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)154 ArrayList (java.util.ArrayList)91 Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)74 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)74 JAXBObject (org.metatype.sxc.jaxb.JAXBObject)39 List (java.util.List)22 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