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 2012/02/19 23:32:13 UTC

svn commit: r1291077 [3/4] - in /openejb/trunk/openejb/examples: bean-validation-design-by-contract/ bean-validation-design-by-contract/src/main/java/org/superbiz/designbycontract/ bean-validation-design-by-contract/src/test/java/ cdi-interceptors/ cdi...

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/BoostrapUtility.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/BoostrapUtility.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/BoostrapUtility.java (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/BoostrapUtility.java Sun Feb 19 22:32:10 2012
@@ -1,51 +1,51 @@
-/**
- * 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.superbiz.dynamicdatasourcerouting;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-/**
- * OpenJPA create the table at the first query.
- * To avoid to have to create the table manunally this singleton will do it for us.
- *
- */
-@Startup
-@Singleton
-public class BoostrapUtility {
-    @PersistenceContext(unitName = "db1")
-    private EntityManager em1;
-
-    @PersistenceContext(unitName = "db2")
-    private EntityManager em2;
-
-    @PersistenceContext(unitName = "db3")
-    private EntityManager em3;
-
-    @PostConstruct
-    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
-    public void initDatabase() {
-        em1.find(Person.class, 0);
-        em2.find(Person.class, 0);
-        em3.find(Person.class, 0);
-    }
-}
+/**
+ * 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.superbiz.dynamicdatasourcerouting;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+/**
+ * OpenJPA create the table at the first query.
+ * To avoid to have to create the table manunally this singleton will do it for us.
+ *
+ */
+@Startup
+@Singleton
+public class BoostrapUtility {
+    @PersistenceContext(unitName = "db1")
+    private EntityManager em1;
+
+    @PersistenceContext(unitName = "db2")
+    private EntityManager em2;
+
+    @PersistenceContext(unitName = "db3")
+    private EntityManager em3;
+
+    @PostConstruct
+    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+    public void initDatabase() {
+        em1.find(Person.class, 0);
+        em2.find(Person.class, 0);
+        em3.find(Person.class, 0);
+    }
+}

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/DeterminedRouter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/DeterminedRouter.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/DeterminedRouter.java (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/DeterminedRouter.java Sun Feb 19 22:32:10 2012
@@ -1,107 +1,107 @@
-/**
- * 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.superbiz.dynamicdatasourcerouting;
-
-import org.apache.openejb.resource.jdbc.AbstractRouter;
-
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class DeterminedRouter extends AbstractRouter {
-    private String dataSourceNames;
-    private String defaultDataSourceName;
-    private Map<String, DataSource> dataSources = null;
-    private ThreadLocal<DataSource> currentDataSource = new ThreadLocal<DataSource>();
-
-    /**
-     * @param datasourceList datasource resource name, separator is a space
-     */
-    public void setDataSourceNames(String datasourceList) {
-        dataSourceNames = datasourceList;
-    }
-
-    /**
-     * lookup datasource in openejb resources
-     */
-    private void init() {
-        dataSources = new ConcurrentHashMap<String, DataSource>();
-        for (String ds : dataSourceNames.split(" ")) {
-            try {
-                Object o = getOpenEJBResource(ds);
-                if (o instanceof DataSource) {
-                    dataSources.put(ds, DataSource.class.cast(o));
-                }
-            } catch (NamingException e) {
-                // ignored
-            }
-        }
-    }
-
-    /**
-     * @return the user selected data source if it is set
-     *         or the default one
-     *  @throws IllegalArgumentException if the data source is not found
-     */
-    @Override
-    public DataSource getDataSource() {
-        // lazy init of routed datasources
-        if (dataSources == null) {
-            init();
-        }
-
-        // if no datasource is selected use the default one
-        if (currentDataSource.get() == null) {
-            if (dataSources.containsKey(defaultDataSourceName)) {
-                return dataSources.get(defaultDataSourceName);
-
-            } else {
-                throw new IllegalArgumentException("you have to specify at least one datasource");
-            }
-        }
-
-        // the developper set the datasource to use
-        return currentDataSource.get();
-    }
-
-    /**
-     *
-     * @param datasourceName data source name
-     */
-    public void setDataSource(String datasourceName) {
-        if (dataSources == null) {
-            init();
-        }
-        if (!dataSources.containsKey(datasourceName)) {
-            throw new IllegalArgumentException("data source called " + datasourceName + " can't be found.");
-        }
-        DataSource ds = dataSources.get(datasourceName);
-        currentDataSource.set(ds);
-    }
-
-    /**
-     * reset the data source
-     */
-    public void clear() {
-        currentDataSource.remove();
-    }
-
-    public void setDefaultDataSourceName(String name) {
-        this.defaultDataSourceName = name;
-    }
-}
+/**
+ * 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.superbiz.dynamicdatasourcerouting;
+
+import org.apache.openejb.resource.jdbc.AbstractRouter;
+
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class DeterminedRouter extends AbstractRouter {
+    private String dataSourceNames;
+    private String defaultDataSourceName;
+    private Map<String, DataSource> dataSources = null;
+    private ThreadLocal<DataSource> currentDataSource = new ThreadLocal<DataSource>();
+
+    /**
+     * @param datasourceList datasource resource name, separator is a space
+     */
+    public void setDataSourceNames(String datasourceList) {
+        dataSourceNames = datasourceList;
+    }
+
+    /**
+     * lookup datasource in openejb resources
+     */
+    private void init() {
+        dataSources = new ConcurrentHashMap<String, DataSource>();
+        for (String ds : dataSourceNames.split(" ")) {
+            try {
+                Object o = getOpenEJBResource(ds);
+                if (o instanceof DataSource) {
+                    dataSources.put(ds, DataSource.class.cast(o));
+                }
+            } catch (NamingException e) {
+                // ignored
+            }
+        }
+    }
+
+    /**
+     * @return the user selected data source if it is set
+     *         or the default one
+     *  @throws IllegalArgumentException if the data source is not found
+     */
+    @Override
+    public DataSource getDataSource() {
+        // lazy init of routed datasources
+        if (dataSources == null) {
+            init();
+        }
+
+        // if no datasource is selected use the default one
+        if (currentDataSource.get() == null) {
+            if (dataSources.containsKey(defaultDataSourceName)) {
+                return dataSources.get(defaultDataSourceName);
+
+            } else {
+                throw new IllegalArgumentException("you have to specify at least one datasource");
+            }
+        }
+
+        // the developper set the datasource to use
+        return currentDataSource.get();
+    }
+
+    /**
+     *
+     * @param datasourceName data source name
+     */
+    public void setDataSource(String datasourceName) {
+        if (dataSources == null) {
+            init();
+        }
+        if (!dataSources.containsKey(datasourceName)) {
+            throw new IllegalArgumentException("data source called " + datasourceName + " can't be found.");
+        }
+        DataSource ds = dataSources.get(datasourceName);
+        currentDataSource.set(ds);
+    }
+
+    /**
+     * reset the data source
+     */
+    public void clear() {
+        currentDataSource.remove();
+    }
+
+    public void setDefaultDataSourceName(String name) {
+        this.defaultDataSourceName = name;
+    }
+}

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/Person.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/Person.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/Person.java (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/Person.java Sun Feb 19 22:32:10 2012
@@ -1,52 +1,52 @@
-/**
- * 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.superbiz.dynamicdatasourcerouting;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class Person {
-    @Id
-    private long id;
-    private String name;
-
-    public Person() {
-        // no-op
-    }
-
-    public Person(int i, String n) {
-        id = i;
-        name = n;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-}
+/**
+ * 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.superbiz.dynamicdatasourcerouting;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Person {
+    @Id
+    private long id;
+    private String name;
+
+    public Person() {
+        // no-op
+    }
+
+    public Person(int i, String n) {
+        id = i;
+        name = n;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/RoutedPersister.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/RoutedPersister.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/RoutedPersister.java (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/RoutedPersister.java Sun Feb 19 22:32:10 2012
@@ -1,36 +1,36 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.superbiz.dynamicdatasourcerouting;
-
-import javax.annotation.Resource;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-@Stateless
-public class RoutedPersister {
-    @PersistenceContext(unitName = "router")
-    private EntityManager em;
-
-    @Resource(name = "My Router", type = DeterminedRouter.class)
-    private DeterminedRouter router;
-
-    public void persist(int id, String name, String ds) {
-        router.setDataSource(ds);
-        em.persist(new Person(id, name));
-    }
-}
+/**
+ * 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.superbiz.dynamicdatasourcerouting;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateless
+public class RoutedPersister {
+    @PersistenceContext(unitName = "router")
+    private EntityManager em;
+
+    @Resource(name = "My Router", type = DeterminedRouter.class)
+    private DeterminedRouter router;
+
+    public void persist(int id, String name, String ds) {
+        router.setDataSource(ds);
+        em.persist(new Person(id, name));
+    }
+}

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml Sun Feb 19 22:32:10 2012
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
--->
-<ServiceJar>
-  <ServiceProvider id="DeterminedRouter" service="Resource"
-                   type="org.apache.openejb.resource.jdbc.Router"
-                   class-name="org.superbiz.dynamicdatasourcerouting.DeterminedRouter">
-    DataSourceNames
-    DefaultDataSourceName
-  </ServiceProvider>
-</ServiceJar>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+<ServiceJar>
+  <ServiceProvider id="DeterminedRouter" service="Resource"
+                   type="org.apache.openejb.resource.jdbc.Router"
+                   class-name="org.superbiz.dynamicdatasourcerouting.DeterminedRouter">
+    DataSourceNames
+    DefaultDataSourceName
+  </ServiceProvider>
+</ServiceJar>
+

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/persistence.xml?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/persistence.xml (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/main/resources/META-INF/persistence.xml Sun Feb 19 22:32:10 2012
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-  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.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
-             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
-             version="2.0">
-  <persistence-unit name="router" transaction-type="JTA">
-    <jta-data-source>Routed Datasource</jta-data-source>
-    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
-    <properties>
-      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-    </properties>
-  </persistence-unit>
-
-  <persistence-unit name="db1" transaction-type="JTA">
-    <jta-data-source>database1</jta-data-source>
-    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
-    <properties>
-      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-    </properties>
-  </persistence-unit>
-  <persistence-unit name="db2" transaction-type="JTA">
-    <jta-data-source>database2</jta-data-source>
-    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
-    <properties>
-      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-    </properties>
-  </persistence-unit>
-  <persistence-unit name="db3" transaction-type="JTA">
-    <jta-data-source>database3</jta-data-source>
-    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
-    <properties>
-      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-    </properties>
-  </persistence-unit>
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+             version="2.0">
+  <persistence-unit name="router" transaction-type="JTA">
+    <jta-data-source>Routed Datasource</jta-data-source>
+    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+
+  <persistence-unit name="db1" transaction-type="JTA">
+    <jta-data-source>database1</jta-data-source>
+    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+  <persistence-unit name="db2" transaction-type="JTA">
+    <jta-data-source>database2</jta-data-source>
+    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+  <persistence-unit name="db3" transaction-type="JTA">
+    <jta-data-source>database3</jta-data-source>
+    <class>org.superbiz.dynamicdatasourcerouting.Person</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>

Modified: openejb/trunk/openejb/examples/dynamic-datasource-routing/src/test/java/org/superbiz/dynamicdatasourcerouting/DynamicDataSourceTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/dynamic-datasource-routing/src/test/java/org/superbiz/dynamicdatasourcerouting/DynamicDataSourceTest.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/dynamic-datasource-routing/src/test/java/org/superbiz/dynamicdatasourcerouting/DynamicDataSourceTest.java (original)
+++ openejb/trunk/openejb/examples/dynamic-datasource-routing/src/test/java/org/superbiz/dynamicdatasourcerouting/DynamicDataSourceTest.java Sun Feb 19 22:32:10 2012
@@ -1,122 +1,122 @@
-/*
- * 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.superbiz.dynamicdatasourcerouting;
-
-import org.apache.openejb.core.LocalInitialContextFactory;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * If you are using openejb.xml the test properties are:
- *
- *
-  <!-- Router and datasource -->
-  <Resource id="My Router" type="org.apache.openejb.router.test.DynamicDataSourceTest$DeterminedRouter" provider="org.routertest:DeterminedRouter">
-    DatasourceNames = database1 database2 database3
-    DefaultDataSourceName = database1
-  </Resource>
-  <Resource id="Routed Datasource" type="org.apache.openejb.resource.jdbc.Router" provider="org.router:RoutedDataSource">
-    Router = My Router
-  </Resource>
-
-  <!-- real datasources -->
-  <Resource id="database1" type="DataSource">
-    JdbcDriver = org.hsqldb.jdbcDriver
-    JdbcUrl = jdbc:hsqldb:mem:db1
-    UserName = sa
-    Password
-    JtaManaged = true
-  </Resource>
-  <Resource id="database2" type="DataSource">
-    JdbcDriver = org.hsqldb.jdbcDriver
-    JdbcUrl = jdbc:hsqldb:mem:db2
-    UserName = sa
-    Password
-    JtaManaged = true
-  </Resource>
-  <Resource id="database3" type="DataSource">
-    JdbcDriver = org.hsqldb.jdbcDriver
-    JdbcUrl = jdbc:hsqldb:mem:db3
-    UserName = sa
-    Password
-    JtaManaged = true
-  </Resource>
- */
-public class DynamicDataSourceTest {
-    @Test
-    public void route() throws Exception {
-        String[] databases = new String[]{"database1", "database2", "database3"};
-
-        Properties properties = new Properties();
-        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
-
-        // resources
-        // datasources
-        for (int i = 1; i <= databases.length; i++) {
-            String dbName = databases[i - 1];
-            properties.setProperty(dbName, "new://Resource?type=DataSource");
-            dbName += ".";
-            properties.setProperty(dbName + "JdbcDriver", "org.hsqldb.jdbcDriver");
-            properties.setProperty(dbName + "JdbcUrl", "jdbc:hsqldb:mem:db" + i);
-            properties.setProperty(dbName + "UserName", "sa");
-            properties.setProperty(dbName + "Password", "");
-            properties.setProperty(dbName + "JtaManaged", "true");
-        }
-
-        // router
-        properties.setProperty("My Router", "new://Resource?provider=org.router:DeterminedRouter&type=" + DeterminedRouter.class.getName());
-        properties.setProperty("My Router.DatasourceNames", "database1 database2 database3");
-        properties.setProperty("My Router.DefaultDataSourceName", "database1");
-
-        // routed datasource
-        properties.setProperty("Routed Datasource", "new://Resource?provider=RoutedDataSource&type=" + DataSource.class.getName());
-        properties.setProperty("Routed Datasource.Router", "My Router");
-
-        Context ctx = EJBContainer.createEJBContainer(properties).getContext();
-        RoutedPersister ejb = (RoutedPersister) ctx.lookup("java:global/dynamic-datasource-routing/RoutedPersister");
-        for (int i = 0; i < 18; i++) {
-            // persisting a person on database db -> kind of manual round robin
-            String name = "record " + i;
-            String db = databases[i % 3];
-            ejb.persist(i, name, db);
-        }
-
-        // assert database records number using jdbc
-        for (int i = 1; i <= databases.length; i++) {
-            Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:db" + i, "sa", "");
-            Statement st = connection.createStatement();
-            ResultSet rs = st.executeQuery("select count(*) from PERSON");
-            rs.next();
-            assertEquals(6, rs.getInt(1));
-            st.close();
-            connection.close();
-        }
-
-        ctx.close();
-    }
-}
-
+/*
+ * 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.superbiz.dynamicdatasourcerouting;
+
+import org.apache.openejb.core.LocalInitialContextFactory;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * If you are using openejb.xml the test properties are:
+ *
+ *
+  <!-- Router and datasource -->
+  <Resource id="My Router" type="org.apache.openejb.router.test.DynamicDataSourceTest$DeterminedRouter" provider="org.routertest:DeterminedRouter">
+    DatasourceNames = database1 database2 database3
+    DefaultDataSourceName = database1
+  </Resource>
+  <Resource id="Routed Datasource" type="org.apache.openejb.resource.jdbc.Router" provider="org.router:RoutedDataSource">
+    Router = My Router
+  </Resource>
+
+  <!-- real datasources -->
+  <Resource id="database1" type="DataSource">
+    JdbcDriver = org.hsqldb.jdbcDriver
+    JdbcUrl = jdbc:hsqldb:mem:db1
+    UserName = sa
+    Password
+    JtaManaged = true
+  </Resource>
+  <Resource id="database2" type="DataSource">
+    JdbcDriver = org.hsqldb.jdbcDriver
+    JdbcUrl = jdbc:hsqldb:mem:db2
+    UserName = sa
+    Password
+    JtaManaged = true
+  </Resource>
+  <Resource id="database3" type="DataSource">
+    JdbcDriver = org.hsqldb.jdbcDriver
+    JdbcUrl = jdbc:hsqldb:mem:db3
+    UserName = sa
+    Password
+    JtaManaged = true
+  </Resource>
+ */
+public class DynamicDataSourceTest {
+    @Test
+    public void route() throws Exception {
+        String[] databases = new String[]{"database1", "database2", "database3"};
+
+        Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
+
+        // resources
+        // datasources
+        for (int i = 1; i <= databases.length; i++) {
+            String dbName = databases[i - 1];
+            properties.setProperty(dbName, "new://Resource?type=DataSource");
+            dbName += ".";
+            properties.setProperty(dbName + "JdbcDriver", "org.hsqldb.jdbcDriver");
+            properties.setProperty(dbName + "JdbcUrl", "jdbc:hsqldb:mem:db" + i);
+            properties.setProperty(dbName + "UserName", "sa");
+            properties.setProperty(dbName + "Password", "");
+            properties.setProperty(dbName + "JtaManaged", "true");
+        }
+
+        // router
+        properties.setProperty("My Router", "new://Resource?provider=org.router:DeterminedRouter&type=" + DeterminedRouter.class.getName());
+        properties.setProperty("My Router.DatasourceNames", "database1 database2 database3");
+        properties.setProperty("My Router.DefaultDataSourceName", "database1");
+
+        // routed datasource
+        properties.setProperty("Routed Datasource", "new://Resource?provider=RoutedDataSource&type=" + DataSource.class.getName());
+        properties.setProperty("Routed Datasource.Router", "My Router");
+
+        Context ctx = EJBContainer.createEJBContainer(properties).getContext();
+        RoutedPersister ejb = (RoutedPersister) ctx.lookup("java:global/dynamic-datasource-routing/RoutedPersister");
+        for (int i = 0; i < 18; i++) {
+            // persisting a person on database db -> kind of manual round robin
+            String name = "record " + i;
+            String db = databases[i % 3];
+            ejb.persist(i, name, db);
+        }
+
+        // assert database records number using jdbc
+        for (int i = 1; i <= databases.length; i++) {
+            Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:db" + i, "sa", "");
+            Statement st = connection.createStatement();
+            ResultSet rs = st.executeQuery("select count(*) from PERSON");
+            rs.next();
+            assertEquals(6, rs.getInt(1));
+            st.close();
+            connection.close();
+        }
+
+        ctx.close();
+    }
+}
+

Modified: openejb/trunk/openejb/examples/mbean-auto-registration/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/mbean-auto-registration/README.md?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/mbean-auto-registration/README.md (original)
+++ openejb/trunk/openejb/examples/mbean-auto-registration/README.md Sun Feb 19 22:32:10 2012
@@ -1,151 +1,151 @@
-Title: Mbean Auto Registration
-
-This example shows how to automatically create and register mbeans using TomEE features.
-
-# Dependencies
-
-To be able to use it you need to import the mbean api (annotations):
-
-    <dependency>
-      <groupId>org.apache.openejb</groupId>
-      <artifactId>mbean-annotation-api</artifactId>
-      <version>4.0.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-
-# The MBean
-
-The mbean implements a simple game where the goal is to guess a number.
-
-It allows the user to change the value too.
-
-    package org.superbiz.mbean;
-
-    import javax.management.Description;
-    import javax.management.MBean;
-    import javax.management.ManagedAttribute;
-    import javax.management.ManagedOperation;
-
-    /**
-     * @author Romain Manni-Bucau
-     */
-    @MBean
-    @Description("play with me to guess a number")
-    public class GuessHowManyMBean {
-        private int value = 0;
-
-        @ManagedAttribute
-        @Description("you are cheating!")
-        public int getValue() {
-            return value;
-        }
-
-        @ManagedAttribute
-        public void setValue(int value) {
-            this.value = value;
-        }
-
-        @ManagedOperation
-        public String tryValue(int userValue) {
-            if (userValue == value) {
-                return "winner";
-            }
-            return "not the correct value, please have another try";
-        }
-    }
-
-To register a MBean you simply have to specify a property either in system.properties,
-or in intial context properties.
-
-    Properties properties = new Properties();
-    properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
-    EJBContainer.createEJBContainer(properties);
-
-# Accessing the MBean
-
-Then simply get the platform server and you can play with parameters and operations:
-
-    package org.superbiz.mbean;
-
-    import org.junit.Test;
-
-    import javax.ejb.embeddable.EJBContainer;
-    import javax.management.Attribute;
-    import javax.management.MBeanInfo;
-    import javax.management.MBeanServer;
-    import javax.management.ObjectName;
-    import java.lang.management.ManagementFactory;
-    import java.util.Properties;
-
-    import static junit.framework.Assert.assertEquals;
-
-    /**
-     * @author Romain Manni-Bucau
-     */
-    public class GuessHowManyMBeanTest {
-        private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
-
-        @Test
-        public void play() throws Exception {
-            Properties properties = new Properties();
-            properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
-            EJBContainer container = EJBContainer.createEJBContainer(properties);
-
-            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-            ObjectName objectName = new ObjectName(OBJECT_NAME);
-            MBeanInfo infos = server.getMBeanInfo(objectName);
-            assertEquals(0, server.getAttribute(objectName, "value"));
-            server.setAttribute(objectName, new Attribute("value", 3));
-            assertEquals(3, server.getAttribute(objectName, "value"));
-            assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
-            assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
-
-            container.close();
-        }
-    }
-
-#### Note
-
-If OpenEJB can't find any module it can't start. So to force him to start even if the example has only the mbean
-as java class, we added a `beans.xml` file to turn our project into a Java EE module.
-
-# Running
-
-    
-    -------------------------------------------------------
-     T E S T S
-    -------------------------------------------------------
-    Running org.superbiz.mbean.GuessHowManyMBeanTest
-    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
-    http://openejb.apache.org/
-    INFO - openejb.home = /Users/dblevins/examples/mbean-auto-registration
-    INFO - openejb.base = /Users/dblevins/examples/mbean-auto-registration
-    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-    INFO - Found EjbModule in classpath: /Users/dblevins/examples/mbean-auto-registration/target/classes
-    INFO - Beginning load: /Users/dblevins/examples/mbean-auto-registration/target/classes
-    INFO - Configuring enterprise application: /Users/dblevins/examples/mbean-auto-registration
-    INFO - MBean openejb.user.mbeans:application=,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
-    INFO - MBean openejb.user.mbeans:application=mbean-auto-registration,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
-    INFO - MBean openejb.user.mbeans:application=EjbModule1847652919,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
-    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-    INFO - Auto-creating a container for bean mbean-auto-registration.Comp: Container(type=MANAGED, id=Default Managed Container)
-    INFO - Enterprise application "/Users/dblevins/examples/mbean-auto-registration" loaded.
-    INFO - Assembling app: /Users/dblevins/examples/mbean-auto-registration
-    INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp!org.apache.openejb.BeanContext$Comp")
-    INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp")
-    INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest!org.superbiz.mbean.GuessHowManyMBeanTest")
-    INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest")
-    INFO - Created Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
-    INFO - Created Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
-    INFO - Started Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
-    INFO - Started Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
-    INFO - Deployed Application(path=/Users/dblevins/examples/mbean-auto-registration)
-    INFO - Undeploying app: /Users/dblevins/examples/mbean-auto-registration
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.063 sec
-    
-    Results :
-    
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-    
+Title: Mbean Auto Registration
+
+This example shows how to automatically create and register mbeans using TomEE features.
+
+# Dependencies
+
+To be able to use it you need to import the mbean api (annotations):
+
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>mbean-annotation-api</artifactId>
+      <version>4.0.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+
+# The MBean
+
+The mbean implements a simple game where the goal is to guess a number.
+
+It allows the user to change the value too.
+
+    package org.superbiz.mbean;
+
+    import javax.management.Description;
+    import javax.management.MBean;
+    import javax.management.ManagedAttribute;
+    import javax.management.ManagedOperation;
+
+    /**
+     * @author Romain Manni-Bucau
+     */
+    @MBean
+    @Description("play with me to guess a number")
+    public class GuessHowManyMBean {
+        private int value = 0;
+
+        @ManagedAttribute
+        @Description("you are cheating!")
+        public int getValue() {
+            return value;
+        }
+
+        @ManagedAttribute
+        public void setValue(int value) {
+            this.value = value;
+        }
+
+        @ManagedOperation
+        public String tryValue(int userValue) {
+            if (userValue == value) {
+                return "winner";
+            }
+            return "not the correct value, please have another try";
+        }
+    }
+
+To register a MBean you simply have to specify a property either in system.properties,
+or in intial context properties.
+
+    Properties properties = new Properties();
+    properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
+    EJBContainer.createEJBContainer(properties);
+
+# Accessing the MBean
+
+Then simply get the platform server and you can play with parameters and operations:
+
+    package org.superbiz.mbean;
+
+    import org.junit.Test;
+
+    import javax.ejb.embeddable.EJBContainer;
+    import javax.management.Attribute;
+    import javax.management.MBeanInfo;
+    import javax.management.MBeanServer;
+    import javax.management.ObjectName;
+    import java.lang.management.ManagementFactory;
+    import java.util.Properties;
+
+    import static junit.framework.Assert.assertEquals;
+
+    /**
+     * @author Romain Manni-Bucau
+     */
+    public class GuessHowManyMBeanTest {
+        private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
+
+        @Test
+        public void play() throws Exception {
+            Properties properties = new Properties();
+            properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
+            EJBContainer container = EJBContainer.createEJBContainer(properties);
+
+            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+            ObjectName objectName = new ObjectName(OBJECT_NAME);
+            MBeanInfo infos = server.getMBeanInfo(objectName);
+            assertEquals(0, server.getAttribute(objectName, "value"));
+            server.setAttribute(objectName, new Attribute("value", 3));
+            assertEquals(3, server.getAttribute(objectName, "value"));
+            assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
+            assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
+
+            container.close();
+        }
+    }
+
+#### Note
+
+If OpenEJB can't find any module it can't start. So to force him to start even if the example has only the mbean
+as java class, we added a `beans.xml` file to turn our project into a Java EE module.
+
+# Running
+
+    
+    -------------------------------------------------------
+     T E S T S
+    -------------------------------------------------------
+    Running org.superbiz.mbean.GuessHowManyMBeanTest
+    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+    http://openejb.apache.org/
+    INFO - openejb.home = /Users/dblevins/examples/mbean-auto-registration
+    INFO - openejb.base = /Users/dblevins/examples/mbean-auto-registration
+    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Found EjbModule in classpath: /Users/dblevins/examples/mbean-auto-registration/target/classes
+    INFO - Beginning load: /Users/dblevins/examples/mbean-auto-registration/target/classes
+    INFO - Configuring enterprise application: /Users/dblevins/examples/mbean-auto-registration
+    INFO - MBean openejb.user.mbeans:application=,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+    INFO - MBean openejb.user.mbeans:application=mbean-auto-registration,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+    INFO - MBean openejb.user.mbeans:application=EjbModule1847652919,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+    INFO - Auto-creating a container for bean mbean-auto-registration.Comp: Container(type=MANAGED, id=Default Managed Container)
+    INFO - Enterprise application "/Users/dblevins/examples/mbean-auto-registration" loaded.
+    INFO - Assembling app: /Users/dblevins/examples/mbean-auto-registration
+    INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp!org.apache.openejb.BeanContext$Comp")
+    INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp")
+    INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest!org.superbiz.mbean.GuessHowManyMBeanTest")
+    INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest")
+    INFO - Created Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+    INFO - Created Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
+    INFO - Deployed Application(path=/Users/dblevins/examples/mbean-auto-registration)
+    INFO - Undeploying app: /Users/dblevins/examples/mbean-auto-registration
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.063 sec
+    
+    Results :
+    
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+    

Modified: openejb/trunk/openejb/examples/mbean-auto-registration/src/main/java/org/superbiz/mbean/GuessHowManyMBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/mbean-auto-registration/src/main/java/org/superbiz/mbean/GuessHowManyMBean.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/mbean-auto-registration/src/main/java/org/superbiz/mbean/GuessHowManyMBean.java (original)
+++ openejb/trunk/openejb/examples/mbean-auto-registration/src/main/java/org/superbiz/mbean/GuessHowManyMBean.java Sun Feb 19 22:32:10 2012
@@ -1,47 +1,47 @@
-/**
- * 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.superbiz.mbean;
-
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedAttribute;
-import javax.management.ManagedOperation;
-
-@MBean
-@Description("play with me to guess a number")
-public class GuessHowManyMBean {
-    private int value = 0;
-
-    @ManagedAttribute
-    @Description("you are cheating!")
-    public int getValue() {
-        return value;
-    }
-
-    @ManagedAttribute
-    public void setValue(int value) {
-        this.value = value;
-    }
-
-    @ManagedOperation
-    public String tryValue(int userValue) {
-        if (userValue == value) {
-            return "winner";
-        }
-        return "not the correct value, please have another try";
-    }
-}
+/**
+ * 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.superbiz.mbean;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedAttribute;
+import javax.management.ManagedOperation;
+
+@MBean
+@Description("play with me to guess a number")
+public class GuessHowManyMBean {
+    private int value = 0;
+
+    @ManagedAttribute
+    @Description("you are cheating!")
+    public int getValue() {
+        return value;
+    }
+
+    @ManagedAttribute
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    @ManagedOperation
+    public String tryValue(int userValue) {
+        if (userValue == value) {
+            return "winner";
+        }
+        return "not the correct value, please have another try";
+    }
+}

Modified: openejb/trunk/openejb/examples/mbean-auto-registration/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/mbean-auto-registration/src/main/resources/META-INF/beans.xml?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/mbean-auto-registration/src/main/resources/META-INF/beans.xml (original)
+++ openejb/trunk/openejb/examples/mbean-auto-registration/src/main/resources/META-INF/beans.xml Sun Feb 19 22:32:10 2012
@@ -1,17 +1,17 @@
-<!--
-  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.
- -->
-<beans/>
+<!--
+  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.
+ -->
+<beans/>

Modified: openejb/trunk/openejb/examples/mbean-auto-registration/src/test/java/org/superbiz/mbean/GuessHowManyMBeanTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/mbean-auto-registration/src/test/java/org/superbiz/mbean/GuessHowManyMBeanTest.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/mbean-auto-registration/src/test/java/org/superbiz/mbean/GuessHowManyMBeanTest.java (original)
+++ openejb/trunk/openejb/examples/mbean-auto-registration/src/test/java/org/superbiz/mbean/GuessHowManyMBeanTest.java Sun Feb 19 22:32:10 2012
@@ -1,51 +1,51 @@
-/**
- * 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.superbiz.mbean;
-
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.management.Attribute;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.lang.management.ManagementFactory;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-
-public class GuessHowManyMBeanTest {
-    private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
-
-    @Test
-    public void play() throws Exception {
-        Properties properties = new Properties();
-        properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
-        EJBContainer container = EJBContainer.createEJBContainer(properties);
-
-        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-        ObjectName objectName = new ObjectName(OBJECT_NAME);
-        MBeanInfo infos = server.getMBeanInfo(objectName);
-        assertEquals(0, server.getAttribute(objectName, "value"));
-        server.setAttribute(objectName, new Attribute("value", 3));
-        assertEquals(3, server.getAttribute(objectName, "value"));
-        assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
-        assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
-
-        container.close();
-    }
-}
+/**
+ * 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.superbiz.mbean;
+
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.management.Attribute;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.lang.management.ManagementFactory;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+
+public class GuessHowManyMBeanTest {
+    private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
+
+    @Test
+    public void play() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
+        EJBContainer container = EJBContainer.createEJBContainer(properties);
+
+        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        ObjectName objectName = new ObjectName(OBJECT_NAME);
+        MBeanInfo infos = server.getMBeanInfo(objectName);
+        assertEquals(0, server.getAttribute(objectName, "value"));
+        server.setAttribute(objectName, new Attribute("value", 3));
+        assertEquals(3, server.getAttribute(objectName, "value"));
+        assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
+        assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
+
+        container.close();
+    }
+}

Modified: openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java (original)
+++ openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java Sun Feb 19 22:32:10 2012
@@ -1,42 +1,42 @@
-/**
- * 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.superbiz.cdi.bookshow.beans;
-
-import org.superbiz.cdi.bookshow.interceptorbinding.Log;
-
-import javax.ejb.Stateful;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-@Log
-@Stateful
-public class BookShow implements Serializable {
-    private static final long serialVersionUID = 6350400892234496909L;
-
-    public List<String> getMoviesList() {
-        List<String> moviesAvailable = new ArrayList<String>();
-        moviesAvailable.add("12 Angry Men");
-        moviesAvailable.add("Kings speech");
-        return moviesAvailable;
-    }
-
-    public Integer getDiscountedPrice(int ticketPrice) {
-        return ticketPrice - 50;
-    }
-    // assume more methods are present
-}
+/**
+ * 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.superbiz.cdi.bookshow.beans;
+
+import org.superbiz.cdi.bookshow.interceptorbinding.Log;
+
+import javax.ejb.Stateful;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@Log
+@Stateful
+public class BookShow implements Serializable {
+    private static final long serialVersionUID = 6350400892234496909L;
+
+    public List<String> getMoviesList() {
+        List<String> moviesAvailable = new ArrayList<String>();
+        moviesAvailable.add("12 Angry Men");
+        moviesAvailable.add("Kings speech");
+        return moviesAvailable;
+    }
+
+    public Integer getDiscountedPrice(int ticketPrice) {
+        return ticketPrice - 50;
+    }
+    // assume more methods are present
+}

Modified: openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java (original)
+++ openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java Sun Feb 19 22:32:10 2012
@@ -1,31 +1,31 @@
-/**
- * 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.superbiz.cdi.bookshow.interceptorbinding;
-
-import javax.interceptor.InterceptorBinding;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@InterceptorBinding
-@Target({TYPE, METHOD})
-@Retention(RUNTIME)
-public @interface Log {
-}
+/**
+ * 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.superbiz.cdi.bookshow.interceptorbinding;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface Log {
+}

Modified: openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java (original)
+++ openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java Sun Feb 19 22:32:10 2012
@@ -1,51 +1,51 @@
-/**
- * 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.
- */
-/**
- * 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.superbiz.cdi.bookshow.interceptors;
-
-import org.superbiz.cdi.bookshow.interceptorbinding.Log;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-
-@Interceptor
-@Log
-public class LoggingInterceptor {
-    private static final long serialVersionUID = 8139854519874743530L;
-
-    @AroundInvoke
-    public Object logMethodEntry(InvocationContext ctx) throws Exception {
-        System.out.println("Entering method: " + ctx.getMethod().getName());
-        return ctx.proceed();
-    }
-}
+/**
+ * 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.
+ */
+/**
+ * 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.superbiz.cdi.bookshow.interceptors;
+
+import org.superbiz.cdi.bookshow.interceptorbinding.Log;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+@Log
+public class LoggingInterceptor {
+    private static final long serialVersionUID = 8139854519874743530L;
+
+    @AroundInvoke
+    public Object logMethodEntry(InvocationContext ctx) throws Exception {
+        System.out.println("Entering method: " + ctx.getMethod().getName());
+        return ctx.proceed();
+    }
+}

Modified: openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/resources/META-INF/beans.xml?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/resources/META-INF/beans.xml (original)
+++ openejb/trunk/openejb/examples/simple-cdi-interceptor/src/main/resources/META-INF/beans.xml Sun Feb 19 22:32:10 2012
@@ -1,31 +1,31 @@
-<!--
-
-    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.
--->
-<beans>
-  <!-- By default, a bean archive has no enabled interceptors bound via interceptor 
-    bindings. An interceptor must be explicitly enabled by listing its class 
-    under the element of the beans.xml file of the bean archive. The order of 
-    the interceptor declarations determines the interceptor ordering. Interceptors 
-    which occur earlier in the list are called first. If the same class is listed 
-    twice under the interceptors element, the container automatically detects 
-    the problem and treats it as a deployment problem. -->
-
-  <interceptors>
-    <class>org.superbiz.cdi.bookshow.interceptors.LoggingInterceptor
-    </class>
-  </interceptors>
-</beans>
+<!--
+
+    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.
+-->
+<beans>
+  <!-- By default, a bean archive has no enabled interceptors bound via interceptor 
+    bindings. An interceptor must be explicitly enabled by listing its class 
+    under the element of the beans.xml file of the bean archive. The order of 
+    the interceptor declarations determines the interceptor ordering. Interceptors 
+    which occur earlier in the list are called first. If the same class is listed 
+    twice under the interceptors element, the container automatically detects 
+    the problem and treats it as a deployment problem. -->
+
+  <interceptors>
+    <class>org.superbiz.cdi.bookshow.interceptors.LoggingInterceptor
+    </class>
+  </interceptors>
+</beans>

Modified: openejb/trunk/openejb/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java?rev=1291077&r1=1291076&r2=1291077&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java (original)
+++ openejb/trunk/openejb/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java Sun Feb 19 22:32:10 2012
@@ -1,50 +1,50 @@
-/**
- * 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.superbiz.cdi.bookshow.interceptors;
-
-import junit.framework.TestCase;
-import org.superbiz.cdi.bookshow.beans.BookShow;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-
-public class BookShowTest extends TestCase {
-    @EJB
-    private BookShow bookForAShowBean;
-    EJBContainer ejbContainer;
-
-    /**
-     * Bootstrap the Embedded EJB Container
-     *
-     * @throws Exception
-     */
-    @Override
-    protected void setUp() throws Exception {
-        ejbContainer = EJBContainer.createEJBContainer();
-        ejbContainer.getContext().bind("inject", this);
-    }
-
-    /**
-     * Test basic interception
-     */
-    public void testMethodShouldBeIntercepted() {
-
-        bookForAShowBean.getMoviesList();
-
-    }
-
-}
+/**
+ * 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.superbiz.cdi.bookshow.interceptors;
+
+import junit.framework.TestCase;
+import org.superbiz.cdi.bookshow.beans.BookShow;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+
+public class BookShowTest extends TestCase {
+    @EJB
+    private BookShow bookForAShowBean;
+    EJBContainer ejbContainer;
+
+    /**
+     * Bootstrap the Embedded EJB Container
+     *
+     * @throws Exception
+     */
+    @Override
+    protected void setUp() throws Exception {
+        ejbContainer = EJBContainer.createEJBContainer();
+        ejbContainer.getContext().bind("inject", this);
+    }
+
+    /**
+     * Test basic interception
+     */
+    public void testMethodShouldBeIntercepted() {
+
+        bookForAShowBean.getMoviesList();
+
+    }
+
+}