Author: genspring
Date: Sat Jul  2 04:13:58 2011
New Revision: 1142152

URL: http://svn.apache.org/viewvc?rev=1142152&view=rev
Log:
OPENEJB-1619 Support schema validation for Java EE Deployment descriptor, 
Thanks Rex for the patch !

Added:
    
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JavaeeSchema.java
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application-client_6.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application_6.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/connector_1_6.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/ejb-jar_3_1.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/javaee_6.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/javaee_web_services_1_3.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/javaee_web_services_client_1_3.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/javaee_web_services_metadata_handler_2_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/jsp_2_2.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-app_3_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-common_3_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-facelettaglibrary_2_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-facesconfig_2_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-facesuicomponent_2_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-fragment_3_0.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-jsptaglibrary_2_1.xsd
    
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/web-partialresponse_2_0.xsd
Modified:
    
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JaxbJavaee.java

Added: 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JavaeeSchema.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JavaeeSchema.java?rev=1142152&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JavaeeSchema.java
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JavaeeSchema.java
 Sat Jul  2 04:13:58 2011
@@ -0,0 +1,36 @@
+/**
+ * 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;
+
+public enum JavaeeSchema {
+    
+    APPLICATION_6("application_6.xsd"),
+    APPLICATION_CLIENT_6("application-client_6.xsd"),
+    WEB_APP_3_0("web-app_3_0.xsd"),
+    EJB_JAR_3_1("ejb-jar_3_1.xsd"),
+    CONNECTOR_1_6("connector_1_6.xsd");
+    
+    private final String schemaFileName;
+    
+    JavaeeSchema(String schemaFileName){
+        this.schemaFileName = schemaFileName;
+    }
+    
+    public String getSchemaFileName() {
+        return schemaFileName;
+    }
+}

Modified: 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JaxbJavaee.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JaxbJavaee.java?rev=1142152&r1=1142151&r2=1142152&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JaxbJavaee.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JaxbJavaee.java
 Sat Jul  2 04:13:58 2011
@@ -21,6 +21,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Reader;
+import java.net.URL;
 import java.util.AbstractMap;
 import java.util.HashMap;
 import java.util.Map;
@@ -28,6 +30,7 @@ import java.util.Set;
 import java.util.Stack;
 import java.util.TreeSet;
 
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
@@ -38,12 +41,19 @@ import javax.xml.bind.ValidationEventHan
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
 
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.AttributesImpl;
 import org.xml.sax.helpers.XMLFilterImpl;
 
 /**
@@ -92,11 +102,11 @@ public class JaxbJavaee {
      * @throws JAXBException if the xml cannot be marshalled into a T.
      */
     public static <T>Object unmarshalJavaee(Class<T> type, InputStream in) 
throws ParserConfigurationException, SAXException, JAXBException {
-        InputSource inputSource = new InputSource(in);
-
+        
         SAXParserFactory factory = SAXParserFactory.newInstance();
         factory.setNamespaceAware(true);
         factory.setValidating(false);
+        
         SAXParser parser = factory.newSAXParser();
 
         JAXBContext ctx = JaxbJavaee.getContext(type);
@@ -108,12 +118,12 @@ public class JaxbJavaee {
             }
         });
 
-
         JavaeeNamespaceFilter xmlFilter = new 
JavaeeNamespaceFilter(parser.getXMLReader());
         xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
-
-        SAXSource source = new SAXSource(xmlFilter, inputSource);
-
+        
+        // unmarshall
+        SAXSource source = new SAXSource(xmlFilter, new InputSource(in));
+        
         currentPublicId.set(new TreeSet<String>());
         try {
             JAXBElement<T> element = unmarshaller.unmarshal(source, type);
@@ -234,7 +244,6 @@ public class JaxbJavaee {
             }
         });
 
-
         JaxbJavaee.HandlerChainsNamespaceFilter xmlFilter = new 
JaxbJavaee.HandlerChainsNamespaceFilter(parser.getXMLReader());
         xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
         HandlerChainsStringQNameAdapter adapter = new 
HandlerChainsStringQNameAdapter();
@@ -277,6 +286,7 @@ public class JaxbJavaee {
             super.endElement("http://java.sun.com/xml/ns/javaee";, localName, 
qName);
         }
     }
+    
     public static class NoSourceFilter extends XMLFilterImpl {
         private static final InputSource EMPTY_INPUT_SOURCE = new 
InputSource(new ByteArrayInputStream(new byte[0]));
 
@@ -395,4 +405,269 @@ public class JaxbJavaee {
             super.endElement("http://java.sun.com/xml/ns/javaee";, localName, 
qName);
         }
     }
