Author: pete.muir(a)jboss.org
Date: 2009-04-08 09:26:25 -0400 (Wed, 08 Apr 2009)
New Revision: 2347
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
Fix packaging
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java (from
rev 2343, ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java 2009-04-08
13:26:25 UTC (rev 2347)
@@ -0,0 +1,84 @@
+package org.jboss.webbeans.context;
+
+import org.jboss.webbeans.CurrentManager;
+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;
+import org.jboss.webbeans.servlet.ConversationBeanStore;
+
+/**
+ * An implementation of the Web Beans lifecycle that supports restoring
+ * and destroying all the built in contexts
+ *
+ * @author Pete Muir
+ *
+ */
+public class ContextLifecycle
+{
+
+ private static ContextLifecycle instance;
+
+ public static ContextLifecycle instance()
+ {
+ return instance;
+ }
+
+ protected static void setInstance(ContextLifecycle instance)
+ {
+ ContextLifecycle.instance = instance;
+ }
+
+ private static LogProvider log = Logging.getLogProvider(ContextLifecycle.class);
+
+ protected void restoreSession(String id, BeanStore sessionBeanStore)
+ {
+ log.trace("Restoring session " + id);
+ SessionContext.INSTANCE.setBeanStore(sessionBeanStore);
+ SessionContext.INSTANCE.setActive(true);
+ }
+
+ protected void endSession(String id, BeanStore sessionBeanStore)
+ {
+ log.trace("Ending session " + id);
+ SessionContext.INSTANCE.setActive(true);
+ ConversationManager conversationManager =
CurrentManager.rootManager().getInstanceByType(ConversationManager.class);
+ conversationManager.destroyAllConversations();
+ SessionContext.INSTANCE.destroy();
+ SessionContext.INSTANCE.setBeanStore(null);
+ SessionContext.INSTANCE.setActive(false);
+ }
+
+ public void beginRequest(String id, BeanStore requestBeanStore)
+ {
+ log.trace("Starting request " + id);
+ RequestContext.INSTANCE.setBeanStore(requestBeanStore);
+ RequestContext.INSTANCE.setActive(true);
+ DependentContext.INSTANCE.setActive(true);
+ }
+
+ public void endRequest(String id, BeanStore requestBeanStore)
+ {
+ log.trace("Ending request " + id);
+ RequestContext.INSTANCE.setBeanStore(requestBeanStore);
+ DependentContext.INSTANCE.setActive(false);
+ RequestContext.INSTANCE.destroy();
+ RequestContext.INSTANCE.setActive(false);
+ }
+
+ protected void restoreConversation(String id, BeanStore conversationBeanStore)
+ {
+ log.trace("Starting conversation " + id);
+ ConversationContext.INSTANCE.setBeanStore(conversationBeanStore);
+ ConversationContext.INSTANCE.setActive(true);
+ }
+
+ protected void destroyConversation(String id, ConversationBeanStore
conversationBeanStore)
+ {
+ log.trace("Ending conversation " + id);
+ ConversationContext destructionContext = new ConversationContext();
+ destructionContext.setBeanStore(conversationBeanStore);
+ destructionContext.destroy();
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-08
13:23:42 UTC (rev 2346)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-08
13:26:25 UTC (rev 2347)
@@ -3,13 +3,13 @@
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.bootstrap.api.Environments;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.context.ContextLifecycle;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.servlet.AbstractLifecycle;
-public class MockServletLifecycle extends AbstractLifecycle
+public class MockServletLifecycle extends ContextLifecycle
{
private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-04-08
13:23:42 UTC (rev 2346)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/AbstractLifecycle.java 2009-04-08
13:26:25 UTC (rev 2347)
@@ -1,87 +0,0 @@
-package org.jboss.webbeans.servlet;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.DependentContext;
-import org.jboss.webbeans.context.RequestContext;
-import org.jboss.webbeans.context.SessionContext;
-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;
-
-/**
- * A generic implementation of the Web Beans lifecycle that supports restoring
- * and destroying all the built in contexts
- *
- * @author Pete Muir
- *
- */
-public abstract class AbstractLifecycle
-{
-
- 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 restoreSession(String id, BeanStore sessionBeanStore)
- {
- log.trace("Restoring session " + id);
- SessionContext.INSTANCE.setBeanStore(sessionBeanStore);
- SessionContext.INSTANCE.setActive(true);
- }
-
- protected void endSession(String id, BeanStore sessionBeanStore)
- {
- log.trace("Ending session " + id);
- SessionContext.INSTANCE.setActive(true);
- ConversationManager conversationManager =
CurrentManager.rootManager().getInstanceByType(ConversationManager.class);
- conversationManager.destroyAllConversations();
- SessionContext.INSTANCE.destroy();
- SessionContext.INSTANCE.setBeanStore(null);
- SessionContext.INSTANCE.setActive(false);
- }
-
- public void beginRequest(String id, BeanStore requestBeanStore)
- {
- log.trace("Starting request " + id);
- RequestContext.INSTANCE.setBeanStore(requestBeanStore);
- RequestContext.INSTANCE.setActive(true);
- DependentContext.INSTANCE.setActive(true);
- }
-
- public void endRequest(String id, BeanStore requestBeanStore)
- {
- log.trace("Ending request " + id);
- RequestContext.INSTANCE.setBeanStore(requestBeanStore);
- DependentContext.INSTANCE.setActive(false);
- RequestContext.INSTANCE.destroy();
- RequestContext.INSTANCE.setActive(false);
- }
-
- protected void restoreConversation(String id, BeanStore conversationBeanStore)
- {
- log.trace("Starting conversation " + id);
- ConversationContext.INSTANCE.setBeanStore(conversationBeanStore);
- ConversationContext.INSTANCE.setActive(true);
- }
-
- protected void destroyConversation(String id, ConversationBeanStore
conversationBeanStore)
- {
- log.trace("Ending conversation " + id);
- ConversationContext destructionContext = new ConversationContext();
- destructionContext.setBeanStore(conversationBeanStore);
- destructionContext.destroy();
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-08
13:23:42 UTC (rev 2346)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-08
13:26:25 UTC (rev 2347)
@@ -21,6 +21,7 @@
import javax.servlet.http.HttpSession;
import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.context.ContextLifecycle;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
@@ -35,19 +36,19 @@
* @author Pete Muir
* @author Nicklas Karlsson
*/
-public class ServletLifecycle extends AbstractLifecycle
+public class ServletLifecycle extends ContextLifecycle
{
public static final String REQUEST_ATTRIBUTE_NAME = ServletLifecycle.class.getName() +
".requestBeanStore";
static
{
- AbstractLifecycle.setInstance(new ServletLifecycle());
+ ContextLifecycle.setInstance(new ServletLifecycle());
}
public static ServletLifecycle instance()
{
- return (ServletLifecycle) AbstractLifecycle.instance();
+ return (ServletLifecycle) ContextLifecycle.instance();
}
private static LogProvider log = Logging.getLogProvider(ServletLifecycle.class);
Show replies by date