[webbeans-commits] Webbeans SVN: r1774 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-05 17:20:30 -0500 (Thu, 05 Mar 2009)
New Revision: 1774
Modified:
doc/trunk/reference/en-US/ri-spi.xml
Log:
Document the servlet injection
Modified: doc/trunk/reference/en-US/ri-spi.xml
===================================================================
--- doc/trunk/reference/en-US/ri-spi.xml 2009-03-05 16:51:38 UTC (rev 1773)
+++ doc/trunk/reference/en-US/ri-spi.xml 2009-03-05 22:20:30 UTC (rev 1774)
@@ -325,6 +325,29 @@
]]></programlisting>
</section>
+
+ <section>
+ <title>Servlet injection</title>
+
+ <para>
+ Java EE / Servlet does not provide any hooks which can be used to
+ provide injection into Servlets, so Web Beans provides an API to
+ allow the container to request JSR-299 injection for a Servlet.
+ </para>
+
+ <para>
+ To be compliant with JSR-299, the container should request servlet
+ injection for each newly instantiated servlet after the constructor
+ returns and before the servlet is placed into service.
+ </para>
+
+ <para>
+ To perform injection on a servlet call
+ <literal>WebBeansManager.injectIntoServlet()</literal>. The manager
+ can be obtained from <literal>Bootstrap.getManager()</literal>.
+ </para>
+
+ </section>
</section>
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1773 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 12 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-05 11:51:38 -0500 (Thu, 05 Mar 2009)
New Revision: 1773
Added:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ServletInjector.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Barn.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Farm.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/FarmLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Hamlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/HamletLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Village.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/VillageLocal.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/beans.xml
Modified:
ri/trunk/webbeans-ri-spi/pom.xml
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/packaging/ear/EarArtifactDescriptor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/NonContextualInjectionTest.java
Log:
WBRI-119, WBRI-55
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -56,6 +56,7 @@
import javax.inject.manager.InterceptionType;
import javax.inject.manager.Interceptor;
import javax.inject.manager.Manager;
+import javax.servlet.Servlet;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
@@ -69,10 +70,13 @@
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.injection.ResolvableAnnotatedClass;
import org.jboss.webbeans.injection.Resolver;
+import org.jboss.webbeans.injection.ServletInjector;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.literal.NewLiteral;
+import org.jboss.webbeans.manager.api.WebBeansManager;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -89,8 +93,10 @@
* @author Pete Muir
*
*/
-public class ManagerImpl implements Manager, Serializable
+public class ManagerImpl implements WebBeansManager, Serializable
{
+
+ private static final Annotation[] NEW_BINDING_ARRAY = {new NewLiteral()};
private static final long serialVersionUID = 3021562879133838561L;
@@ -139,6 +145,8 @@
private transient final NamingContext namingContext;
private final transient Map<Bean<?>, Bean<?>> specializedBeans;
+
+ private final transient ServletInjector servletInjector;
/**
* Create a new manager
@@ -163,6 +171,7 @@
this.ejbDescriptorCache = new EjbDescriptorCache();
this.currentInjectionPoint = new ThreadLocal<InjectionPoint>();
this.specializedBeans = new HashMap<Bean<?>, Bean<?>>();
+ this.servletInjector = new ServletInjector(this);
List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
defaultEnabledDeploymentTypes.add(0, Standard.class);
defaultEnabledDeploymentTypes.add(1, Production.class);
@@ -624,6 +633,11 @@
return this.<T>getInstanceToInject(injectionPoint, null);
}
+ public void injectIntoServlet(Servlet servlet)
+ {
+ servletInjector.inject(servlet);
+ }
+
@SuppressWarnings("unchecked")
public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -25,7 +25,6 @@
import javax.context.Dependent;
import javax.context.ScopeType;
import javax.event.Observes;
-import javax.inject.BindingType;
import javax.inject.CreationException;
import javax.inject.DefinitionException;
import javax.inject.DeploymentType;
@@ -39,11 +38,11 @@
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -130,24 +129,8 @@
*/
protected void initInjectionPoints()
{
- injectableFields = new HashSet<FieldInjectionPoint<?>>();
- for (AnnotatedField<?> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
- {
- if (!annotatedField.isAnnotationPresent(Produces.class))
- {
- if (annotatedField.isStatic())
- {
- throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
- }
- if (annotatedField.isFinal())
- {
- throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
- }
- FieldInjectionPoint<?> fieldInjectionPoint = FieldInjectionPoint.of(this, annotatedField);
- injectableFields.add(fieldInjectionPoint);
- super.injectionPoints.add(fieldInjectionPoint);
- }
- }
+ injectableFields = new HashSet<FieldInjectionPoint<?>>(Beans.getFieldInjectionPoints(annotatedItem, this));
+ super.injectionPoints.addAll(injectableFields);
for (AnnotatedMethod<?> initializer : getInitializerMethods())
{
for (AnnotatedParameter<?> parameter : initializer.getParameters())
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -1,6 +1,9 @@
package org.jboss.webbeans.injection;
import java.lang.annotation.Annotation;
+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;
import java.util.Arrays;
@@ -35,6 +38,22 @@
return new ResolvableAnnotatedClass<T>(clazz, clazz, annotations);
}
+ public static <T> ResolvableAnnotatedClass<T> of(Member member, Annotation[] annotations)
+ {
+ if (member instanceof Field)
+ {
+ return new ResolvableAnnotatedClass<T>((Class<T>) ((Field) member).getType(), ((Field) member).getGenericType(), annotations);
+ }
+ else if (member instanceof Method)
+ {
+ return new ResolvableAnnotatedClass<T>((Class<T>) ((Method) member).getReturnType(), ((Method) member).getGenericReturnType(), annotations);
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+
private ResolvableAnnotatedClass(Class<T> rawType, Type type, Annotation[] annotations)
{
super(AnnotationStore.of(annotations, EMPTY_ANNOTATION_ARRAY));
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ServletInjector.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ServletInjector.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ServletInjector.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,43 @@
+package org.jboss.webbeans.injection;
+
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import javax.servlet.Servlet;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.ConcurrentCache;
+
+public class ServletInjector
+{
+
+ private final ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>> servlets;
+ private final ManagerImpl manager;
+
+ public ServletInjector(ManagerImpl manager)
+ {
+ this.manager = manager;
+ this.servlets = new ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>>();
+ }
+
+ public void inject(final Servlet instance)
+ {
+ Set<FieldInjectionPoint<?>> injectionPoints = servlets.putIfAbsent(instance.getClass(), new Callable<Set<FieldInjectionPoint<?>>>()
+ {
+
+ public Set<FieldInjectionPoint<?>> call() throws Exception
+ {
+ return Beans.getFieldInjectionPoints(AnnotatedClassImpl.of(instance.getClass()), null);
+ }
+
+ }
+ );
+ for (FieldInjectionPoint<?> injectionPoint : injectionPoints)
+ {
+ injectionPoint.inject(instance, manager, null);
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ServletInjector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -17,12 +17,19 @@
package org.jboss.webbeans.util;
import java.lang.reflect.Type;
+import java.util.HashSet;
import java.util.Set;
+import javax.inject.BindingType;
+import javax.inject.DefinitionException;
+import javax.inject.Produces;
import javax.inject.manager.Bean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.injection.FieldInjectionPoint;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.metadata.MetaDataCache;
/**
@@ -92,4 +99,26 @@
return true;
}
+ public static Set<FieldInjectionPoint<?>> getFieldInjectionPoints(AnnotatedClass<?> annotatedItem, Bean<?> declaringBean)
+ {
+ Set<FieldInjectionPoint<?>> injectableFields = new HashSet<FieldInjectionPoint<?>>();
+ for (AnnotatedField<?> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
+ {
+ if (!annotatedField.isAnnotationPresent(Produces.class))
+ {
+ if (annotatedField.isStatic())
+ {
+ throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
+ }
+ if (annotatedField.isFinal())
+ {
+ throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+ }
+ FieldInjectionPoint<?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
+ injectableFields.add(fieldInjectionPoint);
+ }
+ }
+ return injectableFields;
+ }
+
}
Modified: ri/trunk/webbeans-ri-spi/pom.xml
===================================================================
--- ri/trunk/webbeans-ri-spi/pom.xml 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri-spi/pom.xml 2009-03-05 16:51:38 UTC (rev 1773)
@@ -38,6 +38,12 @@
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <optional>true</optional>
+ </dependency>
</dependencies>
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -1,11 +1,10 @@
package org.jboss.webbeans.bootstrap.api;
-import javax.inject.manager.Manager;
-
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.ejb.spi.EjbResolver;
+import org.jboss.webbeans.manager.api.WebBeansManager;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.transaction.spi.TransactionServices;
@@ -76,12 +75,12 @@
public void initialize();
/**
- * Get the manager being used for bootstrap.
+ * Get the manager used for this application.
*
* @return the manager. Unless {@link #initialize()} has been called, this
* method will return null.
*/
- public Manager getManager();
+ public WebBeansManager getManager();
/**
* Starts the boot process.
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -1,12 +1,11 @@
package org.jboss.webbeans.bootstrap.api.helpers;
-import javax.inject.manager.Manager;
-
import org.jboss.webbeans.bootstrap.api.Bootstrap;
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.ejb.spi.EjbResolver;
+import org.jboss.webbeans.manager.api.WebBeansManager;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -20,7 +19,7 @@
delegate().boot();
}
- public Manager getManager()
+ public WebBeansManager getManager()
{
return delegate().getManager();
}
Added: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java (rev 0)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.manager.api;
+
+import javax.inject.manager.Manager;
+import javax.servlet.Servlet;
+
+public interface WebBeansManager extends Manager
+{
+
+ public void injectIntoServlet(Servlet servlet);
+
+}
Property changes on: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/packaging/ear/EarArtifactDescriptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/packaging/ear/EarArtifactDescriptor.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/packaging/ear/EarArtifactDescriptor.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -5,6 +5,7 @@
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Writer;
+import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
@@ -117,6 +118,14 @@
@Override
public void create() throws IOException
{
+ for (ResourceDescriptor resource : new HashSet<ResourceDescriptor>(getResources()))
+ {
+ if (resource.getName().startsWith("war"))
+ {
+ getResources().remove(resource);
+ war.getResources().add(new ResourceDescriptor(resource.getName().substring(3), resource.getSource()));
+ }
+ }
getResources().add(new ResourceDescriptor(war.getDefaultName(), war.getJar()));
getResources().add(new ResourceDescriptor(ejbJar.getDefaultName(), ejbJar.getJar()));
super.create();
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Barn.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Barn.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Barn.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import java.io.Serializable;
+
+public class Barn implements Serializable
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Barn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Farm.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Farm.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Farm.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import java.io.Serializable;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+
+@Stateful
+public class Farm implements FarmLocal, Serializable
+{
+
+ @Current Barn barn;
+
+ @Remove
+ public void remove()
+ {
+
+ }
+
+ public Barn getBarn()
+ {
+ return barn;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Farm.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/FarmLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/FarmLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/FarmLocal.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import javax.ejb.Local;
+
+@Local
+public interface FarmLocal
+{
+
+ public Barn getBarn();
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/FarmLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Hamlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Hamlet.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Hamlet.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import javax.annotation.Resource;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+@Stateful
+public class Hamlet implements HamletLocal
+{
+
+ @Resource(mappedName="java:comp/env/servlet-test-runner/Farm/local") FarmLocal farm;
+
+ @Remove
+ public void remove() {}
+
+ public FarmLocal getFarm()
+ {
+ return farm;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Hamlet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/HamletLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/HamletLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/HamletLocal.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import javax.ejb.Local;
+
+@Local
+public interface HamletLocal
+{
+
+ public FarmLocal getFarm();
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/HamletLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/NonContextualInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/NonContextualInjectionTest.java 2009-03-05 13:56:44 UTC (rev 1772)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/NonContextualInjectionTest.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -2,6 +2,10 @@
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Packaging;
+import org.jboss.jsr299.tck.impl.packaging.PackagingType;
import org.testng.annotations.Test;
/**
@@ -9,60 +13,37 @@
* Spec version: PRD2
*
*/
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
public class NonContextualInjectionTest extends AbstractDeclarativeTest
{
- /**
- * For the purposes of dependency injection and interceptor/decorator stack
- * creation, the container must treat non-contextual instances of session
- * beans as instances of the most specialized bean that specializes the bean
- * with binding @New and de- ployment type @Standard defined in Section
- * 3.3.6, "Session beans with the @New binding".
- */
- @Test(groups = { "stub", "integration" })
- @SpecAssertion(section = "5.12.1", id = "p")
- public void testNonContextualSessionBeanSpecializesNewBeanForInjection()
+ @Test(groups = { "integration", "stub" })
+ @SpecAssertion(section = "5.12.1", id = "a")
+ public void testInjectionIntoSessionBeanLookedUpInJndi() throws Exception
{
+ // Quite tough as no universal names. Need to allow these to be specified or something...
assert false;
}
-
- /**
- * Session bean instances obtained directly from JNDI, injected using @EJB or
- * @Resource, or created by the container to re- ceive remote method calls or
- * timeouts are not contextual instances. However, the container is still
- * required to perform de- pendency injection and create interceptor and
- * decorator stacks for these instances.
- */
- @Test(groups = { "stub", "integration" })
- @SpecAssertion(section = "5.12.1", id = "q")
- public void testNonContextualSessionBeanSpecializesNewBeanForInterceptorStack()
+
+ @Test(groups = { "integration" })
+ @SpecAssertion(section = "5.12.1", id = "a")
+ public void testInjectionIntoSessionBeanInjectedViaEjb() throws Exception
{
- assert false;
+ assert getCurrentManager().resolveByType(VillageLocal.class).size() == 1;
+ assert getCurrentManager().getInstanceByType(VillageLocal.class).getFarm().getBarn() != null;
}
-
- /**
- * Session bean instances obtained directly from JNDI, injected using @EJB or
- * @Resource, or created by the container to re- ceive remote method calls or
- * timeouts are not contextual instances. However, the container is still
- * required to perform de- pendency injection and create interceptor and
- * decorator stacks for these instances.
- */
- @Test(groups = { "stub", "integration" })
- @SpecAssertion(section = "5.12.1", id = "r")
- public void testNonContextualSessionBeanSpecializesNewBeanForDecoratorStack()
+
+ @Test(groups = { "integration", "broken" })
+ @SpecAssertion(section = "5.12.1", id = "a")
+ public void testInjectionIntoSessionBeanInjectedViaResource() throws Exception
{
- assert false;
+ // Quite tough as no universal names. Need to allow these to be specified or something...
+ assert getCurrentManager().resolveByType(HamletLocal.class).size() == 1;
+ assert getCurrentManager().getInstanceByType(HamletLocal.class).getFarm().getBarn() != null;
}
-
- /**
- * Message-driven beans do not have contextual instances. However, the
- * container is still required to perform dependency in- jection and create
- * interceptor and decorator stacks.
- *
- * The container performs dependency injection and creates interceptor and
- * decorator stacks for message-driven bean in- stances according to the bean
- * class annotations.
- */
+
@Test(groups = { "stub", "integration" })
@SpecAssertion(section = "5.12.2", id = "a")
public void testInjectionIntoMessageDrivenBean()
@@ -70,12 +51,6 @@
assert false;
}
- /**
- * Servlets do not have contextual instances. However, the container is still
- * required to perform dependency injection. The container performs
- * dependency injection for servlets according to the servlet class
- * annotations.
- */
@Test(groups = { "stub", "integration" })
@SpecAssertion(section = "5.12.3", id = "a")
public void testInjectionIntoServlet()
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Village.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Village.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Village.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import javax.ejb.EJB;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+@Stateful
+public class Village implements VillageLocal
+{
+
+ @EJB FarmLocal farm;
+
+ @Remove
+ public void remove() {}
+
+ public FarmLocal getFarm()
+ {
+ return farm;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/Village.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/VillageLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/VillageLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/VillageLocal.java 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.nonContextual;
+
+import javax.ejb.Local;
+
+@Local
+public interface VillageLocal
+{
+
+ public FarmLocal getFarm();
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/nonContextual/VillageLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/beans.xml 2009-03-05 16:51:38 UTC (rev 1773)
@@ -0,0 +1,7 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.lookup.nonContextual">
+ <Deploy>
+ <Standard />
+ <Production />
+ </Deploy>
+</Beans>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/nonContextual/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1771 - in examples/trunk: conversations and 20 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-05 07:44:41 -0500 (Thu, 05 Mar 2009)
New Revision: 1771
Added:
examples/trunk/conversations/
examples/trunk/conversations/WebContent/
examples/trunk/conversations/WebContent/WEB-INF/
examples/trunk/conversations/WebContent/WEB-INF/beans.xml
examples/trunk/conversations/WebContent/WEB-INF/faces-config.xml
examples/trunk/conversations/WebContent/WEB-INF/web.xml
examples/trunk/conversations/WebContent/home.xhtml
examples/trunk/conversations/WebContent/index.html
examples/trunk/conversations/WebContent/style/
examples/trunk/conversations/WebContent/template.xhtml
examples/trunk/conversations/build.xml
examples/trunk/conversations/pom.xml
examples/trunk/conversations/src/
examples/trunk/conversations/src/main/
examples/trunk/conversations/src/main/java/
examples/trunk/conversations/src/main/java/org/
examples/trunk/conversations/src/main/java/org/jboss/
examples/trunk/conversations/src/main/java/org/jboss/webbeans/
examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/
examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/conversations/
examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/conversations/Conversations.java
examples/trunk/conversations/src/main/resources/
examples/trunk/conversations/src/main/resources/META-INF/
examples/trunk/conversations/target/
examples/trunk/conversations/target/classes/
examples/trunk/conversations/target/classes/org/
examples/trunk/conversations/target/classes/org/jboss/
examples/trunk/conversations/target/classes/org/jboss/webbeans/
examples/trunk/conversations/target/classes/org/jboss/webbeans/examples/
examples/trunk/conversations/target/classes/org/jboss/webbeans/examples/conversations/
examples/trunk/conversations/target/classes/org/jboss/webbeans/examples/conversations/Conversations.class
Removed:
examples/trunk/numberguess/WebContent/conversations.xhtml
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java
Log:
split conversation example out from numberguess
Added: examples/trunk/conversations/WebContent/WEB-INF/beans.xml
===================================================================
Added: examples/trunk/conversations/WebContent/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/conversations/WebContent/WEB-INF/faces-config.xml (rev 0)
+++ examples/trunk/conversations/WebContent/WEB-INF/faces-config.xml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+</faces-config>
Added: examples/trunk/conversations/WebContent/WEB-INF/web.xml
===================================================================
--- examples/trunk/conversations/WebContent/WEB-INF/web.xml (rev 0)
+++ examples/trunk/conversations/WebContent/WEB-INF/web.xml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>Web Beans Conversations example</display-name>
+
+ <!-- JSF -->
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Added: examples/trunk/conversations/WebContent/home.xhtml
===================================================================
--- examples/trunk/conversations/WebContent/home.xhtml (rev 0)
+++ examples/trunk/conversations/WebContent/home.xhtml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="content">
+ <h:form>
+ <h:panelGrid columns="1">
+ <h:outputText value="Long-running: #{conversations.conversationList}"/>
+ <h:outputText value="Current: #{conversation}"/>
+ <h:panelGroup>
+ <h:commandButton action="#{conversation.begin}" value="begin"/>
+ <h:commandButton action="#{conversations.noop}" value="noop"/>
+ <h:commandButton action="#{conversation.end}" value="end"/>
+ <h:commandButton action="#{conversations.abandon}" value="abandon"/>
+ </h:panelGroup>
+ <h:inputText value="#{conversations.cid}"/>
+ <h:commandButton action="#{conversations.switchConversation}" value="switch"/>
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</html>
Added: examples/trunk/conversations/WebContent/index.html
===================================================================
--- examples/trunk/conversations/WebContent/index.html (rev 0)
+++ examples/trunk/conversations/WebContent/index.html 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=home.jsf">
+</head>
+</html>
\ No newline at end of file
Added: examples/trunk/conversations/WebContent/template.xhtml
===================================================================
--- examples/trunk/conversations/WebContent/template.xhtml (rev 0)
+++ examples/trunk/conversations/WebContent/template.xhtml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Conversations</title>
+ <link href="style/main.css" rel="stylesheet" type="text/css"/>
+ <ui:insert name="head"/>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="header">
+
+ </div>
+
+ <div id="sidebar">
+
+ </div>
+
+ <div id="content">
+ <ui:insert name="content"/>
+ </div>
+
+ <br style="clear:both"/>
+ </div>
+
+</body>
+</html>
+
Added: examples/trunk/conversations/build.xml
===================================================================
--- examples/trunk/conversations/build.xml (rev 0)
+++ examples/trunk/conversations/build.xml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,7 @@
+<project basedir="." name="Conversations Example Build" default="restart">
+
+ <property name="example.name" value="webbeans-conversations" />
+
+ <import file="../build.xml" />
+
+</project>
\ No newline at end of file
Added: examples/trunk/conversations/pom.xml
===================================================================
--- examples/trunk/conversations/pom.xml (rev 0)
+++ examples/trunk/conversations/pom.xml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>webbeans-conversations</artifactId>
+ <packaging>war</packaging>
+ <name>Web Beans Examples: Conversations</name>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>codehaus snapshot repository</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <!-- <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>-->
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>webbeans-conversations</finalName>
+ </build>
+
+</project>
+
Added: examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/conversations/Conversations.java
===================================================================
--- examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/conversations/Conversations.java (rev 0)
+++ examples/trunk/conversations/src/main/java/org/jboss/webbeans/examples/conversations/Conversations.java 2009-03-05 12:44:41 UTC (rev 1771)
@@ -0,0 +1,72 @@
+package org.jboss.webbeans.examples.conversations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.SessionScoped;
+import javax.faces.model.SelectItem;
+import javax.inject.Current;
+import javax.inject.Produces;
+
+import java.io.Serializable;
+
+import org.jboss.webbeans.conversation.ConversationIdGenerator;
+import org.jboss.webbeans.conversation.ConversationManager;
+import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
+
+@SessionScoped
+@Named("conversations")
+public class Conversations implements Serializable {
+
+ @Current private Conversation conversation;
+ @Current private ConversationIdGenerator id;
+ @Current private ConversationManager conversationManager;
+ private String cid;
+
+ public Conversations()
+ {
+ }
+
+ public void abandon()
+ {
+ conversation.begin(id.nextId());
+ }
+
+ public void noop()
+ {
+
+ }
+
+ public Iterable<Conversation> getConversationList()
+ {
+ return conversationManager.getLongRunningConversations();
+ }
+
+ public List<SelectItem> getLongRunningConversations()
+ {
+ List<SelectItem> longRunningConversations = new ArrayList<SelectItem>();
+ for (Conversation conversation : conversationManager.getLongRunningConversations())
+ {
+ longRunningConversations.add(new SelectItem(conversation.getId(), conversation.getId()));
+ }
+ return longRunningConversations;
+ }
+
+ public void switchConversation()
+ {
+ conversation.begin(cid);
+ }
+
+ public String getCid()
+ {
+ return cid;
+ }
+
+ public void setCid(String cid)
+ {
+ this.cid = cid;
+ }
+
+}
\ No newline at end of file
Added: examples/trunk/conversations/target/classes/org/jboss/webbeans/examples/conversations/Conversations.class
===================================================================
(Binary files differ)
Property changes on: examples/trunk/conversations/target/classes/org/jboss/webbeans/examples/conversations/Conversations.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: examples/trunk/numberguess/WebContent/conversations.xhtml
===================================================================
--- examples/trunk/numberguess/WebContent/conversations.xhtml 2009-03-05 08:00:16 UTC (rev 1770)
+++ examples/trunk/numberguess/WebContent/conversations.xhtml 2009-03-05 12:44:41 UTC (rev 1771)
@@ -1,25 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core">
-
- <ui:composition template="template.xhtml">
- <ui:define name="content">
- <h:form>
- <h:panelGrid columns="1">
- <h:outputText value="Long-running: #{conversations.conversationList}"/>
- <h:outputText value="Current: #{conversation}"/>
- <h:panelGroup>
- <h:commandButton action="#{conversation.begin}" value="begin"/>
- <h:commandButton action="#{conversations.noop}" value="noop"/>
- <h:commandButton action="#{conversation.end}" value="end"/>
- <h:commandButton action="#{conversations.abandon}" value="abandon"/>
- </h:panelGroup>
- <h:inputText value="#{conversations.cid}"/>
- <h:commandButton action="#{conversations.switchConversation}" value="switch"/>
- </h:panelGrid>
- </h:form>
- </ui:define>
- </ui:composition>
-</html>
Deleted: examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java
===================================================================
--- examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java 2009-03-05 08:00:16 UTC (rev 1770)
+++ examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java 2009-03-05 12:44:41 UTC (rev 1771)
@@ -1,72 +0,0 @@
-package org.jboss.webbeans.examples.numberguess;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Named;
-import javax.context.Conversation;
-import javax.context.SessionScoped;
-import javax.faces.model.SelectItem;
-import javax.inject.Current;
-import javax.inject.Produces;
-
-import java.io.Serializable;
-
-import org.jboss.webbeans.conversation.ConversationIdGenerator;
-import org.jboss.webbeans.conversation.ConversationManager;
-import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
-
-@SessionScoped
-@Named("conversations")
-public class Conversations implements Serializable {
-
- @Current private Conversation conversation;
- @Current private ConversationIdGenerator id;
- @Current private ConversationManager conversationManager;
- private String cid;
-
- public Conversations()
- {
- }
-
- public void abandon()
- {
- conversation.begin(id.nextId());
- }
-
- public void noop()
- {
-
- }
-
- public Iterable<Conversation> getConversationList()
- {
- return conversationManager.getLongRunningConversations();
- }
-
- public List<SelectItem> getLongRunningConversations()
- {
- List<SelectItem> longRunningConversations = new ArrayList<SelectItem>();
- for (Conversation conversation : conversationManager.getLongRunningConversations())
- {
- longRunningConversations.add(new SelectItem(conversation.getId(), conversation.getId()));
- }
- return longRunningConversations;
- }
-
- public void switchConversation()
- {
- conversation.begin(cid);
- }
-
- public String getCid()
- {
- return cid;
- }
-
- public void setCid(String cid)
- {
- this.cid = cid;
- }
-
-}
\ No newline at end of file
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1770 - in examples/trunk/numberguess: src/main/java/org/jboss/webbeans/examples/numberguess and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-05 03:00:16 -0500 (Thu, 05 Mar 2009)
New Revision: 1770
Added:
examples/trunk/numberguess/WebContent/conversations.xhtml
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java
Log:
Temp conversation test piggybacking on the numberguess build
Added: examples/trunk/numberguess/WebContent/conversations.xhtml
===================================================================
--- examples/trunk/numberguess/WebContent/conversations.xhtml (rev 0)
+++ examples/trunk/numberguess/WebContent/conversations.xhtml 2009-03-05 08:00:16 UTC (rev 1770)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="content">
+ <h:form>
+ <h:panelGrid columns="1">
+ <h:outputText value="Long-running: #{conversations.conversationList}"/>
+ <h:outputText value="Current: #{conversation}"/>
+ <h:panelGroup>
+ <h:commandButton action="#{conversation.begin}" value="begin"/>
+ <h:commandButton action="#{conversations.noop}" value="noop"/>
+ <h:commandButton action="#{conversation.end}" value="end"/>
+ <h:commandButton action="#{conversations.abandon}" value="abandon"/>
+ </h:panelGroup>
+ <h:inputText value="#{conversations.cid}"/>
+ <h:commandButton action="#{conversations.switchConversation}" value="switch"/>
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</html>
Added: examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java
===================================================================
--- examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java (rev 0)
+++ examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Conversations.java 2009-03-05 08:00:16 UTC (rev 1770)
@@ -0,0 +1,72 @@
+package org.jboss.webbeans.examples.numberguess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.SessionScoped;
+import javax.faces.model.SelectItem;
+import javax.inject.Current;
+import javax.inject.Produces;
+
+import java.io.Serializable;
+
+import org.jboss.webbeans.conversation.ConversationIdGenerator;
+import org.jboss.webbeans.conversation.ConversationManager;
+import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
+
+@SessionScoped
+@Named("conversations")
+public class Conversations implements Serializable {
+
+ @Current private Conversation conversation;
+ @Current private ConversationIdGenerator id;
+ @Current private ConversationManager conversationManager;
+ private String cid;
+
+ public Conversations()
+ {
+ }
+
+ public void abandon()
+ {
+ conversation.begin(id.nextId());
+ }
+
+ public void noop()
+ {
+
+ }
+
+ public Iterable<Conversation> getConversationList()
+ {
+ return conversationManager.getLongRunningConversations();
+ }
+
+ public List<SelectItem> getLongRunningConversations()
+ {
+ List<SelectItem> longRunningConversations = new ArrayList<SelectItem>();
+ for (Conversation conversation : conversationManager.getLongRunningConversations())
+ {
+ longRunningConversations.add(new SelectItem(conversation.getId(), conversation.getId()));
+ }
+ return longRunningConversations;
+ }
+
+ public void switchConversation()
+ {
+ conversation.begin(cid);
+ }
+
+ public String getCid()
+ {
+ return cid;
+ }
+
+ public void setCid(String cid)
+ {
+ this.cid = cid;
+ }
+
+}
\ No newline at end of file
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1769 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: conversation and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-05 02:53:41 -0500 (Thu, 05 Mar 2009)
New Revision: 1769
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
Log:
Conversation changes. Still something strange in the lifecycle with conversation switching...
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -22,7 +22,6 @@
import javax.context.ContextNotActiveException;
import javax.context.Contextual;
import javax.context.CreationalContext;
-import javax.inject.manager.Bean;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.log.LogProvider;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -36,8 +36,8 @@
{
private static LogProvider log = Logging.getLogProvider(ConversationEntry.class);
- // The conversation ID
- private String cid;
+ // The conversation
+ private ConversationImpl conversation;
// The handle to the asynchronous timeout task
private Future<?> terminationHandle;
// The lock for concurrent access prevention
@@ -49,12 +49,13 @@
* @param cid The conversation ID
* @param terminationHandle The timeout termination handle
*/
- protected ConversationEntry(String cid, Future<?> terminationHandle)
+ protected ConversationEntry(ConversationImpl conversation, Future<?> terminationHandle)
{
- this.cid = cid;
+ // conversation is a proxy so we need to make a "real" instance
+ this.conversation = new ConversationImpl(conversation);
this.terminationHandle = terminationHandle;
this.concurrencyLock = new ReentrantLock();
- log.trace("Created new conversation entry for conversation " + cid);
+ log.trace("Created new conversation entry for conversation " + conversation);
}
/**
@@ -64,9 +65,9 @@
* @param terminationHandle The timeout termination handle
* @return A new conversation entry
*/
- public static ConversationEntry of(String cid, Future<?> terminationHandle)
+ public static ConversationEntry of(ConversationImpl conversation, Future<?> terminationHandle)
{
- return new ConversationEntry(cid, terminationHandle);
+ return new ConversationEntry(conversation, terminationHandle);
}
/**
@@ -79,11 +80,11 @@
boolean success = terminationHandle.cancel(false);
if (success)
{
- log.trace("Termination of conversation " + cid + " cancelled");
+ log.trace("Termination of conversation " + conversation + " cancelled");
}
else
{
- log.warn("Failed to cancel termination of conversation " + cid);
+ log.warn("Failed to cancel termination of conversation " + conversation);
}
return success;
}
@@ -95,51 +96,53 @@
*/
public void destroy(HttpSession session)
{
- log.debug("Destroying conversation " + cid);
+ log.debug("Destroying conversation " + conversation);
if (!terminationHandle.isCancelled())
{
cancelTermination();
}
ConversationContext terminationContext = new ConversationContext();
- terminationContext.setBeanStore(new ConversationBeanStore(session, cid));
+ terminationContext.setBeanStore(new ConversationBeanStore(session, conversation.getId()));
terminationContext.destroy();
- log.trace("Conversation " + cid + " destroyed");
+ log.trace("Conversation " + conversation + " destroyed");
}
/**
* Attempts to lock the conversation for exclusive usage
*
- * @param timeoutInMilliseconds The time in milliseconds to wait on the lock
+ * @param timeout The time in milliseconds to wait on the lock
* @return True if lock was successful, false otherwise
* @throws InterruptedException If the lock operation was unsuccessful
*/
- public boolean lock(long timeoutInMilliseconds) throws InterruptedException
+ public boolean lock(long timeout) throws InterruptedException
{
- boolean success = concurrencyLock.tryLock(timeoutInMilliseconds, TimeUnit.MILLISECONDS);
+ boolean success = concurrencyLock.tryLock(timeout, TimeUnit.MILLISECONDS);
if (success)
{
- log.trace("Conversation " + cid + " locked");
+ log.trace("Conversation " + conversation + " locked");
}
else
{
- log.warn("Failed to lock conversation " + cid + " in " + timeoutInMilliseconds + "ms");
+ log.warn("Failed to lock conversation " + conversation + " in " + timeout + "ms");
}
return success;
}
/**
* Attempts to unlock the conversation
+ *
+ * @return true if the unlock was successful, false otherwise
*/
public boolean unlock()
{
if (concurrencyLock.isHeldByCurrentThread())
{
- log.trace("Unlocked conversation " + cid);
concurrencyLock.unlock();
+ log.trace("Unlocked conversation " + conversation);
}
else
{
- log.warn("Unlock attempt by non-owner on conversation " + cid);
+ log.warn("Unlock attempt by non-owner on conversation " + conversation);
}
return !concurrencyLock.isLocked();
}
@@ -151,8 +154,12 @@
*/
public void reScheduleTermination(Future<?> terminationHandle)
{
- log.trace("Conversation " + cid + " re-scheduled for termination");
this.terminationHandle = terminationHandle;
+ log.trace("Conversation " + conversation + " re-scheduled for termination");
}
+ public ConversationImpl getConversation()
+ {
+ return conversation;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -47,8 +47,8 @@
private String originalCid;
// Is the conversation long-running?
private boolean longRunning;
- // The inactivity timeout in milliseconds
- private long timeoutInMilliseconds;
+ // The timeout in milliseconds
+ private long timeout;
/**
* Creates a new conversation
@@ -58,16 +58,28 @@
}
/**
+ * Creates a new conversation from an existing one.
+ *
+ * @param conversation The old conversation
+ */
+ public ConversationImpl(ConversationImpl conversation)
+ {
+ this.cid = conversation.getId();
+ this.longRunning = conversation.isLongRunning();
+ this.timeout = conversation.getTimeout();
+ }
+
+ /**
* Initializes a new conversation
*
* @param conversationIdGenerator The conversation ID generator
- * @param timeoutInMilliseconds The inactivity timeout in milliseconds
*/
@Initializer
- public void init(ConversationIdGenerator conversationIdGenerator, @ConversationInactivityTimeout long timeoutInMilliseconds)
+ public void init(ConversationIdGenerator conversationIdGenerator, @ConversationInactivityTimeout long timeout)
{
this.cid = conversationIdGenerator.nextId();
- this.timeoutInMilliseconds = timeoutInMilliseconds;
+ this.timeout = timeout;
+ this.longRunning = false;
log.debug("Created a new conversation " + this);
}
@@ -100,7 +112,7 @@
public long getTimeout()
{
- return timeoutInMilliseconds;
+ return timeout;
}
public boolean isLongRunning()
@@ -110,30 +122,28 @@
public void setTimeout(long timeout)
{
- log.debug("Set timeout of conversation " + cid + " to " + timeout);
- this.timeoutInMilliseconds = timeout;
+ this.timeout = timeout;
}
/**
* Assumes the identity of another conversation
*
- * @param cid The new conversation ID
- * @param longRunning The new long-running status
- * @param timeout The new inactivity timeout in milliseconds
+ * @param conversation The new conversation identity
+ *
*/
- public void switchTo(String cid, boolean longRunning, long timeoutInMilliseconds)
+ public void switchTo(Conversation conversation)
{
log.debug("Switched conversation from " + this);
- this.cid = cid;
- this.longRunning = longRunning;
- this.timeoutInMilliseconds = timeoutInMilliseconds;
- log.debug("to " + this);
+ cid = conversation.getId();
+ longRunning = conversation.isLongRunning();
+ timeout = conversation.getTimeout();
+ log.debug(" to " + this);
}
@Override
public String toString()
{
- return "ID: " + cid + ", long-running: " + longRunning + ", timeout: " + timeoutInMilliseconds;
+ return "ID: " + cid + ", long-running: " + longRunning + ", timeout: " + timeout;
}
public void setLongRunning(boolean longRunning)
@@ -142,6 +152,11 @@
this.longRunning = longRunning;
}
+ /**
+ * Gets the original ID of the conversation
+ *
+ * @return The id
+ */
public String getOriginalCid()
{
return originalCid;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -16,6 +16,10 @@
*/
package org.jboss.webbeans.conversation;
+import java.util.Set;
+
+import javax.context.Conversation;
+
/**
* A conversation manager responsible for starting, resuming and ending conversations
*
@@ -42,4 +46,11 @@
*/
public abstract void destroyAllConversations();
+ /**
+ * Gets the currently managed long-running conversations
+ *
+ * @return the conversations
+ */
+ public abstract Set<Conversation> getLongRunningConversations();
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -17,10 +17,14 @@
package org.jboss.webbeans.conversation;
import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
+import javax.context.Conversation;
import javax.context.SessionScoped;
import javax.inject.Current;
import javax.inject.Produces;
@@ -65,10 +69,6 @@
@ConversationConcurrentAccessTimeout
private long concurrentAccessTimeout;
- // The conversation inactivity timeout in milliseconds
- @ConversationInactivityTimeout
- private long inactivityTimeout;
-
// A map of current active long-running conversation entries
private Map<String, ConversationEntry> longRunningConversations;
@@ -125,13 +125,13 @@
log.info("Could not restore long-running conversation " + cid);
return;
}
+ ConversationEntry resumedConversationEntry = longRunningConversations.get(cid);
// Try to get a lock to the requested conversation, log and return to
// continue with a transient conversation if we fail
try
{
- if (!longRunningConversations.get(cid).lock(concurrentAccessTimeout))
+ if (!resumedConversationEntry.lock(concurrentAccessTimeout))
{
- log.debug("Could not acquire conversation lock in " + concurrentAccessTimeout + "ms, giving up");
return;
}
}
@@ -143,16 +143,16 @@
// If we can't cancel the termination, release the lock, return and
// continue
// with a transient conversation
- if (!longRunningConversations.get(cid).cancelTermination())
+ if (!resumedConversationEntry.cancelTermination())
{
- longRunningConversations.get(cid).unlock();
+ resumedConversationEntry.unlock();
}
else
{
// If all goes well, set the identity of the current conversation to
// match the fetched long-running one
String oldConversation = currentConversation.toString();
- currentConversation.switchTo(cid, true, inactivityTimeout);
+ currentConversation.switchTo(resumedConversationEntry.getConversation());
log.trace("Conversation switched from " + oldConversation + " to " + currentConversation);
}
}
@@ -161,11 +161,11 @@
// long-running conversations
public void cleanupConversation()
{
+ log.trace("Cleaning up conversation for " + currentConversation);
String cid = currentConversation.getId();
- log.trace("Cleaning up conversations for cid " + cid);
if (currentConversation.isLongRunning())
{
- Future<?> terminationHandle = scheduleForTermination(cid);
+ Future<?> terminationHandle = scheduleForTermination(cid, currentConversation.getTimeout());
// When the conversation ends, a long-running conversation needs to
// start its self-destruct. We can have the case where the conversation
// is a previously known conversation (that had it's termination
@@ -179,7 +179,7 @@
}
else
{
- ConversationEntry conversationEntry = ConversationEntry.of(cid, terminationHandle);
+ ConversationEntry conversationEntry = ConversationEntry.of(currentConversation, terminationHandle);
longRunningConversations.put(cid, conversationEntry);
}
log.trace("Scheduled " + currentConversation + " for termination, there are now " + longRunningConversations.size() + " long-running conversations");
@@ -192,19 +192,27 @@
log.trace("Destroying transient conversation " + currentConversation);
if (longRunningConversations.containsKey(cid))
{
- longRunningConversations.get(cid).cancelTermination();
- longRunningConversations.get(cid).unlock();
+ ConversationEntry removedConversationEntry = longRunningConversations.remove(cid);
+ if (removedConversationEntry != null)
+ {
+ removedConversationEntry.cancelTermination();
+ removedConversationEntry.unlock();
+ }
+ else
+ {
+ log.debug("Failed to remove long-running conversation " + cid + " from list");
+ }
}
ConversationContext.INSTANCE.destroy();
}
- // If Conversation.begin(String) is called, it might be that the
- // conversation will be switched. We need to unlock this original
- // conversation and re-schedule it for termination
+ // If the conversation has been switched from one long running-conversation to another with
+ // Conversation.begin(String), we need to unlock the original conversation and re-schedule
+ // it for termination
String originalCid = currentConversation.getOriginalCid();
if (originalCid != null && longRunningConversations.containsKey(originalCid))
{
longRunningConversations.get(originalCid).unlock();
- longRunningConversations.get(originalCid).reScheduleTermination(scheduleForTermination(originalCid));
+ longRunningConversations.get(originalCid).reScheduleTermination(scheduleForTermination(originalCid, currentConversation.getTimeout()));
}
}
@@ -214,11 +222,11 @@
* @param cid The id of the conversation to terminate
* @return The asynchronous job handle
*/
- private Future<?> scheduleForTermination(String cid)
+ private Future<?> scheduleForTermination(String cid, long timeout)
{
HttpSession session = CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).getSession();
Runnable terminationTask = new TerminationTask(cid, session);
- return conversationTerminator.scheduleForTermination(terminationTask, inactivityTimeout);
+ return conversationTerminator.scheduleForTermination(terminationTask, timeout);
}
/**
@@ -266,4 +274,14 @@
longRunningConversations.clear();
}
+ public Set<Conversation> getLongRunningConversations()
+ {
+ Set<Conversation> conversations = new HashSet<Conversation>();
+ for (ConversationEntry conversationEntry : longRunningConversations.values())
+ {
+ conversations.add(conversationEntry.getConversation());
+ }
+ return Collections.unmodifiableSet(conversations);
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,80 +1,78 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.introspector;
-
-import java.lang.reflect.Field;
-
-import javax.inject.manager.Manager;
-
-/**
- * AnnotatedField provides a uniform access to the annotations on an annotated
- * field
- *
- * @author Pete Muir
- *
- */
-public interface AnnotatedField<T> extends AnnotatedMember<T, Field>
-{
-
- /**
- * Gets the annotated field
- *
- * @return The annotated field
- */
- public Field getAnnotatedField();
-
- /**
- * Injects an instance
- *
- *
- * @param declaringInstance The instance to inject into
- * @param value The value to inject
- */
- public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
-
- /**
- * Injects into the field using the value provided by the manager
- *
- * Unlike {@link #set(Object, Manager)} the field injected into is
- * discovered from the declaring instance. This is slower, but safe to use
- * with proxies.
- *
- * @param declaringInstance The instance to inject into
- * @param value The value to inject
- */
- public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException;
-
- public T get(Object instance);
-
- /**
- * Gets an abstraction of the declaring class
- *
- * @return The declaring class
- */
- public AnnotatedType<?> getDeclaringClass();
-
- /**
- * Gets the property name of the field
- *
- * @return The name
- */
- public String getPropertyName();
-
- public boolean isTransient();
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Field;
+
+/**
+ * AnnotatedField provides a uniform access to the annotations on an annotated
+ * field
+ *
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedField<T> extends AnnotatedMember<T, Field>
+{
+
+ /**
+ * Gets the annotated field
+ *
+ * @return The annotated field
+ */
+ public Field getAnnotatedField();
+
+ /**
+ * Injects an instance
+ *
+ *
+ * @param declaringInstance The instance to inject into
+ * @param value The value to inject
+ */
+ public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
+
+ /**
+ * Injects into the field using the value provided by the manager
+ *
+ * Unlike {@link #set(Object, Manager)} the field injected into is
+ * discovered from the declaring instance. This is slower, but safe to use
+ * with proxies.
+ *
+ * @param declaringInstance The instance to inject into
+ * @param value The value to inject
+ */
+ public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException;
+
+ public T get(Object instance);
+
+ /**
+ * Gets an abstraction of the declaring class
+ *
+ * @return The declaring class
+ */
+ public AnnotatedType<?> getDeclaringClass();
+
+ /**
+ * Gets the property name of the field
+ *
+ * @return The name
+ */
+ public String getPropertyName();
+
+ public boolean isTransient();
+
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,264 +1,263 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedConstructor;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.util.Names;
-
-/**
- * Represents an annotated constructor
- *
- * This class is immutable, and therefore threadsafe
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
-{
-
-
- // The type arguments
- private static final Type[] actualTypeArguments = new Type[0];
- // The underlying constructor
- private final Constructor<T> constructor;
-
- // The list of parameter abstractions
- private final List<AnnotatedParameter<?>> parameters;
- // The mapping of annotation -> parameter abstraction
- private final AnnotatedParameterMap annotatedParameters;
-
- // The declaring class abstraction
- private final AnnotatedType<T> declaringClass;
-
- // Cached string representation
- private String toString;
-
- public static <T> AnnotatedConstructor<T> of(Constructor<T> constructor, AnnotatedType<T> declaringClass)
- {
- return new AnnotatedConstructorImpl<T>(constructor, declaringClass);
- }
-
- /**
- * Constructor
- *
- * Initializes the superclass with the build annotations map
- *
- * @param constructor The constructor method
- * @param declaringClass The declaring class
- */
- public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
- {
- super(AnnotationStore.of(constructor), constructor);
- this.constructor = constructor;
- this.declaringClass = declaringClass;
-
- this.parameters = new ArrayList<AnnotatedParameter<?>>();
- annotatedParameters = new AnnotatedParameterMap();
- for (int i = 0; i < constructor.getParameterTypes().length; i++)
- {
- if (constructor.getParameterAnnotations()[i].length > 0)
- {
- Class<?> clazz = constructor.getParameterTypes()[i];
- AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, this);
- parameters.add(parameter);
-
- for (Annotation annotation : parameter.getAnnotationsAsSet())
- {
- annotatedParameters.put(annotation.annotationType(), parameter);
- }
- }
- else
- {
- Class<?> clazz = constructor.getParameterTypes()[i];
- AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(new Annotation[0], clazz, this);
- parameters.add(parameter);
-
- for (Annotation annotation : parameter.getAnnotationsAsSet())
- {
- annotatedParameters.put(annotation.annotationType(), parameter);
- }
- }
- }
- }
-
- /**
- * Gets the constructor
- *
- * @return The constructor
- */
- public Constructor<T> getAnnotatedConstructor()
- {
- return constructor;
- }
-
- /**
- * Gets the delegate (constructor)
- *
- * @return The delegate
- */
- public Constructor<T> getDelegate()
- {
- return constructor;
- }
-
- /**
- * Gets the type of the constructor
- *
- * @return The type of the constructor
- */
- public Class<T> getType()
- {
- return constructor.getDeclaringClass();
- }
-
- /**
- * Gets the actual type arguments
- *
- * @return The type arguments
- *
- * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getActualTypeArguments()
- */
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- /**
- * Gets the abstracted parameters
- *
- * If the parameters are null, initalize them first
- *
- * @return A list of annotated parameter abstractions
- *
- * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getParameters()
- */
- public List<AnnotatedParameter<?>> getParameters()
- {
- return Collections.unmodifiableList(parameters);
- }
-
- /**
- * Gets parameter abstractions with a given annotation type.
- *
- * If the parameters are null, they are initializes first.
- *
- * @param annotationType The annotation type to match
- * @return A list of matching parameter abstractions. An empty list is
- * returned if there are no matches.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getAnnotatedParameters(Class)
- */
- public List<AnnotatedParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
- {
- return Collections.unmodifiableList(annotatedParameters.get(annotationType));
- }
-
- /**
- * Creates a new instance
- *
- * @param manager The Web Beans manager
- * @return An instance
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws IllegalArgumentException
- *
- * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
- */
- public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
- {
- return getDelegate().newInstance(parameters);
- }
-
- /**
- * The overridden equals operation
- *
- * @param other The instance to compare to
- * @return True if equal, false otherwise
- */
- @Override
- public boolean equals(Object other)
- {
-
- if (super.equals(other) && other instanceof AnnotatedConstructor)
- {
- AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
- return this.getDeclaringClass().equals(that.getDeclaringClass()) && this.getParameters().equals(that.getParameters());
- }
- return false;
- }
-
- /**
- * The overridden hashcode
- *
- * Gets the hash code from the delegate
- *
- * @return The hash code
- */
- @Override
- public int hashCode()
- {
- return getDelegate().hashCode();
- }
-
- /**
- * Gets the declaring class
- *
- * @return The declaring class
- */
- public AnnotatedType<T> getDeclaringClass()
- {
- return declaringClass;
- }
-
- /**
- * Gets a string representation of the constructor
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- if (toString != null)
- {
- return toString;
- }
- toString = "Annotated method " + Names.constructorToString(constructor);
- return toString;
- }
-
- public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)
- {
- throw new UnsupportedOperationException();
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.AnnotationStore;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * Represents an annotated constructor
+ *
+ * This class is immutable, and therefore threadsafe
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
+{
+
+
+ // The type arguments
+ private static final Type[] actualTypeArguments = new Type[0];
+ // The underlying constructor
+ private final Constructor<T> constructor;
+
+ // The list of parameter abstractions
+ private final List<AnnotatedParameter<?>> parameters;
+ // The mapping of annotation -> parameter abstraction
+ private final AnnotatedParameterMap annotatedParameters;
+
+ // The declaring class abstraction
+ private final AnnotatedType<T> declaringClass;
+
+ // Cached string representation
+ private String toString;
+
+ public static <T> AnnotatedConstructor<T> of(Constructor<T> constructor, AnnotatedType<T> declaringClass)
+ {
+ return new AnnotatedConstructorImpl<T>(constructor, declaringClass);
+ }
+
+ /**
+ * Constructor
+ *
+ * Initializes the superclass with the build annotations map
+ *
+ * @param constructor The constructor method
+ * @param declaringClass The declaring class
+ */
+ public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
+ {
+ super(AnnotationStore.of(constructor), constructor);
+ this.constructor = constructor;
+ this.declaringClass = declaringClass;
+
+ this.parameters = new ArrayList<AnnotatedParameter<?>>();
+ annotatedParameters = new AnnotatedParameterMap();
+ for (int i = 0; i < constructor.getParameterTypes().length; i++)
+ {
+ if (constructor.getParameterAnnotations()[i].length > 0)
+ {
+ Class<?> clazz = constructor.getParameterTypes()[i];
+ AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, this);
+ parameters.add(parameter);
+
+ for (Annotation annotation : parameter.getAnnotationsAsSet())
+ {
+ annotatedParameters.put(annotation.annotationType(), parameter);
+ }
+ }
+ else
+ {
+ Class<?> clazz = constructor.getParameterTypes()[i];
+ AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(new Annotation[0], clazz, this);
+ parameters.add(parameter);
+
+ for (Annotation annotation : parameter.getAnnotationsAsSet())
+ {
+ annotatedParameters.put(annotation.annotationType(), parameter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the constructor
+ *
+ * @return The constructor
+ */
+ public Constructor<T> getAnnotatedConstructor()
+ {
+ return constructor;
+ }
+
+ /**
+ * Gets the delegate (constructor)
+ *
+ * @return The delegate
+ */
+ public Constructor<T> getDelegate()
+ {
+ return constructor;
+ }
+
+ /**
+ * Gets the type of the constructor
+ *
+ * @return The type of the constructor
+ */
+ public Class<T> getType()
+ {
+ return constructor.getDeclaringClass();
+ }
+
+ /**
+ * Gets the actual type arguments
+ *
+ * @return The type arguments
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getActualTypeArguments()
+ */
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ /**
+ * Gets the abstracted parameters
+ *
+ * If the parameters are null, initalize them first
+ *
+ * @return A list of annotated parameter abstractions
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getParameters()
+ */
+ public List<AnnotatedParameter<?>> getParameters()
+ {
+ return Collections.unmodifiableList(parameters);
+ }
+
+ /**
+ * Gets parameter abstractions with a given annotation type.
+ *
+ * If the parameters are null, they are initializes first.
+ *
+ * @param annotationType The annotation type to match
+ * @return A list of matching parameter abstractions. An empty list is
+ * returned if there are no matches.
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getAnnotatedParameters(Class)
+ */
+ public List<AnnotatedParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ return Collections.unmodifiableList(annotatedParameters.get(annotationType));
+ }
+
+ /**
+ * Creates a new instance
+ *
+ * @param manager The Web Beans manager
+ * @return An instance
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ * @throws IllegalArgumentException
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
+ */
+ public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
+ {
+ return getDelegate().newInstance(parameters);
+ }
+
+ /**
+ * The overridden equals operation
+ *
+ * @param other The instance to compare to
+ * @return True if equal, false otherwise
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+
+ if (super.equals(other) && other instanceof AnnotatedConstructor)
+ {
+ AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
+ return this.getDeclaringClass().equals(that.getDeclaringClass()) && this.getParameters().equals(that.getParameters());
+ }
+ return false;
+ }
+
+ /**
+ * The overridden hashcode
+ *
+ * Gets the hash code from the delegate
+ *
+ * @return The hash code
+ */
+ @Override
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
+
+ /**
+ * Gets the declaring class
+ *
+ * @return The declaring class
+ */
+ public AnnotatedType<T> getDeclaringClass()
+ {
+ return declaringClass;
+ }
+
+ /**
+ * Gets a string representation of the constructor
+ *
+ * @return A string representation
+ */
+ @Override
+ public String toString()
+ {
+ if (toString != null)
+ {
+ return toString;
+ }
+ toString = "Annotated method " + Names.constructorToString(constructor);
+ return toString;
+ }
+
+ public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -16,8 +16,6 @@
*/
package org.jboss.webbeans.jsf;
-import java.io.IOException;
-
import javax.faces.component.html.HtmlInputHidden;
import javax.faces.context.FacesContext;
import javax.inject.AnnotationLiteral;
@@ -120,7 +118,6 @@
* Gets the propagated conversation id from the propagation component
*
* @return The conversation id (or null if not found)
- * @throws IOException
*/
public static String getConversationIdFromPropagationComponent()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -80,7 +80,7 @@
* session to be injected by the Session manager
*
* @param session
- * @return
+ * @return the session bean store
*/
protected BeanStore restoreSessionContext(HttpSession session)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,189 +1,188 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.util;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-
-import com.google.common.collect.ForwardingMap;
-
-/**
- * Represents a thread safe map
- *
- * @author Pete Muir
- */
-public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
-{
-
- // The backing map with the value wrapped in a Future instance
- private ConcurrentHashMap<K, Future<V>> map;
-
- /**
- * Constructor
- */
- public ConcurrentCache()
- {
- map = new ConcurrentHashMap<K, Future<V>>();
- }
-
- /**
- * Gets the Future value from the map
- *
- * @param key The key to look for
- * @return The Future instance of the value
- */
-
- public <T extends V> Future<T> getFuture(K key)
- {
- @SuppressWarnings("unchecked")
- Future<T> future = (Future<T>) super.get(key);
- return future;
- }
-
- /**
- * Gets a value from the map. Blocks until it is available
- *
- * @param key The key to look for
- * @return The value
- */
- public <T extends V> T getValue(K key)
- {
- @SuppressWarnings("unchecked")
- Future<T> value = (Future<T>) map.get(key);
- if (value != null)
- {
- boolean interrupted = false;
- try
- {
- while (true)
- {
- try
- {
- return value.get();
- }
- catch (InterruptedException e)
- {
- interrupted = true;
- }
- catch (ExecutionException e)
- {
- rethrow(e);
- }
- }
- }
- finally
- {
- if (interrupted)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Adds an item to the map if it's not already there
-
- * @param key The key to place the item under
- * @param callable The item, wrapped in a Callable instance
- * @return The item added
- */
- public <E> E putIfAbsent(K key, Callable<E> callable)
- {
- @SuppressWarnings("unchecked")
- Future<E> future = (Future<E>) map.get(key);
- Future<E> value = future;
- if (value == null)
- {
- FutureTask<E> task = new FutureTask<E>(callable);
- value = task;
- @SuppressWarnings("unchecked")
- Future<V> t = (Future<V>) task;
- map.put(key, t);
- task.run();
- }
- boolean interrupted = false;
- try
- {
- while (true)
- {
- try
- {
- return value.get();
- }
- catch (InterruptedException e)
- {
- interrupted = true;
- }
- catch (ExecutionException e)
- {
- rethrow(e);
- }
- ;
- }
- }
- finally
- {
- if (interrupted)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * Gets the delegate map
- *
- * @return The backing map
- */
- @Override
- protected Map<K, Future<V>> delegate()
- {
- return map;
- }
-
- /**
- * Examines and re-throws an exception
- *
- * @param e The exception that happened during execution
- */
- protected void rethrow(ExecutionException e)
- {
- if (e.getCause() instanceof RuntimeException)
- {
- throw (RuntimeException) e.getCause();
- }
- else if (e.getCause() instanceof Error)
- {
- throw (Error) e.getCause();
- }
- else
- {
- throw new IllegalStateException(e.getCause());
- }
- }
-
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.util;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
+import com.google.common.collect.ForwardingMap;
+
+/**
+ * Represents a thread safe map
+ *
+ * @author Pete Muir
+ */
+public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
+{
+
+ // The backing map with the value wrapped in a Future instance
+ private ConcurrentHashMap<K, Future<V>> map;
+
+ /**
+ * Constructor
+ */
+ public ConcurrentCache()
+ {
+ map = new ConcurrentHashMap<K, Future<V>>();
+ }
+
+ /**
+ * Gets the Future value from the map
+ *
+ * @param key The key to look for
+ * @return The Future instance of the value
+ */
+
+ public <T extends V> Future<T> getFuture(K key)
+ {
+ @SuppressWarnings("unchecked")
+ Future<T> future = (Future<T>) super.get(key);
+ return future;
+ }
+
+ /**
+ * Gets a value from the map. Blocks until it is available
+ *
+ * @param key The key to look for
+ * @return The value
+ */
+ public <T extends V> T getValue(K key)
+ {
+ @SuppressWarnings("unchecked")
+ Future<T> value = (Future<T>) map.get(key);
+ if (value != null)
+ {
+ boolean interrupted = false;
+ try
+ {
+ while (true)
+ {
+ try
+ {
+ return value.get();
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ catch (ExecutionException e)
+ {
+ rethrow(e);
+ }
+ }
+ }
+ finally
+ {
+ if (interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Adds an item to the map if it's not already there
+
+ * @param key The key to place the item under
+ * @param callable The item, wrapped in a Callable instance
+ * @return The item added
+ */
+ public <E> E putIfAbsent(K key, Callable<E> callable)
+ {
+ @SuppressWarnings("unchecked")
+ Future<E> future = (Future<E>) map.get(key);
+ Future<E> value = future;
+ if (value == null)
+ {
+ FutureTask<E> task = new FutureTask<E>(callable);
+ value = task;
+ @SuppressWarnings("unchecked")
+ Future<V> t = (Future<V>) task;
+ map.put(key, t);
+ task.run();
+ }
+ boolean interrupted = false;
+ try
+ {
+ while (true)
+ {
+ try
+ {
+ return value.get();
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ catch (ExecutionException e)
+ {
+ rethrow(e);
+ }
+ }
+ }
+ finally
+ {
+ if (interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ /**
+ * Gets the delegate map
+ *
+ * @return The backing map
+ */
+ @Override
+ protected Map<K, Future<V>> delegate()
+ {
+ return map;
+ }
+
+ /**
+ * Examines and re-throws an exception
+ *
+ * @param e The exception that happened during execution
+ */
+ protected void rethrow(ExecutionException e)
+ {
+ if (e.getCause() instanceof RuntimeException)
+ {
+ throw (RuntimeException) e.getCause();
+ }
+ else if (e.getCause() instanceof Error)
+ {
+ throw (Error) e.getCause();
+ }
+ else
+ {
+ throw new IllegalStateException(e.getCause());
+ }
+ }
+
}
\ No newline at end of file
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1768 - doc/trunk/reference/de-DE.
by webbeans-commits@lists.jboss.org
Author: jdimanos
Date: 2009-03-05 02:11:30 -0500 (Thu, 05 Mar 2009)
New Revision: 1768
Modified:
doc/trunk/reference/de-DE/specialization.po
Log:
update
Modified: doc/trunk/reference/de-DE/specialization.po
===================================================================
--- doc/trunk/reference/de-DE/specialization.po 2009-03-05 06:55:15 UTC (rev 1767)
+++ doc/trunk/reference/de-DE/specialization.po 2009-03-05 07:11:30 UTC (rev 1768)
@@ -7,7 +7,7 @@
"Project-Id-Version: specialization\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-01-10 14:18+0000\n"
-"PO-Revision-Date: 2009-01-24 15:39+1100\n"
+"PO-Revision-Date: 2009-03-05 18:10+1100\n"
"Last-Translator: \n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -19,7 +19,7 @@
#: specialization.xml:4
#, no-c-format
msgid "Specialization"
-msgstr ""
+msgstr "Spezialisierung"
#. Tag: para
#: specialization.xml:6
@@ -96,12 +96,14 @@
"Would receive an instance of <literal>StagingCreditCardPaymentProcessor</"
"literal>."
msgstr ""
+"Wir würden eine Instanz von <literal>StagingCreditCardPaymentProcessor</"
+"literal> erhalten."
#. Tag: para
#: specialization.xml:28
#, no-c-format
msgid "Unfortunately, there are several traps we can easily fall into:"
-msgstr ""
+msgstr "Leider könnten wir in gleich mehrere Fallen tappen:"
#. Tag: para
#: specialization.xml:32
@@ -158,7 +160,7 @@
#: specialization.xml:58
#, no-c-format
msgid "Using specialization"
-msgstr ""
+msgstr "Verwendung von Spezialisierung"
#. Tag: para
#: specialization.xml:60
@@ -187,7 +189,7 @@
#: specialization.xml:73
#, no-c-format
msgid "be annotated <literal>@Specializes</literal>."
-msgstr ""
+msgstr "<literal>@Specializes</literal> annotiert sein."
#. Tag: programlisting
#: specialization.xml:77
@@ -217,13 +219,13 @@
#: specialization.xml:85
#, no-c-format
msgid "Advantages of specialization"
-msgstr ""
+msgstr "Vorteile von Spezialisierung"
#. Tag: para
#: specialization.xml:87
#, no-c-format
msgid "When specialization is used:"
-msgstr ""
+msgstr "Wann Spezialisierung eingesetzt wird:"
#. Tag: para
#: specialization.xml:91
@@ -249,6 +251,8 @@
"superclass are called upon an instance of the Web Bean annotated "
"<literal>@Specializes</literal>."
msgstr ""
+"Durch die Superklasse deklarierte Producer-Methoden, Bereinigungsmethoden und Observer-Methoden "
+"werden durch eine Instanz des mit <literal>@Specializes</literal> annotierten Web Beans aufgerufen."
#. Tag: para
#: specialization.xml:105
@@ -258,12 +262,15 @@
"<literal>CreditCardPaymentProcessor</literal> is inherited by "
"<literal>StagingCreditCardPaymentProcessor</literal>."
msgstr ""
+"In unserem Beispiel wird der Binding-Typ <literal>@CreditCard</literal> von "
+"<literal>CreditCardPaymentProcessor</literal> von "
+"<literal>StagingCreditCardPaymentProcessor</literal> geerbt."
#. Tag: para
#: specialization.xml:109
#, no-c-format
msgid "Furthermore, the Web Bean manager will validate that:"
-msgstr ""
+msgstr "Desweiteren validiert der Web Bean Manager dies:"
#. Tag: para
#: specialization.xml:113
@@ -273,6 +280,8 @@
"<literal>@Specializes</literal> (all local interfaces of the superclass "
"enterprise bean are also local interfaces of the subclass),"
msgstr ""
+"alle API-Typen der Superklasse sind API-Typen des mit <literal>@Specializes</literal> annotierten Web Beans "
+"(alle lokalen Interfaces der Superklasse Enterprise Bean sind auch lokale Interfaces der Subklasse),"
#. Tag: para
#: specialization.xml:119
@@ -282,12 +291,15 @@
"literal> has a higher precedence than the deployment type of the superclass, "
"and"
msgstr ""
+"der Deployment-Typ des mit <literal>@Specializes</"
+"literal> annotierten Web Bean besitzt Vorrang vor dem Deployment-Typ der Superklasse "
+"und "
#. Tag: para
#: specialization.xml:124
#, no-c-format
msgid "there is no other enabled Web Bean that also specializes the superclass."
-msgstr ""
+msgstr "es existiert keun weiteres aktiviertes Web Bean, das ebenfalls die Superklasse spezialisiert."
#. Tag: para
#: specialization.xml:129
@@ -295,7 +307,7 @@
msgid ""
"If any of these conditions are violated, the Web Bean manager throws an "
"exception at initialization time."
-msgstr ""
+msgstr "Wird eine dieser Bedingungen verletzt, so meldet der Web Bean Manager zum Zeitpunkt der Initialisierung eine Ausnahme."
#. Tag: para
#: specialization.xml:132
@@ -305,4 +317,6 @@
"emphasis> be called in any deployment of the system where the Web Bean "
"annotated <literal>@Specializes</literal> is deployed and enabled."
msgstr ""
+"Wir können daher sicher sein, dass die Superklasse <emphasis>nie</"
+"emphasis> bei einem Deployment des Systems bei dem das mit <literal>@Specializes</literal> annotierte Web Bean deployt und aktiviert wird, aufgerufen wird."
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1767 - doc/trunk/reference/de-DE.
by webbeans-commits@lists.jboss.org
Author: jdimanos
Date: 2009-03-05 01:55:15 -0500 (Thu, 05 Mar 2009)
New Revision: 1767
Modified:
doc/trunk/reference/de-DE/scopescontexts.po
Log:
update
Modified: doc/trunk/reference/de-DE/scopescontexts.po
===================================================================
--- doc/trunk/reference/de-DE/scopescontexts.po 2009-03-05 05:04:00 UTC (rev 1766)
+++ doc/trunk/reference/de-DE/scopescontexts.po 2009-03-05 06:55:15 UTC (rev 1767)
@@ -7,7 +7,7 @@
"Project-Id-Version: scopescontexts\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-01-10 14:18+0000\n"
-"PO-Revision-Date: 2009-03-05 15:57+1100\n"
+"PO-Revision-Date: 2009-03-05 17:54+1100\n"
"Last-Translator: \n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -175,49 +175,46 @@
#. Tag: para
#: scopescontexts.xml:86
#, no-c-format
-#, fuzzy
msgid ""
"any servlet request has access to active request, session and application "
"scopes, and, additionally"
-msgstr ""
-"Jede Servlet-Anfrage hat Zugriff auf die aktuelle Anfrage, Session und Geltungsbereiche der Anwendung und zusätzlichhas access to active request, session and application "
-"scopes, and, additionally"
+msgstr "Jede Servlet-Anfrage hat Zugriff auf die aktuelle Anfrage, Session und Geltungsbereiche der Anwendung und zusätzlich "
#. Tag: para
#: scopescontexts.xml:90
#, no-c-format
msgid "any JSF request has access to an active conversation scope."
-msgstr ""
+msgstr "hat jede JSF-Anfrage Zugriff auf einen aktiven Konversations-Geltungsbereich."
#. Tag: para
#: scopescontexts.xml:94
#, no-c-format
msgid "The request and application scopes are also active:"
-msgstr ""
+msgstr "Die Geltungsbereiche von Anfrage und Applikation sind ebenfalls aktiv:"
#. Tag: para
#: scopescontexts.xml:98
#, no-c-format
msgid "during invocations of EJB remote methods,"
-msgstr ""
+msgstr "während Aufrufen von EJB Remote-Methoden,"
#. Tag: para
#: scopescontexts.xml:101
#, no-c-format
msgid "during EJB timeouts,"
-msgstr ""
+msgstr "während EJB-Timeouts,"
#. Tag: para
#: scopescontexts.xml:104
#, no-c-format
msgid "during message delivery to a message-driven bean, and"
-msgstr ""
+msgstr "während Message Delivery an ein message-betriebenes Bean und "
#. Tag: para
#: scopescontexts.xml:107
#, no-c-format
msgid "during web service invocations."
-msgstr ""
+msgstr "während Aufrufen von Webdiensten."
#. Tag: para
#: scopescontexts.xml:111
@@ -226,7 +223,7 @@
"If the application tries to invoke a Web Bean with a scope that does not "
"have an active context, a <literal>ContextNotActiveException</literal> is "
"thrown by the Web Bean manager at runtime."
-msgstr ""
+msgstr "Versucht die Applikation ein Web Bean aufzurufen, das keinen aktiven Kontext besitzt, so wird zur Runtime eine <literal>ContextNotActiveException</literal> vom Web Bean Manager gemeldet."
#. Tag: para
#: scopescontexts.xml:115
@@ -236,12 +233,14 @@
"EE developer, so let's not waste time discussing them here. One of the "
"scopes, however, is new."
msgstr ""
+"Drei der vier eingebauten Geltungsbereiche solltem jedem Java "
+"EE Entwickler sehr vertraut sein, daher wollen wir hier nicht weiter auf diese eingehen. Einer der Geltungsbereiche jedoch ist neu."
#. Tag: title
#: scopescontexts.xml:122
#, no-c-format
msgid "The conversation scope"
-msgstr ""
+msgstr "Der Geltungsbereich der Konversation"
#. Tag: para
#: scopescontexts.xml:124
@@ -251,13 +250,13 @@
"in that it holds state associated with a user of the system, and spans "
"multiple requests to the server. However, unlike the session scope, the "
"conversation scope:"
-msgstr ""
+msgstr "Der Web Beans Geltungsbereich der Konversation ähnelt dem herkömmlichen Geltungsbereich der Session dahingehend, dass er den mit einem Benutzer des Systems assoziierten Status verwahrt und mehrere Anfragen zum Server umfasst. Anders als für den Geltungsbereich der Session gilt für den Geltungsbereich der Konversation jedoch:"
#. Tag: para
#: scopescontexts.xml:130
#, no-c-format
msgid "is demarcated explicitly by the application, and"
-msgstr ""
+msgstr "ist explizit durch die Applikation demarkiert und "
#. Tag: para
#: scopescontexts.xml:133
@@ -265,7 +264,7 @@
msgid ""
"holds state associated with a particular web browser tab in a JSF "
"application."
-msgstr ""
+msgstr "verwahrt den mit einem bestimmten Webbrowser assoziierten Status in einer JSF-Applikation."
#. Tag: para
#: scopescontexts.xml:138
@@ -275,7 +274,7 @@
"the user. The conversation context holds state associated with what the user "
"is currently working on. If the user is doing multiple things at the same "
"time, there are multiple conversations."
-msgstr ""
+msgstr "Eine Konversation repräsentiert aus Perspektive des Benutzers eine Aufgabe, eine Arbeitseinheit. Der Konversationskontext enthält den Status dessen, woran der Benutzer gerade arbeitet. Arbeitet der Benutzer gleichzeitig an mehreren Dingen, so existieren mehrere Konversationen."
#. Tag: para
#: scopescontexts.xml:143
@@ -285,13 +284,13 @@
"conversations are destroyed at the end of the request. If a conversation "
"should hold state across multiple requests, it must be explicitly promoted "
"to a <emphasis>long-running conversation</emphasis>."
-msgstr ""
+msgstr "Der Konversation skontext ist während jeder JSF-Anfrage aktiv. Jedoch werden die meisten Konversationen am Ende der Anfrage gelöscht. Soll eine Konversation den Status über mehrere Anfragen hinweg verwahren, so muss sie explizit zu einer <emphasis>lange laufenden Konversation</emphasis> fortgepflanzt werden."
#. Tag: title
#: scopescontexts.xml:149
#, no-c-format
msgid "Conversation demarcation"
-msgstr ""
+msgstr "Konversationsdemarkierung"
#. Tag: para
#: scopescontexts.xml:151
@@ -300,13 +299,13 @@
"Web Beans provides a built-in Web Bean for controlling the lifecyle of "
"conversations in a JSF application. This Web Bean may be obtained by "
"injection:"
-msgstr ""
+msgstr "Web Beans liefert ein eingebautes Web Bean für die Steuerung des Lebenszyklus von Konversationen in einer JSF-Applikation. Dieses Web Bean kann durch Einspeisung erhalten werden:"
#. Tag: programlisting
#: scopescontexts.xml:154
#, no-c-format
msgid "@Current Conversation conversation;"
-msgstr ""
+msgstr "@Current Conversation Konversation;"
#. Tag: para
#: scopescontexts.xml:156
@@ -318,6 +317,8 @@
"for destruction at the end of the current request, call <literal>end()</"
"literal>."
msgstr ""
+"Um die mit der aktuellen Anfrage assoziierte Konversation an eine lange laufende Konversation fortzupflanzen, rufen Sie die <literal>begin()</literal>-Methode vom Applikationscode auf. Um den aktuellen, lange laufenden Konversationskontext für die Löschung am Ende der aktuellen Anfrage zu terminieren, rufen Sie <literal>end()</"
+"literal> auf."
#. Tag: para
#: scopescontexts.xml:161
@@ -325,7 +326,7 @@
msgid ""
"In the following example, a conversation-scoped Web Bean controls the "
"conversation with which it is associated:"
-msgstr ""
+msgstr "IIm folgenden Beispiel steuert ein konversationsbegrenztes Web Bean die Konversation, mit der es assoziiert ist:"
#. Tag: programlisting
#: scopescontexts.xml:164
@@ -401,12 +402,14 @@
"<literal>Conversation</literal> API. But some other Web Beans have a "
"lifecycle which depends completely upon another object."
msgstr ""
+"Dieses Web Bean ist in der Lage, seinen eigenen Lebenszyklus durch Verwendung der "
+"<literal>Conversation</literal>-API zu steuern. Aber einige andere Web Beans besitzen einen Lebenszyklus, der komplett von einem anderen Objekt abhängt."
#. Tag: title
#: scopescontexts.xml:173
#, no-c-format
msgid "Conversation propagation"
-msgstr ""
+msgstr "Konversationsfortpflanzung (Conversation Propagation)"
#. Tag: para
#: scopescontexts.xml:175
@@ -416,6 +419,8 @@
"(JSF form submission). It does not automatically propagate with non-faces "
"requests, for example, navigation via a link."
msgstr ""
+"Der Konversationskontext wird automatisch mit allen JSF Faces Anfragen fortgepflanzt"
+"(JSF-Formulareinreichung). Nicht-Faces Anfragen werden nicht automatisch fortgepflanzt, zum Beispiel Navigation via einem Link."
#. Tag: para
#: scopescontexts.xml:179
@@ -428,12 +433,16 @@
"conversation may be obtained from the <literal>Conversation</literal> "
"object, which has the Web Beans name <literal>conversation</literal>."
msgstr ""
+"Wir können die Konversation zwingen, mit einer nicht-Faces Anfrage fortzupflanzen, indem wir den eindeutigen Bezeichner der Konversation als einen Anfragenparameter mit einschließen. "
+"Die Web Beans Spezifikation reserviert den Anfragenparameter namens "
+"<literal>cid</literal> für diesen Gebrauch. Den eindeutigen Bezeichner der Konversation "
+"erhält man vom <literal>Conversation</literal>-Objekt, welches den Web Beans Namen <literal>conversation</literal> besitzt."
#. Tag: para
#: scopescontexts.xml:186
#, no-c-format
msgid "Therefore, the following link propagates the conversation:"
-msgstr ""
+msgstr "Daher pflanzt das folgende Link die Konversation fort:"
#. Tag: programlisting
#: scopescontexts.xml:188
@@ -454,13 +463,13 @@
"very easy to implement the common POST-then-redirect pattern, without resort "
"to fragile constructs such as a \"flash\" object. In this case, the Web Bean "
"manager automatically adds a request parameter to the redirect URL."
-msgstr ""
+msgstr "Der Web Bean Manager muss auch Konversationen über ein Redirect fortpflanzen, selbst wenn die Konversation nicht als lange laufend gekennzeichnet ist. Dies macht die Implementierung des POST-then-redirect Musters sehr einfach, ohne dass man sich auf anfällige Konstrukte wie etwa ein \"Flash\"-Objekt stützen müsste. In tdiesem Fall fügt der Web Bean Manager automatisch einen Anfragenparameter hinzu, um die URL umzuleiten."
#. Tag: title
#: scopescontexts.xml:200
#, no-c-format
msgid "Conversation timeout"
-msgstr ""
+msgstr "Konversations-Timeout"
#. Tag: para
#: scopescontexts.xml:202
@@ -472,6 +481,8 @@
"timeout — though this is not required by the Web Beans specification. The "
"timeout is the period of inactivity before the conversation is destroyed."
msgstr ""
+"Dem Web Bean Manager ist gestattet, eine Konversation und alle Stati innerhalb seines Kontexts zu jedem Zeitpunkt zu löschen, um Ressourcen zu schonen. Eine Implementierung des Web Bean "
+"Managers wird dies in der Regel auf der Basis einer Art von Timeout — tun, obwohl dies nicht durch die Web Beans Spezifikation gefordert wird. Beim Timeout handelt es sich um den Zeitraum von Inaktivität, ehe die Konversation gelöscht wird."
#. Tag: para
#: scopescontexts.xml:208
@@ -480,7 +491,7 @@
"The <literal>Conversation</literal> object provides a method to set the "
"timeout. This is a hint to the Web Bean manager, which is free to ignore the "
"setting."
-msgstr ""
+msgstr "Das <literal>Conversation</literal>-Objekt liefert eine Methode, mit der der Timeout eingestellt werden kann. Dies ist ein Tipp an den Web Bean Manager, der die Einstellung ignorieren kann."
#. Tag: programlisting
#: scopescontexts.xml:212
@@ -492,7 +503,7 @@
#: scopescontexts.xml:219
#, no-c-format
msgid "The dependent pseudo-scope"
-msgstr ""
+msgstr "Der abhängige Pseudo-Geltungsbereich (\"Pseudo-Scope\")"
#. Tag: para
#: scopescontexts.xml:221
@@ -502,12 +513,14 @@
"<emphasis>dependent pseudo-scope</emphasis>. This is the default scope for a "
"Web Bean which does not explicitly declare a scope type."
msgstr ""
+"Neben den vier eingebauten Geltungsbereichen bieten Web Beans den sogenannten"
+"<emphasis>abhängigen Pseudo-Geltungsbereich</emphasis>. Dies ist der standardmäßige Geltungsbereich für ein Web Bean, das nicht expliziet einen Typ von Geltungsbereich deklariert."
#. Tag: para
#: scopescontexts.xml:225
#, no-c-format
msgid "For example, this Web Bean has the scope type <literal>@Dependent</literal>:"
-msgstr ""
+msgstr "Zum Beispiel besitzt dieses Web Bean den Geltungsbereich-Typ <literal>@Dependent</literal>:"
#. Tag: programlisting
#: scopescontexts.xml:227
@@ -524,7 +537,7 @@
"Bean is instantiated. Instances of dependent Web Beans are never shared "
"between different Web Beans or different injection points. They are "
"<emphasis>dependent objects</emphasis> of some other Web Bean instance."
-msgstr ""
+msgstr "Wenn der Einspeisungspunkt eines Web Bean zu einem abhängigen Web Bean hin aufgelöst wird, so wird jedes Mal, wenn das erste Web Bean instantiiert wird, eine neue Instanz des abhängigen Web Beans erstellt. Instanzen abhängiger Web Beans werden nie von unterschiedlichen Web Beans oder unterschiedlichen Einspeisungspunkten geteilt. Sie sind <emphasis>abhängige Objekte</emphasis> einer anderen Web Bean Instanz."
#. Tag: para
#: scopescontexts.xml:235
@@ -532,7 +545,7 @@
msgid ""
"Dependent Web Bean instances are destroyed when the instance they depend "
"upon is destroyed."
-msgstr ""
+msgstr "Abhängige Web Bean Instanzen werden gelöscht, wenn die Instanz von der sie abhängen gelöscht wird."
#. Tag: para
#: scopescontexts.xml:243
@@ -542,12 +555,15 @@
"EJB bean, even if the class or EJB bean is already declared as a Web Bean "
"with some other scope type."
msgstr ""
+"Web Beans machen es einfach, eine unabhängige Instanz einer Java-Klasse oder eines "
+"EJB-Beans zu erhalten, selbst wenn die Klasse oder das EJB-Bean bereits als ein Web Bean "
+"mit einem anderen Typ von Geltungsbereich deklariert sind."
#. Tag: title
#: scopescontexts.xml:248
#, no-c-format
msgid "The <literal>@New</literal> annotation"
-msgstr ""
+msgstr "Die <literal>@New</literal>-Annotation"
#. Tag: para
#: scopescontexts.xml:250
@@ -557,6 +573,8 @@
"<emphasis>implicit</emphasis> definition of a dependent Web Bean at an "
"injection point. Suppose we declare the following injected field:"
msgstr ""
+"Die eingebaute <literal>@New</literal> Binding-Annotation gestattet die "
+"<emphasis>implizite</emphasis> Definition eines abhängigen Web Beans an einem Einspeisungspunkt. Nehmen wir an, wir deklarieren das folgende eingespeiste Feld:"
#. Tag: programlisting
#: scopescontexts.xml:254
@@ -573,6 +591,10 @@
"implementation class <literal>Calculator</literal> and deployment type "
"<literal>@Standard</literal> is implicitly defined."
msgstr ""
+"Dann wird ein Web Bean mit Geltungsbereich <literal>@Dependent</literal>, Binding-Typ "
+"<literal>@New</literal>, API-Typ <literal>Calculator</literal>, "
+"Implementierungsklasse <literal>Calculator</literal> und Deployment-Typ "
+"<literal>@Standard</literal> impliziert definiert."
#. Tag: para
#: scopescontexts.xml:261
@@ -581,6 +603,8 @@
"This is true even if <literal>Calculator</literal> is <emphasis>already</"
"emphasis> declared with a different scope type, for example:"
msgstr ""
+"Dies ist wahr, selbst wenn <literal>Calculator</literal> <emphasis>bereits</"
+"emphasis> mit einem anderen Typ von Geltungsbereich definiert ist, zum Beispiel:"
#. Tag: programlisting
#: scopescontexts.xml:264
@@ -599,6 +623,8 @@
"So the following injected attributes each get a different instance of "
"<literal>Calculator</literal>:"
msgstr ""
+"Die folgenden eingespeisten Attribute erhalten also jeweils eine unterschiedliche Instanz von "
+"<literal>Calculator</literal>:"
#. Tag: programlisting
#: scopescontexts.xml:269
@@ -627,6 +653,8 @@
"literal> field has a new instance of <literal>Calculator</literal> injected, "
"with a lifecycle that is bound to the owning <literal>PaymentCalc</literal>."
msgstr ""
+"In das <literal>calculator</literal>-Feld wird eine konversationsbegrenzte Instanz von <literal>Calculator</literal> eingespeist. In das <literal>newCalculator</"
+"literal>-Feld wird eine neue Instanz von <literal>Calculator</literal> eingespeist, mit einem Lebenszyklus, der an den besitzenden <literal>PaymentCalc</literal> gebunden ist."
#. Tag: para
#: scopescontexts.xml:276
@@ -634,5 +662,5 @@
msgid ""
"This feature is particularly useful with producer methods, as we'll see in "
"the next chapter."
-msgstr ""
+msgstr "Dieses Feature ist insbesondere im Zusammenhang mit Producer-Methoden von Nutzen, wie wir im folgenden Kapitel noch sehen werden."
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1766 - doc/trunk/reference/de-DE.
by webbeans-commits@lists.jboss.org
Author: jdimanos
Date: 2009-03-05 00:04:00 -0500 (Thu, 05 Mar 2009)
New Revision: 1766
Modified:
doc/trunk/reference/de-DE/scopescontexts.po
Log:
update
Modified: doc/trunk/reference/de-DE/scopescontexts.po
===================================================================
--- doc/trunk/reference/de-DE/scopescontexts.po 2009-03-05 03:41:18 UTC (rev 1765)
+++ doc/trunk/reference/de-DE/scopescontexts.po 2009-03-05 05:04:00 UTC (rev 1766)
@@ -7,7 +7,7 @@
"Project-Id-Version: scopescontexts\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-01-10 14:18+0000\n"
-"PO-Revision-Date: 2009-01-24 15:38+1100\n"
+"PO-Revision-Date: 2009-03-05 15:57+1100\n"
"Last-Translator: \n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -19,7 +19,7 @@
#: scopescontexts.xml:4
#, no-c-format
msgid "Scopes and contexts"
-msgstr ""
+msgstr "Geltungsbereiche und Kontexte"
#. Tag: para
#: scopescontexts.xml:6
@@ -31,24 +31,26 @@
"instances of the Web Bean. According to the Web Beans specification, a scope "
"determines:"
msgstr ""
+"Bis jetzt haben wir ein paar Beispiele von <emphasis>Geltungsbereichtyp-Annotationen</"
+"emphasis> gesehen. Der Geltungsbereich eines Web Beans bestimmt den Lebenszyklus der Instanzen des Web Beans. Der Geltungsbereich bestimmt auch, welche Clients sich auf welche Instanzen des Web Beans beziehen. Gemäß der Web Beans Spezifikation bestimmt ein Geltungsbereich:"
#. Tag: para
#: scopescontexts.xml:14
#, no-c-format
msgid "When a new instance of any Web Bean with that scope is created"
-msgstr ""
+msgstr "Wann eine neue Instanz eines beliebigen Web Beans mit diesem Geltungsbereich erstellt wird"
#. Tag: para
#: scopescontexts.xml:17
#, no-c-format
msgid "When an existing instance of any Web Bean with that scope is destroyed"
-msgstr ""
+msgstr "Wenn eine bestehende Instanz eines beliebigen Web Beans mit diesem Geltungsbereich gelöscht wird"
#. Tag: para
#: scopescontexts.xml:20
#, no-c-format
msgid "Which injected references refer to any instance of a Web Bean with that scope"
-msgstr ""
+msgstr "Welche eingespeisten Referenzen auf eine beliebige Instanz eines Web Beans mit diesem Geltungsbereich verweisen"
#. Tag: para
#: scopescontexts.xml:25
@@ -61,12 +63,16 @@
"the first time a <literal>CurrentUser</literal> is needed in that session, "
"and automatically destroyed when the session ends."
msgstr ""
+"Wenn wir etwa ein session-begrenztes Web Bean <literal>CurrentUser</"
+"literal> haben, so sehen alle Web Beans, die im Kontext derselben "
+"<literal>HttpSession</literal> aufgerufen werden, dieselbe Instanz von "
+"<literal>CurrentUser</literal>. Diese Instanz wird automatisch erstellt, wenn <literal>CurrentUser</literal> erstmals in dieser Session benötigt wird und automatisch gelöscht, wenn die Session endet."
#. Tag: title
#: scopescontexts.xml:32
#, no-c-format
msgid "Scope types"
-msgstr ""
+msgstr "Typen von Geltungsbereichen"
#. Tag: para
#: scopescontexts.xml:34
@@ -74,7 +80,7 @@
msgid ""
"Web Beans features an <emphasis>extensible context model</emphasis>. It is "
"possible to define new scopes by creating a new scope type annotation:"
-msgstr ""
+msgstr "Web Beans besitzen ein <emphasis>erweiterbares Kontextmodell</emphasis>. Es ist möglich, neue Geltungsbereiche zu definieren, indem man eine neue Annotation für einen Geltungsbereich-Typ erstellt:"
#. Tag: programlisting
#: scopescontexts.xml:37
@@ -98,7 +104,7 @@
"useful, we will also need to define a <literal>Context</literal> object that "
"implements the scope! Implementing a <literal>Context</literal> is usually a "
"very technical task, intended for framework development only."
-msgstr ""
+msgstr "Natürlich ist dies der einfache Teil des Jobs. Damit dieser Typ von Geltungsbereich von Nutzen ist, müssen wir außerdem ein <literal>Context</literal>-Objekt definieren, das den Geltungsbereich implementiert! Die Implementierung eines <literal>Context</literal> ist in der Regel ein sehr technisches Unterfangen, das nur für Framework-Entwicklung vorgesehen ist."
#. Tag: para
#: scopescontexts.xml:44
@@ -106,7 +112,7 @@
msgid ""
"We can apply a scope type annotation to a Web Bean implementation class to "
"specify the scope of the Web Bean:"
-msgstr ""
+msgstr "Wir können eine Annotation eines Geltungsbereich-Typs an einer Web Bean Implementierungsklasse anwenden, um den Geltungsbereich des Web Beans festzulegen:"
#. Tag: programlisting
#: scopescontexts.xml:47
@@ -122,19 +128,19 @@
#: scopescontexts.xml:58
#, no-c-format
msgid "Usually, you'll use one of Web Beans' built-in scopes."
-msgstr ""
+msgstr "In der Regel verwenden Sie einen der eingebauten Geltungsbereiche der Web Beans."
#. Tag: title
#: scopescontexts.xml:63
#, no-c-format
msgid "Built-in scopes"
-msgstr ""
+msgstr "Eingebaute Geltungsbereiche"
#. Tag: para
#: scopescontexts.xml:65
#, no-c-format
msgid "Web Beans defines four built-in scopes:"
-msgstr ""
+msgstr "Web Beans definiert vier eingebaute Geltungsbereiche:"
#. Tag: literal
#: scopescontexts.xml:69
@@ -164,15 +170,18 @@
#: scopescontexts.xml:82
#, no-c-format
msgid "For a web application that uses Web Beans:"
-msgstr ""
+msgstr "Für eine Web Beans verwendende Webanwendung:"
#. Tag: para
#: scopescontexts.xml:86
#, no-c-format
+#, fuzzy
msgid ""
"any servlet request has access to active request, session and application "
"scopes, and, additionally"
msgstr ""
+"Jede Servlet-Anfrage hat Zugriff auf die aktuelle Anfrage, Session und Geltungsbereiche der Anwendung und zusätzlichhas access to active request, session and application "
+"scopes, and, additionally"
#. Tag: para
#: scopescontexts.xml:90
15 years, 2 months
[webbeans-commits] Webbeans SVN: r1765 - doc/trunk/reference/de-DE.
by webbeans-commits@lists.jboss.org
Author: jdimanos
Date: 2009-03-04 22:41:18 -0500 (Wed, 04 Mar 2009)
New Revision: 1765
Modified:
doc/trunk/reference/de-DE/ri-spi.po
Log:
update
Modified: doc/trunk/reference/de-DE/ri-spi.po
===================================================================
--- doc/trunk/reference/de-DE/ri-spi.po 2009-03-04 21:54:38 UTC (rev 1764)
+++ doc/trunk/reference/de-DE/ri-spi.po 2009-03-05 03:41:18 UTC (rev 1765)
@@ -7,7 +7,7 @@
"Project-Id-Version: ri-spi\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-02-28 13:48+0000\n"
-"PO-Revision-Date: 2009-03-04 18:20+1100\n"
+"PO-Revision-Date: 2009-03-05 14:40+1100\n"
"Last-Translator: \n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -673,6 +673,8 @@
"Servlet listener, either automatically, or through user configuration, for "
"each Web Beans application which uses Servlet."
msgstr ""
+"Falls Sie Web Beans in eine Servlet Umgebung integrieren, müssen Sie <literal>org.jboss.webbeans.servlet.WebBeansListener</literal> als einen "
+"Servlet-Listener registrieren, entweder automatisch oder aber durch Benutzerkonfiguration. Dies muss für jede Servlet benutzende Web Beans Applikation erfolgen."
#. Tag: term
#: ri-spi.xml:230
@@ -690,6 +692,8 @@
"through user configuration, for each Web Beans application which uses "
"enterprise beans."
msgstr ""
+"Falls Sie Web Beans in eine EJB Umgebung integrieren, müssen Sie <literal>org.jboss.webbeans.ejb.SessionBeanInterceptor</literal> als einen "
+"EJB-Interzeptor für alle EJBs in der Applikation registrieren, entweder automatisch oder aber durch Benutzerkonfiguration. Dies muss für jede Enterprise Beans benutzende Web Beans Applikation erfolgen."
#. Tag: term
#: ri-spi.xml:245
@@ -706,4 +710,6 @@
"literal> into the applications isolated classloader. It cannot be loaded "
"from a shared classloader."
msgstr ""
+"Falls Sie Web Beans in eine Umgebung integrieren, die das Deployment von Anwendungen unterstützt, so müssen Sie die <literal>webbeans-ri.jar</"
+"literal> in den isolierten Klassenlader der Anwendungen einfügen. Das Laden kann nicht aus einem geteilten Klassenlader erfolgen."
15 years, 2 months