You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/06/09 07:11:00 UTC
svn commit: r952905 - in
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
config/ container/ context/ context/creational/ context/type/ conversation/
Author: struberg
Date: Wed Jun 9 05:10:59 2010
New Revision: 952905
URL: http://svn.apache.org/viewvc?rev=952905&view=rev
Log:
OWB-275 code cleanup
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Wed Jun 9 05:10:59 2010
@@ -330,8 +330,8 @@ public class BeansDeployer
Stack<String> beanNames = new Stack<String>();
for (Bean<?> bean : beans)
{
- String beanName = null;
- if((beanName = bean.getName()) != null)
+ String beanName = bean.getName();
+ if(beanName != null)
{
beanNames.push(beanName);
}
@@ -527,7 +527,7 @@ public class BeansDeployer
}
catch (IOException e)
{
- ;// all ok, ignore this!
+ // all ok, ignore this!
}
}
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java Wed Jun 9 05:10:59 2010
@@ -29,7 +29,8 @@ import java.lang.reflect.Proxy;
* The annotation literal gets filled with the default values.
* TODO implement class caching!
*/
-public class DefaultAnnotation implements InvocationHandler{
+public class DefaultAnnotation implements InvocationHandler
+{
public static Annotation of(Class<? extends Annotation> annotation)
{
return (Annotation) Proxy.newProxyInstance(annotation.getClassLoader(), new Class[] {annotation}, new DefaultAnnotation());
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Wed Jun 9 05:10:59 2010
@@ -237,7 +237,9 @@ public final class DefinitionUtil
{
if (!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), Nonbinding.class))
{
- throw new WebBeansConfigurationException("WebBeans definition class : " + component.getReturnType().getName() + " @Qualifier : " + annotation.annotationType().getName() + " must have @NonBinding valued members for its array-valued and annotation valued members");
+ throw new WebBeansConfigurationException("WebBeans definition class : " + component.getReturnType().getName() + " @Qualifier : "
+ + annotation.annotationType().getName()
+ + " must have @NonBinding valued members for its array-valued and annotation valued members");
}
}
}
@@ -299,9 +301,9 @@ public final class DefinitionUtil
//Add @Any support
if(!AnnotationUtil.hasAnyQualifier(component))
{
- component.addQualifier(new AnyLiteral());
+ component.addQualifier(new AnyLiteral());
}
-
+
}
/**
@@ -603,7 +605,7 @@ public final class DefinitionUtil
/**
* Defines the {@link Bean} producer methods. Moreover, it configures the
- * producer methods with using the {@link Realizes} annotations.
+ * producer methods with using the {@link Produces} annotations.
*
* @param component
* @return the set of producer components
@@ -627,7 +629,8 @@ public final class DefinitionUtil
return producerComponents;
}
- private static <T> void createProducerComponents(InjectionTargetBean<T> component, Set<ProducerMethodBean<?>> producerComponents, Method declaredMethod, Class<?> clazz)
+ private static <T> void createProducerComponents(InjectionTargetBean<T> component, Set<ProducerMethodBean<?>> producerComponents,
+ Method declaredMethod, Class<?> clazz)
{
boolean isSpecializes = false;
@@ -640,7 +643,8 @@ public final class DefinitionUtil
{
if (ClassUtil.isStatic(declaredMethod.getModifiers()))
{
- throw new WebBeansConfigurationException("Specializing producer method : " + declaredMethod.getName() + " in class : " + clazz.getName() + " can not be static");
+ throw new WebBeansConfigurationException("Specializing producer method : " + declaredMethod.getName() + " in class : " + clazz.getName()
+ + " can not be static");
}
isSpecializes = true;
@@ -680,7 +684,8 @@ public final class DefinitionUtil
WebBeansUtil.setBeanEnableFlagForProducerBean(parent, component, methodAnns);
DefinitionUtil.defineProducerMethodApiTypes(component, method.getGenericReturnType(), methodAnns);
- DefinitionUtil.defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName() + " must declare default @Scope annotation");
+ DefinitionUtil.defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName()
+ + " must declare default @Scope annotation");
WebBeansUtil.checkUnproxiableApiType(component, component.getScope());
WebBeansUtil.checkProducerGenericType(component,method);
DefinitionUtil.defineQualifiers(component, methodAnns);
@@ -735,7 +740,8 @@ public final class DefinitionUtil
WebBeansUtil.setBeanEnableFlagForProducerBean(parent, component, fieldAnns);
DefinitionUtil.defineProducerMethodApiTypes(component, field.getGenericType(), fieldAnns);
- DefinitionUtil.defineScopeType(component, fieldAnns, "WebBeans producer method : " + field.getName() + " in class " + parent.getReturnType().getName() + " must declare default @Scope annotation");
+ DefinitionUtil.defineScopeType(component, fieldAnns, "WebBeans producer method : " + field.getName() + " in class " + parent.getReturnType().getName()
+ + " must declare default @Scope annotation");
WebBeansUtil.checkUnproxiableApiType(component, component.getScope());
WebBeansUtil.checkProducerGenericType(component,field);
DefinitionUtil.defineQualifiers(component, fieldAnns);
@@ -768,7 +774,8 @@ public final class DefinitionUtil
Set<Bean<?>> set = InjectionResolver.getInstance().implResolveByType(type, annot);
- if (set.isEmpty()) {
+ if (set.isEmpty())
+ {
throw new UnsatisfiedResolutionException("Producer method component of the disposal method : " + declaredMethod.getName() +
" in class : " + clazz.getName() + ". Cannot find bean " + type + " with qualifier " + Arrays.toString(annot));
}
@@ -778,7 +785,8 @@ public final class DefinitionUtil
if (bean == null || !(bean instanceof ProducerMethodBean))
{
- throw new UnsatisfiedResolutionException("Producer method component of the disposal method : " + declaredMethod.getName() + " in class : " + clazz.getName() + "is not found");
+ throw new UnsatisfiedResolutionException("Producer method component of the disposal method : " + declaredMethod.getName() + " in class : "
+ + clazz.getName() + "is not found");
}
else
@@ -795,7 +803,8 @@ public final class DefinitionUtil
// multiple same producer
if (previous.equals(pr))
{
- throw new WebBeansConfigurationException("There are multiple disposal method for the producer method : " + pr.getCreatorMethod().getName() + " in class : " + clazz.getName());
+ throw new WebBeansConfigurationException("There are multiple disposal method for the producer method : " + pr.getCreatorMethod().getName()
+ + " in class : " + clazz.getName());
}
}
@@ -803,7 +812,8 @@ public final class DefinitionUtil
//Disposer methods and producer methods must be in the same class
if(!producerMethod.getDeclaringClass().getName().equals(declaredMethod.getDeclaringClass().getName()))
{
- throw new WebBeansConfigurationException("Producer method component of the disposal method : " + declaredMethod.getName() + " in class : " + clazz.getName() + " must be in the same class!");
+ throw new WebBeansConfigurationException("Producer method component of the disposal method : " + declaredMethod.getName() + " in class : "
+ + clazz.getName() + " must be in the same class!");
}
pr.setDisposalMethod(declaredMethod);
@@ -856,7 +866,8 @@ public final class DefinitionUtil
{
if(BeanManagerImpl.getManager().isNormalScope(component.getScope()))
{
- throw new WebBeansConfigurationException("If bean has a public field, bean scope must be defined as @Scope. Bean is : " + component.toString());
+ throw new WebBeansConfigurationException("If bean has a public field, bean scope must be defined as @Scope. Bean is : "
+ + component.toString());
}
}
@@ -999,7 +1010,8 @@ public final class DefinitionUtil
TypeVariable<?>[] args = method.getTypeParameters();
if(args.length > 0)
{
- throw new WebBeansConfigurationException("Initializer methods must not be generic but method : " + method.getName() + " in bean class : " + clazz + " is defined as generic");
+ throw new WebBeansConfigurationException("Initializer methods must not be generic but method : " + method.getName() + " in bean class : "
+ + clazz + " is defined as generic");
}
Annotation[][] anns = method.getParameterAnnotations();
@@ -1017,7 +1029,8 @@ public final class DefinitionUtil
}
else
{
- throw new WebBeansConfigurationException("Initializer method : " + method.getName() + " in class : " + clazz.getName() + " can not be annotated with @Produces");
+ throw new WebBeansConfigurationException("Initializer method : " + method.getName() + " in class : " + clazz.getName()
+ + " can not be annotated with @Produces");
}
}
@@ -1170,7 +1183,8 @@ public final class DefinitionUtil
return producerComponents;
}
- private static <X> void createProducerBeansFromAnnotatedType(InjectionTargetBean<X> bean, Set<ProducerMethodBean<?>> producerComponents, AnnotatedMethod<X> annotatedMethod, Class<?> clazz, boolean isSpecializes)
+ private static <X> void createProducerBeansFromAnnotatedType(InjectionTargetBean<X> bean, Set<ProducerMethodBean<?>> producerComponents,
+ AnnotatedMethod<X> annotatedMethod, Class<?> clazz, boolean isSpecializes)
{
Annotation[] anns = annotatedMethod.getAnnotations().toArray(new Annotation[0]);
@@ -1181,9 +1195,13 @@ public final class DefinitionUtil
for(AnnotatedParameter<X> parameter : parameters)
{
Annotation[] parameterAnns = parameter.getAnnotations().toArray(new Annotation[0]);
- if (AnnotationUtil.hasAnnotation(anns, Inject.class) || AnnotationUtil.hasAnnotation(parameterAnns, Disposes.class) || AnnotationUtil.hasAnnotation(parameterAnns, Observes.class))
- {
- throw new WebBeansConfigurationException("Producer Method Bean with name : " + annotatedMethod.getJavaMember().getName() + " in bean class : " + clazz + " can not be annotated with" + " @Initializer/@Destructor annotation or has a parameter annotated with @Disposes/@Observes");
+ if (AnnotationUtil.hasAnnotation(anns, Inject.class) ||
+ AnnotationUtil.hasAnnotation(parameterAnns, Disposes.class) ||
+ AnnotationUtil.hasAnnotation(parameterAnns, Observes.class))
+ {
+ throw new WebBeansConfigurationException("Producer Method Bean with name : " + annotatedMethod.getJavaMember().getName() + " in bean class : " + clazz
+ + " can not be annotated with @Initializer/@Destructor annotation "
+ + "or has a parameter annotated with @Disposes/@Observes");
}
}
@@ -1192,13 +1210,15 @@ public final class DefinitionUtil
{
if (ClassUtil.isStatic(annotatedMethod.getJavaMember().getModifiers()))
{
- throw new WebBeansConfigurationException("Specializing producer method : " + annotatedMethod.getJavaMember().getName() + " in class : " + clazz.getName() + " can not be static");
+ throw new WebBeansConfigurationException("Specializing producer method : " + annotatedMethod.getJavaMember().getName() + " in class : " + clazz.getName()
+ + " can not be static");
}
isSpecializes = true;
}
- ProducerMethodBean<?> newComponent = createProducerBeanFromAnnotatedType((Class<X>)annotatedMethod.getJavaMember().getReturnType(), annotatedMethod, bean, isSpecializes);
+ ProducerMethodBean<?> newComponent = createProducerBeanFromAnnotatedType((Class<X>)annotatedMethod.getJavaMember().getReturnType(),
+ annotatedMethod, bean, isSpecializes);
if (newComponent != null)
{
producerComponents.add(newComponent);
@@ -1208,7 +1228,8 @@ public final class DefinitionUtil
}
- public static <X> ProducerMethodBean<X> createProducerBeanFromAnnotatedType(Class<X> returnType, AnnotatedMethod<X> method, InjectionTargetBean<?> parent, boolean isSpecializes)
+ public static <X> ProducerMethodBean<X> createProducerBeanFromAnnotatedType(Class<X> returnType, AnnotatedMethod<X> method,
+ InjectionTargetBean<?> parent, boolean isSpecializes)
{
ProducerMethodBean<X> bean = new ProducerMethodBean<X>(parent, returnType);
bean.setCreatorMethod(method.getJavaMember());
@@ -1229,7 +1250,8 @@ public final class DefinitionUtil
defineStereoTypes(bean, anns);
DefinitionUtil.defineProducerMethodApiTypes(bean, method.getBaseType(), anns);
- DefinitionUtil.defineScopeType(bean, anns, "Bean producer method : " + method.getJavaMember().getName() + " in class " + parent.getReturnType().getName() + " must declare default @Scope annotation");
+ DefinitionUtil.defineScopeType(bean, anns, "Bean producer method : " + method.getJavaMember().getName() + " in class "
+ + parent.getReturnType().getName() + " must declare default @Scope annotation");
WebBeansUtil.checkProducerGenericType(bean,method.getJavaMember());
DefinitionUtil.defineQualifiers(bean, anns);
DefinitionUtil.defineName(bean, anns, WebBeansUtil.getProducerDefaultName(method.getJavaMember().getName()));
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Wed Jun 9 05:10:59 2010
@@ -69,7 +69,8 @@ public final class ManagedBeanConfigurat
if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
{
- throw new WebBeansConfigurationException("ManagedBean implementation class : " + clazz.getName() + " may not annotated with both @Interceptor and @Decorator annotation");
+ throw new WebBeansConfigurationException("ManagedBean implementation class : " + clazz.getName()
+ + " may not annotated with both @Interceptor and @Decorator annotation");
}
if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && !AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
@@ -131,7 +132,8 @@ public final class ManagedBeanConfigurat
Annotation[] clazzAnns = clazz.getDeclaredAnnotations();
DefinitionUtil.defineApiTypes(component, clazz);
- DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName() + " stereotypes must declare same @Scope annotations");
+ DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName()
+ + " stereotypes must declare same @Scope annotations");
WebBeansUtil.checkGenericType(component);
DefinitionUtil.defineQualifiers(component, clazzAnns);
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java Wed Jun 9 05:10:59 2010
@@ -47,7 +47,10 @@ public class OWBLogConst
public final static String WARN_0002 = "WARN_0002"; // Alternative XML content is wrong. Child of <alternatives> must be <class>,<stereotype> but found :
public final static String WARN_0003 = "WARN_0003"; // Conversation already started with cid : [{0}]
public final static String WARN_0004 = "WARN_0004"; // Conversation already ended with cid \: [{0}]
- public final static String WARN_0005_1 = "WARN_0005_1"; // [{0}] has not DependentScope. If an interceptor or decorator has any scope other than @Dependent, non-portable behaviour results.
+
+ // [{0}] has not DependentScope. If an interceptor or decorator has any scope other than @Dependent, non-portable behaviour results.
+ public final static String WARN_0005_1 = "WARN_0005_1";
+
public final static String WARN_0005_2 = "WARN_0005_2"; // [{0}] has a name. If an interceptor or decorator has name, non-portable behaviour results.
public final static String WARN_0005_3 = "WARN_0005_3"; // [{0}] is Alternative. If an interceptor or decorator is @Alternative, non-portable behaviour results.
public final static String WARN_0006 = "WARN_0006"; // Unable to close entity manager factory with name \: [{0}]
@@ -61,7 +64,9 @@ public class OWBLogConst
public final static String WARN_0014 = "WARN_0014"; // Could not find {0} with name [{1}].
public final static String WARN_0015 = "WARN_0015"; // Trying to serialize non-passivation capable bean proxy \: [{0}]
public final static String WARN_0016 = "WARN_0016"; // Stereotypes can not annotated with @Typed but stereotype \: [{0}] has annotated, non-portable behaviour results.
- public final static String WARN_0017 = "WARN_0017"; // Stereotypes can not define qualifier other than @Named but stereotype \: [{0}] has defined [{1}] , non-portable behaviour results.
+
+ // Stereotypes can not define qualifier other than @Named but stereotype \: [{0}] has defined [{1}] , non-portable behaviour results.
+ public final static String WARN_0017 = "WARN_0017";
public final static String ERROR_0001 = "ERROR_0001"; // Unable to inject resource for : [{0}]
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java Wed Jun 9 05:10:59 2010
@@ -21,10 +21,8 @@ package org.apache.webbeans.config;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.text.MessageFormat;
import java.util.Properties;
-import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.logger.WebBeansLogger;
@@ -201,7 +199,7 @@ public class OpenWebBeansConfiguration
/**
* (re)read the configuration from the resources in the classpath.
- * @see #DEFALULT_CONFIG_PROPERTIES_NAME
+ * @see #DEFAULT_CONFIG_PROPERTIES_NAME
* @see #CONFIG_PROPERTIES_NAME
*/
public synchronized void parseConfiguration() throws WebBeansConfigurationException
@@ -263,7 +261,8 @@ public class OpenWebBeansConfiguration
try
{
is.close();
- }catch(Exception e)
+ }
+ catch(Exception e)
{
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java Wed Jun 9 05:10:59 2010
@@ -116,7 +116,9 @@ public class OwbParametrizedTypeImpl imp
if (owner == null)
{
if (other.owner != null)
+ {
return false;
+ }
}
else if (!owner.equals(other.owner))
{
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java Wed Jun 9 05:10:59 2010
@@ -159,7 +159,8 @@ public final class SerializableBean<T> i
{
String id = (String) s.readObject();
Bean<T> b = (Bean<T>) BeanManagerImpl.getManager().getPassivationCapableBean(id);
- if (b == null) {
+ if (b == null)
+ {
throw new DeploymentException("cannot deserialize Bean with PassivationCapable id=" + id);
}
if (b instanceof SerializableBean)
@@ -176,7 +177,8 @@ public final class SerializableBean<T> i
* {@inheritDoc}
*/
@Override
- public boolean equals(Object other) {
+ public boolean equals(Object other)
+ {
if (other instanceof SerializableBean<?>)
{
return bean.equals(((SerializableBean<?>)other).getBean());
@@ -191,7 +193,8 @@ public final class SerializableBean<T> i
* @return hashCode of the underlying bean instance.
*/
@Override
- public int hashCode() {
+ public int hashCode()
+ {
return bean.hashCode();
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java Wed Jun 9 05:10:59 2010
@@ -23,7 +23,6 @@ import org.apache.webbeans.util.WebBeans
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.PassivationCapable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -35,13 +34,15 @@ import java.util.concurrent.ConcurrentHa
* like e.g. the SessionContext, the ConversationContext or any 3-rd party Context
* for a NormalScoped(passivating=true) and therefore PassivationCapable Scope needs to be Serializable.</p>
* <p>Normal {@link Bean}s are not serializable because they contain non transportable information. But each
- * {@link PassivationCapable} {@link Bean} is uniquely identifyable via it's id and can be restored by
+ * {@link javax.enterprise.inject.spi.PassivationCapable} {@link Bean} is uniquely
+ * identifyable via it's id and can be restored by
* {@link javax.enterprise.inject.spi.BeanManager#getPassivationCapableBean(String)}.</p>
* <p>Since a custom Context implementation doesn't know when it gets passivated (for a Http Session
* this is pretty seldom), the Contextual<T> handed over to the Context implementation must be
* Serializable.</p>
*/
-public class SerializableBeanVault {
+public class SerializableBeanVault
+{
private Map<String, SerializableBean<?>> serializableBeans = new ConcurrentHashMap<String, SerializableBean<?>>();
@@ -59,9 +60,9 @@ public class SerializableBeanVault {
return bean;
}
- String id = null;
+ String id = WebBeansUtil.isPassivationCapable(bean);
- if((id=WebBeansUtil.isPassivationCapable(bean)) != null)
+ if(id != null)
{
SerializableBean<T> sb = (SerializableBean<T>) serializableBeans.get(id);
if (sb == null)
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java Wed Jun 9 05:10:59 2010
@@ -33,7 +33,6 @@ import javax.enterprise.context.Conversa
import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
@@ -46,7 +45,7 @@ import org.apache.webbeans.util.Asserts;
/**
* Abstract implementation of the {@link WebBeansContext} interfaces.
*
- * @see Context
+ * @see javax.enterprise.context.spi.Context
* @see RequestContext
* @see DependentContext
* @see SessionContext
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java Wed Jun 9 05:10:59 2010
@@ -18,14 +18,13 @@
*/
package org.apache.webbeans.context;
-import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
import org.apache.webbeans.context.type.ContextTypes;
/**
- * Defines the component {@link Dependent} context.
+ * Defines the component {@link javax.enterprise.context.Dependent} context.
* <p>
* Each web beans component has a dependent context, that saves its dependent
* objects. Dependent context is destroyed at the end of the component
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java Wed Jun 9 05:10:59 2010
@@ -65,7 +65,7 @@ public class CreationalContextImpl<T> im
/**
* Add interceptor instance.
- * @param clazz interceptor class
+ * @param ownerInstance
* @param instance interceptor instance
*/
public void addEjbInterceptor(Object ownerInstance, EjbInterceptorContext instance)
@@ -374,8 +374,8 @@ public class CreationalContextImpl<T> im
= new HashMap<Object, List<DependentCreationalContext<?>>>(dependentObjects);
s.writeObject(depo);
- String id = null;
- if (contextual != null && (id = WebBeansUtil.isPassivationCapable(contextual)) != null)
+ String id = WebBeansUtil.isPassivationCapable(contextual);
+ if (contextual != null && id != null)
{
s.writeObject(id);
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java Wed Jun 9 05:10:59 2010
@@ -111,10 +111,10 @@ public class DependentCreationalContext<
s.writeObject(instance);
//Write for contextual
- String id = null;
if (contextual != null)
{
- if ((id = WebBeansUtil.isPassivationCapable(contextual)) != null)
+ String id = WebBeansUtil.isPassivationCapable(contextual);
+ if (id != null)
{
s.writeObject(id);
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java Wed Jun 9 05:10:59 2010
@@ -81,9 +81,9 @@ public enum ContextTypes
case 5:
return "singleton";
+ default:
+ return null;
}
-
- return null;
}
}
\ No newline at end of file
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java Wed Jun 9 05:10:59 2010
@@ -101,7 +101,8 @@ public class ConversationImpl implements
//Sets at the beginning of each JSF request.
manager.addConversationContext(this, (ConversationContext) BeanManagerImpl.getManager().getContext(ConversationScoped.class));
- }catch(Exception e)
+ }
+ catch(Exception e)
{
//TCK tests
manager.addConversationContext(this, new ConversationContext());
@@ -266,26 +267,44 @@ public class ConversationImpl implements
public boolean equals(Object obj)
{
if (this == obj)
+ {
return true;
+ }
+
if (obj == null)
+ {
return false;
+ }
+
if (getClass() != obj.getClass())
+ {
return false;
+ }
+
final ConversationImpl other = (ConversationImpl) obj;
if (id == null)
{
if (other.id != null)
+ {
return false;
+ }
}
else if (!id.equals(other.id))
+ {
return false;
+ }
if (sessionId == null)
{
if (other.sessionId != null)
+ {
return false;
+ }
}
else if (!sessionId.equals(other.sessionId))
+ {
return false;
+ }
+
return true;
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java?rev=952905&r1=952904&r2=952905&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java Wed Jun 9 05:10:59 2010
@@ -182,7 +182,7 @@ public class ConversationManager
@SuppressWarnings("unchecked")
public Conversation getConversationBeanReference()
{
- BeanManager beanManager = BeanManagerImpl.getManager();
+ BeanManager beanManager = BeanManagerImpl.getManager();
Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, new DefaultLiteral()).iterator().next();
Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean));