openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r794883 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ container/ plugins/ util/ xml/
Date Thu, 16 Jul 2009 21:54:37 GMT
Author: gerdogdu
Date: Thu Jul 16 21:54:37 2009
New Revision: 794883

URL: http://svn.apache.org/viewvc?rev=794883&view=rev
Log:
some name updates.

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbPlugin.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
Thu Jul 16 21:54:37 2009
@@ -32,12 +32,18 @@
      * @return true if given class is an deployed ejb bean class
      * @throws WebBeansConfigurationException if any exception occurs
      */
-    public static boolean isEJBWebBean(Class<?> clazz) throws WebBeansConfigurationException
+    public static boolean isSessionBean(Class<?> clazz) throws WebBeansConfigurationException
     {
         PluginLoader loader = PluginLoader.getInstance();
         OpenWebBeansEjbPlugin ejbPlugin = loader.getEjbPlugin();
         
-        return ejbPlugin.isEjbClass(clazz);
+        //There is no ejb container
+        if(ejbPlugin == null)
+        {
+            return false;
+        }
+        
+        return ejbPlugin.isSessionBean(clazz);
     }
     
     /**
@@ -51,7 +57,12 @@
         PluginLoader loader = PluginLoader.getInstance();
         OpenWebBeansEjbPlugin ejbPlugin = loader.getEjbPlugin();
         
-        return ejbPlugin.defineEjbComponent(clazz);
+        if(ejbPlugin == null)
+        {
+            throw new IllegalStateException("There is no provided EJB plugin. Unable to define
session bean for class : " + clazz.getName());
+        }
+        
+        return ejbPlugin.defineSessionBean(clazz);
     }
     
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Thu Jul 16 21:54:37 2009
@@ -80,11 +80,11 @@
      * @return true if this class can be candidate for simple web bean
      * @throws WebBeansConfigurationException if any configuration exception occurs
      */
-    public static boolean isSimpleWebBean(Class<?> clazz) throws WebBeansConfigurationException
+    public static boolean isManagedBean(Class<?> clazz) throws WebBeansConfigurationException
     {
         try
         {
-            WebBeansUtil.isSimpleWebBeanClass(clazz);
+            WebBeansUtil.isManagedBeanClass(clazz);
 
         }
         catch (WebBeansConfigurationException e)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
Thu Jul 16 21:54:37 2009
@@ -311,12 +311,12 @@
                     continue;
                 }
                 
-                if (ManagedBeanConfigurator.isSimpleWebBean(implClass))
+                if (ManagedBeanConfigurator.isManagedBean(implClass))
                 {
                     logger.info("Managed Bean with class name : " + componentClassName +
" is found");
                     defineManagedBean(implClass);
                 }
