openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1433706 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-...
Date Tue, 15 Jan 2013 22:26:21 GMT
Author: struberg
Date: Tue Jan 15 22:26:20 2013
New Revision: 1433706

URL: http://svn.apache.org/viewvc?rev=1433706&view=rev
Log:
OWB-755 destroy ManagedBean via InjectionTarget#destroy

Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectionTargetBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java

Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java?rev=1433706&r1=1433705&r2=1433706&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
(original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
Tue Jan 15 22:26:20 2013
@@ -91,7 +91,7 @@ public abstract class BaseEjbBean<T> ext
      * {@inheritDoc}
      */
     @Override
-    protected void destroyComponentInstance(T instance, CreationalContext<T> creational)
+    public void destroyInstance(T instance, CreationalContext<T> creational)
     {
         if (getEjbType().equals(SessionBeanType.STATEFUL))
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java?rev=1433706&r1=1433705&r2=1433706&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
Tue Jan 15 22:26:20 2013
@@ -25,7 +25,6 @@ import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.CreationalContext;
@@ -36,19 +35,15 @@ import org.apache.webbeans.config.OWBLog
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.decorator.WebBeansDecorator;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.intercept.InterceptorData;
 
 import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.InterceptionType;
 
-import org.apache.webbeans.intercept.InvocationContextImplRemove;
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptorBeanPleaseRemove;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.proxy.ProxyFactory;
-import org.apache.webbeans.spi.ResourceInjectionService;
 import org.apache.webbeans.util.Asserts;
-import org.apache.webbeans.util.WebBeansUtil;
+
 
 /**
  * Abstract class for injection target beans.
@@ -163,7 +158,7 @@ public abstract class InjectionTargetBea
      */
     protected void destroyInstance(T instance, CreationalContext<T> creationalContext)
     {
-        destroyComponentInstance(instance, creationalContext);
+        injectionTarget.preDestroy(instance);
     }
 
     /**
@@ -173,46 +168,10 @@ public abstract class InjectionTargetBea
      */
     protected void destroyComponentInstance(T instance, CreationalContext<T> creationalContext)
     {
-        preDestroy(instance, creationalContext);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public void preDestroy(T instance, CreationalContext<T> creationalContext)
-    {
-        preDestroyDefault(instance, creationalContext);
-    }
 
-    /**
-     * Default predestroy.
-     * 
-     * @param instance bean instance
-     */
-    protected void preDestroyDefault(T instance, CreationalContext<T> creationalContext)
-    {
-        if(getWebBeansType().equals(WebBeansType.MANAGED) ||
-                getWebBeansType().equals(WebBeansType.DECORATOR))                
-        {
-            if (WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptionType.PRE_DESTROY))
-            {                
-                InvocationContextImplRemove impl = new InvocationContextImplRemove(getWebBeansContext(),
null, instance, null, null,
-                        getWebBeansContext().getInterceptorUtil().getInterceptorMethods(getInterceptorStack(),
-                                                                                        InterceptionType.PRE_DESTROY),
-                                                                                        InterceptionType.PRE_DESTROY);
-                impl.setCreationalContext(creationalContext);
-                try
-                {
-                    impl.proceed();
-                }
-                catch (Exception e)
-                {
-                    getLogger().log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0008,
"@PreDestroy."), e);
-                    throw new WebBeansException(e);
-                }
-            }            
-        }
-    }
+
 
     /**
      * {@inheritDoc}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectionTargetBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectionTargetBeanBuilder.java?rev=1433706&r1=1433705&r2=1433706&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectionTargetBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectionTargetBeanBuilder.java
Tue Jan 15 22:26:20 2013
@@ -65,7 +65,6 @@ import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
-import static org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
 
 /**
  * Abstract implementation of {@link AbstractBeanBuilder}.

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java?rev=1433706&r1=1433705&r2=1433706&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
Tue Jan 15 22:26:20 2013
@@ -31,7 +31,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
@@ -335,7 +334,7 @@ public class InjectionTargetImpl<T> exte
             preDestroyInterceptors = new ArrayList<Interceptor<?>>(interceptorInfo.getInterceptors());
         }
 
-        InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(instance,
InterceptionType.PRE_DESTROY, preDestroyInterceptors,
+        InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(internalInstance,
InterceptionType.PRE_DESTROY, preDestroyInterceptors,
                                                                             interceptorInstances,
preDestroyMethods);
         try
         {



Mime
View raw message