-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"spellright.language": [ | ||
"English (American)" | ||
], | ||
"spellright.documentTypes": [ | ||
"latex", | ||
"plaintext", | ||
"markdown" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Client Architecture | ||
- [Client Architecture](#client-architecture) | ||
- [ConsoleClientLauncher](#consoleclientlauncher) | ||
- [ConsoleMenu](#consolemenu) | ||
- [MopeLSPClient](#mopelspclient) | ||
- [_UML_](#uml) | ||
|
||
## ConsoleClientLauncher | ||
The ConsoleClientLauncher is responsible for starting the MopeLSPClient. | ||
It connects a socket to the given port and host address, launches a instance of MopeLSPClient and connects it In- and Out-putStreams to the socket. | ||
Afterwards it presents the User a ConsoleMenu and keeps running until the User exited that Menu. | ||
## ConsoleMenu | ||
The ConsoleMenu is responsible for: | ||
- Guiding the User so he knows what to input | ||
- Reading the UserInput | ||
- Calling the requested _WrapperMethod_ in the MopeLSPClient | ||
- Printing the Answers from the Server | ||
## MopeLSPClient | ||
MopeLSPClient is an implementation of the LSP4J::LanguageClient. It implements RPC's like: | ||
- showMessage | ||
- publishDiagnostics | ||
|
||
For more Information about client side RPC's you can have a look into the official LSP-Specification. | ||
|
||
Additionally the MopeLSPClient contains _WrapperMethods_ to call RPC's on the server side. | ||
|
||
|
||
## _UML_ | ||
![MopeLSPClientUML](uml/png/Client.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Server Architecture | ||
- [Server Architecture](#server-architecture) | ||
- [ICompilerAdapter](#icompileradapter) | ||
- [OMCAdapter](#omcadapter) | ||
- [MopeServerLauncher](#mopeserverlauncher) | ||
- [MopeLSPServer](#mopelspserver) | ||
- [MopeWorkspaceService](#mopeworkspaceservice) | ||
- [MopeDocumentService](#mopedocumentservice) | ||
- [MopeModelicaService](#mopemodelicaservice) | ||
- [CompletionProvider](#completionprovider) | ||
- [DiagnosticHandler](#diagnostichandler) | ||
- [ModelicaDiagnostic](#modelicadiagnostic) | ||
- [_UML_](#uml) | ||
|
||
## ICompilerAdapter | ||
This Interface acts as a wrapper for a Modelica Compiler. | ||
It contains Methods like: | ||
- connect (launching a compiler instance and connecting to it) | ||
- exit (disconnecting from the compiler and exiting the process) | ||
- checkModel | ||
- getCompilerPath | ||
- sendExpression | ||
- and quite a few more | ||
### OMCAdapter | ||
|
||
This is the implementation of the ICompilerAdapter-Interface responsible for managing requests to the OpenModelicaCompiler(OMC). It uses the omc-java-api to interact with the OMC. | ||
|
||
It requires a valid path to the OMC-loaction. This path gets injected via the constructor. | ||
|
||
## MopeServerLauncher | ||
The MopeServerLauncher is responsible for starting the MopeLSPServer. | ||
To do so it | ||
- tries to read a configuration-file | ||
- opens a serverSocket | ||
- launches an instance of MopeLSPServer | ||
- adds clients that connect to the Socket | ||
|
||
Furthermore this class is responsible to free all the used resources after the Server is shut down. | ||
## MopeLSPServer | ||
The MopeLSPServer is an implementation of the LSP4J::LanguageServer. It contains Methods like: | ||
- initialize (initializes the Server, starts compilerProcess and exchanges capabilities with the Client) | ||
- shutdown (Shuts down the Server Instance and exits the compilerProcess) | ||
- get<_ServiceName_>Service (is used to call methods from the underlying service(JSON-RPC-Segment)) | ||
|
||
## MopeWorkspaceService | ||
MopeWorkspaceService is responsible for all workspace-related operations. For more information consider taking a look at the official LSP-Specification. | ||
|
||
To make the integration of Modelica-related commands on the client side as easy as possible the 'executeCommand' method is used to execute methods located in the MopeModelicaService. | ||
|
||
## MopeDocumentService | ||
The responsibilities of this Service are everything related to TextDocuments. | ||
For example: | ||
- Opening a document | ||
- Changing a document | ||
|
||
Also this time refer to the official LSP-Specification for more information. | ||
|
||
For now the MopeDocumentService only supports the `complete` operation. | ||
## MopeModelicaService | ||
The MopeModelicaService supplies Modelica specific functionality like semantic and syntactic analysis of models. | ||
The Service uses an implementation to of [ICompilerAdapter](#icompileradapter) to interact with a Modelica compiler. | ||
During some operations it uses the [ModelicaDiagnosticClass](#modelicadiagnostic) to generate Diagnostics and forward them to the [DiagnosticHandler](#diagnostichandler). | ||
|
||
## CompletionProvider | ||
The CompletionProvider is called from the MopeDocumentService to generate a List of LSP4J::CompletionItems which is forwarded to the Client calling the Complete-Request. | ||
To do so the CompletionProvider opens the file where the completion is requested and searches for a keyword on the given position(line,character). | ||
Depending on the type of the keyword, the CompletionProvider uses the ICompilerAdapter to search for the names of loaded Models. | ||
## DiagnosticHandler | ||
The DiagnosticHandler maintains multiple lists of Diagnostics organized in a hash map. One list for each file that contains Diagnostics. | ||
On every change in any of the Diagnostics the Handler triggers the `publishDiagnosticsToAllClients` method provided by MopeLSPServer. | ||
|
||
### ModelicaDiagnostic | ||
ModelicaDiagnostics extend the LSP4J::Diagnostic. It adds a String `URI` which indicates the file the Diagnostic is located in and is used by the DiagnosticHandler to add the Diagnostic to the correct list. | ||
Furthermore it provides static Methods to create Diagnostics based on the result returned from ICompilerAdapter Methods like `checkModel` or `loadModel`. | ||
|
||
## _UML_ | ||
![MopeLSPServerUML](uml/png/Server.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<diagram program="umletino" version="14.4.0-SNAPSHOT"><zoom_level>10</zoom_level><help_text><diagram program="umletino" version="14.4.0-SNAPSHOT"><zoom_level>10</zoom_level><element><id>Relation</id><coordinates><x>810</x><y>311</y><w>90</w><h>110</h></coordinates><panel_attributes>lt=&lt;. | ||
implements</panel_attributes><additional_attributes>10;10;10;90</additional_attributes></element></diagram><diagram program="umletino" version="14.4.0-SNAPSHOT"><zoom_level>10</zoom_level><element><id>UMLClass</id><coordinates><x>880</x><y>500</y><w>210</w><h>190</h></coordinates><panel_attributes>DiagnosticHandler | ||
-- | ||
</panel_attributes><additional_attributes></additional_attributes></element></diagram>Space for diagram notes</help_text><element><id>UMLClass</id><coordinates><x>140</x><y>1225</y><w>1110</w><h>230</h></coordinates><panel_attributes>EOF</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>510</x><y>430</y><w>420</w><h>30</h></coordinates><panel_attributes>MopeLSPClient | ||
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>290</x><y>290</y><w>240</w><h>170</h></coordinates><panel_attributes>lt=<<<- | ||
launches Client and tries | ||
to connect to MopeLSPServer | ||
on given host and port</panel_attributes><additional_attributes>220;150;50;150;50;10;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>90</x><y>240</y><w>210</w><h>170</h></coordinates><panel_attributes>ConsoleClientLauncher | ||
-- | ||
- socket: Socket | ||
- client: MopeLSPClient | ||
- executor: ExecutorService | ||
- host: String | ||
- port: int | ||
-- | ||
- launchClient() | ||
- stopClient() | ||
- main(args: String[]) | ||
...</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>600</x><y>230</y><w>290</w><h>150</h></coordinates><panel_attributes>/IModelicaLanguageClient/ | ||
-- | ||
*Methods* | ||
- checkModel(String modelName) | ||
- compilerVersion(); | ||
... | ||
-- | ||
Responsibilities | ||
- Provides "easy to call" Methods, | ||
which talk to the the ModelicaLanguageServer</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>860</x><y>341</y><w>90</w><h>110</h></coordinates><panel_attributes>lt=<. | ||
implements</panel_attributes><additional_attributes>10;10;10;90</additional_attributes></element><element><id>UMLClass</id><coordinates><x>600</x><y>40</y><w>290</w><h>150</h></coordinates><panel_attributes>/LSP4J::LanguageClient/ | ||
-- | ||
*Methods* | ||
- publishNotifications(diagnostics) | ||
- showMessage(messageParams) | ||
... | ||
-- | ||
Responsibilities | ||
- Provides (abstract) RPC-Methods, | ||
that can be called from a LSPServer</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>840</x><y>170</y><w>90</w><h>90</h></coordinates><panel_attributes>lt=<. | ||
implements</panel_attributes><additional_attributes>10;10;10;70</additional_attributes></element><element><id>UMLClass</id><coordinates><x>90</x><y>500</y><w>210</w><h>250</h></coordinates><panel_attributes>ConsoleMenu | ||
-- | ||
- sc : Scanner | ||
- client MopeLSPClient | ||
-- | ||
*Methods* | ||
- printMenu() | ||
- readUserInput() | ||
... | ||
-- | ||
Responsibilities | ||
The ConsoleMenu allows a user to | ||
call Methods from the LSPClient | ||
to talk to the Server. | ||
It helps with creating the necessary | ||
Input for the Methods and displays | ||
the answers from the Server</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>160</x><y>400</y><w>80</w><h>120</h></coordinates><panel_attributes>lt=<<<- | ||
launches</panel_attributes><additional_attributes>10;100;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>290</x><y>450</y><w>530</w><h>160</h></coordinates><panel_attributes>lt=<<<- | ||
calls Client-Methods to send RPC</panel_attributes><additional_attributes>330;10;330;140;10;140</additional_attributes></element><element><id>Relation</id><coordinates><x>240</x><y>400</y><w>150</w><h>120</h></coordinates><panel_attributes>lt=<<<- | ||
triggers Stop/Shutdown</panel_attributes><additional_attributes>10;10;10;100</additional_attributes></element></diagram> |
Oops, something went wrong.