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/07/29 21:26:10 UTC

svn commit: r1614468 [1/3] - in /tomee/tomee/trunk: ./ container/openejb-core/ container/openejb-core/src/main/java/org/apache/openejb/ container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/...

Author: rmannibucau
Date: Tue Jul 29 19:26:09 2014
New Revision: 1614468

URL: http://svn.apache.org/r1614468
Log:
make trunk really unstable with a bunch of snapshot but at least bval-embedded passes (all others should be broken == work in progress)

Added:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidatorFactory.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/Adapter1.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/AnnotationType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/BeanType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ClassType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ConstraintDefinitionType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ConstraintMappingsType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ConstraintType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ConstructorType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/CrossParameterType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/DefaultValidatedExecutableTypesType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ElementType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ExecutableValidationType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/FieldType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/GetterType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/GroupConversionType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/GroupSequenceType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/GroupsType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/MethodType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ObjectFactory.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ParameterType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/PayloadType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/PropertyType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ReturnValueType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ValidatedByType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ValidationConfigType.java
    tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/package-info.java
    tomee/tomee/trunk/tck/bval-embedded/src/test/resources/dev.xml
      - copied, changed from r1613793, tomee/tomee/trunk/tck/bval-embedded/src/test/resources/jsr303-tck-suite.xml
Removed:
    tomee/tomee/trunk/tck/bval-embedded/src/test/resources/META-INF/
    tomee/tomee/trunk/tck/bval-embedded/src/test/resources/jsr303-tck-suite.xml
Modified:
    tomee/tomee/trunk/container/openejb-core/pom.xml
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidator.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidationInfo.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBTransactionService.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java
    tomee/tomee/trunk/container/openejb-core/src/test/java/org/apache/openejb/DeploymentContextOptionsTest.java
    tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/LocalClientRunner.java
    tomee/tomee/trunk/pom.xml
    tomee/tomee/trunk/tck/bval-embedded/pom.xml
    tomee/tomee/trunk/tck/bval-tomee/pom.xml

Modified: tomee/tomee/trunk/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/pom.xml?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/pom.xml (original)
+++ tomee/tomee/trunk/container/openejb-core/pom.xml Tue Jul 29 19:26:09 2014
@@ -121,8 +121,8 @@
       org.apache.activemq.store;resolution:=optional;version="[5.8,6.0)",
       org.apache.activemq.store.jdbc;resolution:=optional;version="[5.8,6.0)",
       org.apache.activemq.store.memory;resolution:=optional;version="[5.8,6.0)",
-      org.apache.bval.jsr303;resolution:=optional,
-      org.apache.bval.jsr303.resolver;resolution:=optional,
+      org.apache.bval.jsr;resolution:=optional,
+      org.apache.bval.jsr.resolver;resolution:=optional,
       org.apache.commons.beanutils,
       org.apache.commons.cli;version="[1.2,2)",
       org.apache.commons.dbcp;resolution:=optional;version="[1.4,2)",
@@ -666,7 +666,7 @@
 
     <dependency>
       <groupId>org.apache.bval</groupId>
-      <artifactId>bval-jsr303</artifactId>
+      <artifactId>bval-jsr</artifactId>
     </dependency>
 
     <dependency> <!-- licence apache, only 110ko -->

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java Tue Jul 29 19:26:09 2014
@@ -1618,7 +1618,8 @@ public class BeanContext extends Deploym
                             CreationalContextImpl.class.cast(creationalContext).putDelegate(beanInstance);
                             final Object decoratorInstance = decorator.create(CreationalContext.class.cast(creationalContext));
                             instances.put(decorator, decoratorInstance);
-                            beanInstance = pf.createProxyInstance(proxyClass, instance, new DecoratorHandler(interceptorInfo, instances, i - 1, instance, cdiEjbBean.getId()));
+                            beanInstance = pf.createProxyInstance(proxyClass, instance,
+                                new DecoratorHandler(interceptorInfo, decorators, instances, i - 1, instance, cdiEjbBean.getId()));
                         }
                     }
                 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Tue Jul 29 19:26:09 2014
@@ -227,7 +227,8 @@ public class Assembler extends Assembler
     public static final String TIMER_STORE_CLASS = "timerStore.class";
     private static final ReentrantLock lock = new ReentrantLock(true);
     public static final String OPENEJB_TIMERS_ON = "openejb.timers.on";
-
+    public static final Class<?>[] VALIDATOR_FACTORY_INTERFACES = new Class<?>[]{ValidatorFactory.class};
+    public static final Class<?>[] VALIDATOR_INTERFACES = new Class<?>[]{Validator.class};
     private final boolean skipLoaderIfPossible;
 
     Messages messages = new Messages(Assembler.class.getPackage().getName());
@@ -715,23 +716,28 @@ public class Assembler extends Assembler
 
             final Context containerSystemContext = containerSystem.getJNDIContext();
 
-            if (!SystemInstance.get().hasProperty("openejb.geronimo")) {
+            final Map<String, LazyValidatorFactory> lazyValidatorFactories = new HashMap<String, LazyValidatorFactory>();
+            final Map<String, LazyValidator> lazyValidators = new HashMap<String, LazyValidator>();
+            final boolean isGeronimo = SystemInstance.get().hasProperty("openejb.geronimo");
+            if (!isGeronimo) {
                 // Bean Validation
                 // ValidatorFactory needs to be put in the map sent to the entity manager factory
                 // so it has to be constructed before
                 final List<CommonInfoObject> vfs = listCommonInfoObjectsForAppInfo(appInfo);
-
                 final Map<String, ValidatorFactory> validatorFactories = new HashMap<String, ValidatorFactory>();
+
                 for (final CommonInfoObject info : vfs) {
                     ValidatorFactory factory = null;
-                    try {
-                        factory = ValidatorBuilder.buildFactory(classLoader, info.validationInfo);
+                    try { // lazy cause of CDI :(
+                        final LazyValidatorFactory handler = new LazyValidatorFactory(classLoader, info.validationInfo);
+                        factory = (ValidatorFactory) Proxy.newProxyInstance(
+                            appContext.getClassLoader(), VALIDATOR_FACTORY_INTERFACES, handler);
+                        lazyValidatorFactories.put(info.uniqueId, handler);
                     } catch (final ValidationException ve) {
                         logger.warning("can't build the validation factory for module " + info.uniqueId, ve);
+                        continue;
                     }
-                    if (factory != null) {
-                        validatorFactories.put(info.uniqueId, factory);
-                    }
+                    validatorFactories.put(info.uniqueId, factory);
                 }
 
                 // validators bindings
@@ -743,9 +749,12 @@ public class Assembler extends Assembler
 
                         Validator validator;
                         try {
-                            validator = factory.usingContext().getValidator();
+                            final LazyValidator lazyValidator = new LazyValidator(factory);
+                            validator = (Validator) Proxy.newProxyInstance(appContext.getClassLoader(), VALIDATOR_INTERFACES, lazyValidator);
+                            lazyValidators.put(id, lazyValidator);
                         } catch (final Exception e) {
-                            validator = (Validator) Proxy.newProxyInstance(appContext.getClassLoader(), new Class<?>[]{Validator.class}, new LazyValidator(factory));
+                            logger.error(e.getMessage(), e);
+                            continue;
                         }
 
                         containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, validator);
@@ -755,6 +764,8 @@ public class Assembler extends Assembler
                         throw new OpenEJBException(e);
                     }
                 }