+
+    public static class Javaee6SchemaFilter extends XMLFilterImpl {
+        private static final InputSource EMPTY_INPUT_SOURCE = new 
InputSource(new ByteArrayInputStream(new byte[0]));
+
+        public Javaee6SchemaFilter(XMLReader xmlReader) {
+            super(xmlReader);
+        }
+
+        @Override
+        public InputSource resolveEntity(String publicId, String systemId) 
throws SAXException, IOException {
+            Set<String> publicIds = currentPublicId.get();
+            if (publicIds != null) {
+                publicIds.add(publicId);
+            }
+            return EMPTY_INPUT_SOURCE;
+        }
+
+        @Override
+        public void startElement(String uri, String localName, String qname, 
Attributes atts) throws SAXException {
+            super.startElement("http://java.sun.com/xml/ns/javaee";, localName, 
qname, fixVersion(localName, atts));
+            
+        }
+
+        private Attributes fixVersion(String localName, Attributes atts){
+            if (localName.equals("web-app") && atts.getIndex("version")!=-1 && 
!atts.getValue(atts.getIndex("version")).equals("3.0")) {
+                AttributesImpl newAtts = new AttributesImpl(atts);
+                newAtts.setValue(newAtts.getIndex("version"), "3.0");
+                return newAtts;
+            } 
+            
+            if (localName.equals("ejb-jar") && atts.getIndex("version")!=-1 && 
!atts.getValue(atts.getIndex("version")).equals("3.1")){
+                AttributesImpl newAtts = new AttributesImpl(atts);
+                newAtts.setValue(newAtts.getIndex("version"), "3.1");
+                return newAtts;
+            } 
+            
+            if (localName.equals("application") && 
atts.getIndex("version")!=-1 && 
!atts.getValue(atts.getIndex("version")).equals("6")){
+                AttributesImpl newAtts = new AttributesImpl(atts);
+                newAtts.setValue(newAtts.getIndex("version"), "3.1");
+                return newAtts;
+            } 
+            
+            if (localName.equals("application-client") && 
atts.getIndex("version")!=-1 && 
!atts.getValue(atts.getIndex("version")).equals("6")){
+                AttributesImpl newAtts = new AttributesImpl(atts);
+                newAtts.setValue(newAtts.getIndex("version"), "3.1");
+                return newAtts;
+            } 
+            
+            if (localName.equals("connector") && atts.getIndex("version")!=-1 
&& !atts.getValue(atts.getIndex("version")).equals("1.6")){
+                AttributesImpl newAtts = new AttributesImpl(atts);
+                newAtts.setValue(newAtts.getIndex("version"), "3.1");
+                return newAtts;
+            } 
+            
+            return atts;
+        }
+        
+        @Override
+        public void endElement(String uri, String localName, String qName) 
throws SAXException {
+            super.endElement("http://java.sun.com/xml/ns/javaee";, localName, 
qName);
+        }
+    }
+    
+
+    /**
+     * validate the inputStream, which should be a Java EE standard deployment 
descriptor against its schema type
+     * Note, this method will use the new Java EE 6 schema to validate the old 
descriptors after changing their namespace and version.
+     * @param type
+     * @param in
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws IOException
+     */
+    public static void validateJavaee(JavaeeSchema type, InputStream in) 
throws ParserConfigurationException, SAXException, IOException {
+        URL javaeeSchemaURL = resolveJavaeeSchemaURL(type);
+        if (javaeeSchemaURL == null) {
+            throw new IllegalArgumentException("Can not find the xsd file 
against type:" + type);
+        }
+        
+        URL xmlSchemaURL = JaxbJavaee.getSchemaURL("xml.xsd");
+        if (xmlSchemaURL == null) {
+            throw new IllegalArgumentException("Can not find the xml.xsd 
file");
+        }
+        
+        // get the parser
+        SAXParserFactory parserfactory = SAXParserFactory.newInstance();
+        parserfactory.setNamespaceAware(true);
+        parserfactory.setValidating(false);
+        SAXParser parser = parserfactory.newSAXParser();
+        
+        // get the xml filter
+        Javaee6SchemaFilter xmlFilter = new 
Javaee6SchemaFilter(parser.getXMLReader());
+        
+        // get the source
+        SAXSource sourceForValidate = new SAXSource(xmlFilter, new 
InputSource(in));
+        
+        // get the schema
+        SchemaFactory schemaFactory = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        
+        JaxbJavaeeSchemaResourceResolver resourceResolver = new 
JaxbJavaeeSchemaResourceResolver();  
+        schemaFactory.setResourceResolver(resourceResolver);  
+        
+        Schema schema = schemaFactory.newSchema(
+                new Source[] {
+                        new StreamSource(xmlSchemaURL.openStream()),
+                        new StreamSource(javaeeSchemaURL.openStream())
+                });
+
+        // validate
+        schema.newValidator().validate(sourceForValidate);
+    }
+    
+    private static URL getSchemaURL(String xsdFileName){
+        return 
JaxbJavaee.class.getClassLoader().getResource("/META-INF/schema/" + 
xsdFileName);
+    }
+    
+    private static URL resolveJavaeeSchemaURL(JavaeeSchema type){
+        URL schemaURL = null;
+        if (type.equals(JavaeeSchema.WEB_APP_3_0)){
+            //will include web-common.xsd, jsp_2_2.xsd, javaee_6.xsd and 
javaee_web_services_client_1_3.xsd
+            schemaURL = 
JaxbJavaee.getSchemaURL(JavaeeSchema.WEB_APP_3_0.getSchemaFileName());
+        } else if (type.equals(JavaeeSchema.EJB_JAR_3_1)) {
+            schemaURL = 
JaxbJavaee.getSchemaURL(JavaeeSchema.EJB_JAR_3_1.getSchemaFileName());
+        } else if (type.equals(JavaeeSchema.APPLICATION_6)) {
+            schemaURL = 
JaxbJavaee.getSchemaURL(JavaeeSchema.APPLICATION_6.getSchemaFileName());
+        } else if (type.equals(JavaeeSchema.APPLICATION_CLIENT_6)) {
+            schemaURL = 
JaxbJavaee.getSchemaURL(JavaeeSchema.APPLICATION_CLIENT_6.getSchemaFileName());
+        } else if (type.equals(JavaeeSchema.CONNECTOR_1_6)) {
+            schemaURL = 
JaxbJavaee.getSchemaURL(JavaeeSchema.CONNECTOR_1_6.getSchemaFileName());
+        }
+        
+        return schemaURL;
+    }
+    
+    static class JaxbJavaeeSchemaResourceResolver implements 
LSResourceResolver {  
+        
+        /**  
+         * Allow the application to resolve external resources.   
+         */
+        public LSInput resolveResource(String type, String namespaceURI, 
String publicId, String systemId, String baseURI) {  
+//            System.out.println("\n>> Resolving "  +  "\n"   
+//                              + "TYPE: "  + type +  "\n"   
+//                              + "NAMESPACE_URI: "  + namespaceURI +  "\n"    
+//                              + "PUBLIC_ID: "  + publicId +  "\n"   
+//                              + "SYSTEM_ID: "  + systemId +  "\n"   
+//                              + "BASE_URI: "  + baseURI +  "\n" );  
+              
+            LSInput lsInput = new LSInputImpl();  
+              
+            // In all Java EE schema xsd files, the <xsd:include 
schemaLocation=../> always reference to a relative path. 
+            // so the systemId here will be the xsd file name.
+            URL schemaURL = JaxbJavaee.getSchemaURL(systemId);
+
+            InputStream is = null;
+            if (schemaURL!=null) {
+                try {
+                    is = schemaURL.openStream();
+                } catch (IOException e) {
+                    //should not happen
+                    throw new RuntimeException(e);
+                }
+            }
+                        
+            lsInput.setSystemId(systemId);  
+            lsInput.setByteStream(is);  
+          
+            return  lsInput;  
+        }  
+        
+        
+        
+        /**  
+         *   
+         * Represents an input source for data  
+         *  
+         */   
+        class LSInputImpl implements LSInput {  
+      
+            private String publicId;  
+            private String systemId;  
+            private String baseURI;  
+            private InputStream byteStream;  
+            private Reader charStream;  
+            private String stringData;  
+            private String encoding;  
+            private boolean certifiedText;  
+            
+            public LSInputImpl() {
+            }
+
+            public LSInputImpl(String publicId, String systemId, InputStream 
byteStream) {
+                this.publicId = publicId;
+                this.systemId = systemId;
+                this.byteStream = byteStream;
+            }
+
+            public String getBaseURI() {
+                return baseURI;
+            }
+
+            public InputStream getByteStream() {
+                return byteStream;
+            }
+
+            public boolean getCertifiedText() {
+                return certifiedText;
+            }
+
+            public Reader getCharacterStream() {
+                return charStream;
+            }
+
+            public String getEncoding() {
+                return encoding;
+            }
+
+            public String getPublicId() {
+                return publicId;
+            }
+
+            public String getStringData() {
+                return stringData;
+            }
+
+            public String getSystemId() {
+                return systemId;
+            }
+
+            public void setBaseURI(String baseURI) {
+                this.baseURI = baseURI;
+            }
+
+            public void setByteStream(InputStream byteStream) {
+                this.byteStream = byteStream;
+            }
+
+            public void setCertifiedText(boolean certifiedText) {
+                this.certifiedText = certifiedText;
+            }
+
+            public void setCharacterStream(Reader characterStream) {
+                this.charStream = characterStream;
+            }
+
+            public void setEncoding(String encoding) {
+                this.encoding = encoding;
+            }
+
+            public void setPublicId(String publicId) {
+                this.publicId = publicId;
+            }
+
+            public void setStringData(String stringData) {
+                this.stringData = stringData;
+            }
+
+            public void setSystemId(String systemId) {
+                this.systemId = systemId;
+            }  
+              
+        }  
+      
+    }  
+
 }
+

Added: 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application-client_6.xsd
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application-client_6.xsd?rev=1142152&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application-client_6.xsd
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application-client_6.xsd
 Sat Jul  2 04:13:58 2011
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema";
+            targetNamespace="http://java.sun.com/xml/ns/javaee";
+            xmlns:javaee="http://java.sun.com/xml/ns/javaee";
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified"
+            version="6">
+  <xsd:annotation>
+    <xsd:documentation>
+
+      DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+      
+      Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
+      
+      The contents of this file are subject to the terms of either the
+      GNU General Public License Version 2 only ("GPL") or the Common
+      Development and Distribution License("CDDL") (collectively, the
+      "License").  You may not use this file except in compliance with
+      the License. You can obtain a copy of the License at
+      https://glassfish.dev.java.net/public/CDDL+GPL.html or
+      glassfish/bootstrap/legal/LICENSE.txt.  See the License for the
+      specific language governing permissions and limitations under the
+      License.
+      
+      When distributing the software, include this License Header
+      Notice in each file and include the License file at
+      glassfish/bootstrap/legal/LICENSE.txt.  Sun designates this
+      particular file as subject to the "Classpath" exception as
+      provided by Sun in the GPL Version 2 section of the License file
+      that accompanied this code.  If applicable, add the following
+      below the License Header, with the fields enclosed by brackets []
+      replaced by your own identifying information:
+      "Portions Copyrighted [year] [name of copyright owner]"
+      
+      Contributor(s):
+      
+      If you wish your version of this file to be governed by only the
+      CDDL or only the GPL Version 2, indicate your decision by adding
+      "[Contributor] elects to include this software in this
+      distribution under the [CDDL or GPL Version 2] license."  If you
+      don't indicate a single choice of license, a recipient has the
+      option to distribute your version of this file under either the
+      CDDL, the GPL Version 2 or to extend the choice of license to its
+      licensees as provided above.  However, if you add GPL Version 2
+      code and therefore, elected the GPL Version 2 license, then the
+      option applies only if the new code is made subject to such
+      option by the copyright holder.
+      
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:annotation>
+    <xsd:documentation>
+      <![CDATA[[
+      This is the XML Schema for the application client 6
+      deployment descriptor.  The deployment descriptor must
+      be named "META-INF/application-client.xml" in the
+      application client's jar file.  All application client
+      deployment descriptors must indicate the application
+      client schema by using the Java EE namespace:
+      
+      http://java.sun.com/xml/ns/javaee
+      
+      and indicate the version of the schema by
+      using the version element as shown below:
+      
+      <application-client xmlns="http://java.sun.com/xml/ns/javaee";
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
+       http://java.sun.com/xml/ns/javaee/application-client_6.xsd";
+      version="6">
+      ...
+      </application-client>
+      
+      The instance documents may indicate the published version of
+      the schema using the xsi:schemaLocation attribute for Java EE
+      namespace with the following location:
+      
+      http://java.sun.com/xml/ns/javaee/application-client_6.xsd
+      
+      ]]>
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:annotation>
+    <xsd:documentation>
+
+      The following conventions apply to all Java EE
+      deployment descriptor elements unless indicated otherwise.
+      
+      - In elements that specify a pathname to a file within the
+      same JAR file, relative filenames (i.e., those not
+      starting with "/") are considered relative to the root of
+      the JAR file's namespace.  Absolute filenames (i.e., those
+      starting with "/") also specify names in the root of the
+      JAR file's namespace.  In general, relative names are
+      preferred.  The exception is .war files where absolute
+      names are preferred for consistency with the Servlet API.
+      
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:include schemaLocation="javaee_6.xsd"/>
+
+
+<!-- **************************************************** -->
+
+  <xsd:element name="application-client"
+               type="javaee:application-clientType">
+    <xsd:annotation>
+      <xsd:documentation>
+
+        The application-client element is the root element of an
+        application client deployment descriptor.  The application
+        client deployment descriptor describes the EJB components
+        and external resources referenced by the application
+        client.
+        
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:unique name="env-entry-name-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The env-entry-name element contains the name of an
+          application client's environment entry.  The name is a JNDI
+          name relative to the java:comp/env context.  The name must
+          be unique within an application client.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:env-entry"/>
+      <xsd:field xpath="javaee:env-entry-name"/>
+    </xsd:unique>
+    <xsd:unique name="ejb-ref-name-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The ejb-ref-name element contains the name of an EJB
+          reference. The EJB reference is an entry in the application
+          client's environment and is relative to the
+          java:comp/env context. The name must be unique within the
+          application client.
+          
+          It is recommended that name is prefixed with "ejb/".
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:ejb-ref"/>
+      <xsd:field xpath="javaee:ejb-ref-name"/>
+    </xsd:unique>
+    <xsd:unique name="res-ref-name-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The res-ref-name element specifies the name of a
+          resource manager connection factory reference.The name
+          is a JNDI name relative to the java:comp/env context.
+          The name must be unique within an application client.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:resource-ref"/>
+      <xsd:field xpath="javaee:res-ref-name"/>
+    </xsd:unique>
+    <xsd:unique name="resource-env-ref-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The resource-env-ref-name element specifies the name of
+          a resource environment reference; its value is the
+          environment entry name used in the application client
+          code. The name is a JNDI name relative to the
+          java:comp/env context and must be unique within an
+          application client.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:resource-env-ref"/>
+      <xsd:field xpath="javaee:resource-env-ref-name"/>
+    </xsd:unique>
+    <xsd:unique name="message-destination-ref-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The message-destination-ref-name element specifies the
+          name of a message destination reference; its value is
+          the message destination reference name used in the
+          application client code. The name is a JNDI name
+          relative to the java:comp/env context and must be unique
+          within an application client.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:message-destination-ref"/>
+      <xsd:field xpath="javaee:message-destination-ref-name"/>
+    </xsd:unique>
+  </xsd:element>
+
+
+<!-- **************************************************** -->
+
+  <xsd:complexType name="application-clientType">
+    <xsd:sequence>
+      <xsd:element name="module-name"
+                   type="javaee:string"
+                   minOccurs="0"/>
+      <xsd:group ref="javaee:descriptionGroup"/>
+      <xsd:element name="env-entry"
+                   type="javaee:env-entryType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="ejb-ref"
+                   type="javaee:ejb-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:group ref="javaee:service-refGroup"/>
+      <xsd:element name="resource-ref"
+                   type="javaee:resource-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="resource-env-ref"
+                   type="javaee:resource-env-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="message-destination-ref"
+                   type="javaee:message-destination-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="persistence-unit-ref"
+                   type="javaee:persistence-unit-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="post-construct"
+                   type="javaee:lifecycle-callbackType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="pre-destroy"
+                   type="javaee:lifecycle-callbackType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="callback-handler"
+                   type="javaee:fully-qualified-classType"
+                   minOccurs="0">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The callback-handler element names a class provided by
+            the application.  The class must have a no args
+            constructor and must implement the
+            javax.security.auth.callback.CallbackHandler
+            interface.  The class will be instantiated by the
+            application client container and used by the container
+            to collect authentication information from the user.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+      <xsd:element name="message-destination"
+                   type="javaee:message-destinationType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="data-source"
+                   type="javaee:data-sourceType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="version"
+                   type="javaee:dewey-versionType"
+                   fixed="6"
+                   use="required">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The required value for the version is 6.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+    </xsd:attribute>
+    <xsd:attribute name="metadata-complete"
+                   type="xsd:boolean">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The metadata-complete attribute defines whether this
+          deployment descriptor and other related deployment
+          descriptors for this module (e.g., web service
+          descriptors) are complete, or whether the class
+          files available to this module and packaged with
+          this application should be examined for annotations
+          that specify deployment information.
+          
+          If metadata-complete is set to "true", the deployment
+          tool must ignore any annotations that specify deployment
+          information, which might be present in the class files
+          of the application.
+          
+          If metadata-complete is not specified or is set to
+          "false", the deployment tool must examine the class
+          files of the application for annotations, as
+          specified by the specifications.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+    </xsd:attribute>
+    <xsd:attribute name="id"
+                   type="xsd:ID"/>
+  </xsd:complexType>
+
+</xsd:schema>

Added: 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application_6.xsd
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application_6.xsd?rev=1142152&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application_6.xsd
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/application_6.xsd
 Sat Jul  2 04:13:58 2011
@@ -0,0 +1,394 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema";
+            targetNamespace="http://java.sun.com/xml/ns/javaee";
+            xmlns:javaee="http://java.sun.com/xml/ns/javaee";
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified"
+            version="6">
+  <xsd:annotation>
+    <xsd:documentation>
+
+      DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+      
+      Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
+      
+      The contents of this file are subject to the terms of either the
+      GNU General Public License Version 2 only ("GPL") or the Common
+      Development and Distribution License("CDDL") (collectively, the
+      "License").  You may not use this file except in compliance with
+      the License. You can obtain a copy of the License at
+      https://glassfish.dev.java.net/public/CDDL+GPL.html or
+      glassfish/bootstrap/legal/LICENSE.txt.  See the License for the
+      specific language governing permissions and limitations under the
+      License.
+      
+      When distributing the software, include this License Header
+      Notice in each file and include the License file at
+      glassfish/bootstrap/legal/LICENSE.txt.  Sun designates this
+      particular file as subject to the "Classpath" exception as
+      provided by Sun in the GPL Version 2 section of the License file
+      that accompanied this code.  If applicable, add the following
+      below the License Header, with the fields enclosed by brackets []
+      replaced by your own identifying information:
+      "Portions Copyrighted [year] [name of copyright owner]"
+      
+      Contributor(s):
+      
+      If you wish your version of this file to be governed by only the
+      CDDL or only the GPL Version 2, indicate your decision by adding
+      "[Contributor] elects to include this software in this
+      distribution under the [CDDL or GPL Version 2] license."  If you
+      don't indicate a single choice of license, a recipient has the
+      option to distribute your version of this file under either the
+      CDDL, the GPL Version 2 or to extend the choice of license to its
+      licensees as provided above.  However, if you add GPL Version 2
+      code and therefore, elected the GPL Version 2 license, then the
+      option applies only if the new code is made subject to such
+      option by the copyright holder.
+      
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:annotation>
+    <xsd:documentation>
+      <![CDATA[[
+      This is the XML Schema for the application 6 deployment
+      descriptor.  The deployment descriptor must be named
+      "META-INF/application.xml" in the application's ear file.
+      All application deployment descriptors must indicate
+      the application schema by using the Java EE namespace:
+      
+      http://java.sun.com/xml/ns/javaee
+      
+      and indicate the version of the schema by
+      using the version element as shown below:
+      
+      <application xmlns="http://java.sun.com/xml/ns/javaee";
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
+       http://java.sun.com/xml/ns/javaee/application_6.xsd";
+      version="6">
+      ...
+      </application>
+      
+      The instance documents may indicate the published version of
+      the schema using the xsi:schemaLocation attribute for Java EE
+      namespace with the following location:
+      
+      http://java.sun.com/xml/ns/javaee/application_6.xsd
+      
+      ]]>
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:annotation>
+    <xsd:documentation>
+
+      The following conventions apply to all Java EE
+      deployment descriptor elements unless indicated otherwise.
+      
+      - In elements that specify a pathname to a file within the
+      same JAR file, relative filenames (i.e., those not
+      starting with "/") are considered relative to the root of
+      the JAR file's namespace.  Absolute filenames (i.e., those
+      starting with "/") also specify names in the root of the
+      JAR file's namespace.  In general, relative names are
+      preferred.  The exception is .war files where absolute
+      names are preferred for consistency with the Servlet API.
+      
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:include schemaLocation="javaee_6.xsd"/>
+
+
+<!-- **************************************************** -->
+
+  <xsd:element name="application"
+               type="javaee:applicationType">
+    <xsd:annotation>
+      <xsd:documentation>
+
+        The application element is the root element of a Java EE
+        application deployment descriptor.
+        
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:unique name="context-root-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The context-root element content must be unique
+          in the ear. 
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:module/javaee:web"/>
+      <xsd:field xpath="javaee:context-root"/>
+    </xsd:unique>
+    <xsd:unique name="security-role-uniqueness">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The security-role-name element content
+          must be unique in the ear.  
+          
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:selector xpath="javaee:security-role"/>
+      <xsd:field xpath="javaee:role-name"/>
+    </xsd:unique>
+  </xsd:element>
+
+
+<!-- **************************************************** -->
+
+  <xsd:complexType name="applicationType">
+    <xsd:annotation>
+      <xsd:documentation>
+
+        The applicationType defines the structure of the
+        application. 
+        
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:sequence>
+      <xsd:element name="application-name"
+                   type="javaee:string"
+                   minOccurs="0"/>
+      <xsd:group ref="javaee:descriptionGroup"/>
+      <xsd:element name="initialize-in-order"
+                   type="javaee:generic-booleanType"
+                   minOccurs="0"
+                   maxOccurs="1">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            If initialize-in-order is true, modules must be initialized
+            in the order they're listed in this deployment descriptor,
+            with the exception of application client modules, which can
+            be initialized in any order.
+            If initialize-in-order is not set or set to false, the order
+            of initialization is unspecified and may be product-dependent.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+      <xsd:element name="module"
+                   type="javaee:moduleType"
+                   maxOccurs="unbounded">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The application deployment descriptor must have one
+            module element for each Java EE module in the
+            application package. A module element is defined 
+            by moduleType definition. 
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+      <xsd:element name="security-role"
+                   type="javaee:security-roleType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="library-directory"
+                   type="javaee:pathType"
+                   minOccurs="0"
+                   maxOccurs="1">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The library-directory element specifies the pathname
+            of a directory within the application package, relative
+            to the top level of the application package.  All files
+            named "*.jar" in this directory must be made available
+            in the class path of all components included in this
+            application package.  If this element isn't specified,
+            the directory named "lib" is searched.  An empty element
+            may be used to disable searching.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+      <xsd:element name="env-entry"
+                   type="javaee:env-entryType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="ejb-ref"
+                   type="javaee:ejb-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="ejb-local-ref"
+                   type="javaee:ejb-local-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:group ref="javaee:service-refGroup"/>
+      <xsd:element name="resource-ref"
+                   type="javaee:resource-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="resource-env-ref"
+                   type="javaee:resource-env-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="message-destination-ref"
+                   type="javaee:message-destination-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="persistence-context-ref"
+                   type="javaee:persistence-context-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="persistence-unit-ref"
+                   type="javaee:persistence-unit-refType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="message-destination"
+                   type="javaee:message-destinationType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+      <xsd:element name="data-source"
+                   type="javaee:data-sourceType"
+                   minOccurs="0"
+                   maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="version"
+                   type="javaee:dewey-versionType"
+                   fixed="6"
+                   use="required">
+      <xsd:annotation>
+        <xsd:documentation>
+
+          The required value for the version is 6.
+          
+        </xsd:documentation>
+      </xsd:annotation>
+    </xsd:attribute>
+    <xsd:attribute name="id"
+                   type="xsd:ID"/>
+  </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+  <xsd:complexType name="moduleType">
+    <xsd:annotation>
+      <xsd:documentation>
+
+        The moduleType defines a single Java EE module and contains a
+        connector, ejb, java, or web element, which indicates the
+        module type and contains a path to the module file, and an
+        optional alt-dd element, which specifies an optional URI to
+        the post-assembly version of the deployment descriptor.
+        
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:sequence>
+      <xsd:choice>
+        <xsd:element name="connector"
+                     type="javaee:pathType">
+          <xsd:annotation>
+            <xsd:documentation>
+
+              The connector element specifies the URI of a
+              resource adapter archive file, relative to the
+              top level of the application package.
+              
+            </xsd:documentation>
+          </xsd:annotation>
+        </xsd:element>
+        <xsd:element name="ejb"
+                     type="javaee:pathType">
+          <xsd:annotation>
+            <xsd:documentation>
+
+              The ejb element specifies the URI of an ejb-jar,
+              relative to the top level of the application
+              package.
+              
+            </xsd:documentation>
+          </xsd:annotation>
+        </xsd:element>
+        <xsd:element name="java"
+                     type="javaee:pathType">
+          <xsd:annotation>
+            <xsd:documentation>
+
+              The java element specifies the URI of a java
+              application client module, relative to the top
+              level of the application package.
+              
+            </xsd:documentation>
+          </xsd:annotation>
+        </xsd:element>
+        <xsd:element name="web"
+                     type="javaee:webType"/>
+      </xsd:choice>
+      <xsd:element name="alt-dd"
+                   type="javaee:pathType"
+                   minOccurs="0">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The alt-dd element specifies an optional URI to the
+            post-assembly version of the deployment descriptor
+            file for a particular Java EE module.  The URI must
+            specify the full pathname of the deployment
+            descriptor file relative to the application's root
+            directory. If alt-dd is not specified, the deployer
+            must read the deployment descriptor from the default
+            location and file name required by the respective
+            component specification.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+    </xsd:sequence>
+    <xsd:attribute name="id"
+                   type="xsd:ID"/>
+  </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+  <xsd:complexType name="webType">
+    <xsd:annotation>
+      <xsd:documentation>
+
+        The webType defines the web-uri and context-root of
+        a web application module.
+        
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:sequence>
+      <xsd:element name="web-uri"
+                   type="javaee:pathType">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The web-uri element specifies the URI of a web
+            application file, relative to the top level of the
+            application package.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+      <xsd:element name="context-root"
+                   type="javaee:string">
+        <xsd:annotation>
+          <xsd:documentation>
+
+            The context-root element specifies the context root
+            of a web application.
+            
+          </xsd:documentation>
+        </xsd:annotation>
+      </xsd:element>
+    </xsd:sequence>
+    <xsd:attribute name="id"
+                   type="xsd:ID"/>
+  </xsd:complexType>
+
+</xsd:schema>

Added: 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd?rev=1142152&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
 Sat Jul  2 04:13:58 2011
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+   <!--
+      JBoss, Home of Professional Open Source Copyright 2008, Red Hat
+      Middleware LLC, and individual contributors by the @authors tag.
+      See the copyright.txt in the distribution for a full listing of
+      individual contributors. Licensed 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.
+   -->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+   elementFormDefault="qualified" 
targetNamespace="http://java.sun.com/xml/ns/javaee";
+   xmlns:javaee="http://java.sun.com/xml/ns/javaee"; version="1.0">
+
+   <xs:annotation>
+      <xs:documentation>
+         Contexts and Dependency Injection (CDI) defines
+         a set of complementary services that help improve the structure
+         of application code. beans.xml is used to enable CDI services
+         for the current bean archive as well as to enable named
+         interceptors, decorators and alternatives for the current bean
+         archive.
+      </xs:documentation>
+   </xs:annotation>
+
+   <xs:element name="beans">
+      <xs:annotation>
+         <xs:documentation>
+            Bean classes of enabled beans must be
+            deployed in bean archives. A library jar, EJB jar,
+            application client jar or rar archive is a bean archive if
+            it has a file named beans.xml in the META-INF directory. The
+            WEB-INF/classes directory of a war is a bean archive if
+            there is a file named beans.xml in the WEB-INF directory of
+            the war. A directory in the JVM classpath is a bean archive
+            if it has a file named beans.xml in the META-INF directory.
+         </xs:documentation>
+      </xs:annotation>
+      <xs:complexType>
+         <xs:all>
+            <xs:element ref="javaee:interceptors" minOccurs="0" />
+            <xs:element ref="javaee:decorators" minOccurs="0" />
+            <xs:element ref="javaee:alternatives" minOccurs="0" />
+         </xs:all>
+      </xs:complexType>
+   </xs:element>
+
+   <xs:element name="interceptors">
+      <xs:annotation>
+         <xs:documentation>
+            By default, a bean archive has no enabled
+            interceptors bound via interceptor bindings. An interceptor
+            must be explicitly enabled by listing its class under the
+            &lt;interceptors&gt; element of the beans.xml file of the
+            bean archive. The order of the interceptor declarations
+            determines the interceptor ordering. Interceptors which
+            occur earlier in the list are called first. If the same
+            class is listed twice under the &lt;interceptors&gt;
+            element, the container automatically detects the problem and
+            treats it as a deployment problem.
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexType>
+         <xs:choice minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="class" type="xs:string">
+               <xs:annotation>
+                  <xs:documentation>
+                     Each child &lt;class&gt; element
+                     must specify the name of an interceptor class. If
+                     there is no class with the specified name, or if
+                     the class with the specified name is not an
+                     interceptor class, the container automatically
+                     detects the problem and treats it as a deployment
+                     problem.
+                  </xs:documentation>
+               </xs:annotation>
+            </xs:element>
+         </xs:choice>
+      </xs:complexType>
+   </xs:element>
+
+   <xs:element name="decorators">
+      <xs:annotation>
+         <xs:documentation>
+            By default, a bean archive has no enabled
+            decorators. A decorator must be explicitly enabled by
+            listing its bean class under the &lt;decorators&gt; element
+            of the beans.xml file of the bean archive. The order of the
+            decorator declarations determines the decorator ordering.
+            Decorators which occur earlier in the list are called first.
+            If the same class is listed twice under the
+            &lt;decorators&gt; element, the container automatically
+            detects the problem and treats it as a deployment problem.
+         </xs:documentation>
+      </xs:annotation>
+      <xs:complexType>
+         <xs:choice minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="class" type="xs:string">
+               <xs:annotation>
+                  <xs:documentation>
+                     Each child &lt;class&gt; element
+                     must specify the name of a decorator class. If
+                     there is no class with the specified name, or if
+                     the class with the specified name is not a
+                     decorator class, the container automatically
+                     detects the problem and treats it as a deployment
+                     problem.
+                  </xs:documentation>
+               </xs:annotation>
+            </xs:element>
+         </xs:choice>
+      </xs:complexType>
+   </xs:element>
+
+   <xs:element name="alternatives">
+      <xs:annotation>
+         <xs:documentation>
+            An alternative is a bean that must be
+            explicitly declared in the beans.xml file if it should be
+            available for lookup, injection or EL resolution. By
+            default, a bean archive has no selected alternatives. An
+            alternative must be explicitly declared using the
+            &lt;alternatives&gt; element of the beans.xml file of the
+            bean archive. The &lt;alternatives&gt; element contains a
+            list of bean classes and stereotypes. An alternative is
+            selected for the bean archive if either: the alternative is
+            a managed bean or session bean and the bean class of the
+            bean is listed, or the alternative is a producer method,
+            field or resource, and the bean class that declares the
+            method or field is listed, or any @Alternative stereotype of
+            the alternative is listed.
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexType>
+         <xs:choice minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="class" type="xs:string">
+               <xs:annotation>
+                  <xs:documentation>
+                     Each child &lt;class&gt; element
+                     must specify the name of an alternative bean class.
+                     If there is no class with the specified name, or if
+                     the class with the specified name is not an
+                     alternative bean class, the container automatically
+                     detects the problem and treats it as a deployment
+                     problem. If the same class is listed twice under
+                     the &lt;alternatives&gt; element, the container
+                     automatically detects the problem and treats it as
+                     a deployment problem.
+                  </xs:documentation>
+               </xs:annotation>
+            </xs:element>
+
+            <xs:element name="stereotype" type="xs:string">
+               <xs:annotation>
+                  <xs:documentation>
+                     Each child &lt;stereotype&gt;
+                     element must specify the name of an @Alternative
+                     stereotype annotation. If there is no annotation
+                     with the specified name, or the annotation is not
+                     an @Alternative stereotype, the container
+                     automatically detects the problem and treats it as
+                     a deployment problem. If the same stereotype is
+                     listed twice under the &lt;alternatives&gt;
+                     element, the container automatically detects the
+                     problem and treats it as a deployment problem.
+                  </xs:documentation>
+               </xs:annotation>
+            </xs:element>
+         </xs:choice>
+      </xs:complexType>
+   </xs:element>
+
+</xs:schema>


Reply via email to