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 2010/07/08 23:32:13 UTC
svn commit: r961950 - in /openwebbeans/trunk:
webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/
webbeans-impl/src/main/java/org/apache/webbeans/config/
webbeans-impl/src/main/java/org/apache/webbeans/container/
webbeans-impl/src/main/java...
Author: struberg
Date: Thu Jul 8 21:32:12 2010
New Revision: 961950
URL: http://svn.apache.org/viewvc?rev=961950&view=rev
Log:
OWB-405 refactored AnnotatedElementFactory from static maps to singletons
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.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-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java
openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java
openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java
Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java (original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java Thu Jul 8 21:32:12 2010
@@ -62,7 +62,9 @@ public final class EjbUtility
public static <T> void fireEvents(Class<T> clazz, BaseEjbBean<T> ejbBean,ProcessAnnotatedType<T> event)
{
BeanManagerImpl manager = BeanManagerImpl.getManager();
- AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(clazz);
+ AnnotatedElementFactory annotatedElementFactory = AnnotatedElementFactory.getInstance();
+
+ AnnotatedType<T> annotatedType = annotatedElementFactory.newAnnotatedType(clazz);
//Fires ProcessAnnotatedType
ProcessAnnotatedTypeImpl<T> processAnnotatedEvent = (ProcessAnnotatedTypeImpl<T>)event;
@@ -102,7 +104,7 @@ public final class EjbUtility
Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods = new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>();
for(ProducerMethodBean<?> producerMethod : producerMethodBeans)
{
- AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(), annotatedType);
+ AnnotatedMethod<?> method = annotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(), annotatedType);
ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForMethod(producerMethod,method);
WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerMethods. Look at logs for further details");
@@ -115,7 +117,7 @@ public final class EjbUtility
Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields = new HashMap<ProducerFieldBean<?>, AnnotatedField<?>>();
for(ProducerFieldBean<?> producerField : producerFieldBeans)
{
- AnnotatedField<?> field = AnnotatedElementFactory.newAnnotatedField(producerField.getCreatorField(), annotatedType);
+ AnnotatedField<?> field = annotatedElementFactory.newAnnotatedField(producerField.getCreatorField(), annotatedType);
ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForField(producerField, field);
WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerFields. Look at logs for further details");
@@ -130,7 +132,7 @@ public final class EjbUtility
for(ObserverMethod<?> observerMethod : observerMethods)
{
ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
- AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(), annotatedType);
+ AnnotatedMethod<?> method = annotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(), annotatedType);
observerMethodsMap.put(observerMethod, method);
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Thu Jul 8 21:32:12 2010
@@ -457,7 +457,7 @@ public class BeansDeployer
for(Class<?> implClass : classIndex)
{
//Define annotation type
- AnnotatedType<?> annotatedType = AnnotatedElementFactory.newAnnotatedType(implClass);
+ AnnotatedType<?> annotatedType = AnnotatedElementFactory.getInstance().newAnnotatedType(implClass);
//Fires ProcessAnnotatedType
ProcessAnnotatedTypeImpl<?> processAnnotatedEvent = WebBeansUtil.fireProcessAnnotatedTypeEvent(annotatedType);
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=961950&r1=961949&r2=961950&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 Jul 8 21:32:12 2010
@@ -166,6 +166,8 @@ public class BeanManagerImpl implements
private Map<Class<?>, InjectionTargetWrapper<?>> injectionTargetForJavaEeComponents =
new ConcurrentHashMap<Class<?>, InjectionTargetWrapper<?>>();
+ private AnnotatedElementFactory annotatedElementFactory;
+
/**
* Creates a new {@link BeanManager} instance.
* Called by the system. Do not use outside of the
@@ -175,6 +177,7 @@ public class BeanManagerImpl implements
{
injectionResolver = new InjectionResolver(this);
notificationManager = new NotificationManager();
+ annotatedElementFactory = AnnotatedElementFactory.getInstance();
}
public <T> void putInjectionTargetWrapper(Contextual<T> contextual, InjectionTargetWrapper<T> wrapper)
@@ -637,7 +640,7 @@ public class BeanManagerImpl implements
@Override
public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
{
- AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(type);
+ AnnotatedType<T> annotatedType = annotatedElementFactory.newAnnotatedType(type);
return annotatedType;
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java Thu Jul 8 21:32:12 2010
@@ -72,7 +72,7 @@ import org.apache.webbeans.util.WebBeans
* }
* </pre>
* Above class X instance observes for the event with type <code>LoggedInEvent</code>
- * and event qualifier is <code>Current</code>. Whenever event is fired, its {@link Observer#notify()}
+ * and event qualifier is <code>Current</code>. Whenever event is fired, its {@link ObserverMethod#notify()}
* method is called.
* </p>
*
@@ -123,7 +123,6 @@ public class ObserverMethodImpl<T> imple
* @param bean owner
* @param observerMethod method
* @param ifExist if exist parameter
- * @param type transaction type
*/
public ObserverMethodImpl(InjectionTargetBean<?> bean, Method observerMethod, boolean ifExist)
{
@@ -150,7 +149,7 @@ public class ObserverMethodImpl<T> imple
* @param bean
* @param observerMethod
* @param ifExist
- * @param observedQualifiers
+ * @param qualifiers
* @param observedEventType
*/
public ObserverMethodImpl(InjectionTargetBean<?> bean, Method observerMethod, boolean ifExist,
@@ -294,9 +293,11 @@ public class ObserverMethodImpl<T> imple
@SuppressWarnings("unchecked")
protected List<ObserverParams> getMethodArguments(Object event)
{
+ AnnotatedElementFactory annotatedElementFactory = AnnotatedElementFactory.getInstance();
+
//Define annotated parameter
- AnnotatedType<T> annotatedType = (AnnotatedType<T>) AnnotatedElementFactory.newAnnotatedType(this.bean.getReturnType());
- AnnotatedMethod<T> annotatedMethod = (AnnotatedMethod<T>)AnnotatedElementFactory.newAnnotatedMethod(this.observerMethod, annotatedType);
+ AnnotatedType<T> annotatedType = (AnnotatedType<T>) annotatedElementFactory.newAnnotatedType(this.bean.getReturnType());
+ AnnotatedMethod<T> annotatedMethod = (AnnotatedMethod<T>)annotatedElementFactory.newAnnotatedMethod(this.observerMethod, annotatedType);
Type[] types = this.observerMethod.getGenericParameterTypes();
Annotation[][] annots = this.observerMethod.getParameterAnnotations();
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Thu Jul 8 21:32:12 2010
@@ -103,9 +103,9 @@ public class InjectionPointFactory
if(!checkFieldApplicable(annots))
{
- AnnotatedType<?> annotated = AnnotatedElementFactory.newAnnotatedType(member.getDeclaringClass());
+ AnnotatedType<?> annotated = AnnotatedElementFactory.getInstance().newAnnotatedType(member.getDeclaringClass());
return getGenericInjectionPoint(owner, annots, member.getGenericType(), member,
- AnnotatedElementFactory.newAnnotatedField(member, annotated));
+ AnnotatedElementFactory.getInstance().newAnnotatedField(member, annotated));
}
else
{
@@ -208,8 +208,8 @@ public class InjectionPointFactory
List<InjectionPoint> lists = new ArrayList<InjectionPoint>();
- AnnotatedType<?> annotated = AnnotatedElementFactory.newAnnotatedType(member.getDeclaringClass());
- AnnotatedMethod method = AnnotatedElementFactory.newAnnotatedMethod(member, annotated);
+ AnnotatedType<?> annotated = AnnotatedElementFactory.getInstance().newAnnotatedType(member.getDeclaringClass());
+ AnnotatedMethod method = AnnotatedElementFactory.getInstance().newAnnotatedMethod(member, annotated);
List<AnnotatedParameter<?>> parameters = method.getParameters();
InjectionPoint point = null;
@@ -313,8 +313,8 @@ public class InjectionPointFactory
List<InjectionPoint> lists = new ArrayList<InjectionPoint>();
- AnnotatedType<Object> annotated = (AnnotatedType<Object>)AnnotatedElementFactory.newAnnotatedType(member.getDeclaringClass());
- AnnotatedConstructor constructor = AnnotatedElementFactory.newAnnotatedConstructor((Constructor<Object>)member,annotated);
+ AnnotatedType<Object> annotated = (AnnotatedType<Object>)AnnotatedElementFactory.getInstance().newAnnotatedType(member.getDeclaringClass());
+ AnnotatedConstructor constructor = AnnotatedElementFactory.getInstance().newAnnotatedConstructor((Constructor<Object>)member,annotated);
List<AnnotatedParameter<?>> parameters = constructor.getParameters();
InjectionPoint point = null;
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java Thu Jul 8 21:32:12 2010
@@ -179,6 +179,8 @@ class InjectionPointImpl implements Inje
{
Class<?> beanClass = (Class<?>)in.readObject();
Set<Annotation> anns = new HashSet<Annotation>();
+ AnnotatedElementFactory annotatedElementFactory = AnnotatedElementFactory.getInstance();
+
while(!in.readObject().equals(new Character('~')))
{
Class<? extends Annotation> ann = (Class<Annotation>) in.readObject();
@@ -196,8 +198,8 @@ class InjectionPointImpl implements Inje
this.injectionMember = field;
- AnnotatedType<?> annotated = AnnotatedElementFactory.newAnnotatedType(beanClass);
- this.annotated = AnnotatedElementFactory.newAnnotatedField(field, annotated);
+ AnnotatedType<?> annotated = annotatedElementFactory.newAnnotatedType(beanClass);
+ this.annotated = annotatedElementFactory.newAnnotatedField(field, annotated);
this.injectionType = field.getGenericType();
}
@@ -209,8 +211,8 @@ class InjectionPointImpl implements Inje
Method method = ClassUtil.getDeclaredMethod(beanClass, methodName, parameters);
this.injectionMember = method;
- AnnotatedType<?> annotated = AnnotatedElementFactory.newAnnotatedType(beanClass);
- AnnotatedMethod<Object> am = (AnnotatedMethod<Object>)AnnotatedElementFactory.
+ AnnotatedType<?> annotated = annotatedElementFactory.newAnnotatedType(beanClass);
+ AnnotatedMethod<Object> am = (AnnotatedMethod<Object>)annotatedElementFactory.
newAnnotatedMethod((Method)this.injectionMember ,annotated);
List<AnnotatedParameter<Object>> annParameters = am.getParameters();
@@ -223,8 +225,8 @@ class InjectionPointImpl implements Inje
Class<?>[] parameters = (Class<?>[])in.readObject();
this.injectionMember = ClassUtil.getConstructor(beanClass, parameters);
- AnnotatedType<Object> annotated = (AnnotatedType<Object>)AnnotatedElementFactory.newAnnotatedType(beanClass);
- AnnotatedConstructor<Object> am = (AnnotatedConstructor<Object>)AnnotatedElementFactory
+ AnnotatedType<Object> annotated = (AnnotatedType<Object>)annotatedElementFactory.newAnnotatedType(beanClass);
+ AnnotatedConstructor<Object> am = (AnnotatedConstructor<Object>)annotatedElementFactory
.newAnnotatedConstructor((Constructor<Object>)this.injectionMember,annotated);
List<AnnotatedParameter<Object>> annParameters = am.getParameters();
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=961950&r1=961949&r2=961950&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 Thu Jul 8 21:32:12 2010
@@ -160,7 +160,7 @@ public abstract class AbstractLifeCycle
JavassistProxyFactory.clear();
//Delete AnnotateTypeCache
- AnnotatedElementFactory.clear();
+ AnnotatedElementFactory.getInstance().clear();
//After Stop
afterStopApplication(endObject);
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java Thu Jul 8 21:32:12 2010
@@ -67,7 +67,7 @@ abstract class AbstractAnnotatedMember<X
if(declaringType == null)
{
- this.declaringType = (AnnotatedType<X>)AnnotatedElementFactory.newAnnotatedType(this.javaMember.getDeclaringClass());
+ this.declaringType = (AnnotatedType<X>)AnnotatedElementFactory.getInstance().newAnnotatedType(this.javaMember.getDeclaringClass());
AnnotatedTypeImpl<X> impl = (AnnotatedTypeImpl<X>)this.declaringType;
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java Thu Jul 8 21:32:12 2010
@@ -31,6 +31,7 @@ import javax.enterprise.inject.spi.Annot
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.SecurityUtil;
+import org.apache.webbeans.config.WebBeansFinder;
/**
* Factory for {@link javax.enterprise.inject.spi.Annotated} elements.
@@ -39,28 +40,34 @@ import org.apache.webbeans.util.Security
*/
public final class AnnotatedElementFactory
{
+
+ public static AnnotatedElementFactory getInstance()
+ {
+ AnnotatedElementFactory aef = (AnnotatedElementFactory) WebBeansFinder.getSingletonInstance(AnnotatedElementFactory.class.getName());
+ return aef;
+ }
+
//Cache of the AnnotatedType
- private static ConcurrentMap<Class<?>, AnnotatedType<?>> annotatedTypeCache =
+ private ConcurrentMap<Class<?>, AnnotatedType<?>> annotatedTypeCache =
new ConcurrentHashMap<Class<?>, AnnotatedType<?>>();
//Cache of AnnotatedConstructor
- private static ConcurrentMap<Constructor<?>, AnnotatedConstructor<?>> annotatedConstructorCache =
+ private ConcurrentMap<Constructor<?>, AnnotatedConstructor<?>> annotatedConstructorCache =
new ConcurrentHashMap<Constructor<?>, AnnotatedConstructor<?>>();
//Cache of AnnotatedMethod
- private static ConcurrentMap<Method, AnnotatedMethod<?>> annotatedMethodCache =
+ private ConcurrentMap<Method, AnnotatedMethod<?>> annotatedMethodCache =
new ConcurrentHashMap<Method, AnnotatedMethod<?>>();
//Cache of AnnotatedField
- private static ConcurrentMap<Field, AnnotatedField<?>> annotatedFieldCache =
+ private ConcurrentMap<Field, AnnotatedField<?>> annotatedFieldCache =
new ConcurrentHashMap<Field, AnnotatedField<?>>();
/**
* No instantiate.
*/
- private AnnotatedElementFactory()
+ public AnnotatedElementFactory()
{
- // Emtpty
}
/**
@@ -71,7 +78,7 @@ public final class AnnotatedElementFacto
* @return new annotated type
*/
@SuppressWarnings("unchecked")
- public static <X> AnnotatedType<X> newAnnotatedType(Class<X> annotatedClass)
+ public <X> AnnotatedType<X> newAnnotatedType(Class<X> annotatedClass)
{
Asserts.assertNotNull(annotatedClass, "annotatedClass is null");
AnnotatedTypeImpl<X> annotatedType = null;
@@ -122,7 +129,7 @@ public final class AnnotatedElementFacto
* @return new annotated constructor
*/
@SuppressWarnings("unchecked")
- public static <X> AnnotatedConstructor<X> newAnnotatedConstructor(Constructor<X> constructor, AnnotatedType<X> declaringClass)
+ public <X> AnnotatedConstructor<X> newAnnotatedConstructor(Constructor<X> constructor, AnnotatedType<X> declaringClass)
{
Asserts.assertNotNull(constructor, "constructor is null");
Asserts.assertNotNull(declaringClass, "declaringClass is null");
@@ -154,7 +161,7 @@ public final class AnnotatedElementFacto
* @return new annotated field
*/
@SuppressWarnings("unchecked")
- public static <X> AnnotatedField<X> newAnnotatedField(Field field, AnnotatedType<X> declaringClass)
+ public <X> AnnotatedField<X> newAnnotatedField(Field field, AnnotatedType<X> declaringClass)
{
Asserts.assertNotNull(field, "field is null");
Asserts.assertNotNull(declaringClass, "declaringClass is null");
@@ -186,7 +193,7 @@ public final class AnnotatedElementFacto
* @return new annotated method
*/
@SuppressWarnings("unchecked")
- public static <X> AnnotatedMethod<X> newAnnotatedMethod(Method method, AnnotatedType<X> declaringType)
+ public <X> AnnotatedMethod<X> newAnnotatedMethod(Method method, AnnotatedType<X> declaringType)
{
Asserts.assertNotNull(method, "method is null");
Asserts.assertNotNull(declaringType, "declaringType is null");
@@ -212,7 +219,7 @@ public final class AnnotatedElementFacto
/**
* Clear caches.
*/
- public static void clear()
+ public void clear()
{
annotatedTypeCache.clear();
annotatedConstructorCache.clear();
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java Thu Jul 8 21:32:12 2010
@@ -66,7 +66,7 @@ public class AfterBeanDiscoveryImpl impl
@SuppressWarnings("unchecked")
public void addBean(Bean<?> bean)
{
- AnnotatedType<?> annotatedType = AnnotatedElementFactory.newAnnotatedType(bean.getBeanClass());
+ AnnotatedType<?> annotatedType = AnnotatedElementFactory.getInstance().newAnnotatedType(bean.getBeanClass());
//Fire Event
ProcessBean<?> processBeanEvent = new GProcessBean(bean,annotatedType);
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=961950&r1=961949&r2=961950&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 Jul 8 21:32:12 2010
@@ -56,7 +56,7 @@ import org.apache.webbeans.logger.WebBea
/**
* Utility classes with respect to the class operations.
- *
+ *
* @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
* @since 1.0
*/
@@ -190,6 +190,7 @@ public final class ClassUtil
{
loader = WebBeansUtil.getCurrentClassLoader();
clazz = Class.forName(name, true , loader);
+ //X clazz = loader.loadClass(name);
return clazz;
}
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=961950&r1=961949&r2=961950&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 Thu Jul 8 21:32:12 2010
@@ -2541,7 +2541,7 @@ public final class WebBeansUtil
*/
public static <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
{
- AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(bean.getReturnType());
+ AnnotatedType<T> annotatedType = AnnotatedElementFactory.getInstance().newAnnotatedType(bean.getReturnType());
InjectionTargetProducer<T> injectionTarget = new InjectionTargetProducer<T>(bean);
GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,
annotatedType);
@@ -2560,7 +2560,7 @@ public final class WebBeansUtil
*/
public static <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
{
- AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(componentClass);
+ AnnotatedType<T> annotatedType = AnnotatedElementFactory.getInstance().newAnnotatedType(componentClass);
InjectionTarget<T> injectionTarget = BeanManagerImpl.getManager().createInjectionTarget(annotatedType);
GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,annotatedType);
@@ -2608,7 +2608,7 @@ public final class WebBeansUtil
GProcessProducerMethod processProducerMethodEvent = null;
if(disposal != null)
{
- disposalAnnotated = AnnotatedElementFactory.newAnnotatedMethod(disposal, annotatedType);
+ disposalAnnotated = AnnotatedElementFactory.getInstance().newAnnotatedMethod(disposal, annotatedType);
processProducerMethodEvent = new GProcessProducerMethod(bean,annotatedMethod,
disposalAnnotated.getParameters().get(0));
}
@@ -3000,7 +3000,7 @@ public final class WebBeansUtil
for(ProducerMethodBean<?> producerMethod : producerMethods)
{
- AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(),
+ AnnotatedMethod<?> method = AnnotatedElementFactory.getInstance().newAnnotatedMethod(producerMethod.getCreatorMethod(),
annotatedType);
ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForMethod(producerMethod,
method);
@@ -3018,7 +3018,7 @@ public final class WebBeansUtil
for(ProducerFieldBean<?> producerField : producerFields)
{
- AnnotatedField<?> field = AnnotatedElementFactory.newAnnotatedField(producerField.getCreatorField(),
+ AnnotatedField<?> field = AnnotatedElementFactory.getInstance().newAnnotatedField(producerField.getCreatorField(),
annotatedType);
ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForField(producerField,
field);
@@ -3037,7 +3037,7 @@ public final class WebBeansUtil
for(ObserverMethod<?> observerMethod : observerMethods)
{
ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
- AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(),
+ AnnotatedMethod<?> method = AnnotatedElementFactory.getInstance().newAnnotatedMethod(impl.getObserverMethod(),
annotatedType);
observerMethodsMap.put(observerMethod, method);
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=961950&r1=961949&r2=961950&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 Thu Jul 8 21:32:12 2010
@@ -326,7 +326,7 @@ public abstract class TestContext implem
getComponents().add((AbstractOwbBean<?>) bean);
manager.addBean(bean);
- GProcessAnnotatedType type = new GProcessAnnotatedType(AnnotatedElementFactory.newAnnotatedType(clazz));
+ GProcessAnnotatedType type = new GProcessAnnotatedType(AnnotatedElementFactory.getInstance().newAnnotatedType(clazz));
manager.fireEvent(type, new Annotation[0]);
}
Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java Thu Jul 8 21:32:12 2010
@@ -61,7 +61,7 @@ public class PortableTests extends TestC
@Test
public void testAnnotatedType()
{
- AnnotatedType<PortableType1> type = AnnotatedElementFactory.newAnnotatedType(PortableType1.class);
+ AnnotatedType<PortableType1> type = AnnotatedElementFactory.getInstance().newAnnotatedType(PortableType1.class);
Set<Annotation> annotations = type.getAnnotations();
Set<Class<? extends Annotation>> clazzesAnnots = new HashSet<Class<? extends Annotation>>();
Modified: openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java (original)
+++ openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java Thu Jul 8 21:32:12 2010
@@ -70,6 +70,6 @@ public abstract class EjbTestContext
{
EjbPlugin plugin = new EjbPlugin();
return (OpenEjbBean<T>)plugin.defineSessionBean(ejbClass,
- new GProcessAnnotatedType(AnnotatedElementFactory.newAnnotatedType(ejbClass)));
+ new GProcessAnnotatedType(AnnotatedElementFactory.getInstance().newAnnotatedType(ejbClass)));
}
}
Modified: openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java?rev=961950&r1=961949&r2=961950&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java (original)
+++ openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java Thu Jul 8 21:32:12 2010
@@ -57,7 +57,7 @@ public class SimpleBeanTest extends EjbT
Assert.assertTrue(value);
- GProcessAnnotatedType annotatedType = new GProcessAnnotatedType(AnnotatedElementFactory.newAnnotatedType(SimpleBean.class));
+ GProcessAnnotatedType annotatedType = new GProcessAnnotatedType(AnnotatedElementFactory.getInstance().newAnnotatedType(SimpleBean.class));
OpenEjbBean<SimpleBean> bean = (OpenEjbBean<SimpleBean>)plugin.defineSessionBean(SimpleBean.class, annotatedType);
Assert.assertNotNull(bean);