Author: dblevins
Date: Thu Jan 20 17:52:51 2011
New Revision: 1061418
URL: http://svn.apache.org/viewvc?rev=1061418&view=rev
Log:
Destatic InterceptorUtil and ManagedBeanConfigurator
OWB-503 status: 543 code uses
Total of 4572 static synchronized accesses and 4995 hashed calls in 340 tests
Average of 13 static synchronized accesses and 14 hashed calls per test
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.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/InterceptorHandler.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.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
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
Thu Jan 20 17:52:51 2011
@@ -24,7 +24,6 @@ import javax.enterprise.inject.spi.Annot
import org.apache.webbeans.component.ManagedBean;
import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.config.ManagedBeanConfigurator;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
import org.apache.webbeans.util.WebBeansUtil;
@@ -60,7 +59,7 @@ public class ManagedBeanCreatorImpl<T> e
{
if(isDefaultMetaDataProvider())
{
-
ManagedBeanConfigurator.checkManagedBeanCondition(getBean().getReturnType());
+
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(getBean().getReturnType());
}
else
{
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=1061418&r1=1061417&r2=1061418&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 Jan 20 17:52:51 2011
@@ -811,11 +811,11 @@ public class BeansDeployer
}
//Check for whether this class is candidate for Managed Bean
- if (ManagedBeanConfigurator.isManagedBean(clazz))
+ if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
{
//Check conditions
- ManagedBeanConfigurator.checkManagedBeanCondition(clazz);
-
+
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
+
//Temporary managed bean instance creationa
ManagedBean<T> managedBean = new
ManagedBean<T>(clazz,WebBeansType.MANAGED, webBeansContext);
ManagedBeanCreatorImpl<T> managedBeanCreator = new
ManagedBeanCreatorImpl<T>(managedBean);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Thu Jan 20 17:52:51 2011
@@ -32,7 +32,6 @@ import org.apache.webbeans.component.Pro
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.portable.creation.InjectionTargetProducer;
import org.apache.webbeans.portable.creation.ProducerBeansProducer;
import org.apache.webbeans.util.AnnotationUtil;
@@ -44,26 +43,20 @@ import org.apache.webbeans.util.WebBeans
* <p>
* Contains useful static methods for creating Simple WebBeans Components.
* </p>
- *
+ *
* @version $Rev$ $Date$
*/
public final class ManagedBeanConfigurator
{
- /**
- * Private constructor.
- */
- private ManagedBeanConfigurator()
- {
+ private final WebBeansContext webBeansContext;
+
+ public ManagedBeanConfigurator(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
}
- /**
- * Checks the implementation class for checking conditions.
- *
- * @param clazz implementation class
- * @throws WebBeansConfigurationException if any configuration exception
occurs
- */
- public static void checkManagedBeanCondition(Class<?> clazz) throws
WebBeansConfigurationException
+ public void checkManagedBeanCondition(Class<?> clazz) throws
WebBeansConfigurationException
{
int modifier = clazz.getModifiers();
@@ -75,27 +68,27 @@ public final class ManagedBeanConfigurat
if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
!AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
{
- InterceptorUtil.checkSimpleWebBeansInterceptorConditions(clazz);
+
webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
}
if (ClassUtil.isInterface(modifier))
{
- throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName() + " may not defined as interface");
+ throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName() + " may not _defined as interface");
}
}
/**
* Returns true if this class can be candidate for simple web bean, false
otherwise.
- *
+ *
* @param clazz implementation class
* @return true if this class can be candidate for simple web bean
* @throws WebBeansConfigurationException if any configuration exception
occurs
*/
- public static boolean isManagedBean(Class<?> clazz) throws
WebBeansConfigurationException
+ public boolean isManagedBean(Class<?> clazz) throws
WebBeansConfigurationException
{
try
{
-
WebBeansContext.getInstance().getWebBeansUtil().isManagedBeanClass(clazz);
+ webBeansContext.getWebBeansUtil().isManagedBeanClass(clazz);
}
catch (WebBeansConfigurationException e)
@@ -108,19 +101,34 @@ public final class ManagedBeanConfigurat
/**
* Returns the newly created Simple WebBean Component.
- *
+ *
* @param clazz Simple WebBean Component implementation class
* @return the newly created Simple WebBean Component
* @throws WebBeansConfigurationException if any configuration exception
occurs
* @deprecated
*/
@SuppressWarnings("unchecked")
- public static <T> ManagedBean<T> define(Class<T> clazz, WebBeansType type)
throws WebBeansConfigurationException
+ public <T> ManagedBean<T> define(Class<T> clazz, WebBeansType type) throws
WebBeansConfigurationException
{
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
- checkManagedBeanCondition(clazz);
+ int modifier = clazz.getModifiers();
+
+ if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
+ {
+ throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName()
+ + " may not annotated
with both @Interceptor and @Decorator annotation");
+ }
+
+ if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
!AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
+ {
+
webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
+ }
+
+ if (ClassUtil.isInterface(modifier))
+ {
+ throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName() + " may not _defined as interface");
+ }
ManagedBean<T> component = new ManagedBean<T>(clazz, type,
webBeansContext);
manager.putInjectionTargetWrapper(component, new
InjectionTargetWrapper(new InjectionTargetProducer(component)));
@@ -129,13 +137,13 @@ public final class ManagedBeanConfigurat
DefinitionUtil.defineSerializable(component);
DefinitionUtil.defineStereoTypes(component,
clazz.getDeclaredAnnotations());
-
+
Annotation[] clazzAnns = clazz.getDeclaredAnnotations();
DefinitionUtil.defineApiTypes(component, clazz);
DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean
Component implementation class : " + clazz.getName()
+ " stereotypes
must declare same @Scope annotations");
-
+
WebBeansUtil.checkGenericType(component);
DefinitionUtil.defineQualifiers(component, clazzAnns);
DefinitionUtil.defineName(component, clazzAnns,
WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
@@ -154,7 +162,7 @@ public final class ManagedBeanConfigurat
manager.addBean(producerMethod);
manager.putInjectionTargetWrapper(producerMethod, new
InjectionTargetWrapper(new ProducerBeansProducer(producerMethod)));
}
-
+
Set<ProducerFieldBean<?>> producerFields =
DefinitionUtil.defineProduerFields(component);
for (ProducerFieldBean<?> producerField : producerFields)
{
@@ -162,7 +170,7 @@ public final class ManagedBeanConfigurat
manager.addBean(producerField);
manager.putInjectionTargetWrapper(producerField, new
InjectionTargetWrapper(new ProducerBeansProducer(producerField)));
}
-
+
DefinitionUtil.defineDisposalMethods(component);
DefinitionUtil.defineInjectedFields(component);
@@ -170,5 +178,5 @@ public final class ManagedBeanConfigurat
DefinitionUtil.defineObserverMethods(component, clazz);
return component;
- }
+ }
}
\ No newline at end of file
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=1061418&r1=1061417&r2=1061418&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
Thu Jan 20 17:52:51 2011
@@ -39,6 +39,7 @@ import org.apache.webbeans.deployment.St
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.inject.AlternativesManager;
import org.apache.webbeans.inject.impl.InjectionPointFactory;
+import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.InterceptorsManager;
import org.apache.webbeans.jms.JMSManager;
import org.apache.webbeans.plugins.PluginLoader;
@@ -82,6 +83,8 @@ public class WebBeansContext
private XMLSpecializesManager xmlSpecializesManager = new
XMLSpecializesManager();
private ResolutionUtil resolutionUtil = new ResolutionUtil(this);
private InjectionPointFactory injectionPointFactory = new
InjectionPointFactory(this);
+ private InterceptorUtil interceptorUtil = new InterceptorUtil(this);
+ private ManagedBeanConfigurator managedBeanConfigurator = new
ManagedBeanConfigurator(this);
private final Map<Class<?>, Object> managerMap = new HashMap<Class<?>,
Object>();
@@ -164,6 +167,16 @@ public class WebBeansContext
return serviceInterface.cast(get(implName));
}
+ public ManagedBeanConfigurator getManagedBeanConfigurator()
+ {
+ return managedBeanConfigurator;
+ }
+
+ public InterceptorUtil getInterceptorUtil()
+ {
+ return interceptorUtil;
+ }
+
public InjectionPointFactory getInjectionPointFactory()
{
return injectionPointFactory;
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
Thu Jan 20 17:52:51 2011
@@ -204,7 +204,7 @@ public abstract class InterceptorHandler
InterceptorDataImpl decoratorInterceptorDataImpl = null;
//Check method is business method
- if (InterceptorUtil.isWebBeansBusinessMethod(method))
+ if
(webBeansContext.getInterceptorUtil().isWebBeansBusinessMethod(method))
{
List<Object> decorators = null;
if (injectionTarget.getDecoratorStack().size() > 0)
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Thu Jan 20 17:52:51 2011
@@ -57,20 +57,27 @@ import org.apache.webbeans.util.Security
public final class InterceptorUtil
{
- static OpenWebBeansEjbLCAPlugin ejbPlugin = null;
- static Class<? extends Annotation> prePassivateClass = null;
- static Class<? extends Annotation> postActivateClass = null;
-
private static final WebBeansLogger logger =
WebBeansLogger.getLogger(InterceptorUtil.class);
+ private final OpenWebBeansEjbLCAPlugin ejbPlugin;
+ private final Class<? extends Annotation> prePassivateClass;
+ private final Class<? extends Annotation> postActivateClass;
+
+ private final WebBeansContext webBeansContext;
- private InterceptorUtil()
+ public InterceptorUtil(WebBeansContext webBeansContext)
{
- ejbPlugin =
WebBeansContext.getInstance().getPluginLoader().getEjbLCAPlugin();
- if(ejbPlugin != null)
+ this.webBeansContext = webBeansContext;
+ this.ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
+ if (ejbPlugin != null)
+ {
+ prePassivateClass = ejbPlugin.getPrePassivateClass();
+ postActivateClass = ejbPlugin.getPostActivateClass();
+ }
+ else
{
- prePassivateClass = ejbPlugin.getPrePassivateClass();
- postActivateClass = ejbPlugin.getPostActivateClass();
+ prePassivateClass = null;
+ postActivateClass = null;
}
}
@@ -80,7 +87,7 @@ public final class InterceptorUtil
* @param method
* @return <code>true</code> if the given method is an interceptable
business method
*/
- public static boolean isWebBeansBusinessMethod(Method method)
+ public boolean isWebBeansBusinessMethod(Method method)
{
Asserts.nullCheckForMethod(method);
@@ -113,7 +120,7 @@ public final class InterceptorUtil
return true;
}
- public static Class<? extends Annotation>
getInterceptorAnnotationClazz(InterceptionType type)
+ public Class<? extends Annotation>
getInterceptorAnnotationClazz(InterceptionType type)
{
if (type.equals(InterceptionType.AROUND_INVOKE))
{
@@ -217,7 +224,7 @@ public final class InterceptorUtil
return false;
}
- public static boolean isLifecycleMethodInterceptor(Class<?> clazz)
+ public boolean isLifecycleMethodInterceptor(Class<?> clazz)
{
Asserts.nullCheckForClass(clazz);
Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
@@ -253,7 +260,7 @@ public final class InterceptorUtil
}
@SuppressWarnings("unchecked")
- public static <T> boolean isLifecycleMethodInterceptor(AnnotatedType<T>
annotatedType)
+ public <T> boolean isLifecycleMethodInterceptor(AnnotatedType<T>
annotatedType)
{
Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
for(AnnotatedMethod<? super T> methodA : methods)
@@ -295,7 +302,7 @@ public final class InterceptorUtil
}
- public static <T> void
checkAnnotatedTypeInterceptorConditions(AnnotatedType<T> annotatedType)
+ public <T> void checkAnnotatedTypeInterceptorConditions(AnnotatedType<T>
annotatedType)
{
Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
for(AnnotatedMethod<? super T> methodA : methods)
@@ -310,7 +317,7 @@ public final class InterceptorUtil
}
Annotation[] anns = annotatedType.getAnnotations().toArray(new
Annotation[0]);
- if
(!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns))
+ if
(!webBeansContext.getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns))
{
throw new WebBeansConfigurationException("Interceptor class : " +
annotatedType.getJavaClass().getName()
+ " must have at least
one @InterceptorBinding annotation");
@@ -321,7 +328,7 @@ public final class InterceptorUtil
}
- public static void checkInterceptorConditions(Class<?> clazz)
+ public void checkInterceptorConditions(Class<?> clazz)
{
Asserts.nullCheckForClass(clazz);
@@ -335,7 +342,7 @@ public final class InterceptorUtil
}
}
- if
(!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(
+ if
(!webBeansContext.getAnnotationManager().hasInterceptorBindingMetaAnnotation(
clazz.getDeclaredAnnotations()))
{
throw new WebBeansConfigurationException("WebBeans Interceptor
class : " + clazz.getName()
@@ -346,14 +353,13 @@ public final class InterceptorUtil
+ "
interceptor binding type must be defined as @Target{TYPE}");
}
- public static <T> void checkLifecycleConditions(Class<T> clazz,
Annotation[] annots, String errorMessage)
+ public <T> void checkLifecycleConditions(Class<T> clazz, Annotation[]
annots, String errorMessage)
{
Asserts.nullCheckForClass(clazz);
if (isLifecycleMethodInterceptor(clazz) &&
!isBusinessMethodInterceptor(clazz))
{
- Annotation[] anns =
-
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
+ Annotation[] anns =
webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
for (Annotation annotation : anns)
{
@@ -369,12 +375,11 @@ public final class InterceptorUtil
}
- public static <T> void checkLifecycleConditions(AnnotatedType<T>
annotatedType, Annotation[] annots, String errorMessage)
+ public <T> void checkLifecycleConditions(AnnotatedType<T> annotatedType,
Annotation[] annots, String errorMessage)
{
if (isLifecycleMethodInterceptor(annotatedType) &&
!isBusinessMethodInterceptor(annotatedType))
{
- Annotation[] anns =
-
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
+ Annotation[] anns =
webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
for (Annotation annotation : anns)
{
@@ -391,13 +396,13 @@ public final class InterceptorUtil
}
- public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
+ public void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
{
Asserts.nullCheckForClass(clazz);
Annotation[] anns = clazz.getDeclaredAnnotations();
boolean hasClassInterceptors = false;
- AnnotationManager annotationManager =
WebBeansContext.getInstance().getAnnotationManager();
+ AnnotationManager annotationManager =
webBeansContext.getAnnotationManager();
if
(annotationManager.getInterceptorBindingMetaAnnotations(anns).length > 0)
{
hasClassInterceptors = true;
@@ -595,7 +600,6 @@ public final class InterceptorUtil
* Filter bean interceptor stack.
* @param stack interceptor stack
* @param method called method on proxy
- * @param ownerCreationalContext bean creational context
*/
public static void filterCommonInterceptorStackList(List<InterceptorData>
stack, Method method)
{
@@ -665,7 +669,7 @@ public final class InterceptorUtil
* Remove bean inherited and overriden lifecycle interceptor method from
its
* stack list.
*
- * @param clazz bean class
+ * @param beanClass bean class
* @param stack bean interceptor stack
*/
public static void filterOverridenLifecycleInterceptor(Class<?> beanClass,
List<InterceptorData> stack)
@@ -698,7 +702,7 @@ public final class InterceptorUtil
* invoked. Remove bean inherited but overriden around invoke interceptor
* method from its stack list.
*
- * @param clazz bean class
+ * @param beanClass bean class
* @param stack bean interceptor stack
*/
public static void filterOverridenAroundInvokeInterceptor(Class<?>
beanClass, List<InterceptorData> stack)
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
Thu Jan 20 17:52:51 2011
@@ -28,7 +28,6 @@ import org.apache.webbeans.exception.Web
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.inject.InjectableField;
import org.apache.webbeans.inject.InjectableMethods;
-import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.OwbInterceptor;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.util.AnnotationUtil;
@@ -277,7 +276,8 @@ public class WebBeansInterceptor<T> exte
else
{
- Class<? extends Annotation> interceptorTypeAnnotationClazz =
InterceptorUtil.getInterceptorAnnotationClazz(type);
+ Class<? extends Annotation> interceptorTypeAnnotationClazz =
+
webBeansContext.getInterceptorUtil().getInterceptorAnnotationClazz(type);
method =
getWebBeansContext().getWebBeansUtil().checkCommonAnnotationCriterias(getClazz(),
interceptorTypeAnnotationClazz,
true);
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=1061418&r1=1061417&r2=1061418&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 Jan 20 17:52:51 2011
@@ -124,7 +124,6 @@ import org.apache.webbeans.component.cre
import org.apache.webbeans.component.creation.ManagedBeanCreatorImpl;
import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.EJBWebBeansConfigurator;
-import org.apache.webbeans.config.ManagedBeanConfigurator;
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.config.WebBeansContext;
@@ -145,7 +144,6 @@ import org.apache.webbeans.inject.Altern
import org.apache.webbeans.intercept.InterceptorData;
import org.apache.webbeans.intercept.InterceptorDataImpl;
import org.apache.webbeans.intercept.InterceptorType;
-import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
@@ -645,7 +643,7 @@ public final class WebBeansUtil
NewBean<T> comp = null;
- if (ManagedBeanConfigurator.isManagedBean(clazz))
+ if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
{
comp = new NewBean<T>(clazz, WebBeansType.MANAGED,
webBeansContext);
comp.setImplScopeType(new DependentScopeLiteral());
@@ -2126,7 +2124,7 @@ public final class WebBeansUtil
{
ManagedBean<T> component = null;
- InterceptorUtil.checkInterceptorConditions(clazz);
+
webBeansContext.getInterceptorUtil().checkInterceptorConditions(clazz);
component = defineManagedBean(managedBeanCreator,
injectionTargetEvent);
if (component != null)
@@ -3201,7 +3199,7 @@ public final class WebBeansUtil
{
ManagedBean<T> delegate = null;
-
InterceptorUtil.checkAnnotatedTypeInterceptorConditions(annotatedType);
+
webBeansContext.getInterceptorUtil().checkAnnotatedTypeInterceptorConditions(annotatedType);
delegate = defineManagedBean(annotatedType);
if (delegate != null)
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=1061418&r1=1061417&r2=1061418&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
Thu Jan 20 17:52:51 2011
@@ -53,7 +53,6 @@ import org.apache.webbeans.component.Abs
import org.apache.webbeans.component.xml.XMLManagedBean;
import org.apache.webbeans.component.xml.XMLProducerBean;
import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.config.ManagedBeanConfigurator;
import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.WebBeansContext;
@@ -744,7 +743,8 @@ public final class WebBeansXMLConfigurat
boolean ok = false;
/* Enterprise WebBean */
- OpenWebBeansEjbPlugin plugin =
WebBeansContext.getInstance().getPluginLoader().getEjbPlugin();
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ OpenWebBeansEjbPlugin plugin =
webBeansContext.getPluginLoader().getEjbPlugin();
if (plugin != null && plugin.isSessionBean(clazz))
{
// Configure for EJB
@@ -754,7 +754,7 @@ public final class WebBeansXMLConfigurat
else
{
/* Simple WebBeans */
- if (ManagedBeanConfigurator.isManagedBean(clazz))
+ if
(webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
{
// Configure Simple WebBean
configureSimpleWebBean(clazz, webBeanElement);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
Thu Jan 20 17:52:51 2011
@@ -55,7 +55,6 @@ import org.apache.webbeans.exception.def
import org.apache.webbeans.inject.xml.XMLInjectionModelType;
import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
import org.apache.webbeans.intercept.InterceptorData;
-import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
import org.apache.webbeans.proxy.JavassistProxyFactory;
@@ -385,6 +384,8 @@ public final class XMLDefinitionUtil
public static <T> void defineXMLInterceptors(XMLManagedBean<T> component,
List<Class<? extends Annotation>> annotationSet,
List<Element>
annotationElementList, String errorMessage)
{
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+
Iterator<Class<? extends Annotation>> it = annotationSet.iterator();
boolean found = false;
@@ -405,7 +406,7 @@ public final class XMLDefinitionUtil
found = true;
}
}
- else if (AnnotationUtil.isInterceptorBindingAnnotation(temp))
+ else if
(webBeansContext.getAnnotationManager().isInterceptorBindingAnnotation(temp))
{
Element annotationElement = annotationElementList.get(i);
Annotation bindingAnnotation =
XMLUtil.getXMLDefinedAnnotationMember(annotationElement, temp, errorMessage);
@@ -423,7 +424,8 @@ public final class XMLDefinitionUtil
Annotation[] anns = new Annotation[interceptorBindingTypes.size()];
anns = interceptorBindingTypes.toArray(anns);
- InterceptorUtil.checkLifecycleConditions(component.getReturnType(),
anns, errorMessage + "Lifecycle interceptor : "
+
webBeansContext.getInterceptorUtil().checkLifecycleConditions(component.getReturnType(),
anns,
+
errorMessage + "Lifecycle interceptor : "
+ component.getReturnType().getName() +
" interceptor binding type must be defined as @Target{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=1061418&r1=1061417&r2=1061418&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 Jan 20 17:52:51 2011
@@ -42,13 +42,11 @@ import org.apache.webbeans.component.Man
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.component.xml.XMLManagedBean;
import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.config.ManagedBeanConfigurator;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.context.DependentContext;
import org.apache.webbeans.decorator.DecoratorUtil;
import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
import org.apache.webbeans.deployment.StereoTypeModel;
-import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.newtests.AbstractUnitTest;
@@ -309,7 +307,8 @@ public abstract class TestContext implem
{
ManagedBean<T> bean = null;
- bean = ManagedBeanConfigurator.define(clazz, WebBeansType.MANAGED);
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ bean = webBeansContext.getManagedBeanConfigurator().define(clazz,
WebBeansType.MANAGED);
if (bean != null)
{
manager.addBean(WebBeansUtil.createNewBean(bean));
@@ -320,7 +319,7 @@ public abstract class TestContext implem
getComponents().add((AbstractOwbBean<?>) bean);
manager.addBean(bean);
- GProcessAnnotatedType type = new
GProcessAnnotatedType(WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(clazz));
+ GProcessAnnotatedType type = new
GProcessAnnotatedType(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
manager.fireEvent(type, new Annotation[0]);
}
@@ -421,13 +420,14 @@ public abstract class TestContext implem
{
ManagedBean<T> component = null;
- ManagedBeanConfigurator.checkManagedBeanCondition(clazz);
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
-
WebBeansContext.getInstance().getInterceptorsManager().addNewInterceptor(clazz);
- InterceptorUtil.checkInterceptorConditions(clazz);
- component = ManagedBeanConfigurator.define(clazz,
WebBeansType.INTERCEPTOR);
+ webBeansContext.getInterceptorsManager().addNewInterceptor(clazz);
+ webBeansContext.getInterceptorUtil().checkInterceptorConditions(clazz);
+ component = webBeansContext.getManagedBeanConfigurator().define(clazz,
WebBeansType.INTERCEPTOR);
WebBeansInterceptorConfig.configureInterceptorClass((ManagedBean<Object>)
component,
-
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(
+
webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(
clazz.getDeclaredAnnotations()));
@@ -445,10 +445,11 @@ public abstract class TestContext implem
{
ManagedBean<T> component = null;
- if
(WebBeansContext.getInstance().getDecoratorsManager().isDecoratorEnabled(clazz))
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ if (webBeansContext.getDecoratorsManager().isDecoratorEnabled(clazz))
{
DecoratorUtil.checkDecoratorConditions(clazz);
- component = ManagedBeanConfigurator.define(clazz,
WebBeansType.DECORATOR);
+ component =
webBeansContext.getManagedBeanConfigurator().define(clazz,
WebBeansType.DECORATOR);
if (component != null)
{
Modified:
openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java?rev=1061418&r1=1061417&r2=1061418&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
(original)
+++
openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
Thu Jan 20 17:52:51 2011
@@ -32,7 +32,7 @@ import org.apache.webbeans.component.Inj
import org.apache.webbeans.component.ManagedBean;
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.config.ManagedBeanConfigurator;
+import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.util.AnnotationUtil;
import org.jboss.jsr299.tck.spi.Beans;
@@ -48,11 +48,10 @@ public class BeansImpl implements Beans
public <T> Bean<T> createSimpleBean(Class<T> clazz)
{
- ManagedBean<T> bean = null;
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
- ManagedBeanConfigurator.checkManagedBeanCondition(clazz);
-
- bean = ManagedBeanConfigurator.define(clazz, WebBeansType.MANAGED);
+ ManagedBean<T> bean =
webBeansContext.getManagedBeanConfigurator().define(clazz,
WebBeansType.MANAGED);
return bean;
}