extending.md 1.8 KB
Newer Older
René Schöne's avatar
René Schöne committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Extending `ragconnect`

To add a new communication protocol `ABC`, the following locations have to be changed:

- 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`

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)