You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/01/01 22:15:45 UTC
svn commit: r730609 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
component/ config/ decorator/ intercept/ intercept/webbeans/ jsf/ util/
Author: gerdogdu
Date: Thu Jan 1 13:15:44 2009
New Revision: 730609
URL: http://svn.apache.org/viewvc?rev=730609&view=rev
Log:
Arranging and testing for M1 Release.
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java Thu Jan 1 13:15:44 2009
@@ -26,7 +26,6 @@
import javax.webbeans.Decorates;
import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.ejb.EJBUtil;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.inject.InjectableConstructor;
import org.apache.webbeans.inject.InjectableField;
@@ -105,29 +104,25 @@
injectFields(instance);
injectMethods(instance);
- //TODO Initial Values Set Defined in the XML
-
if(getWebBeansType().equals(WebBeansType.SIMPLE))
{
+ DefinitionUtil.defineSimpleWebBeanInterceptorStack(this);
DefinitionUtil.defineWebBeanDecoratorStack(this, instance);
}
- if(!EJBUtil.isEJBClass(getReturnType()))
- {
- if(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.POST_CONSTRUCT))
+ if(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.POST_CONSTRUCT))
+ {
+ InvocationContextImpl impl = new InvocationContextImpl(instance,null,null,WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.POST_CONSTRUCT),InterceptorType.POST_CONSTRUCT);
+ try
{
- InvocationContextImpl impl = new InvocationContextImpl(instance,null,null,WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.POST_CONSTRUCT),InterceptorType.POST_CONSTRUCT);
- try
- {
- impl.proceed();
-
- }catch(Exception e)
- {
- throw new WebBeansException(e);
- }
- }
-
+ impl.proceed();
+
+ }catch(Exception e)
+ {
+ throw new WebBeansException(e);
+ }
}
+
}
/*
@@ -174,20 +169,16 @@
@Override
protected void destroyInstance(T instance)
{
- if(!EJBUtil.isEJBClass(getReturnType()))
+ if(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.PRE_DESTROY))
{
- if(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.PRE_DESTROY))
+ InvocationContextImpl impl = new InvocationContextImpl(instance,null,null,WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.PRE_DESTROY),InterceptorType.PRE_DESTROY);
+ try
{
- InvocationContextImpl impl = new InvocationContextImpl(instance,null,null,WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.PRE_DESTROY),InterceptorType.PRE_DESTROY);
- try
- {
- impl.proceed();
-
- }catch(Exception e)
- {
- throw new WebBeansException(e);
- }
+ impl.proceed();
+ }catch(Exception e)
+ {
+ throw new WebBeansException(e);
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Thu Jan 1 13:15:44 2009
@@ -345,7 +345,9 @@
if(component != null)
{
DecoratorUtil.checkSimpleWebBeanDecoratorConditions(component);
- DefinitionUtil.defineSimpleWebBeanInterceptorStack(component);
+
+ /*I have added this into the ComponentImpl.afterCreate();*/
+ //DefinitionUtil.defineSimpleWebBeanInterceptorStack(component);
ManagerImpl.getManager().addBean(component);
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Thu Jan 1 13:15:44 2009
@@ -33,6 +33,7 @@
import org.apache.webbeans.inject.InjectableField;
import org.apache.webbeans.inject.InjectableMethods;
import org.apache.webbeans.logger.WebBeansLogger;
+import org.apache.webbeans.proxy.JavassistProxyFactory;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.ClassUtil;
@@ -183,8 +184,13 @@
@Override
public Object create()
{
- Object proxy = ManagerImpl.getManager().getInstance(this);
-
+ Object proxy = JavassistProxyFactory.createNewProxyInstance(this);
+
+ return proxy;
+ }
+
+ public void setInjections(Object proxy)
+ {
//Set injected fields
ComponentImpl<Object> delegate = (ComponentImpl<Object>)this.delegateComponent;
@@ -207,9 +213,6 @@
InjectableMethods<?> ife = new InjectableMethods(injectedMethod,proxy,this.delegateComponent);
ife.doInjection();
}
-
-
- return proxy;
}
@Override
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java Thu Jan 1 13:15:44 2009
@@ -78,7 +78,9 @@
{
WebBeansDecorator decorator = (WebBeansDecorator)itList.next();
- Object decoratorInstance = decorator.create();
+ Object decoratorInstance = ManagerImpl.getManager().getInstance(decorator);
+
+ decorator.setInjections(decoratorInstance);
decorator.setDelegate(decoratorInstance, instance);
component.getDecoratorStack().add(decoratorInstance);
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Thu Jan 1 13:15:44 2009
@@ -90,6 +90,11 @@
}
+ if(!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+
return method.invoke(webbeansInstance, arguments);
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Thu Jan 1 13:15:44 2009
@@ -146,6 +146,11 @@
Method method = intc.getAroundInvoke();
+ if(!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+
Object t = intc.getInterceptorInstance();
if(t == null)
{
@@ -184,6 +189,10 @@
method = intc.getPreDestroy();
}
+ if(!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
currentMethod++;
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Thu Jan 1 13:15:44 2009
@@ -1,22 +1,20 @@
/*
- * 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.
+ * 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.intercept.webbeans;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
@@ -31,22 +29,26 @@
import javax.webbeans.manager.Interceptor;
import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.ComponentImpl;
import org.apache.webbeans.container.ManagerImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.inject.InjectableField;
+import org.apache.webbeans.inject.InjectableMethods;
import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
+import org.apache.webbeans.proxy.JavassistProxyFactory;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.WebBeansUtil;
import org.apache.webbeans.xml.XMLAnnotationTypeManager;
/**
* Defines the webbeans specific interceptors.
- *
* <p>
- * WebBeans interceotor classes has at least one {@link InterceptorBindingType} annotation.
- * It can be defined on the class or method level at the component. WebBeans interceptors are
- * called after the EJB related interceptors are called in the chain. Semantics of the interceptors
- * are specified by the EJB specificatin.
+ * WebBeans interceotor classes has at least one {@link InterceptorBindingType}
+ * annotation. It can be defined on the class or method level at the component.
+ * WebBeans interceptors are called after the EJB related interceptors are
+ * called in the chain. Semantics of the interceptors are specified by the EJB
+ * specificatin.
* </p>
*
* @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
@@ -54,29 +56,28 @@
*/
public class WebBeansInterceptor extends Interceptor
{
- /**InterceptorBindingTypes exist on the interceptor class*/
- private Map<Class<? extends Annotation>, Annotation> interceptorBindingSet = new HashMap<Class<? extends Annotation>,Annotation>();
-
- /**Interceptor class*/
- private Class<?> clazz;
-
- /**Simple Web Beans component*/
+ /** InterceptorBindingTypes exist on the interceptor class */
+ private Map<Class<? extends Annotation>, Annotation> interceptorBindingSet = new HashMap<Class<? extends Annotation>, Annotation>();
+
+ /** Interceptor class */
+ private Class<?> clazz;
+
+ /** Simple Web Beans component */
private AbstractComponent<Object> delegateComponent;
-
+
public WebBeansInterceptor(AbstractComponent<Object> delegateComponent)
{
super(ManagerImpl.getManager());
this.delegateComponent = delegateComponent;
- this.clazz = getDelegate().getReturnType();
-
+ this.clazz = getDelegate().getReturnType();
+
}
-
-
+
public AbstractComponent<Object> getDelegate()
{
return this.delegateComponent;
}
-
+
/**
* Add new binding type to the interceptor.
*
@@ -86,27 +87,25 @@
public void addInterceptorBindingType(Class<? extends Annotation> bindingType, Annotation annot)
{
Method[] methods = bindingType.getDeclaredMethods();
-
- for(Method method : methods)
+
+ for (Method method : methods)
{
Class<?> clazz = method.getReturnType();
- if(clazz.isArray() || clazz.isAnnotation())
+ if (clazz.isArray() || clazz.isAnnotation())
{
- if(!AnnotationUtil.isAnnotationExist(method.getAnnotations(), NonBinding.class))
+ if (!AnnotationUtil.isAnnotationExist(method.getAnnotations(), NonBinding.class))
{
- throw new WebBeansConfigurationException("Interceptor definition class : " + getClazz().getName() +
- " @InterceptorBindingType : " + bindingType.getName() + " must have @NonBinding valued members for its array-valued and annotation valued members");
+ throw new WebBeansConfigurationException("Interceptor definition class : " + getClazz().getName() + " @InterceptorBindingType : " + bindingType.getName() + " must have @NonBinding valued members for its array-valued and annotation valued members");
}
}
}
-
- interceptorBindingSet.put(bindingType,annot);
+
+ interceptorBindingSet.put(bindingType, annot);
}
-
-
+
/**
- * Checks whether this interceptor has given binding types with {@link NonBinding} member
- * values.
+ * Checks whether this interceptor has given binding types with
+ * {@link NonBinding} member values.
*
* @param bindingTypes binding types
* @param annots binding types annots.
@@ -115,38 +114,34 @@
public boolean isBindingTypesExist(List<Class<? extends Annotation>> bindingTypes, List<Annotation> annots)
{
boolean result = false;
-
-
- if(bindingTypes != null && annots != null && (bindingTypes.size() == annots.size()))
+
+ if (bindingTypes != null && annots != null && (bindingTypes.size() == annots.size()))
{
int i = 0;
- for(Class<? extends Annotation> bindingType : bindingTypes)
+ for (Class<? extends Annotation> bindingType : bindingTypes)
{
- if(this.interceptorBindingSet.containsKey(bindingType))
+ if (this.interceptorBindingSet.containsKey(bindingType))
{
Annotation target = this.interceptorBindingSet.get(bindingType);
- if(AnnotationUtil.isAnnotationMemberExist(bindingType, annots.get(i), target))
+ if (AnnotationUtil.isAnnotationMemberExist(bindingType, annots.get(i), target))
{
result = true;
- }
- else
+ } else
{
return false;
}
- }
- else
+ } else
{
return false;
}
-
+
i++;
}
}
-
+
return result;
}
-
/**
* Gets the interceptor class.
*
@@ -160,65 +155,56 @@
public Set<Interceptor> getMetaInceptors()
{
Set<Interceptor> set = new HashSet<Interceptor>();
-
+
Set<Class<? extends Annotation>> keys = interceptorBindingSet.keySet();
Iterator<Class<? extends Annotation>> it = keys.iterator();
-
- while(it.hasNext())
+
+ while (it.hasNext())
{
Class<? extends Annotation> clazzAnnot = it.next();
- Set<Annotation> declared = null;
+ Set<Annotation> declared = null;
Annotation[] anns = null;
-
- if(XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
+
+ if (XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
{
declared = XMLAnnotationTypeManager.getInstance().getInterceptorBindingTypeInherites(clazzAnnot);
anns = new Annotation[declared.size()];
anns = declared.toArray(anns);
}
-
- else if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazzAnnot.getAnnotations()))
+
+ else if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazzAnnot.getAnnotations()))
{
- anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getAnnotations());
+ anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getAnnotations());
}
-
+
/*
- * For example:
- *
- * @InterceptorBindingType
- * @Transactional
- * @Action
- * public @interface ActionTransactional
- *
- * @ActionTransactional @Production
- * {
- *
- * }
- *
+ * For example: @InterceptorBindingType @Transactional @Action
+ * public @interface ActionTransactional @ActionTransactional
+ * @Production { }
*/
-
- if(anns != null && anns.length > 0)
+
+ if (anns != null && anns.length > 0)
{
- //For example : @Transactional @Action Interceptor
- Set<Interceptor> metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(anns);
- set.addAll(metas);
-
- //For each @Transactional and @Action Interceptor
- for(Annotation ann : anns)
- {
- Annotation[] simple = new Annotation[1];
- simple[0] = ann;
- metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(simple);
- set.addAll(metas);
- }
-
+ // For example : @Transactional @Action Interceptor
+ Set<Interceptor> metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(anns);
+ set.addAll(metas);
+
+ // For each @Transactional and @Action Interceptor
+ for (Annotation ann : anns)
+ {
+ Annotation[] simple = new Annotation[1];
+ simple[0] = ann;
+ metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(simple);
+ set.addAll(metas);
+ }
+
}
-
+
}
-
+
return set;
}
-
+
/**
* Sets interceptor class.
*
@@ -229,87 +215,61 @@
this.clazz = clazz;
}
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj)
- {
- if(this == obj)
- return true;
-
- WebBeansInterceptor o = null;
-
- if(obj instanceof WebBeansInterceptor)
- {
- o = (WebBeansInterceptor) obj;
-
- if(o.clazz != null && this.clazz != null)
- {
- return o.clazz.equals(this.clazz);
- }
-
- }
-
- return false;
- }
-
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode()
- {
- return this.clazz != null ? clazz.hashCode() : 0;
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- return "WebBeans Interceptor with class : " + "[" + this.clazz.getName() + "]";
- }
-
-
@Override
public Set<Annotation> getInterceptorBindingTypes()
{
Set<Annotation> set = new HashSet<Annotation>();
Set<Class<? extends Annotation>> keySet = this.interceptorBindingSet.keySet();
Iterator<Class<? extends Annotation>> itSet = keySet.iterator();
-
- while(itSet.hasNext())
+
+ while (itSet.hasNext())
{
set.add(this.interceptorBindingSet.get(itSet.next()));
}
-
+
return set;
}
-
@Override
public Method getMethod(InterceptionType type)
{
Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);
Method method = WebBeansUtil.checkCommonAnnotationCriterias(getClazz(), interceptorTypeAnnotationClazz, true);
-
+
return method;
}
-
@Override
public Object create()
{
- return delegateComponent.create();
+ Object proxy = JavassistProxyFactory.createNewProxyInstance(this);
+
+ return proxy;
+
+ // return delegateComponent.create();
}
+ public void setInjections(Object proxy)
+ {
+ // Set injected fields
+ ComponentImpl<Object> delegate = (ComponentImpl<Object>) this.delegateComponent;
+
+ Set<Field> injectedFields = delegate.getInjectedFields();
+ for (Field injectedField : injectedFields)
+ {
+ InjectableField ife = new InjectableField(injectedField, proxy, this.delegateComponent);
+ ife.doInjection();
+ }
+
+ Set<Method> injectedMethods = delegate.getInjectedMethods();
+ for (Method injectedMethod : injectedMethods)
+ {
+ @SuppressWarnings("unchecked")
+ InjectableMethods<?> ife = new InjectableMethods(injectedMethod, proxy, this.delegateComponent);
+ ife.doInjection();
+ }
+
+ }
@Override
public void destroy(Object instance)
@@ -317,41 +277,84 @@
delegateComponent.destroy(instance);
}
-
@Override
public Set<Annotation> getBindingTypes()
{
return delegateComponent.getBindingTypes();
}
-
@Override
public Class<? extends Annotation> getDeploymentType()
{
return delegateComponent.getDeploymentType();
}
-
@Override
public String getName()
{
return delegateComponent.getName();
}
-
@Override
public Class<? extends Annotation> getScopeType()
{
return delegateComponent.getScopeType();
}
-
@Override
public Set<Class<?>> getTypes()
{
return delegateComponent.getTypes();
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+
+ WebBeansInterceptor o = null;
+
+ if (obj instanceof WebBeansInterceptor)
+ {
+ o = (WebBeansInterceptor) obj;
+
+ if (o.clazz != null && this.clazz != null)
+ {
+ return o.clazz.equals(this.clazz);
+ }
+
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ return this.clazz != null ? clazz.hashCode() : 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "WebBeans Interceptor with class : " + "[" + this.clazz.getName() + "]";
+ }
@Override
public boolean isNullable()
@@ -359,7 +362,6 @@
return delegateComponent.isNullable();
}
-
@Override
public boolean isSerializable()
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationImpl.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationImpl.java Thu Jan 1 13:15:44 2009
@@ -39,6 +39,11 @@
private long activeTime = 0L;
+ public ConversationImpl()
+ {
+
+ }
+
public ConversationImpl(String sessionId)
{
Asserts.assertNotNull(sessionId);
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=730609&r1=730608&r2=730609&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Thu Jan 1 13:15:44 2009
@@ -103,6 +103,8 @@
import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.intercept.InterceptorsManager;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
+import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
+import org.apache.webbeans.jsf.ConversationImpl;
/**
* Contains some utility methods used in the all project.
@@ -518,6 +520,7 @@
ConversationComponent conversationComp = new ConversationComponent();
conversationComp.addApiType(Conversation.class);
+ conversationComp.addApiType(ConversationImpl.class);
conversationComp.setImplScopeType(new RequestedScopeLiteral());
conversationComp.setType(new StandardLiteral());
conversationComp.addBindingType(new CurrentLiteral());
@@ -724,13 +727,24 @@
{
try
{
- if (ClassUtil.isContaintNoArgConstructor(clazz) == null)
+ if(isDefinedWithWebBeans)
{
- throw new WebBeansConfigurationException("Interceptor class : " + clazz.getName() + " must have no-arg constructor");
+ Object interceptorProxy = ManagerImpl.getManager().getInstance(webBeansInterceptor);
+ WebBeansInterceptor interceptor = (WebBeansInterceptor)webBeansInterceptor;
+ interceptor.setInjections(interceptorProxy);
+
+ intData.setInterceptorInstance(interceptorProxy);
+ }
+ else
+ {
+ if (ClassUtil.isContaintNoArgConstructor(clazz) == null)
+ {
+ throw new WebBeansConfigurationException("Interceptor class : " + clazz.getName() + " must have no-arg constructor");
+ }
+
+ intData.setInterceptorInstance(clazz.newInstance());
}
-
- intData.setInterceptorInstance(clazz.newInstance());
} catch (WebBeansConfigurationException e1)
{