You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/12/10 06:08:43 UTC
svn commit: r1419199 [6/35] - in /openejb/trunk/openejb/container:
openejb-jee-accessors/ openejb-jee-accessors/src/main/
openejb-jee-accessors/src/main/java/ openejb-jee-accessors/src/main/java/org/
openejb-jee-accessors/src/main/java/org/apache/ open...
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,288 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class CookieConfig$JAXB
+ extends JAXBObject<CookieConfig> {
+
+
+ public CookieConfig$JAXB() {
+ super(CookieConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cookie-configType".intern()));
+ }
+
+ public static CookieConfig readCookieConfig(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeCookieConfig(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context)
+ throws Exception {
+ _write(writer, cookieConfig, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context)
+ throws Exception {
+ _write(writer, cookieConfig, context);
+ }
+
+ public final static CookieConfig _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ CookieConfig cookieConfig = new CookieConfig();
+ context.beforeUnmarshal(cookieConfig, LifecycleCallback.NONE);
+
+
+ // Check xsi:type
+ 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 (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ 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 (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: name
+ String nameRaw = elementReader.getElementAsString();
+
+ String name;
+ try {
+ name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
+ } catch (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
+ String domainRaw = elementReader.getElementAsString();
+
+ String domain;
+ try {
+ domain = Adapters.collapsedStringAdapterAdapter.unmarshal(domainRaw);
+ } catch (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
+ String pathRaw = elementReader.getElementAsString();
+
+ String path;
+ try {
+ path = Adapters.collapsedStringAdapterAdapter.unmarshal(pathRaw);
+ } catch (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
+ String commentRaw = elementReader.getElementAsString();
+
+ String comment;
+ try {
+ comment = Adapters.collapsedStringAdapterAdapter.unmarshal(commentRaw);
+ } catch (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
+ 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
+ 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
+ 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;
+ }
+
+ public final CookieConfig read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context)
+ throws Exception {
+ if (cookieConfig == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ 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
+ String idRaw = cookieConfig.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(cookieConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ELEMENT: name
+ String nameRaw = cookieConfig.name;
+ String name = null;
+ try {
+ name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
+ } catch (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
+ String domainRaw = cookieConfig.domain;
+ String domain = null;
+ try {
+ domain = Adapters.collapsedStringAdapterAdapter.marshal(domainRaw);
+ } catch (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
+ String pathRaw = cookieConfig.path;
+ String path = null;
+ try {
+ path = Adapters.collapsedStringAdapterAdapter.marshal(pathRaw);
+ } catch (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
+ String commentRaw = cookieConfig.comment;
+ String comment = null;
+ try {
+ comment = Adapters.collapsedStringAdapterAdapter.marshal(commentRaw);
+ } catch (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
+ 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
+ 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
+ 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);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,516 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.openejb.jee.IsolationLevel$JAXB.parseIsolationLevel;
+import static org.apache.openejb.jee.IsolationLevel$JAXB.toStringIsolationLevel;
+import static org.apache.openejb.jee.Property$JAXB.readProperty;
+import static org.apache.openejb.jee.Property$JAXB.writeProperty;
+import static org.apache.openejb.jee.Text$JAXB.readText;
+import static org.apache.openejb.jee.Text$JAXB.writeText;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class DataSource$JAXB
+ extends JAXBObject<DataSource> {
+
+
+ public DataSource$JAXB() {
+ super(DataSource.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "data-sourceType".intern()), Text$JAXB.class, Property$JAXB.class, IsolationLevel$JAXB.class);
+ }
+
+ public static DataSource readDataSource(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeDataSource(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context)
+ throws Exception {
+ _write(writer, dataSource, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context)
+ throws Exception {
+ _write(writer, dataSource, context);
+ }
+
+ public final static DataSource _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ DataSource dataSource = new DataSource();
+ context.beforeUnmarshal(dataSource, LifecycleCallback.NONE);
+
+ ArrayList<Text> descriptions = null;
+ List<Property> property = null;
+
+ // Check xsi:type
+ 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 (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ 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 (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: descriptions
+ 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
+ String nameRaw = elementReader.getElementAsString();
+
+ String name;
+ try {
+ name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
+ } catch (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
+ String classNameRaw = elementReader.getElementAsString();
+
+ String className;
+ try {
+ className = Adapters.collapsedStringAdapterAdapter.unmarshal(classNameRaw);
+ } catch (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
+ String serverNameRaw = elementReader.getElementAsString();
+
+ String serverName;
+ try {
+ serverName = Adapters.collapsedStringAdapterAdapter.unmarshal(serverNameRaw);
+ } catch (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
+ 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
+ String databaseNameRaw = elementReader.getElementAsString();
+
+ String databaseName;
+ try {
+ databaseName = Adapters.collapsedStringAdapterAdapter.unmarshal(databaseNameRaw);
+ } catch (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
+ String urlRaw = elementReader.getElementAsString();
+
+ String url;
+ try {
+ url = Adapters.collapsedStringAdapterAdapter.unmarshal(urlRaw);
+ } catch (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
+ String userRaw = elementReader.getElementAsString();
+
+ String user;
+ try {
+ user = Adapters.collapsedStringAdapterAdapter.unmarshal(userRaw);
+ } catch (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
+ String passwordRaw = elementReader.getElementAsString();
+
+ String password;
+ try {
+ password = Adapters.collapsedStringAdapterAdapter.unmarshal(passwordRaw);
+ } catch (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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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 (Exception e) {
+ context.setterError(reader, DataSource.class, "setDescriptions", Text[].class, e);
+ }
+ }
+ if (property != null) {
+ dataSource.property = property;
+ }
+
+ context.afterUnmarshal(dataSource, LifecycleCallback.NONE);
+
+ return dataSource;
+ }
+
+ public final DataSource read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context)
+ throws Exception {
+ if (dataSource == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ 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
+ String idRaw = dataSource.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (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 (Exception e) {
+ context.getterError(dataSource, "descriptions", DataSource.class, "getDescriptions", e);
+ }
+ if (descriptions != null) {
+ for (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
+ String nameRaw = dataSource.name;
+ String name = null;
+ try {
+ name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
+ } catch (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
+ String classNameRaw = dataSource.className;
+ String className = null;
+ try {
+ className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw);
+ } catch (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
+ String serverNameRaw = dataSource.serverName;
+ String serverName = null;
+ try {
+ serverName = Adapters.collapsedStringAdapterAdapter.marshal(serverNameRaw);
+ } catch (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
+ 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
+ String databaseNameRaw = dataSource.databaseName;
+ String databaseName = null;
+ try {
+ databaseName = Adapters.collapsedStringAdapterAdapter.marshal(databaseNameRaw);
+ } catch (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
+ String urlRaw = dataSource.url;
+ String url = null;
+ try {
+ url = Adapters.collapsedStringAdapterAdapter.marshal(urlRaw);
+ } catch (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
+ String userRaw = dataSource.user;
+ String user = null;
+ try {
+ user = Adapters.collapsedStringAdapterAdapter.marshal(userRaw);
+ } catch (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
+ String passwordRaw = dataSource.password;
+ String password = null;
+ try {
+ password = Adapters.collapsedStringAdapterAdapter.marshal(passwordRaw);
+ } catch (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
+ List<Property> property = dataSource.property;
+ if (property != null) {
+ for (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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class DestinationType$JAXB
+ extends JAXBObject<DestinationType> {
+
+
+ public DestinationType$JAXB() {
+ super(DestinationType.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "destination-type".intern()), null);
+ }
+
+ public static DestinationType readDestinationType(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeDestinationType(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context)
+ throws Exception {
+ _write(writer, destinationType, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context)
+ throws Exception {
+ _write(writer, destinationType, context);
+ }
+
+ public final static DestinationType _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ DestinationType destinationType = new DestinationType();
+ context.beforeUnmarshal(destinationType, LifecycleCallback.NONE);
+
+
+ // Check xsi:type
+ QName xsiType = reader.getXsiType();
+ if (xsiType != null) {
+ return context.unexpectedXsiType(reader, DestinationType.class);
+ }
+
+ // Read attributes
+ for (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
+ context.addXmlId(reader, id, destinationType);
+ destinationType.id = id;
+ } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
+ context.unexpectedAttribute(attribute, new QName("", "id"));
+ }
+ }
+
+ // VALUE: value
+ String valueRaw = reader.getElementText();
+
+ String value = null;
+ boolean valueConverted;
+ try {
+ value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
+ valueConverted = true;
+ } catch (Exception e) {
+ context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e);
+ valueConverted = false;
+ }
+
+ if (valueConverted) {
+ destinationType.value = value;
+ }
+
+ context.afterUnmarshal(destinationType, LifecycleCallback.NONE);
+
+ return destinationType;
+ }
+
+ public final DestinationType read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context)
+ throws Exception {
+ if (destinationType == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ if (DestinationType.class != destinationType.getClass()) {
+ context.unexpectedSubclass(writer, destinationType, DestinationType.class);
+ return;
+ }
+
+ context.beforeMarshal(destinationType, LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = destinationType.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(destinationType, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // VALUE: value
+ String valueRaw = destinationType.value;
+ String value = null;
+ try {
+ value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(destinationType, "value", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeCharacters(value);
+
+ context.afterMarshal(destinationType, LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBEnum;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+
+import javax.xml.namespace.QName;
+
+public class Dispatcher$JAXB
+ extends JAXBEnum<Dispatcher> {
+
+
+ public Dispatcher$JAXB() {
+ super(Dispatcher.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "dispatcherType".intern()));
+ }
+
+ public Dispatcher parse(XoXMLStreamReader reader, RuntimeContext context, String value)
+ throws Exception {
+ return parseDispatcher(reader, context, value);
+ }
+
+ public String toString(Object bean, String parameterName, RuntimeContext context, Dispatcher dispatcher)
+ throws Exception {
+ return toStringDispatcher(bean, parameterName, context, dispatcher);
+ }
+
+ public static Dispatcher parseDispatcher(XoXMLStreamReader reader, RuntimeContext context, String value)
+ throws Exception {
+ if ("FORWARD".equals(value)) {
+ return Dispatcher.FORWARD;
+ } else if ("REQUEST".equals(value)) {
+ return Dispatcher.REQUEST;
+ } else if ("INCLUDE".equals(value)) {
+ return Dispatcher.INCLUDE;
+ } else if ("ASYNC".equals(value)) {
+ return Dispatcher.ASYNC;
+ } else if ("ERROR".equals(value)) {
+ return Dispatcher.ERROR;
+ } else {
+ context.unexpectedEnumValue(reader, Dispatcher.class, value, "FORWARD", "REQUEST", "INCLUDE", "ASYNC", "ERROR");
+ return null;
+ }
+ }
+
+ public static String toStringDispatcher(Object bean, String parameterName, RuntimeContext context, Dispatcher dispatcher)
+ throws Exception {
+ if (Dispatcher.FORWARD == dispatcher) {
+ return "FORWARD";
+ } else if (Dispatcher.REQUEST == dispatcher) {
+ return "REQUEST";
+ } else if (Dispatcher.INCLUDE == dispatcher) {
+ return "INCLUDE";
+ } else if (Dispatcher.ASYNC == dispatcher) {
+ return "ASYNC";
+ } else if (Dispatcher.ERROR == dispatcher) {
+ return "ERROR";
+ } else {
+ context.unexpectedEnumConst(bean, parameterName, dispatcher, Dispatcher.FORWARD, Dispatcher.REQUEST, Dispatcher.INCLUDE, Dispatcher.ASYNC, Dispatcher.ERROR);
+ return null;
+ }
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar%24JAXB.java?rev=1419199&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java (added)
+++ openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java Mon Dec 10 05:08:14 2012
@@ -0,0 +1,450 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import com.envoisolutions.sxc.jaxb.JAXBObject;
+import com.envoisolutions.sxc.jaxb.LifecycleCallback;
+import com.envoisolutions.sxc.jaxb.RuntimeContext;
+import com.envoisolutions.sxc.util.Attribute;
+import com.envoisolutions.sxc.util.XoXMLStreamReader;
+import com.envoisolutions.sxc.util.XoXMLStreamWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+
+import static org.apache.openejb.jee.AssemblyDescriptor$JAXB.readAssemblyDescriptor;
+import static org.apache.openejb.jee.AssemblyDescriptor$JAXB.writeAssemblyDescriptor;
+import static org.apache.openejb.jee.EntityBean$JAXB.readEntityBean;
+import static org.apache.openejb.jee.EntityBean$JAXB.writeEntityBean;
+import static org.apache.openejb.jee.Icon$JAXB.readIcon;
+import static org.apache.openejb.jee.Icon$JAXB.writeIcon;
+import static org.apache.openejb.jee.Interceptors$JAXB.readInterceptors;
+import static org.apache.openejb.jee.Interceptors$JAXB.writeInterceptors;
+import static org.apache.openejb.jee.MessageDrivenBean$JAXB.readMessageDrivenBean;
+import static org.apache.openejb.jee.MessageDrivenBean$JAXB.writeMessageDrivenBean;
+import static org.apache.openejb.jee.Relationships$JAXB.readRelationships;
+import static org.apache.openejb.jee.Relationships$JAXB.writeRelationships;
+import static org.apache.openejb.jee.SessionBean$JAXB.readSessionBean;
+import static org.apache.openejb.jee.SessionBean$JAXB.writeSessionBean;
+import static org.apache.openejb.jee.Text$JAXB.readText;
+import static org.apache.openejb.jee.Text$JAXB.writeText;
+
+@SuppressWarnings({
+ "StringEquality"
+})
+public class EjbJar$JAXB
+ extends JAXBObject<EjbJar> {
+
+
+ public EjbJar$JAXB() {
+ super(EjbJar.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-jar".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-jarType".intern()), Text$JAXB.class, Icon$JAXB.class, MessageDrivenBean$JAXB.class, SessionBean$JAXB.class, EntityBean$JAXB.class, Interceptors$JAXB.class, Relationships$JAXB.class, AssemblyDescriptor$JAXB.class);
+ }
+
+ public static EjbJar readEjbJar(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public static void writeEjbJar(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context)
+ throws Exception {
+ _write(writer, ejbJar, context);
+ }
+
+ public void write(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context)
+ throws Exception {
+ _write(writer, ejbJar, context);
+ }
+
+ public final static EjbJar _read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+
+ // Check for xsi:nil
+ if (reader.isXsiNil()) {
+ return null;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ EjbJar ejbJar = new EjbJar();
+ context.beforeUnmarshal(ejbJar, LifecycleCallback.NONE);
+
+ ArrayList<Text> descriptions = null;
+ ArrayList<Text> displayNames = null;
+ LocalCollection<Icon> icon = null;
+
+ // Check xsi:type
+ 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 (Attribute attribute : reader.getAttributes()) {
+ if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
+ // ATTRIBUTE: id
+ 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
+ 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 (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: moduleName
+ String moduleNameRaw = elementReader.getElementAsString();
+
+ String moduleName;
+ try {
+ moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw);
+ } catch (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
+ 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
+ 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
+ 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
+ Interceptors interceptors = readInterceptors(elementReader, context);
+ ejbJar.interceptors = interceptors;
+ } else if (("relationships" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: relationships
+ 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
+ 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
+ String ejbClientJarRaw = elementReader.getElementAsString();
+
+ String ejbClientJar;
+ try {
+ ejbClientJar = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClientJarRaw);
+ } catch (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 (Exception e) {
+ context.setterError(reader, EjbJar.class, "setDescriptions", Text[].class, e);
+ }
+ }
+ if (displayNames != null) {
+ try {
+ ejbJar.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
+ } catch (Exception e) {
+ context.setterError(reader, EjbJar.class, "setDisplayNames", Text[].class, e);
+ }
+ }
+ if (icon != null) {
+ ejbJar.icon = icon;
+ }
+
+ context.afterUnmarshal(ejbJar, LifecycleCallback.NONE);
+
+ return ejbJar;
+ }
+
+ public final EjbJar read(XoXMLStreamReader reader, RuntimeContext context)
+ throws Exception {
+ return _read(reader, context);
+ }
+
+ public final static void _readEnterpriseBeans(XoXMLStreamReader reader, RuntimeContext context, EjbJar ejbJar)
+ throws Exception {
+ ArrayList<EnterpriseBean> enterpriseBeans = null;
+
+ // Read elements
+ for (XoXMLStreamReader elementReader : reader.getChildElements()) {
+ if (("message-driven" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: enterpriseBeans
+ org.apache.openejb.jee.MessageDrivenBean enterpriseBeansItem = readMessageDrivenBean(elementReader, context);
+ if (enterpriseBeans == null) {
+ enterpriseBeans = new ArrayList<EnterpriseBean>();
+ }
+ enterpriseBeans.add(enterpriseBeansItem);
+ } else if (("session" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: enterpriseBeans
+ org.apache.openejb.jee.SessionBean enterpriseBeansItem1 = readSessionBean(elementReader, context);
+ if (enterpriseBeans == null) {
+ enterpriseBeans = new ArrayList<EnterpriseBean>();
+ }
+ enterpriseBeans.add(enterpriseBeansItem1);
+ } else if (("entity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+ // ELEMENT: enterpriseBeans
+ org.apache.openejb.jee.EntityBean enterpriseBeansItem2 = readEntityBean(elementReader, context);
+ if (enterpriseBeans == null) {
+ enterpriseBeans = new ArrayList<EnterpriseBean>();
+ }
+ enterpriseBeans.add(enterpriseBeansItem2);
+ }
+ }
+ if (enterpriseBeans != null) {
+ try {
+ ejbJar.setEnterpriseBeans(enterpriseBeans.toArray(new EnterpriseBean[enterpriseBeans.size()]));
+ } catch (Exception e) {
+ context.setterError(reader, EjbJar.class, "setEnterpriseBeans", EnterpriseBean[].class, e);
+ }
+ }
+ }
+
+ public final static void _write(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context)
+ throws Exception {
+ if (ejbJar == null) {
+ writer.writeXsiNil();
+ return;
+ }
+
+ if (context == null) {
+ context = new RuntimeContext();
+ }
+
+ String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
+ if (EjbJar.class != ejbJar.getClass()) {
+ context.unexpectedSubclass(writer, ejbJar, EjbJar.class);
+ return;
+ }
+
+ context.beforeMarshal(ejbJar, LifecycleCallback.NONE);
+
+
+ // ATTRIBUTE: id
+ String idRaw = ejbJar.id;
+ if (idRaw != null) {
+ String id = null;
+ try {
+ id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(ejbJar, "id", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "id", id);
+ }
+
+ // ATTRIBUTE: metadataComplete
+ Boolean metadataComplete = ejbJar.metadataComplete;
+ if (metadataComplete != null) {
+ writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete));
+ }
+
+ // ATTRIBUTE: version
+ String versionRaw = ejbJar.version;
+ if (versionRaw != null) {
+ String version = null;
+ try {
+ version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(ejbJar, "version", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ writer.writeAttribute("", "", "version", version);
+ }
+
+ // ELEMENT: moduleName
+ String moduleNameRaw = ejbJar.moduleName;
+ String moduleName = null;
+ try {
+ moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(ejbJar, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (moduleName != null) {
+ writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(moduleName);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: descriptions
+ Text[] descriptions = null;
+ try {
+ descriptions = ejbJar.getDescriptions();
+ } catch (Exception e) {
+ context.getterError(ejbJar, "descriptions", EjbJar.class, "getDescriptions", e);
+ }
+ if (descriptions != null) {
+ for (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(ejbJar, "descriptions");
+ }
+ }
+ }
+
+ // ELEMENT: displayNames
+ Text[] displayNames = null;
+ try {
+ displayNames = ejbJar.getDisplayNames();
+ } catch (Exception e) {
+ context.getterError(ejbJar, "displayNames", EjbJar.class, "getDisplayNames", e);
+ }
+ if (displayNames != null) {
+ for (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(ejbJar, "displayNames");
+ }
+ }
+ }
+
+ // ELEMENT: icon
+ LocalCollection<Icon> icon = ejbJar.icon;
+ if (icon != null) {
+ for (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(ejbJar, "icon");
+ }
+ }
+ }
+
+ // ELEMENT: enterpriseBeans
+ EnterpriseBean[] enterpriseBeans = null;
+ try {
+ enterpriseBeans = ejbJar.getEnterpriseBeans();
+ } catch (Exception e) {
+ context.getterError(ejbJar, "enterpriseBeans", EjbJar.class, "getEnterpriseBeans", e);
+ }
+ writer.writeStartElement(prefix, "enterprise-beans", "http://java.sun.com/xml/ns/javaee");
+ if (enterpriseBeans != null) {
+ for (EnterpriseBean enterpriseBeansItem : enterpriseBeans) {
+ if (enterpriseBeansItem instanceof org.apache.openejb.jee.EntityBean) {
+ org.apache.openejb.jee.EntityBean EntityBean = ((org.apache.openejb.jee.EntityBean) enterpriseBeansItem);
+ writer.writeStartElement(prefix, "entity", "http://java.sun.com/xml/ns/javaee");
+ writeEntityBean(writer, EntityBean, context);
+ writer.writeEndElement();
+ } else if (enterpriseBeansItem instanceof org.apache.openejb.jee.SessionBean) {
+ org.apache.openejb.jee.SessionBean SessionBean = ((org.apache.openejb.jee.SessionBean) enterpriseBeansItem);
+ writer.writeStartElement(prefix, "session", "http://java.sun.com/xml/ns/javaee");
+ writeSessionBean(writer, SessionBean, context);
+ writer.writeEndElement();
+ } else if (enterpriseBeansItem instanceof org.apache.openejb.jee.MessageDrivenBean) {
+ org.apache.openejb.jee.MessageDrivenBean MessageDrivenBean = ((org.apache.openejb.jee.MessageDrivenBean) enterpriseBeansItem);
+ writer.writeStartElement(prefix, "message-driven", "http://java.sun.com/xml/ns/javaee");
+ writeMessageDrivenBean(writer, MessageDrivenBean, context);
+ writer.writeEndElement();
+ } else if (enterpriseBeansItem == null) {
+ context.unexpectedNullValue(ejbJar, "enterpriseBeans");
+ } else {
+ context.unexpectedElementType(writer, ejbJar, "enterpriseBeans", enterpriseBeansItem, org.apache.openejb.jee.EntityBean.class, org.apache.openejb.jee.SessionBean.class, org.apache.openejb.jee.MessageDrivenBean.class);
+ }
+ }
+ }
+ writer.writeEndElement();
+
+ // ELEMENT: interceptors
+ Interceptors interceptors = ejbJar.interceptors;
+ if (interceptors != null) {
+ writer.writeStartElement(prefix, "interceptors", "http://java.sun.com/xml/ns/javaee");
+ writeInterceptors(writer, interceptors, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: relationships
+ Relationships relationships = ejbJar.relationships;
+ if (relationships != null) {
+ writer.writeStartElement(prefix, "relationships", "http://java.sun.com/xml/ns/javaee");
+ writeRelationships(writer, relationships, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: assemblyDescriptor
+ AssemblyDescriptor assemblyDescriptor = ejbJar.assemblyDescriptor;
+ if (assemblyDescriptor != null) {
+ writer.writeStartElement(prefix, "assembly-descriptor", "http://java.sun.com/xml/ns/javaee");
+ writeAssemblyDescriptor(writer, assemblyDescriptor, context);
+ writer.writeEndElement();
+ }
+
+ // ELEMENT: ejbClientJar
+ String ejbClientJarRaw = ejbJar.ejbClientJar;
+ String ejbClientJar = null;
+ try {
+ ejbClientJar = Adapters.collapsedStringAdapterAdapter.marshal(ejbClientJarRaw);
+ } catch (Exception e) {
+ context.xmlAdapterError(ejbJar, "ejbClientJar", CollapsedStringAdapter.class, String.class, String.class, e);
+ }
+ if (ejbClientJar != null) {
+ writer.writeStartElement(prefix, "ejb-client-jar", "http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters(ejbClientJar);
+ writer.writeEndElement();
+ }
+
+ context.afterMarshal(ejbJar, LifecycleCallback.NONE);
+ }
+
+}
Propchange: openejb/trunk/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java
------------------------------------------------------------------------------
svn:eol-style = native