openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1480745 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/third/PassivationCapableThirdpartyBeanImpl.java component/third/ThirdpartyBeanImpl.java container/BeanManagerImpl.java
Date Thu, 09 May 2013 19:49:49 GMT
Author: arne
Date: Thu May  9 19:49:48 2013
New Revision: 1480745

URL: http://svn.apache.org/r1480745
Log:
OWB-857: Added patch from Romain Manni-Bucau

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java?rev=1480745&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
Thu May  9 19:49:48 2013
@@ -0,0 +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.apache.webbeans.component.third;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class PassivationCapableThirdpartyBeanImpl<T> extends ThirdpartyBeanImpl<T>
implements PassivationCapable
+{
+    private final String id;
+    
+    public PassivationCapableThirdpartyBeanImpl(WebBeansContext webBeansContext, Bean<T>
bean)
+    {
+        super(webBeansContext, bean);
+        id = PassivationCapable.class.cast(bean).getId();
+    }
+
+    @Override
+    public String getId()
+    {
+        return id;
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=1480745&r1=1480744&r2=1480745&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Thu May  9 19:49:48 2013
@@ -24,7 +24,6 @@ import java.util.Set;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.PassivationCapable;
 import javax.enterprise.inject.spi.Producer;
 
 import org.apache.webbeans.component.AbstractOwbBean;
@@ -100,21 +99,13 @@ public class ThirdpartyBeanImpl<T> exten
     @Override
     public String getId()
     {
-        if(bean instanceof PassivationCapable)
-        {
-            PassivationCapable pc = (PassivationCapable) bean;
-            return pc.getId();
-        }
-        
         return null;
     }
-    
-    
 
     @Override
     public boolean isPassivationCapable()
     {
-        return bean instanceof PassivationCapable;
+        return false;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1480745&r1=1480744&r2=1480745&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Thu May  9 19:49:48 2013
@@ -71,6 +71,7 @@ import org.apache.webbeans.component.Inj
 import org.apache.webbeans.component.JmsBeanMarker;
 import org.apache.webbeans.component.NewBean;
 import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.third.PassivationCapableThirdpartyBeanImpl;
 import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
@@ -356,16 +357,24 @@ public class BeanManagerImpl extends Abs
      * @param newBean
      * @return
      */
-    public BeanManager addInternalBean(Bean<?> newBean)
+    public <T> BeanManager addInternalBean(Bean<T> newBean)
     {
         if(newBean instanceof AbstractOwbBean)
         {
-            addPassivationInfo((OwbBean)newBean);
+            addPassivationInfo((OwbBean<T>)newBean);
             deploymentBeans.add(newBean);
         }
         else
         {
-            ThirdpartyBeanImpl<?> bean = new ThirdpartyBeanImpl(webBeansContext, newBean);
+            ThirdpartyBeanImpl<?> bean;
+            if (!PassivationCapable.class.isInstance(newBean))
+            {
+                bean = new ThirdpartyBeanImpl<T>(webBeansContext, newBean);
+            }
+            else
+            {
+                bean = new PassivationCapableThirdpartyBeanImpl<T>(webBeansContext,
newBean);
+            }
             addPassivationInfo(bean);
             deploymentBeans.add(bean);
         }



Mime
View raw message