TOMEE-727 - Optimized reading of xml deployment descriptors


git-svn-id: https://svn.apache.org/repos/asf/openejb/trunk@1432340 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/openejb/container/openejb-core/pom.xml b/openejb/container/openejb-core/pom.xml
index 7b1e2e6..2c759ec 100644
--- a/openejb/container/openejb-core/pom.xml
+++ b/openejb/container/openejb-core/pom.xml
@@ -424,6 +424,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-jee-accessors</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-itests-app</artifactId>
       <version>${project.version}</version>
       <scope>test</scope>
diff --git a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
index 1a3eff5..b32fdea 100644
--- a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
+++ b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
@@ -42,8 +42,12 @@
 import org.apache.openejb.assembler.classic.ValidatorBuilder;
 import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.config.sys.Container;
+import org.apache.openejb.config.sys.JaxbOpenejb;
+import org.apache.openejb.config.sys.Openejb;
 import org.apache.openejb.config.sys.Resource;
+import org.apache.openejb.config.sys.Resources;
 import org.apache.openejb.config.sys.ServiceProvider;
+import org.apache.openejb.config.sys.ServicesJar;
 import org.apache.openejb.jee.AdminObject;
 import org.apache.openejb.jee.ApplicationClient;
 import org.apache.openejb.jee.ConfigProperty;
@@ -71,6 +75,7 @@
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.jee.oejb3.PojoDeployment;
 import org.apache.openejb.jpa.integration.MakeTxLookup;
+import org.apache.openejb.loader.IO;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.CircularReferencesException;
 import org.apache.openejb.util.LogCategory;
@@ -81,6 +86,7 @@
 import javax.xml.bind.JAXBException;
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -445,7 +451,8 @@
             // the id generation code in AutoConfig$AppResources
             //
 
-            final Connector connector = connectorModule.getConnector();
+            final Resources config = new Resources();
+            Connector connector = connectorModule.getConnector();
 
             final ConnectorInfo connectorInfo = new ConnectorInfo();
             connectorInfo.description = connector.getDescription();
@@ -472,12 +479,10 @@
                 final String id = this.getId(connectorModule);
                 final String className = resourceAdapter.getResourceAdapterClass();
 
-                final ServiceProvider provider = new ServiceProvider(className, id, "Resource");
-                provider.getTypes().add(className);
+                Resource resource = new Resource(id, className);
+                resource.setType(className);
+                resource.setClassName(className);
 
-                ServiceUtils.registerServiceProvider(appId, provider);
-
-                final Resource resource = new Resource(id, className, appId + "#" + id);
 
                 for (final ConfigProperty property : resourceAdapter.getConfigProperty()) {
                     final String name = property.getConfigPropertyName();
@@ -486,7 +491,9 @@
                         resource.getProperties().setProperty(name, value);
                     }
                 }
-                connectorInfo.resourceAdapter = this.configFactory.configureService(resource, ResourceInfo.class);
+
+                config.getResource().add(resource);
+                connectorInfo.resourceAdapter = configFactory.configureService(resource, ResourceInfo.class);
             }
 
             final OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
@@ -509,16 +516,14 @@
                     final String className = connection.getManagedConnectionFactoryClass();
                     final String type = connection.getConnectionFactoryInterface();
 
-                    final ServiceProvider provider = new ServiceProvider(className, id, "Resource");
-                    provider.getTypes().add(type);
+                    Resource resource = new Resource(id, type);
+                    resource.setType(type);
+                    resource.setClassName(className);
 
-                    ServiceUtils.registerServiceProvider(appId, provider);
-
-                    final Resource resource = new Resource(id, type, appId + "#" + id);
-                    final Properties properties = resource.getProperties();
-                    for (final ConfigProperty property : connection.getConfigProperty()) {
-                        final String name = property.getConfigPropertyName();
-                        final String value = property.getConfigPropertyValue();
+                    Properties properties = resource.getProperties();
+                    for (ConfigProperty property : connection.getConfigProperty()) {
+                        String name = property.getConfigPropertyName();
+                        String value = property.getConfigPropertyValue();
                         if (value != null) {
                             properties.setProperty(name, value);
                         }
@@ -528,7 +533,8 @@
                     	properties.setProperty("ResourceAdapter", connectorInfo.resourceAdapter.id);
                     }
 
-                    final ResourceInfo resourceInfo = this.configFactory.configureService(resource, ResourceInfo.class);
+                    config.getResource().add(resource);
+                    ResourceInfo resourceInfo = configFactory.configureService(resource, ResourceInfo.class);
                     connectorInfo.outbound.add(resourceInfo);
                 }
             }
