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 2011/06/14 13:45:11 UTC

svn commit: r1135499 - in /openejb/trunk/openejb3: container/openejb-core/ container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/apache/openejb/config/ container/openejb-core/src/main/java/o...

Author: rmannibucau
Date: Tue Jun 14 11:45:09 2011
New Revision: 1135499

URL: http://svn.apache.org/viewvc?rev=1135499&view=rev
Log:
adding auto registring for annotated mbeans

Added:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/MBeanDeployer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/MBeanDeployerTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/
    openejb/trunk/openejb3/deps/mbean-annotation-api/pom.xml
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/Description.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/MBean.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedAttribute.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedOperation.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfo.java
    openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfos.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/pom.xml
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AppInfo.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java
    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/AppInfoBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
    openejb/trunk/openejb3/deps/pom.xml

Modified: openejb/trunk/openejb3/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/pom.xml?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/pom.xml (original)
+++ openejb/trunk/openejb3/container/openejb-core/pom.xml Tue Jun 14 11:45:09 2011
@@ -50,7 +50,7 @@
       org.apache.commons.dbcp*;resolution:=optional,
       org.apache.xerces*;resolution:=optional,
       org.apache.xml.resolver*;resolution:=optional,
-      org.junit*;resolution:=optional, 
+      org.junit*;resolution:=optional,
       javax.annotation*;version=1.1,
       javax.transaction*;version=1.1,
       javax.ejb*;version=3.1,
@@ -205,6 +205,11 @@
   </build>
   <dependencies>
     <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>mbean-annotation-api</artifactId>
+      <version>4.0.0-SNAPSHOT</version>
+  </dependency>
+    <dependency>
       <groupId>org.apache.bval</groupId>
       <artifactId>bval-core</artifactId>
     </dependency>

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AppInfo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AppInfo.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AppInfo.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AppInfo.java Tue Jun 14 11:45:09 2011
@@ -38,4 +38,5 @@ public class AppInfo extends InfoObject 
     public final JndiEncInfo globalJndiEnc = new JndiEncInfo();
     public final JndiEncInfo appJndiEnc = new JndiEncInfo();
     public String cmpMappingsXml;
+    public Set<String> jmx = new TreeSet<String>();
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Tue Jun 14 11:45:09 2011
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.Instrumentation;
+import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -30,6 +31,11 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import javax.management.InstanceNotFoundException;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
 import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -1082,6 +1088,23 @@ public class Assembler extends Assembler
             }
         }
 
+        // mbeans
+        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        for (String objectName : appInfo.jmx) {
+            try {
+              ObjectName on = new ObjectName(objectName);
+              if (server.isRegistered(on)) {
+                      server.unregisterMBean(on);
+              }
+            } catch (InstanceNotFoundException e) {
+                logger.warning("can't unregister " + objectName + " because the mbean was not found", e);
+            } catch (MBeanRegistrationException e) {
+                logger.warning("can't unregister " + objectName, e);
+            } catch (MalformedObjectNameException mone) {
+                logger.warning("can't unregister because the ObjectName is malformed: " + objectName, mone);
+            }
+        }
+
         ClassLoaderUtil.destroyClassLoader(appInfo.path);
 
         if (undeployException.getCauses().size() > 0) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ValidatorBuilder.java Tue Jun 14 11:45:09 2011
@@ -16,12 +16,8 @@
  */
 package org.apache.openejb.assembler.classic;
 
-import org.apache.openejb.config.sys.JaxbOpenejb;
-import org.apache.openejb.jee.bval.PropertyType;
-import org.apache.openejb.jee.bval.ValidationConfigType;
-import org.apache.openejb.util.LogCategory;
-import org.apache.openejb.util.Logger;
-
+import java.io.InputStream;
+import java.util.Map;
 import javax.validation.Configuration;
 import javax.validation.ConstraintValidatorFactory;
 import javax.validation.MessageInterpolator;
@@ -29,11 +25,11 @@ import javax.validation.TraversableResol
 import javax.validation.Validation;
 import javax.validation.ValidationException;
 import javax.validation.ValidatorFactory;
-import javax.validation.spi.ValidationProvider;
 import javax.xml.bind.JAXBElement;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
+import org.apache.openejb.jee.bval.PropertyType;
+import org.apache.openejb.jee.bval.ValidationConfigType;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 
 public final class ValidatorBuilder {
     public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, ValidatorBuilder.class);
