You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/07/19 20:47:26 UTC

svn commit: r557730 - in /openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/config/ container/openejb-core/src/main/java/org/apache/openejb/config/rules/ container/openejb-core/src/main/resources/org/apache/openejb/config/...

Author: dblevins
Date: Thu Jul 19 11:47:23 2007
New Revision: 557730

URL: http://svn.apache.org/viewvc?view=rev&rev=557730
Log:
OPENEJB-526: Validation: Check for incorrect use of injection-target-name
OPENEJB-536: Validation: AroundInvoke signature
OPENEJB-552: Validation: EjbName used in InterceptorBinding is correct
OPENEJB-612: Validation: EjbName used in method-based InterceptorBinding
OPENEJB-574: Validation: XML transaction attributes to beans that do not exist
OPENEJB-575: Validation: XML method permissions to beans that do not exist
OPENEJB-613: Validation: PreDestroy callback signature is correct
OPENEJB-614: Validation: PostConstruct callback signature is correct
OPENEJB-615: Validation: PrePassivate callback signature is correct
OPENEJB-616: Validation: PostActivate callback signature is correct
OPENEJB-617: Validation: Warn on unsupported service-refs

All i18n keys are present, many of the text is still outstanding.

Added:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckServiceRefs.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/ValidationBase.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckInjectionTargetsTest.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbValidator.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java
    openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EjbJar.java
    openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/src/main/resources/META-INF/ejb-jar.xml

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Thu Jul 19 11:47:23 2007
@@ -727,33 +727,30 @@
 
             }
 
