MopeSWTP-SS21 / MopeSWTP

MIT License
1 stars 0 forks source link

ServerConfig #35

Closed manuEbg closed 3 years ago

manuEbg commented 3 years ago

We need a Server Config Class/File should contain:

IlmarB commented 3 years ago

So I have started an attempt - referencing to the mope.cfg file of the mope-server I can easily create the needed server.cfg. But .. What I do not understand is the constructor of OMCAdapter-Class. So @CSchoel, what exactly is the purpose of the parameters in class MopeLSPServer

workspaceService.InitOMC( new OMCAdapter("/usr/bin/omc", "us", "mope_local" ));

and the definition in OMCAdapter

public OMCAdapter(String omcExecPath, String locale, String fileProviderSuffix){ omc = new ZeroMQClient(omcExecPath, locale, new ZMQPortFileProvider(fileProviderSuffix)); logger.info("OMCAdapter initialized"); }

IlmarB commented 3 years ago

I mean the first one is kinda self-explanatory, that is the path to the omc. But what about the other two?

CSchoel commented 3 years ago

I know as much about these classes as you, but by traversing a little through the code ("go to definition" is your friend :wink:) I found out the following:

manuEbg commented 3 years ago

@IlmarB maybe this is a little help:) https://github.com/MopeSWTP-SS21/LspConsole/commit/dd7a1c3161435c787ab49adc3e30df47f7c1176b

I got inspired by https://stackoverflow.com/questions/16273174/how-to-read-a-configuration-file-in-java

njustus commented 3 years ago

I guess this influences the language in which OMC reports errors.

Yes it does! If you do not provide the LANG variable on localized systems omc produces half-localized error messages. They are mostly unreadable.

If you don't need to support multiple projects at once, you don't need the parameter suffixProvider. In this scenario you need unique port files per project which is highly application specific. If the suffix isn't provided omc will always reuse the running instance, which in turn causes race condition nightmares!

I would suspect that most of the time you will not need those arguments at all. You can simply create a client with new ZeroMQClient(omExecPath) and it will use the LANG variable of the OS and the default suffix om_local.

Yes!

BTW: I would highly recommend using HOCON or YAML for your configuration files. Unless you are using Spring Boot for parsing property files into @Configuration classes its extremely difficult to use them consistently throughout your application.

Sidenote: Skimming through the mope and webmodelica thesis could improve your understanding of Modelica and OMC.

CSchoel commented 3 years ago

@IlmarB This issue has not received any updates in the last week. What is your status?

CSchoel commented 3 years ago

Currently, the server config is loaded from src/main/java/Server/server.config. This is bad practice, because:

IlmarB commented 3 years ago

nothing done for that yet

CSchoel commented 3 years ago

@IlmarB It has been another week without update. Can you please keep us posted about the status of this issue?

IlmarB commented 3 years ago

I actually forgot about this one 🙈 will do until friday

IlmarB commented 3 years ago

done - see branch feature/cfgAndShutDown