@@ -545,7 +551,8 @@
                     properties.setProperty("MessageListenerInterface", messageListener.getMessageListenerType());
                     properties.setProperty("ActivationSpecClass", messageListener.getActivationSpec().getActivationSpecClass());
 
-                    final MdbContainerInfo mdbContainerInfo = this.configFactory.configureService(container, MdbContainerInfo.class);
+                    config.getContainer().add(container);
+                    MdbContainerInfo mdbContainerInfo = configFactory.configureService(container, MdbContainerInfo.class);
                     connectorInfo.inbound.add(mdbContainerInfo);
                 }
             }
@@ -556,24 +563,34 @@
                 final String className = adminObject.getAdminObjectClass();
                 final String type = adminObject.getAdminObjectInterface();
 
-                final ServiceProvider provider = new ServiceProvider(className, id, "Resource");
-                provider.getTypes().add(type);
+                Resource resource = new Resource(id, type);
+                resource.setType(type);
+                resource.setClassName(className);
 
-                ServiceUtils.registerServiceProvider(appId, provider);
-
-                final Resource resource = new Resource(id, type, appId + "#" + id);
-                final Properties properties = resource.getProperties();
-                for (final ConfigProperty property : adminObject.getConfigProperty()) {
-                    final String name = property.getConfigPropertyName();
-                    final String value = property.getConfigPropertyValue();
+                Properties properties = resource.getProperties();
+                for (ConfigProperty property : adminObject.getConfigProperty()) {
+                    String name = property.getConfigPropertyName();
+                    String value = property.getConfigPropertyValue();
                     if (value != null) {
                         properties.setProperty(name, value);
                     }
                 }
-                final ResourceInfo resourceInfo = this.configFactory.configureService(resource, ResourceInfo.class);
+
+                config.getResource().add(resource);
+                ResourceInfo resourceInfo = configFactory.configureService(resource, ResourceInfo.class);
                 connectorInfo.adminObject.add(resourceInfo);
             }
 
+            final File file = new File("/tmp/resources.xml");
+
+            try {
+                final OutputStream write = IO.write(file);
+                JaxbOpenejb.marshal(Resources.class, config, write);
+                write.flush();
+                write.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
             appInfo.connectors.add(connectorInfo);
         }
     }
diff --git a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
index 6b520ef..496e9d7 100644
--- a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
+++ b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
@@ -31,7 +31,6 @@
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.FacesConfig;
 import org.apache.openejb.jee.JavaWsdlMapping;
-import org.apache.openejb.jee.JaxbJavaee;
 import org.apache.openejb.jee.JspConfig;
 import org.apache.openejb.jee.Module;
 import org.apache.openejb.jee.Taglib;
@@ -43,6 +42,7 @@
 import org.apache.openejb.loader.FileUtils;
 import org.apache.openejb.loader.IO;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.sxc.ApplicationXml;
 import org.apache.openejb.util.AnnotationFinder;
 import org.apache.openejb.util.JarExtractor;
 import org.apache.openejb.util.LogCategory;
@@ -54,9 +54,7 @@
 import org.apache.xbean.finder.archive.ClassesArchive;
 import org.apache.xbean.finder.filter.Filter;
 import org.apache.xbean.finder.filter.Filters;
-import org.xml.sax.SAXException;
 
