[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Gavin King
gavin.king at jboss.com
Tue Oct 3 19:15:58 EDT 2006
User: gavin
Date: 06/10/03 19:15:58
Modified: src/main/org/jboss/seam/contexts
BusinessProcessContext.java
ClientConversationContext.java Lifecycle.java
PageContext.java ServerConversationContext.java
Log:
JBSEAM-78, destroy method call for business process context
Revision Changes Path
1.29 +7 -1 jboss-seam/src/main/org/jboss/seam/contexts/BusinessProcessContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BusinessProcessContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/BusinessProcessContext.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- BusinessProcessContext.java 29 Sep 2006 22:48:50 -0000 1.28
+++ BusinessProcessContext.java 3 Oct 2006 23:15:58 -0000 1.29
@@ -27,7 +27,7 @@
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
* @author Gavin King
- * @version $Revision: 1.28 $
+ * @version $Revision: 1.29 $
*/
public class BusinessProcessContext implements Context {
@@ -124,6 +124,11 @@
removals.addAll( getNamesFromContext() );
}
+ /**
+ * Propagate all additions and removals to the jBPM database if
+ * there is a current process instance, or do nothing if there
+ * is no current process instance.
+ */
public void flush()
{
if ( !additions.isEmpty() || !removals.isEmpty() )
@@ -136,6 +141,7 @@
if ( processInstance==null )
{
log.debug( "no process instance to persist business process state" );
+ return; //don't clear the additions and removals
}
else
{
1.6 +4 -1 jboss-seam/src/main/org/jboss/seam/contexts/ClientConversationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ClientConversationContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ClientConversationContext.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ClientConversationContext.java 29 Sep 2006 22:48:50 -0000 1.5
+++ ClientConversationContext.java 3 Oct 2006 23:15:58 -0000 1.6
@@ -22,7 +22,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class ClientConversationContext implements Context {
@@ -77,6 +77,9 @@
return get( Seam.getComponentName(clazz) );
}
+ /**
+ * Put the context variables in the faces view root.
+ */
public void flush()
{
if ( Manager.instance().isLongRunningConversation() )
1.53 +19 -2 jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Lifecycle.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- Lifecycle.java 29 Sep 2006 22:48:50 -0000 1.52
+++ Lifecycle.java 3 Oct 2006 23:15:58 -0000 1.53
@@ -20,15 +20,17 @@
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.Seam;
+import org.jboss.seam.core.BusinessProcess;
import org.jboss.seam.core.Events;
import org.jboss.seam.core.Init;
import org.jboss.seam.core.Manager;
+import org.jboss.seam.core.ProcessInstance;
import org.jboss.seam.security.authenticator.Authenticator;
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.52 $
+ * @version $Revision: 1.53 $
*/
public class Lifecycle
{
@@ -346,6 +348,20 @@
if ( Contexts.isConversationContextActive() )
{
+
+ if ( Contexts.isBusinessProcessContextActive() )
+ {
+ boolean destroyBusinessProcessContext = !BusinessProcess.instance().hasCurrentProcess() ||
+ //TODO: it would be nice if BP context spanned redirects along with the conversation
+ // this would also require changes to BusinessProcessContext
+ ProcessInstance.instance().hasEnded();
+ if ( destroyBusinessProcessContext )
+ {
+ log.debug("destroying business process context");
+ Contexts.destroy( Contexts.getBusinessProcessContext() );
+ }
+ }
+
if ( !Manager.instance().isLongRunningConversation() )
{
log.debug("destroying conversation context");
@@ -356,6 +372,7 @@
log.debug("flushing server-side conversation context");
Contexts.getConversationContext().flush();
}
+
}
//destroy the event context after the
1.5 +4 -1 jboss-seam/src/main/org/jboss/seam/contexts/PageContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PageContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/PageContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PageContext.java 29 Sep 2006 22:48:50 -0000 1.4
+++ PageContext.java 3 Oct 2006 23:15:58 -0000 1.5
@@ -29,7 +29,7 @@
* returns values from the page that was the source of the request.
*
* @author Gavin King
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class PageContext implements Context {
@@ -98,6 +98,9 @@
return get( Seam.getComponentName(clazz) );
}
+ /**
+ * Put the context variables in the faces view root.
+ */
public void flush()
{
getAttributeMap().put( ScopeType.PAGE.getPrefix(), nextPageMap );
1.9 +7 -2 jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerConversationContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ServerConversationContext.java 29 Sep 2006 22:48:50 -0000 1.8
+++ ServerConversationContext.java 3 Oct 2006 23:15:58 -0000 1.9
@@ -24,7 +24,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public class ServerConversationContext implements Context {
@@ -163,6 +163,11 @@
removals.addAll( getNamesFromSession() );
}
+ /**
+ * Propagate additions and removals to the HttpSession if
+ * the current conversation is long-running, or remove all
+ * attributes if it is a temporary conversation.
+ */
public void flush()
{
Manager manager = Manager.instance();
More information about the jboss-cvs-commits
mailing list