[ 
https://issues.apache.org/jira/browse/SCXML-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505507
 ] 

Rahul Akolkar commented on SCXML-47:
------------------------------------

Sounds useful; the AbstractStateMachine class hasn't been used much by me (it 
was put together for the stopwatch usecase) but I know others are using it. I 
believe many improvements are possible -- at some point, when we move to JDK 
1.5, we can take care of some of this with annotations instead which perhaps 
may be cleaner.

To begin, could you fill out an Individual Contributor License Agreement 
(ICLA)? That is here (the fax number is on the form itself, you can mail it in 
too if you want):

http://www.apache.org/licenses/icla.txt

Its a one-time thing, and is needed for non-trivial contributions, for code 
provenance and pedigree reasons. Please let us know if you have any questions 
about the ICLA. Ping this issue when you send it in (unless you choose not to), 
then we can track its receipt and dig into the details of this improvement. 
Thanks.


> Provide a state machine support class to allow for delegation.
> --------------------------------------------------------------
>
>                 Key: SCXML-47
>                 URL: https://issues.apache.org/jira/browse/SCXML-47
>             Project: Commons SCXML
>          Issue Type: Improvement
>            Reporter: Michael Heuer
>            Priority: Minor
>         Attachments: state-machine-support-src.tar.gz
>
>
> This is not completely thought out yet, but if folks like the idea I might 
> persue it further.
> I would like to use AbstractStateMachine but cannot extend from it:
> class B extends A /*, AbstractStateMachine */ {
>   // copy source from AbstractStateMachine here
> }
> I propose here a StateMachineSupport class that provides for use by 
> subclassing and for use by delegation.  The constructors are a little messy, 
> but in the end I have
> public class StateMachineSupport {
>   // use by subclassing
>   protected StateMachineSupport(...) {
>   }
>   // use by delegation
>   public StateMachineSupport(Object delegator, ...) {
>   }
>   // ... methods from AbstractStateMachine
> }
> public abstract class AbstractStateMachine extends StateMachineSupport {
>   protected AbstractStateMachine(...) {
>     super(...);
>   }
> }
> // use by subclassing
> class ConcreteStateMachine extends AbstractStateMachine {
>   ConcreteStateMachine() {
>     super(..."stopwatch.xml");
>   }
>   public void reset() { ... }
>   public void running() { ... }
>   public void paused() { ... }
>   public void stopped() { ... }
> }
> // use by delegation
> class DelegatingStateMachine extends SomethingElse {
>   StateMachineSupport delegate;
>   DelegatingStateMachine() {
>     delegate = new StateMachineSupport(this, ..."stopwatch.xml");
>   }
>   public void reset() { ... }
>   public void running() { ... }
>   public void paused() { ... }
>   public void stopped() { ... }
> }
> StateMachineSupport.java, AbstractStateMachine2.java, 
> StateMachineSupportTest.java, and AbstractStateMachine2Test.java attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to