extending.md 1.83 KB
Newer Older
René Schöne's avatar
René Schöne committed
1
# Extending `RagConnect`
René Schöne's avatar
René Schöne committed
2

René Schöne's avatar
René Schöne committed
3
To add a new communication protocol, the following locations have to be changed (replace `ABC` and `abc` with the name of the protocol):
René Schöne's avatar
René Schöne committed
4

René Schöne's avatar
René Schöne committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Within `ragconnect.base/src/main/resources`:
- Add a new handler `ABCHandler`, if appropriate, similar to the existing handlers
  - Add a new template `abc.mustache` containing an aspect `ABC` initializing the handler (if any) similar to the existing protocols
  - In `ragconnect.mustache`: add `{{#usesABC}}{{> abc}}{{/usesABC}}` and `{{#usesABC}}{{abcHandlerField}}.close();{{/usesABC}}`, respectively if appropriate
- In `receiveDefinition.mustache` and `sendDefinition.mustache`: add a new case in the switch statement defining the logic to happen for both definitions. If the new protocol is close to a PUSH semantic, follow `mqtt`. If it is closer to PULL semantic, follow `rest`.

Within `ragconnect.base/src/main/jastadd`:
- In `backend/Configuration`: add a new static boolean flag `usesABC` to indicate whether the protocol is used
- In `backend/Generation`:
  - Add new attributes for type `MRagConnect` for handler-attribute and handler-field, if needed
  - Add attributes for newly introduced references in changed mustache templates, if any
- In `backend/MustacheNodesToYAML`:
  - Add key-value-pair for `usesABC` (and handler, if any)
  - Add key-value-pairs for newly introduced referemces in changed mustache templates, if any

In `ragconnect.base/src/main/java/org/jastadd/ragconnect/compiler/Compiler.java`:
- Add a new choice for `--protocols` similar to the existing ones
- Set the flag `usesABC` if the choice is given.
- Add code to add the handler to the list `handlers` if the choice is given, i.e., if `ASTNode.usesABC`
René Schöne's avatar
René Schöne committed
24
25

Furthermore, new test cases are appreciated. They can be added in the [ragconnect.rests repository](https://git-st.inf.tu-dresden.de/jastadd/ragconnect-tests)