Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-07-19 11:35:49 -0400
committerHenrik Rentz-Reichert2013-07-19 11:40:37 -0400
commit87380681303ebb79ce70c08be197756b6509251f (patch)
treef47a05ee1e84089bc3fa6577ceafc786cb814de5 /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse
parent70f0f873144946795a991d9eaae91efefbd0b332 (diff)
parentcdc96c87ec214de91c55b361ed712ddc1fbc75aa (diff)
downloadorg.eclipse.etrice-87380681303ebb79ce70c08be197756b6509251f.tar.gz
org.eclipse.etrice-87380681303ebb79ce70c08be197756b6509251f.tar.xz
org.eclipse.etrice-87380681303ebb79ce70c08be197756b6509251f.zip
Merge branch 'DynAct' into DynamicActorsTmp
Conflicts: plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ConnectionInstance.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/PortKind.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/StructureInstance.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ConnectionInstanceImpl.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/StructureInstanceImpl.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.tokens plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomLexer.java plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomParser.java plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/RoomQuickfixProvider.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.tokens plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomLexer.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomParser.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/ActorClass.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/ActorRef.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/RoomPackage.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/ActorClassImpl.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/ActorRefImpl.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomFactoryImpl.java plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomPackageImpl.java plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.xtend plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/postprocessing/PostprocessingHelpers.xtend plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.java plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemRunnerGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/MainGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemRunnerGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip plugins/org.eclipse.etrice.ui.structure/META-INF/MANIFEST.MF plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramAccess.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/commands/PopulateDiagramCommand.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureEditor.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/DecorationProvider.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java runtime/org.eclipse.etrice.runtime.java/src-gen/org/eclipse/etrice/runtime/java/modelbase/RTSystemServicesProtocol.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java tests/org.eclipse.etrice.core.room.tests/models/TestBindings.room tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBase.java tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBindings.java tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestCases.java tests/org.eclipse.etrice.generator.java.tests/make.xml tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceTest.java tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBaseTest.java tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/modelbase/MockEventReceiver.java tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/modelbase/MockPort.java tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/modelbase/PortBaseTest.java tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBaseTest.java
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.java/src/org/eclipse')
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java43
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java3
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java25
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java109
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java21
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java11
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java3
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java3
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IInterfaceItemOwner.java24
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IOptionalActorFactory.java28
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java1
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java53
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBroker.java65
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/OptionalActorInterfaceBase.java107
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToPeers.java53
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToThread.java24
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java5
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java4
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java41
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBroker.java38
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedOptionalActorInterfaceBase.java102
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java3
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ScalarOptionalActorInterfaceBase.java68
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java91
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SystemMessage.java45
25 files changed, 822 insertions, 148 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java
new file mode 100644
index 000000000..836b73b5a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.messaging;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public interface IMessageService extends IRTObject, IMessageReceiver, Runnable {
+
+ enum ExecMode {
+ POLLED, BLOCKED, MIXED
+ }
+
+ void terminate();
+
+ Address getFreeAddress();
+
+ void freeAddress(Address addr);
+
+ /**
+ * set the thread of this service
+ * (also sets the thread priority)
+ *
+ * @param thread
+ */
+ void setThread(Thread thread);
+
+ /**
+ * @return the thread of this service
+ */
+ Thread getThread();
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java
index 4dc06e41d..42d95caba 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IRTObject.java
@@ -36,4 +36,7 @@ public interface IRTObject {
String getInstancePath(char delim);
String getInstancePath();
String getInstancePathName();
+
+ int getThreadForPath(String path);
+ List<String> getPeersForPath(String path);
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
index e7aa4be0e..a5f1a76ae 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
@@ -15,14 +15,14 @@ package org.eclipse.etrice.runtime.java.messaging;
/**
- * The MessageService the backbone of the asynchronous communication inside a SubSystem
+ * The MessageService is the backbone of the asynchronous communication inside a SubSystem
* It usually contains a thread a message queue and a dispatcher
*
* @author Thomas Schuetz (initial contribution)
* @author Henrik Rentz-Reichert (extending RTObject, implementing Runnable)
*
*/
-public class MessageService extends RTObject implements IMessageReceiver, Runnable {
+public class MessageService extends RTObject implements IMessageService {
private boolean running = false;
@@ -34,11 +34,15 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
private Thread thread;
private int priority;
- public MessageService(IRTObject parent, int node, int thread, String name) {
- this(parent, node, thread, name, Thread.NORM_PRIORITY);
+ public MessageService(IRTObject parent, ExecMode mode, int node, int thread, String name) {
+ this(parent, mode, 0, node, thread, name, Thread.NORM_PRIORITY);
}
- public MessageService(IRTObject parent, int node, int thread, String name, int priority) {
+ public MessageService(IRTObject parent, ExecMode mode, int nsec, int node, int thread, String name) {
+ this(parent, mode, nsec, node, thread, name, Thread.NORM_PRIORITY);
+ }
+
+ public MessageService(IRTObject parent, ExecMode mode, int nsec, int node, int thread, String name, int priority) {
super(parent, "MessageService_"+name);
address = new Address(node, thread, 0);
@@ -117,11 +121,8 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
}
}
- /**
- * set the thread of this service
- * (also sets the thread priority)
- *
- * @param thread
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#setThread(java.lang.Thread)
*/
public void setThread(Thread thread) {
this.thread = thread;
@@ -129,8 +130,8 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
thread.setPriority(priority);
}
- /**
- * @return the thread of this service
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#getThread()
*/
public Thread getThread() {
return thread;
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
index 35acd3f3f..8f8509e5f 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
@@ -13,9 +13,6 @@
package org.eclipse.etrice.runtime.java.messaging;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -30,47 +27,16 @@ import java.util.Map;
public class MessageServiceController {
- @SuppressWarnings("serial")
- private static class PathToThread extends HashMap<String, Integer> {}
- @SuppressWarnings("serial")
- private static class PathToPeers extends HashMap<String, ArrayList<String>> {
- public void put(String key, String value) {
- ArrayList<String> list = get(key);
- if (list==null) {
- list = new ArrayList<String>();
- put(key, list);
- }
- list.add(value);
- }
-
- public void put(String key, Collection<String> values) {
- ArrayList<String> list = get(key);
- if (list==null) {
- list = new ArrayList<String>(values);
- put(key, list);
- }
- else
- list.addAll(values);
- }
-
- public void put(String key, String[] values) {
- List<String> list = Arrays.asList(values);
- put(key, list);
- }
- }
-
- private List<MessageService> messageServiceList = null;
- private PathToThread path2thread = new PathToThread();
- private PathToPeers path2peers = new PathToPeers();
+ private List<IMessageService> messageServiceList = null;
private boolean running = false;
public MessageServiceController(/*IRTObject parent*/){
// TODOTS: Who is parent of MessageServices and Controller?
// this.parent = parent;
- messageServiceList = new ArrayList<MessageService>();
+ messageServiceList = new ArrayList<IMessageService>();
}
- public void addMsgSvc(MessageService msgSvc){
+ public void addMsgSvc(IMessageService msgSvc){
// TODOTS: Who is parent of MessageServices ?
assert(msgSvc.getAddress().threadID == messageServiceList.size());
messageServiceList.add(msgSvc);
@@ -80,14 +46,14 @@ public class MessageServiceController {
return messageServiceList.size();
}
- public MessageService getMsgSvc(int threadID){
+ public IMessageService getMsgSvc(int threadID){
assert(threadID < messageServiceList.size());
return messageServiceList.get(threadID);
}
public void start() {
// start all message services
- for (MessageService msgSvc : messageServiceList){
+ for (IMessageService msgSvc : messageServiceList){
Thread thread = new Thread(msgSvc, msgSvc.getName());
msgSvc.setThread(thread);
thread.start();
@@ -130,7 +96,7 @@ public class MessageServiceController {
private void terminate() {
// terminate all message services
- for (MessageService msgSvc : messageServiceList){
+ for (IMessageService msgSvc : messageServiceList){
msgSvc.terminate();
// TODOTS: stop in order of priorities
}
@@ -141,7 +107,7 @@ public class MessageServiceController {
* ! not threadsafe !
*/
public void waitTerminate() {
- for (MessageService msgSvc : messageServiceList) {
+ for (IMessageService msgSvc : messageServiceList) {
try {
msgSvc.getThread().join(1000); // wait at most 1000ms
if (msgSvc.getThread().isAlive())
@@ -153,67 +119,8 @@ public class MessageServiceController {
}
}
- /**
- * map a path to a thread id
- * @param path
- * @param thread
- */
- public void addPathToThread(String path, int thread) {
- path2thread.put(path, thread);
- }
-
- /**
- * get thread for path
- * @param path
- * @return
- */
- public int getThreadForPath(String path) {
- Integer thread = path2thread.get(path);
- if (thread==null)
- return 0;
-
- return thread;
- }
-
- /**
- * add a peer for the given path
- * @param path
- * @param peer
- */
- public void addPathToPeer(String path, String peer) {
- path2peers.put(path, peer);
- }
-
- /**
- * add a collection of peers to the given path
- * @param path
- * @param peers
- */
- public void addPathToPeers(String path, Collection<String> peers) {
- path2peers.put(path, peers);
- }
-
- /**
- * add several peers to the given path
- * @param path
- * @param peers
- */
- public void addPathToPeers(String path, String... peers) {
- path2peers.put(path, peers);
- }
-
- /**
- * @param path
- * @return list of peer paths
- */
- public List<String> getPeersForPath(String path) {
- return path2peers.get(path);
- }
-
public void resetAll() {
stop();
messageServiceList.clear();
- path2peers.clear();
- path2thread.clear();
- }
+}
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java
index d6ee1c3a6..5f2ffb87f 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java
@@ -9,6 +9,7 @@
package org.eclipse.etrice.runtime.java.messaging;
import java.util.ArrayList;
+import java.util.List;
/**
* An implementation of the IRTObject interface using a hierarchical structure
@@ -115,4 +116,24 @@ public class RTObject implements IRTObject {
public String getInstancePathName() {
return getInstancePath(PATHNAME_DELIM);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IRTObject#getThreadForPath(java.lang.String)
+ */
+ @Override
+ public int getThreadForPath(String path) {
+ if (parent!=null)
+ return parent.getThreadForPath(path);
+ return -1;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IRTObject#getPeersForPath(java.lang.String)
+ */
+ @Override
+ public List<String> getPeersForPath(String path) {
+ if (parent!=null)
+ return parent.getPeersForPath(path);
+ return null;
+ }
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
index 3e5da5b32..9ed2410a0 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
@@ -22,7 +22,7 @@ import org.eclipse.etrice.runtime.java.modelbase.RTSystemProtocol.RTSystemPort;
* @author Thomas Schuetz
*
*/
-public abstract class ActorClassBase extends EventReceiver implements IMessageReceiver {
+public abstract class ActorClassBase extends EventReceiver implements IMessageReceiver, IInterfaceItemOwner {
protected static final int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later
@@ -117,10 +117,7 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
}
public void destroy() {
- for (IRTObject child : getChildren()) {
- if (child instanceof ActorClassBase)
- ((ActorClassBase) child).destroy();
- }
+ super.destroy();
}
public abstract void executeInitTransition();
@@ -155,4 +152,8 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
}
return true;
}
+
+ public IEventReceiver getEventReceiver() {
+ return this;
+ }
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java
index d4a3e11cb..f35b70c4a 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.java
@@ -15,7 +15,6 @@ package org.eclipse.etrice.runtime.java.modelbase;
import java.util.List;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.messaging.RTServices;
/**
* @author Henrik Rentz-Reichert
@@ -30,7 +29,7 @@ public abstract class DataReceivePort extends DataPortBase {
protected DataReceivePort(IRTObject parent, String name, int localId) {
super(parent, name, localId);
- List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
if (peerPaths!=null && !peerPaths.isEmpty()) {
IRTObject object = getObject(peerPaths.get(0));
connect((DataSendPort) object);
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java
index 1b5e69aad..189a441cd 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.java
@@ -15,7 +15,6 @@ package org.eclipse.etrice.runtime.java.modelbase;
import java.util.List;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.messaging.RTServices;
/**
* @author Henrik Rentz-Reichert
@@ -26,7 +25,7 @@ public class DataSendPort extends DataPortBase {
public DataSendPort(IRTObject parent, String name, int localId) {
super(parent, name, localId);
- List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
if (peerPaths!=null) {
for (String peerPath : peerPaths) {
IRTObject object = getObject(peerPath);
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IInterfaceItemOwner.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IInterfaceItemOwner.java
new file mode 100644
index 000000000..4c8260c26
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IInterfaceItemOwner.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public interface IInterfaceItemOwner extends IRTObject {
+
+ IEventReceiver getEventReceiver();
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IOptionalActorFactory.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IOptionalActorFactory.java
new file mode 100644
index 000000000..cd954102b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IOptionalActorFactory.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public interface IOptionalActorFactory {
+
+ /**
+ * @param replicatedOptionalActorInterfaceBase
+ * @param name
+ * @return
+ */
+ ActorClassBase create(OptionalActorInterfaceBase parent, String name);
+
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java
index 9fcac1819..0899f67bc 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IReplicatedInterfaceItem.java
@@ -19,4 +19,5 @@ package org.eclipse.etrice.runtime.java.modelbase;
public interface IReplicatedInterfaceItem {
InterfaceItemBase createSubInterfaceItem();
+ void removeItem(InterfaceItemBase item);
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
index 6bfdec6aa..3bc1bda46 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
@@ -13,9 +13,11 @@ import java.util.List;
import org.eclipse.etrice.runtime.java.messaging.AbstractMessageReceiver;
import org.eclipse.etrice.runtime.java.messaging.Address;
import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
+import org.eclipse.etrice.runtime.java.messaging.IMessageService;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
+import org.eclipse.etrice.runtime.java.modelbase.SystemMessage.Reason;
/**
* The abstract base class for actor class interface items like ports and saps.
@@ -25,21 +27,25 @@ import org.eclipse.etrice.runtime.java.messaging.RTServices;
*/
public abstract class InterfaceItemBase extends AbstractMessageReceiver {
- private IMessageReceiver ownMsgReceiver;
- private IMessageReceiver peerMsgReceiver;
+ private IReplicatedInterfaceItem replicator = null;
+ protected IMessageReceiver ownMsgReceiver;
+ protected IMessageReceiver peerMsgReceiver;
private int localId;
private int idx;
- private Address peerAddress = null;
+ protected Address peerAddress = null;
- public InterfaceItemBase (IEventReceiver actor, String name, int localId, int idx) {
- super(actor, name);
+ public InterfaceItemBase (IInterfaceItemOwner owner, String name, int localId, int idx) {
+ super(owner.getEventReceiver(), name);
this.localId = localId;
this.idx = idx;
- int thread = RTServices.getInstance().getMsgSvcCtrl().getThreadForPath(getParent().getInstancePath());
+ if (owner instanceof IReplicatedInterfaceItem)
+ replicator = (IReplicatedInterfaceItem) owner;
+
+ int thread = getParent().getThreadForPath(getParent().getInstancePath());
if (thread>=0) {
- MessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
+ IMessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
Address addr = msgSvc.getFreeAddress();
setAddress(addr);
@@ -52,7 +58,7 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
}
}
- List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
if (peerPaths!=null && !peerPaths.isEmpty()) {
IRTObject object = getObject(peerPaths.get(0));
InterfaceItemBase peer = null;
@@ -66,6 +72,16 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
}
}
+
+ protected void handleSystemMessage(SystemMessage msg) {
+ switch (msg.getReason()) {
+ case DISCONNECT:
+ disconnect();
+ if (replicator!=null)
+ destroy();
+ break;
+ }
+ }
protected void connectWith(InterfaceItemBase peer) {
if (peer!=null) {
@@ -76,6 +92,16 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
peer.peerMsgReceiver = ownMsgReceiver;
}
}
+
+ protected void disconnect() {
+ peerMsgReceiver.receive(new SystemMessage(peerAddress, Reason.DISCONNECT));
+ peerAddress = null;
+ peerMsgReceiver = null;
+
+ if (replicator!=null) {
+ replicator.removeItem(this);
+ }
+ }
protected IMessageReceiver getMsgReceiver() {
return ownMsgReceiver;
@@ -104,4 +130,15 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
protected Address getPeerAddress() {
return peerAddress;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.RTObject#destroy()
+ */
+ @Override
+ protected void destroy() {
+ if (peerAddress!=null)
+ disconnect();
+
+ super.destroy();
+ }
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBroker.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBroker.java
new file mode 100644
index 000000000..dcae4782d
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBroker.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import org.eclipse.etrice.runtime.java.messaging.Message;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class InterfaceItemBroker extends InterfaceItemBase {
+
+ private InterfaceItemBase firstPeer = null;
+
+ public InterfaceItemBroker(IInterfaceItemOwner parent, String name, int localId) {
+ this(parent, name, localId, 0);
+ }
+
+ /**
+ * @param actor
+ * @param name
+ * @param localId
+ * @param idx
+ */
+ public InterfaceItemBroker(IInterfaceItemOwner parent, String name, int localId, int idx) {
+ super(parent, name, localId, idx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IMessageReceiver#receive(org.eclipse.etrice.runtime.java.messaging.Message)
+ */
+ @Override
+ public void receive(Message msg) {
+ // ignore this, will never receive a message
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase#connectWith(org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase)
+ */
+ @Override
+ protected void connectWith(InterfaceItemBase peer) {
+ if (firstPeer==null) {
+ firstPeer = peer;
+ super.connectWith(peer);
+ }
+ else {
+ // we are already connected, lets connect our new peer with the previous one
+ peer.peerAddress = firstPeer.getAddress();
+ peer.peerMsgReceiver = firstPeer.ownMsgReceiver;
+ firstPeer.peerAddress = peer.getAddress();
+ firstPeer.peerMsgReceiver = peer.ownMsgReceiver;
+ firstPeer = null;
+ }
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/OptionalActorInterfaceBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/OptionalActorInterfaceBase.java
new file mode 100644
index 000000000..b842a7e40
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/OptionalActorInterfaceBase.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import java.util.List;
+
+import org.eclipse.etrice.runtime.java.messaging.RTObject;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public abstract class OptionalActorInterfaceBase extends RTObject implements IInterfaceItemOwner {
+
+ private String className;
+ private PathToPeers path2peers = null;
+ private String ownPath;
+ private int subtreeThread = -1;
+
+ /**
+ * @param parent
+ * @param name
+ */
+ protected OptionalActorInterfaceBase(IEventReceiver parent, String name, String clsname) {
+ super(parent, name);
+ className = clsname;
+ setOwnPath(getInstancePath());
+ }
+
+ /**
+ * Get list of peer paths
+ *
+ * @param path
+ * @return list of peer paths or {@code null} if not mapped
+ */
+ public List<String> getPeersForPath(String path) {
+ if (getPath2peers()==null)
+ return null;
+
+ path = path.substring(getOwnPath().length());
+ return getPath2peers().get(path);
+ }
+
+ /**
+ * get thread for path
+ * @param path
+ * @return thread id or {@code -1} if not mapped
+ */
+ public int getThreadForPath(String path) {
+ return subtreeThread;
+ }
+
+ public void setPath2peers(PathToPeers path2peers) {
+ this.path2peers = path2peers;
+ }
+
+ /**
+ * @return the path2peers
+ */
+ protected PathToPeers getPath2peers() {
+ return path2peers;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner#getEventReceiver()
+ */
+ @Override
+ public IEventReceiver getEventReceiver() {
+ return (IEventReceiver) getParent();
+ }
+
+ /**
+ * @return the ownPath
+ */
+ public String getOwnPath() {
+ return ownPath;
+ }
+
+ /**
+ * @param ownPath the ownPath to set
+ */
+ public void setOwnPath(String ownPath) {
+ this.ownPath = ownPath;
+ }
+
+ protected int getSubtreeThread() {
+ return subtreeThread;
+ }
+
+ protected void setSubtreeThread(int subtreeThread) {
+ this.subtreeThread = subtreeThread;
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToPeers.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToPeers.java
new file mode 100644
index 000000000..0007b34ca
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToPeers.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class PathToPeers extends HashMap<String, ArrayList<String>> {
+
+ private static final long serialVersionUID = 1L;
+
+ public void put(String key, String value) {
+ ArrayList<String> list = get(key);
+ if (list==null) {
+ list = new ArrayList<String>();
+ put(key, list);
+ }
+ list.add(value);
+ }
+
+ public void put(String key, Collection<String> values) {
+ ArrayList<String> list = get(key);
+ if (list==null) {
+ list = new ArrayList<String>(values);
+ put(key, list);
+ }
+ else
+ list.addAll(values);
+ }
+
+ public void put(String key, String[] values) {
+ List<String> list = Arrays.asList(values);
+ put(key, list);
+ }
+
+} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToThread.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToThread.java
new file mode 100644
index 000000000..a71fadd40
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToThread.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import java.util.HashMap;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class PathToThread extends HashMap<String, Integer> {
+
+ private static final long serialVersionUID = 1L;
+} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
index 2c0997034..90e13b9a9 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
@@ -9,6 +9,7 @@
package org.eclipse.etrice.runtime.java.modelbase;
+
/**
* An abstract base class for port instances.
*
@@ -17,11 +18,11 @@ package org.eclipse.etrice.runtime.java.modelbase;
*/
public abstract class PortBase extends InterfaceItemBase {
- public PortBase (IEventReceiver actor, String name, int localId){
+ public PortBase (IInterfaceItemOwner actor, String name, int localId){
super(actor, name, localId, 0);
}
- public PortBase (IEventReceiver actor, String name, int localId, int idx){
+ public PortBase (IInterfaceItemOwner actor, String name, int localId, int idx){
super(actor, name, localId, idx);
}
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java
index e54ef6e27..574e4e022 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java
@@ -26,7 +26,7 @@ public class RTSystemProtocol {
public static class RTSystemPort extends RTSystemServicesProtocolPort {
- public RTSystemPort(IEventReceiver actor, int localId) {
+ public RTSystemPort(IInterfaceItemOwner actor, int localId) {
super(actor, RT_SYSTEM_PORT_NAME, localId);
// since we have no mapping for the system ports we connect them directly here
@@ -44,7 +44,7 @@ public class RTSystemProtocol {
public static class RTSystemConjPort extends RTSystemServicesProtocolConjReplPort {
- public RTSystemConjPort(IEventReceiver actor, int localId) {
+ public RTSystemConjPort(IInterfaceItemOwner actor, int localId) {
super(actor, RT_SYSTEM_PORT_NAME, localId);
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java
index 9732d7a6c..c223915fb 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBase.java
@@ -13,32 +13,33 @@
package org.eclipse.etrice.runtime.java.modelbase;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.RTObject;
-import org.eclipse.etrice.runtime.java.messaging.RTServices;
/**
* @author Henrik Rentz-Reichert
*
*/
-public abstract class ReplicatedInterfaceItemBase extends RTObject implements IReplicatedInterfaceItem {
+public abstract class ReplicatedInterfaceItemBase extends RTObject implements IReplicatedInterfaceItem, IInterfaceItemOwner {
private int localId;
private ArrayList<InterfaceItemBase> items = new ArrayList<InterfaceItemBase>();
+ private LinkedList<Integer> releasedIndices = new LinkedList<Integer>();
/**
- * @param parent
+ * @param owner
* @param name
* @param localId
*/
- protected ReplicatedInterfaceItemBase(IEventReceiver parent, String name, int localId) {
- super(parent, name);
+ protected ReplicatedInterfaceItemBase(IInterfaceItemOwner owner, String name, int localId) {
+ super(owner, name);
this.localId = localId;
- List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
if (peerPaths!=null) {
for (String path : peerPaths) {
IRTObject object = getObject(path);
@@ -62,14 +63,29 @@ public abstract class ReplicatedInterfaceItemBase extends RTObject implements IR
*/
@Override
public InterfaceItemBase createSubInterfaceItem() {
- InterfaceItemBase item = createInterfaceItem((IEventReceiver)getParent(), getName()+items.size(), localId, items.size());
+ InterfaceItemBase item = createInterfaceItem(this, getName()+items.size(), localId, getFreeIndex());
items.add(item);
return item;
}
+ public void removeItem(InterfaceItemBase item) {
+ assert(item.getParent()==this): "is own child";
+ releasedIndices.push(item.getIdx());
+ items.remove(item);
+ }
+
+ private int getFreeIndex() {
+ if (releasedIndices.isEmpty())
+ return items.size();
+ else
+ return releasedIndices.pop();
+ }
+
public InterfaceItemBase getInterfaceItem(int idx) {
- if (0<=idx && idx<items.size())
- return items.get(idx);
+ for (InterfaceItemBase item : items) {
+ if (item.getIdx()==idx)
+ return item;
+ }
return null;
}
@@ -82,5 +98,10 @@ public abstract class ReplicatedInterfaceItemBase extends RTObject implements IR
return localId;
}
- protected abstract InterfaceItemBase createInterfaceItem(IEventReceiver rcv, String name, int lid, int idx);
+ @Override
+ public IEventReceiver getEventReceiver() {
+ return (IEventReceiver) getParent();
+ }
+
+ protected abstract InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx);
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBroker.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBroker.java
new file mode 100644
index 000000000..15a7e4591
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBroker.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class ReplicatedInterfaceItemBroker extends ReplicatedInterfaceItemBase {
+
+ /**
+ * @param parent
+ * @param name
+ * @param localId
+ */
+ public ReplicatedInterfaceItemBroker(IInterfaceItemOwner parent, String name, int localId) {
+ super(parent, name, localId);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.modelbase.ReplicatedInterfaceItemBase#createInterfaceItem(org.eclipse.etrice.runtime.java.messaging.IRTObject, java.lang.String, int, int)
+ */
+ @Override
+ protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
+ return new InterfaceItemBroker(this, name, lid, idx);
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedOptionalActorInterfaceBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedOptionalActorInterfaceBase.java
new file mode 100644
index 000000000..884688f96
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedOptionalActorInterfaceBase.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+import org.eclipse.etrice.runtime.java.messaging.RTServices;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class ReplicatedOptionalActorInterfaceBase extends OptionalActorInterfaceBase {
+
+ private static final char INDEX_SEP = ':';
+ private LinkedList<Integer> releasedIndices = new LinkedList<Integer>();
+ private ArrayList<ActorClassBase> actors = new ArrayList<ActorClassBase>();
+
+ /**
+ * @param parent
+ * @param name
+ * @param clsname
+ */
+ public ReplicatedOptionalActorInterfaceBase(IEventReceiver parent, String name, String clsname) {
+ super(parent, name, clsname);
+ }
+
+ protected int createOptionalActor(String actorClass, int thread) {
+ setSubtreeThread(thread);
+
+ // make sure the path is up to date
+ setOwnPath(getInstancePath());
+
+ IOptionalActorFactory factory = RTServices.getInstance().getSubSystem().getFactory(getClassName(), actorClass);
+ if (factory==null)
+ return -1;
+
+ // the factory will set our path2peers map
+ int index = getFreeIndex();
+ String name = getChildName(index);
+ ActorClassBase actor = factory.create(this, name);
+ if (actor==null)
+ return -1;
+
+ actors.add(actor);
+
+ return index;
+ }
+
+ /**
+ * @param idx
+ * @return
+ */
+ protected boolean destroyOptionalActor(int idx) {
+ IRTObject child = getChild(getChildName(idx));
+ if (!(child instanceof ActorClassBase))
+ return false;
+
+ ((ActorClassBase)child).destroy();
+ releasedIndices.push(idx);
+ actors.remove(child);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.modelbase.OptionalActorInterfaceBase#getPeersForPath(java.lang.String)
+ */
+ @Override
+ public List<String> getPeersForPath(String path) {
+ if (getPath2peers()==null)
+ return null;
+
+ path = path.substring(getOwnPath().length(), path.lastIndexOf(INDEX_SEP));
+ return getPath2peers().get(path);
+ }
+
+ public String getChildName(int idx) {
+ return getName()+INDEX_SEP+idx;
+ }
+
+ private int getFreeIndex() {
+ if (releasedIndices.isEmpty())
+ return actors.size();
+ else
+ return releasedIndices.pop();
+ }
+
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java
index e511717ff..deb7d4f5d 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedPortBase.java
@@ -12,6 +12,7 @@
package org.eclipse.etrice.runtime.java.modelbase;
+
/**
* An abstract base class for instances of replicated ports.
*
@@ -25,7 +26,7 @@ public abstract class ReplicatedPortBase extends ReplicatedInterfaceItemBase {
* @param name
* @param localId
*/
- public ReplicatedPortBase(IEventReceiver parent, String name, int localId) {
+ public ReplicatedPortBase(IInterfaceItemOwner parent, String name, int localId) {
super(parent, name, localId);
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ScalarOptionalActorInterfaceBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ScalarOptionalActorInterfaceBase.java
new file mode 100644
index 000000000..bb966300c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ScalarOptionalActorInterfaceBase.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import org.eclipse.etrice.runtime.java.messaging.RTServices;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class ScalarOptionalActorInterfaceBase extends OptionalActorInterfaceBase {
+
+ private ActorClassBase actor = null;
+
+ /**
+ * @param parent
+ * @param name
+ * @param clsname
+ */
+ public ScalarOptionalActorInterfaceBase(IEventReceiver parent, String name, String clsname) {
+ super(parent, name, clsname);
+ }
+
+ protected boolean createOptionalActor(String actorClass, int thread) {
+ if (actor!=null)
+ return false;
+
+ setSubtreeThread(thread);
+
+ // make sure the path is up to date
+ setOwnPath(getInstancePath());
+
+ // SubSystemClass.createOptionalActor() will set our PathTo* maps
+ IOptionalActorFactory factory = RTServices.getInstance().getSubSystem().getFactory(getClassName(), actorClass);
+ if (factory==null)
+ return false;
+
+ // the factory will set our path2peers map
+ actor = factory.create(this, getName());
+
+ return actor!=null;
+ }
+
+ /**
+ * @param idx
+ * @return
+ */
+ protected boolean destroyOptionalActor() {
+ if (actor==null)
+ return false;
+
+ actor.destroy();
+ actor = null;
+
+ return true;
+ }
+
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
index 3219c7fda..cd37a8dd3 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
@@ -8,11 +8,14 @@
package org.eclipse.etrice.runtime.java.modelbase;
+import java.util.Collection;
+import java.util.List;
+
import org.eclipse.etrice.runtime.java.config.IVariableService;
import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.IMessageService;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.RTObject;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
import org.eclipse.etrice.runtime.java.modelbase.RTSystemProtocol.RTSystemConjPort;
@@ -24,7 +27,7 @@ import org.eclipse.etrice.runtime.java.modelbase.RTSystemProtocol.RTSystemConjPo
* @author Henrik Rentz-Reichert
*
*/
-public abstract class SubSystemClassBase extends RTObject implements IEventReceiver{
+public abstract class SubSystemClassBase extends RTObject implements IEventReceiver, IInterfaceItemOwner {
// variable service (is only instantiated if needed)
protected IVariableService variableService = null;
@@ -35,6 +38,9 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
//--------------------- interface item IDs
protected static final int IFITEM_RTSystemPort = 0;
+ private PathToThread path2thread = new PathToThread();
+ private PathToPeers path2peers = new PathToPeers();
+
// for tests only
private TestSemaphore terminateSem=null;
private int terminateCode;
@@ -119,7 +125,7 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
System.out.println("=== done destroy RTServices");
}
- public MessageService getMsgService(int idx) {
+ public IMessageService getMsgService(int idx) {
return RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(idx);
}
@@ -163,4 +169,83 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
public IVariableService getVariableService() {
return variableService;
}
+
+ /**
+ * map a path to a thread id
+ * @param path
+ * @param thread
+ */
+ public void addPathToThread(String path, int thread) {
+ path2thread.put(path, thread);
+ }
+
+ /**
+ * get thread for path
+ * @param path
+ * @return
+ */
+ public int getThreadForPath(String path) {
+ Integer thread = path2thread.get(path);
+ if (thread==null)
+ return -1;
+
+ return thread;
+ }
+
+ /**
+ * add a peer for the given path
+ * @param path
+ * @param peer
+ */
+ public void addPathToPeer(String path, String peer) {
+ path2peers.put(path, peer);
+ }
+
+ /**
+ * add a collection of peers to the given path
+ * @param path
+ * @param peers
+ */
+ public void addPathToPeers(String path, Collection<String> peers) {
+ path2peers.put(path, peers);
+ }
+
+ /**
+ * add several peers to the given path
+ * @param path
+ * @param peers
+ */
+ public void addPathToPeers(String path, String... peers) {
+ path2peers.put(path, peers);
+ }
+
+ /**
+ * @param path
+ * @return list of peer paths
+ */
+ public List<String> getPeersForPath(String path) {
+ return path2peers.get(path);
+ }
+
+ /**
+ * Clears thread and peer mappings.
+ */
+ public void resetAll() {
+ path2peers.clear();
+ path2thread.clear();
+ }
+ /**
+ * @param optionalActorClass
+ * @param instanceActorClass
+ * @return
+ */
+ abstract public IOptionalActorFactory getFactory(String optionalActorClass, String instanceActorClass);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner#getEventReceiver()
+ */
+ @Override
+ public IEventReceiver getEventReceiver() {
+ return this;
+ }
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SystemMessage.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SystemMessage.java
new file mode 100644
index 000000000..fc0b0976a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SystemMessage.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.modelbase;
+
+import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.Message;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class SystemMessage extends Message {
+
+ enum Reason {
+ DISCONNECT
+ }
+
+ private Reason reason;
+
+ /**
+ * @param address
+ */
+ public SystemMessage(Address address, Reason reason) {
+ super(address);
+ this.reason = reason;
+ }
+
+ /**
+ * @return the reason
+ */
+ public Reason getReason() {
+ return reason;
+ }
+
+}

Back to the top