diff options
author | Henrik Rentz-Reichert | 2013-03-27 15:35:08 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2013-03-27 15:35:08 +0000 |
commit | a2dad98eb24149014bf42ad213c5ba50afa92057 (patch) | |
tree | 89d85f543e924b09ca3a12f6bf13195271fa0a8c /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse | |
parent | e00142a716a028a66822193e8e5368621153e666 (diff) | |
download | org.eclipse.etrice-a2dad98eb24149014bf42ad213c5ba50afa92057.tar.gz org.eclipse.etrice-a2dad98eb24149014bf42ad213c5ba50afa92057.tar.xz org.eclipse.etrice-a2dad98eb24149014bf42ad213c5ba50afa92057.zip |
[runtime.java] bug 404457: create base classes for data driven send and receive ports
https://bugs.eclipse.org/bugs/show_bug.cgi?id=404457
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.java/src/org/eclipse')
3 files changed, 121 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataPortBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataPortBase.java new file mode 100644 index 000000000..2e4051c61 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataPortBase.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;
+
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+import org.eclipse.etrice.runtime.java.messaging.RTObject;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class DataPortBase extends RTObject {
+
+ private int localId;
+
+ /**
+ * @param parent
+ * @param name
+ */
+ protected DataPortBase(IRTObject parent, String name, int localId) {
+ super(parent, name);
+ }
+
+ public int getLocalId() {
+ return localId;
+ }
+
+}
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 new file mode 100644 index 000000000..630146387 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataReceivePort.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 java.util.List;
+
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+import org.eclipse.etrice.runtime.java.messaging.RTServices;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public abstract class DataReceivePort extends DataPortBase {
+
+ /**
+ * @param parent
+ * @param name
+ */
+ protected DataReceivePort(IRTObject parent, String name, int localId) {
+ super(parent, name, localId);
+
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ if (peerPaths!=null && !peerPaths.isEmpty()) {
+ IRTObject object = getObject(peerPaths.get(0));
+ connect((DataSendPort) object);
+ }
+ }
+
+ /**
+ * @param dataSendPort
+ */
+ abstract protected void connect(DataSendPort dataSendPort);
+
+}
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 new file mode 100644 index 000000000..6ae05b090 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/DataSendPort.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;
+
+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 DataSendPort extends DataPortBase {
+
+ public DataSendPort(IRTObject parent, String name, int localId) {
+ super(parent, name, localId);
+
+ List<String> peerPaths = RTServices.getInstance().getMsgSvcCtrl().getPeersForPath(getInstancePath());
+ if (peerPaths!=null) {
+ for (String peerPath : peerPaths) {
+ IRTObject object = getObject(peerPath);
+ if (object instanceof DataReceivePort)
+ ((DataReceivePort)object).connect(this);
+ }
+ }
+ }
+}
|