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/06/18 21:53:02 UTC
svn commit: r786231 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/main:
java/org/apache/webbeans/annotation/ java/org/apache/webbeans/component/
java/org/apache/webbeans/config/ java/org/apache/webbeans/container/
java/org/apache/webbeans/decora...
Author: gerdogdu
Date: Thu Jun 18 19:53:01 2009
New Revision: 786231
URL: http://svn.apache.org/viewvc?rev=786231&view=rev
Log:
Update for reflects changes to API.
Added:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DefinitionException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DeploymentException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/ExecutionException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/ExecutionException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/InconsistentSpecializationException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/NullableDependencyException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/UnserializableDependencyException.java
- copied, changed from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/UnserializableDependencyException.java
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/WebBeansAnnotation.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.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/container/ChildActivityManager.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.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/exception/WebBeansConfigurationException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentConstructorException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentFieldException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMemberException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMethodException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentTypeException.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.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/lifecycle/WebBeansLifeCycle.java (contents, props changed)
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java (contents, props changed)
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java (contents, props changed)
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java Thu Jun 18 19:53:01 2009
@@ -25,5 +25,17 @@
*/
public class NewLiteral extends AnnotationLiteral<New> implements New
{
+ private Class<?> clazz = null;
+
+ public NewLiteral()
+ {
+
+ }
+
+ public NewLiteral(Class<?> clazz)
+ {
+ this.clazz = clazz;
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/WebBeansAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/WebBeansAnnotation.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/WebBeansAnnotation.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/WebBeansAnnotation.java Thu Jun 18 19:53:01 2009
@@ -21,8 +21,8 @@
import javassist.util.proxy.MethodHandler;
-import javax.inject.ExecutionException;
+import org.apache.webbeans.exception.inject.ExecutionException;
import org.apache.webbeans.util.Asserts;
/**
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Thu Jun 18 19:53:01 2009
@@ -251,6 +251,22 @@
{
return type;
}
+
+
+ /**
+ * Get return types of the bean.
+ */
+ public Class<?> getBeanClass()
+ {
+ if(IComponentHasParent.class.isAssignableFrom(getClass()))
+ {
+ IComponentHasParent comp = (IComponentHasParent)this;
+
+ return comp.getParent().getBeanClass();
+ }
+
+ return getReturnType();
+ }
/**
* Set component type.
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java Thu Jun 18 19:53:01 2009
@@ -114,6 +114,11 @@
}
+ public Field getCreatorField()
+ {
+ return this.producerField;
+ }
+
public Type[] getActualTypeArguments()
{
Type type = producerField.getGenericType();
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Thu Jun 18 19:53:01 2009
@@ -27,6 +27,7 @@
import java.util.Set;
import javax.decorator.Decorates;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.ScopeType;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Current;
@@ -185,19 +186,9 @@
{
types.add(clazz);
-// if (clazz.isPrimitive())
-// {
-// types.add(ClassUtil.getPrimitiveWrapper(clazz));
-// }
-
}
else
{
-// if (ClassUtil.isPrimitiveWrapper(clazz))
-// {
-// types.add(ClassUtil.getWrapperPrimitive(clazz));
-// }
-
ClassUtil.setTypeHierarchy(component.getTypes(), clazz);
}
}
@@ -691,7 +682,8 @@
Annotation[] methodAnns = method.getDeclaredAnnotations();
DefinitionUtil.defineProducerMethodApiTypes(component, returnType);
- DefinitionUtil.defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName() + " must declare default @ScopeType annotation");
+ DefinitionUtil.defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName() + " must declare default @ScopeType annotation");
+ WebBeansUtil.checkProducerGenericType(component,method);
DefinitionUtil.defineBindingTypes(component, methodAnns);
DefinitionUtil.defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
@@ -725,6 +717,7 @@
DefinitionUtil.defineProducerMethodApiTypes(component, returnType);
DefinitionUtil.defineScopeType(component, fieldAnns, "WebBeans producer method : " + field.getName() + " in class " + parent.getReturnType().getName() + " must declare default @ScopeType annotation");
+ WebBeansUtil.checkProducerGenericType(component,field);
DefinitionUtil.defineBindingTypes(component, fieldAnns);
DefinitionUtil.defineName(component, fieldAnns, field.getName());
@@ -850,6 +843,19 @@
{
for (Field field : fields)
{
+
+ //TODO Check TEsts
+ /*
+ *
+ if(ClassUtil.isPublic(field.getModifiers()))
+ {
+ if(!component.getScopeType().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("If bean has a public modifier injection point, bean scope type must be defined as @Dependent");
+ }
+ }
+ */
+
Annotation[] anns = field.getDeclaredAnnotations();
// Injected fields can not be @Decorates or @Produces
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java Thu Jun 18 19:53:01 2009
@@ -42,6 +42,9 @@
private Properties configProperties = new Properties();
private WebBeansLogger logger = WebBeansLogger.getLogger(OpenWebBeansConfiguration.class);
+ /**Conversation periodic delay in ms.*/
+ public static final String CONVERSATION_PERIODIC_DELAY = "org.apache.webbeans.conversation.Conversation.periodicDelay";
+
public static OpenWebBeansConfiguration getInstance() {
return (OpenWebBeansConfiguration) WebBeansFinder.getSingletonInstance(OpenWebBeansConfiguration.class.getName());
}
@@ -108,4 +111,15 @@
{
return configProperties.getProperty(key);
}
+
+ /**
+ * @param key
+ * @param defaultValue
+ * @return String with the property value or <code>null</code>
+ */
+ public String getProperty(String key,String defaultValue)
+ {
+ return configProperties.getProperty(key, defaultValue);
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java Thu Jun 18 19:53:01 2009
@@ -125,6 +125,8 @@
DefinitionUtil.defineApiTypes(component, clazz);
DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName() + " stereotypes must declare same @ScopeType annotations");
+
+ WebBeansUtil.checkGenericType(component);
WebBeansUtil.checkPassivationScope(component, component.getScopeType().getAnnotation(ScopeType.class));
DefinitionUtil.defineBindingTypes(component, clazzAnns);
DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getSimpleWebBeanDefaultName(clazz.getSimpleName()));
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=786231&r1=786230&r2=786231&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 Jun 18 19:53:01 2009
@@ -34,7 +34,6 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.stereotype.Model;
-import javax.inject.InconsistentSpecializationException;
import javax.interceptor.Interceptor;
import org.apache.webbeans.WebBeansConstants;
@@ -50,6 +49,7 @@
import org.apache.webbeans.deployment.StereoTypeModel;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.spi.JNDIService;
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ChildActivityManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ChildActivityManager.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ChildActivityManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ChildActivityManager.java Thu Jun 18 19:53:01 2009
@@ -30,7 +30,8 @@
import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.DeploymentException;
+
+import org.apache.webbeans.exception.inject.DeploymentException;
/**
* Each Manager can start a new child activity as defined by the JSR-299 spec chapter 11.6
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Thu Jun 18 19:53:01 2009
@@ -24,7 +24,6 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.NullableDependencyException;
import org.apache.webbeans.annotation.CurrentLiteral;
import org.apache.webbeans.component.InstanceComponentImpl;
@@ -34,6 +33,7 @@
import org.apache.webbeans.container.activity.ActivityManager;
import org.apache.webbeans.deployment.DeploymentTypeManager;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.NullableDependencyException;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
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=786231&r1=786230&r2=786231&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 Jun 18 19:53:01 2009
@@ -351,5 +351,11 @@
return true;
}
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return this.delegateComponent.getBeanClass();
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
/**
* Exception that is thrown by the web beans container at the intialization
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception;
-import javax.inject.DeploymentException;
+import org.apache.webbeans.exception.inject.DeploymentException;
/**
* Exception that is thrown by the web beans container at the deployment time.
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentConstructorException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentConstructorException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentConstructorException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentConstructorException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception.definition;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
public class NonexistentConstructorException extends DefinitionException
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentFieldException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentFieldException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentFieldException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentFieldException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception.definition;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
public class NonexistentFieldException extends DefinitionException
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMemberException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMemberException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMemberException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMemberException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception.definition;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
public class NonexistentMemberException extends DefinitionException
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMethodException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMethodException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMethodException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentMethodException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception.definition;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
public class NonexistentMethodException extends DefinitionException
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentTypeException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentTypeException.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentTypeException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/NonexistentTypeException.java Thu Jun 18 19:53:01 2009
@@ -13,7 +13,7 @@
*/
package org.apache.webbeans.exception.definition;
-import javax.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
public class NonexistentTypeException extends DefinitionException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DefinitionException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DefinitionException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DefinitionException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,7 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
public class DefinitionException extends RuntimeException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DeploymentException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DeploymentException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/DeploymentException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,7 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
public class DeploymentException extends RuntimeException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/ExecutionException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/ExecutionException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/ExecutionException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/ExecutionException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/ExecutionException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/ExecutionException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/ExecutionException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,7 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
public class ExecutionException extends RuntimeException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/InconsistentSpecializationException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/InconsistentSpecializationException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/InconsistentSpecializationException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,7 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
public class InconsistentSpecializationException extends DeploymentException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/NullableDependencyException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/NullableDependencyException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/NullableDependencyException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,7 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
public class NullableDependencyException extends DeploymentException
{
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/UnserializableDependencyException.java (from r782277, incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/UnserializableDependencyException.java)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/UnserializableDependencyException.java?p2=incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/UnserializableDependencyException.java&p1=incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/UnserializableDependencyException.java&r1=782277&r2=786231&rev=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/inject/UnserializableDependencyException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/UnserializableDependencyException.java Thu Jun 18 19:53:01 2009
@@ -11,7 +11,8 @@
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
-package javax.inject;
+package org.apache.webbeans.exception.inject;
+
public class UnserializableDependencyException extends DeploymentException
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java Thu Jun 18 19:53:01 2009
@@ -21,7 +21,6 @@
import java.util.HashSet;
import java.util.Set;
-import javax.enterprise.inject.DuplicateBindingTypeException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.Bean;
import javax.inject.Obtains;
@@ -82,7 +81,7 @@
{
if(this.bindingAnnotations.contains(annot))
{
- throw new DuplicateBindingTypeException("Duplicate Binding Exception, " + this.toString());
+ throw new IllegalArgumentException("Duplicate Binding Exception, " + this.toString());
}
this.bindingAnnotations.add(annot);
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=786231&r1=786230&r2=786231&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 Jun 18 19:53:01 2009
@@ -54,8 +54,7 @@
* specificatin.
* </p>
*
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
+ * @version $Rev$ $Date$
*/
public class WebBeansInterceptor extends Interceptor
{
@@ -375,4 +374,10 @@
{
return delegateComponent.isSerializable();
}
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return this.delegateComponent.getBeanClass();
+ }
}
\ No newline at end of file
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java Thu Jun 18 19:53:01 2009
@@ -28,6 +28,7 @@
import javax.servlet.jsp.JspFactory;
import org.apache.webbeans.WebBeansConstants;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.config.WebBeansContainerDeployer;
import org.apache.webbeans.config.WebBeansFinder;
import org.apache.webbeans.container.ManagerImpl;
@@ -38,27 +39,52 @@
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.servlet.WebBeansConfigurationListener;
import org.apache.webbeans.spi.JNDIService;
import org.apache.webbeans.spi.ServiceLoader;
import org.apache.webbeans.spi.deployer.MetaDataDiscoveryService;
import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+/**
+ * Manages container lifecycle.
+ *
+ * <p>
+ * Behaves according to the request, session, and application
+ * contexts of the web application.
+ * </p>
+ *
+ * @version $Rev$Â $Date$
+ * @see WebBeansConfigurationListener
+ */
public final class WebBeansLifeCycle
{
- private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansLifeCycle.class);
+ //Logger instance
+ private static final WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansLifeCycle.class);
+ /**Manages unused conversations*/
private ScheduledExecutorService service = null;
+ /**Discover bean classes*/
private MetaDataDiscoveryService discovery = null;
- private WebBeansContainerDeployer deployer = null;
+ /**Deploy discovered beans*/
+ private final WebBeansContainerDeployer deployer;
- private WebBeansXMLConfigurator xmlDeployer = null;
+ /**XML discovery. */
+ //XML discovery is removed from the specification. It is here for next revisions of spec.
+ private final WebBeansXMLConfigurator xmlDeployer;
- private JNDIService jndiService = null;
+ /**Using for lookup operations*/
+ private final JNDIService jndiService;
- private ManagerImpl rootManager = null;
-
+ /**Root container.*/
+ //Activities are removed from the specification.
+ private final ManagerImpl rootManager;
+
+ /**
+ * Creates a new lifecycle instance and initializes
+ * the instance variables.
+ */
public WebBeansLifeCycle()
{
this.rootManager = new ManagerImpl();
@@ -71,27 +97,28 @@
ActivityManager.getInstance().setRootActivity(this.rootManager);
}
+
public void requestStarted(ServletRequestEvent event)
{
- logger.info("Initializing of the Request Context with Remote Address : " + event.getServletRequest().getRemoteAddr());
+ logger.debug("Starting a new request : " + event.getServletRequest().getRemoteAddr());
ContextFactory.initRequestContext(event);
}
public void requestEnded(ServletRequestEvent event)
{
- logger.info("Destroying of the Request Context with Remote Address : " + event.getServletRequest().getRemoteAddr());
+ logger.debug("Destroying a request : " + event.getServletRequest().getRemoteAddr());
ContextFactory.destroyRequestContext((HttpServletRequest) event.getServletRequest());
}
public void sessionStarted(HttpSessionEvent event)
{
- logger.info("Initializing of the Session Context with session id : " + event.getSession().getId());
+ logger.debug("Starting a session with session id : " + event.getSession().getId());
ContextFactory.initSessionContext(event.getSession());
}
public void sessionEnded(HttpSessionEvent event)
{
- logger.info("Destroying of the Session Context with session id : " + event.getSession().getId());
+ logger.debug("Destroying a session with session id : " + event.getSession().getId());
ContextFactory.destroySessionContext(event.getSession());
ConversationManager conversationManager = ConversationManager.getInstance();
@@ -106,46 +133,40 @@
// load all optional plugins
PluginLoader.getInstance().startUp();
- // I do not know this is the correct way, spec is not so explicit.
+ String strDelay = OpenWebBeansConfiguration.getInstance().getProperty(OpenWebBeansConfiguration.CONVERSATION_PERIODIC_DELAY,"150000");
+ long delay = Long.parseLong(strDelay);
+
service = Executors.newScheduledThreadPool(1);
- service.scheduleWithFixedDelay(new Runnable()
- {
-
- public void run()
- {
- ConversationManager.getInstance().destroyWithRespectToTimout();
+ service.scheduleWithFixedDelay(new ConversationCleaner(), delay, delay, TimeUnit.MILLISECONDS);
- }
-
- }, 150000, 150000, TimeUnit.MILLISECONDS);
-
- logger.info("Starting the WebBeans Container Configuration");
+ logger.info("Starting the dependency injection container configuration");
long begin = System.currentTimeMillis();
- logger.info("Scanning classpaths for WebBeans artifacts is started");
+ logger.info("Scanning classpaths for beans artifacts is started");
this.discovery.scan();
- logger.info("Scanning is ended.");
+ logger.info("Scanning is ended");
- logger.info("Deploying the scanned WebBeans artifacts.");
+ logger.info("Deploying the scanned beans artifacts");
deployer.deploy(this.discovery);
- logger.info("Deploying is ended.");
+ logger.info("Deploying is ended");
long end = System.currentTimeMillis();
- logger.info("WebBeans Container Configuration is ended, takes " + Long.toString(end - begin) + " ms.");
+ logger.info("Dependency injection container configuration is ended, takes " + Long.toString(end - begin) + " ms.");
// Initalize Application Context
- logger.info("Initializing of the Application Context with Context Path : " + event.getServletContext().getContextPath());
+ logger.info("Initializing of the application context");
ContextFactory.initApplicationContext(event.getServletContext());
ServletContext context = event.getServletContext();
try
{
- // check this application is JSF application
+ // check this application is JSF application,this must be extended.
+ //In JSF 2.0, faces-config.xml may not be necessary!
URL url = context.getResource("/WEB-INF/faces-config.xml");
URL urlWeb = context.getResource("/WEB-INF/web.xml");
if (url == null && urlWeb != null)
@@ -160,29 +181,48 @@
logger.error(e);
throw new WebBeansException(e);
}
-
+
+ logger.info("Dependency injection container is started for context path : " + event.getServletContext().getContextPath());
}
public void applicationEnded(ServletContextEvent event)
{
service.shutdownNow();
- logger.info("Destroying of the Application Context with Context Path : " + event.getServletContext().getContextPath());
ContextFactory.destroyApplicationContext(event.getServletContext());
jndiService.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);
- this.deployer = null;
- this.discovery = null;
- this.service = null;
- this.xmlDeployer = null;
- this.rootManager = null;
-
// finally free all plugin resources
PluginLoader.getInstance().shutDown();
WebBeansFinder.clearInstances();
+
+ logger.info("Dependency injection container is stopped for context path : " + event.getServletContext().getContextPath());
+ }
+
+ public void sessionPassivated(HttpSessionEvent event)
+ {
+ logger.info("Session is passivated. Session id : [ " + event.getSession().getId()+" ]");
+ }
+
+ public void sessionActivated(HttpSessionEvent event)
+ {
+ logger.info("Session is activated. Session id : [ " + event.getSession().getId()+" ]");
+ }
+
+ private static class ConversationCleaner implements Runnable
+ {
+ public ConversationCleaner()
+ {
+
+ }
+
+ public void run()
+ {
+ ConversationManager.getInstance().destroyWithRespectToTimout();
+ }
}
}
\ No newline at end of file
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java Thu Jun 18 19:53:01 2009
@@ -21,9 +21,8 @@
* <p>
* Actually, it is a thin layer on the log4j {@link Logger} implementation.
* </p>
- *
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
+ *
+ * @version $Rev$ $Date$
*/
public final class WebBeansLogger
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java Thu Jun 18 19:53:01 2009
@@ -17,70 +17,97 @@
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionActivationListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.apache.webbeans.lifecycle.WebBeansLifeCycle;
/**
- * Configures the all web beans components that are defined in the EAR or WAR
- * file.
+ * Initializing the beans container for using in an web application
+ * environment.
*
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
+ * @version $Rev$ $Date$
*/
-public class WebBeansConfigurationListener implements ServletContextListener, ServletRequestListener, HttpSessionListener
+public class WebBeansConfigurationListener implements ServletContextListener, ServletRequestListener, HttpSessionListener,HttpSessionActivationListener
{
+ /**Manages the container lifecycle*/
private WebBeansLifeCycle lifeCycle = null;
/**
- * Performed when the servlet context destroyed.
+ * Default constructor
*/
+ public WebBeansConfigurationListener()
+ {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void contextDestroyed(ServletContextEvent event)
{
this.lifeCycle.applicationEnded(event);
this.lifeCycle = null;
}
- /**
- * Performed when the servlet context started.
- */
+ /**
+ * {@inheritDoc}
+ */
public void contextInitialized(ServletContextEvent event)
{
this.lifeCycle = new WebBeansLifeCycle();
this.lifeCycle.applicationStarted(event);
}
- /**
- * Destroy request context
- */
+ /**
+ * {@inheritDoc}
+ */
public void requestDestroyed(ServletRequestEvent event)
{
this.lifeCycle.requestEnded(event);
}
- /**
- * Initializes the request context
- */
+ /**
+ * {@inheritDoc}
+ */
public void requestInitialized(ServletRequestEvent event)
{
this.lifeCycle.requestStarted(event);
}
- /**
- * Initializes session context
- */
+ /**
+ * {@inheritDoc}
+ */
public void sessionCreated(HttpSessionEvent event)
{
this.lifeCycle.sessionStarted(event);
}
- /**
- * Destroy session context
- */
+ /**
+ * {@inheritDoc}
+ */
public void sessionDestroyed(HttpSessionEvent event)
{
this.lifeCycle.sessionEnded(event);
}
-}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionDidActivate(HttpSessionEvent event)
+ {
+ this.lifeCycle.sessionActivated(event);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionWillPassivate(HttpSessionEvent event)
+ {
+ this.lifeCycle.sessionPassivated(event);
+ }
+
+}
\ No newline at end of file
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java Thu Jun 18 19:53:01 2009
@@ -29,6 +29,8 @@
* class scanning (EJB, JSF, JPA, ...). This SPI allows us to only have one
* central class scanner for the whole application server
* which only performs the scanning once at startup of each WebApp.
+ *
+ * @version $Rev$ $Date$
*/
public interface MetaDataDiscoveryService
{
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/deployer/MetaDataDiscoveryService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Thu Jun 18 19:53:01 2009
@@ -28,7 +28,6 @@
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.DuplicateBindingTypeException;
import javax.enterprise.inject.NonBinding;
import javax.enterprise.inject.stereotype.Stereotype;
import javax.xml.ws.WebServiceRef;
@@ -718,7 +717,7 @@
{
if (before.equals(ann))
{
- throw new DuplicateBindingTypeException("Binding annotations can not contain duplicate binding : @" + before.annotationType().getName());
+ throw new IllegalArgumentException("Binding annotations can not contain duplicate binding : @" + before.annotationType().getName());
}
else
{
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=786231&r1=786230&r2=786231&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 Jun 18 19:53:01 2009
@@ -18,6 +18,7 @@
import java.lang.annotation.Target;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -46,7 +47,6 @@
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.DuplicateBindingTypeException;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Instance;
@@ -62,9 +62,6 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.stereotype.Stereotype;
import javax.event.Fires;
-import javax.inject.DefinitionException;
-import javax.inject.InconsistentSpecializationException;
-import javax.inject.NullableDependencyException;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
import javax.servlet.Filter;
@@ -88,6 +85,8 @@
import org.apache.webbeans.component.ManagerComponentImpl;
import org.apache.webbeans.component.NewComponentImpl;
import org.apache.webbeans.component.ObservableComponentImpl;
+import org.apache.webbeans.component.ProducerComponentImpl;
+import org.apache.webbeans.component.ProducerFieldComponent;
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.EJBWebBeansConfigurator;
@@ -105,6 +104,9 @@
import org.apache.webbeans.event.EventImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
+import org.apache.webbeans.exception.inject.NullableDependencyException;
import org.apache.webbeans.intercept.InterceptorData;
import org.apache.webbeans.intercept.InterceptorDataImpl;
import org.apache.webbeans.intercept.InterceptorType;
@@ -161,6 +163,99 @@
}
/**
+ * Checks the generic type requirements.
+ *
+ * @param bean managed bean instance
+ */
+ public static void checkGenericType(Bean<?> bean)
+ {
+ Asserts.assertNotNull(bean);
+
+ Class<?> clazz = bean.getBeanClass();
+
+ if (ClassUtil.isDefinitionConstainsTypeVariables(clazz))
+ {
+ if(!bean.getScopeType().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Generic type may only defined with scope type @Dependent for bean class : " + clazz.getName());
+ }
+ }
+ }
+
+
+ /**
+ * Check producer method return type.
+ *
+ * @param component producer method component
+ * @param type return type
+ */
+ public static void checkProducerGenericType(Bean<?> component,Member member)
+ {
+ Asserts.assertNotNull(component);
+
+ Type type = null;
+
+ if(component instanceof ProducerComponentImpl)
+ {
+ type = ((ProducerComponentImpl<?>)component).getCreatorMethod().getGenericReturnType();
+ }
+ else if(component instanceof ProducerFieldComponent)
+ {
+ type = ((ProducerFieldComponent<?>)component).getCreatorField().getGenericType();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Component must be producer field or method : " + component);
+ }
+
+ String message = "Producer field/method : " + member.getName() + " in class : " + member.getDeclaringClass().getName();
+
+ if(checkGenericForProducers(type, message))
+ {
+ if(!component.getScopeType().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException(message + " scope type must bee @Dependent");
+ }
+ }
+ }
+
+ //Helper method
+ private static boolean checkGenericForProducers(Type type, String message)
+ {
+ boolean result = false;
+
+ if(type instanceof TypeVariable)
+ {
+ throw new WebBeansConfigurationException(message + " return type can not be type variable");
+ }
+
+ if(ClassUtil.isParametrizedType(type))
+ {
+ Type[] actualTypes = ClassUtil.getActualTypeArguements(type);
+
+ if(actualTypes.length == 0)
+ {
+ throw new WebBeansConfigurationException(message + " return type must define actual type arguments or type variable");
+ }
+
+ for(Type actualType : actualTypes)
+ {
+ if(ClassUtil.isWildCardType(actualType))
+ {
+ throw new WebBeansConfigurationException(message + " return type can not define wildcard actual type argument");
+ }
+
+ if(ClassUtil.isTypeVariable(actualType))
+ {
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
* Return <code>true</code> if the given class is ok for simple web bean conditions,
* <code>false</code> otherwise.
*
@@ -172,9 +267,6 @@
Asserts.nullCheckForClass(clazz);
int modifier = clazz.getModifiers();
- if (ClassUtil.isDefinitionConstainsTypeVariables(clazz))
- throw new WebBeansConfigurationException("Web Beans component implementation class : " + clazz.getName() + " can not be parametrized type");
-
if (!ClassUtil.isStatic(modifier) && ClassUtil.isInnerClazz(clazz))
throw new WebBeansConfigurationException("Web Beans component implementation class : " + clazz.getName() + " can not be non-static inner class");
@@ -1536,7 +1628,7 @@
{
if (old.equals(interceptorBindingType))
{
- throw new DuplicateBindingTypeException("Manager.resolveInterceptors() method parameter interceptor binding types array argument can not define duplicate binding annotation with name : @" + old.getClass().getName());
+ throw new IllegalArgumentException("Manager.resolveInterceptors() method parameter interceptor binding types array argument can not define duplicate binding annotation with name : @" + old.getClass().getName());
}
if (!AnnotationUtil.isInterceptorBindingAnnotation(interceptorBindingType.annotationType()))
@@ -1567,7 +1659,7 @@
{
if (old.annotationType().equals(bindingType.annotationType()))
{
- throw new DuplicateBindingTypeException("Manager.resolveDecorators() method parameter binding types array argument can not define duplicate binding annotation with name : @" + old.annotationType().getName());
+ throw new IllegalArgumentException("Manager.resolveDecorators() method parameter binding types array argument can not define duplicate binding annotation with name : @" + old.annotationType().getName());
}
if (!AnnotationUtil.isBindingAnnotation(bindingType.annotationType()))
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Thu Jun 18 19:53:01 2009
@@ -47,8 +47,6 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.deployment.DeploymentType;
import javax.enterprise.inject.deployment.Production;
-import javax.inject.DefinitionException;
-import javax.inject.DeploymentException;
import javax.interceptor.Interceptor;
import org.apache.webbeans.WebBeansConstants;
@@ -68,6 +66,8 @@
import org.apache.webbeans.exception.definition.NonexistentFieldException;
import org.apache.webbeans.exception.definition.NonexistentMethodException;
import org.apache.webbeans.exception.definition.NonexistentTypeException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DeploymentException;
import org.apache.webbeans.inject.impl.InjectionPointFactory;
import org.apache.webbeans.inject.xml.XMLInjectableConstructor;
import org.apache.webbeans.inject.xml.XMLInjectionModelType;
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Thu Jun 18 19:53:01 2009
@@ -25,8 +25,6 @@
import java.util.List;
import java.util.Set;
-import javax.enterprise.inject.DuplicateBindingTypeException;
-import javax.inject.DefinitionException;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -37,6 +35,7 @@
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.exception.definition.NonexistentTypeException;
+import org.apache.webbeans.exception.inject.DefinitionException;
import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
import org.apache.webbeans.proxy.JavassistProxyFactory;
import org.apache.webbeans.util.AnnotationUtil;
@@ -608,7 +607,7 @@
{
if (definedBindingType.equals(annotClazz))
{
- throw new DuplicateBindingTypeException(errorMessage + "Java type with name : " + getElementJavaClassName(typeElement) + " is duplicated");
+ throw new IllegalArgumentException(errorMessage + "Java type with name : " + getElementJavaClassName(typeElement) + " is duplicated");
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties?rev=786231&r1=786230&r2=786231&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties Thu Jun 18 19:53:01 2009
@@ -37,6 +37,9 @@
#JMS ConnectionFactory JNDI Name
org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi=ConnectionFactory
+#Conversation periodic delay in MiliSeconds, it checks the unused conversations
+org.apache.webbeans.conversation.Conversation.periodicDelay=150000
+
# lookup the javax.transaction.TransactionManager via JNDI as default
org.apache.webbeans.spi.TransactionService=org.apache.webbeans.spi.ee.TransactionServiceJndiImpl