Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-07-23 04:13:10 -0400
committerHenrik Rentz-Reichert2013-07-23 04:14:23 -0400
commit6da86dfabe8cae3f9e764b3b6bf31ba52077da6f (patch)
tree3ff5e4254041d6c1b0f5ed35bf60c795ffc4a842 /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse
parent61827a255e062f27954b7e50ed6160d052399940 (diff)
downloadorg.eclipse.etrice-6da86dfabe8cae3f9e764b3b6bf31ba52077da6f.tar.gz
org.eclipse.etrice-6da86dfabe8cae3f9e764b3b6bf31ba52077da6f.tar.xz
org.eclipse.etrice-6da86dfabe8cae3f9e764b3b6bf31ba52077da6f.zip
manual revert to the contents of 19.7.2013, commit 70f0f87
this discards the changes introduced with merge 54c56bd
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, 148 insertions, 822 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
deleted file mode 100644
index 836b73b5a..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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 42d95caba..4dc06e41d 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,7 +36,4 @@ 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 a5f1a76ae..e7aa4be0e 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 is the backbone of the asynchronous communication inside a SubSystem
+ * The MessageService 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 IMessageService {
+public class MessageService extends RTObject implements IMessageReceiver, Runnable {
private boolean running = false;
@@ -34,15 +34,11 @@ public class MessageService extends RTObject implements IMessageService {
private Thread thread;
private int 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) {
+ this(parent, node, thread, name, Thread.NORM_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) {
+ public MessageService(IRTObject parent, int node, int thread, String name, int priority) {
super(parent, "MessageService_"+name);
address = new Address(node, thread, 0);
@@ -121,8 +117,11 @@ public class MessageService extends RTObject implements IMessageService {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#setThread(java.lang.Thread)
+ /**
+ * set the thread of this service
+ * (also sets the thread priority)
+ *
+ * @param thread
*/
public void setThread(Thread thread) {
this.thread = thread;
@@ -130,8 +129,8 @@ public class MessageService extends RTObject implements IMessageService {
thread.setPriority(priority);
}
- /* (non-Javadoc)
- * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#getThread()
+ /**
+ * @return the thread of this service
*/
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 8f8509e5f..35acd3f3f 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,6 +13,9 @@
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;
@@ -27,16 +30,47 @@ import java.util.Map;
public class MessageServiceController {
- private List<IMessageService> messageServiceList = null;
+ @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 boolean running = false;
public MessageServiceController(/*IRTObject parent*/){
// TODOTS: Who is parent of MessageServices and Controller?
// this.parent = parent;
- messageServiceList = new ArrayList<IMessageService>();
+ messageServiceList = new ArrayList<MessageService>();
}
- public void addMsgSvc(IMessageService msgSvc){
+ public void addMsgSvc(MessageService msgSvc){
// TODOTS: Who is parent of MessageServices ?
assert(msgSvc.getAddress().threadID == messageServiceList.size());
messageServiceList.add(msgSvc);
@@ -46,14 +80,14 @@ public class MessageServiceController {
return messageServiceList.size();
}
- public IMessageService getMsgSvc(int threadID){
+ public MessageService getMsgSvc(int threadID){
assert(threadID < messageServiceList.size());
return messageServiceList.get(threadID);
}
public void start() {
// start all message services
- for (IMessageService msgSvc : messageServiceList){
+ for (MessageService msgSvc : messageServiceList){
Thread thread = new Thread(msgSvc, msgSvc.getName());
msgSvc.setThread(thread);
thread.start();
@@ -96,7 +130,7 @@ public class MessageServiceController {
private void terminate() {
// terminate all message services
- for (IMessageService msgSvc : messageServiceList){
+ for (MessageService msgSvc : messageServiceList){
msgSvc.terminate();
// TODOTS: stop in order of priorities
}
@@ -107,7 +141,7 @@ public class MessageServiceController {
* ! not threadsafe !
*/
public void waitTerminate() {
- for (IMessageService msgSvc : messageServiceList) {
+ for (MessageService msgSvc : messageServiceList) {
try {
msgSvc.getThread().join(1000); // wait at most 1000ms
if (msgSvc.getThread().isAlive())
@@ -119,8 +153,67 @@ 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 5f2ffb87f..d6ee1c3a6 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,7 +9,6 @@
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
@@ -116,24 +115,4 @@ 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 9ed2410a0..3e5da5b32 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, IInterfaceItemOwner {
+public abstract class ActorClassBase extends EventReceiver implements IMessageReceiver {
protected static final int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later
@@ -117,7 +117,10 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
}
public void destroy() {
- super.destroy();
+ for (IRTObject child : getChildren()) {
+ if (child instanceof ActorClassBase)
+ ((ActorClassBase) child).destroy();
+ }
}
public abstract void executeInitTransition();
@@ -152,8 +155,4 @@ 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 f35b70c4a..d4a3e11cb 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,6 +15,7 @@ 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
@@ -29,7 +30,7 @@ public abstract class DataReceivePort extends DataPortBase {
protected DataReceivePort(IRTObject parent, String name, int localId) {
super(parent, name, localId);
- List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().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 189a441cd..1b5e69aad 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,6 +15,7 @@ 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
@@ -25,7 +26,7 @@ public class DataSendPort extends DataPortBase {
public DataSendPort(IRTObject parent, String name, int localId) {
super(parent, name, localId);
- List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().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
deleted file mode 100644
index 4c8260c26..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IInterfaceItemOwner.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index cd954102b..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/IOptionalActorFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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 0899f67bc..9fcac1819 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,5 +19,4 @@ 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 3bc1bda46..6bfdec6aa 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,11 +13,9 @@ 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.
@@ -27,25 +25,21 @@ import org.eclipse.etrice.runtime.java.modelbase.SystemMessage.Reason;
*/
public abstract class InterfaceItemBase extends AbstractMessageReceiver {
- private IReplicatedInterfaceItem replicator = null;
- protected IMessageReceiver ownMsgReceiver;
- protected IMessageReceiver peerMsgReceiver;
+ private IMessageReceiver ownMsgReceiver;
+ private IMessageReceiver peerMsgReceiver;
private int localId;
private int idx;
- protected Address peerAddress = null;
+ private Address peerAddress = null;
- public InterfaceItemBase (IInterfaceItemOwner owner, String name, int localId, int idx) {
- super(owner.getEventReceiver(), name);
+ public InterfaceItemBase (IEventReceiver actor, String name, int localId, int idx) {
+ super(actor, name);
this.localId = localId;
this.idx = idx;
- if (owner instanceof IReplicatedInterfaceItem)
- replicator = (IReplicatedInterfaceItem) owner;
-
- int thread = getParent().getThreadForPath(getParent().getInstancePath());
+ int thread = RTServices.getInstance().getMsgSvcCtrl().getThreadForPath(getParent().getInstancePath());
if (thread>=0) {
- IMessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
+ MessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
Address addr = msgSvc.getFreeAddress();
setAddress(addr);
@@ -58,7 +52,7 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
}
}
- List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
if (peerPaths!=null && !peerPaths.isEmpty()) {
IRTObject object = getObject(peerPaths.get(0));
InterfaceItemBase peer = null;
@@ -72,16 +66,6 @@ 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) {
@@ -92,16 +76,6 @@ 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;
@@ -130,15 +104,4 @@ 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
deleted file mode 100644
index dcae4782d..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBroker.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index b842a7e40..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/OptionalActorInterfaceBase.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 0007b34ca..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToPeers.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index a71fadd40..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PathToThread.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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 90e13b9a9..2c0997034 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,7 +9,6 @@
package org.eclipse.etrice.runtime.java.modelbase;
-
/**
* An abstract base class for port instances.
*
@@ -18,11 +17,11 @@ package org.eclipse.etrice.runtime.java.modelbase;
*/
public abstract class PortBase extends InterfaceItemBase {
- public PortBase (IInterfaceItemOwner actor, String name, int localId){
+ public PortBase (IEventReceiver actor, String name, int localId){
super(actor, name, localId, 0);
}
- public PortBase (IInterfaceItemOwner actor, String name, int localId, int idx){
+ public PortBase (IEventReceiver 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 574e4e022..e54ef6e27 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(IInterfaceItemOwner actor, int localId) {
+ public RTSystemPort(IEventReceiver 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(IInterfaceItemOwner actor, int localId) {
+ public RTSystemConjPort(IEventReceiver 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 c223915fb..9732d7a6c 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,33 +13,32 @@
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, IInterfaceItemOwner {
+public abstract class ReplicatedInterfaceItemBase extends RTObject implements IReplicatedInterfaceItem {
private int localId;
private ArrayList<InterfaceItemBase> items = new ArrayList<InterfaceItemBase>();
- private LinkedList<Integer> releasedIndices = new LinkedList<Integer>();
/**
- * @param owner
+ * @param parent
* @param name
* @param localId
*/
- protected ReplicatedInterfaceItemBase(IInterfaceItemOwner owner, String name, int localId) {
- super(owner, name);
+ protected ReplicatedInterfaceItemBase(IEventReceiver parent, String name, int localId) {
+ super(parent, name);
this.localId = localId;
- List<String> peerPaths = getParent().getPeersForPath(getInstancePath());
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
if (peerPaths!=null) {
for (String path : peerPaths) {
IRTObject object = getObject(path);
@@ -63,29 +62,14 @@ public abstract class ReplicatedInterfaceItemBase extends RTObject implements IR
*/
@Override
public InterfaceItemBase createSubInterfaceItem() {
- InterfaceItemBase item = createInterfaceItem(this, getName()+items.size(), localId, getFreeIndex());
+ InterfaceItemBase item = createInterfaceItem((IEventReceiver)getParent(), getName()+items.size(), localId, items.size());
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) {
- for (InterfaceItemBase item : items) {
- if (item.getIdx()==idx)
- return item;
- }
+ if (0<=idx && idx<items.size())
+ return items.get(idx);
return null;
}
@@ -98,10 +82,5 @@ public abstract class ReplicatedInterfaceItemBase extends RTObject implements IR
return localId;
}
- @Override
- public IEventReceiver getEventReceiver() {
- return (IEventReceiver) getParent();
- }
-
- protected abstract InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx);
+ protected abstract InterfaceItemBase createInterfaceItem(IEventReceiver 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
deleted file mode 100644
index 15a7e4591..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedInterfaceItemBroker.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 884688f96..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ReplicatedOptionalActorInterfaceBase.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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 deb7d4f5d..e511717ff 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,7 +12,6 @@
package org.eclipse.etrice.runtime.java.modelbase;
-
/**
* An abstract base class for instances of replicated ports.
*
@@ -26,7 +25,7 @@ public abstract class ReplicatedPortBase extends ReplicatedInterfaceItemBase {
* @param name
* @param localId
*/
- public ReplicatedPortBase(IInterfaceItemOwner parent, String name, int localId) {
+ public ReplicatedPortBase(IEventReceiver 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
deleted file mode 100644
index bb966300c..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ScalarOptionalActorInterfaceBase.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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 cd37a8dd3..3219c7fda 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,14 +8,11 @@
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;
@@ -27,7 +24,7 @@ import org.eclipse.etrice.runtime.java.modelbase.RTSystemProtocol.RTSystemConjPo
* @author Henrik Rentz-Reichert
*
*/
-public abstract class SubSystemClassBase extends RTObject implements IEventReceiver, IInterfaceItemOwner {
+public abstract class SubSystemClassBase extends RTObject implements IEventReceiver{
// variable service (is only instantiated if needed)
protected IVariableService variableService = null;
@@ -38,9 +35,6 @@ 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;
@@ -125,7 +119,7 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
System.out.println("=== done destroy RTServices");
}
- public IMessageService getMsgService(int idx) {
+ public MessageService getMsgService(int idx) {
return RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(idx);
}
@@ -169,83 +163,4 @@ 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
deleted file mode 100644
index fc0b0976a..000000000
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SystemMessage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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