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/18 14:09:54 UTC
svn commit: r1435124 - in /openwebbeans/trunk:
webbeans-impl/src/main/java/org/apache/webbeans/component/
webbeans-impl/src/main/java/org/apache/webbeans/config/
webbeans-impl/src/main/java/org/apache/webbeans/intercept/
webbeans-impl/src/main/java/org...
Author: struberg
Date: Fri Jan 18 13:09:54 2013
New Revision: 1435124
URL: http://svn.apache.org/viewvc?rev=1435124&view=rev
Log:
OWB-344 remove old ProxyFactory
Removed:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/OwbInterceptor.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java Fri Jan 18 13:09:54 2013
@@ -21,14 +21,11 @@ package org.apache.webbeans.component;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Set;
-import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.CreationalContext;
-import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.WebBeansUtil;
@@ -78,54 +75,6 @@ public class ProducerFieldBean<T> extend
}
/**
- * Default producer method creation.
- *
- * @param creationalContext creational context
- * @return producer method instance
- */
- @SuppressWarnings("unchecked")
- protected T createDefaultInstance(CreationalContext<T> creationalContext)
- {
- T instance = null;
- Object parentInstance = null;
- CreationalContext<?> parentCreational = null;
- try
- {
- parentCreational = getManager().createCreationalContext(ownerComponent);
-
- if (!producerField.isAccessible())
- {
- getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(producerField, true);
- }
-
- if (Modifier.isStatic(producerField.getModifiers()))
- {
- instance = (T) producerField.get(null);
- }
- else
- {
- parentInstance = getParentInstanceFromContext(parentCreational);
-
- instance = (T) producerField.get(parentInstance);
- }
- }
- catch(Exception e)
- {
- throw new WebBeansException(e);
- }
- finally
- {
- if (ownerComponent.getScope().equals(Dependent.class))
- {
- destroyBean(ownerComponent, parentInstance, parentCreational);
- }
- }
-
- return instance;
-
- }
-
- /**
* Gets creator field.
*
* @return creator field
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java Fri Jan 18 13:09:54 2013
@@ -56,8 +56,6 @@ public class ProducerMethodBean<T> exten
/** Disposal method */
protected Method disposalMethod;
- private static ThreadLocal<List<DependentCreationalContext<Object>>> dependentInstanceOfProducerMethods =
- new ThreadLocal<List<DependentCreationalContext<Object>>>();
/**
* Creates a new instance.
*
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java Fri Jan 18 13:09:54 2013
@@ -46,7 +46,6 @@ import org.apache.webbeans.portable.Anno
import org.apache.webbeans.portable.events.ExtensionLoader;
import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
import org.apache.webbeans.proxy.NormalScopeProxyFactory;
-import org.apache.webbeans.proxy.ProxyFactory;
import org.apache.webbeans.service.DefaultLoaderService;
import org.apache.webbeans.spi.ContextsService;
import org.apache.webbeans.spi.LoaderService;
@@ -80,7 +79,6 @@ public class WebBeansContext
private final ExtensionLoader extensionLoader = new ExtensionLoader(this);
private final InterceptorsManager interceptorsManager = new InterceptorsManager(this);
private final WebBeansInterceptorConfig webBeansInterceptorConfig = new WebBeansInterceptorConfig(this);
- private final ProxyFactory proxyFactoryRemove;
private final InterceptorDecoratorProxyFactory interceptorDecoratorProxyFactory = new InterceptorDecoratorProxyFactory(this);
private final NormalScopeProxyFactory normalScopeProxyFactory = new NormalScopeProxyFactory(this);
private final OpenWebBeansConfiguration openWebBeansConfiguration;
@@ -138,9 +136,6 @@ public class WebBeansContext
loaderService = getService(LoaderService.class);
securityService = getService(SecurityService.class);
- proxyFactoryRemove = serviceMap.containsKey(ProxyFactory.class)
- ? (ProxyFactory) serviceMap.get(ProxyFactory.class)
- : new ProxyFactory(this);
// Allow the WebBeansContext itself to be looked up
managerMap.put(getClass(), this);
@@ -154,7 +149,6 @@ public class WebBeansContext
managerMap.put(DecoratorsManager.class, decoratorsManager);
managerMap.put(ExtensionLoader.class, extensionLoader);
managerMap.put(InterceptorsManager.class, interceptorsManager);
- managerMap.put(ProxyFactory.class, proxyFactoryRemove);
managerMap.put(InterceptorDecoratorProxyFactory.class, interceptorDecoratorProxyFactory);
managerMap.put(NormalScopeProxyFactory.class, normalScopeProxyFactory);
managerMap.put(OpenWebBeansConfiguration.class, openWebBeansConfiguration);
@@ -329,10 +323,6 @@ public class WebBeansContext
return extensionLoader;
}
- public ProxyFactory getProxyFactoryRemove()
- {
- return proxyFactoryRemove;
- }
public InterceptorDecoratorProxyFactory getInterceptorDecoratorProxyFactory()
{
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java Fri Jan 18 13:09:54 2013
@@ -20,31 +20,20 @@ package org.apache.webbeans.intercept;
import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.component.InterceptedMarker;
-import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.intercept.webbeans.WebBeansInterceptorBeanPleaseRemove;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
import org.apache.webbeans.portable.InjectionTargetImpl;
import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
-import org.apache.webbeans.util.AnnotationUtil;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
import javax.interceptor.AroundInvoke;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
import java.util.logging.Logger;
import static org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
@@ -69,6 +58,10 @@ public final class WebBeansInterceptorCo
}
/**
+ * This method gets invoked in the ValidateBean phase and will fill all the
+ * interceptor information into the given InjectionTargetBean
+ *
+ * TODO: move this method to some other, better place!
* Configure bean instance interceptor stack.
* @param bean bean instance
*/
@@ -113,16 +106,6 @@ public final class WebBeansInterceptorCo
}
}
-/*X TODO remove
- if (mii.getMethodDecorators() != null)
- {
- LinkedHashMap<Decorator<?>, Method> methodDecorators= mii.getMethodDecorators();
-
- //X TODO fill an own DecoratorDelegateInterceptor and add it to the activeInterceptors.
- //X TODO or find some alternative handling
- }
-*/
-
if (activeInterceptors.size() > 0)
{
methodInterceptors.put(interceptedMethod, activeInterceptors);
@@ -191,98 +174,5 @@ public final class WebBeansInterceptorCo
}
- /**
- * Configures WebBeans specific interceptor class.
- *
- * @param interceptorBindingTypes interceptor class
- */
- public <T> void configureInterceptorClass(InjectionTargetBean<T> delegate, Annotation[] interceptorBindingTypes)
- {
- if(delegate.getScope() != Dependent.class)
- {
- if(logger.isLoggable(Level.WARNING))
- {
- logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, delegate.getBeanClass().getName());
- }
- }
-
- if(delegate.getName() != null)
- {
- if(logger.isLoggable(Level.WARNING))
- {
- logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, delegate.getBeanClass().getName());
- }
- }
-
- if(delegate.isAlternative())
- {
- if(logger.isLoggable(Level.WARNING))
- {
- logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, delegate.getBeanClass().getName());
- }
- }
-
- if (logger.isLoggable(Level.FINE))
- {
- logger.log(Level.FINE, "Configuring interceptor class : [{0}]", delegate.getReturnType());
- }
- WebBeansInterceptorBeanPleaseRemove<T> interceptor = new WebBeansInterceptorBeanPleaseRemove<T>(delegate);
-
- for (Annotation ann : interceptorBindingTypes)
- {
- checkInterceptorAnnotations(interceptorBindingTypes, ann, delegate);
- interceptor.addInterceptorBinding(ann.annotationType(), ann);
- }
-
-
- delegate.getWebBeansContext().getInterceptorsManager().addCdiInterceptor(interceptor);
-
- }
-
- private void checkInterceptorAnnotations(Annotation[] interceptorBindingTypes, Annotation ann, Bean<?> bean)
- {
- for(Annotation old : interceptorBindingTypes)
- {
- if(old.annotationType().equals(ann.annotationType()))
- {
- if(!AnnotationUtil.isQualifierEqual(ann, old))
- {
- throw new WebBeansConfigurationException("Interceptor Binding types must be equal for interceptor : " + bean);
- }
- }
- }
- }
-
- /*
- * Find the deployed interceptors with all the given interceptor binding types.
- * The reason why we can face multiple InterceptorBindings is because of the transitive
- * behaviour of @InterceptorBinding. See section 9.1.1 of the CDI spec.
- */
- public Set<Interceptor<?>> findDeployedWebBeansInterceptor(Annotation[] interceptorBindingTypes)
- {
- Set<Interceptor<?>> set = new HashSet<Interceptor<?>>();
-
- Iterator<Interceptor<?>> it = webBeansContext.getInterceptorsManager().getCdiInterceptors().iterator();
-
- List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<? extends Annotation>>();
- List<Annotation> listAnnot = new ArrayList<Annotation>();
- for (Annotation ann : interceptorBindingTypes)
- {
- bindingTypes.add(ann.annotationType());
- listAnnot.add(ann);
- }
-
- while (it.hasNext())
- {
- WebBeansInterceptorBeanPleaseRemove<?> interceptor = (WebBeansInterceptorBeanPleaseRemove<?>) it.next();
-
- if (interceptor.hasBinding(bindingTypes, listAnnot))
- {
- set.add(interceptor);
- set.addAll(interceptor.getMetaInceptors());
- }
- }
- return set;
- }
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java Fri Jan 18 13:09:54 2013
@@ -18,24 +18,18 @@
*/
package org.apache.webbeans.intercept.webbeans;
-import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.component.AbstractOwbBean;
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
-import org.apache.webbeans.intercept.OwbInterceptor;
import org.apache.webbeans.util.AnnotationUtil;
import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InterceptionType;
-import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.util.Nonbinding;
import javax.interceptor.AroundInvoke;
import javax.interceptor.AroundTimeout;
@@ -64,7 +58,7 @@ import java.util.logging.Level;
* @version $Rev$ $Date$
* @deprecated this should get replaced via a new version which does <b>not</b> delegate to a ManagedBean!
*/
-public class WebBeansInterceptorBeanPleaseRemove<T> extends AbstractOwbBean<T> implements OwbInterceptor<T>
+public class WebBeansInterceptorBeanPleaseRemove<T> extends AbstractOwbBean<T>
{
/** InterceptorBindingTypes exist on the interceptor class */
private Map<Class<? extends Annotation>, Annotation> interceptorBindingSet = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -187,60 +181,6 @@ public class WebBeansInterceptorBeanPlea
return clazz;
}
- public Set<Interceptor<?>> getMetaInceptors()
- {
- Set<Interceptor<?>> set = new HashSet<Interceptor<?>>();
-
- Set<Annotation> keys = getInterceptorBindings();
-
- AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
-
- for (Annotation key : keys)
- {
- Class<? extends Annotation> clazzAnnot = key.annotationType();
- Set<Annotation> declared = null;
- Annotation[] anns = null;
-
- if (webBeansContext.getInterceptorsManager().hasInterceptorBindingType(clazzAnnot))
- {
- declared = webBeansContext.getInterceptorsManager().getInterceptorBindingTypeMetaAnnotations(clazzAnnot);
- anns = new Annotation[declared.size()];
- anns = declared.toArray(anns);
- }
-
- else if (annotationManager.hasInterceptorBindingMetaAnnotation(clazzAnnot.getDeclaredAnnotations()))
- {
- anns = annotationManager.getInterceptorBindingMetaAnnotations(clazzAnnot.getDeclaredAnnotations());
- }
-
- /*
- * For example: @InterceptorBinding @Transactional @Action
- * public @interface ActionTransactional @ActionTransactional
- * @Production { }
- */
-
- if (anns != null && anns.length > 0)
- {
- // For example : @Transactional @Action Interceptor
- Set<Interceptor<?>> metas = webBeansContext.getWebBeansInterceptorConfig().findDeployedWebBeansInterceptor(anns);
- set.addAll(metas);
-
- // For each @Transactional and @Action Interceptor
- for (Annotation ann : anns)
- {
- Annotation[] simple = new Annotation[1];
- simple[0] = ann;
- metas = webBeansContext.getWebBeansInterceptorConfig().findDeployedWebBeansInterceptor(simple);
- set.addAll(metas);
- }
-
- }
-
- }
-
- return set;
- }
-
public Set<Annotation> getInterceptorBindings()
{
Set<Annotation> set = new HashSet<Annotation>();
@@ -285,17 +225,7 @@ public class WebBeansInterceptorBeanPlea
return method;
}
-
- @SuppressWarnings("unchecked")
- protected T createInstance(CreationalContext<T> creationalContext)
- {
- Context context = webBeansContext.getBeanManagerImpl().getContext(getScope());
- Object actualInstance = context.get((Bean<Object>) delegateBean, (CreationalContext<Object>)creationalContext);
- T proxy = (T) webBeansContext.getProxyFactoryRemove().createDependentScopedBeanProxyRemove(delegateBean, actualInstance, creationalContext);
-
- return proxy;
- }
-
+
@Override
public Set<Annotation> getQualifiers()
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java Fri Jan 18 13:09:54 2013
@@ -168,9 +168,6 @@ public abstract class AbstractLifeCycle
injectionResolver.clearCaches();
- //Delte proxies
- webBeansContext.getProxyFactoryRemove().clear();
-
//Delete AnnotateTypeCache
webBeansContext.getAnnotatedElementFactory().clear();
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=1435124&r1=1435123&r2=1435124&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 Fri Jan 18 13:09:54 2013
@@ -45,9 +45,7 @@ import javax.decorator.Decorator;
import javax.enterprise.context.Dependent;
import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.event.Observes;
import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Specializes;
@@ -346,7 +344,7 @@ public final class WebBeansUtil
+ " have to be concrete if not defines as @Decorator");
}
- if (!isConstructureOk(clazz))
+ if (!isConstructorOk(clazz))
{
throw new WebBeansConfigurationException("Bean implementation class : " + clazz.getName()
+ " must define at least one Constructor");
@@ -443,78 +441,6 @@ public final class WebBeansUtil
return false;
}
- /**
- * Defines applicable constructor.
- * @param <T> type info
- * @param clazz class type
- * @return constructor
- * @throws WebBeansConfigurationException any configuration exception
- */
- public <T> Constructor<T> defineConstructor(Class<T> clazz) throws WebBeansConfigurationException
- {
- Asserts.nullCheckForClass(clazz);
- Constructor<?>[] constructors = webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructors(clazz);
-
- return defineConstructor(constructors, clazz);
-
- }
-
-
- public <T> Constructor<T> defineConstructor(Constructor<?>[] constructors, Class<T> clazz)
- {
- Constructor<T> result = null;
-
- boolean inAnnotation = false;
-
- /* Check for @Initializer */
- for (Constructor<?> constructor : constructors)
- {
- if (constructor.getAnnotation(Inject.class) != null)
- {
- if (inAnnotation)// duplicate @In
- {
- throw new WebBeansConfigurationException("There are more than one Constructor with "
- + "Initializer annotation in class " + clazz.getName());
- }
- inAnnotation = true;
- result = (Constructor<T>) constructor;
- }
- }
-
- if (result == null)
- {
- result = getNoArgConstructor(clazz);
-
- if(result == null)
- {
- throw new WebBeansConfigurationException("No constructor is found for the class : " + clazz.getName());
- }
- }
-
-
- Annotation[][] parameterAnns = result.getParameterAnnotations();
- for (Annotation[] parameters : parameterAnns)
- {
- for (Annotation param : parameters)
- {
- if (param.annotationType().equals(Disposes.class))
- {
- throw new WebBeansConfigurationException("Constructor parameter annotations can not contain " +
- "@Disposes annotation in class : " + clazz.getName());
- }
-
- if(param.annotationType().equals(Observes.class))
- {
- throw new WebBeansConfigurationException("Constructor parameter annotations can not contain " +
- "@Observes annotation in class : " + clazz.getName());
- }
- }
-
- }
-
- return result;
-
- }
/**
* Check that simple web beans class has compatible constructor.
@@ -522,7 +448,7 @@ public final class WebBeansUtil
* @throws WebBeansConfigurationException if the web beans has incompatible
* constructor
*/
- public boolean isConstructureOk(Class<?> clazz) throws WebBeansConfigurationException
+ public boolean isConstructorOk(Class<?> clazz) throws WebBeansConfigurationException
{
Asserts.nullCheckForClass(clazz);
@@ -1046,53 +972,6 @@ public final class WebBeansUtil
}
}
-
- /**
- * Create a new instance of the given class using it's default constructor
- * regardless if the constructor is visible or not.
- * This is needed to construct some package scope classes in the TCK.
- *
- * @param <T>
- * @param clazz
- * @return
- * @throws WebBeansConfigurationException
- */
- public <T> T newInstanceForced(Class<T> clazz) throws WebBeansConfigurationException
- {
- // FIXME: This new instance should have JCDI injection performed
- Constructor<T> ct = getNoArgConstructor(clazz);
- if (ct == null)
- {
- throw new WebBeansConfigurationException("class : " + clazz.getName() + " must have no-arg constructor");
- }
-
- if (!ct.isAccessible())
- {
- webBeansContext.getSecurityService().doPrivilegedSetAccessible(ct, true);
- }
-
- try
- {
- return ct.newInstance();
- }
- catch( IllegalArgumentException e )
- {
- throw new WebBeansConfigurationException("class : " + clazz.getName() + " is not constructable", e);
- }
- catch( IllegalAccessException e )
- {
- throw new WebBeansConfigurationException("class : " + clazz.getName() + " is not constructable", e);
- }
- catch( InvocationTargetException e )
- {
- throw new WebBeansConfigurationException("class : " + clazz.getName() + " is not constructable", e);
- }
- catch( InstantiationException e )
- {
- throw new WebBeansConfigurationException("class : " + clazz.getName() + " is not constructable", e);
- }
- }
-
/**
* Returns true if interceptor stack contains interceptor with given type.
*
Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java Fri Jan 18 13:09:54 2013
@@ -46,6 +46,7 @@ import org.apache.webbeans.component.Man
import org.apache.webbeans.component.ProducerFieldBean;
import org.apache.webbeans.component.ProducerMethodBean;
import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.creation.CdiInterceptorBeanBuilder;
import org.apache.webbeans.component.creation.DecoratorBeanBuilder;
import org.apache.webbeans.component.creation.ManagedBeanBuilder;
import org.apache.webbeans.config.WebBeansContext;
@@ -308,14 +309,9 @@ public abstract class TestContext implem
webBeansContext.getInterceptorsManager().addNewInterceptorClass(clazz);
AnnotatedType annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
- webBeansContext.getInterceptorUtil().checkInterceptorConditions(annotatedType);
- component = define(clazz, WebBeansType.INTERCEPTOR, webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
- webBeansContext.getWebBeansInterceptorConfig().configureInterceptorClass((ManagedBean<Object>) component,
- webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(
- clazz.getDeclaredAnnotations()));
-
-
- return component;
+ CdiInterceptorBeanBuilder<T> ibb = new CdiInterceptorBeanBuilder<T>(webBeansContext, annotatedType);
+ ibb.defineCdiInterceptorRules();
+ return ibb.getBean();
}
/**
Modified: openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java (original)
+++ openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java Fri Jan 18 13:09:54 2013
@@ -42,9 +42,8 @@ import org.apache.webbeans.jms.JMSModel.
import org.apache.webbeans.jms.component.JmsBean;
import org.apache.webbeans.util.ClassUtil;
-import org.apache.webbeans.proxy.MethodHandler;
-public class JmsProxyHandler implements InvocationHandler, MethodHandler
+public class JmsProxyHandler implements InvocationHandler
{
private JmsBean<?> jmsComponent = null;
Modified: openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java?rev=1435124&r1=1435123&r2=1435124&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java (original)
+++ openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java Fri Jan 18 13:09:54 2013
@@ -43,7 +43,6 @@ import org.apache.webbeans.exception.Web
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.jms.JMSModel;
import org.apache.webbeans.jms.component.JmsBean;
-import org.apache.webbeans.proxy.MethodHandler;
import org.apache.webbeans.spi.JNDIService;
import org.apache.webbeans.util.Asserts;
@@ -167,11 +166,10 @@ public final class JmsUtil
{
try
{
- final MethodHandler handler = new JmsProxyHandler(jmsComponent, intf);
-
final Class<?>[] interfaces = {Closable.class, Serializable.class, intf};
- return WebBeansContext.getInstance().getProxyFactoryRemove().createProxy(handler, interfaces);
+ //X TODO do we still need this?
+ throw new WebBeansException("Support got temporarily removed while moving from Javassist to ASM");
}
catch (Exception e)