MPS Language for modelling remote database data
Is there any way to design a language that maps model directly onto existing remote database?
I want be able to perform actions (intentions?) that would read/insert/update/delete remote data (using java classes to access database). This also means that I should be able to update model from remote database (again, metadata could be read using my java classes).
Is it possible now in MPS?
I want be able to perform actions (intentions?) that would read/insert/update/delete remote data (using java classes to access database). This also means that I should be able to update model from remote database (again, metadata could be read using my java classes).
Is it possible now in MPS?
Please sign in to leave a comment.
Could you explain your use case some more? I'm working on a custom persistence solution for another use case (proprietary, unfortunately, so I can't share it), so I might be able to make some suggestions if I know more about what exactly you are trying to do.
Here I mean an use case when system admin changes database structure via MPS, so we could store db structure in our language model on the one hand and have an actual database with the same structure on the another. To do the actual changes in database MPS is supposed to use our custom classes.
So in this case, I think, it is an addition to standard MPS storage, not a replacement.
There are a lot of ways I can think of to do that, depending on how immediate you want the update to be. An easy way would be either a custom action (added to one of the menus) or a make facet that calls your custom classes to update the database. If you need immediate synchronization, that would be a little more difficult - intentions would probably work there. Custom persistence would probably NOT be a good choice, since you probably only want to make the calls to update the database if the model is in a consistent state.
Are you using a traditional relational db or a document-oriented "nosql" db like MongoDB? I ask because if you are using a relational db, I could see real problems with doing the schema updates on the fly without updating the client code to reflect the changes, whereas for many of the non-relational dbs that are popular now that wouldn't always be an issue.
In current version of our software we use Oracle DB, but now I think of possibility to move to NoSQL, so, as you wrote, it still will be possible to have instant updates of db schema while editing a model.
Is it possible to import custom classes as a model and use them in actions/intentions?
And another question - is it possible to use smodel in custom classes?
Keep in mind that mps is a language workbench, and is meant to be used primarily at analysis and development time. The usual approach is to then generate the code for your application. I suppose it is possible to incorporate it into your runtime solution, using the IDEA platform as a base, but that is not a trivial task in most cases. For the record, I've never dug into the IDEA platform that way, so I don't know first hand what is involved. I have done a lot of Eclipse RCP development however, and that is IMO a better documented platform with a much bigger ecosystem, yet still presents quite a few challenges when developing a non-trivial app.
My personal opinion is to use each platform for what it's intended for, and you'll save yourself a lot of headaches. If you need to use the tools as part of your runtime solution, a better choice might be Eclipse EMF and Xtext. EMF is rather unique in how it blurs the line between the tool side and the runtime. The cost of this flexibility is that EMF is more limited, and there are things you can do with MPS that are either very difficult or just impossible with EMF.
That's just my observation, and if I'm wrong then anyone, feel free to correct me.