This is an old revision of the document!
Table of Contents
API GroIMP
The API in GroIMP is implemented as a new “GroIMP application” including a toolkit, workbenches, and a workbench manager.
Key components and their integration
Application
The APIApplication is the class that is executed during the boot process of GroIMP if the parameter “-a api” is used. It extends the class UIApplication and initialized the workbench manager and the toolkit before starting the API Server.
Workbench manager
The APIWorkbenchManager is required to resolve each workbench to its unique id to allow parallel interaction with projects.
Workbench
Each UIApplication in GroIMP has it's own workbench (GUI,CLI,API), this is necessary because even so they implement the same commands, the interpretation of the input is different. The generalized workflow of this is that the registry command is calling a static function in ProjectWorkbench, which resolves the current workbench form the context and forwards the (at this state quite vague) variable info to a function in the application specific workbench which interprets the content of info and calls the version of the function that takes proper defined parameters, which is often defined in ProjectWorkbench.
Toolkit
UIToolkits in GroIMP are used define how to display panels and other content. The APIToolkit is quite small since only the content of the XL console is returned to the client. In a future version this could be extended by creating a json based toolkit which would allow the access to all information of a workbench in a simpler way.
Server
The APIServer extends the abstract class https://javadoc.grogra.de/utilities/de/grogra/http/Server.html server. It simply takes any request that starts with /api and initializes a new APIRunner with the content.
Runner
The APIRunner implements Command which enables the class to be pushed to the job manager of the different workbenches. The runner resolves the workbenches and commands defined in the requests and is the core component of the call lifecylce.