Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-01-09 18:22:37 +0000
committerHenrik Rentz-Reichert2012-01-09 18:22:37 +0000
commiteaa1db7254b917776689cfe565442d34512c5e23 (patch)
tree961495dd18d4e0b77a0fb0345902555233f5900f /runtime
parent5d1cd48b70f2969e3eab620ff24af10ea6d44037 (diff)
downloadorg.eclipse.etrice-eaa1db7254b917776689cfe565442d34512c5e23.tar.gz
org.eclipse.etrice-eaa1db7254b917776689cfe565442d34512c5e23.tar.xz
org.eclipse.etrice-eaa1db7254b917776689cfe565442d34512c5e23.zip
[modellib] re-factored LogService
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.modellib/models/ALogService.room22
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java11
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java8
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java78
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java37
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java83
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java27
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java27
8 files changed, 147 insertions, 146 deletions
diff --git a/runtime/org.eclipse.etrice.modellib/models/ALogService.room b/runtime/org.eclipse.etrice.modellib/models/ALogService.room
index 9b102b70d..3b1d70dbd 100644
--- a/runtime/org.eclipse.etrice.modellib/models/ALogService.room
+++ b/runtime/org.eclipse.etrice.modellib/models/ALogService.room
@@ -77,9 +77,11 @@ RoomModel room.basic.service.logging {
Message open(fileName: string)
Message setLogLevel(l: int32)
Message close()
+ Message log(data: LogData)
Message internalLog(data: InternalLogData)
}
- outgoing { } conjugate PortClass {
+ outgoing { }
+ conjugate PortClass {
usercode {
"public static final int LOG_LEVEL_LOW = 1;"
"public static final int LOG_LEVEL_MEDIUM = 2;"
@@ -91,13 +93,10 @@ RoomModel room.basic.service.logging {
"logLevel=l;"
"if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;"
}
- handle internalLog{
- "System.out.printf(\"\\ndonīt use the internalLog messages !\\n\");"
- }
- Operation log(logLevel:int32, userString:string){
+ handle log {
"long s;"
- "if (logLevel>this.logLevel){"
- "d.userString=userString;"
+ "if (data.logLevel>this.logLevel){"
+ "d.userString=data.userString;"
"s=System.currentTimeMillis();"
"d.timeStamp=Long.toString(s);"
"d.sender=getInstancePath();"
@@ -108,10 +107,15 @@ RoomModel room.basic.service.logging {
}
}
+ DataClass LogData {
+ Attribute logLevel: int32
+ Attribute userString: string
+ }
+
DataClass InternalLogData {
- Attribute timeStamp:string
- Attribute sender: string
Attribute userString: string
+ Attribute sender: string
+ Attribute timeStamp: string
}
} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java
index d79ea15fa..0264da386 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java
@@ -49,6 +49,7 @@ public class DSocketConfiguration {
// default constructor
public DSocketConfiguration() {
+ super();
// initialize attributes
serverName = "";
portNumber = 0;
@@ -57,6 +58,16 @@ public class DSocketConfiguration {
mode = 0;
}
+ // constructor using fields
+ public DSocketConfiguration(String serverName, int portNumber, int protocol, boolean checkCookie, int mode) {
+ super();
+ this.serverName = serverName;
+ this.portNumber = portNumber;
+ this.protocol = protocol;
+ this.checkCookie = checkCookie;
+ this.mode = mode;
+ }
+
// deep copy
public DSocketConfiguration deepCopy() {
DSocketConfiguration copy = new DSocketConfiguration();
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java
index 6aa26a518..271a460e3 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java
@@ -28,11 +28,19 @@ public class DSocketData {
// default constructor
public DSocketData() {
+ super();
// initialize attributes
size = 0;
data = "";
}
+ // constructor using fields
+ public DSocketData(int size, String data) {
+ super();
+ this.size = size;
+ this.data = data;
+ }
+
// deep copy
public DSocketData deepCopy() {
DSocketData copy = new DSocketData();
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
index 279e19fdb..c530e5914 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
@@ -74,8 +74,7 @@ public class PSocket {
// sent messages
- public void connected ()
- {
+ public void connected() {
if (messageStrings[ OUT_connected] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_connected]);
@@ -83,8 +82,7 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_connected));
}
- public void disconnected ()
- {
+ public void disconnected() {
if (messageStrings[ OUT_disconnected] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_disconnected]);
@@ -92,8 +90,7 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_disconnected));
}
- public void receivedData ()
- {
+ public void receivedData() {
if (messageStrings[ OUT_receivedData] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_receivedData]);
@@ -101,8 +98,7 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_receivedData));
}
- public void sentData ()
- {
+ public void sentData() {
if (messageStrings[ OUT_sentData] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_sentData]);
@@ -110,8 +106,7 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_sentData));
}
- public void error ()
- {
+ public void error() {
if (messageStrings[ OUT_error] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_error]);
@@ -149,39 +144,29 @@ public class PSocket {
}
// outgoing messages
- public void connected ()
- {
+ public void connected(){
for (int i=0; i<replication; ++i) {
- ports.get(i).connected()
- ;
+ ports.get(i).connected();
}
}
- public void disconnected ()
- {
+ public void disconnected(){
for (int i=0; i<replication; ++i) {
- ports.get(i).disconnected()
- ;
+ ports.get(i).disconnected();
}
}
- public void receivedData ()
- {
+ public void receivedData(){
for (int i=0; i<replication; ++i) {
- ports.get(i).receivedData()
- ;
+ ports.get(i).receivedData();
}
}
- public void sentData ()
- {
+ public void sentData(){
for (int i=0; i<replication; ++i) {
- ports.get(i).sentData()
- ;
+ ports.get(i).sentData();
}
}
- public void error ()
- {
+ public void error(){
for (int i=0; i<replication; ++i) {
- ports.get(i).error()
- ;
+ ports.get(i).error();
}
}
}
@@ -220,8 +205,7 @@ public class PSocket {
// sent messages
- public void connect (DSocketConfiguration config)
- {
+ public void connect(DSocketConfiguration config) {
if (messageStrings[ IN_connect] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_connect]);
@@ -229,8 +213,10 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_connect, config.deepCopy()));
}
- public void disconnect ()
- {
+ public void connect(String serverName, int portNumber, int protocol, boolean checkCookie, int mode) {
+ connect(new DSocketConfiguration(serverName, portNumber, protocol, checkCookie, mode));
+ }
+ public void disconnect() {
if (messageStrings[ IN_disconnect] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_disconnect]);
@@ -238,8 +224,7 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_disconnect));
}
- public void sendData (DSocketData data)
- {
+ public void sendData(DSocketData data) {
if (messageStrings[ IN_sendData] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_sendData]);
@@ -247,6 +232,9 @@ public class PSocket {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_sendData, data.deepCopy()));
}
+ public void sendData(int size, String data) {
+ sendData(new DSocketData(size, data));
+ }
}
// replicated port class
@@ -277,25 +265,19 @@ public class PSocket {
}
// incoming messages
- public void connect (DSocketConfiguration config)
- {
+ public void connect(DSocketConfiguration config){
for (int i=0; i<replication; ++i) {
- ports.get(i).connect( config)
- ;
+ ports.get(i).connect( config);
}
}
- public void disconnect ()
- {
+ public void disconnect(){
for (int i=0; i<replication; ++i) {
- ports.get(i).disconnect()
- ;
+ ports.get(i).disconnect();
}
}
- public void sendData (DSocketData data)
- {
+ public void sendData(DSocketData data){
for (int i=0; i<replication; ++i) {
- ports.get(i).sendData( data)
- ;
+ ports.get(i).sendData( data);
}
}
}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java
index 91aef4ab2..ad18afdf3 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java
@@ -7,16 +7,16 @@ public class InternalLogData {
//--------------------- attributes
- protected String timeStamp = "";
- protected String sender = "";
protected String userString = "";
+ protected String sender = "";
+ protected String timeStamp = "";
//--------------------- attribute setters and getters
- public void setTimeStamp (String timeStamp) {
- this.timeStamp = timeStamp;
+ public void setUserString (String userString) {
+ this.userString = userString;
}
- public String getTimeStamp () {
- return this.timeStamp;
+ public String getUserString () {
+ return this.userString;
}
public void setSender (String sender) {
this.sender = sender;
@@ -24,29 +24,38 @@ public class InternalLogData {
public String getSender () {
return this.sender;
}
- public void setUserString (String userString) {
- this.userString = userString;
+ public void setTimeStamp (String timeStamp) {
+ this.timeStamp = timeStamp;
}
- public String getUserString () {
- return this.userString;
+ public String getTimeStamp () {
+ return this.timeStamp;
}
//--------------------- operations
// default constructor
public InternalLogData() {
+ super();
// initialize attributes
- timeStamp = "";
- sender = "";
userString = "";
+ sender = "";
+ timeStamp = "";
+ }
+
+ // constructor using fields
+ public InternalLogData(String userString, String sender, String timeStamp) {
+ super();
+ this.userString = userString;
+ this.sender = sender;
+ this.timeStamp = timeStamp;
}
// deep copy
public InternalLogData deepCopy() {
InternalLogData copy = new InternalLogData();
- copy.timeStamp = timeStamp;
- copy.sender = sender;
copy.userString = userString;
+ copy.sender = sender;
+ copy.timeStamp = timeStamp;
return copy;
}
};
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
index 5dae83b59..cea42b67b 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
@@ -19,12 +19,13 @@ public class Log {
public static final int IN_open = 1;
public static final int IN_setLogLevel = 2;
public static final int IN_close = 3;
- public static final int IN_internalLog = 4;
+ public static final int IN_log = 4;
+ public static final int IN_internalLog = 5;
//error if msgID >= MSG_MAX
- public static final int MSG_MAX = 5;
+ public static final int MSG_MAX = 6;
- private static String messageStrings[] = {"MIN", "open","setLogLevel","close","internalLog","MAX"};
+ private static String messageStrings[] = {"MIN", "open","setLogLevel","close","log","internalLog","MAX"};
public String getMessageString(int msg_id) {
if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
@@ -143,21 +144,9 @@ public class Log {
//--------------------- attributes
//--------------------- operations
- public void log(int logLevel, String userString) {
- long s;
- if (logLevel>this.logLevel){
- d.userString=userString;
- s=System.currentTimeMillis();
- d.timeStamp=Long.toString(s);
- d.sender=getInstancePath();
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d));
- }
- }
// sent messages
- public void open (String fileName)
- {
+ public void open(String fileName) {
if (messageStrings[ IN_open] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
@@ -165,13 +154,11 @@ public class Log {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, fileName));
}
- public void setLogLevel (int l)
- {
+ public void setLogLevel(int l) {
logLevel=l;
if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;
}
- public void close ()
- {
+ public void close() {
if (messageStrings[ IN_close] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_close]);
@@ -179,9 +166,30 @@ public class Log {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_close));
}
- public void internalLog (InternalLogData data)
- {
- System.out.printf("\ndonīt use the internalLog messages !\n");
+ public void log(LogData data) {
+ long s;
+ if (data.logLevel>this.logLevel){
+ d.userString=data.userString;
+ s=System.currentTimeMillis();
+ d.timeStamp=Long.toString(s);
+ d.sender=getInstancePath();
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d));
+ }
+ }
+ public void log(int logLevel, String userString) {
+ log(new LogData(logLevel, userString));
+ }
+ public void internalLog(InternalLogData data) {
+ if (messageStrings[ IN_internalLog] != "timerTick"){
+ // TODOTS: model switch for activation
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalLog]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, data.deepCopy()));
+ }
+ public void internalLog(String userString, String sender, String timeStamp) {
+ internalLog(new InternalLogData(userString, sender, timeStamp));
}
}
@@ -213,32 +221,29 @@ public class Log {
}
// incoming messages
- public void open (String fileName)
- {
+ public void open(String fileName){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).open( fileName);
+ }
+ }
+ public void setLogLevel(int l){
for (int i=0; i<replication; ++i) {
- ports.get(i).open( fileName)
- ;
+ ports.get(i).setLogLevel( l);
}
}
- public void setLogLevel (int l)
- {
+ public void close(){
for (int i=0; i<replication; ++i) {
- ports.get(i).setLogLevel( l)
- ;
+ ports.get(i).close();
}
}
- public void close ()
- {
+ public void log(LogData data){
for (int i=0; i<replication; ++i) {
- ports.get(i).close()
- ;
+ ports.get(i).log( data);
}
}
- public void internalLog (InternalLogData data)
- {
+ public void internalLog(InternalLogData data){
for (int i=0; i<replication; ++i) {
- ports.get(i).internalLog( data)
- ;
+ ports.get(i).internalLog( data);
}
}
}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
index 42b4a0b83..1df8619e3 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
@@ -145,8 +145,7 @@ public class PTimeout {
}
// sent messages
- public void timeoutTick ()
- {
+ public void timeoutTick() {
if (messageStrings[ OUT_timeoutTick] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_timeoutTick]);
@@ -184,11 +183,9 @@ public class PTimeout {
}
// outgoing messages
- public void timeoutTick ()
- {
+ public void timeoutTick(){
for (int i=0; i<replication; ++i) {
- ports.get(i).timeoutTick()
- ;
+ ports.get(i).timeoutTick();
}
}
}
@@ -247,8 +244,7 @@ public class PTimeout {
//--------------------- operations
// sent messages
- public void Start (int time_ms)
- {
+ public void Start(int time_ms) {
//conjugate PortClass handle start
if (active)
return;
@@ -262,8 +258,7 @@ public class PTimeout {
new EventWithDataMessage(getPeerAddress(),
IN_Start, new TimeoutData(time_ms, ++currentId)));
}
- public void Kill ()
- {
+ public void Kill() {
//conjugate PortClass kill
DebuggingService.getInstance().addMessageAsyncOut(getAddress(),
getPeerAddress(), messageStrings[IN_Kill]);
@@ -304,18 +299,14 @@ public class PTimeout {
}
// incoming messages
- public void Start (int time_ms)
- {
+ public void Start(int time_ms){
for (int i=0; i<replication; ++i) {
- ports.get(i).Start( time_ms)
- ;
+ ports.get(i).Start( time_ms);
}
}
- public void Kill ()
- {
+ public void Kill(){
for (int i=0; i<replication; ++i) {
- ports.get(i).Kill()
- ;
+ ports.get(i).Kill();
}
}
}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
index 74a4d4d9c..426cafb1f 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
@@ -145,8 +145,7 @@ public class PTimer {
}
// sent messages
- public void timerTick ()
- {
+ public void timerTick() {
if (messageStrings[ OUT_timerTick] != "timerTick"){
// TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_timerTick]);
@@ -184,11 +183,9 @@ public class PTimer {
}
// outgoing messages
- public void timerTick ()
- {
+ public void timerTick(){
for (int i=0; i<replication; ++i) {
- ports.get(i).timerTick()
- ;
+ ports.get(i).timerTick();
}
}
}
@@ -246,8 +243,7 @@ public class PTimer {
//--------------------- operations
// sent messages
- public void Start (int time_ms)
- {
+ public void Start(int time_ms) {
//conjugate PortClass handle start
if (active)
return;
@@ -261,8 +257,7 @@ public class PTimer {
new EventWithDataMessage(getPeerAddress(),
IN_Start, new TimerData(time_ms, ++currentId)));
}
- public void Kill ()
- {
+ public void Kill() {
//conjugate PortClass kill
DebuggingService.getInstance().addMessageAsyncOut(getAddress(),
getPeerAddress(), messageStrings[IN_Kill]);
@@ -303,18 +298,14 @@ public class PTimer {
}
// incoming messages
- public void Start (int time_ms)
- {
+ public void Start(int time_ms){
for (int i=0; i<replication; ++i) {
- ports.get(i).Start( time_ms)
- ;
+ ports.get(i).Start( time_ms);
}
}
- public void Kill ()
- {
+ public void Kill(){
for (int i=0; i<replication; ++i) {
- ports.get(i).Kill()
- ;
+ ports.get(i).Kill();
}
}
}

Back to the top