You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2013/01/05 19:37:12 UTC

svn commit: r1429354 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ container/ event/ util/ xml/

Author: struberg
Date: Sat Jan  5 18:37:12 2013
New Revision: 1429354

URL: http://svn.apache.org/viewvc?rev=1429354&view=rev
Log:
OWB-748 remove unused methods

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java Sat Jan  5 18:37:12 2013
@@ -33,12 +33,9 @@ import org.apache.webbeans.config.WebBea
  */
 public class NewManagedBean<T> extends ManagedBean<T> implements NewBean<T>
 {
-    private WebBeansType definedType;
-
     public NewManagedBean(Class<T> returnType, WebBeansType definedType, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
     {
         super(returnType, annotatedType, webBeansContext);
-        this.definedType = definedType;        
     }
 
     @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=1429354&r1=1429353&r2=1429354&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 Sat Jan  5 18:37:12 2013
@@ -740,7 +740,7 @@ public class BeanManagerImpl implements 
         //Check type if bean type is given
         if(beanType != null)
         {
-            if(!ResolutionUtil.checkBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof NewBean))
+            if(!webBeansContext.getResolutionUtil().checkBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof NewBean))
             {
                 throw new IllegalArgumentException("Given bean type : " + beanType + " is not applicable for the bean instance : " + bean);
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java Sat Jan  5 18:37:12 2013
@@ -28,14 +28,11 @@ import org.apache.webbeans.util.ClassUti
 public final class ResolutionUtil
 {
 
-    private final WebBeansContext webBeansContext;
-
     public ResolutionUtil(WebBeansContext webBeansContext)
     {
-        this.webBeansContext = webBeansContext;
     }
 
-    public static boolean checkBeanTypeAssignableToGivenType(Set<Type> beanTypes, Type givenType, boolean newBean)
+    public boolean checkBeanTypeAssignableToGivenType(Set<Type> beanTypes, Type givenType, boolean newBean)
     {
         Iterator<Type> itBeanApiTypes = beanTypes.iterator();
         while (itBeanApiTypes.hasNext())

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java Sat Jan  5 18:37:12 2013
@@ -498,39 +498,6 @@ public final class NotificationManager
         }
     }
 
-    public <T> Set<ObserverMethod<?>> addObservableComponentMethods(InjectionTargetBean<?> component)
-    {
-        Asserts.assertNotNull(component, "component parameter can not be null");
-        Set<Method> observableMethods = component.getObservableMethods();
-        Set<ObserverMethod<?>> observerMethods = new HashSet<ObserverMethod<?>>();
-        
-        //check for null
-        if(observableMethods != null)
-        {
-            for (Method observableMethod : observableMethods)
-            {
-                Observes observes = AnnotationUtil.getMethodFirstParameterAnnotation(observableMethod, Observes.class);
-
-                boolean ifExist = false;
-
-                if (observes.notifyObserver().equals(Reception.IF_EXISTS))
-                {
-                    ifExist = true;
-                }
-
-                ObserverMethodImpl<T> observer = new ObserverMethodImpl(component, observableMethod, ifExist);
-
-                Type type = AnnotationUtil.getMethodFirstParameterWithAnnotation(observableMethod, Observes.class);
-
-                addObserver(observer, type);
-                
-                observerMethods.add(observer);
-            }            
-        }
-
-        return observerMethods;
-    }
-    
     /**
      * Gets observer method from given annotated method.
      * @param <T> bean type info

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java Sat Jan  5 18:37:12 2013
@@ -27,13 +27,11 @@ import org.apache.webbeans.component.Owb
 import org.apache.webbeans.component.ProducerFieldBean;
 import org.apache.webbeans.component.ProducerMethodBean;
 import org.apache.webbeans.component.ResourceBean;
-import org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl;
 import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.inject.impl.InjectionPointFactory;
-import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.spi.api.ResourceReference;
 
 import javax.enterprise.context.Dependent;
@@ -60,19 +58,14 @@ import java.lang.reflect.ParameterizedTy
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import static org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException;
 
 public final class WebBeansAnnotatedTypeUtil
 {
-    private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansAnnotatedTypeUtil.class);
-
     private final WebBeansContext webBeansContext;
 
     public WebBeansAnnotatedTypeUtil(WebBeansContext webBeansContext)
@@ -751,43 +744,5 @@ public final class WebBeansAnnotatedType
         }                
     }
 
-    /**
-     * Gets injection points for the given javaee component annotated type.
-     * @param webBeansContext
-     *@param type annotated type for the class  @return injection points of the java ee component class
-     * @throws IllegalArgumentException if any exception occurs
-     */
-    public static <T> Set<InjectionPoint> getJavaEeComponentInstanceInjectionPoints(WebBeansContext webBeansContext,
-                                                                                    AnnotatedType<T> type) throws IllegalArgumentException
-    {
-        try
-        {
-            if(type == null)
-            {
-                return Collections.emptySet();
-            }
-            else
-            {
-                //Class of the component
-                Class<T> clazz = type.getJavaClass();
-                
-                //Just creating temporary for getting injected fields
-                AnnotatedTypeBeanCreatorImpl<T> managedBeanCreator = new AnnotatedTypeBeanCreatorImpl<T>(type, webBeansContext);            
-                managedBeanCreator.getBean().setImplScopeType(new DependentScopeLiteral());
-                
-                //Just define injections
-                managedBeanCreator.defineInjectedFields();
-                managedBeanCreator.defineInjectedMethods();
-                
-                return managedBeanCreator.getBean().getInjectionPoints();
-                
-            }            
-        }
-        catch(Exception e)
-        {
-            String message = "Error is occured while getting injection points for the Java EE component instance class, " + type.getJavaClass(); 
-            logger.log(Level.SEVERE, message, e);
-            throw new IllegalArgumentException(message, e);
-        }
-    }
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Sat Jan  5 18:37:12 2013
@@ -582,53 +582,6 @@ public final class WebBeansUtil
     }
 
     /**
-     * Check producer method is ok for deployment.
-     *
-     * @param method producer method
-     * @param parentImplClazzName parent class name
-     */
-    public static void checkProducerMethodForDeployment(Method method, String parentImplClazzName)
-    {
-        Asserts.assertNotNull(method, "Method argument can not be null");
-
-        if (AnnotationUtil.hasMethodAnnotation(method, Inject.class) ||
-            AnnotationUtil.hasMethodParameterAnnotation(method, Disposes.class) ||
-            AnnotationUtil.hasMethodParameterAnnotation(method, Observes.class))
-        {
-            throw new WebBeansConfigurationException("Producer Method Bean with name : " + method.getName()
-                                                     + " in bean class : " + parentImplClazzName
-                                                     + " can not be annotated with @Initializer/@Destructor annotation "
-                                                     + "or has a parameter annotated with @Disposes/@Observes");
-        }
-    }
-
-    /**
-     * CheckProducerMethodDisposal.
-     * @param disposalMethod disposal method
-     * @param definedBeanClassName bean class name
-     */
-    public static void checkProducerMethodDisposal(Method disposalMethod, String definedBeanClassName)
-    {
-        if (AnnotationUtil.hasMethodMultipleParameterAnnotation(disposalMethod, Disposes.class))
-        {
-            throw new WebBeansConfigurationException("Disposal method : " + disposalMethod.getName() + " in class "
-                                                     + definedBeanClassName
-                                                     + " has multiple @Disposes annotation parameter");
-        }
-
-        if (AnnotationUtil.hasMethodAnnotation(disposalMethod, Inject.class) ||
-            AnnotationUtil.hasMethodParameterAnnotation(disposalMethod, Observes.class) ||
-            AnnotationUtil.hasMethodAnnotation(disposalMethod, Produces.class))
-        {
-            throw new WebBeansConfigurationException("Disposal method : " + disposalMethod.getName()
-                                                     + " in the class : " + definedBeanClassName
-                                                     + " can not be annotated with @Initializer/@Destructor/@Produces "
-                                                     + "annotation or has a parameter annotated with @Observes");
-        }
-
-    }
-
-    /**
      * New WebBeans component class.
      *
      * @param <T>
@@ -1833,36 +1786,6 @@ public final class WebBeansUtil
     }
 
     /**
-     * Configures the producer method specialization.
-     *
-     * @param component producer method component
-     * @param method specialized producer method
-     * @param superClass bean super class that has overriden method
-     * @throws DefinitionException if the name is exist on the producer method when
-     *         parent also has name
-     * @throws WebBeansConfigurationException any other exceptions
-     */
-    public static void configureProducerSpecialization(AbstractOwbBean<?> component, Method method, Class<?> superClass)
-    {
-        Method superMethod = ClassUtil.getClassMethodWithTypes(superClass, method.getName(), Arrays.asList(method.getParameterTypes()));
-        if (superMethod == null)
-        {
-            throw new WebBeansConfigurationException("Producer method specialization is failed. Method "
-                    + method.getName() + " not found in super class : " + superClass.getName());
-        }
-
-        if (!AnnotationUtil.hasAnnotation(superMethod.getAnnotations(), Produces.class))
-        {
-            throw new WebBeansConfigurationException("Producer method specialization is failed. Method "
-                    + method.getName() + " found in super class : " + superClass.getName()
-                    + " is not annotated with @Produces");
-        }
-
-        component.setSpecializedBean(true);
-
-    }
-
-    /**
      * Configures the name of the producer method for specializing the parent.
      *
      * @param component producer method component
@@ -1874,21 +1797,6 @@ public final class WebBeansUtil
         return webBeansContext.getAnnotationManager().configuredProducerSpecializedName(component, method, superMethod);
     }
 
-    public static void checkInjectedMethodParameterConditions(Method method, Class<?> clazz)
-    {
-        Asserts.assertNotNull(method, "method parameter can not be null");
-        Asserts.nullCheckForClass(clazz);
-
-        if (AnnotationUtil.hasMethodParameterAnnotation(method, Disposes.class) ||
-            AnnotationUtil.hasMethodParameterAnnotation(method, Observes.class))
-        {
-            throw new WebBeansConfigurationException("Initializer method parameters in method : " + method.getName()
-                    + " in class : " + clazz.getName() + " can not be annotated with @Disposes or @Observers");
-
-        }
-
-    }
-
     /**
      * Returns true if instance injection point false otherwise.
      *

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=1429354&r1=1429353&r2=1429354&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Sat Jan  5 18:37:12 2013
@@ -89,17 +89,6 @@ public final class WebBeansXMLConfigurat
         }
 
     }
-    
-    /**
-     * Configures XML configuration file.
-     *
-     * @param xmlStream xml configuration file
-     * @param fileName  file name
-     */
-    public void configure(InputStream xmlStream, String fileName)
-    {
-        configure(xmlStream, fileName, null);
-    }
 
     /**
      * Configures XML configuration file.