Ok so the fact to add it for all beans was really a mistake? - Romain
2012/3/12 David Blevins <[email protected]> > It's the interface that allows bean instances to be removed when CDI > scopes end. @ManagedBean and @Stateful can have their lifecycle managed in > such a way. > > -David > > On Mar 12, 2012, at 12:04 PM, Romain Manni-Bucau wrote: > > > the goal was mainly to be able to @Inject EJBs > > > > can you give some points regarding this interface please? > > > > - Romain > > > > > > 2012/3/12 David Blevins <[email protected]> > > > >> > >> On Mar 12, 2012, at 10:05 AM, [email protected] wrote: > >> > >>> Author: rmannibucau > >>> Date: Mon Mar 12 15:05:59 2012 > >>> New Revision: 1299702 > >>> > >>> URL: http://svn.apache.org/viewvc?rev=1299702&view=rev > >>> Log: > >>> isn't BeanContext.Removable only for stateful beans? > >> > >> Works for @ManagedBean as well in our impl. > >> > >> > >> -David > >> > >>> Modified: > >>> > >> > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java > >>> > >>> Modified: > >> > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java > >>> URL: > >> > http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java?rev=1299702&r1=1299701&r2=1299702&view=diff > >>> > >> > ============================================================================== > >>> --- > >> > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java > >> (original) > >>> +++ > >> > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java > >> Mon Mar 12 15:05:59 2012 > >>> @@ -27,6 +27,7 @@ import org.apache.openejb.core.managed.M > >>> import org.apache.openejb.core.singleton.SingletonEjbHomeHandler; > >>> import org.apache.openejb.core.stateful.StatefulEjbHomeHandler; > >>> import org.apache.openejb.core.stateless.StatelessEjbHomeHandler; > >>> +import org.apache.openejb.jee.SessionType; > >>> import org.apache.openejb.spi.ApplicationServer; > >>> import org.apache.openejb.util.LogCategory; > >>> import org.apache.openejb.util.Logger; > >>> @@ -129,7 +130,7 @@ public abstract class EjbHomeProxyHandle > >>> > >>> InterfaceType objectInterfaceType = > >> this.interfaceType.getCounterpart(); > >>> > >>> - EjbObjectProxyHandler handler = > >> newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, > >> this.getInterfaces(), mainInterface); > >>> + EjbObjectProxyHandler handler = > >> newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, > >> getInterfaces(), mainInterface); > >>> > >>> // TODO Is it correct for ManagedBean injection via managed > >> bean class? > >>> if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || > >> getBeanContext().getComponentType().equals(BeanType.MANAGED)) > >>> @@ -139,7 +140,9 @@ public abstract class EjbHomeProxyHandle > >>> List<Class> proxyInterfaces = new > >> ArrayList<Class>(handler.getInterfaces().size() + 1); > >>> proxyInterfaces.addAll(handler.getInterfaces()); > >>> proxyInterfaces.add(IntraVmProxy.class); > >>> - proxyInterfaces.add(BeanContext.Removable.class); > >>> + if > >> (SessionType.STATEFUL.equals(getBeanContext().getComponentType())) { > >>> + proxyInterfaces.add(BeanContext.Removable.class); > >>> + } > >>> return > >> ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[]{}), > >> handler); > >>> } > >>> > >>> > >>> > >>> > >> > >> > >
