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/17 01:11:49 UTC
svn commit: r1434512 - in
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
component/ component/creation/ inject/ intercept/ portable/creation/ proxy/
util/
Author: struberg
Date: Thu Jan 17 00:11:48 2013
New Revision: 1434512
URL: http://svn.apache.org/viewvc?rev=1434512&view=rev
Log:
OWB-344 remove old unused interceptor code
Removed:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/Injectable.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.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/ManagedBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducerRemove.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java Thu Jan 17 00:11:48 2013
@@ -55,14 +55,6 @@ public class ExtensionBean<T> extends In
Collections.<Class<? extends Annotation>>emptySet());
setEnabled(true);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void destroyComponentInstance(T instance, CreationalContext<T> creationalContext)
- {
-
- }
+
}
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=1434512&r1=1434511&r2=1434512&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 Thu Jan 17 00:11:48 2013
@@ -162,18 +162,6 @@ public abstract class InjectionTargetBea
}
/**
- * Sub-classes must override this method to destroy bean instance.
- *
- * @param instance object instance.
- */
- protected void destroyComponentInstance(T instance, CreationalContext<T> creationalContext)
- {
- }
-
-
-
-
- /**
* {@inheritDoc}
*/
public List<InterceptorData> getInterceptorStack()
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java Thu Jan 17 00:11:48 2013
@@ -131,39 +131,6 @@ public class ManagedBeanBuilder<T, M ext
return webBeansContext.getInterceptorUtil().getLifecycleMethods(getAnnotated(), PreDestroy.class, false);
}
- /**
- * @deprecated replaced via the various {@link InterceptorBeanBuilder}s
- */
- public ManagedBean<T> defineInterceptor(AnnotatedType<T> annotatedType)
- {
- Class<?> clazz = annotatedType.getJavaClass();
-
- if (webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(clazz))
- {
- ManagedBean<T> component;
-
- webBeansContext.getInterceptorUtil().checkInterceptorConditions(annotatedType);
- component = defineManagedBean(annotatedType);
-
- if (component != null)
- {
- Annotation[] anns = annotatedType.getAnnotations().toArray(new Annotation[annotatedType.getAnnotations().size()]);
- webBeansContext.getWebBeansInterceptorConfig().configureInterceptorClass(component,
- webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(anns));
- }
- else
- {
- // TODO could probably be a bit more descriptive
- throw new DeploymentException("Cannot create Interceptor for class" + annotatedType);
- }
- return component;
- }
- else
- {
- return null;
- }
- }
-
protected void addConstructorInjectionPointMetaData(ManagedBean<T> bean)
{
if (constructor == null)
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Thu Jan 17 00:11:48 2013
@@ -46,7 +46,7 @@ import org.apache.webbeans.util.ClassUti
import org.apache.webbeans.util.WebBeansUtil;
/**
- * Abstract implementation of the {@link Injectable} contract.
+ * Abstract implementation of all components which are injectable.
*
* <p>
* Do actual injection via {@link AbstractInjectable#inject(InjectionPoint)}
@@ -56,7 +56,7 @@ import org.apache.webbeans.util.WebBeans
* @see InjectableConstructor
* @see InjectableMethod
*/
-public abstract class AbstractInjectable<T> implements Injectable<T>
+public abstract class AbstractInjectable<T>
{
private Producer<?> owner;
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=1434512&r1=1434511&r2=1434512&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 Thu Jan 17 00:11:48 2013
@@ -18,7 +18,6 @@
*/
package org.apache.webbeans.intercept;
-import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.component.InterceptedMarker;
import org.apache.webbeans.config.OWBLogConst;
@@ -26,19 +25,10 @@ import org.apache.webbeans.config.WebBea
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.intercept.webbeans.WebBeansInterceptorBeanPleaseRemove;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
-import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
import org.apache.webbeans.portable.InjectionTargetImpl;
import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
-import org.apache.webbeans.spi.BDABeansXmlScanner;
-import org.apache.webbeans.spi.ScannerService;
import org.apache.webbeans.util.AnnotationUtil;
-import org.apache.webbeans.util.ArrayUtil;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
@@ -46,7 +36,6 @@ 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;
@@ -250,214 +239,6 @@ public final class WebBeansInterceptorCo
}
}
- /**
- * Configures the given class for applicable interceptors.
- * @deprecated old interceptor stuff
- */
- public void configure(InjectionTargetBean<?> component, List<InterceptorData> stack)
- {
- AnnotatedType<?> annotatedType = component.getAnnotatedType();
- Set<Annotation> annotations = annotatedType.getAnnotations();
-
- AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
-
- Annotation[] typeAnns;
- typeAnns = annotations.toArray(new Annotation[annotations.size()]);
- Set<Annotation> bindingTypeSet = annotationManager.getInterceptorAnnotations(ArrayUtil.asSet(typeAnns));
-
- Annotation[] anns;
- Set<Interceptor<?>> componentInterceptors = null;
-
- anns = bindingTypeSet.toArray(new Annotation[bindingTypeSet.size()]);
-
- //Spec Section 9.5.2
- for(Annotation checkAnn : anns)
- {
- checkInterceptorAnnotations(anns, checkAnn, component);
- }
-
- if (anns.length > 0)
- {
- componentInterceptors = findDeployedWebBeansInterceptor(anns);
-
- // Adding class interceptors
- addComponentInterceptors(componentInterceptors, stack);
- }
-
- // Method level interceptors.
- addMethodInterceptors(annotatedType, stack, componentInterceptors);
- filterInterceptorsPerBDA(component,stack);
-
- Collections.sort(stack, new InterceptorDataComparator(component.getWebBeansContext()));
-
- }
-
- private void filterInterceptorsPerBDA(InjectionTargetBean<?> component, List<InterceptorData> stack)
- {
-
- ScannerService scannerService = component.getWebBeansContext().getScannerService();
- if (!scannerService.isBDABeansXmlScanningEnabled())
- {
- return;
- }
- BDABeansXmlScanner beansXMLScanner = scannerService.getBDABeansXmlScanner();
- String beanBDABeansXML = beansXMLScanner.getBeansXml(component.getBeanClass());
- Set<Class<?>> definedInterceptors = beansXMLScanner.getInterceptors(beanBDABeansXML);
-
- InterceptorData interceptorData;
-
- if (stack != null && stack.size() > 0)
- {
- Iterator<InterceptorData> it = stack.iterator();
- while (it.hasNext())
- {
- interceptorData = (InterceptorData) it.next();
- if (!definedInterceptors.contains(interceptorData.getInterceptorClass()))
- {
- it.remove();
- }
- }
- }
-
- }
-
- public void addComponentInterceptors(Set<Interceptor<?>> set, List<InterceptorData> stack)
- {
- Iterator<Interceptor<?>> it = set.iterator();
- while (it.hasNext())
- {
- WebBeansInterceptorBeanPleaseRemove<?> interceptor = (WebBeansInterceptorBeanPleaseRemove<?>) it.next();
- AnnotatedType<?> annotatedType = interceptor.getAnnotatedType();
-
- OpenWebBeansEjbLCAPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
- Class <? extends Annotation> prePassivateClass = null;
- Class <? extends Annotation> postActivateClass = null;
- if (null != ejbPlugin)
- {
- prePassivateClass = ejbPlugin.getPrePassivateClass();
- postActivateClass = ejbPlugin.getPostActivateClass();
- }
-
- // interceptor binding
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor, annotatedType,
- AroundInvoke.class, true,
- false, stack, null, true);
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor, annotatedType,
- PostConstruct.class, true,
- false, stack, null, true);
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor, annotatedType,
- PreDestroy.class, true,
- false, stack, null, true);
-
- if (null != ejbPlugin)
- {
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
- annotatedType,
- prePassivateClass,
- true, false, stack,
- null, true);
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
- annotatedType,
- postActivateClass,
- true, false, stack,
- null, true);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> void addMethodInterceptors(AnnotatedType<T> annotatedType,
- List<InterceptorData> stack,
- Set<Interceptor<?>> componentInterceptors)
- {
-
- AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
- Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
- for(AnnotatedMethod<? super T> methodA : methods)
- {
- AnnotatedMethod<T> methodB = (AnnotatedMethod<T>)methodA;
- Method method = methodB.getJavaMember();
- Set<Annotation> interceptorAnns = new HashSet<Annotation>();
-
- Annotation[] methodAnns = AnnotationUtil.asArray(methodB.getAnnotations());
- if (annotationManager.hasInterceptorBindingMetaAnnotation(methodAnns))
- {
- Annotation[] anns =
- annotationManager.getInterceptorBindingMetaAnnotations(
- methodAnns);
- Annotation[] annsClazz =
- annotationManager.getInterceptorBindingMetaAnnotations(
- AnnotationUtil.asArray(annotatedType.getAnnotations()));
-
- for (Annotation ann : anns)
- {
- interceptorAnns.add(ann);
- }
-
- for (Annotation ann : annsClazz)
- {
- interceptorAnns.add(ann);
- }
- }
-
- Annotation[] stereoTypes =
- annotationManager.getStereotypeMetaAnnotations(
- AnnotationUtil.asArray(annotatedType.getAnnotations()));
- for (Annotation stero : stereoTypes)
- {
- if (annotationManager.hasInterceptorBindingMetaAnnotation(
- stero.annotationType().getDeclaredAnnotations()))
- {
- Annotation[] steroInterceptorBindings =
- annotationManager.getInterceptorBindingMetaAnnotations(
- stero.annotationType().getDeclaredAnnotations());
-
- for (Annotation ann : steroInterceptorBindings)
- {
- interceptorAnns.add(ann);
- }
- }
- }
-
- if (!interceptorAnns.isEmpty())
- {
- Annotation[] result = new Annotation[interceptorAnns.size()];
- result = interceptorAnns.toArray(result);
-
- Set<Interceptor<?>> setInterceptors = findDeployedWebBeansInterceptor(result);
-
- if(componentInterceptors != null)
- {
- setInterceptors.removeAll(componentInterceptors);
- }
-
- Iterator<Interceptor<?>> it = setInterceptors.iterator();
-
- while (it.hasNext())
- {
- WebBeansInterceptorBeanPleaseRemove<?> interceptor = (WebBeansInterceptorBeanPleaseRemove<?>) it.next();
-
- AnnotatedType<?> interAnnoType = interceptor.getAnnotatedType();
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
- interAnnoType,
- AroundInvoke.class,
- true, true, stack,
- method, true);
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
- interAnnoType,
- PostConstruct.class,
- true, true, stack,
- method, true);
- webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
- interAnnoType,
- PreDestroy.class,
- true, true, stack,
- method, true);
- }
- }
- }
- }
-
/*
* Find the deployed interceptors with all the given interceptor binding types.
* The reason why we can face multiple InterceptorBindings is because of the transitive
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducerRemove.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducerRemove.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducerRemove.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducerRemove.java Thu Jan 17 00:11:48 2013
@@ -93,20 +93,6 @@ public abstract class AbstractProducerRe
bean.destroyCreatedInstance(instance, creationalContext);
}
- /**
- * Returns actual bean instance.
- *
- * @param <X> bean type info
- * @param clazz bean type class
- * @return actual bean
- */
- protected <X> X getBean(Class<X> clazz)
- {
- return clazz.cast(bean);
- }
-
- public void setBean(OwbBean<T> bean)
- {
- this.bean = bean;
- }
+
+
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java Thu Jan 17 00:11:48 2013
@@ -22,7 +22,6 @@ import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -60,7 +59,6 @@ import org.apache.webbeans.util.WebBeans
*/
public final class ProxyFactory
{
- private final WebBeansContext webBeansContext;
private ConcurrentMap<OwbBean<?>, Class<?>> buildInBeanProxyClassesRemove = new ConcurrentHashMap<OwbBean<?>, Class<?>>();
private ConcurrentMap<OwbBean<?>, Class<?>> normalScopedBeanProxyClassesRemove = new ConcurrentHashMap<OwbBean<?>, Class<?>>();
@@ -72,13 +70,9 @@ public final class ProxyFactory
private ConcurrentMap<OwbBean<?>, ConcurrentMap<Class<?>, Class<?>>> ejbProxyClasses = new ConcurrentHashMap<OwbBean<?>, ConcurrentMap<Class<?>, Class<?>>>();
private Factory factoryRemove = new JavassistFactory();
- private final InterceptorDecoratorProxyFactory interceptorDecoratorProxyFactory;
-
public ProxyFactory(WebBeansContext webBeansContext)
{
- this.webBeansContext = webBeansContext;
- this.interceptorDecoratorProxyFactory = new InterceptorDecoratorProxyFactory();
}
/**
@@ -106,71 +100,6 @@ public final class ProxyFactory
interceptorProxyClassesRemove.clear();
ejbProxyClasses.clear();
}
- /**
- * Provides the proxy for the given bean and interface, if defined
- *
- * @param bean the contextual representing the EJB
- * @param iface the injected business local interface
- * @return the proxy Class if one has been defined, else null
- */
- public Class<?> getEjbBeanProxyClass(OwbBean<?> bean, Class<?> iface)
- {
- Class<?> proxyClass = null;
-
- ConcurrentMap<Class<?>, Class<?>> typeToProxyClassMap = ejbProxyClasses.get(bean);
- if (typeToProxyClassMap == null)
- {
- typeToProxyClassMap = new ConcurrentHashMap<Class<?>, Class<?>>();
- ConcurrentMap<Class<?>, Class<?>> existingMap = ejbProxyClasses.putIfAbsent(bean, typeToProxyClassMap);
-
- // use the map that beat us, because our new one definitely had no classes in it.
- typeToProxyClassMap = (existingMap != null) ? existingMap : typeToProxyClassMap;
- }
-
- proxyClass = typeToProxyClassMap.get(iface);
-
- if (proxyClass == null)
- {
- Class<?> superClazz = null;
- List<Class<?>> list = new ArrayList<Class<?>>();
- Class<?>[] interfaces = null;
-
- if (iface.isInterface())
- {
- list.add(iface);
- }
- else
- {
- // @LocalBean no-interface local view requested
- superClazz = iface;
- //Stateless beans with no interface
- //To failover bean instance
- Class<?>[] ifaces = iface.getInterfaces();
- if(ifaces != null && ifaces.length > 0)
- {
- //check for serializable
- for(Class<?> temp : ifaces)
- {
- if(temp == Serializable.class)
- {
- list.add(Serializable.class);
- break;
- }
- }
- }
- }
-
- interfaces = new Class<?>[list.size()];
- interfaces = list.toArray(interfaces);
- proxyClass = factoryRemove.getProxyClass(superClazz, interfaces);
-
- typeToProxyClassMap.putIfAbsent(iface, proxyClass);
- // don't care if we were beaten in updating the iface->proxyclass map
- }
-
- return proxyClass;
- }
-
/**
* TODO rework! Still uses old proxy
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1434512&r1=1434511&r2=1434512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Thu Jan 17 00:11:48 2013
@@ -1116,29 +1116,6 @@ public final class ClassUtil
}
/**
- * @deprecated no longer used by core, not safe for generic types
- */
- public static Set<Type> setInterfaceTypeHierarchy(Set<Type> set, Class<?> clazz)
- {
- Asserts.nullCheckForClass(clazz);
-
- do
- {
- Class<?>[] interfaces = clazz.getInterfaces();
-
- for (Class<?> cl : interfaces)
- {
- set.add(cl);
-
- setTypeHierarchy(set, cl);
- }
- clazz = clazz.getSuperclass();
- } while (clazz != null && clazz != Object.class);
-
- return set;
- }
-
- /**
* Return true if it does not contain type variable for wildcard type
* false otherwise.
*