Author: rahul Date: Sun Jan 29 08:35:02 2006 New Revision: 373323 URL: http://svn.apache.org/viewcvs?rev=373323&view=rev Log: Clean the Commons SCXML object model of any stateful properties.
* Remove last known configurations from History objects * Remove NotificationRegistry and RootContext from SCXML objects * Remove Context from State objects * Remove NotificationRegistry from Transition objects * Remove NotificationRegistry from TransitionTarget objects Also remove the Observable interface. Implementing it ties the model elements to a particular NotificationRegistry. Removed: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/Observable.java Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/History.java jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/SCXML.java jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/State.java jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/Transition.java jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/History.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/History.java?rev=373323&r1=373322&r2=373323&view=diff ============================================================================== --- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/History.java (original) +++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/History.java Sun Jan 29 08:35:02 2006 @@ -1,6 +1,6 @@ /* * - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,6 @@ */ package org.apache.commons.scxml.model; -import java.util.HashSet; -import java.util.Set; - /** * The class in this SCXML object model that corresponds to the * <history> SCXML pseudo state element. @@ -40,12 +37,6 @@ private Transition transition; /** - * The configuration when the parent of this pseudo state was last - * exited. - */ - private Set lastConfiguration; - - /** * Default no-args constructor for XML Digester. */ public History() { @@ -90,52 +81,6 @@ isDeep = true; } //shallow is by default - } - - /** - * Get the last configuration for this history. - * - * @return Returns the lastConfiguration. - */ - public final Set getLastConfiguration() { - return lastConfiguration; - } - - /** - * Set the last configuration for this history. - * - * @param lc The lastConfiguration to set. - */ - public final void setLastConfiguration(final Set lc) { - if (lastConfiguration == null) { - lastConfiguration = new HashSet(lc.size()); - } else { - lastConfiguration.clear(); - } - lastConfiguration.addAll(lc); - } - - /** - * Check whether we have prior history. - * - * @return Whether we have a non-empty last configuration - */ - public final boolean isEmpty() { - if (lastConfiguration == null || lastConfiguration.isEmpty()) { - return true; - } - return false; - } - - /** - * Resets the history state. - * - * @see org.apache.commons.scxml.SCXMLExecutor#reset() - */ - public final void reset() { - if (lastConfiguration != null) { - lastConfiguration.clear(); - } } } Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/SCXML.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/SCXML.java?rev=373323&r1=373322&r2=373323&view=diff ============================================================================== --- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/SCXML.java (original) +++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/SCXML.java Sun Jan 29 08:35:02 2006 @@ -1,6 +1,6 @@ /* * - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,24 +17,18 @@ */ package org.apache.commons.scxml.model; -import org.apache.commons.scxml.Context; -import org.apache.commons.scxml.NotificationRegistry; -import org.apache.commons.scxml.Observable; -import org.apache.commons.scxml.SCXMLHelper; -import org.apache.commons.scxml.SCXMLListener; - import java.util.HashMap; import java.util.Map; +import org.apache.commons.scxml.SCXMLHelper; + /** * The class in this SCXML object model that corresponds to the * <scxml> root element, and serves as the "document - * root". It is also associated with the root Context, via which - * the SCXMLExecutor may access and the query state of the host - * environment. + * root". * */ -public class SCXML implements Observable { +public class SCXML { /** * The SCXML XMLNS. @@ -68,27 +62,16 @@ private Map states; /** - * The notification registry. - */ - private NotificationRegistry notifReg; - - /** * A global map of all States and Parallels associated with this * state machine, keyed by their id. */ private Map targets; /** - * The root Context which interfaces with the host environment. - */ - private Context rootContext; - - /** * Constructor. */ public SCXML() { this.states = new HashMap(); - this.notifReg = new NotificationRegistry(); this.targets = new HashMap(); } @@ -188,15 +171,6 @@ } /** - * Get the notification registry. - * - * @return NotificationRegistry Returns the notifReg. - */ - public final NotificationRegistry getNotificationRegistry() { - return notifReg; - } - - /** * Get the ID of the initial state. * * @return String Returns the initial state ID (used by XML Digester only). @@ -214,44 +188,6 @@ */ public final void setInitialstate(final String initialstate) { this.initialstate = initialstate; - } - - /** - * Get the root Context for this document. - * - * @return Returns the rootContext. - */ - public final Context getRootContext() { - return rootContext; - } - - /** - * Set the root Context for this document. - * - * @param rootContext The rootContext to set. - */ - public final void setRootContext(final Context rootContext) { - this.rootContext = rootContext; - } - - /** - * Register a listener to this document root. - * - * @param lst The SCXMLListener to add - * Remarks: Only valid if StateMachine is non null! - */ - public final void addListener(final SCXMLListener lst) { - notifReg.addListener(this, lst); - } - - /** - * Deregister a listener from this document root. - * - * @param lst The SCXMLListener to remove - * Remarks: Only valid if StateMachine is non null! - */ - public final void removeListener(final SCXMLListener lst) { - notifReg.removeListener(this, lst); } } Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/State.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/State.java?rev=373323&r1=373322&r2=373323&view=diff ============================================================================== --- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/State.java (original) +++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/State.java Sun Jan 29 08:35:02 2006 @@ -1,6 +1,6 @@ /* * - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.scxml.Context; - /** * The class in this SCXML object model that corresponds to the * <state> SCXML element. @@ -33,11 +31,6 @@ public class State extends TransitionTarget { /** - * The Context in which any expressions will be evaluated. - */ - private Context context; - - /** * The Map containing immediate children of this State, keyed by * their IDs. Incompatible with the parallel property. */ @@ -87,25 +80,6 @@ this.children = new HashMap(); this.transitions = new HashMap(); this.history = new ArrayList(); - } - - /** - * Get the Context. - * - * @return Context Returns the context. - */ - public final Context getContext() { - return context; - } - - /** - * Set the Context. - * - * @param context - * The context to set. - */ - public final void setContext(final Context context) { - this.context = context; } /** Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/Transition.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/Transition.java?rev=373323&r1=373322&r2=373323&view=diff ============================================================================== --- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/Transition.java (original) +++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/Transition.java Sun Jan 29 08:35:02 2006 @@ -1,6 +1,6 @@ /* * - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,6 @@ */ package org.apache.commons.scxml.model; -import org.apache.commons.scxml.NotificationRegistry; -import org.apache.commons.scxml.Observable; -import org.apache.commons.scxml.SCXMLListener; - /** * The class in this SCXML object model that corresponds to the * <transition> SCXML element. Transition rules are triggered @@ -28,7 +24,7 @@ * "guard-conditions". * */ -public class Transition extends Executable implements Observable { +public class Transition extends Executable { /** * Property that specifies the trigger for this transition. @@ -52,11 +48,6 @@ private String next; /** - * The notification registry. - */ - private NotificationRegistry notifReg; - - /** * The path for this transition. * @see Path */ @@ -68,29 +59,10 @@ public Transition() { super(); this.target = null; - this.notifReg = null; this.path = null; } /** - * Register a listener to this document root. - * - * @param lst The SCXMLListener to add - */ - public final void addListener(final SCXMLListener lst) { - notifReg.addListener(this, lst); - } - - /** - * Deregister a listener from this document root. - * - * @param lst The SCXMLListener to remove - */ - public final void removeListener(final SCXMLListener lst) { - notifReg.removeListener(this, lst); - } - - /** * Get the guard condition (may be null). * * @return Returns the cond. @@ -185,25 +157,6 @@ */ public final void setNext(final String next) { this.next = next; - } - - /** - * Supply this Transition object a handle to the notification - * registry. Called by the Digester after instantiation. - * - * @param reg The notification registry - */ - public final void setNotificationRegistry(final NotificationRegistry reg) { - notifReg = reg; - } - - /** - * Get the notification registry. - * - * @return NotificationRegistry The notification registry. - */ - public final NotificationRegistry getNotificationRegistry() { - return notifReg; } /** Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java?rev=373323&r1=373322&r2=373323&view=diff ============================================================================== --- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java (original) +++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java Sun Jan 29 08:35:02 2006 @@ -1,6 +1,6 @@ /* * - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,12 @@ */ package org.apache.commons.scxml.model; -import org.apache.commons.scxml.NotificationRegistry; -import org.apache.commons.scxml.Observable; -import org.apache.commons.scxml.SCXMLListener; - /** * An abstract base class for elements in SCXML that can serve as a * <target> for a <transition>, such as State or Parallel. * */ -public abstract class TransitionTarget implements Observable { +public abstract class TransitionTarget { /** * Identifier for this transition target. Other parts of the SCXML @@ -53,11 +49,6 @@ private TransitionTarget parent; /** - * The notification registry. - */ - private NotificationRegistry notifReg; - - /** * Constructor. */ public TransitionTarget() { @@ -67,44 +58,6 @@ onExit = new OnExit(); //empty defaults onExit.setParent(this); parent = null; - notifReg = null; - } - - /** - * Register a listener to this document root. - * - * @param lst The SCXMLListener to add - */ - public final void addListener(final SCXMLListener lst) { - notifReg.addListener(this, lst); - } - - /** - * Deregister a listener from this document root. - * - * @param lst The SCXMLListener to remove - */ - public final void removeListener(final SCXMLListener lst) { - notifReg.removeListener(this, lst); - } - - /** - * Supply this TransitionTarget object a handle to the notification - * registry. Called by the Digester after instantiation. - * - * @param reg The notification registry - */ - public final void setNotificationRegistry(final NotificationRegistry reg) { - notifReg = reg; - } - - /** - * Get the notification registry. - * - * @return The notification registry. - */ - public final NotificationRegistry getNotificationRegistry() { - return notifReg; } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]