+
+                validatorFactories.clear();
             }
 
             // JPA - Persistence Units MUST be processed first since they will add ClassFileTransformers
@@ -817,6 +828,28 @@ public class Assembler extends Assembler
                 appContext.getBindings().put("app/BeanManager", appContext.getBeanManager());
             }
 
+            // now cdi is started we can try to bind real validator factory and validator
+            if (!isGeronimo) {
+                for (final Entry<String, LazyValidator> lazyValidator : lazyValidators.entrySet()) {
+                    final String id = lazyValidator.getKey();
+                    final ValidatorFactory factory = lazyValidatorFactories.get(lazyValidator.getKey()).getFactory();
+                    final Validator validator = lazyValidator.getValue().getValidator();
+                    try {
+                        final String factoryName = VALIDATOR_FACTORY_NAMING_CONTEXT + id;
+                        containerSystemContext.unbind(factoryName);
+                        containerSystemContext.bind(factoryName, factory);
+
+                        final String validatoryName = VALIDATOR_NAMING_CONTEXT + id;
+                        containerSystemContext.unbind(validatoryName);
+                        containerSystemContext.bind(validatoryName, validator);
+                    } catch (final NameAlreadyBoundException e) {
+                        throw new OpenEJBException("ValidatorFactory already exists for module " + id, e);
+                    } catch (final Exception e) {
+                        throw new OpenEJBException(e);
+                    }
+                }
+            }
+
             startEjbs(start, allDeployments);
 
             // App Client

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidator.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidator.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidator.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidator.java Tue Jul 29 19:26:09 2014
@@ -20,6 +20,7 @@ package org.apache.openejb.assembler.cla
 import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -35,7 +36,15 @@ public class LazyValidator implements In
 
     @Override
     public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+        ensureDelegate();
+        try {
+            return method.invoke(validator, args);
+        } catch (final InvocationTargetException ite) {
+            throw ite.getCause();
+        }
+    }
 
+    private void ensureDelegate() {
         if (validator == null) {
 
             final ReentrantLock l = lock;
@@ -49,7 +58,10 @@ public class LazyValidator implements In
                 l.unlock();
             }
         }
+    }
 
-        return method.invoke(validator, args);
+    public Validator getValidator() {
+        ensureDelegate();
+        return validator;
     }
 }

