[webbeans-commits] Webbeans SVN: r1664 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/unit/context/dependent and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-23 17:57:59 -0500 (Mon, 23 Feb 2009)
New Revision: 1664
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/Tame.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/implementation/initializer/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/OtherSpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/SpiderProducer.java
tck/trunk/impl/src/main/resources/tck-tests.xml
Log:
Fix tests
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/AnotherDeploymentType.java 2009-02-23 22:57:59 UTC (rev 1664)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.unit.context.dependent;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java 2009-02-23 21:20:06 UTC (rev 1663)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java 2009-02-23 22:57:59 UTC (rev 1664)
@@ -1,23 +1,30 @@
package org.jboss.jsr299.tck.unit.context.dependent;
+import java.lang.annotation.Annotation;
import java.util.Set;
import javax.context.Context;
import javax.context.ContextNotActiveException;
import javax.context.Dependent;
+import javax.inject.AnnotationLiteral;
import javax.inject.manager.Bean;
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.jsr299.BeansXml;
import org.testng.annotations.Test;
/**
* Spec version: Public Release Draft 2
*/
@Artifact
+@BeansXml("beans.xml")
public class DependentContextTest extends AbstractDeclarativeTest
{
+
+ private static final Annotation TAME_LITERAL = new AnnotationLiteral<Tame> () {};
+
@Test(groups = { "contexts", "injection" })
@SpecAssertion(section = "8.3", id = "a")
public void testInstanceNotSharedBetweenInjectionPoints()
@@ -76,7 +83,7 @@
@SpecAssertion(section = "8.3", id = "d")
public void testInstanceUsedForProducerFieldNotShared() throws Exception
{
- Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
+ Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class, TAME_LITERAL).iterator().next();
Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
Tarantula tarantula2 = tarantulaBean.create(new MyCreationalContext<Tarantula>());
assert tarantula != null;
@@ -277,7 +284,7 @@
assert foxRun.fox != null;
}
- @Test(groups = { "contexts", "beanDestruction" })
+ @Test(groups = { "contexts", "beanDestruction", "ri-broken" })
@SpecAssertion(section = "8.3.2", id = "a")
public void testDestroyingParentDestroysDependents() throws Exception
{
@@ -361,7 +368,7 @@
OtherSpiderProducer currentSpiderProducerInstance = dependentContext.get(spiderProducer);
// Should not have any instance of this bean yet
assert currentSpiderProducerInstance == null;
- Tarantula spiderInstance = getCurrentManager().getInstanceByType(Tarantula.class);
+ Tarantula spiderInstance = getCurrentManager().getInstanceByType(Tarantula.class, TAME_LITERAL);
assert spiderInstance != null;
currentSpiderProducerInstance = dependentContext.get(spiderProducer);
// Still should not have any instance of this bean (already
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/OtherSpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/OtherSpiderProducer.java 2009-02-23 21:20:06 UTC (rev 1663)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/OtherSpiderProducer.java 2009-02-23 22:57:59 UTC (rev 1664)
@@ -2,7 +2,8 @@
import javax.inject.Produces;
+@AnotherDeploymentType
public class OtherSpiderProducer
{
- @Produces public Tarantula produceTarantula = new Tarantula();
+ @Produces @Tame public Tarantula produceTarantula = new Tarantula();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/SpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/SpiderProducer.java 2009-02-23 21:20:06 UTC (rev 1663)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/SpiderProducer.java 2009-02-23 22:57:59 UTC (rev 1664)
@@ -6,6 +6,7 @@
import javax.inject.Produces;
import javax.inject.manager.Manager;
+@AnotherDeploymentType
class SpiderProducer
{
@Current
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/Tame.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/Tame.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/Tame.java 2009-02-23 22:57:59 UTC (rev 1664)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.unit.context.dependent;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Tame
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/Tame.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/resources/tck-tests.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-tests.xml 2009-02-23 21:20:06 UTC (rev 1663)
+++ tck/trunk/impl/src/main/resources/tck-tests.xml 2009-02-23 22:57:59 UTC (rev 1664)
@@ -38,6 +38,7 @@
<exclude name="stub" />
<exclude name="broken" />
<exclude name="underInvestigation" />
+ <exclude name="ri-broken" />
</run>
</groups>
<packages>
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1663 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: bean and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-23 16:20:06 -0500 (Mon, 23 Feb 2009)
New Revision: 1663
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
Log:
Some fixes to toString() and deprecation of getBindings() for annotated items.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -90,7 +90,7 @@
}
if (resolvedBeans.size() > 1)
{
- throw new AmbiguousDependencyException("The injection point " + injectionPoint + " has ambiguos dependencies for type " + type + " and binding types " + bindings + " in " + bean);
+ throw new AmbiguousDependencyException("The injection point " + injectionPoint + " has ambiguous dependencies for type " + type + " and binding types " + bindings + " in " + bean);
}
Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
if (MetaDataCache.instance().getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(type))
@@ -140,11 +140,11 @@
{
if (!hasHigherPrecedence(bean.getDeploymentType(), abstractBean.getSpecializedBean().getDeploymentType()))
{
- throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean");
+ throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean: " + bean);
}
if (specializedBeans.contains(abstractBean.getSpecializedBean()))
{
- throw new InconsistentSpecializationException("Two beans cannot specialize the same bean");
+ throw new InconsistentSpecializationException("Two beans cannot specialize the same bean: " + bean);
}
specializedBeans.add(abstractBean.getSpecializedBean());
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -36,7 +36,7 @@
*
* @author David Allen
*
- * @param <T>
+ * @param <T> The actual type of the event object
* @param <S>
*/
public class EventBean<T, S> extends AbstractFacadeBean<Event<T>, S, T>
@@ -86,7 +86,7 @@
{
if (!this.getAnnotatedItem().getType().equals(Event.class))
{
- throw new DefinitionException("Observable field/parameter is not of type Event<T>: " + this.getAnnotatedItem());
+ throw new DefinitionException("Event field/parameter is not of type Event<T>: " + this.getAnnotatedItem());
}
}
@@ -164,17 +164,11 @@
public String toString()
{
StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
- if (getName() == null)
- {
- buffer.append(" unnamed event bean");
- }
- else
- {
- buffer.append(" enterprise bean '" + getName() + "'");
- }
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types " + getBindings() + "\n");
+ buffer.append(Names.scopeTypeToString(getScopeType()));
+ buffer.append("Event bean ");
+ buffer.append(getType().getName() + "\n");
+ buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getBindings()));
+ buffer.append("\n");
return buffer.toString();
}
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-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -4,11 +4,13 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Arrays;
+import java.util.HashSet;
import javax.inject.TypeLiteral;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem;
+import org.jboss.webbeans.util.Names;
/**
* Extension of an element which bases equality not only on type, but also on
@@ -40,12 +42,12 @@
if (type instanceof ParameterizedType)
{
this.actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
- this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types " + annotations;
+ this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
}
else
{
this.actualTypeArguments = new Type[0];
- this._string = rawType.toString() +"; binding types " + annotations;
+ this._string = rawType.toString() +"; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -85,6 +85,7 @@
*
* @returns A set of binding types present on the type. Returns an empty set
* if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding types
*/
public Set<Annotation> getBindings();
@@ -93,6 +94,7 @@
*
* @returns An array of binding types present on the type. Returns an empty
* array if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding types
*/
public Annotation[] getBindingsAsArray();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-02-23 20:50:23 UTC (rev 1662)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-02-23 21:20:06 UTC (rev 1663)
@@ -235,7 +235,7 @@
{
return toString;
}
- toString = "Annotated method " + Names.methodToString(method);
+ toString = "Annotated method on class " + getDeclaringClass().getName() + Names.methodToString(method);
return toString;
}
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1662 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: context/beanstore and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-23 15:50:23 -0500 (Mon, 23 Feb 2009)
New Revision: 1662
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanStore.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanStoreNamingScheme.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/PrefixBeanStoreNamingScheme.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanStore.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanStore.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanMapAdaptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMapAdaptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java
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/AbstractThreadLocalMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
Log:
beanmap -> beanstore
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-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -30,7 +30,7 @@
/**
* Base for the Context implementations. Delegates calls to the abstract
- * getBeanMap and getActive to allow for different implementations (storage
+ * getBeanStorage and getActive to allow for different implementations (storage
* types and ThreadLocal vs. shared)
*
* @author Nicklas Karlsson
@@ -69,7 +69,7 @@
{
throw new ContextNotActiveException();
}
- T instance = getBeanMap().get(contextual);
+ T instance = getBeanStorage().get(contextual);
if (instance != null)
{
return instance;
@@ -79,7 +79,7 @@
instance = contextual.create(creationalContext);
if (instance != null)
{
- getBeanMap().put(contextual, instance);
+ getBeanStorage().put(contextual, instance);
}
return instance;
}
@@ -103,7 +103,7 @@
private <T> void destroy(Contextual<T> bean)
{
log.trace("Destroying " + bean);
- bean.destroy(getBeanMap().get(bean));
+ bean.destroy(getBeanStorage().get(bean));
}
/**
@@ -112,11 +112,11 @@
public void destroy()
{
log.trace("Destroying context");
- for (Contextual<? extends Object> bean : getBeanMap().getBeans())
+ for (Contextual<? extends Object> bean : getBeanStorage().getBeans())
{
destroy(bean);
}
- getBeanMap().clear();
+ getBeanStorage().clear();
}
/**
@@ -124,6 +124,6 @@
*
* @return The actual bean map
*/
- protected abstract BeanStore getBeanMap();
+ protected abstract BeanStore getBeanStorage();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -19,10 +19,9 @@
* Gets the bean map
*
* @returns The bean map
- * @see org.jboss.webbeans.context.AbstractContext#getNewEnterpriseBeanMap()
*/
@Override
- public BeanStore getBeanMap()
+ public BeanStore getBeanStorage()
{
return beanStore.get();
}
@@ -32,7 +31,7 @@
*
* @param beanStore The bean map
*/
- public void setBeanMap(BeanStore beanStore)
+ public void setBeanStore(BeanStore beanStore)
{
this.beanStore.set(beanStore);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -61,7 +61,7 @@
* @return The bean map
*/
@Override
- public BeanStore getBeanMap()
+ public BeanStore getBeanStorage()
{
return this.beanStore;
}
@@ -69,11 +69,11 @@
/**
* Sets the bean map
*
- * @param applicationBeanMap The bean map
+ * @param applicationBeanStore The bean map
*/
- public void setBeanMap(BeanStore applicationBeanMap)
+ public void setBeanStore(BeanStore applicationBeanStore)
{
- this.beanStore = applicationBeanMap;
+ this.beanStore = applicationBeanStore;
}
/**
@@ -102,8 +102,8 @@
public String toString()
{
String active = isActive() ? "Active " : "Inactive ";
- String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
- return active + "application context " + beanMapInfo;
+ String beanStoreInfo = getBeanStorage() == null ? "" : getBeanStorage().toString();
+ return active + "application context " + beanStoreInfo;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ConversationContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -52,8 +52,8 @@
public String toString()
{
String active = isActive() ? "Active " : "Inactive ";
- String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
- return active + "conversation context " + beanMapInfo;
+ String beanStoreInfo = getBeanStorage() == null ? "" : getBeanStorage().toString();
+ return active + "conversation context " + beanStoreInfo;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/RequestContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -47,8 +47,8 @@
public String toString()
{
String active = isActive() ? "Active " : "Inactive ";
- String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
- return active + "request context " + beanMapInfo;
+ String beanStoreInfo = getBeanStorage() == null ? "" : getBeanStorage().toString();
+ return active + "request context " + beanStoreInfo;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/SessionContext.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -52,8 +52,8 @@
public String toString()
{
String active = isActive() ? "Active " : "Inactive ";
- String beanMapInfo = getBeanMap() == null ? "" : getBeanMap().toString();
- return active + "session context " + beanMapInfo;
+ String beanStoreInfo = getBeanStorage() == null ? "" : getBeanStorage().toString();
+ return active + "session context " + beanStoreInfo;
}
}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap)
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanMap.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,181 +0,0 @@
-/*
- * 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.context.beanmap;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.context.Contextual;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.EnumerationIterable;
-import org.jboss.webbeans.util.Names;
-
-/**
- * Provides common BeanMap operations
- *
- * @author Nicklas Karlsson
- *
- */
-public abstract class AbstractBeanMap implements BeanStore
-{
- // The log provider
- private static LogProvider log = Logging.getLogProvider(AbstractBeanMap.class);
-
- /**
- * Gets a bean from the map
- *
- * @param contextual The bean to get
- * @return The instance
- */
- @SuppressWarnings("unchecked")
- public <T> T get(Contextual<? extends T> contextual)
- {
- String key = getBeanMapAdaptor().getContextualKey(contextual);
- T instance = (T) getAttribute(key);
- log.trace("Looked for " + key + " and got " + instance);
- return instance;
- }
-
- /**
- * Removes an instance from the map
- *
- * @param contextual The bean of the instance to remove
- * @return The removed instance
- */
- public <T> T remove(Contextual<? extends T> contextual)
- {
- T instance = get(contextual);
- String key = getBeanMapAdaptor().getContextualKey(contextual);
- removeAttribute(key);
- log.trace("Removed bean under key " + key);
- return instance;
- }
-
- /**
- * Clears the bean map
- */
- public void clear()
- {
- for (String attributeName : getFilteredAttributeNames())
- {
- removeAttribute(attributeName);
- }
- log.trace("Bean Map cleared");
- }
-
- /**
- * Returns the beans present in the map
- *
- * @return The beans
- */
- public Iterable<Contextual<? extends Object>> getBeans()
- {
- List<Contextual<?>> contextuals = new ArrayList<Contextual<?>>();
- BeanMapAdaptor adaptor = getBeanMapAdaptor();
- for (String attributeName : getFilteredAttributeNames())
- {
- int beanIndex = adaptor.getBeanIndexFromKey(attributeName);
- Contextual<?> contextual = CurrentManager.rootManager().getBeans().get(beanIndex);
- contextuals.add(contextual);
- }
- return contextuals;
- }
-
- /**
- * Gets the list of attribute names that is held by the bean map
- *
- * @return The list of attribute names
- */
- private List<String> getFilteredAttributeNames()
- {
- List<String> attributeNames = new ArrayList<String>();
- BeanMapAdaptor adaptor = getBeanMapAdaptor();
- for (String attributeName : new EnumerationIterable<String>(getAttributeNames()))
- {
- if (adaptor.acceptKey(attributeName))
- {
- attributeNames.add(attributeName);
- }
- }
- return attributeNames;
- }
-
- /**
- * Puts an instance of a bean in the map
- *
- * @param bean The key bean
- * @param instance The instance
- * @return The instance added
- */
- public <T> void put(Contextual<? extends T> bean, T instance)
- {
- String key = getBeanMapAdaptor().getContextualKey(bean);
- setAttribute(key, instance);
- log.trace("Added bean " + bean + " under key " + key);
- }
-
- /**
- * Gets an attribute from the underlying storage
- *
- * @param key The key of the attribute
- * @return The data
- */
- protected abstract Object getAttribute(String key);
-
- /**
- * Removes an attribute from the underlying storage
- *
- * @param key The attribute to remove
- */
- protected abstract void removeAttribute(String key);
-
- /**
- * Gets an enumeration of the attribute names present in the underlying
- * storage
- *
- * @return The attribute names
- */
- protected abstract Enumeration<String> getAttributeNames();
-
- /**
- * Sets an instance under a key in the underlying storage
- *
- * @param key The key
- * @param instance The instance
- */
- protected abstract void setAttribute(String key, Object instance);
-
- /**
- * Gets an adaptor for handling keys in a bean map
- *
- * @return The filter
- */
- protected abstract BeanMapAdaptor getBeanMapAdaptor();
-
-
- @Override
- public String toString()
- {
- return "holding " + Names.count(getBeans()) + " instances";
- }
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanStore.java (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanStore.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,181 @@
+/*
+ * 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.context.beanstore;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.context.Contextual;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.EnumerationIterable;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * Provides common BeanStore operations
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+public abstract class AbstractBeanStore implements BeanStore
+{
+ // The log provider
+ private static LogProvider log = Logging.getLogProvider(AbstractBeanStore.class);
+
+ /**
+ * Gets a bean from the map
+ *
+ * @param contextual The bean to get
+ * @return The instance
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T get(Contextual<? extends T> contextual)
+ {
+ String key = getBeanNamingScheme().getContextualKey(contextual);
+ T instance = (T) getAttribute(key);
+ log.trace("Looked for " + key + " and got " + instance);
+ return instance;
+ }
+
+ /**
+ * Removes an instance from the map
+ *
+ * @param contextual The bean of the instance to remove
+ * @return The removed instance
+ */
+ public <T> T remove(Contextual<? extends T> contextual)
+ {
+ T instance = get(contextual);
+ String key = getBeanNamingScheme().getContextualKey(contextual);
+ removeAttribute(key);
+ log.trace("Removed bean under key " + key);
+ return instance;
+ }
+
+ /**
+ * Clears the bean map
+ */
+ public void clear()
+ {
+ for (String attributeName : getFilteredAttributeNames())
+ {
+ removeAttribute(attributeName);
+ }
+ log.trace("Bean Map cleared");
+ }
+
+ /**
+ * Returns the beans present in the map
+ *
+ * @return The beans
+ */
+ public Iterable<Contextual<? extends Object>> getBeans()
+ {
+ List<Contextual<?>> contextuals = new ArrayList<Contextual<?>>();
+ BeanStoreNamingScheme namingScheme = getBeanNamingScheme();
+ for (String attributeName : getFilteredAttributeNames())
+ {
+ int beanIndex = namingScheme.getBeanIndexFromKey(attributeName);
+ Contextual<?> contextual = CurrentManager.rootManager().getBeans().get(beanIndex);
+ contextuals.add(contextual);
+ }
+ return contextuals;
+ }
+
+ /**
+ * Gets the list of attribute names that is held by the bean map
+ *
+ * @return The list of attribute names
+ */
+ private List<String> getFilteredAttributeNames()
+ {
+ List<String> attributeNames = new ArrayList<String>();
+ BeanStoreNamingScheme namingScheme = getBeanNamingScheme();
+ for (String attributeName : new EnumerationIterable<String>(getAttributeNames()))
+ {
+ if (namingScheme.acceptKey(attributeName))
+ {
+ attributeNames.add(attributeName);
+ }
+ }
+ return attributeNames;
+ }
+
+ /**
+ * Puts an instance of a bean in the map
+ *
+ * @param bean The key bean
+ * @param instance The instance
+ * @return The instance added
+ */
+ public <T> void put(Contextual<? extends T> bean, T instance)
+ {
+ String key = getBeanNamingScheme().getContextualKey(bean);
+ setAttribute(key, instance);
+ log.trace("Added bean " + bean + " under key " + key);
+ }
+
+ /**
+ * Gets an attribute from the underlying storage
+ *
+ * @param key The key of the attribute
+ * @return The data
+ */
+ protected abstract Object getAttribute(String key);
+
+ /**
+ * Removes an attribute from the underlying storage
+ *
+ * @param key The attribute to remove
+ */
+ protected abstract void removeAttribute(String key);
+
+ /**
+ * Gets an enumeration of the attribute names present in the underlying
+ * storage
+ *
+ * @return The attribute names
+ */
+ protected abstract Enumeration<String> getAttributeNames();
+
+ /**
+ * Sets an instance under a key in the underlying storage
+ *
+ * @param key The key
+ * @param instance The instance
+ */
+ protected abstract void setAttribute(String key, Object instance);
+
+ /**
+ * Gets an naming scheme for handling keys in a bean map
+ *
+ * @return The naming scheme
+ */
+ protected abstract BeanStoreNamingScheme getBeanNamingScheme();
+
+
+ @Override
+ public String toString()
+ {
+ return "holding " + Names.count(getBeans()) + " instances";
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/AbstractBeanStore.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanMapAdaptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanMapAdaptor.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,52 +0,0 @@
-/*
- * 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.context.beanmap;
-
-import javax.context.Contextual;
-
-/**
- * Interface against a BeanMap to handle different naming schemes
- *
- * @author Nicklas Karlsson
- *
- */
-public interface BeanMapAdaptor
-{
- /**
- * Checks if a key is handled by the bean map
- *
- * @param key The key to match
- * @return True if match, false otherwise
- */
- public abstract boolean acceptKey(String key);
-
- /**
- * Gets a bean map key for a contextual
- *
- * @param contextual The contextual to make the key for
- * @return A map key
- */
- public abstract String getContextualKey(Contextual<?> contextual);
-
- /**
- * Gets a bean index key from a key
- *
- * @param key The key to parse
- * @return The bean index
- */
- public abstract int getBeanIndexFromKey(String key);
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanStoreNamingScheme.java (from rev 1657, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanStoreNamingScheme.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanStoreNamingScheme.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,52 @@
+/*
+ * 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.context.beanstore;
+
+import javax.context.Contextual;
+
+/**
+ * Interface against a BeanStore to handle different naming schemes
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+public interface BeanStoreNamingScheme
+{
+ /**
+ * Checks if a key is handled by the bean map
+ *
+ * @param key The key to match
+ * @return True if match, false otherwise
+ */
+ public abstract boolean acceptKey(String key);
+
+ /**
+ * Gets a bean map key for a contextual
+ *
+ * @param contextual The contextual to make the key for
+ * @return A map key
+ */
+ public abstract String getContextualKey(Contextual<?> contextual);
+
+ /**
+ * Gets a bean index key from a key
+ *
+ * @param key The key to parse
+ * @return The bean index
+ */
+ public abstract int getBeanIndexFromKey(String key);
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/BeanStoreNamingScheme.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/PrefixBeanStoreNamingScheme.java (from rev 1657, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/PrefixBeanStoreNamingScheme.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/PrefixBeanStoreNamingScheme.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,58 @@
+/*
+ * 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.context.beanstore;
+
+import javax.context.Contextual;
+
+import org.jboss.webbeans.CurrentManager;
+
+/**
+ * Simple prefix-based implementation of a bean map naming scheme
+ *
+ * @author Nicklas Karlsson
+ */
+public class PrefixBeanStoreNamingScheme implements BeanStoreNamingScheme
+{
+ public String prefix;
+ public String delimeter;
+
+ public PrefixBeanStoreNamingScheme(String prefix, String delimeter)
+ {
+ if (prefix.indexOf(delimeter) >= 0)
+ {
+ throw new IllegalArgumentException("The prefix '" + prefix + "' shouldn't be in the prefix '" + prefix + "'");
+ }
+ this.prefix = prefix;
+ this.delimeter = delimeter;
+ }
+
+ public boolean acceptKey(String key)
+ {
+ return key.startsWith(prefix);
+ }
+
+ public int getBeanIndexFromKey(String key)
+ {
+ return Integer.parseInt(key.substring(prefix.length() + delimeter.length()));
+ }
+
+ public String getContextualKey(Contextual<?> contextual)
+ {
+ return prefix + delimeter + CurrentManager.rootManager().getBeans().indexOf(contextual);
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/PrefixBeanStoreNamingScheme.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMap.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,139 +0,0 @@
-/*
- * 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.context.beanmap;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.context.Contextual;
-import javax.inject.manager.Bean;
-
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-import com.google.common.collect.ForwardingMap;
-
-/**
- * A BeanMap that uses a simple forwarding HashMap as backing map
- *
- * @author Nicklas Karlsson
- */
-public class SimpleBeanMap extends ForwardingMap<Contextual<? extends Object>, Object> implements BeanStore
-{
- private static LogProvider log = Logging.getLogProvider(SimpleBeanMap.class);
-
- // The backing map
- protected Map<Contextual<? extends Object>, Object> delegate;
-
- /**
- * Constructor
- */
- public SimpleBeanMap()
- {
- delegate = new ConcurrentHashMap<Contextual<? extends Object>, Object>();
- }
-
- /**
- * Gets an instance from the map
- *
- * @param The bean to look for
- * @return An instance, if found
- *
- * @see org.jboss.webbeans.context.api.BeanStore#get(Bean)
- */
- public <T extends Object> T get(Contextual<? extends T> bean)
- {
- @SuppressWarnings("unchecked")
- T instance = (T) super.get(bean);
- log.trace("Searched bean map for " + bean + " and got " + instance);
- return instance;
- }
-
- /**
- * Gets the delegate for the map
- *
- * @return The delegate
- */
- @Override
- public Map<Contextual<? extends Object>, Object> delegate()
- {
- return delegate;
- }
-
- /**
- * Removed a instance from the map
- *
- * @param bean the bean to remove
- * @return The instance removed
- *
- * @see org.jboss.webbeans.context.api.BeanStore#remove(Bean)
- */
- public <T extends Object> T remove(Contextual<? extends T> bean)
- {
- @SuppressWarnings("unchecked")
- T instance = (T) super.remove(bean);
- log.trace("Removed instace " + instance + " for bean " + bean + " from the bean map");
- return instance;
- }
-
- /**
- * Clears the map
- *
- * @see org.jboss.webbeans.context.api.BeanStore#clear()
- */
- public void clear()
- {
- delegate.clear();
- log.trace("Bean map cleared");
- }
-
- /**
- * Returns the beans contained in the map
- *
- * @return The beans present
- *
- * @see org.jboss.webbeans.context.api.BeanStore#getBeans()
- */
- public Set<Contextual<? extends Object>> getBeans()
- {
- return delegate.keySet();
- }
-
- /**
- * Puts a bean instance under the bean key in the map
- *
- * @param bean The bean
- * @param instance the instance
- *
- * @see org.jboss.webbeans.context.api.BeanStore#put(Bean, Object)
- */
- public <T> void put(Contextual<? extends T> bean, T instance)
- {
- delegate.put(bean, instance);
- log.trace("Stored instance " + instance + " for bean " + bean + " in bean map");
- }
-
- @Override
- public String toString()
- {
- return "holding " + delegate.size() + " instances";
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMapAdaptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanMapAdaptor.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,52 +0,0 @@
-/*
- * 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.context.beanmap;
-
-import javax.context.Contextual;
-
-import org.jboss.webbeans.CurrentManager;
-
-/**
- * Simple prefix-based implementation of a bean map adaptor
- *
- * @author Nicklas Karlsson
- */
-public class SimpleBeanMapAdaptor implements BeanMapAdaptor
-{
- public String prefix;
-
- public SimpleBeanMapAdaptor(String prefix)
- {
- this.prefix = prefix;
- }
-
- public boolean acceptKey(String key)
- {
- return key.startsWith(prefix);
- }
-
- public int getBeanIndexFromKey(String key)
- {
- return Integer.parseInt(key.substring(prefix.length() + 1));
- }
-
- public String getContextualKey(Contextual<?> contextual)
- {
- return prefix + "#" + CurrentManager.rootManager().getBeans().indexOf(contextual);
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanStore.java (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanStore.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,139 @@
+/*
+ * 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.context.beanstore;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.context.Contextual;
+import javax.inject.manager.Bean;
+
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+import com.google.common.collect.ForwardingMap;
+
+/**
+ * A BeanStore that uses a simple forwarding HashMap as backing storage
+ *
+ * @author Nicklas Karlsson
+ */
+public class SimpleBeanStore extends ForwardingMap<Contextual<? extends Object>, Object> implements BeanStore
+{
+ private static LogProvider log = Logging.getLogProvider(SimpleBeanStore.class);
+
+ // The backing map
+ protected Map<Contextual<? extends Object>, Object> delegate;
+
+ /**
+ * Constructor
+ */
+ public SimpleBeanStore()
+ {
+ delegate = new ConcurrentHashMap<Contextual<? extends Object>, Object>();
+ }
+
+ /**
+ * Gets an instance from the map
+ *
+ * @param The bean to look for
+ * @return An instance, if found
+ *
+ * @see org.jboss.webbeans.context.api.BeanStore#get(Bean)
+ */
+ public <T extends Object> T get(Contextual<? extends T> bean)
+ {
+ @SuppressWarnings("unchecked")
+ T instance = (T) super.get(bean);
+ log.trace("Searched bean map for " + bean + " and got " + instance);
+ return instance;
+ }
+
+ /**
+ * Gets the delegate for the map
+ *
+ * @return The delegate
+ */
+ @Override
+ public Map<Contextual<? extends Object>, Object> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Removed a instance from the map
+ *
+ * @param bean the bean to remove
+ * @return The instance removed
+ *
+ * @see org.jboss.webbeans.context.api.BeanStore#remove(Bean)
+ */
+ public <T extends Object> T remove(Contextual<? extends T> bean)
+ {
+ @SuppressWarnings("unchecked")
+ T instance = (T) super.remove(bean);
+ log.trace("Removed instace " + instance + " for bean " + bean + " from the bean map");
+ return instance;
+ }
+
+ /**
+ * Clears the map
+ *
+ * @see org.jboss.webbeans.context.api.BeanStore#clear()
+ */
+ public void clear()
+ {
+ delegate.clear();
+ log.trace("Bean map cleared");
+ }
+
+ /**
+ * Returns the beans contained in the map
+ *
+ * @return The beans present
+ *
+ * @see org.jboss.webbeans.context.api.BeanStore#getBeans()
+ */
+ public Set<Contextual<? extends Object>> getBeans()
+ {
+ return delegate.keySet();
+ }
+
+ /**
+ * Puts a bean instance under the bean key in the map
+ *
+ * @param bean The bean
+ * @param instance the instance
+ *
+ * @see org.jboss.webbeans.context.api.BeanStore#put(Bean, Object)
+ */
+ public <T> void put(Contextual<? extends T> bean, T instance)
+ {
+ delegate.put(bean, instance);
+ log.trace("Stored instance " + instance + " for bean " + bean + " in bean map");
+ }
+
+ @Override
+ public String toString()
+ {
+ return "holding " + delegate.size() + " instances";
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanstore/SimpleBeanStore.java
___________________________________________________________________
Name: svn:mergeinfo
+
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-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -25,7 +25,7 @@
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ConversationBeanMap;
+import org.jboss.webbeans.servlet.ConversationBeanStore;
import org.jboss.webbeans.servlet.ServletLifecycle;
/**
@@ -92,7 +92,7 @@
/**
* Destroys the conversation and it's associated conversational context
*
- * @param session The HTTP session for the backing context beanmap
+ * @param session The HTTP session for the backing context bean store
*/
public void destroy(HttpSession session)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -27,7 +27,7 @@
import org.jboss.webbeans.conversation.ConversationManager;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ConversationBeanMap;
+import org.jboss.webbeans.servlet.ConversationBeanStore;
import org.jboss.webbeans.servlet.HttpSessionManager;
import org.jboss.webbeans.servlet.ServletLifecycle;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -20,7 +20,7 @@
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+import org.jboss.webbeans.context.beanstore.SimpleBeanStore;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.servlet.AbstractLifecycle;
@@ -33,9 +33,9 @@
private final WebBeansBootstrap bootstrap;
private final MockWebBeanDiscovery webBeanDiscovery;
- private BeanStore applicationBeanMap = new SimpleBeanMap();
- private BeanStore sessionBeanMap = new SimpleBeanMap();
- private BeanStore requestBeanMap = new SimpleBeanMap();
+ private BeanStore applicationBeanStore = new SimpleBeanStore();
+ private BeanStore sessionBeanStore = new SimpleBeanStore();
+ private BeanStore requestBeanStore = new SimpleBeanStore();
public MockLifecycle()
{
@@ -75,12 +75,12 @@
public void beginApplication()
{
- super.beginApplication("Mock", applicationBeanMap);
- BeanStore requestBeanMap = new SimpleBeanMap();
- super.beginDeploy(requestBeanMap);
+ super.beginApplication("Mock", applicationBeanStore);
+ BeanStore requestBeanStore = new SimpleBeanStore();
+ super.beginDeploy(requestBeanStore);
bootstrap.setEjbDiscovery(new MockEjbDiscovery(webBeanDiscovery.discoverWebBeanClasses()));
bootstrap.boot();
- super.endDeploy(requestBeanMap);
+ super.endDeploy(requestBeanStore);
}
public void resetContexts()
@@ -90,28 +90,28 @@
public void endApplication()
{
- super.endApplication("Mock", applicationBeanMap);
+ super.endApplication("Mock", applicationBeanStore);
}
public void beginRequest()
{
- super.beginRequest("Mock", requestBeanMap);
+ super.beginRequest("Mock", requestBeanStore);
}
public void endRequest()
{
- super.endRequest("Mock", requestBeanMap);
+ super.endRequest("Mock", requestBeanStore);
}
public void beginSession()
{
- super.beginSession("Mock", sessionBeanMap);
+ super.beginSession("Mock", sessionBeanStore);
}
public void endSession()
{
// TODO Conversation handling breaks this :-(
- //super.endSession("Mock", sessionBeanMap);
+ //super.endSession("Mock", sessionBeanStore);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -50,80 +50,80 @@
manager.addContext(ConversationContext.create());
}
- protected void beginApplication(String id, BeanStore applicationBeanMap)
+ protected void beginApplication(String id, BeanStore applicationBeanStore)
{
log.trace("Starting application " + id);
- ApplicationContext.INSTANCE.setBeanMap(applicationBeanMap);
+ ApplicationContext.INSTANCE.setBeanStore(applicationBeanStore);
ApplicationContext.INSTANCE.setActive(true);
}
- protected void beginDeploy(BeanStore requestBeanMap)
+ protected void beginDeploy(BeanStore requestBeanStore)
{
- RequestContext.INSTANCE.setBeanMap(requestBeanMap);
+ RequestContext.INSTANCE.setBeanStore(requestBeanStore);
RequestContext.INSTANCE.setActive(true);
}
- protected void endDeploy(BeanStore requestBeanMap)
+ protected void endDeploy(BeanStore requestBeanStore)
{
- RequestContext.INSTANCE.setBeanMap(null);
+ RequestContext.INSTANCE.setBeanStore(null);
RequestContext.INSTANCE.setActive(false);
}
- protected void endApplication(String id, BeanStore applicationBeanMap)
+ protected void endApplication(String id, BeanStore applicationBeanStore)
{
log.trace("Ending application " + id);
ApplicationContext.INSTANCE.destroy();
ApplicationContext.INSTANCE.setActive(false);
- ApplicationContext.INSTANCE.setBeanMap(null);
+ ApplicationContext.INSTANCE.setBeanStore(null);
}
- protected void beginSession(String id, BeanStore sessionBeanMap)
+ protected void beginSession(String id, BeanStore sessionBeanStore)
{
log.trace("Starting session " + id);
- SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
+ SessionContext.INSTANCE.setBeanStore(sessionBeanStore);
SessionContext.INSTANCE.setActive(true);
}
- protected void endSession(String id, BeanStore sessionBeanMap)
+ protected void endSession(String id, BeanStore sessionBeanStore)
{
log.trace("Ending session " + id);
ConversationManager conversationManager = CurrentManager.rootManager().getInstanceByType(ConversationManager.class);
conversationManager.destroyAllConversations();
SessionContext.INSTANCE.destroy();
- SessionContext.INSTANCE.setBeanMap(null);
+ SessionContext.INSTANCE.setBeanStore(null);
SessionContext.INSTANCE.setActive(false);
}
- public void beginRequest(String id, BeanStore requestBeanMap)
+ public void beginRequest(String id, BeanStore requestBeanStore)
{
log.trace("Starting request " + id);
- RequestContext.INSTANCE.setBeanMap(requestBeanMap);
+ RequestContext.INSTANCE.setBeanStore(requestBeanStore);
RequestContext.INSTANCE.setActive(true);
DependentContext.INSTANCE.setActive(true);
}
- public void endRequest(String id, BeanStore requestBeanMap)
+ public void endRequest(String id, BeanStore requestBeanStore)
{
log.trace("Ending request " + id);
- RequestContext.INSTANCE.setBeanMap(requestBeanMap);
+ RequestContext.INSTANCE.setBeanStore(requestBeanStore);
DependentContext.INSTANCE.setActive(false);
RequestContext.INSTANCE.destroy();
RequestContext.INSTANCE.setActive(false);
}
- protected void restoreConversation(String id, BeanStore conversationBeanMap)
+ protected void restoreConversation(String id, BeanStore conversationBeanStore)
{
log.trace("Starting conversation " + id);
- ConversationContext.INSTANCE.setBeanMap(conversationBeanMap);
+ ConversationContext.INSTANCE.setBeanStore(conversationBeanStore);
ConversationContext.INSTANCE.setActive(true);
}
- protected void destroyConversation(String id, ConversationBeanMap conversationBeanMap)
+ protected void destroyConversation(String id, ConversationBeanStore conversationBeanStore)
{
log.trace("Ending conversation " + id);
ConversationContext destructionContext = new ConversationContext();
- destructionContext.setBeanMap(conversationBeanMap);
+ destructionContext.setBeanStore(conversationBeanStore);
destructionContext.destroy();
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,95 +0,0 @@
-/*
- * 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.servlet;
-
-import java.util.Enumeration;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.webbeans.context.ApplicationContext;
-import org.jboss.webbeans.context.beanmap.AbstractBeanMap;
-import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
-
-/**
- * A BeanMap that uses a servlet context as backing map
- *
- * @author Nicklas Karlsson
- *
- * @see org.jboss.webbeans.context.ApplicationContext
- */
-public class ApplicationBeanMap extends AbstractBeanMap
-{
- // The servlet context to use as backing map
- private ServletContext context;
-
- /**
- * Constructor
- *
- * @param context The servlet context instance
- */
- public ApplicationBeanMap(ServletContext context)
- {
- super();
- this.context = context;
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
- */
- @Override
- protected Object getAttribute(String key)
- {
- return context.getAttribute(key);
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttributeNames()
- */
- @SuppressWarnings("unchecked")
- @Override
- protected Enumeration<String> getAttributeNames()
- {
- return context.getAttributeNames();
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#removeAttributes()
- */
- @Override
- protected void removeAttribute(String key)
- {
- context.removeAttribute(key);
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#setAttribute()
- */
- @Override
- protected void setAttribute(String key, Object instance)
- {
- context.setAttribute(key, instance);
- }
-
- @Override
- protected BeanMapAdaptor getBeanMapAdaptor()
- {
- return new SimpleBeanMapAdaptor(ApplicationContext.class.getName());
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,95 @@
+/*
+ * 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.servlet;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.beanstore.AbstractBeanStore;
+import org.jboss.webbeans.context.beanstore.BeanStoreNamingScheme;
+import org.jboss.webbeans.context.beanstore.PrefixBeanStoreNamingScheme;
+
+/**
+ * A BeanStore that uses a servlet context as backing storage
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.ApplicationContext
+ */
+public class ApplicationBeanStore extends AbstractBeanStore
+{
+ // The servlet context to use as backing map
+ private ServletContext context;
+
+ /**
+ * Constructor
+ *
+ * @param context The servlet context instance
+ */
+ public ApplicationBeanStore(ServletContext context)
+ {
+ super();
+ this.context = context;
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#getAttribute()
+ */
+ @Override
+ protected Object getAttribute(String key)
+ {
+ return context.getAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#getAttributeNames()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ return context.getAttributeNames();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#removeAttributes()
+ */
+ @Override
+ protected void removeAttribute(String key)
+ {
+ context.removeAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#setAttribute()
+ */
+ @Override
+ protected void setAttribute(String key, Object instance)
+ {
+ context.setAttribute(key, instance);
+ }
+
+ @Override
+ protected BeanStoreNamingScheme getBeanNamingScheme()
+ {
+ return new PrefixBeanStoreNamingScheme(ApplicationContext.class.getName(), "#");
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,47 +0,0 @@
-/*
- * 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.servlet;
-
-import javax.servlet.http.HttpSession;
-
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
-
-/**
- * A HTTP session backed bean map for the conversational scope
- *
- * @author Nicklas Karlsson
- */
-public class ConversationBeanMap extends HttpSessionBeanMap
-{
- private String cid;
-
- public ConversationBeanMap(HttpSession session, String cid)
- {
- super(session);
- this.cid = cid;
- }
-
- @Override
- protected BeanMapAdaptor getBeanMapAdaptor()
- {
- return new SimpleBeanMapAdaptor(ConversationContext.class.getName() + "[" + cid + "]");
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,47 @@
+/*
+ * 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.servlet;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.webbeans.context.ConversationContext;
+import org.jboss.webbeans.context.beanstore.BeanStoreNamingScheme;
+import org.jboss.webbeans.context.beanstore.PrefixBeanStoreNamingScheme;
+
+/**
+ * A HTTP session backed bean map for the conversational scope
+ *
+ * @author Nicklas Karlsson
+ */
+public class ConversationBeanStore extends HttpSessionBeanStore
+{
+ private String cid;
+
+ public ConversationBeanStore(HttpSession session, String cid)
+ {
+ super(session);
+ this.cid = cid;
+ }
+
+ @Override
+ protected BeanStoreNamingScheme getBeanNamingScheme()
+ {
+ return new PrefixBeanStoreNamingScheme(ConversationContext.class.getName() + "[" + cid + "]", "#");
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -1,94 +0,0 @@
-/*
- * 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.servlet;
-
-import java.util.Enumeration;
-
-import javax.servlet.http.HttpSession;
-
-import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanmap.AbstractBeanMap;
-import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
-
-/**
- * A BeanMap that uses a HTTP session as backing map
- *
- * @author Nicklas Karlsson
- *
- * @see org.jboss.webbeans.context.ApplicationContext
- */
-public class HttpSessionBeanMap extends AbstractBeanMap
-{
- // The HTTP session context to use as backing map
- private HttpSession session;
-
- /**
- * Constructor
- *
- * @param session The HTTP session
- */
- public HttpSessionBeanMap(HttpSession session)
- {
- super();
- this.session = session;
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
- */
- @Override
- protected Object getAttribute(String key)
- {
- return session.getAttribute(key);
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttributeNames()
- */
- @SuppressWarnings("unchecked")
- @Override
- protected Enumeration<String> getAttributeNames()
- {
- return session.getAttributeNames();
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#removeAttributes()
- */
- @Override
- protected void removeAttribute(String key)
- {
- session.removeAttribute(key);
- }
-
- /**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#setAttribute()
- */
- @Override
- protected void setAttribute(String key, Object instance)
- {
- session.setAttribute(key, instance);
- }
-
- @Override
- protected BeanMapAdaptor getBeanMapAdaptor()
- {
- return new SimpleBeanMapAdaptor(SessionContext.class.getName());
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanStore.java (from rev 1661, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanStore.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -0,0 +1,94 @@
+/*
+ * 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.servlet;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.context.beanstore.AbstractBeanStore;
+import org.jboss.webbeans.context.beanstore.BeanStoreNamingScheme;
+import org.jboss.webbeans.context.beanstore.PrefixBeanStoreNamingScheme;
+
+/**
+ * A BeanStore that uses a HTTP session as backing storage
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.ApplicationContext
+ */
+public class HttpSessionBeanStore extends AbstractBeanStore
+{
+ // The HTTP session context to use as backing map
+ private HttpSession session;
+
+ /**
+ * Constructor
+ *
+ * @param session The HTTP session
+ */
+ public HttpSessionBeanStore(HttpSession session)
+ {
+ super();
+ this.session = session;
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#getAttribute()
+ */
+ @Override
+ protected Object getAttribute(String key)
+ {
+ return session.getAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#getAttributeNames()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ return session.getAttributeNames();
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#removeAttributes()
+ */
+ @Override
+ protected void removeAttribute(String key)
+ {
+ session.removeAttribute(key);
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractBeanStore#setAttribute()
+ */
+ @Override
+ protected void setAttribute(String key, Object instance)
+ {
+ session.setAttribute(key, instance);
+ }
+
+ @Override
+ protected BeanStoreNamingScheme getBeanNamingScheme()
+ {
+ return new PrefixBeanStoreNamingScheme(SessionContext.class.getName(), "#");
+ }
+
+}
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-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -24,7 +24,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+import org.jboss.webbeans.context.beanstore.SimpleBeanStore;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -40,7 +40,7 @@
public class ServletLifecycle extends AbstractLifecycle
{
- public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle.class.getName() + ".requestBeanMap";
+ public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle.class.getName() + ".requestBeanStore";
static
{
@@ -71,11 +71,11 @@
{
ServletInitialization servletInitialization = new ServletInitialization(servletContext).initialize();
super.initialize();
- super.beginApplication(servletContext.getServletContextName(), new ApplicationBeanMap(servletContext));
- BeanStore requestBeanMap = new SimpleBeanMap();
- super.beginDeploy(requestBeanMap);
+ super.beginApplication(servletContext.getServletContextName(), new ApplicationBeanStore(servletContext));
+ BeanStore requestBeanStore = new SimpleBeanStore();
+ super.beginDeploy(requestBeanStore);
servletInitialization.start();
- super.endDeploy(requestBeanMap);
+ super.endDeploy(requestBeanStore);
}
/**
@@ -83,7 +83,7 @@
*/
public void endApplication(ServletContext servletContext)
{
- super.endApplication(servletContext.getServletContextName(), new ApplicationBeanMap(servletContext));
+ super.endApplication(servletContext.getServletContextName(), new ApplicationBeanStore(servletContext));
}
/**
@@ -115,10 +115,10 @@
*/
protected BeanStore restoreSessionContext(HttpSession session)
{
- BeanStore sessionBeanMap = new HttpSessionBeanMap(session);
- SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
+ BeanStore sessionBeanStore = new HttpSessionBeanStore(session);
+ SessionContext.INSTANCE.setBeanStore(sessionBeanStore);
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
- return sessionBeanMap;
+ return sessionBeanStore;
}
/**
@@ -130,7 +130,7 @@
*/
public void beginRequest(HttpServletRequest request)
{
- BeanStore beanStore = new SimpleBeanMap();
+ BeanStore beanStore = new SimpleBeanStore();
request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
super.beginRequest(request.getRequestURI(), beanStore);
restoreSessionContext(request.getSession());
@@ -146,7 +146,7 @@
BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
super.endRequest(request.getRequestURI(), beanStore);
- SessionContext.INSTANCE.setBeanMap(null);
+ SessionContext.INSTANCE.setBeanStore(null);
}
/**
@@ -157,7 +157,7 @@
*/
public void restoreConversation(HttpSession session, String cid)
{
- super.restoreConversation(session.getId() + "[" + cid + "]", new ConversationBeanMap(session, cid));
+ super.restoreConversation(session.getId() + "[" + cid + "]", new ConversationBeanStore(session, cid));
}
/**
@@ -168,7 +168,7 @@
*/
public void destroyConversation(HttpSession session, String cid)
{
- super.destroyConversation(session.getId() + "[" + cid + "]", new ConversationBeanMap(session, cid));
+ super.destroyConversation(session.getId() + "[" + cid + "]", new ConversationBeanStore(session, cid));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -24,7 +24,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+import org.jboss.webbeans.context.beanstore.SimpleBeanStore;
/**
* Implementation of the Web Beans lifecycle that can react to servlet events.
@@ -37,7 +37,7 @@
public class ServletLifecycle2 extends AbstractLifecycle
{
- public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle2.class.getName() + ".requestBeanMap";
+ public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle2.class.getName() + ".requestBeanStore";
public static ServletLifecycle2 instance()
{
@@ -58,7 +58,7 @@
*/
public void beginApplication(ServletContext servletContext)
{
- super.beginApplication(servletContext.getServletContextName(), new ApplicationBeanMap(servletContext));
+ super.beginApplication(servletContext.getServletContextName(), new ApplicationBeanStore(servletContext));
}
/**
@@ -66,7 +66,7 @@
*/
public void endApplication(ServletContext servletContext)
{
- super.endApplication(servletContext.getServletContextName(), new ApplicationBeanMap(servletContext));
+ super.endApplication(servletContext.getServletContextName(), new ApplicationBeanStore(servletContext));
}
/**
@@ -98,10 +98,10 @@
*/
protected BeanStore restoreSessionContext(HttpSession session)
{
- BeanStore sessionBeanMap = new HttpSessionBeanMap(session);
- SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
+ BeanStore sessionBeanStore = new HttpSessionBeanStore(session);
+ SessionContext.INSTANCE.setBeanStore(sessionBeanStore);
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
- return sessionBeanMap;
+ return sessionBeanStore;
}
/**
@@ -114,7 +114,7 @@
public void beginRequest(HttpServletRequest request)
{
restoreSessionContext(request.getSession());
- BeanStore beanStore = new SimpleBeanMap();
+ BeanStore beanStore = new SimpleBeanStore();
request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
super.beginRequest(request.getRequestURI(), beanStore);
}
@@ -129,7 +129,7 @@
BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
super.endRequest(request.getRequestURI(), beanStore);
- SessionContext.INSTANCE.setBeanMap(null);
+ SessionContext.INSTANCE.setBeanStore(null);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-23 19:43:17 UTC (rev 1661)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-23 20:50:23 UTC (rev 1662)
@@ -54,18 +54,21 @@
public RedirectUrl appendCid(String cid)
{
- return new RedirectUrl(URL + (URL.indexOf("?") > 0 ? "&" : "?") + "cid=" + cid);
+ URL = URL + (URL.indexOf("?") > 0 ? "&" : "?") + "cid=" + cid;
+ return this;
}
public RedirectUrl getRedirectView()
{
String requestPath = context.getExternalContext().getRequestContextPath();
- return new RedirectUrl(URL.substring(URL.indexOf(requestPath) + requestPath.length()));
+ URL = URL.substring(URL.indexOf(requestPath) + requestPath.length());
+ return this;
}
public RedirectUrl getActionUrl()
{
- return new RedirectUrl(context.getApplication().getViewHandler().getActionURL(context, URL));
+ URL = context.getApplication().getViewHandler().getActionURL(context, URL);
+ return this;
}
public String encode()
@@ -80,7 +83,6 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
- System.out.println("!!!");
chain.doFilter(request, wrapResponse((HttpServletResponse) response));
}
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1661 - in ri/trunk/jboss-tck-runner: src/main/java/org/jboss/webbeans/tck/integration/jbossas and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-23 14:43:17 -0500 (Mon, 23 Feb 2009)
New Revision: 1661
Modified:
ri/trunk/jboss-tck-runner/pom.xml
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
Log:
Attempt to fix windows undeploy problems...
Modified: ri/trunk/jboss-tck-runner/pom.xml
===================================================================
--- ri/trunk/jboss-tck-runner/pom.xml 2009-02-23 18:36:03 UTC (rev 1660)
+++ ri/trunk/jboss-tck-runner/pom.xml 2009-02-23 19:43:17 UTC (rev 1661)
@@ -195,6 +195,10 @@
<name>org.jboss.jsr299.tck.libraryDirectory</name>
<value>target/dependency/lib</value>
</property>
+ <property>
+ <name>org.jboss.jsr299.tck.outputDirectory</name>
+ <value>target</value>
+ </property>
</systemProperties>
</configuration>
</plugin>
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 18:36:03 UTC (rev 1660)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 19:43:17 UTC (rev 1661)
@@ -2,6 +2,7 @@
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
@@ -184,6 +185,11 @@
}
}
+ public String getJbossHome()
+ {
+ return jbossHome;
+ }
+
public void cleanup() throws IOException
{
if (jbossWasStarted)
@@ -227,7 +233,7 @@
dump(p.getInputStream());
}
- protected static void dump(final InputStream is)
+ protected void dump(final InputStream is)
{
new Thread(new Runnable()
{
@@ -235,7 +241,7 @@
{
try
{
- DataOutputStream out = new DataOutputStream(new FileOutputStream(System.getProperty("java.io.tmpdir") + File.separator + "jboss.log"));
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(configuration.getOutputDirectory() + File.separator + "jboss.log"));
int c;
while((c = is.read()) != -1)
{
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-02-23 18:36:03 UTC (rev 1660)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-02-23 19:43:17 UTC (rev 1661)
@@ -3,6 +3,8 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import javax.naming.InitialContext;
@@ -22,6 +24,8 @@
private Logger log = Logger.getLogger(ProfileServiceContainersImpl.class);
+ private final List<String> failedUndeployments;
+
private DeploymentManager deploymentManager;
private JBossTestServices testServices;
private final File tmpdir;
@@ -35,6 +39,7 @@
tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
tmpdir.mkdir();
tmpdir.deleteOnExit();
+ this.failedUndeployments = new ArrayList<String>();
}
@@ -89,8 +94,15 @@
{
try
{
- deploymentManager.stop(DeploymentPhase.APPLICATION, name).run();
- deploymentManager.undeploy(DeploymentPhase.APPLICATION, name).run();
+ DeploymentProgress stopProgress = deploymentManager.stop(DeploymentPhase.APPLICATION, name);
+ stopProgress.run();
+
+ DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
+ undeployProgress.run();
+ if (undeployProgress.getDeploymentStatus().isFailed())
+ {
+ failedUndeployments.add(name);
+ }
}
catch (Exception e)
{
@@ -114,4 +126,31 @@
VFS.init();
}
+ @Override
+ public void cleanup() throws IOException
+ {
+ super.cleanup();
+ List<String> remainingDeployments = new ArrayList<String>();
+ for (String name : failedUndeployments)
+ {
+ try
+ {
+ DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
+ undeployProgress.run();
+ if (undeployProgress.getDeploymentStatus().isFailed())
+ {
+ remainingDeployments.add(name);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e);
+ }
+ }
+ if (remainingDeployments.size() > 0)
+ {
+ //log.error("Failed to undeploy these artifacts: " + remainingDeployments);
+ }
+ }
+
}
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1660 - ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-23 13:36:03 -0500 (Mon, 23 Feb 2009)
New Revision: 1660
Modified:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java
Log:
fix javadoc
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java 2009-02-23 18:34:32 UTC (rev 1659)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java 2009-02-23 18:36:03 UTC (rev 1660)
@@ -26,8 +26,6 @@
*
* @author Nicklas Karlsson
*
- * @see org.jboss.webbeans.context.beanmap.SimpleBeanMap
- * @see org.jboss.webbeans.servlet.HttpSessionBeanMap
*/
public interface BeanStore
{
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1659 - in ri/trunk: webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-23 13:34:32 -0500 (Mon, 23 Feb 2009)
New Revision: 1659
Added:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
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/helpers/AbstractBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java
Log:
Move BeanMap -> SPI
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-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -24,7 +24,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -112,7 +112,7 @@
public void destroy()
{
log.trace("Destroying context");
- for (Contextual<? extends Object> bean : getBeanMap().getContents())
+ for (Contextual<? extends Object> bean : getBeanMap().getBeans())
{
destroy(bean);
}
@@ -124,6 +124,6 @@
*
* @return The actual bean map
*/
- protected abstract BeanMap getBeanMap();
+ protected abstract BeanStore getBeanMap();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -2,17 +2,17 @@
import java.lang.annotation.Annotation;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
public abstract class AbstractThreadLocalMapContext extends AbstractMapContext
{
- private final ThreadLocal<BeanMap> beanMap;
+ private final ThreadLocal<BeanStore> beanStore;
public AbstractThreadLocalMapContext(Class<? extends Annotation> scopeType)
{
super(scopeType);
- this.beanMap = new ThreadLocal<BeanMap>();
+ this.beanStore = new ThreadLocal<BeanStore>();
}
/**
@@ -22,19 +22,19 @@
* @see org.jboss.webbeans.context.AbstractContext#getNewEnterpriseBeanMap()
*/
@Override
- public BeanMap getBeanMap()
+ public BeanStore getBeanMap()
{
- return beanMap.get();
+ return beanStore.get();
}
/**
* Sets the bean map
*
- * @param beanMap The bean map
+ * @param beanStore The bean map
*/
- public void setBeanMap(BeanMap beanMap)
+ public void setBeanMap(BeanStore beanStore)
{
- this.beanMap.set(beanMap);
+ this.beanStore.set(beanStore);
}
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -21,7 +21,7 @@
import javax.context.ApplicationScoped;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
/**
* The Application context
@@ -42,7 +42,7 @@
}
// The beans
- private BeanMap beanMap;
+ private BeanStore beanStore;
// Is the context active?
private AtomicBoolean active;
@@ -61,9 +61,9 @@
* @return The bean map
*/
@Override
- public BeanMap getBeanMap()
+ public BeanStore getBeanMap()
{
- return this.beanMap;
+ return this.beanStore;
}
/**
@@ -71,9 +71,9 @@
*
* @param applicationBeanMap The bean map
*/
- public void setBeanMap(BeanMap applicationBeanMap)
+ public void setBeanMap(BeanStore applicationBeanMap)
{
- this.beanMap = applicationBeanMap;
+ this.beanStore = applicationBeanMap;
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -24,6 +24,7 @@
import javax.context.Contextual;
import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.EnumerationIterable;
@@ -35,7 +36,7 @@
* @author Nicklas Karlsson
*
*/
-public abstract class AbstractBeanMap implements BeanMap
+public abstract class AbstractBeanMap implements BeanStore
{
// The log provider
private static LogProvider log = Logging.getLogProvider(AbstractBeanMap.class);
@@ -87,7 +88,7 @@
*
* @return The beans
*/
- public Iterable<Contextual<? extends Object>> getContents()
+ public Iterable<Contextual<? extends Object>> getBeans()
{
List<Contextual<?>> contextuals = new ArrayList<Contextual<?>>();
BeanMapAdaptor adaptor = getBeanMapAdaptor();
@@ -175,6 +176,6 @@
@Override
public String toString()
{
- return "holding " + Names.count(getContents()) + " instances";
+ return "holding " + Names.count(getBeans()) + " instances";
}
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -1,70 +0,0 @@
-/*
- * 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.context.beanmap;
-
-import javax.context.Contextual;
-
-
-/**
- * Interface for different implementations of Bean to Bean instance storage.
- * Used primarily by the contexts.
- *
- * @author Nicklas Karlsson
- *
- * @see org.jboss.webbeans.context.beanmap.SimpleBeanMap
- * @see org.jboss.webbeans.servlet.HttpSessionBeanMap
- */
-public interface BeanMap
-{
- /**
- * Gets an instance of a bean from the storage.
- *
- * @param bean The bean whose instance to return
- * @return The instance. Null if not found
- */
- public abstract <T extends Object> T get(Contextual<? extends T> bean);
-
- /**
- * Removes an instance of a bean from the storage
- *
- * @param bean The bean whose instance to remove
- * @return The removed instance. Null if not found in storage.
- */
- public abstract <T extends Object> T remove(Contextual<? extends T> bean);
-
- /**
- * Clears the storage of any bean instances
- */
- public abstract void clear();
-
- /**
- * Returns an Iterable over the current contents in the storage
- *
- * @return An Iterable over the keys in the storage
- */
- public abstract Iterable<Contextual<? extends Object>> getContents();
-
- /**
- * Adds a bean instance to the storage
- *
- * @param bean The bean type. Used as key
- * @param instance The instance to add
- * @return The instance added
- */
- public abstract <T> void put(Contextual<? extends T> bean, T instance);
-}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -24,6 +24,7 @@
import javax.context.Contextual;
import javax.inject.manager.Bean;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -34,7 +35,7 @@
*
* @author Nicklas Karlsson
*/
-public class SimpleBeanMap extends ForwardingMap<Contextual<? extends Object>, Object> implements BeanMap
+public class SimpleBeanMap extends ForwardingMap<Contextual<? extends Object>, Object> implements BeanStore
{
private static LogProvider log = Logging.getLogProvider(SimpleBeanMap.class);
@@ -55,7 +56,7 @@
* @param The bean to look for
* @return An instance, if found
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#get(Bean)
+ * @see org.jboss.webbeans.context.api.BeanStore#get(Bean)
*/
public <T extends Object> T get(Contextual<? extends T> bean)
{
@@ -82,7 +83,7 @@
* @param bean the bean to remove
* @return The instance removed
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#remove(Bean)
+ * @see org.jboss.webbeans.context.api.BeanStore#remove(Bean)
*/
public <T extends Object> T remove(Contextual<? extends T> bean)
{
@@ -95,7 +96,7 @@
/**
* Clears the map
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#clear()
+ * @see org.jboss.webbeans.context.api.BeanStore#clear()
*/
public void clear()
{
@@ -108,9 +109,9 @@
*
* @return The beans present
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#getContents()
+ * @see org.jboss.webbeans.context.api.BeanStore#getBeans()
*/
- public Set<Contextual<? extends Object>> getContents()
+ public Set<Contextual<? extends Object>> getBeans()
{
return delegate.keySet();
}
@@ -121,7 +122,7 @@
* @param bean The bean
* @param instance the instance
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#put(Bean, Object)
+ * @see org.jboss.webbeans.context.api.BeanStore#put(Bean, Object)
*/
public <T> void put(Contextual<? extends T> bean, T instance)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -19,7 +19,7 @@
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -33,9 +33,9 @@
private final WebBeansBootstrap bootstrap;
private final MockWebBeanDiscovery webBeanDiscovery;
- private BeanMap applicationBeanMap = new SimpleBeanMap();
- private BeanMap sessionBeanMap = new SimpleBeanMap();
- private BeanMap requestBeanMap = new SimpleBeanMap();
+ private BeanStore applicationBeanMap = new SimpleBeanMap();
+ private BeanStore sessionBeanMap = new SimpleBeanMap();
+ private BeanStore requestBeanMap = new SimpleBeanMap();
public MockLifecycle()
{
@@ -76,7 +76,7 @@
public void beginApplication()
{
super.beginApplication("Mock", applicationBeanMap);
- BeanMap requestBeanMap = new SimpleBeanMap();
+ BeanStore requestBeanMap = new SimpleBeanMap();
super.beginDeploy(requestBeanMap);
bootstrap.setEjbDiscovery(new MockEjbDiscovery(webBeanDiscovery.discoverWebBeanClasses()));
bootstrap.boot();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -7,7 +7,7 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.conversation.ConversationManager;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -50,7 +50,7 @@
manager.addContext(ConversationContext.create());
}
- protected void beginApplication(String id, BeanMap applicationBeanMap)
+ protected void beginApplication(String id, BeanStore applicationBeanMap)
{
log.trace("Starting application " + id);
ApplicationContext.INSTANCE.setBeanMap(applicationBeanMap);
@@ -58,19 +58,19 @@
}
- protected void beginDeploy(BeanMap requestBeanMap)
+ protected void beginDeploy(BeanStore requestBeanMap)
{
RequestContext.INSTANCE.setBeanMap(requestBeanMap);
RequestContext.INSTANCE.setActive(true);
}
- protected void endDeploy(BeanMap requestBeanMap)
+ protected void endDeploy(BeanStore requestBeanMap)
{
RequestContext.INSTANCE.setBeanMap(null);
RequestContext.INSTANCE.setActive(false);
}
- protected void endApplication(String id, BeanMap applicationBeanMap)
+ protected void endApplication(String id, BeanStore applicationBeanMap)
{
log.trace("Ending application " + id);
ApplicationContext.INSTANCE.destroy();
@@ -78,14 +78,14 @@
ApplicationContext.INSTANCE.setBeanMap(null);
}
- protected void beginSession(String id, BeanMap sessionBeanMap)
+ protected void beginSession(String id, BeanStore sessionBeanMap)
{
log.trace("Starting session " + id);
SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
SessionContext.INSTANCE.setActive(true);
}
- protected void endSession(String id, BeanMap sessionBeanMap)
+ protected void endSession(String id, BeanStore sessionBeanMap)
{
log.trace("Ending session " + id);
ConversationManager conversationManager = CurrentManager.rootManager().getInstanceByType(ConversationManager.class);
@@ -95,7 +95,7 @@
SessionContext.INSTANCE.setActive(false);
}
- public void beginRequest(String id, BeanMap requestBeanMap)
+ public void beginRequest(String id, BeanStore requestBeanMap)
{
log.trace("Starting request " + id);
RequestContext.INSTANCE.setBeanMap(requestBeanMap);
@@ -103,7 +103,7 @@
DependentContext.INSTANCE.setActive(true);
}
- public void endRequest(String id, BeanMap requestBeanMap)
+ public void endRequest(String id, BeanStore requestBeanMap)
{
log.trace("Ending request " + id);
RequestContext.INSTANCE.setBeanMap(requestBeanMap);
@@ -112,7 +112,7 @@
RequestContext.INSTANCE.setActive(false);
}
- protected void restoreConversation(String id, BeanMap conversationBeanMap)
+ protected void restoreConversation(String id, BeanStore conversationBeanMap)
{
log.trace("Starting conversation " + id);
ConversationContext.INSTANCE.setBeanMap(conversationBeanMap);
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-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -23,7 +23,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -72,7 +72,7 @@
ServletInitialization servletInitialization = new ServletInitialization(servletContext).initialize();
super.initialize();
super.beginApplication(servletContext.getServletContextName(), new ApplicationBeanMap(servletContext));
- BeanMap requestBeanMap = new SimpleBeanMap();
+ BeanStore requestBeanMap = new SimpleBeanMap();
super.beginDeploy(requestBeanMap);
servletInitialization.start();
super.endDeploy(requestBeanMap);
@@ -113,9 +113,9 @@
* @param session
* @return
*/
- protected BeanMap restoreSessionContext(HttpSession session)
+ protected BeanStore restoreSessionContext(HttpSession session)
{
- BeanMap sessionBeanMap = new HttpSessionBeanMap(session);
+ BeanStore sessionBeanMap = new HttpSessionBeanMap(session);
SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
return sessionBeanMap;
@@ -130,9 +130,9 @@
*/
public void beginRequest(HttpServletRequest request)
{
- BeanMap beanMap = new SimpleBeanMap();
- request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanMap);
- super.beginRequest(request.getRequestURI(), beanMap);
+ BeanStore beanStore = new SimpleBeanMap();
+ request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
+ super.beginRequest(request.getRequestURI(), beanStore);
restoreSessionContext(request.getSession());
}
@@ -143,9 +143,9 @@
*/
public void endRequest(HttpServletRequest request)
{
- BeanMap beanMap = (BeanMap) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
+ BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
- super.endRequest(request.getRequestURI(), beanMap);
+ super.endRequest(request.getRequestURI(), beanStore);
SessionContext.INSTANCE.setBeanMap(null);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle2.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -23,7 +23,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanmap.BeanMap;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
/**
@@ -96,9 +96,9 @@
* @param session
* @return
*/
- protected BeanMap restoreSessionContext(HttpSession session)
+ protected BeanStore restoreSessionContext(HttpSession session)
{
- BeanMap sessionBeanMap = new HttpSessionBeanMap(session);
+ BeanStore sessionBeanMap = new HttpSessionBeanMap(session);
SessionContext.INSTANCE.setBeanMap(sessionBeanMap);
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
return sessionBeanMap;
@@ -114,9 +114,9 @@
public void beginRequest(HttpServletRequest request)
{
restoreSessionContext(request.getSession());
- BeanMap beanMap = new SimpleBeanMap();
- request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanMap);
- super.beginRequest(request.getRequestURI(), beanMap);
+ BeanStore beanStore = new SimpleBeanMap();
+ request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
+ super.beginRequest(request.getRequestURI(), beanStore);
}
/**
@@ -126,9 +126,9 @@
*/
public void endRequest(HttpServletRequest request)
{
- BeanMap beanMap = (BeanMap) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
+ BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
- super.endRequest(request.getRequestURI(), beanMap);
+ super.endRequest(request.getRequestURI(), beanStore);
SessionContext.INSTANCE.setBeanMap(null);
}
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-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -4,6 +4,7 @@
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.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -56,6 +57,8 @@
*/
public void setResourceLoader(ResourceLoader resourceLoader);
+ public void setApplicationContext(BeanStore beanStore);
+
/**
* Initialize the bootstrap:
* <ul>
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java 2009-02-23 12:56:55 UTC (rev 1658)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -3,6 +3,7 @@
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.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -15,6 +16,7 @@
private NamingContext namingContext;
private EjbResolver ejbResolver;
private EjbDiscovery ejbDiscovery;
+ private BeanStore applicationContext;
public void setEjbDiscovery(EjbDiscovery ejbDiscovery)
{
@@ -66,4 +68,14 @@
return ejbDiscovery;
}
+ public BeanStore getApplicationContext()
+ {
+ return applicationContext;
+ }
+
+ public void setApplicationContext(BeanStore applicationContext)
+ {
+ this.applicationContext = applicationContext;
+ }
+
}
\ No newline at end of file
Copied: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java (from rev 1658, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java)
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java (rev 0)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java 2009-02-23 18:34:32 UTC (rev 1659)
@@ -0,0 +1,70 @@
+/*
+ * 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.context.api;
+
+import javax.context.Contextual;
+
+
+/**
+ * Interface for different implementations of Bean to Bean instance storage.
+ * Used primarily by the contexts.
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.webbeans.context.beanmap.SimpleBeanMap
+ * @see org.jboss.webbeans.servlet.HttpSessionBeanMap
+ */
+public interface BeanStore
+{
+ /**
+ * Gets an instance of a bean from the storage.
+ *
+ * @param bean The bean whose instance to return
+ * @return The instance. Null if not found
+ */
+ public abstract <T extends Object> T get(Contextual<? extends T> bean);
+
+ /**
+ * Removes an instance of a bean from the storage
+ *
+ * @param bean The bean whose instance to remove
+ * @return The removed instance. Null if not found in storage.
+ */
+ public abstract <T extends Object> T remove(Contextual<? extends T> bean);
+
+ /**
+ * Clears the storage of any bean instances
+ */
+ public abstract void clear();
+
+ /**
+ * Returns an Iterable over the current contents in the storage
+ *
+ * @return An Iterable over the keys in the storage
+ */
+ public abstract Iterable<Contextual<? extends Object>> getBeans();
+
+ /**
+ * Adds a bean instance to the storage
+ *
+ * @param bean The bean type. Used as key
+ * @param instance The instance to add
+ * @return The instance added
+ */
+ public abstract <T> void put(Contextual<? extends T> bean, T instance);
+}
\ No newline at end of file
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1658 - in tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/unit and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-02-23 07:56:55 -0500 (Mon, 23 Feb 2009)
New Revision: 1658
Added:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/dependent/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/dependent/beans.xml
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java
Log:
removed deployBeans()
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java 2009-02-23 09:37:38 UTC (rev 1657)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/dependent/DependentContextTest.java 2009-02-23 12:56:55 UTC (rev 1658)
@@ -9,18 +9,19 @@
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
import org.testng.annotations.Test;
/**
* Spec version: Public Release Draft 2
*/
+@Artifact
public class DependentContextTest extends AbstractDeclarativeTest
{
@Test(groups = { "contexts", "injection" })
@SpecAssertion(section = "8.3", id = "a")
public void testInstanceNotSharedBetweenInjectionPoints()
{
- deployBeans(Fox.class, FoxRun.class);
Set<Bean<Fox>> foxBeans = getCurrentManager().resolveByType(Fox.class);
assert foxBeans.size() == 1;
Set<Bean<FoxRun>> foxRunBeans = getCurrentManager().resolveByType(FoxRun.class);
@@ -44,7 +45,6 @@
@SpecAssertion(section = "8.3", id = "c")
public void testInstanceUsedForElEvaluationNotShared() throws Exception
{
- deployBeans(Fox.class);
new RunInDependentContext()
{
@Override
@@ -64,7 +64,6 @@
@SpecAssertion(section = "8.3", id = "d")
public void testInstanceUsedForProducerMethodNotShared() throws Exception
{
- deployBeans(SpiderProducer.class);
Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
Tarantula tarantula2 = tarantulaBean.create(new MyCreationalContext<Tarantula>());
@@ -77,7 +76,6 @@
@SpecAssertion(section = "8.3", id = "d")
public void testInstanceUsedForProducerFieldNotShared() throws Exception
{
- deployBeans(OtherSpiderProducer.class);
Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
Tarantula tarantula2 = tarantulaBean.create(new MyCreationalContext<Tarantula>());
@@ -113,7 +111,6 @@
@SpecAssertion(section = "8.3", id = "d")
public void testInstanceUsedForObserverMethodNotShared() throws Exception
{
- deployBeans(HorseStable.class);
new RunInDependentContext()
{
@@ -133,7 +130,6 @@
@SpecAssertion(section = "8.3", id = "e")
public void testContextGetWithCreateTrueReturnsNewInstance() throws Exception
{
- deployBeans(Fox.class);
new RunInDependentContext()
{
@@ -155,7 +151,6 @@
@SpecAssertion(section = "8.3", id = "f")
public void testContextGetWithCreateFalseReturnsNull() throws Exception
{
- deployBeans(Fox.class);
new RunInDependentContext()
{
@@ -183,7 +178,6 @@
@SpecAssertion(section = "8.3", id = "g")
public void testContextIsActiveWhenInvokingProducerMethod()
{
- deployBeans(SpiderProducer.class);
Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
assert tarantula != null;
@@ -216,7 +210,6 @@
@SpecAssertion(section = "8.3", id = "g")
public void testContextIsActiveWhenInvokingObserverMethod()
{
- deployBeans(HorseStable.class);
getCurrentManager().fireEvent(new HorseInStableEvent());
assert HorseStable.isDependentContextActive();
}
@@ -225,7 +218,6 @@
@SpecAssertion(section = "8.3", id = "h")
public void testContextIsActiveWhenEvaluatingElExpression() throws Exception
{
- deployBeans(SensitiveFox.class);
SensitiveFox.setManager(getCurrentManager());
new RunInDependentContext()
{
@@ -243,7 +235,6 @@
@SpecAssertion(section = "8.3", id = "i")
public void testContextIsActiveWhenInvokingObserver()
{
- deployBeans(ApplicationHorseStable.class);
getCurrentManager().fireEvent(new HorseInStableEvent());
assert ApplicationHorseStable.isDependentContextActive();
}
@@ -252,7 +243,6 @@
@SpecAssertion(section = "8.3", id = "j")
public void testContextIsActiveDuringBeanCreation() throws Exception
{
- deployBeans(SensitiveFox.class);
SensitiveFox.setManager(getCurrentManager());
new RunInDependentContext()
{
@@ -282,7 +272,6 @@
@SpecAssertion(section = "8.3", id = "j")
public void testContextIsActiveDuringInjection()
{
- deployBeans(FoxRun.class, Fox.class);
Bean<FoxRun> foxRunBean = getCurrentManager().resolveByType(FoxRun.class).iterator().next();
FoxRun foxRun = foxRunBean.create(new MyCreationalContext<FoxRun>());
assert foxRun.fox != null;
@@ -292,7 +281,6 @@
@SpecAssertion(section = "8.3.2", id = "a")
public void testDestroyingParentDestroysDependents() throws Exception
{
- deployBeans(Farm.class, Horse.class, Stable.class);
new RunInDependentContext()
{
@@ -316,7 +304,6 @@
@SpecAssertion(section = "8.3.2", id = "c")
public void testDependentsDestroyedWhenElEvaluationCompletes() throws Exception
{
- deployBeans(Fox.class);
new RunInDependentContext()
{
@Override
@@ -337,7 +324,6 @@
@SpecAssertion(section = "8.3.2", id = "d")
public void testDependentsDestroyedWhenProducerMethodCompletes() throws Exception
{
- deployBeans(SpiderProducer.class);
new RunInDependentContext()
{
@@ -364,7 +350,6 @@
@SpecAssertion(section = "8.3.2", id = "d")
public void testDependentsDestroyedWhenProducerFieldCompletes() throws Exception
{
- deployBeans(OtherSpiderProducer.class);
new RunInDependentContext()
{
@@ -391,7 +376,6 @@
@SpecAssertion(section = "8.3.2", id = "d")
public void testDependentsDestroyedWhenDisposalMethodCompletes() throws Exception
{
- deployBeans(SpiderProducer.class);
new RunInDependentContext()
{
@@ -414,7 +398,6 @@
@SpecAssertion(section = "8.3.2", id = "d")
public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes() throws Exception
{
- deployBeans(HorseStable.class);
new RunInDependentContext()
{
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/dependent/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/dependent/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/unit/context/dependent/beans.xml 2009-02-23 12:56:55 UTC (rev 1658)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.unit.context.dependent">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+</Beans>
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1657 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: bean and 6 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-23 04:37:38 -0500 (Mon, 23 Feb 2009)
New Revision: 1657
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.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/ServletConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSFHelper.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
Log:
Conversation management -> lifecycle for review
String based keyPrefix -> BeanMapAdaptor (hmm, not really an adaptor, what would be the correct term?)
Minor import cleanups etc
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -22,7 +22,6 @@
import java.util.List;
import java.util.Set;
-import javax.context.Dependent;
import javax.inject.AmbiguousDependencyException;
import javax.inject.DefinitionException;
import javax.inject.IllegalProductException;
@@ -41,7 +40,6 @@
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -25,7 +25,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.context.CreationalContext;
-import javax.context.Dependent;
import javax.inject.DefinitionException;
import javax.inject.Initializer;
import javax.persistence.PersistenceContext;
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-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -25,7 +25,6 @@
import javax.inject.manager.Bean;
import org.jboss.webbeans.context.beanmap.BeanMap;
-import org.jboss.webbeans.jsf.JSFHelper;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -113,7 +112,7 @@
public void destroy()
{
log.trace("Destroying context");
- for (Contextual<? extends Object> bean : getBeanMap().keySet())
+ for (Contextual<? extends Object> bean : getBeanMap().getContents())
{
destroy(bean);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/AbstractBeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ApplicationBeanMap;
import org.jboss.webbeans.util.EnumerationIterable;
import org.jboss.webbeans.util.Names;
@@ -44,13 +43,13 @@
/**
* Gets a bean from the map
*
- * @param bean The bean to get
+ * @param contextual The bean to get
* @return The instance
*/
@SuppressWarnings("unchecked")
- public <T> T get(Contextual<? extends T> bean)
+ public <T> T get(Contextual<? extends T> contextual)
{
- String key = getBeanKey(bean);
+ String key = getBeanMapAdaptor().getContextualKey(contextual);
T instance = (T) getAttribute(key);
log.trace("Looked for " + key + " and got " + instance);
return instance;
@@ -59,13 +58,13 @@
/**
* Removes an instance from the map
*
- * @param bean The bean of the instance to remove
+ * @param contextual The bean of the instance to remove
* @return The removed instance
*/
- public <T> T remove(Contextual<? extends T> bean)
+ public <T> T remove(Contextual<? extends T> contextual)
{
- T instance = get(bean);
- String key = getBeanKey(bean);
+ T instance = get(contextual);
+ String key = getBeanMapAdaptor().getContextualKey(contextual);
removeAttribute(key);
log.trace("Removed bean under key " + key);
return instance;
@@ -76,9 +75,9 @@
*/
public void clear()
{
- for (String name : getFilteredAttributeNames())
+ for (String attributeName : getFilteredAttributeNames())
{
- removeAttribute(name);
+ removeAttribute(attributeName);
}
log.trace("Bean Map cleared");
}
@@ -88,16 +87,17 @@
*
* @return The beans
*/
- public Iterable<Contextual<? extends Object>> keySet()
+ public Iterable<Contextual<? extends Object>> getContents()
{
- List<Contextual<?>> beans = new ArrayList<Contextual<?>>();
- for (String name : getFilteredAttributeNames())
+ List<Contextual<?>> contextuals = new ArrayList<Contextual<?>>();
+ BeanMapAdaptor adaptor = getBeanMapAdaptor();
+ for (String attributeName : getFilteredAttributeNames())
{
- String id = name.substring(getKeyPrefix().length() + 1);
- Contextual<?> bean = CurrentManager.rootManager().getBeans().get(Integer.parseInt(id));
- beans.add(bean);
+ int beanIndex = adaptor.getBeanIndexFromKey(attributeName);
+ Contextual<?> contextual = CurrentManager.rootManager().getBeans().get(beanIndex);
+ contextuals.add(contextual);
}
- return beans;
+ return contextuals;
}
/**
@@ -108,11 +108,10 @@
private List<String> getFilteredAttributeNames()
{
List<String> attributeNames = new ArrayList<String>();
- Enumeration<String> e = getAttributeNames();
- while (e.hasMoreElements())
+ BeanMapAdaptor adaptor = getBeanMapAdaptor();
+ for (String attributeName : new EnumerationIterable<String>(getAttributeNames()))
{
- String attributeName = e.nextElement();
- if (attributeName.startsWith(getKeyPrefix()))
+ if (adaptor.acceptKey(attributeName))
{
attributeNames.add(attributeName);
}
@@ -129,7 +128,7 @@
*/
public <T> void put(Contextual<? extends T> bean, T instance)
{
- String key = getBeanKey(bean);
+ String key = getBeanMapAdaptor().getContextualKey(bean);
setAttribute(key, instance);
log.trace("Added bean " + bean + " under key " + key);
}
@@ -166,27 +165,16 @@
protected abstract void setAttribute(String key, Object instance);
/**
- * Gets a key prefix that should be prefixed to names
+ * Gets an adaptor for handling keys in a bean map
*
- * @return The prefix
+ * @return The filter
*/
- protected abstract String getKeyPrefix();
+ protected abstract BeanMapAdaptor getBeanMapAdaptor();
- /**
- * Returns a map key to a bean. Uses a known prefix and appends the index of
- * the Bean in the Manager bean list.
- *
- * @param bean The bean to generate a key for.
- * @return A unique key;
- */
- protected String getBeanKey(Contextual<?> bean)
- {
- return getKeyPrefix() + "#" + CurrentManager.rootManager().getBeans().indexOf(bean);
- }
@Override
public String toString()
{
- return "holding " + Names.count(keySet()) + " instances under the key prefix " + getKeyPrefix();
+ return "holding " + Names.count(getContents()) + " instances";
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -53,11 +53,11 @@
public abstract void clear();
/**
- * Returns an Iterable over the current keys in the storage
+ * Returns an Iterable over the current contents in the storage
*
* @return An Iterable over the keys in the storage
*/
- public abstract Iterable<Contextual<? extends Object>> keySet();
+ public abstract Iterable<Contextual<? extends Object>> getContents();
/**
* Adds a bean instance to the storage
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/BeanMapAdaptor.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -0,0 +1,52 @@
+/*
+ * 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.context.beanmap;
+
+import javax.context.Contextual;
+
+/**
+ * Interface against a BeanMap to handle different naming schemes
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+public interface BeanMapAdaptor
+{
+ /**
+ * Checks if a key is handled by the bean map
+ *
+ * @param key The key to match
+ * @return True if match, false otherwise
+ */
+ public abstract boolean acceptKey(String key);
+
+ /**
+ * Gets a bean map key for a contextual
+ *
+ * @param contextual The contextual to make the key for
+ * @return A map key
+ */
+ public abstract String getContextualKey(Contextual<?> contextual);
+
+ /**
+ * Gets a bean index key from a key
+ *
+ * @param key The key to parse
+ * @return The bean index
+ */
+ public abstract int getBeanIndexFromKey(String key);
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -108,9 +108,9 @@
*
* @return The beans present
*
- * @see org.jboss.webbeans.context.beanmap.BeanMap#keySet()
+ * @see org.jboss.webbeans.context.beanmap.BeanMap#getContents()
*/
- public Set<Contextual<? extends Object>> keySet()
+ public Set<Contextual<? extends Object>> getContents()
{
return delegate.keySet();
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMapAdaptor.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -0,0 +1,52 @@
+/*
+ * 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.context.beanmap;
+
+import javax.context.Contextual;
+
+import org.jboss.webbeans.CurrentManager;
+
+/**
+ * Simple prefix-based implementation of a bean map adaptor
+ *
+ * @author Nicklas Karlsson
+ */
+public class SimpleBeanMapAdaptor implements BeanMapAdaptor
+{
+ public String prefix;
+
+ public SimpleBeanMapAdaptor(String prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public boolean acceptKey(String key)
+ {
+ return key.startsWith(prefix);
+ }
+
+ public int getBeanIndexFromKey(String key)
+ {
+ return Integer.parseInt(key.substring(prefix.length() + 1));
+ }
+
+ public String getContextualKey(Contextual<?> contextual)
+ {
+ return prefix + "#" + CurrentManager.rootManager().getBeans().indexOf(contextual);
+ }
+
+}
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-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -26,6 +26,7 @@
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.servlet.ConversationBeanMap;
+import org.jboss.webbeans.servlet.ServletLifecycle;
/**
* Represents a long-running conversation entry
@@ -100,9 +101,7 @@
{
cancelTermination();
}
- ConversationContext terminationContext = new ConversationContext();
- terminationContext.setBeanMap(new ConversationBeanMap(session, cid));
- terminationContext.destroy();
+ ServletLifecycle.instance().destroyConversation(session, cid);
log.trace("Conversation " + cid + " destroyed");
}
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-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -28,13 +28,13 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.WebBean;
-import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.conversation.bindings.ConversationConcurrentAccessTimeout;
import org.jboss.webbeans.conversation.bindings.ConversationIdName;
import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.servlet.HttpSessionManager;
+import org.jboss.webbeans.servlet.ServletLifecycle;
/**
* The default conversation manager
@@ -195,7 +195,8 @@
longRunningConversations.get(cid).cancelTermination();
longRunningConversations.get(cid).unlock();
}
- ConversationContext.INSTANCE.destroy();
+ HttpSession session = CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).getSession();
+ ServletLifecycle.instance().destroyConversation(session, cid);
}
// If Conversation.begin(String) is called, it might be that the
// conversation will be switched. We need to unlock this original
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSFHelper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSFHelper.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSFHelper.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -16,10 +16,15 @@
*/
package org.jboss.webbeans.jsf;
+import java.io.IOException;
+
import javax.faces.component.html.HtmlInputHidden;
import javax.faces.context.FacesContext;
+import javax.inject.AnnotationLiteral;
import javax.servlet.http.HttpSession;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.conversation.bindings.ConversationIdName;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -27,14 +32,13 @@
* Helper class for JSF related operations
*
* @author Nicklas Karlsson
- *
+ *
*/
public class JSFHelper
{
private static LogProvider log = Logging.getLogProvider(JSFHelper.class);
private static final String CONVERSATION_PROPAGATION_COMPONENT_ID = "webbeans_conversation_propagation";
- private static final String CONVERSATION_ID_NAME = "cid";
/**
* Gets a FacesContext instance
@@ -70,7 +74,8 @@
}
/**
- * Creates and/or updates the conversation propagation component in the UI view root
+ * Creates and/or updates the conversation propagation component in the UI
+ * view root
*
* @param cid The conversation id to propagate
*/
@@ -105,15 +110,17 @@
*/
public static String getConversationIdFromRequest()
{
- String cid = context().getExternalContext().getRequestParameterMap().get(CONVERSATION_ID_NAME);
+ String cidName = CurrentManager.rootManager().getInstanceByType(String.class, new AnnotationLiteral<ConversationIdName>(){});
+ String cid = context().getExternalContext().getRequestParameterMap().get(cidName);
log.trace("Got cid " + cid + " from request");
return cid;
}
/**
* Gets the propagated conversation id from the propagation component
- *
+ *
* @return The conversation id (or null if not found)
+ * @throws IOException
*/
public static String getConversationIdFromPropagationComponent()
{
@@ -130,7 +137,7 @@
/**
* Gets the propagated conversation id
*
- * @return The conversatio nid (or null if not found)
+ * @return The conversation id (or null if not found)
*/
public static String getConversationId()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -29,6 +29,7 @@
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.servlet.ConversationBeanMap;
import org.jboss.webbeans.servlet.HttpSessionManager;
+import org.jboss.webbeans.servlet.ServletLifecycle;
/**
* A phase listener for propagating conversation id over postbacks through a
@@ -112,7 +113,7 @@
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
CurrentManager.rootManager().getInstanceByType(ConversationManager.class).beginOrRestoreConversation(JSFHelper.getConversationId());
String cid = CurrentManager.rootManager().getInstanceByType(Conversation.class).getId();
- ConversationContext.INSTANCE.setBeanMap(new ConversationBeanMap(session, cid));
+ ServletLifecycle.instance().restoreConversation(session, cid);
}
/**
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -0,0 +1,31 @@
+/*
+ * 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.mock;
+
+import org.jboss.webbeans.conversation.ServletConversationManager;
+
+/**
+ * Mock of a conversation manager without servlet dependencies
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+// TODO dummy
+public class MockConversationManager extends ServletConversationManager
+{
+
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -17,23 +17,23 @@
* and destroying all the built in contexts
*
* @author Pete Muir
- *
+ *
*/
public abstract class AbstractLifecycle
{
-
- private static AbstractLifecycle instance;
-
+
+ private static AbstractLifecycle instance;
+
public static AbstractLifecycle instance()
{
return instance;
}
-
+
protected static void setInstance(AbstractLifecycle instance)
{
AbstractLifecycle.instance = instance;
}
-
+
private static LogProvider log = Logging.getLogProvider(AbstractLifecycle.class);
protected void initialize()
@@ -49,21 +49,21 @@
manager.addContext(ApplicationContext.create());
manager.addContext(ConversationContext.create());
}
-
+
protected void beginApplication(String id, BeanMap applicationBeanMap)
{
log.trace("Starting application " + id);
ApplicationContext.INSTANCE.setBeanMap(applicationBeanMap);
ApplicationContext.INSTANCE.setActive(true);
-
+
}
-
+
protected void beginDeploy(BeanMap requestBeanMap)
{
RequestContext.INSTANCE.setBeanMap(requestBeanMap);
RequestContext.INSTANCE.setActive(true);
}
-
+
protected void endDeploy(BeanMap requestBeanMap)
{
RequestContext.INSTANCE.setBeanMap(null);
@@ -77,7 +77,7 @@
ApplicationContext.INSTANCE.setActive(false);
ApplicationContext.INSTANCE.setBeanMap(null);
}
-
+
protected void beginSession(String id, BeanMap sessionBeanMap)
{
log.trace("Starting session " + id);
@@ -102,7 +102,7 @@
RequestContext.INSTANCE.setActive(true);
DependentContext.INSTANCE.setActive(true);
}
-
+
public void endRequest(String id, BeanMap requestBeanMap)
{
log.trace("Ending request " + id);
@@ -111,5 +111,20 @@
RequestContext.INSTANCE.destroy();
RequestContext.INSTANCE.setActive(false);
}
-
+
+ protected void restoreConversation(String id, BeanMap conversationBeanMap)
+ {
+ log.trace("Starting conversation " + id);
+ ConversationContext.INSTANCE.setBeanMap(conversationBeanMap);
+ ConversationContext.INSTANCE.setActive(true);
+ }
+
+ protected void destroyConversation(String id, ConversationBeanMap conversationBeanMap)
+ {
+ log.trace("Ending conversation " + id);
+ ConversationContext destructionContext = new ConversationContext();
+ destructionContext.setBeanMap(conversationBeanMap);
+ destructionContext.destroy();
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -23,6 +23,8 @@
import org.jboss.webbeans.context.ApplicationContext;
import org.jboss.webbeans.context.beanmap.AbstractBeanMap;
+import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
/**
* A BeanMap that uses a servlet context as backing map
@@ -37,7 +39,7 @@
private ServletContext context;
/**
- * Constructor
+ * Constructor
*
* @param context The servlet context instance
*/
@@ -48,15 +50,6 @@
}
/**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getKeyPrefix()
- */
- @Override
- protected String getKeyPrefix()
- {
- return ApplicationContext.class.getName();
- }
-
- /**
* @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
*/
@Override
@@ -93,4 +86,10 @@
context.setAttribute(key, instance);
}
+ @Override
+ protected BeanMapAdaptor getBeanMapAdaptor()
+ {
+ return new SimpleBeanMapAdaptor(ApplicationContext.class.getName());
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -20,6 +20,8 @@
import javax.servlet.http.HttpSession;
import org.jboss.webbeans.context.ConversationContext;
+import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
/**
* A HTTP session backed bean map for the conversational scope
@@ -37,9 +39,9 @@
}
@Override
- protected String getKeyPrefix()
+ protected BeanMapAdaptor getBeanMapAdaptor()
{
- return ConversationContext.class.getName() + "[" + cid + "]";
+ return new SimpleBeanMapAdaptor(ConversationContext.class.getName() + "[" + cid + "]");
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanMap.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -22,6 +22,8 @@
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.beanmap.AbstractBeanMap;
+import org.jboss.webbeans.context.beanmap.BeanMapAdaptor;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMapAdaptor;
/**
* A BeanMap that uses a HTTP session as backing map
@@ -47,15 +49,6 @@
}
/**
- * @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getKeyPrefix()
- */
- @Override
- protected String getKeyPrefix()
- {
- return SessionContext.class.getName();
- }
-
- /**
* @see org.jboss.webbeans.context.beanmap.AbstractBeanMap#getAttribute()
*/
@Override
@@ -92,4 +85,10 @@
session.setAttribute(key, instance);
}
+ @Override
+ protected BeanMapAdaptor getBeanMapAdaptor()
+ {
+ return new SimpleBeanMapAdaptor(SessionContext.class.getName());
+ }
+
}
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-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -39,21 +39,21 @@
@Deprecated
public class ServletLifecycle extends AbstractLifecycle
{
-
+
public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle.class.getName() + ".requestBeanMap";
-
+
static
{
AbstractLifecycle.setInstance(new ServletLifecycle());
}
-
+
public static ServletLifecycle instance()
{
return (ServletLifecycle) AbstractLifecycle.instance();
}
-
+
private static LogProvider log = Logging.getLogProvider(ServletLifecycle.class);
-
+
@Override
public void initialize()
{
@@ -105,9 +105,9 @@
{
super.endSession(session.getId(), restoreSessionContext(session));
}
-
+
/**
- * Restore the session from the underlying session object. Also allow the
+ * Restore the session from the underlying session object. Also allow the
* session to be injected by the Session manager
*
* @param session
@@ -120,7 +120,7 @@
CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
return sessionBeanMap;
}
-
+
/**
* Begins a HTTP request
*
@@ -149,4 +149,26 @@
SessionContext.INSTANCE.setBeanMap(null);
}
+ /**
+ * Restores a conversation
+ *
+ * @param session The HTTP session
+ * @param cid The conversation to resume
+ */
+ public void restoreConversation(HttpSession session, String cid)
+ {
+ super.restoreConversation(session.getId() + "[" + cid + "]", new ConversationBeanMap(session, cid));
+ }
+
+ /**
+ * Destroys a conversation
+ *
+ * @param session The HTTP session
+ * @param cid The conversation to destroy
+ */
+ public void destroyConversation(HttpSession session, String cid)
+ {
+ super.destroyConversation(session.getId() + "[" + cid + "]", new ConversationBeanMap(session, cid));
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-23 01:08:12 UTC (rev 1656)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-23 09:37:38 UTC (rev 1657)
@@ -80,6 +80,7 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
+ System.out.println("!!!");
chain.doFilter(request, wrapResponse((HttpServletResponse) response));
}
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1656 - ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-22 20:08:12 -0500 (Sun, 22 Feb 2009)
New Revision: 1656
Modified:
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
Log:
oops
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 01:03:11 UTC (rev 1655)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 01:08:12 UTC (rev 1656)
@@ -116,14 +116,14 @@
{
javaOpts = "";
}
- javaOpts = "\"" + javaOpts + JAVA_OPTS + "\"";
+ javaOpts = javaOpts + JAVA_OPTS;
if (jbossHome == null)
{
throw new IllegalArgumentException("-D" + JBOSS_HOME_PROPERTY_NAME + " must be set");
}
else
{
- jbossHome = System.getProperty(JBOSS_HOME_PROPERTY_NAME);
+ jbossHome = System.getProperty(JBOSS_HOME_PROPERTY_NAME);
File jbossHomeFile = new File(jbossHome);
jbossHome = jbossHomeFile.getPath();
log.info("Using JBoss instance in " + jbossHome + " at URL " + configuration.getHost());
@@ -219,7 +219,7 @@
String command[] = {
"sh",
"-c",
- "cd " + jbossHome + "/bin;JAVA_OPTS=" + javaOpts + " ./" + scriptFileName + ".sh " + params
+ "cd " + jbossHome + "/bin;JAVA_OPTS=\"" + javaOpts + "\" ./" + scriptFileName + ".sh " + params
};
p = runtime.exec(command);
}
17 years, 1 month
[webbeans-commits] Webbeans SVN: r1655 - ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-22 20:03:11 -0500 (Sun, 22 Feb 2009)
New Revision: 1655
Modified:
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
Log:
Fix windows build
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 00:07:34 UTC (rev 1654)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-02-23 01:03:11 UTC (rev 1655)
@@ -123,6 +123,9 @@
}
else
{
+ jbossHome = System.getProperty(JBOSS_HOME_PROPERTY_NAME);
+ File jbossHomeFile = new File(jbossHome);
+ jbossHome = jbossHomeFile.getPath();
log.info("Using JBoss instance in " + jbossHome + " at URL " + configuration.getHost());
}
this.bootTimeout = Long.getLong(JBOSS_BOOT_TIMEOUT_PROPERTY_NAME, 240000);
17 years, 1 month