1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
package org.eclipse.etrice.examples.dynamicactors6;
import org.eclipse.etrice.runtime.java.config.IVariableService;
import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.IMessageService;
import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.MessageServiceController;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
import org.eclipse.etrice.runtime.java.modelbase.DataPortBase;
import org.eclipse.etrice.runtime.java.modelbase.OptionalActorInterfaceBase;
import org.eclipse.etrice.runtime.java.modelbase.IOptionalActorFactory;
import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBroker;
public class Node_nodeRef1_main extends SubSystemClassBase {
public static final int THREAD_PHYSICALTHREAD1 = 0;
public Node_nodeRef1_main(IRTObject parent, String name) {
super(parent, name);
}
@Override
public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data){
}
@Override
public void instantiateMessageServices() {
IMessageService msgService;
msgService = new MessageService(this, MessageService.ExecMode.BLOCKED, 0, THREAD_PHYSICALTHREAD1, "MessageService_PhysicalThread1" /*, thread_prio */);
RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(msgService);
}
@Override
public void instantiateActors() {
// thread mappings
addPathToThread("/LS/main/appl", THREAD_PHYSICALTHREAD1);
addPathToThread("/LS/main/appl/cont", THREAD_PHYSICALTHREAD1);
// sub actors
DebuggingService.getInstance().addMessageActorCreate(this, "appl");
new Appl(this, "appl");
// create service brokers in optional actor interfaces
{
OptionalActorInterfaceBase oai = (OptionalActorInterfaceBase) getObject("/LS/main/appl/cont/opt");
}
// wiring
// apply instance attribute configurations
}
@Override
public void init(){
DebuggingService.getInstance().addVisibleComment("begin sub system initialization");
super.init();
DebuggingService.getInstance().addVisibleComment("done sub system initialization");
}
@Override
public void stop(){
super.stop();
}
@Override
public void destroy() {
DebuggingService.getInstance().addVisibleComment("begin sub system destruction");
super.destroy();
DebuggingService.getInstance().addVisibleComment("done sub system destruction");
}
public IOptionalActorFactory getFactory(String optionalActorClass, String actorClass) {
if (optionalActorClass.equals("Optional1")) {
if ("Optional1".equals(actorClass)) {
return new Optional1Factory();
}
}
else if (optionalActorClass.equals("Optional2")) {
if ("Optional2".equals(actorClass)) {
return new Optional2Factory();
}
}
return null;
}
};
|