Added: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidatorFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidatorFactory.java?rev=1614468&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidatorFactory.java (added)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/LazyValidatorFactory.java Tue Jul 29 19:26:09 2014
@@ -0,0 +1,65 @@
+/*
+ * 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.assembler.classic;
+
+import javax.validation.ValidatorFactory;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.concurrent.locks.ReentrantLock;
+
+// TODO: make it generic (LazyDelegate + Factory + refactor LazyValidator)
+public class LazyValidatorFactory implements InvocationHandler {
+    private final ReentrantLock lock = new ReentrantLock();
+    private final ClassLoader loader;
+    private final ValidationInfo info;
+    private volatile ValidatorFactory factory;
+
+    public LazyValidatorFactory(final ClassLoader classLoader, final ValidationInfo validationInfo) {
+        this.loader = classLoader;
+        this.info = validationInfo;
+    }
+
+    @Override
+    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+        ensureDelegate();
+        try {
+            return method.invoke(factory, args);
+        } catch (final InvocationTargetException ite) {
+            throw ite.getCause();
+        }
+    }
+
+    private void ensureDelegate() {
+        if (factory == null) {
+            final ReentrantLock l = lock;
+            l.lock();
+            try {
+                if (factory == null) {
+                    factory = ValidatorBuilder.buildFactory(loader, info);
+                }
+            } finally {
+                l.unlock();
+            }
+        }
+    }
+
+    public ValidatorFactory getFactory() {
+        ensureDelegate();
+        return factory;
+    }
+}

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidationInfo.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidationInfo.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidationInfo.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidationInfo.java Tue Jul 29 19:26:09 2014
@@ -26,6 +26,10 @@ public class ValidationInfo extends Info
     public String messageInterpolatorClass;
     public String traversableResolverClass;
     public String constraintFactoryClass;
+    public String parameterNameProviderClass;
+    public String version;
     public final Properties propertyTypes = new Properties();
     public final List<String> constraintMappings = new ArrayList<String>();
+    public boolean executableValidationEnabled;
+    public final List<String> validatedTypes = new ArrayList<String>();
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java Tue Jul 29 19:26:09 2014
@@ -17,22 +17,39 @@
 
 package org.apache.openejb.assembler.classic;
 
+import org.apache.openejb.jee.bval.DefaultValidatedExecutableTypesType;
+import org.apache.openejb.jee.bval.ExecutableValidationType;
 import org.apache.openejb.jee.bval.PropertyType;
 import org.apache.openejb.jee.bval.ValidationConfigType;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
 
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.validation.BootstrapConfiguration;
 import javax.validation.Configuration;
 import javax.validation.ConstraintValidatorFactory;
 import javax.validation.MessageInterpolator;
+import javax.validation.ParameterNameProvider;
 import javax.validation.TraversableResolver;
 import javax.validation.Validation;
 import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorContext;
 import javax.validation.ValidatorFactory;
-import javax.xml.bind.JAXBElement;
+import javax.validation.executable.ExecutableType;
 import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.Map;
+import java.util.Set;
 
 public final class ValidatorBuilder {
     public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, ValidatorBuilder.class);
@@ -50,15 +67,28 @@ public final class ValidatorBuilder {
     public static ValidationInfo getInfo(final ValidationConfigType config) {
         final ValidationInfo info = new ValidationInfo();
         if (config != null) {
+            info.version = config.getVersion();
             info.providerClassName = config.getDefaultProvider();
             info.constraintFactoryClass = config.getConstraintValidatorFactory();
             info.traversableResolverClass = config.getTraversableResolver();
             info.messageInterpolatorClass = config.getMessageInterpolator();
+            info.parameterNameProviderClass = config.getParameterNameProvider();
+
+            final ExecutableValidationType executableValidation = config.getExecutableValidation();
+            if (executableValidation != null) {
+                info.executableValidationEnabled = executableValidation.getEnabled();
+                final DefaultValidatedExecutableTypesType executableTypes = executableValidation.getDefaultValidatedExecutableTypes();
+                if (executableTypes != null) {
+                    for (final ExecutableType type : executableTypes.getExecutableType()) {
+                        info.validatedTypes.add(type.name());
+                    }
+                }
+            }
             for (final PropertyType p : config.getProperty()) {
                 info.propertyTypes.put(p.getName(), p.getValue());
             }
-            for (final JAXBElement<String> element : config.getConstraintMapping()) {
-                info.constraintMappings.add(element.getValue());
+            for (final String element : config.getConstraintMapping()) {
+                info.constraintMappings.add(element);
             }
         }
         return info;
@@ -66,9 +96,10 @@ public final class ValidatorBuilder {
 
     public static ValidatorFactory buildFactory(final ValidationInfo config, final ClassLoader classLoader) {
         ValidatorFactory factory = null;
-        final ClassLoader oldContextLoader = Thread.currentThread().getContextClassLoader();
+        final Thread thread = Thread.currentThread();
+        final ClassLoader oldContextLoader = thread.getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(classLoader);
+            thread.setContextClassLoader(classLoader);
             if (config == null) {
                 factory = Validation.buildDefaultValidatorFactory();
             } else {
@@ -76,9 +107,9 @@ public final class ValidatorBuilder {
                 try {
                     factory = configuration.buildValidatorFactory();
                 } catch (final ValidationException ve) {
-                    Thread.currentThread().setContextClassLoader(ValidatorBuilder.class.getClassLoader());
+                    thread.setContextClassLoader(ValidatorBuilder.class.getClassLoader());
                     factory = Validation.buildDefaultValidatorFactory();
-                    Thread.currentThread().setContextClassLoader(classLoader);
+                    thread.setContextClassLoader(classLoader);
 
                     logger.warning("Unable create validator factory with config " + config
                         + " (" + ve.getMessage() + ")."
@@ -86,7 +117,7 @@ public final class ValidatorBuilder {
                 }
             }
         } finally {
-            Thread.currentThread().setContextClassLoader(oldContextLoader);
+            thread.setContextClassLoader(oldContextLoader);
         }
         return factory;
     }
@@ -94,7 +125,8 @@ public final class ValidatorBuilder {
     @SuppressWarnings("unchecked")
     private static Configuration<?> getConfig(final ValidationInfo info) {
         Configuration<?> target = null;
-        final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        final Thread thread = Thread.currentThread();
+        final ClassLoader classLoader = thread.getContextClassLoader();
 
         String providerClassName = info.providerClassName;
         if (providerClassName == null) {
@@ -117,11 +149,35 @@ public final class ValidatorBuilder {
         }
         if (target == null) {
             // force to use container provider to ignore any conflicting configuration
-            Thread.currentThread().setContextClassLoader(ValidatorBuilder.class.getClassLoader());
+            thread.setContextClassLoader(ValidatorBuilder.class.getClassLoader());
             target = Validation.byDefaultProvider().configure();
-            Thread.currentThread().setContextClassLoader(classLoader);
+            thread.setContextClassLoader(classLoader);
+        }
+
+        final Set<ExecutableType> types = new HashSet<>();
+        for (final String type : info.validatedTypes) {
+            types.add(ExecutableType.valueOf(type));
+        }
+
+        final Map<String, String> props = new HashMap<>();
+        for (final Map.Entry<Object, Object> entry : info.propertyTypes.entrySet()) {
+            final PropertyType property = new PropertyType();
+            property.setName((String) entry.getKey());
+            property.setValue((String) entry.getValue());
+
+            props.put(property.getName(), property.getValue());
+            if (logger.isDebugEnabled()) {
+                logger.debug("Found property '" + property.getName() + "' with value '" + property.getValue());
+            }
+            target.addProperty(property.getName(), property.getValue());
         }
 
+        final OpenEjbBootstrapConfig bootstrapConfig = new OpenEjbBootstrapConfig(
+            providerClassName, info.constraintFactoryClass, info.messageInterpolatorClass, info.traversableResolverClass,
+            info.parameterNameProviderClass, new HashSet<>(info.constraintMappings), info.executableValidationEnabled,
+            types, props);
+        final OpenEjbConfig config = new OpenEjbConfig(bootstrapConfig, target);
+
         target.ignoreXmlConfiguration();
 
         final String messageInterpolatorClass = info.messageInterpolatorClass;
@@ -129,7 +185,7 @@ public final class ValidatorBuilder {
             try {
                 @SuppressWarnings("unchecked") final
                 Class<MessageInterpolator> clazz = (Class<MessageInterpolator>) classLoader.loadClass(messageInterpolatorClass);
-                target.messageInterpolator(clazz.newInstance());
+                target.messageInterpolator(newInstance(config, clazz));
             } catch (final Exception e) {
                 logger.warning("Unable to set " + messageInterpolatorClass + " as message interpolator.", e);
             }
@@ -140,7 +196,7 @@ public final class ValidatorBuilder {
             try {
                 @SuppressWarnings("unchecked") final
                 Class<TraversableResolver> clazz = (Class<TraversableResolver>) classLoader.loadClass(traversableResolverClass);
-                target.traversableResolver(clazz.newInstance());
+                target.traversableResolver(newInstance(config, clazz));
             } catch (final Exception e) {
                 logger.warning("Unable to set " + traversableResolverClass + " as traversable resolver.", e);
             }
@@ -151,22 +207,12 @@ public final class ValidatorBuilder {
             try {
                 @SuppressWarnings("unchecked") final
                 Class<ConstraintValidatorFactory> clazz = (Class<ConstraintValidatorFactory>) classLoader.loadClass(constraintFactoryClass);
-                target.constraintValidatorFactory(clazz.newInstance());
+                target.constraintValidatorFactory(newInstance(config, clazz));
             } catch (final Exception e) {
                 logger.warning("Unable to set " + constraintFactoryClass + " as constraint factory.", e);
             }
             logger.info("Using " + constraintFactoryClass + " as constraint factory.");
         }
-        for (final Map.Entry<Object, Object> entry : info.propertyTypes.entrySet()) {
-            final PropertyType property = new PropertyType();
-            property.setName((String) entry.getKey());
-            property.setValue((String) entry.getValue());
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("Found property '" + property.getName() + "' with value '" + property.getValue());
-            }
-            target.addProperty(property.getName(), property.getValue());
-        }
         for (final String mappingFileName : info.constraintMappings) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Opening input stream for " + mappingFileName);
@@ -178,7 +224,273 @@ public final class ValidatorBuilder {
                 target.addMapping(in);
             }
         }
+        if (info.parameterNameProviderClass != null) {
+            try {
+                final Class<ParameterNameProvider> clazz = (Class<ParameterNameProvider>) classLoader.loadClass(info.parameterNameProviderClass);
+                target.parameterNameProvider(newInstance(config, clazz));
+            } catch (final Exception e) {
+                logger.warning("Unable to set " + info.parameterNameProviderClass + " as parameter name provider.", e);
+            }
+            logger.info("Using " + info.parameterNameProviderClass + " as parameter name provider.");
+        }
+
+        return config;
+    }
+
+    private static <T> T newInstance(final OpenEjbConfig config, final Class<T> clazz) throws Exception {
+        final WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+        if (webBeansContext == null) {
+            return clazz.newInstance();
+        }
+
+        final BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+        if (!beanManager.isInUse()) {
+            return clazz.newInstance();
+        }
+
+        final AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(clazz);
+        final InjectionTarget<T> it = beanManager.createInjectionTarget(annotatedType);
+        final CreationalContext<T> context = beanManager.createCreationalContext(null);
+        final T instance = it.produce(context);
+        it.inject(instance, context);
+        it.postConstruct(instance);
+
+        config.releasables.add(new Releasable<T>(context, it, instance));
+
+        return instance;
+    }
+
+    private static final class OpenEjbBootstrapConfig implements BootstrapConfiguration, Serializable {
+        private final String providerClassName;
+        private final String constraintFactoryClass;
+        private final String messageInterpolatorClass;
+        private final String traversableResolverClass;
+        private final String parameterNameProviderClass;
+        private final Set<String> constraintMappings;
+        private final boolean executableValidationEnabled;
+        private final Set<ExecutableType> validatedTypes;
+        private final Map<String, String> props;
+
+        public OpenEjbBootstrapConfig(final String providerClassName,
+                                      final String constraintFactoryClass,
+                                      final String messageInterpolatorClass,
+                                      final String traversableResolverClass,
+                                      final String parameterNameProviderClass,
+                                      final Set<String> constraintMappings,
+                                      final boolean executableValidationEnabled,
+                                      final Set<ExecutableType> validatedTypes,
+                                      final Map<String, String> props) {
+            this.providerClassName = providerClassName;
+            this.constraintFactoryClass = constraintFactoryClass;
+            this.messageInterpolatorClass = messageInterpolatorClass;
+            this.traversableResolverClass = traversableResolverClass;
+            this.parameterNameProviderClass = parameterNameProviderClass;
+            this.constraintMappings = constraintMappings;
+            this.executableValidationEnabled = executableValidationEnabled;
+            this.validatedTypes = validatedTypes;
+            this.props = props;
+        }
+
+        @Override
+        public String getDefaultProviderClassName() {
+            return providerClassName;
+        }
 
-        return target;
+        @Override
+        public String getConstraintValidatorFactoryClassName() {
+            return constraintFactoryClass;
+        }
+
+        @Override
+        public String getMessageInterpolatorClassName() {
+            return messageInterpolatorClass;
+        }
+
+        @Override
+        public String getTraversableResolverClassName() {
+            return traversableResolverClass;
+        }
+
+        @Override
+        public String getParameterNameProviderClassName() {
+            return parameterNameProviderClass;
+        }
+
+        @Override
+        public Set<String> getConstraintMappingResourcePaths() {
+            return constraintMappings;
+        }
+
+        @Override
+        public boolean isExecutableValidationEnabled() {
+            return executableValidationEnabled;
+        }
+
+        @Override
+        public Set<ExecutableType> getDefaultValidatedExecutableTypes() {
+            return validatedTypes;
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            return props;
+        }
+    }
+
+    private static final class OpenEjbConfig<T  extends Configuration<T>> implements Configuration<T> {
+        private final Collection<Releasable<?>> releasables = new LinkedList<>();
+        private final Configuration<T> delegate;
+        private final BootstrapConfiguration bootstrap;
+
+        public OpenEjbConfig(final BootstrapConfiguration bootstrapConfig, final Configuration<T> target) {
+            bootstrap = bootstrapConfig;
+            delegate = target;
+        }
+
+        @Override
+        public T ignoreXmlConfiguration() {
+            return delegate.ignoreXmlConfiguration();
+        }
+
+        @Override
+        public T messageInterpolator(final MessageInterpolator interpolator) {
+            return delegate.messageInterpolator(interpolator);
+        }
+
+        @Override
+        public T traversableResolver(final TraversableResolver resolver) {
+            return delegate.traversableResolver(resolver);
+        }
+
+        @Override
+        public T constraintValidatorFactory(final ConstraintValidatorFactory constraintValidatorFactory) {
+            return delegate.constraintValidatorFactory(constraintValidatorFactory);
+        }
+
+        @Override
+        public T addMapping(final InputStream stream) {
+            return delegate.addMapping(stream);
+        }
+
+        @Override
+        public T addProperty(final String name, final String value) {
+            return delegate.addProperty(name, value);
+        }
+
+        @Override
+        public MessageInterpolator getDefaultMessageInterpolator() {
+            return delegate.getDefaultMessageInterpolator();
+        }
+
+        @Override
+        public TraversableResolver getDefaultTraversableResolver() {
+            return delegate.getDefaultTraversableResolver();
+        }
+
+        @Override
+        public ConstraintValidatorFactory getDefaultConstraintValidatorFactory() {
+            return delegate.getDefaultConstraintValidatorFactory();
+        }
+
+        @Override
+        public ValidatorFactory buildValidatorFactory() {
+            return new OpenEJBValidatorFactory(delegate.buildValidatorFactory(), releasables);
+        }
+
+        @Override
+        public T parameterNameProvider(ParameterNameProvider parameterNameProvider) {
+            return delegate.parameterNameProvider(parameterNameProvider);
+        }
+
+        @Override
+        public ParameterNameProvider getDefaultParameterNameProvider() {
+            return delegate.getDefaultParameterNameProvider();
+        }
+
+        @Override
+        public BootstrapConfiguration getBootstrapConfiguration() {
+            return bootstrap;
+        }
+    }
+
+    private static final class OpenEJBValidatorFactory implements ValidatorFactory {
+        private final ValidatorFactory delegate;
+        private final Collection<Releasable<?>> toRelease;
+
+        public OpenEJBValidatorFactory(final ValidatorFactory validatorFactory, final Collection<Releasable<?>> releasables) {
+            delegate = validatorFactory;
+            toRelease = releasables;
+        }
+
+        @Override
+        public Validator getValidator() {
+            return delegate.getValidator();
+        }
+
+        @Override
+        public ValidatorContext usingContext() {
+            return delegate.usingContext();
+        }
+
+        @Override
+        public MessageInterpolator getMessageInterpolator() {
+            return delegate.getMessageInterpolator();
+        }
+
+        @Override
+        public TraversableResolver getTraversableResolver() {
+            return delegate.getTraversableResolver();
+        }
+
+        @Override
+        public ConstraintValidatorFactory getConstraintValidatorFactory() {
+            return delegate.getConstraintValidatorFactory();
+        }
+
+        @Override
+        public <T> T unwrap(final Class<T> type) {
+            return delegate.unwrap(type);
+        }
+
+        @Override
+        public ParameterNameProvider getParameterNameProvider() {
+            return delegate.getParameterNameProvider();
+        }
+
+        @Override
+        public void close() {
+            delegate.close();
+            for (final Releasable<?> r : toRelease) {
+                r.release();
+            }
+        }
+    }
+
+    private static final class Releasable<T> {
+        private final CreationalContext<T> context;
+        private final InjectionTarget<T> injectionTarget;
+        private final T instance;
+
+        private Releasable(final CreationalContext<T> context, final InjectionTarget<T> injectionTarget, final T instance) {
+            this.context = context;
+            this.injectionTarget = injectionTarget;
+            this.instance = instance;
+        }
+
+        private void release() {
+            try {
+                injectionTarget.preDestroy(instance);
+                injectionTarget.dispose(instance);
+                context.release();
+            } catch (final Exception e) {
+                // no-op
+            } catch (final NoClassDefFoundError e) {
+                // no-op
+            }
+        }
+
+        private T getInstance() {
+            return instance;
+        }
     }
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java Tue Jul 29 19:26:09 2014
@@ -322,18 +322,12 @@ public class CdiEjbBean<T> extends BaseE
             return it;
         }
 
-        protected Set<InjectionPoint> createInjectionPoints(final Bean<T> bean) {
-            final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
-            for (final InjectionPoint injectionPoint : getWebBeansContext().getInjectionPointFactory().buildInjectionPoints(bean, getAnnotatedType())) {
-                injectionPoints.add(injectionPoint);
-            }
-            return injectionPoints;
-        }
-
+        @Override
         protected List<AnnotatedMethod<?>> getPostConstructMethods() {
             return Collections.emptyList();
         }
 
+        @Override
         protected List<AnnotatedMethod<?>> getPreDestroyMethods() {
             return Collections.emptyList();
         }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java Tue Jul 29 19:26:09 2014
@@ -38,7 +38,6 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
 import org.apache.webbeans.portable.events.discovery.BeforeShutdownImpl;
 import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
 import org.apache.webbeans.proxy.NormalScopeProxyFactory;
@@ -56,6 +55,7 @@ import javax.enterprise.context.spi.Cont
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Vetoed;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
@@ -274,60 +274,10 @@ public class CdiPlugin extends AbstractO
         return isNewSessionBean(webBeansContext, clazz) || isNewSessionBean(superContext(webBeansContext), clazz);
     }
 
-    private boolean isNewSessionBean(final WebBeansContext ctx, final Class<?> clazz) {
-        if (ctx == null) {
-            return false;
-        }
-
-        final Map<Class<?>, BeanContext> map = pluginBeans(ctx);
-        return map != null && (map.containsKey(clazz) || clazz.isInterface() && findBeanContext(ctx, clazz) != null);
-    }
-
-    private static WebBeansContext superContext(final WebBeansContext ctx) {
-        if (!WebappWebBeansContext.class.isInstance(ctx)) {
-            return null;
-        }
-        return WebappWebBeansContext.class.cast(ctx).getParent();
-    }
-
-    private static BeanContext findBeanContext(final WebBeansContext ctx, final Class<?> clazz) {
-        final Map<Class<?>, BeanContext> beans = pluginBeans(ctx);
-
-        final BeanContext b = beans.get(clazz);
-        if (b != null) {
-            return b;
-        }
-
-        for (final BeanContext bc : beans.values()) {
-            if (bc.isLocalbean()) {
-                continue; // see isSessionBean() impl
-            }
-
-            final CdiEjbBean<?> cdiEjbBean = bc.get(CdiEjbBean.class);
-            if (cdiEjbBean == null) {
-                continue;
-            }
-
-            for (final Class<?> itf : cdiEjbBean.getBusinessLocalInterfaces()) {
-                if (itf.equals(clazz)) {
-                    return bc;
-                }
-            }
-        }
-
-        final WebBeansContext parentCtx = superContext(ctx);
-        if (parentCtx != null) {
-            return findBeanContext(parentCtx, clazz);
-        }
-
-        return null;
-    }
-
     @Override
-    public <T> Bean<T> defineSessionBean(final Class<T> clazz, final ProcessAnnotatedType<T> processAnnotateTypeEvent) {
+    public <T> Bean<T> defineSessionBean(final Class<T> clazz, final AnnotatedType<T> annotatedType) {
         final BeanContext bc = findBeanContext(webBeansContext, clazz);
-        final AnnotatedType<T> annotatedType = processAnnotateTypeEvent.getAnnotatedType();
-        final CdiEjbBean<T> bean = new OpenEJBBeanBuilder<T>(bc, webBeansContext, annotatedType).createBean(clazz, isActivated(processAnnotateTypeEvent));
+        final CdiEjbBean<T> bean = new OpenEJBBeanBuilder<T>(bc, webBeansContext, annotatedType).createBean(clazz, !annotatedType.isAnnotationPresent(Vetoed.class));
 
         bc.set(CdiEjbBean.class, bean);
         bc.set(CurrentCreationalContext.class, new CurrentCreationalContext());
@@ -381,7 +331,7 @@ public class CdiPlugin extends AbstractO
         final BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
 
         //Fires ProcessManagedBean
-        webBeansContext.getBeanManagerImpl().fireEvent(new GProcessSessionBean(Bean.class.cast(bean), annotatedType, bc.getEjbName(), bean.getEjbType()));
+        webBeansContext.getBeanManagerImpl().fireEvent(new GProcessSessionBean(Bean.class.cast(bean), annotatedType, bc.getEjbName(), bean.getEjbType()), true);
         webBeansUtil.inspectErrorStack("There are errors that are added by ProcessSessionBean event observers for managed beans. Look at logs for further details");
 
         //Fires ProcessProducerMethod
@@ -410,6 +360,54 @@ public class CdiPlugin extends AbstractO
         return bean;
     }
 
+    private boolean isNewSessionBean(final WebBeansContext ctx, final Class<?> clazz) {
+        if (ctx == null) {
+            return false;
+        }
+
+        final Map<Class<?>, BeanContext> map = pluginBeans(ctx);
+        return map != null && (map.containsKey(clazz) || clazz.isInterface() && findBeanContext(ctx, clazz) != null);
+    }
+
+    private static WebBeansContext superContext(final WebBeansContext ctx) {
+        if (!WebappWebBeansContext.class.isInstance(ctx)) {
+            return null;
+        }
+        return WebappWebBeansContext.class.cast(ctx).getParent();
+    }
+
+    private static BeanContext findBeanContext(final WebBeansContext ctx, final Class<?> clazz) {
+        final Map<Class<?>, BeanContext> beans = pluginBeans(ctx);
+
+        final BeanContext b = beans.get(clazz);
+        if (b != null) {
+            return b;
+        }
+
+        for (final BeanContext bc : beans.values()) {
+            if (bc.isLocalbean()) {
+                continue; // see isSessionBean() impl
+            }
+
+            final CdiEjbBean<?> cdiEjbBean = bc.get(CdiEjbBean.class);
+            if (cdiEjbBean == null) {
+                continue;
+            }
+
+            for (final Class<?> itf : cdiEjbBean.getBusinessLocalInterfaces()) {
+                if (itf.equals(clazz)) {
+                    return bc;
+                }
+            }
+        }
+
+        final WebBeansContext parentCtx = superContext(ctx);
+        if (parentCtx != null) {
+            return findBeanContext(parentCtx, clazz);
+        }
+
+        return null;
+    }
 
     @Override
     public <T> Bean<T> defineNewSessionBean(final Class<T> clazz) {
@@ -482,10 +480,6 @@ public class CdiPlugin extends AbstractO
         }
     }
 
-    private static boolean isActivated(final ProcessAnnotatedType<?> pat) {
-        return !ProcessAnnotatedTypeImpl.class.isInstance(pat) || !ProcessAnnotatedTypeImpl.class.cast(pat).isVeto();
-    }
-
     @Override
     public boolean isSingletonBean(final Class<?> clazz) {
         throw new IllegalStateException("Statement should never be reached");

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java Tue Jul 29 19:26:09 2014
@@ -18,6 +18,7 @@
 
 package org.apache.openejb.cdi;
 
+import org.apache.bval.cdi.BValInterceptor;
 import org.apache.openejb.BeanContext;
 import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.assembler.classic.BeansInfo;
@@ -90,6 +91,10 @@ public class CdiScanner implements Scann
             interceptorsManager.addEnabledInterceptorClass(interceptor);
         }
 
+        // TODO: this shouldn't be needed with OWB 2, see org.apache.openejb.cdi.OptimizedLoaderService.loadExtensions() too
+        classes.add(BValInterceptor.class);
+        interceptorsManager.addEnabledInterceptorClass(BValInterceptor.class);
+
         // app beans
         for (final EjbJarInfo ejbJar : appInfo.ejbJars) {
             final BeansInfo beans = ejbJar.beans;
@@ -151,7 +156,7 @@ public class CdiScanner implements Scann
             for (final String className : beans.alternativeStereotypes) {
                 final Class<?> clazz = load(PropertyPlaceHolderHelper.simpleValue(className), classLoader);
                 if (clazz != null) {
-                    alternativesManager.addStereoTypeAlternative(clazz, null, null);
+                    alternativesManager.addXmlStereoTypeAlternative(clazz);
                     classes.add(clazz);
                 } else if (shouldThrowCouldNotLoadException(startupObject)) {
                     throw new WebBeansConfigurationException("Could not load alternativeStereotype class: " + className);
@@ -161,7 +166,7 @@ public class CdiScanner implements Scann
             for (final String className : beans.alternativeClasses) {
                 final Class<?> clazz = load(PropertyPlaceHolderHelper.simpleValue(className), classLoader);
                 if (clazz != null) {
-                    alternativesManager.addClazzAlternative(clazz, null, null);
+                    alternativesManager.addXmlStereoTypeAlternative(clazz);
                     classes.add(clazz);
                 } else if (shouldThrowCouldNotLoadException(startupObject)) {
                     throw new WebBeansConfigurationException("Could not load alternative class: " + className);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java Tue Jul 29 19:26:09 2014
@@ -41,7 +41,6 @@ import org.apache.webbeans.spi.ScannerSe
 import org.apache.webbeans.spi.adaptor.ELAdaptor;
 import org.apache.webbeans.util.WebBeansConstants;
 import org.apache.webbeans.util.WebBeansUtil;
-import org.apache.webbeans.xml.WebBeansXMLConfigurator;
 
 import javax.el.ELResolver;
 import javax.enterprise.inject.spi.BeanManager;
@@ -79,12 +78,6 @@ public class OpenEJBLifecycle implements
     private final BeansDeployer deployer;
 
     /**
-     * XML discovery.
-     */
-    //XML discovery is removed from the specification. It is here for next revisions of spec.
-    private final WebBeansXMLConfigurator xmlDeployer;
-
-    /**
      * Using for lookup operations
      */
     private final JNDIService jndiService;
