You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/08/10 15:59:10 UTC

svn commit: r1617107 - in /tomee/tomee/trunk/container/openejb-jee/src: main/java/org/apache/openejb/jee/ main/resources/META-INF/schema/ main/xsdlist/ test/java/org/apache/openejb/jee/cdi/

Author: rmannibucau
Date: Sun Aug 10 13:59:10 2014
New Revision: 1617107

URL: http://svn.apache.org/r1617107
Log:
adding cdi 1.1 descriptor model

Added:
    tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_1.xsd
      - copied, changed from r1616823, tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
    tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/
    tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/BeansTest.java
Removed:
    tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd
Modified:
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
    tomee/tomee/trunk/container/openejb-jee/src/main/xsdlist/xsdlist.txt

Modified: tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java?rev=1617107&r1=1617106&r2=1617107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java (original)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java Sun Aug 10 13:59:10 2014
@@ -18,14 +18,21 @@ package org.apache.openejb.jee;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.net.URL;
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -53,6 +60,8 @@ import java.util.List;
 })
 @XmlRootElement(name = "beans")
 public class Beans {
+    private static final URL DEFAULT_URL = null;
+
     @XmlTransient
     protected List<String> duplicatedInterceptors;
 
@@ -63,7 +72,7 @@ public class Beans {
     protected Alternatives duplicatedAlternatives;
 
     @XmlTransient
-    private final List<String> managedClasses = new ArrayList<String>();
+    private final Map<URL, List<String>> managedClasses = new HashMap<>();
 
     @XmlElementWrapper(name = "interceptors")
     @XmlElement(name = "class")
@@ -75,21 +84,72 @@ public class Beans {
 
     protected Alternatives alternatives;
 
-    public List<String> getManagedClasses() {
+    @XmlAttribute(name = "version")
+    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+    protected String version;
+
+    @XmlAttribute(name = "bean-discovery-mode", required = true)
+    protected String beanDiscoveryMode;
+
+    @XmlElement
+    protected Scan scan;
+
+    public Scan getScan() {
+        if (scan == null) {
+            scan = new Scan();
+        }
+        return scan;
+    }
+
+    public void setScan(Scan scan) {
+        this.scan = scan;
+    }
+
+    public String getVersion() {
+        if (version == null) {
+            return "1.1";
+        }
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+
+    public String getBeanDiscoveryMode() {
+        return beanDiscoveryMode;
+    }
+
+    public void setBeanDiscoveryMode(final String beanDiscoveryMode) {
+        this.beanDiscoveryMode = beanDiscoveryMode;
+    }
+
+    public void addManagedClass(final URL url, final String clazz) {
+        List<String> list = managedClasses.get(url);
+        if (list == null) {
+            list = new LinkedList<>();
+            managedClasses.put(url, list);
+        }
+        list.add(clazz);
+    }
+
+    public Map<URL, List<String>> getManagedClasses() {
         return managedClasses;
     }
 
+    @Deprecated
     public void addManagedClass(final String className) {
-        managedClasses.add(className);
+        addManagedClass(DEFAULT_URL, className);
     }
 
+    @Deprecated
     public void addManagedClass(final Class clazz) {
         addManagedClass(clazz.getName());
     }
 
     public List<String> getInterceptors() {
         if (interceptors == null) {
-            interceptors = new ArrayList<String>();
+            interceptors = new ArrayList<>();
         }
         return interceptors;
     }
@@ -104,7 +164,7 @@ public class Beans {
 
     public List<String> getDecorators() {
         if (decorators == null) {
-            decorators = new ArrayList<String>();
+            decorators = new ArrayList<>();
         }
         return decorators;
     }
@@ -189,29 +249,115 @@ public class Beans {
 
         public List<String> getClasses() {
             if (classes == null) {
-                classes = new ArrayList<String>();
+                classes = new ArrayList<>();
             }
             return classes;
         }
 
         public List<String> getStereotypes() {
             if (stereotypes == null) {
-                stereotypes = new ArrayList<String>();
+                stereotypes = new ArrayList<>();
             }
             return stereotypes;
         }
     }
 
+    @XmlAccessorType(XmlAccessType.FIELD)
+    @XmlRootElement(name = "scan")
+    public static class Scan {
+        protected List<Scan.Exclude> exclude;
+
+        public List<Scan.Exclude> getExclude() {
+            if (exclude == null) {
+                exclude = new ArrayList<>();
+            }
+            return this.exclude;
+        }
+
+        @XmlAccessorType(XmlAccessType.FIELD)
+        public static class Exclude {
+            @XmlElements({
+                    @XmlElement(name = "if-class-available", type = IfAvailableClassCondition.class),
+                    @XmlElement(name = "if-class-not-available", type = IfNotAvailableClassCondition.class),
+                    @XmlElement(name = "if-system-property", type = IfSystemProperty.class)
+            })
+            protected List<Object> ifClassAvailableOrIfClassNotAvailableOrIfSystemProperty;
+
+            @XmlAttribute(name = "name", required = true)
+            protected String name;
+
+            public List<Object> getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty() {
+                if (ifClassAvailableOrIfClassNotAvailableOrIfSystemProperty == null) {
+                    ifClassAvailableOrIfClassNotAvailableOrIfSystemProperty = new ArrayList<>();
+                }
+                return this.ifClassAvailableOrIfClassNotAvailableOrIfSystemProperty;
+            }
+
+            public String getName() {
+                return name;
+            }
+
+            public void setName(String value) {
+                this.name = value;
+            }
+
+            public static class IfAvailableClassCondition extends ClassCondition {
+            }
+
+            public static class IfNotAvailableClassCondition extends ClassCondition {
+            }
+
+            @XmlAccessorType(XmlAccessType.FIELD)
+            public static class ClassCondition {
+                @XmlAttribute(name = "name", required = true)
+                protected String name;
+
+                public String getName() {
+                    return name;
+                }
+
+                public void setName(String value) {
+                    this.name = value;
+                }
+            }
+
+            @XmlAccessorType(XmlAccessType.FIELD)
+            public static class IfSystemProperty {
+                @XmlAttribute(name = "name", required = true)
+                protected String name;
+
+                @XmlAttribute(name = "value")
+                protected String value;
+
+                public String getName() {
+                    return name;
+                }
+
+                public void setName(String value) {
+                    this.name = value;
+                }
+
+                public String getValue() {
+                    return value;
+                }
+
+                public void setValue(String value) {
+                    this.value = value;
+                }
+            }
+        }
+    }
+
     public List<String> getDuplicatedInterceptors() {
         if (duplicatedInterceptors == null) {
-            duplicatedInterceptors = new ArrayList<String>();
+            duplicatedInterceptors = new ArrayList<>();
         }
         return duplicatedInterceptors;
     }
 
     public List<String> getDuplicatedDecorators() {
         if (duplicatedDecorators == null) {
-            duplicatedDecorators = new ArrayList<String>();
+            duplicatedDecorators = new ArrayList<>();
         }
         return duplicatedDecorators;
     }
@@ -232,7 +378,7 @@ public class Beans {
 
     private <T> void removeDuplicates(final List<T> list) {
         // don't use a set to keep order
-        final List<T> classes = new ArrayList<T>();
+        final List<T> classes = new ArrayList<>();
         for (final T t : list) {
             if (!classes.contains(t)) {
                 classes.add(t);

Copied: tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_1.xsd (from r1616823, tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd)
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_1.xsd?p2=tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_1.xsd&p1=tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd&r1=1616823&r2=1617107&rev=1617107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_0.xsd (original)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/resources/META-INF/schema/beans_1_1.xsd Sun Aug 10 13:59:10 2014
@@ -1,180 +1,355 @@
 <?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.
-   -->
+<!--
+   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">
+           elementFormDefault="qualified"
+           targetNamespace="http://xmlns.jcp.org/xml/ns/javaee"
+           xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
+           version="1.1">
 
-   <xs:annotation>
-      <xs:documentation>
+  <xs:annotation>
+    <xs:documentation>
+      <![CDATA[[
          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.
+         
+
+         This is the XML Schema for the beans.xml deployment
+         descriptor for CDI 1.1.  The deployment descriptor must be named
+         "META-INF/beans.xml" or "WEB-INF/beans.xml" in a war file.
+         All application deployment descriptors may indicate
+         the application schema by using the Java EE namespace:
+
+         http://xmlns.jcp.org/xml/ns/javaee
+
+         and may indicate the version of the schema by
+         using the version element as shown below:
+
+         <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+         http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+         version="1.1">
+            ...
+         </beans>
+
+        The deployment descriptor may indicate the published version of
+        the schema using the xsi:schemaLocation attribute for the Java EE
+        namespace with the following location:
+
+        http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd
+
+     ]]>
+    </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:annotation>
+    <xs:complexType>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="javaee:interceptors" />
+        <xs:element ref="javaee:decorators" />
+        <xs:element ref="javaee:alternatives" />
+        <xs:element ref="javaee:scan" />
+        <xs:any namespace="##other" processContents="lax"/>
+      </xs:choice>
+      <xs:attribute name="version" default="1.1">
+        <xs:annotation>
+          <xs:documentation>
+            The version of CDI this beans.xml is for. If the version is "1.1" (or
+            later), then the attribute bean-discovery-mode must be added.
+          </xs:documentation>
+        </xs:annotation>
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:pattern value="\.?[0-9]+(\.[0-9]+)*"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="bean-discovery-mode" use="required">
+        <xs:annotation>
+          <xs:documentation>
+            It is strongly recommended you use "annotated".
+
+            If the bean discovery mode is "all", then all types in this
+            archive will be considered. If the bean discovery mode is
+            "annotated", then only those types with bean defining annotations will be
+            considered. If the bean discovery mode is "none", then no
+            types will be considered.
+          </xs:documentation>
+        </xs:annotation>
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="annotated">
+              <xs:annotation>
+                <xs:documentation>
+                  Only those types with bean defining annotations will be
+                  considered.
+                </xs:documentation>
+              </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="all">
+              <xs:annotation>
+                <xs:documentation>
+                  All types in this archive will be considered.
+                </xs:documentation>
+              </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="none">
+              <xs:annotation>
+                <xs:documentation>
+                  This archive will be ignored.
+                </xs:documentation>
+              </xs:annotation>
+            </xs:enumeration>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
 
-   <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:element name="scan">
+    <xs:annotation>
+      <xs:documentation>
+        <![CDATA[The <scan> element allows exclusion of classes and packages from consideration. Various filters may be applied, and may be conditionally activated.]]>
+      </xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:sequence maxOccurs="unbounded" minOccurs="0">
+        <xs:element name="exclude">
+          <xs:annotation>
+            <xs:documentation>
+              <![CDATA[The exclude filter allows exclusion of classes and packages through the use of Ant-style glob matches. For example, <exclude name="com.acme.**"> would exclude all classes and subpackages of com.acme.]]>
+            </xs:documentation>
+          </xs:annotation>
+          <xs:complexType>
+            <xs:choice maxOccurs="unbounded" minOccurs="0">
+              <xs:element name="if-class-available">
+                <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.
+                    <![CDATA[Activates the filter only if the class specified can be loaded.]]>
                   </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:annotation>
+                <xs:complexType>
+                  <xs:attribute name="name" type="xs:string" use="required">
+                    <xs:annotation>
+                      <xs:documentation>
+                        <![CDATA[If the named class can be loaded then, then the filter will be activated.]]>
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+              <xs:element name="if-class-not-available">
+                <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.
+                    <![CDATA[Activates the filter only if the class specified cannot be loaded.]]>
                   </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:annotation>
+                <xs:complexType>
+                  <xs:attribute name="name" type="xs:string" use="required">
+                    <xs:annotation>
+                      <xs:documentation>
+                        <![CDATA[If the named class cannot be loaded then, then the filter will be activated.]]>
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+              <xs:element name="if-system-property">
+                <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.
+                    <![CDATA[If both name and value are specified, then the named system property must be set, and have the specified value for the filter to be activated. If only the name is specified, then the named system property must be set for the filter to be activated.]]>
                   </xs:documentation>
-               </xs:annotation>
-            </xs:element>
+                </xs:annotation>
+                <xs:complexType>
+                  <xs:attribute name="name" type="xs:string" use="required">
+                    <xs:annotation>
+                      <xs:documentation>
+                        <![CDATA[The name of the system property that must be set for the filter to be active.]]>
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                  <xs:attribute name="value" type="xs:string" use="optional">
+                    <xs:annotation>
+                      <xs:documentation>
+                        <![CDATA[Optional. The value that the system property must have for the filter to be active.]]>
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+            </xs:choice>
+            <xs:attribute name="name" use="required">
+              <xs:annotation>
+                <xs:documentation>
+                  <![CDATA[The name of the class or package to exclude. Ant-style glob matches are supported. For example, <exclude name="com.acme.**"> would exclude all classes and subpackages of com.acme.]]>
+                </xs:documentation>
+              </xs:annotation>
+              <xs:simpleType>
+                <xs:restriction base="xs:string">
+                  <xs:pattern value="([a-zA-Z_$][a-zA-Z\d_$]*\.)*([a-zA-Z_$][a-zA-Z\d_$]*|\*|\*\*)" />
+                </xs:restriction>
+              </xs:simpleType>
+            </xs:attribute>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </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: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>

Modified: tomee/tomee/trunk/container/openejb-jee/src/main/xsdlist/xsdlist.txt
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/xsdlist/xsdlist.txt?rev=1617107&r1=1617106&r2=1617107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/xsdlist/xsdlist.txt (original)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/xsdlist/xsdlist.txt Sun Aug 10 13:59:10 2014
@@ -1,6 +1,6 @@
 http://java.sun.com/xml/ns/javaee/application_6.xsd
 http://java.sun.com/xml/ns/javaee/application-client_6.xsd
-http://java.sun.com/xml/ns/javaee/beans_1_0.xsd
+http://java.sun.com/xml/ns/javaee/beans_1_1.xsd
 http://java.sun.com/xml/ns/javaee/connector_1_6.xsd
 http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd
 http://java.sun.com/xml/ns/javaee/javaee_6.xsd

Added: tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/BeansTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/BeansTest.java?rev=1617107&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/BeansTest.java (added)
+++ tomee/tomee/trunk/container/openejb-jee/src/test/java/org/apache/openejb/jee/cdi/BeansTest.java Sun Aug 10 13:59:10 2014
@@ -0,0 +1,134 @@
+/**
+ * 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.cdi;
+
+import org.apache.openejb.jee.Beans;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class BeansTest {
+    @Test
+    public void readEmpty10() throws JAXBException, SAXException, ParserConfigurationException {
+        final Beans b = read("<beans xmlns=\"http://java.sun.com/xml/ns/javaee\"\n" +
+                "       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+                "       xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\" />");
+        assertNotNull(b);
+    }
+
+    @Test
+    public void read10() throws Exception {
+        final Beans b = read(
+                "<beans\n" +
+                "   xmlns=\"http://java.sun.com/xml/ns/javaee\"\n" +
+                "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+                "   version=\"1.0\"\n" +
+                "   xsi:schemaLocation=\"\n" +
+                "      http://java.sun.com/xml/ns/javaee\n" +
+                "      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\">\n" +
+                "   <interceptors>\n" +
+                "      <class>org.mycompany.myapp.TransactionInterceptor</class>\n" +
+                "   </interceptors>\n" +
+                "   <alternatives>\n" +
+                "         <stereotype>org.mycompany.myapp.Staging</stereotype>\n" +
+                "   </alternatives>" +
+                "   <decorators>\n" +
+                "      <class>org.mycompany.myfwk.TimestampLogger</class>\n" +
+                "   </decorators>" +
+                "</beans>");
+        assertNotNull(b);
+        assertEquals(1, b.getInterceptors().size());
+        assertEquals("org.mycompany.myapp.TransactionInterceptor", b.getInterceptors().iterator().next());
+        assertEquals(0, b.getAlternativeClasses().size());
+        assertEquals(1, b.getAlternativeStereotypes().size());
+        assertEquals("org.mycompany.myapp.Staging", b.getAlternativeStereotypes().iterator().next());
+        assertEquals(1, b.getDecorators().size());
+        assertEquals("org.mycompany.myfwk.TimestampLogger", b.getDecorators().iterator().next());
+        assertEquals("1.0", b.getVersion());
+    }
+
+    @Test
+    public void read11() throws Exception {
+        final Beans b = read(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+                        "<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\">\n" +
+                        "    <scan>\n" +
+                        "        <exclude name=\"com.acme.swing.**\" />\n" +
+                        "        <exclude name=\"com.acme.gwt.**\">\n" +
+                        "            <if-class-not-available name=\"com.google.GWT\"/>\n" +
+                        "        </exclude>\n" +
+                        "        <exclude name=\"com.acme.verbose.*\">\n" +
+                        "            <if-system-property name=\"verbosity\" value=\"low\"/>\n" +
+                        "        </exclude>\n" +
+                        "        <exclude name=\"com.acme.jsf.**\">\n" +
+                        "            <if-class-available name=\"org.apache.wicket.Wicket\"/>\n" +
+                        "            <if-system-property name=\"viewlayer\"/>\n" +
+                        "        </exclude>\n" +
+                        "    </scan>\n" +
+                        "</beans>");
+        assertNotNull(b);
+        assertEquals("1.1", b.getVersion());
+        assertNotNull(b.getScan());
+        final List<Beans.Scan.Exclude> excludeList = b.getScan().getExclude();
+        assertNotNull(excludeList);
+        assertEquals(4, excludeList.size());
+        for (int i = 0; i < 4; i++) {
+            final Beans.Scan.Exclude exclude = excludeList.get(i);
+            switch (i) {
+                case 0:
+                    assertEquals("com.acme.swing.**", exclude.getName());
+                    assertEquals(0, exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().size());
+                    break;
+                case 1:
+                    assertEquals("com.acme.gwt.**", exclude.getName());
+                    assertEquals(1, exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().size());
+                    assertEquals("com.google.GWT", Beans.Scan.Exclude.IfNotAvailableClassCondition.class.cast(exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().iterator().next()).getName());
+                    break;
+                case 2:
+                    assertEquals("com.acme.verbose.*", exclude.getName());
+                    assertEquals(1, exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().size());
+                    final Beans.Scan.Exclude.IfSystemProperty systemProperty = Beans.Scan.Exclude.IfSystemProperty.class.cast(exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().iterator().next());
+                    assertEquals("verbosity", systemProperty.getName());
+                    assertEquals("low", systemProperty.getValue());
+                    break;
+                case 3:
+                    assertEquals("com.acme.jsf.**", exclude.getName());
+                    assertEquals(2, exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().size());
+                    final Iterator<Object> iterator = exclude.getIfClassAvailableOrIfClassNotAvailableOrIfSystemProperty().iterator();
+                    assertEquals("org.apache.wicket.Wicket", Beans.Scan.Exclude.IfAvailableClassCondition.class.cast(iterator.next()).getName());
+                    final Beans.Scan.Exclude.IfSystemProperty ifSystemProperty = Beans.Scan.Exclude.IfSystemProperty.class.cast(iterator.next());
+                    assertEquals("viewlayer", ifSystemProperty.getName());
+                    assertNull(ifSystemProperty.getValue());
+                    break;
+            }
+        }
+    }
+
+    private Beans read(final String value) throws ParserConfigurationException, SAXException, JAXBException {
+        return (Beans) JaxbJavaee.unmarshalJavaee(Beans.class, new ByteArrayInputStream(value.getBytes()));
+    }
+}