-import javax.xml.bind.JAXBException;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.IOException;
@@ -333,7 +331,8 @@
 
             final Application application;
             if (applicationXmlUrl != null) {
-                application = unmarshal(Application.class, "application.xml", applicationXmlUrl);
+
+                application = unmarshal(applicationXmlUrl);
                 for (final Module module : application.getModule()) {
                     try {
                         if (module.getEjb() != null) {
@@ -1471,17 +1470,11 @@
     }
 
     @SuppressWarnings({"unchecked"})
-    public static <T> T unmarshal(final Class<T> type, final String descriptor, final URL url) throws OpenEJBException {
+    public static Application unmarshal(final URL url) throws OpenEJBException {
         try {
-            return (T) JaxbJavaee.unmarshalJavaee(type, new BufferedInputStream(url.openStream()));
-        } catch (SAXException e) {
-            throw new OpenEJBException("Cannot parse the " + descriptor + " file: " + url.toExternalForm(), e);
-        } catch (JAXBException e) {
-            throw new OpenEJBException("Cannot unmarshall the " + descriptor + " file: " + url.toExternalForm(), e);
-        } catch (IOException e) {
-            throw new OpenEJBException("Cannot read the " + descriptor + " file: " + url.toExternalForm(), e);
+            return ApplicationXml.unmarshal(url);
         } catch (Exception e) {
-            throw new OpenEJBException("Encountered unknown error parsing the " + descriptor + " file: " + url.toExternalForm(), e);
+            throw new OpenEJBException("Encountered error parsing the application.xml file: " + url.toExternalForm(), e);
         }
     }
 
diff --git a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
index 12eeb8d..73697fe 100644
--- a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
+++ b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
@@ -32,6 +32,7 @@
 import org.apache.openejb.loader.IO;
 import org.apache.openejb.loader.Options;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.sxc.EjbJarXml;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
 
@@ -214,7 +215,7 @@
 
             final OutputStream out = IO.write(tempFile);
             try {
-                JaxbJavaee.marshal(EjbJar.class, ejbJar, out);
+                EjbJarXml.marshal(ejbJar, out);
                 logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath());
             } catch (JAXBException e) {
             } finally {
diff --git a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
index c233a71..6a337ca 100644
--- a/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
+++ b/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
@@ -34,6 +34,13 @@
 import org.apache.openejb.jee.oejb3.JaxbOpenejbJar3;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.loader.IO;
+import org.apache.openejb.sxc.ApplicationClientXml;
+import org.apache.openejb.sxc.EjbJarXml;
+import org.apache.openejb.sxc.FacesConfigXml;
+import org.apache.openejb.sxc.HandlerChainsXml;
+import org.apache.openejb.sxc.TldTaglibXml;
+import org.apache.openejb.sxc.WebXml;
+import org.apache.openejb.sxc.WebservicesXml;
 import org.apache.openejb.util.*;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -509,7 +516,7 @@
     public static ApplicationClient readApplicationClient(final URL url) throws OpenEJBException {
         final ApplicationClient applicationClient;
         try {
-            applicationClient = (ApplicationClient) JaxbJavaee.unmarshalJavaee(ApplicationClient.class, IO.read(url));
+            applicationClient = ApplicationClientXml.unmarshal(url);
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the application-client.xml file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
@@ -529,15 +536,13 @@
                 final String id = getId(new ByteArrayInputStream(content.getBytes()));
                 return new EjbJar(id);
             }
-            return (EjbJar) JaxbJavaee.unmarshalJavaee(EjbJar.class, new ByteArrayInputStream(content.getBytes()));
+            return EjbJarXml.unmarshal(new ByteArrayInputStream(content.getBytes()));
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the ejb-jar.xml"); // file: " + url.toExternalForm(), e);
-        } catch (JAXBException e) {
-            throw new OpenEJBException("Cannot unmarshall the ejb-jar.xml"); // file: " + url.toExternalForm(), e);
         } catch (IOException e) {
             throw new OpenEJBException("Cannot read the ejb-jar.xml"); // file: " + url.toExternalForm(), e);
         } catch (Exception e) {
-            throw new OpenEJBException("Encountered unknown error parsing the ejb-jar.xml"); // file: " + url.toExternalForm(), e);
+            throw new OpenEJBException("Encountered error parsing the ejb-jar.xml"); // file: " + url.toExternalForm(), e);
         }
     }
 
@@ -612,9 +617,8 @@
     }
 
     public static Webservices readWebservices(final URL url) throws OpenEJBException {
-        final Webservices webservices;
         try {
-            webservices = (Webservices) JaxbJavaee.unmarshalJavaee(Webservices.class, IO.read(url));
+            return WebservicesXml.unmarshal(url);
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the webservices.xml file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
@@ -624,13 +628,11 @@
         } catch (Exception e) {
             throw new OpenEJBException("Encountered unknown error parsing the webservices.xml file: " + url.toExternalForm(), e);
         }
-        return webservices;
     }
 
     public static HandlerChains readHandlerChains(final URL url) throws OpenEJBException {
-        final HandlerChains handlerChains;
         try {
-            handlerChains = (HandlerChains) JaxbJavaee.unmarshalHandlerChains(HandlerChains.class, IO.read(url));
+            return HandlerChainsXml.unmarshal(url);
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the webservices.xml file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
@@ -640,7 +642,6 @@
         } catch (Exception e) {
             throw new OpenEJBException("Encountered unknown error parsing the webservices.xml file: " + url.toExternalForm(), e);
         }
-        return handlerChains;
     }
 
     public static JavaWsdlMapping readJaxrpcMapping(final URL url) throws OpenEJBException {
@@ -706,7 +707,7 @@
     public static WebApp readWebApp(final URL url) throws OpenEJBException {
         final WebApp webApp;
         try {
-            webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, IO.read(url));
+            webApp = (WebApp) WebXml.unmarshal(url);
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the web.xml file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
@@ -730,9 +731,8 @@
             return taglib;
         }
 
-        final TldTaglib tldTaglib;
         try {
-            tldTaglib = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, IO.read(url));
+            return TldTaglibXml.unmarshal(url);
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the JSP tag library definition file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
@@ -742,7 +742,6 @@
         } catch (Exception e) {
             throw new OpenEJBException("Encountered unknown error parsing the JSP tag library definition file: " + url.toExternalForm(), e);
         }
-        return tldTaglib;
     }
 
     public static FacesConfig readFacesConfig(final URL url) throws OpenEJBException {
@@ -756,7 +755,7 @@
             if (isEmpty(new ByteArrayInputStream(content.getBytes()), "faces-config")) {
                 return new FacesConfig();
             }
-            return (FacesConfig) JaxbJavaee.unmarshalJavaee(FacesConfig.class, new ByteArrayInputStream(content.getBytes()));
+            return FacesConfigXml.unmarshal(new ByteArrayInputStream(content.getBytes()));
         } catch (SAXException e) {
             throw new OpenEJBException("Cannot parse the faces configuration file: " + url.toExternalForm(), e);
         } catch (JAXBException e) {
diff --git a/openejb/container/openejb-jee-accessors/pom.xml b/openejb/container/openejb-jee-accessors/pom.xml
index aac4401..67e82d5 100644
--- a/openejb/container/openejb-jee-accessors/pom.xml
+++ b/openejb/container/openejb-jee-accessors/pom.xml
@@ -48,7 +48,6 @@
       <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-loader</artifactId>
       <version>${project.version}</version>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.openejb</groupId>
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationClientXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationClientXml.java
new file mode 100644
index 0000000..d2c658b
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationClientXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.ApplicationClient;
+import org.apache.openejb.jee.ApplicationClient$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ApplicationClientXml {
+
+    public static ApplicationClient unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new ApplicationClient$JAXB(), inputStream);
+    }
+
+    public static ApplicationClient unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new ApplicationClient$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(ApplicationClient applicationClient, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new ApplicationClient$JAXB(), applicationClient, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationXml.java
new file mode 100644
index 0000000..fb810fa
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/ApplicationXml.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.Application;
+import org.apache.openejb.jee.Application$JAXB;
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.jee.WebApp$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ApplicationXml {
+
+    public static Application unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new Application$JAXB(), inputStream);
+    }
+
+    public static Application unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new Application$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(Application application, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new Application$JAXB(), application, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/FacesConfigXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/FacesConfigXml.java
new file mode 100644
index 0000000..47fde55
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/FacesConfigXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.FacesConfig;
+import org.apache.openejb.jee.FacesConfig$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FacesConfigXml {
+
+    public static FacesConfig unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new FacesConfig$JAXB(), inputStream);
+    }
+
+    public static FacesConfig unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new FacesConfig$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(FacesConfig facesConfig, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new FacesConfig$JAXB(), facesConfig, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/HandlerChainsXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/HandlerChainsXml.java
new file mode 100644
index 0000000..28ad392
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/HandlerChainsXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.HandlerChains;
+import org.apache.openejb.jee.HandlerChains$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HandlerChainsXml {
+
+    public static HandlerChains unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new HandlerChains$JAXB(), inputStream);
+    }
+
+    public static HandlerChains unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new HandlerChains$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(HandlerChains handlerChains, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new HandlerChains$JAXB(), handlerChains, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/TldTaglibXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/TldTaglibXml.java
new file mode 100644
index 0000000..e081715
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/TldTaglibXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.TldTaglib;
+import org.apache.openejb.jee.TldTaglib$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TldTaglibXml {
+
+    public static TldTaglib unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new TldTaglib$JAXB(), inputStream);
+    }
+
+    public static TldTaglib unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new TldTaglib$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(TldTaglib taglib, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new TldTaglib$JAXB(), taglib, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebXml.java
new file mode 100644
index 0000000..b9b969b
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.jee.WebApp$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebXml {
+
+    public static WebApp unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new WebApp$JAXB(), inputStream);
+    }
+
+    public static WebApp unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new WebApp$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(WebApp webApp, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new WebApp$JAXB(), webApp, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebservicesXml.java b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebservicesXml.java
new file mode 100644
index 0000000..7ebd095
--- /dev/null
+++ b/openejb/container/openejb-jee-accessors/src/main/java/org/apache/openejb/sxc/WebservicesXml.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sxc;
+
+import org.apache.openejb.jee.Webservices;
+import org.apache.openejb.jee.Webservices$JAXB;
+import org.apache.openejb.loader.IO;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebservicesXml {
+
+    public static Webservices unmarshal(InputStream inputStream) throws Exception {
+        return Sxc.unmarshalJavaee(new Webservices$JAXB(), inputStream);
+    }
+
+    public static Webservices unmarshal(URL url) throws Exception {
+        final InputStream inputStream = IO.read(url);
+        try {
+            return Sxc.unmarshalJavaee(new Webservices$JAXB(), inputStream);
+        } finally {
+            IO.close(inputStream);
+        }
+    }
+
+    public static void marshal(Webservices webservices, OutputStream outputStream) throws Exception {
+        Sxc.marshal(new Webservices$JAXB(), webservices, new StreamResult(outputStream));
+    }
+}
diff --git a/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Warmup.java b/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Warmup.java
index 62becb9..e3dfcd9 100644
--- a/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Warmup.java
+++ b/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Warmup.java
@@ -157,10 +157,10 @@
 
         final ClassLoader loader = Warmup.class.getClassLoader();
 
-        final JaxbJavaeeLoad jaxbJavaeeLoad = new JaxbJavaeeLoad(WebApp.class);
-        final Thread jaxb = new Thread(jaxbJavaeeLoad);
-        jaxb.setDaemon(true);
-        jaxb.start();
+//        final JaxbJavaeeLoad jaxbJavaeeLoad = new JaxbJavaeeLoad(WebApp.class);
+//        final Thread jaxb = new Thread(jaxbJavaeeLoad);
+//        jaxb.setDaemon(true);
+//        jaxb.start();
 
         try { // see org.apache.openejb.Core
             Class.forName("org.apache.openejb.util.Logger", true, loader);
@@ -214,27 +214,27 @@
         try {
             semaphore.acquire(permits);
             tld.join();
-            jaxb.join();
+//            jaxb.join();
         } catch (InterruptedException e) {
             Thread.interrupted();
         }
     }
 
 
-    private static class JaxbJavaeeLoad implements Runnable {
-
-        private final Class<?> type;
-
-        private JaxbJavaeeLoad(Class<?> type) {
-            this.type = type;
-        }
-
-        @Override
-        public void run() {
-            try {
-                JaxbJavaee.getContext(type);
-            } catch (JAXBException e) {
-            }
-        }
-    }
+//    private static class JaxbJavaeeLoad implements Runnable {
+//
+//        private final Class<?> type;
+//
+//        private JaxbJavaeeLoad(Class<?> type) {
+//            this.type = type;
+//        }
+//
+//        @Override
+//        public void run() {
+//            try {
+//                JaxbJavaee.getContext(type);
+//            } catch (JAXBException e) {
+//            }
+//        }
+//    }
 }