@@ -101,13 +94,10 @@ public class OpenEJBLifecycle implements
 
     public OpenEJBLifecycle(final WebBeansContext webBeansContext) {
         this.webBeansContext = webBeansContext;
-        beforeInitApplication(null);
 
         this.beanManager = webBeansContext.getBeanManagerImpl();
-        this.xmlDeployer = new WebBeansXMLConfigurator();
-        this.deployer = new BeansDeployer(this.xmlDeployer, webBeansContext);
+        this.deployer = new BeansDeployer(webBeansContext);
         this.jndiService = webBeansContext.getService(JNDIService.class);
-        this.beanManager.setXMLConfigurator(this.xmlDeployer);
         this.scannerService = webBeansContext.getScannerService();
         this.contextsService = webBeansContext.getContextsService();
 
@@ -140,10 +130,6 @@ public class OpenEJBLifecycle implements
         try {
             Thread.currentThread().setContextClassLoader(stuff.getClassLoader());
 
-            //Before Start
-            beforeStartApplication(startupObject);
-
-
             //Load all plugins
             webBeansContext.getPluginLoader().startUp();
 
@@ -214,7 +200,9 @@ public class OpenEJBLifecycle implements
             }
 
             //Start actual starting on sub-classes
-            afterStartApplication(startupObject);
+            if (beanManager instanceof WebappBeanManager) {
+                ((WebappBeanManager) beanManager).afterStart();
+            }
         } finally {
             Thread.currentThread().setContextClassLoader(oldCl);
 
@@ -231,13 +219,15 @@ public class OpenEJBLifecycle implements
 
         try {
             //Sub-classes operations
-            beforeStopApplication(null);
+            if (service != null) {
+                service.shutdownNow();
+            }
 
             //Fire shut down
             if (beanManager instanceof WebappBeanManager) {
                 ((WebappBeanManager) beanManager).beforeStop();
             }
-            this.beanManager.fireEvent(new BeforeShutdownImpl());
+            this.beanManager.fireEvent(new BeforeShutdownImpl(), true);
 
             //Destroys context
             this.contextsService.destroy(null);
@@ -261,7 +251,18 @@ public class OpenEJBLifecycle implements
             webBeansContext.getAnnotatedElementFactory().clear();
 
             //After Stop
-            afterStopApplication(null);
+            //Clear the resource injection service
+            final ResourceInjectionService injectionServices = webBeansContext.getService(ResourceInjectionService.class);
+            if (injectionServices != null) {
+                injectionServices.clear();
+            }
+
+            //Comment out for commit OWB-502
+            //ContextFactory.cleanUpContextFactory();
+
+            CdiAppContextsService.class.cast(contextsService).removeThreadLocals();
+
+            WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
 
             // Clear BeanManager
             this.beanManager.clear();
@@ -290,13 +291,6 @@ public class OpenEJBLifecycle implements
     }
 
     /**
-     * @return the xmlDeployer
-     */
-    protected WebBeansXMLConfigurator getXmlDeployer() {
-        return xmlDeployer;
-    }
-
-    /**
      * @return the jndiService
      */
     protected JNDIService getJndiService() {
@@ -305,21 +299,7 @@ public class OpenEJBLifecycle implements
 
     @Override
     public void initApplication(final Properties properties) {
-        afterInitApplication(properties);
-    }
-
-    protected void beforeInitApplication(final Properties properties) {
-        //Do nothing as default
-    }
-
-    protected void afterInitApplication(final Properties properties) {
-        //Do nothing as default
-    }
-
-    protected void afterStartApplication(final Object startupObject) {
-        if (beanManager instanceof WebappBeanManager) {
-            ((WebappBeanManager) beanManager).afterStart();
-        }
+        // no-op
     }
 
     public void startServletContext(final ServletContext servletContext) {
@@ -378,22 +358,6 @@ public class OpenEJBLifecycle implements
         }
     }
 
-    protected void afterStopApplication(final Object stopObject) throws Exception {
-
-        //Clear the resource injection service
-        final ResourceInjectionService injectionServices = webBeansContext.getService(ResourceInjectionService.class);
-        if (injectionServices != null) {
-            injectionServices.clear();
-        }
-
-        //Comment out for commit OWB-502
-        //ContextFactory.cleanUpContextFactory();
-
-        CdiAppContextsService.class.cast(contextsService).removeThreadLocals();
-
-        WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
-    }
-
     /**
      * Returns servelt context otherwise throws exception.
      *
@@ -407,14 +371,4 @@ public class OpenEJBLifecycle implements
         }
         return object;
     }
-
-    protected void beforeStartApplication(final Object startupObject) {
-        //Do nothing as default
-    }
-
-    protected void beforeStopApplication(final Object stopObject) throws Exception {
-        if (service != null) {
-            service.shutdownNow();
-        }
-    }
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBTransactionService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBTransactionService.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBTransactionService.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBTransactionService.java Tue Jul 29 19:26:09 2014
@@ -91,7 +91,8 @@ public class OpenEJBTransactionService i
         }
 
         TransactionalEventNotifier.registerTransactionSynchronization(phase, observer, event,
-            new EventMetadataImpl(observer.getObservedType(), null, qualifiers.toArray(new Annotation[qualifiers.size()])));
+            new EventMetadataImpl(observer.getObservedType(), null, null,
+                qualifiers.toArray(new Annotation[qualifiers.size()]), webBeansContext));
     }
 
     public void setWebBeansContext(final WebBeansContext webBeansContext) {

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java Tue Jul 29 19:26:09 2014
@@ -22,8 +22,7 @@ import org.apache.webbeans.component.Bui
 import org.apache.webbeans.component.ExtensionBean;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
-import org.apache.webbeans.event.EventMetadata;
-import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.event.EventMetadataImpl;
 import org.apache.webbeans.util.WebBeansUtil;
 
 import javax.el.ELResolver;
@@ -55,12 +54,8 @@ public class WebappBeanManager extends B
     }
 
     @Override
-    public void fireEvent(final Object event, final EventMetadata metadata, final boolean isLifecycleEvent) {
+    public void fireEvent(final Object event, final EventMetadataImpl metadata, final boolean isLifecycleEvent) {
         final Class<?> eventClass = event.getClass();
-        if (ClassUtil.isDefinitionContainsTypeVariables(ClassUtil.getClass(metadata.getType()))) {
-            throw new IllegalArgumentException("Event class : " + event.getClass().getName() + " can not be defined as generic type");
-        }
-
         getNotificationManager().fireEvent(event, metadata, isLifecycleEvent);
         if (isEvent(eventClass)) {
             getParentBm().getNotificationManager().fireEvent(event, metadata, isLifecycleEvent);
@@ -68,17 +63,13 @@ public class WebappBeanManager extends B
     }
 
     @Override
-    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(final T event, final EventMetadata metadata) {
+    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(final T event, final EventMetadataImpl metadata) {
         final Class<?> eventClass = event.getClass();
-        if (ClassUtil.isDefinitionContainsTypeVariables(ClassUtil.getClass(metadata.getType()))) {
-            throw new IllegalArgumentException("Event type can not contain type variables. Event class is : " + eventClass);
-        }
-
         final Set<ObserverMethod<? super T>> set = new HashSet<ObserverMethod<? super T>>();
-        set.addAll(getNotificationManager().resolveObservers(event, metadata));
+        set.addAll(getNotificationManager().resolveObservers(event, metadata, false));
 
         if (isEvent(eventClass)) {
-            set.addAll(getParentBm().getNotificationManager().resolveObservers(event, metadata));
+            set.addAll(getParentBm().getNotificationManager().resolveObservers(event, metadata, false));
         } // else nothing since extensions are loaded by classloader so we already have it
 
         return set;

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java Tue Jul 29 19:26:09 2014
@@ -21,6 +21,7 @@ import org.apache.openejb.core.Operation
 import org.apache.openejb.util.Classes;
 
 import javax.interceptor.InvocationContext;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Iterator;
@@ -65,6 +66,7 @@ public class ReflectionInvocationContext
         }
     }
 
+    @Override
     public Object getTimer() {
         if (operation.equals(Operation.TIMEOUT)) {
             return parameters[0];
@@ -72,14 +74,22 @@ public class ReflectionInvocationContext
         return null;
     }
 
+    @Override
     public Object getTarget() {
         return target;
     }
 
+    @Override
     public Method getMethod() {
         return method;
     }
 
+    @Override
+    public Constructor<?> getConstructor() {
+        throw new IllegalStateException(); // TODO
+    }
+
+    @Override
     public Object[] getParameters() {
         //TODO Need to figure out what is going on with afterCompletion call back here ?
         if (Operation.POST_CONSTRUCT.equals(operation) || Operation.PRE_DESTROY.equals(operation)) {
@@ -101,6 +111,7 @@ public class ReflectionInvocationContext
         return m;
     }
 
+    @Override
     public void setParameters(final Object[] parameters) {
         if (operation.isCallback() && !operation.equals(Operation.TIMEOUT)) {
             throw new IllegalStateException(getIllegalParameterAccessMessage());
@@ -134,6 +145,7 @@ public class ReflectionInvocationContext
         System.arraycopy(parameters, 0, this.parameters, 0, parameters.length);
     }
 
+    @Override
     public Map<String, Object> getContextData() {
         return contextData;
     }
@@ -164,6 +176,7 @@ public class ReflectionInvocationContext
         }
     }
 
+    @Override
     public Object proceed() throws Exception {
         // The bulk of the logic of this method has intentionally been moved
         // out so stepping through a large stack in a debugger can be done quickly.

Modified: tomee/tomee/trunk/container/openejb-core/src/test/java/org/apache/openejb/DeploymentContextOptionsTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/test/java/org/apache/openejb/DeploymentContextOptionsTest.java?rev=1614468&r1=1614467&r2=1614468&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/test/java/org/apache/openejb/DeploymentContextOptionsTest.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/test/java/org/apache/openejb/DeploymentContextOptionsTest.java Tue Jul 29 19:26:09 2014
@@ -17,7 +17,7 @@
 package org.apache.openejb;
 
 import junit.framework.TestCase;
-import org.apache.bval.jsr303.ConfigurationImpl;
+import org.apache.bval.jsr.ConfigurationImpl;
 import org.apache.openejb.assembler.classic.Assembler;
 import org.apache.openejb.assembler.classic.SecurityServiceInfo;
 import org.apache.openejb.assembler.classic.TransactionServiceInfo;

Added: tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/Adapter1.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/Adapter1.java?rev=1614468&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/Adapter1.java (added)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/Adapter1.java Tue Jul 29 19:26:09 2014
@@ -0,0 +1,38 @@
+/**
+ * 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.bval;
+
+import javax.validation.executable.ExecutableType;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class Adapter1
+    extends XmlAdapter<String, ExecutableType>
+{
+
+
+    public ExecutableType unmarshal(String value) {
+        return (javax.validation.executable.ExecutableType.valueOf(value));
+    }
+
+    public String marshal(ExecutableType value) {
+        if (value == null) {
+            return null;
+        }
+        return value.toString();
+    }
+
+}

Added: tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/AnnotationType.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/AnnotationType.java?rev=1614468&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/AnnotationType.java (added)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/AnnotationType.java Tue Jul 29 19:26:09 2014
@@ -0,0 +1,82 @@
+/**
+ * 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.bval;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for annotationType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="annotationType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="element" type="{http://jboss.org/xml/ns/javax/validation/mapping}elementType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "annotationType", propOrder = {
+    "element"
+})
+public class AnnotationType {
+
+    protected List<ElementType> element;
+
+    /**
+     * Gets the value of the element property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the element property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getElement().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link ElementType }
+     * 
+     * 
+     */
+    public List<ElementType> getElement() {
+        if (element == null) {
+            element = new ArrayList<ElementType>();
+        }
+        return this.element;
+    }
+
+}