-            Interceptor[] interceptors = ejbModule.getEjbJar().getInterceptors();
-            if (interceptors != null) {
-                for (Interceptor interceptor : interceptors) {
-                    Class<?> clazz = null;
-                    try {
-                        clazz = classLoader.loadClass(interceptor.getInterceptorClass());
-                    } catch (ClassNotFoundException e) {
-                        throw new OpenEJBException("Unable to load interceptor class: " + interceptor.getInterceptorClass(), e);
-                    }
+            for (Interceptor interceptor : ejbModule.getEjbJar().getInterceptors()) {
+                Class<?> clazz = null;
+                try {
+                    clazz = classLoader.loadClass(interceptor.getInterceptorClass());
+                } catch (ClassNotFoundException e) {
+                    throw new OpenEJBException("Unable to load interceptor class: " + interceptor.getInterceptorClass(), e);
+                }
 
-                    ClassFinder inheritedClassFinder = createInheritedClassFinder(clazz);
+                ClassFinder inheritedClassFinder = createInheritedClassFinder(clazz);
 
-                    processCallbacks(interceptor, inheritedClassFinder);
+                processCallbacks(interceptor, inheritedClassFinder);
 
-                    buildAnnotatedRefs(interceptor, inheritedClassFinder);
+                buildAnnotatedRefs(interceptor, inheritedClassFinder);
 
-                    for (EnterpriseBean bean : enterpriseBeans) {
-                        // DMB: TODO, we should actually check to see if the ref exists in the bean's enc.
-                        bean.getEnvEntry().addAll(interceptor.getEnvEntry());
-                        bean.getEjbRef().addAll(interceptor.getEjbRef());
-                        bean.getEjbLocalRef().addAll(interceptor.getEjbLocalRef());
-                        bean.getResourceRef().addAll(interceptor.getResourceRef());
-                        bean.getResourceEnvRef().addAll(interceptor.getResourceEnvRef());
-                        bean.getPersistenceContextRef().addAll(interceptor.getPersistenceContextRef());
-                        bean.getPersistenceUnitRef().addAll(interceptor.getPersistenceUnitRef());
-                        bean.getMessageDestinationRef().addAll(interceptor.getMessageDestinationRef());
-                    }
+                for (EnterpriseBean bean : enterpriseBeans) {
+                    // DMB: TODO, we should actually check to see if the ref exists in the bean's enc.
+                    bean.getEnvEntry().addAll(interceptor.getEnvEntry());
+                    bean.getEjbRef().addAll(interceptor.getEjbRef());
+                    bean.getEjbLocalRef().addAll(interceptor.getEjbLocalRef());
+                    bean.getResourceRef().addAll(interceptor.getResourceRef());
+                    bean.getResourceEnvRef().addAll(interceptor.getResourceEnvRef());
+                    bean.getPersistenceContextRef().addAll(interceptor.getPersistenceContextRef());
+                    bean.getPersistenceUnitRef().addAll(interceptor.getPersistenceUnitRef());
+                    bean.getMessageDestinationRef().addAll(interceptor.getMessageDestinationRef());
                 }
             }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java Thu Jul 19 11:47:23 2007
@@ -260,7 +260,7 @@
     }
 
     private void initInterceptors(EjbModule jar, EjbJarInfo ejbJar, Map<String, EnterpriseBeanInfo> beanInfos) throws OpenEJBException {
-        if (jar.getEjbJar().getInterceptors() == null) return;
+        if (jar.getEjbJar().getInterceptors().length == 0) return;
         if (jar.getEjbJar().getAssemblyDescriptor() == null) return;
         if (jar.getEjbJar().getAssemblyDescriptor().getInterceptorBinding() == null) return;
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbValidator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbValidator.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbValidator.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbValidator.java Thu Jul 19 11:47:23 2007
@@ -27,6 +27,10 @@
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.config.rules.CheckClasses;
 import org.apache.openejb.config.rules.CheckMethods;
+import org.apache.openejb.config.rules.CheckAssemblyBindings;
+import org.apache.openejb.config.rules.CheckCallbacks;
+import org.apache.openejb.config.rules.CheckInjectionTargets;
+import org.apache.openejb.config.rules.CheckServiceRefs;
 import org.apache.openejb.util.Messages;
 import org.apache.openejb.util.Logger;
 import org.apache.openejb.util.OpenEjbVersion;
@@ -88,7 +92,11 @@
     protected ValidationRule[] getValidationRules() {
         ValidationRule[] rules = new ValidationRule[]{
                 new CheckClasses(),
-                new CheckMethods()
+                new CheckMethods(),
+                new CheckCallbacks(),
+                new CheckAssemblyBindings(),
+                new CheckInjectionTargets(),
+                new CheckServiceRefs()
         };
         return rules;
     }

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,81 @@
+/**
+ * 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.config.rules;
+
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.jee.AssemblyDescriptor;
+import org.apache.openejb.jee.ContainerTransaction;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.InterceptorBinding;
+import org.apache.openejb.jee.Method;
+import org.apache.openejb.jee.MethodPermission;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckAssemblyBindings extends ValidationBase {
+    public void validate(EjbSet set) {
+        this.set = set;
+
+        Map<String, EnterpriseBean> ejbsByName = set.getEjbJar().getEnterpriseBeansByEjbName();
+
+        AssemblyDescriptor assembly = set.getEjbJar().getAssemblyDescriptor();
+
+        if (assembly == null) return;
+
+        for (InterceptorBinding binding : assembly.getInterceptorBinding()) {
+            List<String> interceptorClasses = binding.getInterceptorClass();
+            if (binding.getInterceptorOrder() != null){
+                interceptorClasses.addAll(binding.getInterceptorOrder().getInterceptorClass());
+            }
+
+            if (binding.getEjbName() != null && !binding.getEjbName().equals("*") && !ejbsByName.containsKey(binding.getEjbName())) {
+                fail("InterceptorBinding", "interceptorBinding.noSuchEjbName", binding.getEjbName(), join(interceptorClasses, ","));
+            }
+
+            if (binding.getMethod() != null) {
+                if (binding.getEjbName() == null) {
+                    fail("InterceptorBinding", "interceptorBinding.ejbNameRequiredWithMethod", binding.getMethod().getMethodName(), join(interceptorClasses, ","));
+                }
+            }
+        }
+
+        for (MethodPermission permission : assembly.getMethodPermission()) {
+            for (Method method : permission.getMethod()) {
+                if (method.getEjbName() == null) {
+                    fail("MethodPermission", "methodPermission.ejbNameRequired", method.getMethodName(), join(permission.getRoleName(), ","));
+                } else if (!ejbsByName.containsKey(method.getEjbName())){
+                    fail("MethodPermission", "methodPermission.noSuchEjbName", method.getEjbName(), method.getMethodName(), join(permission.getRoleName(), ","));
+                }
+            }
+        }
+
+        for (ContainerTransaction transaction : assembly.getContainerTransaction()) {
+            for (Method method : transaction.getMethod()) {
+                if (method.getEjbName() == null) {
+                    fail("ContainerTransaction", "containerTransaction.ejbNameRequired", method.getMethodName(), transaction.getTransAttribute());
+                } else if (!ejbsByName.containsKey(method.getEjbName())){
+                    fail("ContainerTransaction", "containerTransaction.noSuchEjbName", method.getEjbName(), method.getMethodName(), transaction.getTransAttribute());
+                }
+            }
+        }
+    }
+
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,207 @@
+/**
+ * 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.config.rules;
+
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.AroundInvoke;
+import org.apache.openejb.jee.CallbackMethod;
+import org.apache.openejb.jee.LifecycleCallback;
+import org.apache.openejb.jee.Session;
+import org.apache.openejb.jee.Interceptor;
+import org.apache.openejb.OpenEJBException;
+
+import javax.interceptor.InvocationContext;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckCallbacks extends ValidationBase {
+
+    public void validate(EjbSet set) {
+        this.set = set;
+        for (EnterpriseBean bean : set.getEjbJar().getEnterpriseBeans()) {
+            Class ejbClass = null;
+            try {
+                ejbClass = loadClass(bean.getEjbClass());
+            } catch (OpenEJBException e) {
+                continue;
+            }
+
+            for (AroundInvoke aroundInvoke : bean.getAroundInvoke()) {
+                checkAroundInvoke(ejbClass, aroundInvoke, bean.getEjbName());
+            }
+
+            for (LifecycleCallback callback : bean.getPostConstruct()) {
+                checkCallback(ejbClass, "PostConstruct", callback, bean);
+            }
+
+            for (LifecycleCallback callback : bean.getPreDestroy()) {
+                checkCallback(ejbClass, "PreDestroy", callback, bean);
+            }
+
+            if (bean instanceof Session) {
+                Session session = (Session) bean;
+
+                for (LifecycleCallback callback : session.getPrePassivate()) {
+                    checkCallback(ejbClass, "PrePassivate", callback, bean);
+                }
+
+                for (LifecycleCallback callback : session.getPostActivate()) {
+                    checkCallback(ejbClass, "PostActivate", callback, bean);
+                }
+
+            }
+        }
+
+        for (Interceptor interceptor : set.getEjbJar().getInterceptors()) {
+            Class interceptorClass = null;
+            try {
+                interceptorClass = loadClass(interceptor.getInterceptorClass());
+            } catch (OpenEJBException e) {
+                continue;
+            }
+
+            for (AroundInvoke aroundInvoke : interceptor.getAroundInvoke()) {
+                checkAroundInvoke(interceptorClass, aroundInvoke, "Interceptor");
+            }
+
+            for (LifecycleCallback callback : interceptor.getPostConstruct()) {
+                checkCallback(interceptorClass, "PostConstruct", callback, interceptor);
+            }
+
+            for (LifecycleCallback callback : interceptor.getPreDestroy()) {
+                checkCallback(interceptorClass, "PreDestroy", callback, interceptor);
+            }
+
+            for (LifecycleCallback callback : interceptor.getPrePassivate()) {
+                checkCallback(interceptorClass, "PrePassivate", callback, interceptor);
+            }
+
+            for (LifecycleCallback callback : interceptor.getPostActivate()) {
+                checkCallback(interceptorClass, "PostActivate", callback, interceptor);
+            }
+        }
+    }
+
+    private void checkAroundInvoke(Class ejbClass, AroundInvoke aroundInvoke, String componentName) {
+        try {
+            Method method = getMethod(ejbClass, aroundInvoke.getMethodName(), InvocationContext.class);
+
+            Class<?> returnType = method.getReturnType();
+
+            if (!returnType.equals(Object.class)) {
+                fail(componentName, "aroundInvoke.badReturnType", aroundInvoke.getMethodName(), returnType.getName());
+            }
+
+            boolean throwsException = false;
+            for (Class<?> exceptionType : method.getExceptionTypes()) {
+                if (exceptionType.getName().equals(Exception.class.getName())) {
+                    throwsException = true;
+                }
+            }
+
+            if (!throwsException) {
+                fail(componentName, "aroundInvoke.mustThrowException", aroundInvoke.getMethodName());
+            }
+
+        } catch (NoSuchMethodException e) {
+            List<Method> possibleMethods = getMethods(ejbClass, aroundInvoke.getMethodName());
+
+            if (possibleMethods.size() == 0) {
+                fail(componentName, "aroundInvoke.missing", aroundInvoke.getMethodName());
+            } else if (possibleMethods.size() == 1) {
+                fail(componentName, "aroundInvoke.invalidArguments", aroundInvoke.getMethodName(), getParameters(possibleMethods.get(0)));
+            } else {
+                fail(componentName, "aroundInvoke.missing.possibleTypo", aroundInvoke.getMethodName(), possibleMethods.size());
+            }
+        }
+    }
+
+    private void checkCallback(Class ejbClass, String type, CallbackMethod callback, EnterpriseBean bean) {
+        try {
+            Method method = getMethod(ejbClass, callback.getMethodName());
+
+            Class<?> returnType = method.getReturnType();
+
+            if (!returnType.equals(Void.TYPE)) {
+                fail(bean, "callback.badReturnType", type, callback.getMethodName(), returnType.getName());
+            }
+        } catch (NoSuchMethodException e) {
+            List<Method> possibleMethods = getMethods(ejbClass, callback.getMethodName());
+
+            if (possibleMethods.size() == 0) {
+                fail(bean, "callback.missing", callback.getMethodName());
+            } else if (possibleMethods.size() == 1) {
+                fail(bean, "callback.invalidArguments", type, callback.getMethodName(), getParameters(possibleMethods.get(0)));
+            } else {
+                fail(bean, "callback.missing.possibleTypo", type, callback.getMethodName(), possibleMethods.size());
+            }
+        }
+    }
+
+    private void checkCallback(Class interceptorClass, String type, CallbackMethod callback, Interceptor interceptor) {
+        try {
+            Method method = getMethod(interceptorClass, callback.getMethodName(), InvocationContext.class);
+
+            Class<?> returnType = method.getReturnType();
+
+            if (!returnType.equals(Void.TYPE)) {
+                fail("Interceptor", "interceptor.callback.badReturnType", type, callback.getMethodName(), returnType.getName());
+            }
+        } catch (NoSuchMethodException e) {
+            List<Method> possibleMethods = getMethods(interceptorClass, callback.getMethodName());
+
+            if (possibleMethods.size() == 0) {
+                fail("Interceptor", "interceptor.callback.missing", interceptorClass.getName(), callback.getMethodName());
+            } else if (possibleMethods.size() == 1) {
+                fail("Interceptor", "interceptor.callback.invalidArguments", interceptorClass.getName(), type, callback.getMethodName(), getParameters(possibleMethods.get(0)));
+            } else {
+                fail("Interceptor", "interceptor.callback.missing.possibleTypo", interceptorClass.getName(), type, callback.getMethodName(), possibleMethods.size());
+            }
+        }
+    }
+
+    private Method getMethod(Class clazz, String methodName, Class... parameterTypes) throws NoSuchMethodException {
+        NoSuchMethodException original = null;
+        while (clazz != null){
+            try {
+                return clazz.getDeclaredMethod(methodName, parameterTypes);
+            } catch (NoSuchMethodException e) {
+                if (original == null) original = e;
+            }
+            clazz = clazz.getSuperclass();
+        }
+        throw original;
+    }
+
+    private List<Method> getMethods(Class clazz, String methodName) {
+        List<Method> methods = new ArrayList<Method>();
+        while (clazz != null){
+            for (Method method : clazz.getDeclaredMethods()) {
+                if (method.getName().equals(methodName)){
+                    methods.add(method);
+                }
+            }
+        }
+        return methods;
+    }
+
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java Thu Jul 19 11:47:23 2007
@@ -21,15 +21,15 @@
 import org.apache.openejb.jee.RemoteBean;
 import org.apache.openejb.jee.EntityBean;
 import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.Interceptor;
 import org.apache.openejb.config.EjbSet;
 import org.apache.openejb.config.ValidationFailure;
-import org.apache.openejb.config.ValidationRule;
 import org.apache.openejb.util.SafeToolkit;
 
 import javax.ejb.EJBLocalHome;
 import javax.ejb.EJBLocalObject;
 
-public class CheckClasses implements ValidationRule {
+public class CheckClasses extends ValidationBase {
 
     private EjbSet set;
     private ClassLoader classLoader;
@@ -39,10 +39,11 @@
 
         for (EnterpriseBean bean : set.getJar().getEnterpriseBeans()) {
             try {
+                check_hasEjbClass(bean);
+
                 if (!(bean instanceof RemoteBean)) continue;
                 RemoteBean b = (RemoteBean) bean;
 
-                check_hasEjbClass(b);
                 check_isEjbClass(b);
                 check_hasDependentClasses(b, b.getEjbClass(), "<ejb-class>");
                 if (b.getHome() != null) {
@@ -65,6 +66,10 @@
                 throw new RuntimeException(bean.getEjbName(), e);
             }
         }
+
+        for (Interceptor interceptor : set.getEjbJar().getInterceptors()) {
+            check_hasInterceptorClass(interceptor);
+        }
     }
 
     private void check_hasDependentClasses(RemoteBean b, String className, String type) {
@@ -107,28 +112,34 @@
     }
 
     private void check_hasLocalClass(RemoteBean b) {
-        lookForClass(b, b.getLocal(), "<local>");
+        lookForClass(b.getLocal(), "<local>", b.getEjbName());
     }
 
     private void check_hasLocalHomeClass(RemoteBean b) {
-        lookForClass(b, b.getLocalHome(), "<local-home>");
+        lookForClass(b.getLocalHome(), "<local-home>", b.getEjbName());
+    }
+
+    public void check_hasEjbClass(EnterpriseBean b) {
+
+        lookForClass(b.getEjbClass(), "<ejb-class>", b.getEjbName());
+
     }
 
-    public void check_hasEjbClass(RemoteBean b) {
+    public void check_hasInterceptorClass(Interceptor i) {
 
-        lookForClass(b, b.getEjbClass(), "<ejb-class>");
+        lookForClass(i.getInterceptorClass(), "<interceptor-class>", "Interceptor");
 
     }
 
     public void check_hasHomeClass(RemoteBean b) {
 
-        lookForClass(b, b.getHome(), "<home>");
+        lookForClass(b.getHome(), "<home>", b.getEjbName());
 
     }
 
     public void check_hasRemoteClass(RemoteBean b) {
 
-        lookForClass(b, b.getRemote(), "<remote>");
+        lookForClass(b.getRemote(), "<remote>", b.getEjbName());
 
     }
 
@@ -168,7 +179,7 @@
 
     }
 
-    private void lookForClass(RemoteBean b, String clazz, String type) {
+    private void lookForClass(String clazz, String type, String ejbName) {
         try {
             loadClass(clazz);
         } catch (OpenEJBException e) {
@@ -178,11 +189,7 @@
             # 2 - Bean name
             */
 
-            ValidationFailure failure = new ValidationFailure("missing.class");
-            failure.setDetails(clazz, type, b.getEjbName());
-            failure.setComponentName(b.getEjbName());
-
-            set.addFailure(failure);
+            fail(ejbName, "missing.class", clazz, type, ejbName);
 
         } catch (NoClassDefFoundError e) {
             /*
@@ -191,11 +198,8 @@
              # 2 - Bean name
              # 3 - Misslocated Class name
              */
-            ValidationFailure failure = new ValidationFailure("misslocated.class");
-            failure.setDetails(clazz, type, b.getEjbName(), e.getMessage());
-            failure.setComponentName(b.getEjbName());
+            fail(ejbName, "misslocated.class", clazz, type, ejbName, e.getMessage());
 
-            set.addFailure(failure);
             throw e;
         }
 
@@ -219,10 +223,10 @@
         }
     }
 
