Create CommandRouter and CommandHandler to execute request #14

Closed
opened 2026-03-24 18:57:48 +01:00 by lars.winzer · 12 comments
lars.winzer commented 2026-03-24 18:57:48 +01:00 (Migrated from git.scicore.unibas.ch)

Task

Summary

The task of the CommandRouter is it to look up a matching CommandHandler based on the type of the Request it recieves.

The CommandHandler then executes the Request and creates an Response that is then send back to the client with the components created in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/work_items/8.


I thought I have already created the CommandHandler in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/merge_requests/32. For some reason I did implement the right thing but wrote the wrong name in the title and discription of the MR. Weird.

Anyways, the implementation of the (actual) CommandRouter and CommandHandler should be rather straight forward. It follows the principle used in the CommandParserDispatcher and CommandParser.

Context

CommandRouter, CommandHandler

Definition of Done

  • Implement CommandHandler interface and CommandRouter class
  • Create instance of CommandRouter at startup of server
  • Add router field to SessionManager and SessionReader
  • Make SessionReader call route-method on CommandRouter instance

Checklist

  • Linked to other issues or branches that must be completed first?
## Task ### Summary The task of the CommandRouter is it to look up a matching CommandHandler based on the type of the Request it recieves. The CommandHandler then executes the Request and creates an Response that is then send back to the client with the components created in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/work_items/8. --- I thought I have already created the `CommandHandler` in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/merge_requests/32. For some reason I did implement the right thing but wrote the wrong name in the title and discription of the MR. Weird. Anyways, the implementation of the (actual) `CommandRouter` and `CommandHandler` should be rather straight forward. It follows the principle used in the `CommandParserDispatcher` and `CommandParser`. ### Context CommandRouter, CommandHandler ### Definition of Done - [x] Implement `CommandHandler` interface and `CommandRouter` class - [x] Create instance of `CommandRouter` at startup of server - [x] Add router field to `SessionManager` and `SessionReader` - [x] Make SessionReader call route-method on `CommandRouter` instance ### Checklist - [x] Linked to other issues or branches that must be completed first?
lars.winzer commented 2026-03-24 18:58:01 +01:00 (Migrated from git.scicore.unibas.ch)

marked this task as related to #13

marked this task as related to #13
lars.winzer commented 2026-03-24 18:58:03 +01:00 (Migrated from git.scicore.unibas.ch)

marked the checklist item Linked to other issues or branches that must be completed first? as completed

marked the checklist item **Linked to other issues or branches that must be completed first?** as completed
lars.winzer commented 2026-03-26 16:46:47 +01:00 (Migrated from git.scicore.unibas.ch)

assigned to @lars.winzer

assigned to @lars.winzer
lars.winzer commented 2026-03-26 16:47:10 +01:00 (Migrated from git.scicore.unibas.ch)

created branch feat/14-commandrouter-and-commandhandler to address this issue

created branch [`feat/14-commandrouter-and-commandhandler`](/cs108-fs26/Gruppe-13/-/compare/main...feat%2F14-commandrouter-and-commandhandler) to address this issue
lars.winzer commented 2026-03-26 18:11:30 +01:00 (Migrated from git.scicore.unibas.ch)

marked the checklist item Implement CommandHandler interface and CommandRouter class as completed

marked the checklist item **Implement CommandHandler interface and CommandRouter class** as completed
lars.winzer commented 2026-03-26 18:11:31 +01:00 (Migrated from git.scicore.unibas.ch)

marked the checklist item Create instance of CommandRouter at startup of server as completed

marked the checklist item **Create instance of CommandRouter at startup of server** as completed
lars.winzer commented 2026-03-26 18:11:33 +01:00 (Migrated from git.scicore.unibas.ch)

marked the checklist item Add router field to SessionManager and SessionReader as completed

marked the checklist item **Add router field to SessionManager and SessionReader** as completed
lars.winzer commented 2026-03-26 18:11:43 +01:00 (Migrated from git.scicore.unibas.ch)

marked the checklist item Make SessionReader call route-method on CommandRouter instance as completed

marked the checklist item **Make SessionReader call route\-method on CommandRouter instance** as completed
lars.winzer commented 2026-03-26 18:14:34 +01:00 (Migrated from git.scicore.unibas.ch)

added 1h 25m of time spent at 2026-03-26 12:00:00 +0100

added 1h 25m of time spent at 2026-03-26 12:00:00 +0100
lars.winzer commented 2026-03-26 18:16:14 +01:00 (Migrated from git.scicore.unibas.ch)

One word: Generics in Java are weird.

And as soon as you run into type erasure ... lets leave it at that.

One word: Generics in Java are weird. And as soon as you run into type erasure ... lets leave it at that.
lars.winzer commented 2026-03-26 18:22:20 +01:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !50

mentioned in merge request !50
lars.winzer (Migrated from git.scicore.unibas.ch) closed this issue 2026-03-26 18:24:18 +01:00
lars.winzer commented 2026-03-26 18:24:19 +01:00 (Migrated from git.scicore.unibas.ch)

Specified #17 to be closed instead of this one in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/merge_requests/50

Specified #17 to be closed instead of this one in https://git.scicore.unibas.ch/cs108-fs26/Gruppe-13/-/merge_requests/50
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#14