Added: tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/BeanType.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/BeanType.java?rev=1614468&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/BeanType.java (added)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/BeanType.java Tue Jul 29 19:26:09 2014
@@ -0,0 +1,265 @@
+/**
+ * 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.bval;
+
+import java.util.ArrayList;
+import java.util.List;
+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.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * <p>Java class for beanType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="beanType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="class" type="{http://jboss.org/xml/ns/javax/validation/mapping}classType" minOccurs="0"/>
+ *         &lt;element name="field" type="{http://jboss.org/xml/ns/javax/validation/mapping}fieldType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="getter" type="{http://jboss.org/xml/ns/javax/validation/mapping}getterType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="constructor" type="{http://jboss.org/xml/ns/javax/validation/mapping}constructorType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="method" type="{http://jboss.org/xml/ns/javax/validation/mapping}methodType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="class" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="ignore-annotations" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "beanType", propOrder = {
+    "classType",
+    "field",
+    "getter",
+    "constructor",
+    "method"
+})
+public class BeanType {
+
+    @XmlElement(name = "class")
+    protected ClassType classType;
+    protected List<FieldType> field;
+    protected List<GetterType> getter;
+    protected List<ConstructorType> constructor;
+    protected List<MethodType> method;
+    @XmlAttribute(name = "class", required = true)
+    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+    protected String clazz;
+    @XmlAttribute(name = "ignore-annotations")
+    protected Boolean ignoreAnnotations;
+
+    /**
+     * Gets the value of the classType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link ClassType }
+     *     
+     */
+    public ClassType getClassType() {
+        return classType;
+    }
+
+    /**
+     * Sets the value of the classType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link ClassType }
+     *     
+     */
+    public void setClassType(ClassType value) {
+        this.classType = value;
+    }
+
+    /**
+     * Gets the value of the field property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the field property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getField().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FieldType }
+     * 
+     * 
+     */
+    public List<FieldType> getField() {
+        if (field == null) {
+            field = new ArrayList<FieldType>();
+        }
+        return this.field;
+    }
+
+    /**
+     * Gets the value of the getter property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the getter property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getGetter().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link GetterType }
+     * 
+     * 
+     */
+    public List<GetterType> getGetter() {
+        if (getter == null) {
+            getter = new ArrayList<GetterType>();
+        }
+        return this.getter;
+    }
+
+    /**
+     * Gets the value of the constructor property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the constructor property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getConstructor().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link ConstructorType }
+     * 
+     * 
+     */
+    public List<ConstructorType> getConstructor() {
+        if (constructor == null) {
+            constructor = new ArrayList<ConstructorType>();
+        }
+        return this.constructor;
+    }
+
+    /**
+     * Gets the value of the method property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the method property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getMethod().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link MethodType }
+     * 
+     * 
+     */
+    public List<MethodType> getMethod() {
+        if (method == null) {
+            method = new ArrayList<MethodType>();
+        }
+        return this.method;
+    }
+
+    /**
+     * Gets the value of the clazz property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getClazz() {
+        return clazz;
+    }
+
+    /**
+     * Sets the value of the clazz property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setClazz(String value) {
+        this.clazz = value;
+    }
+
+    /**
+     * Gets the value of the ignoreAnnotations property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Boolean }
+     *     
+     */
+    public Boolean getIgnoreAnnotations() {
+        return ignoreAnnotations;
+    }
+
+    /**
+     * Sets the value of the ignoreAnnotations property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Boolean }
+     *     
+     */
+    public void setIgnoreAnnotations(Boolean value) {
+        this.ignoreAnnotations = value;
+    }
+
+}

