Author: struberg
Date: Thu Jan 10 09:05:51 2013
New Revision: 1431214
URL: http://svn.apache.org/viewvc?rev=1431214&view=rev
Log:
OWB-344 start working on a CdiInterceptorBeanBuilder
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java?rev=1431214&r1=1431213&r2=1431214&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
Thu Jan 10 09:05:51 2013
@@ -19,7 +19,6 @@
package org.apache.webbeans.component;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InterceptionType;
import java.lang.annotation.Annotation;
import java.util.Set;
@@ -35,25 +34,23 @@ public class CdiInterceptorBean<T> exten
{
/**
*
- * @param returnType the return Type of the Bean
* @param annotatedType AnnotatedType will be returned by some methods in
the SPI
* @param webBeansContext
- * @param interceptorBindings the @{@link
javax.interceptor.InterceptorBinding} annotations handled by this Interceptor
- * @param intercepts the InterceptionTypes this Bean handles on the
intercepted target
*/
- public CdiInterceptorBean(Class<T> returnType, AnnotatedType<T>
annotatedType,
- WebBeansContext webBeansContext,
- Set<Annotation> interceptorBindings,
- Set<InterceptionType> intercepts)
+ public CdiInterceptorBean(WebBeansContext webBeansContext,
AnnotatedType<T> annotatedType)
{
- super(returnType, annotatedType, webBeansContext, intercepts);
- this.interceptorBindings = interceptorBindings;
+ super(webBeansContext, annotatedType);
}
private Set<Annotation> interceptorBindings;
+ public void setInterceptorBindings(Set<Annotation> interceptorBindings)
+ {
+ this.interceptorBindings = interceptorBindings;
+ }
+
@Override
public Set<Annotation> getInterceptorBindings()
{
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java?rev=1431214&r1=1431213&r2=1431214&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
Thu Jan 10 09:05:51 2013
@@ -19,7 +19,6 @@
package org.apache.webbeans.component;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
import java.lang.annotation.Annotation;
import java.util.Collections;
@@ -36,16 +35,13 @@ public class EjbInterceptorBean<T> exten
{
/**
*
- * @param returnType the return Type of the Bean. This is also the class
of the Interceptor
* @param annotatedType AnnotatedType will be returned by some methods in
the SPI
* @param webBeansContext
- * @param intercepts the InterceptionTypes this Bean handles on the
intercepted target
*/
- public EjbInterceptorBean(Class<T> returnType, AnnotatedType<T>
annotatedType,
- WebBeansContext webBeansContext,
- Set<InterceptionType> intercepts)
+ public EjbInterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotatedType)
{
- super(returnType, annotatedType, webBeansContext, intercepts);
+ super(webBeansContext, annotatedType);
}
/**
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java?rev=1431214&r1=1431213&r2=1431214&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
Thu Jan 10 09:05:51 2013
@@ -43,23 +43,16 @@ public abstract class InterceptorBean<T>
{
/**
*
- * @param returnType the return Type of the Bean
* @param annotatedType AnnotatedType will be returned by some methods in
the SPI
* @param webBeansContext
- * @param intercepts the InterceptionTypes this Bean handles on the
intercepted target
*/
- public InterceptorBean(Class<T> returnType, AnnotatedType<T> annotatedType,
- WebBeansContext webBeansContext,
- Set<InterceptionType> intercepts)
+ public InterceptorBean(WebBeansContext webBeansContext, AnnotatedType<T>
annotatedType)
{
- super(WebBeansType.INTERCEPTOR, returnType, annotatedType,
webBeansContext);
+ super(WebBeansType.INTERCEPTOR, annotatedType.getJavaClass(),
annotatedType, webBeansContext);
Asserts.assertNotNull(intercepts, "Interceptor does not handle any
InterceptionTypes!");
- this.intercepts = intercepts;
}
-
-
private Set<InterceptionType> intercepts;
/**
@@ -207,13 +200,13 @@ public abstract class InterceptorBean<T>
}
if (interceptorMethods.length == 1)
{
- // directly invoke the InvocationContext
+ // directly invoke the interceptor method with the given
InvocationContext
return interceptorMethods[0].invoke(instance,
invocationContext);
}
else
{
- // otherwise we need to wrap it for handling multiple
interceptor methods
-
+ // otherwise we need to wrap the InvocationContext into an own
temporary InvocationContext
+ // which handles multiple interceptor methods at a time
if (invocationContext instanceof MultiMethodInvocationContext)
{
// this happens while we recurse through the interceptors
which have multiple interceptor-methods
@@ -236,9 +229,7 @@ public abstract class InterceptorBean<T>
= new
MultiMethodInvocationContext(invocationContext, interceptionType, instance,
this);
return mmInvocationContext.proceed();
}
-
}
-
}
catch (Exception e)
{
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java?rev=1431214&r1=1431213&r2=1431214&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
Thu Jan 10 09:05:51 2013
@@ -19,7 +19,6 @@
package org.apache.webbeans.component;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
import java.lang.annotation.Annotation;
import java.util.Collections;
@@ -38,16 +37,12 @@ public class SelfInterceptorBean<T> exte
{
/**
*
- * @param returnType the return Type of the Bean. This is also the class
of the Interceptor
* @param annotatedType AnnotatedType will be returned by some methods in
the SPI
* @param webBeansContext
- * @param intercepts the InterceptionTypes this Bean handles on the
intercepted target
*/
- public SelfInterceptorBean(Class<T> returnType, AnnotatedType<T>
annotatedType,
- WebBeansContext webBeansContext,
- Set<InterceptionType> intercepts)
+ public SelfInterceptorBean(WebBeansContext webBeansContext,
AnnotatedType<T> annotatedType)
{
- super(returnType, annotatedType, webBeansContext, intercepts);
+ super(webBeansContext, annotatedType);
}
/**
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java?rev=1431214&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
Thu Jan 10 09:05:51 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component.creation;
+
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.CdiInterceptorBean;
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public abstract class CdiInterceptorBeanBuilder<T> extends
InterceptorBeanBuilder<T>
+{
+ protected CdiInterceptorBeanBuilder(WebBeansContext webBeansContext,
AnnotatedType<T> annotatedType)
+ {
+ super(new CdiInterceptorBean<T>(webBeansContext, annotatedType));
+ }
+
+
+}
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java?rev=1431214&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
Thu Jan 10 09:05:51 2013
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component.creation;
+
+import javax.enterprise.context.Dependent;
+
+import org.apache.webbeans.component.InterceptorBean;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public abstract class InterceptorBeanBuilder<T> extends
AbstractInjectionTargetBeanBuilder<T>
+{
+ protected InterceptorBeanBuilder(InterceptorBean<T> bean)
+ {
+ super(bean, Dependent.class);
+ }
+
+
+}
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=1431214&r1=1431213&r2=1431214&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 10 09:05:51 2013
@@ -61,7 +61,8 @@ import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.WebBeansUtil;
/**
- * Implementation of the {@link ManagedBeanCreator}.
+ * Bean builder for <i>Managed Beans</i>. A <i>ManagedBean</i> is a class
+ * which gets scanned and picked up as {@link
javax.enterprise.inject.spi.Bean}.
*
* @version $Rev$ $Date$
*