Start/stop of background model updater

Hi,

I've a case when I want to start/stop a proxy server that will update my sandbox model.

The flow is as follows:
1) I put a "recorder" root concept instance
2) Somehow tell it to "start recording"
3) I setup browser's proxy to the recording URL
4) When I navigate in browser, "recorder" receives the requests and adds the relevant concept instances to the sandbox
5) Finally I somehow tell "recorder" to "stop recording"

The question is how to start/stop recording. As far as I can understand, MPS "run configuration" launches external process (like in Kajak "run script" example), so it is not that easy to communicate model updates back from that newly created process.

I am not sure if I would shoot myself in the foot by calling java APIs to start proxy controller right from "enabled:boolean" property change action.
In other words, it looks like I should be able to call random code from property setter and I should even be able to store "proxy recorder object" somewhere so I could turn it off when property switches from "enabled" to "disabled".

Is it ok to use property setters to launch such background activities?

Is there a way to use "run configuration" feature to launch in-process task? Using "run configuration" is nice since it provides clear feedback that the activity is running and it allows to observe execution logs.

Can I add "my own run configuration type" that will launch in-process activity so I can update MPS nodes directly without implementing some RPC?
2 comments
Hi!

Are you talking about the possibility to start webserver inside MPS process and process requests inside it. Requests like:
- add node
&nbsp- add node
- stop server

?
0
about the possibility to start webserver inside MPS process and process requests inside it


First of all, it would be good if I could start activities without creating new process.
When using webserver, you have to create some protocol, encode values, decode them back when receiving, etc.

I think (well, I might be wrong and it would be great if you could share your experience on that) that it would be good if MPS could execute something like Class.forName("my.app.Runner").getMethod("main").invoke(null). I do understand that it might result into "memory leaks" (if app.Runner does not release resources), I do understand that crash of app.Runner might result in MPS crash (e.g. out of memory).

I just do not want implementing RPC on top of HTTP.

In other words, current j.m.execution.configurations.ExecuteConfiguration_Function defines its return type as join(process| ProcessHandler). So it does not allow me to just "execute random java code" without hacks like "still execute random java code and return echo hello world so MPS' execute configuration is happy".

about the possibility to start webserver inside MPS process and process requests inside it


Is there an existing solution for that?
I see that mbeddr team is using their own com.mbeddr.mpsutil.httpserver plugin that allows them to start the server and handle the requests.
However, the API is very basic:
1) There is no OOB way of transferring MPS concept instances over the wire. It might be solvable by using mbedder's "serialize node to xml".
2) It is not clear how to distinguish multiple running IDE instances. For instance, mbeddr's server always uses 8080. It might be "just a ticket to mbeddr team"
0

Please sign in to leave a comment.