Added: tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ClassType.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ClassType.java?rev=1614468&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ClassType.java (added)
+++ tomee/tomee/trunk/container/openejb-jee/src/main/java/org/apache/openejb/jee/bval/ClassType.java Tue Jul 29 19:26:09 2014
@@ -0,0 +1,139 @@
+/**
+ * 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.bval;
+
+import java.util.ArrayList;
+import java.util.List;
+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.XmlType;
+
+
+/**
+ * <p>Java class for classType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="classType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="group-sequence" type="{http://jboss.org/xml/ns/javax/validation/mapping}groupSequenceType" minOccurs="0"/>
+ *         &lt;element name="constraint" type="{http://jboss.org/xml/ns/javax/validation/mapping}constraintType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="ignore-annotations" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "classType", propOrder = {
+    "groupSequence",
+    "constraint"
+})
+public class ClassType {
+
+    @XmlElement(name = "group-sequence")
+    protected GroupSequenceType groupSequence;
+    protected List<ConstraintType> constraint;
+    @XmlAttribute(name = "ignore-annotations")
+    protected Boolean ignoreAnnotations;
+
+    /**
+     * Gets the value of the groupSequence property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link GroupSequenceType }
+     *     
+     */
+    public GroupSequenceType getGroupSequence() {
+        return groupSequence;
+    }
+
+    /**
+     * Sets the value of the groupSequence property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link GroupSequenceType }
+     *     
+     */
+    public void setGroupSequence(GroupSequenceType value) {
+        this.groupSequence = value;
+    }
+
+    /**
+     * Gets the value of the constraint property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the constraint property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getConstraint().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link ConstraintType }
+     * 
+     * 
+     */
+    public List<ConstraintType> getConstraint() {
+        if (constraint == null) {
+            constraint = new ArrayList<ConstraintType>();
+        }
+        return this.constraint;
+    }
+
+    /**
+     * Gets the value of the ignoreAnnotations property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Boolean }
+     *     
+     */
+    public Boolean getIgnoreAnnotations() {
+        return ignoreAnnotations;
+    }
+
+    /**
+     * Sets the value of the ignoreAnnotations property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Boolean }
+     *     
+     */
+    public void setIgnoreAnnotations(Boolean value) {
+        this.ignoreAnnotations = value;
+    }
+
+}