@@ -46,22 +42,6 @@ public final class ValidatorBuilder {
         return buildFactory(info, classLoader);
     }
 
-    public static ValidationConfigType readConfig(URL url) {
-        if (url == null) {
-            return null;
-        }
-
-        ValidationConfigType validationConfigType;
-        try {
-            validationConfigType = JaxbOpenejb.unmarshal(ValidationConfigType.class, url.openStream());
-        } catch (Throwable t) {
-            logger.warning("Unable to create module ValidatorFactory instance.  Using default factory", t);
-            return null;
-        }
-
-        return validationConfigType;
-    }
-
     public static ValidationInfo getInfo(ValidationConfigType config) {
         ValidationInfo info = new ValidationInfo();
         if (config != null) {

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?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- 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 Tue Jun 14 11:45:09 2011
@@ -25,7 +25,6 @@ import java.beans.IntrospectionException
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -90,7 +89,6 @@ import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
 import javax.ejb.TransactionManagement;
 import javax.ejb.TransactionManagementType;
-import javax.inject.Inject;
 import javax.interceptor.ExcludeClassInterceptors;
 import javax.interceptor.ExcludeDefaultInterceptors;
 import javax.interceptor.Interceptors;
@@ -254,11 +252,13 @@ public class AnnotationDeployer implemen
     private final DiscoverAnnotatedBeans discoverAnnotatedBeans;
     private final ProcessAnnotatedBeans processAnnotatedBeans;
     private final EnvEntriesPropertiesDeployer envEntriesPropertiesDeployer;
+    private final MBeanDeployer mBeanDeployer;
 
     public AnnotationDeployer() {
         discoverAnnotatedBeans = new DiscoverAnnotatedBeans();
         processAnnotatedBeans = new ProcessAnnotatedBeans();
         envEntriesPropertiesDeployer = new EnvEntriesPropertiesDeployer();
+        mBeanDeployer = new MBeanDeployer();
     }
 
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
@@ -267,6 +267,7 @@ public class AnnotationDeployer implemen
             appModule = discoverAnnotatedBeans.deploy(appModule);
             appModule = envEntriesPropertiesDeployer.deploy(appModule);
             appModule = processAnnotatedBeans.deploy(appModule);
+            appModule = mBeanDeployer.deploy(appModule);
             return appModule;
         } finally {
             removeModule();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java Tue Jun 14 11:45:09 2011
@@ -103,6 +103,7 @@ class AppInfoBuilder {
         appInfo.path = appModule.getJarLocation();
         appInfo.standaloneModule = appModule.isStandaloneModule();
         appInfo.watchedResources.addAll(appModule.getWatchedResources());
+        appInfo.jmx = appModule.getMBeans();
 
         if (appInfo.appId == null) throw new IllegalArgumentException("AppInfo.appId cannot be null");
         if (appInfo.path == null) appInfo.path = appInfo.appId;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java Tue Jun 14 11:45:09 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb.config;
 
+import java.util.HashSet;
 import org.apache.openejb.jee.Application;
 import org.apache.openejb.jee.jpa.EntityMappings;
 
@@ -48,6 +49,7 @@ public class AppModule implements Deploy
     private final Map<String,Object> altDDs = new HashMap<String,Object>();
     private final Set<String> watchedResources = new TreeSet<String>();
     private final boolean standaloneModule;
+    private Set<String> mBeans = new HashSet<String>();
 
     private ID id;
 
@@ -90,6 +92,14 @@ public class AppModule implements Deploy
         this.standaloneModule = standaloneModule;
     }
 
+    public Set<String> getMBeans() {
+        return mBeans;
+    }
+
+    public void setMBeans(Set<String> mBeans) {
+        this.mBeans = mBeans;
+    }
+
     public boolean isStandaloneModule() {
         return standaloneModule;
     }

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/MBeanDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/MBeanDeployer.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/MBeanDeployer.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/MBeanDeployer.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,174 @@
+/**
+ * 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;
+
+import java.lang.management.ManagementFactory;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.management.MBean;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import org.apache.openejb.OpenEJB;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.monitoring.DynamicMBeanWrapper;
+import org.apache.openejb.monitoring.ObjectNameBuilder;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
+import org.apache.xbean.finder.ClassFinder;
+
+/**
+ * @author Romain Manni-Bucau
+ */
+public class MBeanDeployer implements DynamicDeployer {
+    private static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP_CONFIG, MBeanDeployer.class);
+    private static final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+
+    private static final String OPENEJB_MBEAN_CLASSES_PROPERTY = "openejb.user.mbeans.list";
+    private static final String OPENEJB_MBEAN_CLASSES_SPLIT = ",";
+    private static final String OPENEJB_MBEAN_FORCE_FINDER = "*";
+
+    @Override public AppModule deploy(AppModule appModule) throws OpenEJBException {
+        logger.debug("looking for annotated MBeans in " + appModule.getModuleId());
+        Set<String> mbeans = new TreeSet<String>();
+
+        deploy(mbeans, appModule.getClassLoader(), appModule.getModuleId());
+        List<String> done = new ArrayList<String>();
+        for (WebModule webModule : appModule.getWebModules()) {
+            deploy(mbeans, webModule.getClassLoader(), webModule.getModuleId());
+            done.add(webModule.getJarLocation());
+        }
+        for (EjbModule ejbModule : appModule.getEjbModules()) {
+            if (!done.contains(ejbModule.getJarLocation())) {
+                deploy(mbeans, ejbModule.getClassLoader(), ejbModule.getModuleId());
+                done.add(ejbModule.getJarLocation());
+            }
+        }
+        for (ClientModule clientModule : appModule.getClientModules()) {
+            if (!done.contains(clientModule.getJarLocation())) {
+                deploy(mbeans, clientModule.getClassLoader(), clientModule.getModuleId());
+                done.add(clientModule.getJarLocation());
+            }
+        }
+
+        List<URL> libs = appModule.getAdditionalLibraries();
+        Iterator<URL> it = libs.iterator();
+        while (it.hasNext()) {
+            URL url = it.next();
+            for (String location : done) {
+                if (url.getFile().equals(location)) {
+                    it.remove();
+                }
+            }
+        }
+        if (libs.size() > 0) {
+            ClassLoader additionnalLibCl = new URLClassLoader(libs.toArray(new URL[libs.size()]));
+            deploy(mbeans, additionnalLibCl, appModule.getModuleId() + ".add-lib");
+        }
+
+        appModule.setMBeans(mbeans);
+        logger.debug("registered " + mbeans.size() + " annotated MBeans in " + appModule.getModuleId());
+        return appModule;
+    }
+
+    private static void deploy(Set<String> mbeans, ClassLoader cl, String id) {
+        if (cl == null) {
+            return;
+        }
+
+        for (Map.Entry<Class<?>, ObjectName> mbean : getMbeanClasses(cl, id).entrySet()) {
+            ObjectName objectName = mbean.getValue();
+            try {
+                server.registerMBean(new DynamicMBeanWrapper(mbean.getKey()), objectName);
+                mbeans.add(objectName.getCanonicalName());
+                logger.info("MBean " + objectName.getCanonicalName() + " registered.");
+            } catch (Exception e) {
+                logger.error("the mbean " + mbean.getKey().getName() + " can't be registered", e);
+            }
+        }
+    }
+
+    /**
+     * if OPENEJB_MBEAN_FORCE_FINDER system property is set mbeans will be searched from the class loader
+     * otherwise the OPENEJB_MBEAN_CLASSES_PROPERTY system property will be used.
+     *
+     * @param cl the classloader used
+     * @param id application id
+     * @return the list of mbean classes
+     */
+    private static Map<Class<?>, ObjectName> getMbeanClasses(ClassLoader cl, String id) {
+        ClassLoader classLoader = cl;
+        if (classLoader == null) {
+            classLoader = Thread.currentThread().getContextClassLoader();
+            if (classLoader == null) {
+                classLoader = OpenEJB.class.getClassLoader();
+            }
+        }
+
+        Map<Class<?>, ObjectName> mbeans = new HashMap<Class<?>, ObjectName>();
+
+        String listProp = SystemInstance.get().getProperty(OPENEJB_MBEAN_CLASSES_PROPERTY);
+        if (OPENEJB_MBEAN_FORCE_FINDER.equals(listProp)) { // the classfinder costs too much to be used by default
+            logger.debug("loading mbeans using an annotation finder, you should maybe adjust {} system property",
+                                            OPENEJB_MBEAN_CLASSES_PROPERTY);
+            List<Class<?>> list = Collections.emptyList();
+            try {
+                ClassFinder mbeanFinder = new ClassFinder(classLoader, true);
+                list = mbeanFinder.findAnnotatedClasses(MBean.class);
+            } catch (Exception e) {
+                logger.error("can't find annotated MBean", e);
+            }
+
+            for (Class<?> clazz : list) {
+                mbeans.put(clazz, getObjectName(clazz, id));
+            }
+        } else if (listProp != null) {
+            for (String name : listProp.replace(" ", "").split(OPENEJB_MBEAN_CLASSES_SPLIT)) {
+                name = name.trim();
+                try {
+                    Class<?> clazz = classLoader.loadClass(name);
+                    ObjectName objectName = getObjectName(clazz, id);
+                    if (!server.isRegistered(objectName)) {
+                        mbeans.put(clazz, objectName);
+                    }
+                } catch (ClassNotFoundException ignore) { // it is maybe in another classloader
+                    logger.debug("mbean not found in classloader " + classLoader.toString()
+                        + ", we will try in the next app", ignore);
+                } catch (NoClassDefFoundError ignore) {
+                    logger.debug("mbean not found in the current app", ignore);
+                }
+            }
+        }
+        return mbeans;
+    }
+
+    private static ObjectName getObjectName(Class<?> mBean, String id) {
+        ObjectNameBuilder builder = new ObjectNameBuilder("openejb.user.mbeans");
+        builder.set("group", mBean.getPackage().getName());
+        builder.set("application", id);
+        builder.set("name", mBean.getSimpleName());
+        return builder.build();
+    }
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java Tue Jun 14 11:45:09 2011
@@ -16,8 +16,24 @@
  */
 package org.apache.openejb.config;
 
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.assembler.classic.ValidatorBuilder;
+import org.apache.openejb.config.sys.JaxbOpenejb;
 import org.apache.openejb.core.webservices.WsdlResolver;
 import org.apache.openejb.jee.ApplicationClient;
 import org.apache.openejb.jee.Beans;
@@ -31,6 +47,7 @@ import org.apache.openejb.jee.JaxbJavaee
 import org.apache.openejb.jee.TldTaglib;
 import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.jee.Webservices;
+import org.apache.openejb.jee.bval.ValidationConfigType;
 import org.apache.openejb.jee.jpa.EntityMappings;
 import org.apache.openejb.jee.jpa.unit.JaxbPersistenceFactory;
 import org.apache.openejb.jee.jpa.unit.Persistence;
@@ -45,25 +62,6 @@ import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-
-import static org.apache.openejb.util.URLs.toFilePath;
-
 public class ReadDescriptors implements DynamicDeployer {
     @SuppressWarnings({"unchecked"})
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
@@ -130,13 +128,19 @@ public class ReadDescriptors implements 
 
     }
 
-    private void readValidationConfigType(Module module) {
+    private void readValidationConfigType(Module module) throws OpenEJBException {
         if (module.getValidationConfig() != null) {
             return;
         }
         URL url = (URL) module.getAltDDs().get("validation.xml");
         if (url != null) {
-            module.setValidationConfig(ValidatorBuilder.readConfig(url));
+            ValidationConfigType validationConfigType;
+            try {
+                validationConfigType = JaxbOpenejb.unmarshal(ValidationConfigType.class, url.openStream());
+                module.setValidationConfig(validationConfigType);
+            } catch (Throwable t) {
+                throw new OpenEJBException("Unable to create module ValidatorFactory instance.  Using default factory");
+            }
         }
     }
 

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,275 @@
+/**
+ * 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.monitoring;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.Description;
+import javax.management.DynamicMBean;
+import javax.management.ImmutableDescriptor;
+import javax.management.IntrospectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.ManagedAttribute;
+import javax.management.ManagedOperation;
+import javax.management.NotificationInfo;
+import javax.management.NotificationInfos;
+import javax.management.ReflectionException;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
+
+public class DynamicMBeanWrapper implements DynamicMBean {
+    public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_DEPLOY, DynamicMBeanWrapper.class);
+
+    private final MBeanInfo info;
+    private final Map<String, Method> getters = new HashMap<String, Method>();
+    private final Map<String, Method> setters = new HashMap<String, Method>();
+    private final Map<String, Method> operations = new HashMap<String, Method>();
+    private final Object instance;
+
+    public DynamicMBeanWrapper(Class<?> annotatedMBean) {
+        String description;
+        List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
+        List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
+        List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();
+
+        // instantiation
+        try {
+            instance = annotatedMBean.newInstance();
+        } catch (InstantiationException ie) {
+            logger.error("can't instantiate " + annotatedMBean.getName(), ie);
+            throw new IllegalArgumentException(annotatedMBean.getName());
+        } catch (IllegalAccessException iae) {
+            logger.error("can't instantiate " + annotatedMBean.getName(), iae);
+            throw new IllegalArgumentException(annotatedMBean.getName());
+        }
+
+        // class
+        Description classDescription = annotatedMBean.getAnnotation(Description.class);
+        description = getDescription(classDescription, "a MBean built by OpenEJB");
+
+        NotificationInfo notification = annotatedMBean.getAnnotation(NotificationInfo.class);
+        if (notification != null) {
+            MBeanNotificationInfo notificationInfo = getNotificationInfo(notification);
+            notificationInfos.add(notificationInfo);
+        }
+
+        NotificationInfos notifications = annotatedMBean.getAnnotation(NotificationInfos.class);
+        if (notifications != null && notifications.value() != null) {
+            for (NotificationInfo n : notifications.value()) {
+                MBeanNotificationInfo notificationInfo = getNotificationInfo(n);
+                notificationInfos.add(notificationInfo);
+            }
+        }
+
+
+        // methods
+        for (Method m : annotatedMBean.getMethods()) {
+            int modifiers = m.getModifiers();
+            if (m.getDeclaringClass().equals(Object.class)
+                || !Modifier.isPublic(modifiers)
+                || Modifier.isAbstract(modifiers)) {
+                continue;
+            }
+
+            if (m.getAnnotation(ManagedAttribute.class) != null) {
+                String methodName = m.getName();
+                String attrName = methodName;
+                if (((attrName.startsWith("get") && m.getParameterTypes().length == 0)
+                    || (attrName.startsWith("set") && m.getParameterTypes().length == 1))
+                    && attrName.length() > 3) {
+                    attrName = attrName.substring(3);
+                    if (attrName.length() > 1) {
+                        attrName = Character.toLowerCase(attrName.charAt(0)) + attrName.substring(1);
+                    } else {
+                        attrName = attrName.toLowerCase();
+                    }
+                } else {
+                    logger.warning("ignoring attribute " + m.getName() + " for " + annotatedMBean.getName());
+                }
+
+                if (methodName.startsWith("get")) {
+                    getters.put(attrName, m);
+                } else if (methodName.startsWith("set")) {
+                    setters.put(attrName, m);
+                }
+            } else if (m.getAnnotation(ManagedOperation.class) != null) {
+                operations.put(m.getName(), m);
+
+                String operationDescr = "";
+                Description descr = m.getAnnotation(Description.class);
+                if (descr != null) {
+                    operationDescr = getDescription(descr, "-");
+                }
+
+                operationInfos.add(new MBeanOperationInfo(operationDescr, m));
+            }
+        }
+
+        for (Map.Entry<String, Method> e : getters.entrySet()) {
+            String key = e.getKey();
+            Method mtd = e.getValue();
+
+            String attrDescr = "";
+            Description descr = mtd.getAnnotation(Description.class);
+            if (descr != null) {
+                attrDescr = getDescription(descr, "-");
+            }
+
+            try {
+                attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
+            } catch (IntrospectionException ex) {
+                logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
+            }
+        }
+
+        info = new MBeanInfo(annotatedMBean.getName(),
+            description,
+            attributeInfos.toArray(new MBeanAttributeInfo[attributeInfos.size()]),
+            null, // default constructor is mandatory
+            operationInfos.toArray(new MBeanOperationInfo[operationInfos.size()]),
+            notificationInfos.toArray(new MBeanNotificationInfo[notificationInfos.size()]));
+    }
+
+    private MBeanNotificationInfo getNotificationInfo(NotificationInfo n) {
+        String description = getDescription(n.description(), "-");
+        MBeanNotificationInfo ni = new MBeanNotificationInfo(n.types(),
+            n.notificationClass().getName(), description,
+            new ImmutableDescriptor(n.descriptorFields()));
+        return ni;
+    }
+
+    private String getDescription(Description d, String defaultValue) {
+        if (d != null) {
+            if (d.bundleBaseName() != null && d.key() != null) {
+                try {
+                    return ResourceBundle
+                        .getBundle(d.bundleBaseName())
+                        .getString(d.key());
+                } catch (RuntimeException re) {
+                    return d.value();
+                }
+            } else {
+                return d.value();
+            }
+        }
+        return defaultValue;
+    }
+
+    @Override
+    public MBeanInfo getMBeanInfo() {
+        return info;
+    }
+
+    @Override
+    public Object getAttribute(String attribute)
+        throws AttributeNotFoundException, MBeanException,
+        ReflectionException {
+        if (getters.containsKey(attribute)) {
+            try {
+                return getters.get(attribute).invoke(instance);
+            } catch (IllegalArgumentException e) {
+                logger.error("can't get " + attribute + " value", e);
+            } catch (IllegalAccessException e) {
+                logger.error("can't get " + attribute + " value", e);
+            } catch (InvocationTargetException e) {
+                logger.error("can't get " + attribute + " value", e);
+            }
+        }
+        throw new AttributeNotFoundException();
+    }
+
+    @Override
+    public void setAttribute(Attribute attribute)
+        throws AttributeNotFoundException, InvalidAttributeValueException,
+        MBeanException, ReflectionException {
+        if (setters.containsKey(attribute.getName())) {
+            try {
+                setters.get(attribute.getName()).invoke(instance, attribute.getValue());
+            } catch (IllegalArgumentException e) {
+                logger.error("can't set " + attribute + " value", e);
+            } catch (IllegalAccessException e) {
+                logger.error("can't set " + attribute + " value", e);
+            } catch (InvocationTargetException e) {
+                logger.error("can't set " + attribute + " value", e);
+            }
+        } else {
+            throw new AttributeNotFoundException();
+        }
+    }
+
+    @Override
+    public AttributeList getAttributes(String[] attributes) {
+        AttributeList list = new AttributeList();
+        for (String n : attributes) {
+            try {
+                list.add(new Attribute(n, getAttribute(n)));
+            } catch (Exception ignore) {
+                // no-op
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public AttributeList setAttributes(AttributeList attributes) {
+        AttributeList list = new AttributeList();
+        Iterator<Object> it = attributes.iterator();
+        ;
+        while (it.hasNext()) {
+            Attribute attr = (Attribute) it.next();
+            try {
+                setAttribute(attr);
+                list.add(attr);
+            } catch (Exception ignore) {
+                // no-op
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public Object invoke(String actionName, Object[] params, String[] signature)
+        throws MBeanException, ReflectionException {
+        if (operations.containsKey(actionName)) {
+            try {
+                return operations.get(actionName).invoke(instance, params);
+            } catch (IllegalArgumentException e) {
+                logger.error(actionName + "can't be invoked", e);
+            } catch (IllegalAccessException e) {
+                logger.error(actionName + "can't be invoked", e);
+            } catch (InvocationTargetException e) {
+                logger.error(actionName + "can't be invoked", e);
+            }
+        }
+        throw new MBeanException(new IllegalArgumentException(), actionName + " doesn't exist");
+    }
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/MBeanDeployerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/MBeanDeployerTest.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/MBeanDeployerTest.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/MBeanDeployerTest.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,234 @@
+/**
+ * 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;
+
+import java.lang.management.ManagementFactory;
+import java.util.Scanner;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.ProxyFactoryInfo;
+import org.apache.openejb.assembler.classic.SecurityServiceInfo;
+import org.apache.openejb.assembler.classic.TransactionServiceInfo;
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.ConfigurationFactory;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.loader.SystemInstance;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * Note: each MBeans are at least deployed twice (using old and spec module name).
+ *
+ * @author Romain Manni-Bucau
+ *         openejb.user.mbeans.list=org.apache.openejb.mbeans.Empty,
+ *         org.apache.openejb.mbeans.Inheritance,
+ *         org.apache.openejb.mbeans.MBeanDescription,
+ *         org.apache.openejb.mbeans.MBeanNotificationlistener,
+ *         org.apache.openejb.mbeans.MultipleNotifications,
+ *         org.apache.openejb.mbeans.Notificater,
+ *         org.apache.openejb.mbeans.Operation,
+ *         org.apache.openejb.mbeans.OperationDescription,
+ *         org.apache.openejb.mbeans.Reader,
+ *         org.apache.openejb.mbeans.ReaderWriter,
+ *         org.apache.openejb.mbeans.ReaderDescription
+ */
+public class MBeanDeployerTest {
+    private static final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+    private static final String LIST_PROPR = "openejb.user.mbeans.list";
+
+    private static AppModule appModule;
+    private static Assembler assembler;
+    private static ConfigurationFactory config;
+
+    /**
+     * needs properties so it is not done in a @Before
+     * because SystemInstance.get().setProperty(LIST_PROPR, ...) is done in @Test methods.
+     */
+    private void startOpenEJB() throws Exception {
+        config = new ConfigurationFactory();
+        assembler = new Assembler();
+        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
+        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
+        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
+
+        EjbJar ejbJar = new EjbJar();
+        EjbModule ejbModule = new EjbModule(ejbJar);
+
+        appModule = new AppModule(ejbModule.getClassLoader(), "mbeans");
+        appModule.getEjbModules().add(ejbModule);
+        assembler.createApplication(config.configureApplication(appModule));
+    }
+
+    @After public void resetList() {
+        assembler.destroy();
+        SystemInstance.reset();
+    }
+
+    @Test public void empty() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.Empty");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        ObjectName on = new ObjectName(appModule.getMBeans().iterator().next());
+        String cn = on.getCanonicalName();
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=Empty"));
+        assertTrue(server.isRegistered(on));
+    }
+
+    @Test public void reader() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.Reader");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=Reader"));
+        assertTrue(server.isRegistered(on));
+        assertEquals(2, server.getAttribute(on, "value"));
+    }
+
+    @Test public void writer() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.ReaderWriter");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=ReaderWriter"));
+        assertTrue(server.isRegistered(on));
+        assertEquals(2, server.getAttribute(on, "value"));
+        server.setAttribute(on, new Attribute("value", 5));
+        assertEquals(5, server.getAttribute(on, "value"));
+    }
+
+    @Test public void emptyAndReader() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.Empty,org.apache.openejb.mbeans.Reader");
+        startOpenEJB();
+
+        assertEquals(4, appModule.getMBeans().size());
+        for (String cn : appModule.getMBeans()) {
+            ObjectName on = new ObjectName(cn);
+            assertTrue(cn.startsWith("openejb.user.mbeans"));
+            assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+            assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+            assertTrue(cn.contains("name=Reader") || cn.contains("name=Empty"));
+            assertTrue(server.isRegistered(on));
+        }
+    }
+
+    @Test public void inheritance() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.Inheritance");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=Inheritance"));
+        assertTrue(server.isRegistered(on));
+        assertEquals(2, server.getAttribute(on, "value"));
+        server.setAttribute(on, new Attribute("value", 5));
+        assertEquals(5, server.getAttribute(on, "value"));
+        assertEquals("yes - no", server.invoke(on, "returnValue", null, null));
+    }
+
+    @Test public void description() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.MBeanDescription");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=MBeanDescription"));
+        assertTrue(server.isRegistered(on));
+        assertEquals("descr ;)", server.getMBeanInfo(on).getDescription());
+    }
+
+    @Test public void operation() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.Operation");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=Operation"));
+        assertTrue(server.isRegistered(on));
+        assertEquals("yes - no", server.invoke(on, "returnValue", null, null));
+    }
+
+    @Test public void readerDescription() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.ReaderDescription");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=ReaderDescription"));
+        assertTrue(server.isRegistered(on));
+        assertEquals(1, server.getMBeanInfo(on).getAttributes().length);
+        assertEquals("just a value", server.getMBeanInfo(on).getAttributes()[0].getDescription());
+    }
+
+    @Test public void operationDescription() throws Exception {
+        SystemInstance.get().setProperty(LIST_PROPR, "org.apache.openejb.mbeans.OperationDescription");
+        startOpenEJB();
+
+        assertEquals(2, appModule.getMBeans().size());
+
+        String cn = appModule.getMBeans().iterator().next();
+        ObjectName on = new ObjectName(cn);
+        assertTrue(cn.startsWith("openejb.user.mbeans"));
+        assertTrue(cn.contains("group=org.apache.openejb.mbeans"));
+        assertTrue(cn.contains("application=mbeans") || cn.contains("application=EjbModule"));
+        assertTrue(cn.contains("name=OperationDescription"));
+        assertTrue(server.isRegistered(on));
+        assertEquals(1, server.getMBeanInfo(on).getOperations().length);
+        assertEquals("just an op", server.getMBeanInfo(on).getOperations()[0].getDescription());
+    }
+}
+

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,23 @@
+/**
+ * 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.mbeans;
+
+import javax.management.MBean;
+
+@MBean
+public class Empty {
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,28 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedOperation;
+
+@MBean
+public class Inheritance extends ReaderWriter {
+	@ManagedOperation @Description("just an op") public String returnValue() {
+		return "yes - no";
+	}
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,26 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+
+@MBean
+@Description("descr ;)")
+public class MBeanDescription {
+
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedOperation;
+
+@MBean
+@Description("descr ;)")
+public class Operation {
+	@ManagedOperation public String returnValue() {
+		return "yes - no";
+	}
+
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,29 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedOperation;
+
+@MBean
+@Description("descr ;)")
+public class OperationDescription {
+	@ManagedOperation @Description("just an op") public String returnValue() {
+		return "yes - no";
+	}
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedAttribute;
+
+@MBean
+@Description("descr ;)")
+public class Reader {
+	@ManagedAttribute public int getValue() {
+		return 2;
+	}
+
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedAttribute;
+
+@MBean
+@Description("descr ;)")
+public class ReaderDescription {
+	@ManagedAttribute @Description("just a value") public int getValue() {
+		return 2;
+	}
+
+}

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java Tue Jun 14 11:45:09 2011
@@ -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.mbeans;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedAttribute;
+
+@MBean
+@Description("descr ;)")
+public class ReaderWriter {
+	private int i = -1;
+
+	@ManagedAttribute @Description("just a value") public int getValue() {
+		if (i < 0) {
+			return 2;
+		}
+		return i;
+	}
+
+	@ManagedAttribute public void setValue(int v) {
+		i = v;
+	}
+}

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/pom.xml?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/pom.xml (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/pom.xml Tue Jun 14 11:45:09 2011
@@ -0,0 +1,10 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>deps</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>4.0.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>mbean-annotation-api</artifactId>
+  <name>OpenEJB :: Dependencies :: MBean Annotation API</name>
+</project>

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/Description.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/Description.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/Description.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/Description.java Tue Jun 14 11:45:09 2011
@@ -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 javax.management;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(value=RetentionPolicy.RUNTIME)
+@Target(value={
+		ElementType.CONSTRUCTOR,
+		ElementType.FIELD,
+		ElementType.METHOD,
+		ElementType.PARAMETER,
+		ElementType.TYPE
+})
+public @interface Description {
+	String value() default "";
+	String bundleBaseName() default "";
+	String key() default "";
+}

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/MBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/MBean.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/MBean.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/MBean.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,30 @@
+/**
+ * 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 javax.management;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.TYPE)
+@Inherited
+public @interface MBean {
+}
+

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedAttribute.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedAttribute.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedAttribute.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedAttribute.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,29 @@
+/**
+ * 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 javax.management;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+@Documented
+public @interface ManagedAttribute {
+}

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedOperation.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedOperation.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedOperation.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/ManagedOperation.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,29 @@
+/**
+ * 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 javax.management;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+@Documented
+public @interface ManagedOperation {
+}

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfo.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfo.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfo.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,35 @@
+/**
+ * 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 javax.management;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Inherited
+@Target(value = ElementType.TYPE)
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface NotificationInfo {
+	String[] types() default {};
+	Description description() default @Description(value = "");
+	Class<? extends Notification> notificationClass() default Notification.class;
+	String[] descriptorFields() default {};
+}

Added: openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfos.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfos.java?rev=1135499&view=auto
==============================================================================
--- openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfos.java (added)
+++ openejb/trunk/openejb3/deps/mbean-annotation-api/src/main/java/javax/management/NotificationInfos.java Tue Jun 14 11:45:09 2011
@@ -0,0 +1,32 @@
+/**
+ * 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 javax.management;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Inherited
+@Target(value = ElementType.TYPE)
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface NotificationInfos {
+	NotificationInfo[] value();
+}

Modified: openejb/trunk/openejb3/deps/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/deps/pom.xml?rev=1135499&r1=1135498&r2=1135499&view=diff
==============================================================================
--- openejb/trunk/openejb3/deps/pom.xml (original)
+++ openejb/trunk/openejb3/deps/pom.xml Tue Jun 14 11:45:09 2011
@@ -29,5 +29,6 @@
 
   <modules>
     <module>javaee-api</module>
+    <module>mbean-annotation-api</module>
   </modules>
 </project>