-    private Class loadClass(String clazz) throws OpenEJBException {
+    protected Class loadClass(String clazz) throws OpenEJBException {
         ClassLoader cl = set.getClassLoader();
         try {
-            return cl.loadClass(clazz);
+            return Class.forName(clazz, true, cl);
         } catch (ClassNotFoundException cnfe) {
             throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, set.getJarPath()), cnfe);
         }

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,71 @@
+/**
+ * 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.config.rules;
+
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiReference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckInjectionTargets extends ValidationBase {
+    public void validate(EjbSet set) {
+        this.set = set;
+
+        for (EnterpriseBean bean : set.getEjbJar().getEnterpriseBeans()) {
+            List<JndiReference> entries = new ArrayList<JndiReference>();
+            entries.addAll(bean.getEjbLocalRef());
+            entries.addAll(bean.getEjbRef());
+            entries.addAll(bean.getEnvEntry());
+            entries.addAll(bean.getMessageDestinationRef());
+            entries.addAll(bean.getPersistenceContextRef());
+            entries.addAll(bean.getPersistenceUnitRef());
+            entries.addAll(bean.getResourceEnvRef());
+            entries.addAll(bean.getResourceRef());
+            entries.addAll(bean.getServiceRef());
+
+            for (JndiReference reference : entries) {
+                // check injection target
+                for (InjectionTarget target : reference.getInjectionTarget()) {
+                    boolean classPrefix = false;
+
+                    String name = target.getInjectionTargetName();
+                    if (name.startsWith(target.getInjectionTargetClass() + "/")) {
+                        classPrefix = true;
+                        name = name.substring(target.getInjectionTargetClass().length() + 1);
+                    }
+
+                    if (name.startsWith("set") && name.length() >= 4 && Character.isUpperCase(name.charAt(3))) {
+                        StringBuffer correctName = new StringBuffer(name);
+                        correctName.delete(0, 3);
+                        correctName.setCharAt(0, Character.toLowerCase(correctName.charAt(0)));
+                        if (classPrefix) correctName.insert(0, target.getInjectionTargetClass() + "/");
+
+                        warn(bean, "injectionTarget.nameContainsSet", target.getInjectionTargetName(), correctName, reference.getName(), reference.getClass().getSimpleName());
+                        target.setInjectionTargetName(correctName.toString());
+                    }
+                }
+            }
+        }
+    }
+
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java Thu Jul 19 11:47:23 2007
@@ -25,14 +25,13 @@
 import org.apache.openejb.config.ValidationFailure;
 import org.apache.openejb.config.ValidationRule;
 import org.apache.openejb.config.ValidationWarning;
+import org.apache.openejb.config.ValidationError;
 import org.apache.openejb.util.SafeToolkit;
 
 import javax.ejb.EJBLocalObject;
 import java.lang.reflect.Method;
 
-public class CheckMethods implements ValidationRule {
-
-    EjbSet set;
+public class CheckMethods extends ValidationBase {
 
     public void validate(EjbSet set) {
 
@@ -92,12 +91,7 @@
                 Method beanMethod = beanClass.getMethod(name, params);
             } catch (NoSuchMethodException nsme) {
 
-                ValidationFailure failure = new ValidationFailure("no.busines.method");
-                failure.setDetails(interfaceMethods[i].getName(), interfaceMethods[i].toString(), "local", intrface.getName(), beanClass.getName());
-                failure.setComponentName(b.getEjbName());
-
-                set.addFailure(failure);
-
+                fail(b, "no.busines.method", interfaceMethods[i].getName(), interfaceMethods[i].toString(), "local", intrface.getName(), beanClass.getName());
             }
         }
 
@@ -125,16 +119,13 @@
                 Method beanMethod = beanClass.getMethod(name, params);
             } catch (NoSuchMethodException nsme) {
 
-                ValidationFailure failure = new ValidationFailure("no.busines.method");
-                failure.setDetails(interfaceMethods[i].getName(), interfaceMethods[i].toString(), "remote", intrface.getName(), beanClass.getName());
-                failure.setComponentName(b.getEjbName());
-
-                set.addFailure(failure);
+                fail(b, "no.busines.method", interfaceMethods[i].getName(), interfaceMethods[i].toString(), "remote", intrface.getName(), beanClass.getName());
 
             }
         }
     }
 
+
     private void check_homeInterfaceMethods(RemoteBean b) {
         Class home = null;
         Class bean = null;
@@ -175,30 +166,13 @@
 
         if (!hasCreateMethod) {
 
-            ValidationFailure failure = new ValidationFailure("no.home.create");
-            failure.setDetails(b.getHome(), b.getRemote());
-            failure.setComponentName(b.getEjbName());
-
-            set.addFailure(failure);
+            fail(b, "no.home.create", b.getHome(), b.getRemote());
 
         }
 
         return hasCreateMethod;
     }
 
-    public static boolean paramsMatch(Method methodA, Method methodB) {
-        if (methodA.getParameterTypes().length != methodB.getParameterTypes().length){
-            return false;
-        }
-
-        for (int i = 0; i < methodA.getParameterTypes().length; i++) {
-            Class<?> a = methodA.getParameterTypes()[i];
-            Class<?> b = methodB.getParameterTypes()[i];
-            if (!a.equals(b)) return false;
-        }
-        return true;
-    }
-
     public boolean check_createMethodsAreImplemented(RemoteBean b, Class bean, Class home) {
         boolean result = true;
 
@@ -226,19 +200,11 @@
                 if (b instanceof EntityBean) {
                     EntityBean entity = (EntityBean) b;
 
-                    ValidationFailure failure = new ValidationFailure("entity.no.ejb.create");
-                    failure.setDetails(b.getEjbClass(), entity.getPrimKeyClass(), ejbCreateName.toString(), paramString);
-                    failure.setComponentName(b.getEjbName());
-
-                    set.addFailure(failure);
+                    fail(b, "entity.no.ejb.create", b.getEjbClass(), entity.getPrimKeyClass(), ejbCreateName.toString(), paramString);
 
                 } else {
 
-                    ValidationFailure failure = new ValidationFailure("session.no.ejb.create");
-                    failure.setDetails(b.getEjbClass(), ejbCreateName.toString(), paramString);
-                    failure.setComponentName(b.getEjbName());
-
-                    set.addFailure(failure);
+                    fail(b, "session.no.ejb.create", b.getEjbClass(), ejbCreateName.toString(), paramString);
 
                 }
             }
@@ -267,11 +233,7 @@
 
                 String paramString = getParameters(create);
 
-                ValidationFailure failure = new ValidationFailure("no.ejb.post.create");
-                failure.setDetails(b.getEjbClass(), ejbPostCreateName.toString(), paramString);
-                failure.setComponentName(b.getEjbName());
-
-                set.addFailure(failure);
+                fail(b, "no.ejb.post.create", b.getEjbClass(), ejbPostCreateName.toString(), paramString);
 
             }
         }
@@ -297,11 +259,7 @@
 
                 String paramString = getParameters(ejbCreate);
 
-                ValidationWarning warning = new ValidationWarning("unused.ejb.create");
-                warning.setDetails(b.getEjbClass(), ejbCreate.getName(), create.toString(), paramString, home.getName());
-                warning.setComponentName(b.getEjbName());
-
-                set.addWarning(warning);
+                fail(b, "unused.ejb.create", b.getEjbClass(), ejbCreate.getName(), create.toString(), paramString, home.getName());
 
             }
         }
@@ -322,29 +280,5 @@
 ///     beanMethod = beanClass.getMethod(beanMethodName,method.getParameterTypes());
 /// }
 
-    private String getParameters(Method method) {
-        Class[] params = method.getParameterTypes();
-        StringBuffer paramString = new StringBuffer(512);
-
-        if (params.length > 0) {
-            paramString.append(params[0].getName());
-        }
-
-        for (int i = 1; i < params.length; i++) {
-            paramString.append(", ");
-            paramString.append(params[i]);
-        }
-
-        return paramString.toString();
-    }
-
-    private Class loadClass(String clazz) throws OpenEJBException {
-        ClassLoader cl = set.getClassLoader();
-        try {
-            return cl.loadClass(clazz);
-        } catch (ClassNotFoundException cnfe) {
-            throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, set.getJarPath()), cnfe);
-        }
-    }
 }
 

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckServiceRefs.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckServiceRefs.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckServiceRefs.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckServiceRefs.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,41 @@
+/**
+ * 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.config.rules;
+
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.ServiceRef;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckServiceRefs extends ValidationBase {
+    public void validate(EjbSet set) {
+        // Warn that we do not support service-refs yet.
+
+        // Skip if in geronimo
+        if (System.getProperty("duct tape") != null) return;
+
+        this.set = set;
+
+        for (EnterpriseBean bean : set.getEjbJar().getEnterpriseBeans()) {
+            for (ServiceRef ref : bean.getServiceRef()) {
+                warn(bean, "serviceRef.unsupported", ref.getName());
+            }
+        }
+    }
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/ValidationBase.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/ValidationBase.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/ValidationBase.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/ValidationBase.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,129 @@
+/**
+ * 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.config.rules;
+
+import org.apache.openejb.config.ValidationRule;
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.config.ValidationError;
+import org.apache.openejb.config.ValidationFailure;
+import org.apache.openejb.config.ValidationWarning;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.util.SafeToolkit;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class ValidationBase implements ValidationRule {
+    EjbSet set;
+
+    public abstract void validate(EjbSet set);
+
+    public void error(EnterpriseBean bean, String key, Object... details) {
+        ValidationError error = new ValidationError(key);
+        error.setDetails(details);
+        error.setComponentName(bean.getEjbName());
+
+        set.addError(error);
+    }
+
+    public void fail(EnterpriseBean bean, String key, Object... details) {
+        ValidationFailure failure = new ValidationFailure(key);
+        failure.setDetails(details);
+        failure.setComponentName(bean.getEjbName());
+
+        set.addFailure(failure);
+    }
+
+    public void fail(String component, String key, Object... details) {
+        ValidationFailure failure = new ValidationFailure(key);
+        failure.setDetails(details);
+        failure.setComponentName(component);
+
+        set.addFailure(failure);
+    }
+
+    public void warn(EnterpriseBean bean, String key, Object... details) {
+        ValidationWarning warning = new ValidationWarning(key);
+        warning.setDetails(details);
+        warning.setComponentName(bean.getEjbName());
+
+        set.addWarning(warning);
+    }
+
+    public void missingMethod(EnterpriseBean bean, String key, String methodName, Class returnType, Class... paramTypes){
+        fail(bean, key, methodName, returnType.getName(), getParameters(paramTypes));
+    }
+
+    public static boolean paramsMatch(Method methodA, Method methodB) {
+        if (methodA.getParameterTypes().length != methodB.getParameterTypes().length){
+            return false;
+        }
+
+        for (int i = 0; i < methodA.getParameterTypes().length; i++) {
+            Class<?> a = methodA.getParameterTypes()[i];
+            Class<?> b = methodB.getParameterTypes()[i];
+            if (!a.equals(b)) return false;
+        }
+        return true;
+    }
+
+    public String getParameters(Method method) {
+        Class[] params = method.getParameterTypes();
+        return getParameters(params);
+    }
+
+    public String getParameters(Class... params) {
+        StringBuffer paramString = new StringBuffer(512);
+
+        if (params.length > 0) {
+            paramString.append(params[0].getName());
+        }
+
+        for (int i = 1; i < params.length; i++) {
+            paramString.append(", ");
+            paramString.append(params[i]);
+        }
+
+        return paramString.toString();
+    }
+
+    protected Class loadClass(String clazz) throws OpenEJBException {
+        ClassLoader cl = set.getClassLoader();
+        try {
+            return cl.loadClass(clazz);
+        } catch (ClassNotFoundException cnfe) {
+            throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, set.getJarPath()), cnfe);
+        }
+    }
+
+    public String join(List list, String s) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < list.size(); i++) {
+            Object object = list.get(i);
+            sb.append(object.toString());
+            sb.append(s);
+        }
+        if (sb.length() > 0) {
+            sb.delete(sb.length() - s.length(), sb.length());
+        }
+        return sb.toString();
+    }
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties Thu Jul 19 11:47:23 2007
@@ -99,3 +99,115 @@
 1.missing.dependent.class           Missing dependent class or library
 2.missing.dependent.class           Missing dependent class or library: {1} needed by {2}
 3.missing.dependent.class           The class {1} not found and is referenced by the {2} class {0}.  The Check that the class or related library is available in the classpath
+
+
+# CheckAssemblyBindings.java
+# fail("InterceptorBinding", "interceptorBinding.noSuchEjbName", binding.getEjbName(), join(interceptorClasses, ","));
+1.interceptorBinding.noSuchEjbName = Referenced EJB does not exist
+2.interceptorBinding.noSuchEjbName = Referenced EJB does not exist: {0}
+3.interceptorBinding.noSuchEjbName = Binding refers to an EJB, {0}, that does not exist.  Interceptors listed in binding: {1}
+
+# fail("InterceptorBinding", "interceptorBinding.ejbNameRequiredWithMethod", binding.getMethod().getMethodName(), join(interceptorClasses, ","));
+1.interceptorBinding.ejbNameRequiredWithMethod = ejb-name required with method binding
+2.interceptorBinding.ejbNameRequiredWithMethod = ejb-name required with binding on method '{0}'.
+3.interceptorBinding.ejbNameRequiredWithMethod = Binding an interceptor to a specific method requires the ejb-name of the bean to also be specified.  Fix binding on method '{0}' for interceptors {1}.
+
+# fail("MethodPermission", "methodPermission.ejbNameRequired", method.getMethodName(), join(permission.getRoleName(), ","));
+1.methodPermission.ejbNameRequired =  ejb-name required for method-permission
+2.methodPermission.ejbNameRequired =  ejb-name required for method-permission: {0}
+3.methodPermission.ejbNameRequired =  Assinging a method-permission requires the ejb-name of the bean to also be specified.  Fix method-permission on method '{0}' for security roles {1}.
+
+# fail("MethodPermission", "methodPermission.noSuchEjbName", method.getEjbName(), method.getMethodName(), join(permission.getRoleName(), ","));
+1.methodPermission.noSuchEjbName = Referenced EJB does not exist
+2.methodPermission.noSuchEjbName = Referenced EJB does not exist: {0} on method '{1}'.
+3.methodPermission.noSuchEjbName = Method-permission refers to an EJB, {0}, that does not exist.  Fix method-permission on method '{0}' for security roles {1}.
+
+# fail("ContainerTransaction", "containerTransaction.ejbNameRequired", method.getMethodName(), transaction.getTransAttribute());
+1.containerTransaction.ejbNameRequired = ejb-name required for container-transaction
+2.containerTransaction.ejbNameRequired = ejb-name required for container-transaction: {0}
+3.containerTransaction.ejbNameRequired = Assinging a container-transaction requires the ejb-name of the bean to also be specified.  Fix container-transaction on method '{0}' with transaction attribute {1}.
+
+# fail("ContainerTransaction", "containerTransaction.noSuchEjbName", method.getMethodName(), method.getEjbName(), transaction.getTransAttribute());
+1.containerTransaction.noSuchEjbName = Referenced EJB does not exist
+2.containerTransaction.noSuchEjbName = Referenced EJB does not exist: {0} on method '{1}'.
+3.containerTransaction.noSuchEjbName = Container-transaction refers to an EJB, {0}, that does not exist.  Fix container-transaction on method '{0}' with transaction attribute {1}.
+
+# CheckCallbacks.java
+# fail(componentName, "aroundInvoke.badReturnType", aroundInvoke.getMethodName(), returnType.getName());
+1.aroundInvoke.badReturnType = AroundInvoke method must return Object
+2.aroundInvoke.badReturnType = AroundInvoke method must return Object: method '{0}' returns '{1}'
+3.aroundInvoke.badReturnType = AroundInvoke method '{0}' illegally returns type '{1}'.  The required return type for all AroundInvoke methods is java.lang.Object.
+
+# fail(componentName, "aroundInvoke.mustThrowException", aroundInvoke.getMethodName());
+1.aroundInvoke.mustThrowException = AroundInvoke method must declare 'throws Exception'
+2.aroundInvoke.mustThrowException =
+3.aroundInvoke.mustThrowException =
+
+# fail(componentName, "aroundInvoke.missing", aroundInvoke.getMethodName());
+1.aroundInvoke.missing =
+2.aroundInvoke.missing =
+3.aroundInvoke.missing =
+
+# fail(componentName, "aroundInvoke.invalidArguments", aroundInvoke.getMethodName(), getParameters(possibleMethods.get(0)));
+1.aroundInvoke.invalidArguments =
+2.aroundInvoke.invalidArguments =
+3.aroundInvoke.invalidArguments =
+
+# fail(componentName, "aroundInvoke.missing.possibleTypo", aroundInvoke.getMethodName(), possibleMethods.size());
+1.aroundInvoke.missing.possibleTypo =
+2.aroundInvoke.missing.possibleTypo =
+3.aroundInvoke.missing.possibleTypo =
+
+# fail(bean, "callback.badReturnType", type, callback.getMethodName(), returnType.getName());
+1.callback.badReturnType =
+2.callback.badReturnType =
+3.callback.badReturnType =
+
+# fail(bean, "callback.missing", callback.getMethodName());
+1.callback.missing =
+2.callback.missing =
+3.callback.missing =
+
+# fail(bean, "callback.invalidArguments", type, callback.getMethodName(), getParameters(possibleMethods.get(0)));
+1.callback.invalidArguments =
+2.callback.invalidArguments =
+3.callback.invalidArguments =
+
+# fail(bean, "callback.missing.possibleTypo", type, callback.getMethodName(), possibleMethods.size());
+1.callback.missing.possibleTypo =
+2.callback.missing.possibleTypo =
+3.callback.missing.possibleTypo =
+
+# fail("Interceptor", "interceptor.callback.badReturnType", type, callback.getMethodName(), returnType.getName());
+1.interceptor.callback.badReturnType =
+2.interceptor.callback.badReturnType =
+3.interceptor.callback.badReturnType =
+
+# fail("Interceptor", "interceptor.callback.missing", interceptorClass.getName(), callback.getMethodName());
+1.interceptor.callback.missing =
+2.interceptor.callback.missing =
+3.interceptor.callback.missing =
+
+# fail("Interceptor", "interceptor.callback.invalidArguments", interceptorClass.getName(), type, callback.getMethodName(), getParameters(possibleMethods.get(0)));
+1.interceptor.callback.invalidArguments =
+2.interceptor.callback.invalidArguments =
+3.interceptor.callback.invalidArguments =
+
+# fail("Interceptor", "interceptor.callback.missing.possibleTypo", interceptorClass.getName(), type, callback.getMethodName(), possibleMethods.size());
+1.interceptor.callback.missing.possibleTypo =
+2.interceptor.callback.missing.possibleTypo =
+3.interceptor.callback.missing.possibleTypo =
+
+# CheckInjectionTargets.java
+# warn(bean, "injectionTarget.nameContainsSet", target.getInjectionTargetName(), correctName, reference.getName(), reference.getClass().getSimpleName());
+1.injectionTarget.nameContainsSet =
+2.injectionTarget.nameContainsSet =
+3.injectionTarget.nameContainsSet =
+
+
+# CheckServiceRefs.java
+# warn(bean, "serviceRef.unsupported", ref.getName());
+1.serviceRef.unsupported =
+2.serviceRef.unsupported =
+3.serviceRef.unsupported =
+

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckInjectionTargetsTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckInjectionTargetsTest.java?view=auto&rev=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckInjectionTargetsTest.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckInjectionTargetsTest.java Thu Jul 19 11:47:23 2007
@@ -0,0 +1,60 @@
+/**
+ * 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.config.rules;
+
+import junit.framework.TestCase;
+import org.apache.openejb.config.EjbSet;
+import org.apache.openejb.config.ValidationWarning;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.EnvEntry;
+import org.apache.openejb.jee.InjectionTarget;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckInjectionTargetsTest extends TestCase {
+
+    public void test() throws Exception {
+
+        EjbSet ejbSet = new EjbSet("myJarPath", new EjbJar(), this.getClass().getClassLoader());
+        StatelessBean bean = ejbSet.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));
+
+        // Valid
+        EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
+        envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
+        bean.getEnvEntry().add(envEntry);
+
+        // Invalid
+        EnvEntry envEntry2 = new EnvEntry("color", String.class.getName(), "yellow");
+        envEntry2.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/setColor"));
+        bean.getEnvEntry().add(envEntry2);
+
+        // Invalid
+        EnvEntry envEntry3 = new EnvEntry("age", Integer.class.getName(), "5");
+        envEntry3.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "setAge"));
+        bean.getEnvEntry().add(envEntry3);
+
+        CheckInjectionTargets rule = new CheckInjectionTargets();
+        rule.validate(ejbSet);
+
+        ValidationWarning[] warnings = ejbSet.getWarnings();
+        assertEquals(warnings.length, 2);
+
+    }
+
+}

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EjbJar.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EjbJar.java?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EjbJar.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EjbJar.java Thu Jul 19 11:47:23 2007
@@ -170,7 +170,7 @@
     }
     
     public Interceptor[] getInterceptors() {
-        if (interceptors == null) return null;
+        if (interceptors == null) return new Interceptor[]{};
         return interceptors.getInterceptor();
     }
 

Modified: openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/src/main/resources/META-INF/ejb-jar.xml?view=diff&rev=557730&r1=557729&r2=557730
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/src/main/resources/META-INF/ejb-jar.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/src/main/resources/META-INF/ejb-jar.xml Thu Jul 19 11:47:23 2007
@@ -55,7 +55,11 @@
     	</exclude-default-interceptors>
     </interceptor-binding>
     
-    --><interceptor-binding>
+    -->
+    <!-- For some reason the beans associated with these bindings
+         are not present.  Commenting the bindings out as the validation
+         code now checks for valid bindings
+    <interceptor-binding>
     	<ejb-name>SecondStatefulIntercepted</ejb-name>
     	<exclude-default-interceptors>
     		true
@@ -81,6 +85,7 @@
     		<method-name>getContextData</method-name>
     	</method>
     </interceptor-binding>
-
+    -->
+    
   </assembly-descriptor>
 </ejb-jar>