How to update mps sandbox/model over integrated mbeddr http server

First of all I want to mention my use case.

It looks like this:

reads xml from http server -> MPS sandbox -> updates xml on http server
reads xml from http server -> custom web app -> updates xml on http server

You see, I want to have a bidirectional data flow, so that the newest version of my mps thing lies on the http server and both MPS sandbox and web app should fetch data on startup.
My sandbox environment is considered for developers and the web app for none-developers.

My plan until now (big thanks to @Vladimir Sitnikov):
Add an action plugin which reads and saves the xml to http://localhost:8080/project-name/xml/file.xml
and updates my model accordingly. Secondly I have to create my web app and fetch the file from there.

My Code so far
request handler NodeOpenRequest { 
  applicationID: select 
  handled HTTP method: all 
  canHandleRequest(segments, request)->boolean { 
    segments.size == 3; 
  handleRequest(segments, request, response)->void { 
    string project = segments.get(0); 
    string modelId = segments.get(1); 
    string nodeId = segments.get(2); 
    MbeddrURLHelper.openLink(project, modelId, nodeId); 
    response.getWriter().println("It works!"); 

Anyway I don't get further with my plan. I don't know how to get the sandbox content and save it to a xml file yet.

Any help is appreciated!

Is there still a better solution or am I on the right track?
Thanks for any support!

Kind regards
Hi msch95,

the approach that would propably work best for you in the described use case is using the custom persistance of MPS . There is also an example project shipped with MPS called "xmlPersistence".
On the one hand you can write a m2m transformation in the generator aspect of your language from your own meta model to the jetbrains.mps.core.xml language but then you still would have to worry about getting transformations from xml -> MPS. Therefor I think custom persistance is the sensible way to go.

If custom persistance is not what you are looking for than you can always modify the models in MPS via the Open API in MPS.

Best regards,
Thanks for your answer Phillip!

I've successfully installed the xmlPersistence Plugin, but I don't know how to get further..
What isn't clear to me is, how I can persist my custom language filled with data in a solution to xml, so that I can read/write this data from my web app and MPS also reads and saves this data to this xml.
My custom language looks like this.. pretty simple

persons { 
  persons : 
    person Norris { 
      firstname : Chuck 
      car : 
        car Audi { 
          ps : 1000 
    person Norris { 
      firstname : Alice 
      car : 
        <no car> 

Best regards,

Please sign in to leave a comment.