-                else if (EJBWebBeansConfigurator.isEJBWebBean(implClass))
+                else if (EJBWebBeansConfigurator.isSessionBean(implClass))
                 {
                     logger.info("Enterprise Bean with class name : " + componentClassName
+ " is found");
                     defineEnterpriseWebBean(implClass);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Thu Jul 16 21:54:37 2009
@@ -73,6 +73,7 @@
 import org.apache.webbeans.intercept.InterceptorComparator;
 import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
+import org.apache.webbeans.plugins.OpenWebBeansEjbPlugin;
 import org.apache.webbeans.plugins.PluginLoader;
 import org.apache.webbeans.portable.AnnotatedElementFactory;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
@@ -694,7 +695,13 @@
         
         if(bean instanceof EnterpriseBeanMarker)
         {
-            return PluginLoader.getInstance().getEjbPlugin().getProxy(bean);
+            OpenWebBeansEjbPlugin ejbPlugin = PluginLoader.getInstance().getEjbPlugin();
+            if(ejbPlugin == null)
+            {
+                throw new IllegalStateException("There is no EJB plugin provider. Injection
is failed for bean : " + bean);
+            }
+            
+            return ejbPlugin.getSessionBeanProxy(bean,ClassUtil.getClazz(beanType));
         }
         
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbPlugin.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbPlugin.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbPlugin.java
Thu Jul 16 21:54:37 2009
@@ -15,27 +15,58 @@
 
 import javax.enterprise.inject.spi.Bean;
 
+/**
+ * Session bean related plugin contract.
+ * 
+ * @version $Rev$ $Date$
+ */
 public interface OpenWebBeansEjbPlugin extends OpenWebBeansPlugin
 {
     /**
-     * Returns true if class is an ejb class false otherwise
+     * Returns true if class is an session bean class false otherwise
      * 
      * @param clazz class definition
      * @return true if class is an ejb class false otherwise
      */
-    public boolean isEjbClass(Class<?> clazz);
-    
+    public boolean isSessionBean(Class<?> clazz);
+
+    /**
+     * Configures session bean and adds it into the container.
+     * 
+     * @param clazz session bean class
+     */
+    public <T> Bean<T> defineSessionBean(Class<T> clazz);
+
     /**
-     * Configures ejb component and adds it into the container.
-     * @param clazz ejb class
+     * Returns true if given class is singleton session bean, false otherwise.
+     * 
+     * @param clazz session bean class
+     * @return true if given class is singleton session bean, false otherwise
      */
-    public <T> Bean<T> defineEjbComponent(Class<T> clazz);
-    
     public boolean isSingletonBean(Class<?> clazz);
-    
+
+    /**
+     * Returns true if given class is stateless session bean, false otherwise.
+     * 
+     * @param clazz session bean class
+     * @return true if given class is singleton session bean, false otherwise
+     */    
     public boolean isStatelessBean(Class<?> clazz);
-    
+
+    /**
+     * Returns true if given class is stateful session bean, false otherwise.
+     * 
+     * @param clazz session bean class
+     * @return true if given class is singleton session bean, false otherwise
+     */    
     public boolean isStatefulBean(Class<?> clazz);
 
-    public Object getProxy(Bean<?> bean);
-}
+    /**
+     * Returns session bean proxy.
+     * 
+     * @param bean session bean
+     * @param proxy interface
+     * @return session bean proxy
+     */
+    public Object getSessionBeanProxy(Bean<?> bean, Class<?> iface);
+}
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Thu Jul 16 21:54:37 2009
@@ -269,13 +269,13 @@
     }
     
     /**
-     * Return <code>true</code> if the given class is ok for simple web bean
conditions,
+     * Return <code>true</code> if the given class is ok for manage bean conditions,
      * <code>false</code> otherwise.
      * 
      * @param clazz class in hand
      * @return <code>true</code> if the given class is ok for simple web bean
conditions.
      */
-    public static void isSimpleWebBeanClass(Class<?> clazz)
+    public static void isManagedBeanClass(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
         int modifier = clazz.getModifiers();
@@ -286,9 +286,6 @@
         if (!ClassUtil.isConcrete(clazz) && !AnnotationUtil.isAnnotationExistOnClass(clazz,
Decorator.class))
             throw new WebBeansConfigurationException("Web Beans component implementation
class : " + clazz.getName() + " have to be concrete if not defines as @Decorator");
 
-        if (PluginLoader.getInstance().getEjbPlugin() != null && PluginLoader.getInstance().getEjbPlugin().isEjbClass(clazz))
-            throw new WebBeansConfigurationException("Web Beans component implementation
class : " + clazz.getName() + " can not be EJB class");
-
         if (ClassUtil.isAssignable(Servlet.class, clazz))
             throw new WebBeansConfigurationException("Web Beans component implementation
class : " + clazz.getName() + " can not implement Servlet interface");
 
@@ -608,7 +605,7 @@
 
         NewBean<T> comp = null;
 
-        if (ManagedBeanConfigurator.isSimpleWebBean(clazz))
+        if (ManagedBeanConfigurator.isManagedBean(clazz))
         {
             comp = new NewBean<T>(clazz, WebBeansType.MANAGED);
             comp.setConstructor(WebBeansUtil.defineConstructor(clazz));
@@ -616,7 +613,7 @@
             DefinitionUtil.defineInjectedFields(comp);
             DefinitionUtil.defineInjectedMethods(comp);
         }
-        else if (EJBWebBeansConfigurator.isEJBWebBean(clazz))
+        else if (EJBWebBeansConfigurator.isSessionBean(clazz))
         {
             comp = new NewBean<T>(clazz, WebBeansType.ENTERPRISE);
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=794883&r1=794882&r2=794883&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Thu Jul 16 21:54:37 2009
@@ -532,7 +532,7 @@
 
         /* Enterprise WebBean */
         OpenWebBeansEjbPlugin plugin = PluginLoader.getInstance().getEjbPlugin();
-        if (plugin != null && plugin.isEjbClass(clazz))
+        if (plugin != null && plugin.isSessionBean(clazz))
         {
             // Configure for EJB
             configureEJBWebBean(clazz);
@@ -541,7 +541,7 @@
         else
         {
             /* Simple WebBeans */
-            if (ManagedBeanConfigurator.isSimpleWebBean(clazz))
+            if (ManagedBeanConfigurator.isManagedBean(clazz))
             {
                 // Configure Simple WebBean
                 configureSimpleWebBean(clazz, webBeanElement);



Mime
View raw message