Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2017-08-28 08:39:00 +0000
committerjeremie.tatibouet2017-08-28 11:34:01 +0000
commit38f0c3d3589634ea0e0034622dd9faa365bc550c (patch)
treec9c8e5c9c49db4890f38ee3674c528767f62ed06
parent80fd15436f6c88dc061d9a28470b97c0ef13af7a (diff)
downloadorg.eclipse.papyrus-moka-38f0c3d3589634ea0e0034622dd9faa365bc550c.tar.gz
org.eclipse.papyrus-moka-38f0c3d3589634ea0e0034622dd9faa365bc550c.tar.xz
org.eclipse.papyrus-moka-38f0c3d3589634ea0e0034622dd9faa365bc550c.zip
Integrate external controller framework with the execution queue manager
Change-Id: I41ef9ee70ab0d664afe9fd3cd2b9572ceb303a2f Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/control/queue/ExecutionLoop.java2
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF1
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java35
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/control/queue/TimedExecutionLoop.java12
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/build.properties3
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/control/queue/ExternallyControlledExecutionLoop.java69
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/AbstractExternallyControlledVisitor.java3
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/ExternalController.java43
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/engine/AbstractExternalControlExecutionEngine.java166
-rw-r--r--bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/semantics/ExternallyControlledActivityEdgeInstance.java1
10 files changed, 184 insertions, 151 deletions
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/control/queue/ExecutionLoop.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/control/queue/ExecutionLoop.java
index 86cdec6c..ed7c818f 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/control/queue/ExecutionLoop.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/control/queue/ExecutionLoop.java
@@ -51,7 +51,7 @@ public class ExecutionLoop {
return this.runNext();
}
- private boolean runNext(){
+ protected final boolean runNext(){
// If the queue is not empty, then the head execution is removed
// and executed. True is returned. False is only returned if the
// queue was empty.
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
index 7b1b8641..bbc8b821 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
@@ -13,5 +13,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.moka.timedfuml,
org.eclipse.papyrus.moka.timedfuml.actions,
+ org.eclipse.papyrus.moka.timedfuml.control.queue,
org.eclipse.papyrus.moka.timedfuml.semantics
Bundle-Vendor: Eclipse Modeling Project
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
index 2f562b67..f9f88de2 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
@@ -11,18 +11,43 @@
*****************************************************************************/
package org.eclipse.papyrus.moka.timedfuml;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Executor;
+import org.eclipse.papyrus.moka.discreteevent.DEScheduler;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ILocus;
import org.eclipse.papyrus.moka.fuml.control.execution.RootExecution;
import org.eclipse.papyrus.moka.fuml.control.queue.ExecutionController;
import org.eclipse.papyrus.moka.fuml.statemachines.StateMachineExecutionEngine;
import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus;
+import org.eclipse.papyrus.moka.timedfuml.actions._displayCurrentTimeAction;
import org.eclipse.papyrus.moka.timedfuml.control.queue.TimedExecutionLoop;
import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_ExecutionFactory;
import org.eclipse.uml2.uml.Behavior;
public class TimedUmlExecutionEngine extends StateMachineExecutionEngine {
+ protected double getStopTime() {
+ // Scheduler stop time
+ return -1.0;
+ }
+
+ protected void initDEScheduler(){
+ // Initialize the scheduler
+ DEScheduler.init(this.getStopTime());
+ }
+
+ protected void doPreRunActions() {
+ // This method can be overridden to perform pre-run initializations that can be
+ // needed for a given customization. Typically useful to register pre-step
+ // actions to the DEScheduler
+ DEScheduler.getInstance().pushPreStepAction(new _displayCurrentTimeAction());
+ }
+
+ protected void doPostRunActions() {
+ // This method can be overridden to perform post-run finalization that can be
+ // needed for a given customization.
+ }
+
@Override
public ILocus initializeLocus() {
this.locus = new SM_Locus();
@@ -38,5 +63,15 @@ public class TimedUmlExecutionEngine extends StateMachineExecutionEngine {
ExecutionController.getInstance().setExecutionLoop(new TimedExecutionLoop());
ExecutionController.getInstance().start(rootExecution);
}
+
+ @Override
+ public void start(IProgressMonitor monitor) {
+ // we start the default fUML* execution but we know it should finish quick,
+ // once all the Externally controlled visitors are suspended.
+ this.initDEScheduler();
+ this.doPreRunActions();
+ super.start(monitor);
+ this.doPostRunActions();
+ }
}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/control/queue/TimedExecutionLoop.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/control/queue/TimedExecutionLoop.java
index 09d34b25..55b26905 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/control/queue/TimedExecutionLoop.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/control/queue/TimedExecutionLoop.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.moka.timedfuml.control.queue;
import org.eclipse.papyrus.moka.discreteevent.DEScheduler;
import org.eclipse.papyrus.moka.fuml.control.execution.RootExecution;
import org.eclipse.papyrus.moka.fuml.control.queue.ExecutionLoop;
-import org.eclipse.papyrus.moka.timedfuml.actions._displayCurrentTimeAction;
public class TimedExecutionLoop extends ExecutionLoop{
@@ -29,9 +28,7 @@ public class TimedExecutionLoop extends ExecutionLoop{
@Override
public void start(RootExecution execution) {
- // Initialize the scheduler and starts the execution loop
- DEScheduler.init(-1.0);
- DEScheduler.getInstance().pushPreStepAction(new _displayCurrentTimeAction());
+ // Retrieve scheduler instance and starts the execution
this.scheduler = DEScheduler.getInstance();
super.start(execution);
}
@@ -53,13 +50,14 @@ public class TimedExecutionLoop extends ExecutionLoop{
@Override
public boolean step() {
// If the model is in a state that enables the execution to move
- // forward according to executable UML semantics. Conversely, if
+ // forward according to executable UML semantics then execute the
+ // next registered execution in the queue. Conversely, if
// the model is in a state that does not enable the execution to
// move forward according to the executable UML semantics then enable
// scheduler to step forward.
boolean stepIn = super.step();
- if(!stepIn && !scheduler.isFinished()){
- scheduler.step();
+ if(!stepIn && !this.scheduler.isFinished()){
+ this.scheduler.step();
}
return stepIn;
}
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/build.properties b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/build.properties
index 41eb6ade..396b9c1e 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/build.properties
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/build.properties
@@ -1,4 +1,5 @@
-source.. = src/
+source.. = src/,\
+ aspects/
output.. = bin/
bin.includes = META-INF/,\
.
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/control/queue/ExternallyControlledExecutionLoop.java b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/control/queue/ExternallyControlledExecutionLoop.java
new file mode 100644
index 00000000..663d5ca4
--- /dev/null
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/control/queue/ExternallyControlledExecutionLoop.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.externalcontrol.control.queue;
+
+import org.eclipse.papyrus.moka.externalcontrol.controller.ExternalController;
+import org.eclipse.papyrus.moka.timedfuml.control.queue.TimedExecutionLoop;
+
+public class ExternallyControlledExecutionLoop extends TimedExecutionLoop{
+
+ // Semantic visitor controller
+ protected ExternalController controller;
+
+ public ExternallyControlledExecutionLoop(ExternalController controller) {
+ this.controller = controller;
+ }
+
+ @Override
+ public void run() {
+ // While the simulation can continue (i.e., the scheduler has remaining events)
+ // 1] Propagate the execution according to executable UML semantics.
+ // 2] Enable the controller to resume (if possible) controlled execution visitors.
+ // 3] Let simulation time progress (i.e., consume all events at the next closest time)
+ while(!this.scheduler.isFinished()) {
+ while(!this.queue.isEmpty() || this.controller.hasEnabledVisitors()){
+ if(!this.queue.isEmpty()) {
+ this.runNext();
+ }else {
+ this.controller.step();
+ }
+ }
+ this.scheduler.step();
+ }
+ }
+
+ @Override
+ public boolean step() {
+ // If the model is in a state that enables the execution to move
+ // forward according to executable UML semantics then execute the
+ // next registered execution in the queue. Conversely, if the model
+ // is in a state that does enable the execution to move forward according
+ // to the executable UML semantics then if possible a step is requested
+ // from the controller standpoint. If no step is possible for the controller
+ // then a step is requested from the scheduler.
+ boolean stepIn = this.runNext();
+ if(!stepIn) {
+ if(!this.scheduler.isFinished()) {
+ if(this.controller.hasEnabledVisitors()) {
+ this.controller.step();
+ }else {
+ this.scheduler.step();
+ }
+ stepIn = true;
+ }
+ }
+ return stepIn;
+ }
+
+}
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/AbstractExternallyControlledVisitor.java b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/AbstractExternallyControlledVisitor.java
index c42a9fb3..0896746c 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/AbstractExternallyControlledVisitor.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/AbstractExternallyControlledVisitor.java
@@ -19,6 +19,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.eclipse.papyrus.moka.discreteevent.DEScheduler;
import org.eclipse.papyrus.moka.discreteevent.Event;
import org.eclipse.papyrus.moka.discreteevent.actions.Action;
import org.eclipse.papyrus.moka.externalcontrol.advice.IControllerAdvice;
@@ -84,7 +85,7 @@ public abstract class AbstractExternallyControlledVisitor<T extends ISemanticVis
protected void suspendForTime(Double duration){
- controller.getDEScheduler().pushEvent(new Event(duration, new Action() {
+ DEScheduler.getInstance().pushEvent(new Event(duration, new Action() {
@Override
public void execute() {
currentState = ControlledVisitorStep.FINISHING;
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/ExternalController.java b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/ExternalController.java
index b551cdc1..d1dcfc4b 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/ExternalController.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/controller/ExternalController.java
@@ -13,57 +13,32 @@
*****************************************************************************/
package org.eclipse.papyrus.moka.externalcontrol.controller;
-import org.eclipse.papyrus.moka.discreteevent.DEScheduler;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
public class ExternalController {
- protected boolean finished = false ;
- protected boolean started = false ;
-
- protected IControlledVisitorPushPullStrategy pushPullStrategy ;
-
-
- private DEScheduler deScheduler;
+ protected IControlledVisitorPushPullStrategy pushPullStrategy;
- public DEScheduler getDEScheduler(){
- return deScheduler;
- }
-
-
- public ExternalController(DEScheduler deScheduler, IControlledVisitorPushPullStrategy strategy) {
- this.deScheduler = deScheduler;
+ public ExternalController(IControlledVisitorPushPullStrategy strategy) {
this.pushPullStrategy = strategy;
}
-
-
+
public void suspendForControl(IExternallyControlledVisitor<? extends ISemanticVisitor> controlledVisitor) {
pushPullStrategy.pushVisitor(controlledVisitor);
}
-
-
- public void run() {
- while (!deScheduler.isFinished()) {
- this.step() ;
- }
- }
-
public void step() {
- //this is the responsibility of the pushPullStrategy to provide only visitors that can execute
+ // this is the responsibility of the pushPullStrategy to provide only visitors
+ // that can execute
IExternallyControlledVisitor<? extends ISemanticVisitor> visitor = pushPullStrategy.pullEnabledVisitor();
-
- //we perform a first loop on all visitors that can execute now
- while(visitor != null){
+ // we perform a first loop on all visitors that can execute now
+ while (visitor != null) {
visitor.doExecute();
visitor = pushPullStrategy.pullEnabledVisitor();
}
- // then we let time progress
- deScheduler.step();
-
}
-
- public boolean hasEnabledVisitors(){
+
+ public boolean hasEnabledVisitors() {
return pushPullStrategy.hasEnabledVisitors();
}
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/engine/AbstractExternalControlExecutionEngine.java b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/engine/AbstractExternalControlExecutionEngine.java
index 164c87b4..88eb3029 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/engine/AbstractExternalControlExecutionEngine.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/engine/AbstractExternalControlExecutionEngine.java
@@ -15,9 +15,8 @@ package org.eclipse.papyrus.moka.externalcontrol.engine;
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.papyrus.moka.discreteevent.DEScheduler;
import org.eclipse.papyrus.moka.externalcontrol.advice.IControllerAdviceFactory;
+import org.eclipse.papyrus.moka.externalcontrol.control.queue.ExternallyControlledExecutionLoop;
import org.eclipse.papyrus.moka.externalcontrol.controller.ExternalController;
import org.eclipse.papyrus.moka.externalcontrol.controller.IControlledVisitorPushPullStrategy;
import org.eclipse.papyrus.moka.externalcontrol.controller.NodeEdgeAlternatePushPullStrategy;
@@ -27,150 +26,105 @@ import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.IExecutionFactory;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.IExecutor;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ILocus;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Loci.LociL1.ExecutionFactory;
-import org.eclipse.papyrus.moka.fuml.statemachines.StateMachineExecutionEngine;
-import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_Locus;
-
+import org.eclipse.papyrus.moka.fuml.control.execution.RootExecution;
+import org.eclipse.papyrus.moka.fuml.control.queue.ExecutionController;
+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus;
+import org.eclipse.papyrus.moka.timedfuml.TimedUmlExecutionEngine;
+import org.eclipse.uml2.uml.Behavior;
/**
- * Clients should extend this class to provide an specialized Moka execution engine, relying on
- * a default semantic ExecutionFactory, customized thanks to Advices provided by the AdviceFactories.
+ * Clients should extend this class to provide an specialized Moka execution
+ * engine, relying on a default semantic ExecutionFactory, customized thanks to
+ * Advices provided by the AdviceFactories.
+ *
* @author sr246418
*
*/
-public abstract class AbstractExternalControlExecutionEngine extends StateMachineExecutionEngine {
+public abstract class AbstractExternalControlExecutionEngine extends TimedUmlExecutionEngine {
-
-
/**
* The ExternalController instance
*/
- protected ExternalController controller ;
-
-
-
+ protected ExternalController controller;
+
/**
- * Clients should implement this method to provide Advice Factories. The factories
- * will return advices that will influence the default execution of semantic visitors
- * provided by the delegated execution factory.
+ * Clients should implement this method to provide Advice Factories. The
+ * factories will return advices that will influence the default execution of
+ * semantic visitors provided by the delegated execution factory.
*
- * @return a list of Controller Advice factories. It should not be null, but can be empty
+ * @return a list of Controller Advice factories. It should not be null, but can
+ * be empty
*/
protected abstract List<IControllerAdviceFactory> getAdviceFactories();
-
-
+
/**
- * Clients should implement this method to return the default IExecutionFactory, which will
- * instantiate the semantic visitors for each executable model element.
- * @return the default IExecutionFactory on top of which this customization is implemented
+ * Clients should implement this method to return the default IExecutionFactory,
+ * which will instantiate the semantic visitors for each executable model
+ * element.
+ *
+ * @return the default IExecutionFactory on top of which this customization is
+ * implemented
*/
protected abstract IExecutionFactory getDelegatedExecutionFactory();
-
-
/**
- * This method can be overridden to perform pre-run initializations that can be needed
- * for a given customization. Typically useful to register pre-step actions to the DEScheduler
+ * Clients can override this method to provide another ILocus type. By default a
+ * {@link org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus}
+ * is used.
+ *
+ * @return the locus that will be used for this semantic customization. Should
+ * not be null.
*/
- protected void doPreRunActions(){
- //do nothing by default
+ protected ILocus getLocus() {
+ return new SM_Locus();
}
/**
- * This method can be overridden to perform post-run finalization that can be needed
- * for a given customization.
- */
- protected void doPostRunActions() {
- //do nothing by default
-
- }
-
- /**
- * Clients can override this method to provide another ILocus type.
- * By default a {@link org.eclipse.papyrus.moka.timedfuml.semantics.Timed_Locus} is used.
- * @return the locus that will be used for this semantic customization. Should not be null.
- */
- protected ILocus getLocus() {
- return new Timed_Locus();
- }
-
-
- /**
- * Clients can override this method to provide another IExecutor type.
- * By default a {@link org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Executor} is used.
- * @return the IExecutor that will be used for this semantic customization. Should not be null.
+ * Clients can override this method to provide another IExecutor type. By
+ * default a
+ * {@link org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Executor}
+ * is used.
+ *
+ * @return the IExecutor that will be used for this semantic customization.
+ * Should not be null.
*/
- protected IExecutor getExecutor(){
+ protected IExecutor getExecutor() {
return new ExternalControlExecutor();
}
-
-
- /**
- * Clients can override this method to provide another simulation stop time.
- * By default, -1.0 is returned, meaning an infinite stop time.
- * @return the simulation stop time.
- */
- protected double getStopTime(){
- return -1.0;
- }
-
-
+
/**
- * Clients can override this method to provide another IControlledVisitorPushPullStrategy to the ExternalController.
- * By default a {@link org.eclipse.papyrus.moka.externalcontrol.controller.NodeEdgeAlternatePushPullStrategy} is returned.
- * @return the IControlledVisitorPushPullStrategy that will be used by the External Control executor. Should not be null.
+ * Clients can override this method to provide another
+ * IControlledVisitorPushPullStrategy to the ExternalController. By default a
+ * {@link org.eclipse.papyrus.moka.externalcontrol.controller.NodeEdgeAlternatePushPullStrategy}
+ * is returned.
+ *
+ * @return the IControlledVisitorPushPullStrategy that will be used by the
+ * External Control executor. Should not be null.
*/
- protected IControlledVisitorPushPullStrategy getControllerPushPullStrategy(){
+ protected IControlledVisitorPushPullStrategy getControllerPushPullStrategy() {
return new NodeEdgeAlternatePushPullStrategy();
}
-
@Override
public ILocus initializeLocus() {
-
this.locus = getLocus();
locus.setExecutor(getExecutor());
-
-
-
IExecutionFactory delegatedFactory = getDelegatedExecutionFactory();
-
- ExecutionFactory externalControlExecutionFactory = new ExternalControlExecutionFactory(delegatedFactory,controller,getAdviceFactories());
+ ExecutionFactory externalControlExecutionFactory = new ExternalControlExecutionFactory(delegatedFactory,
+ controller, getAdviceFactories());
locus.setFactory(externalControlExecutionFactory);
-
-
return this.locus;
}
-
- @Override
- public void start(IProgressMonitor monitor) {
- initDEScheduler();
- controller = new ExternalController(DEScheduler.getInstance(), getControllerPushPullStrategy());
- doPreRunActions();
-
-
- //we start the default fUML* execution but we know it should finish rapidly,
- //once all the Externally controlled visitors are suspended.
- super.start(monitor);
- //now the controller is starting and will resume suspended visitors
- controller.run();
-
- doPostRunActions();
- }
-
-
-
-
- protected void initDEScheduler() {
- //we init here the DEScheduler since we need it for the ExternalController
- DEScheduler.init(getStopTime());
-
+ @Override
+ protected void run_() {
+ // Starts externally controlled execution loop
+ RootExecution rootExecution = new RootExecution((Behavior) this.executionEntryPoint, this.executionArguments,
+ locus);
+ ExecutionController.getInstance().setExecutionLoop(
+ new ExternallyControlledExecutionLoop(new ExternalController(getControllerPushPullStrategy())));
+ ExecutionController.getInstance().start(rootExecution);
}
-
-
-
-
}
-
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/semantics/ExternallyControlledActivityEdgeInstance.java b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/semantics/ExternallyControlledActivityEdgeInstance.java
index 2e3725bc..90da661f 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/semantics/ExternallyControlledActivityEdgeInstance.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.externalcontrol/src/org/eclipse/papyrus/moka/externalcontrol/semantics/ExternallyControlledActivityEdgeInstance.java
@@ -19,7 +19,6 @@ import org.eclipse.papyrus.moka.externalcontrol.advice.IControllerAdvice;
import org.eclipse.papyrus.moka.externalcontrol.controller.AbstractExternallyControlledVisitor;
import org.eclipse.papyrus.moka.externalcontrol.controller.ExternalController;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityEdgeInstance;
-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityExecution;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivationGroup;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IToken;

Back to the top