anselm94/cmis-grpc-server-client

Merbin J Anselm

Software Architect
Software Engineer
Golang

A Documents Server & Workbench Client

A small implementation of a CMIS server, gRPC based Metadata Server and a gRPC based TUI Client allowing creating/deleting folders/documents in the server. All 3 components are written in Golang. The metadata is persisted in Postgres DB. The server-client interface is either through gRPC which is a Remote-Procedure-Call protocol or via CMIS through CMIS Workbench.

Overview

This repository contains a PoC project and is a proposal for Document-Management ecosystem. It has 3 components
A Metadata Server
A CMIS Server
A generic Client with TUI (Terminal User Interface)
The Metadata Server persists the metadata in Postgres DB and has gRPC based interface. The TUI Generic Client can directly interact with the Metadata Server via gRPC. For a standard CMIS Client (like CMIS Workbench) to interact with Metadata Server, a custom written small CMIS Server (not affliated with OpenCMIS library) with support for key CMIS actions for CMIS workbench to load and navigate through folder hierarchy.
Here the Metadata Server can support any Data-modelling, however, the CMIS Server handles the mapping of data from Metadata Server to CMIS models, and finally to the Browser (JSON) binding
Demo of live updating feature where 2 TUI clients creating folders/documents independantly, and the documents list updates almost instantaneously!
The domain-modelling at the Metadata Server follows that of CMIS but is minimal to show key features of Document Management systems like creating type definitions and property definitions, creating/deleting/fetching folders/documents with attached properties. However, the folders and documents can be attached to any custom type definitions and can have custom properties based on the property definitions, the type definitions have and is very flexible as CMIS.
The Metadata Server is written using Golang and utilizes the concurrency for high-performance and supports server to client push via GORM's DB callbacks (which is not a DB trigger) after every create/delete of objects in DB.
The Generic TUI Client is written in Golang too and has a peculiar Terminal UI (called tui). The client too has concurrency support while listening to server for updates, without blocking any threads. The UI runs in the main routine (similar to threads of Java world, but much simpler and robust, and sleeps while waiting for updates), while the server-listener runs in another go-routine.
Demo of CMIS JSON binding capability using 'CMIS Workbench' displaying Types, folders & documents with support for creating/deleting documents & folders, and the documents list in TUI client updates almost instantaneously!
The CMIS Server is a simple HTTP based RESTful server, parses the requests from any CMIS compliant client (like CMIS Workbench) and serves the JSON API in accordance with 'browser-binding' or 'JSON binding' specification of CMIS. All the metadata operations are handled in Metadata Server which exposes a gRPC binding, model of which is mapped to CMIS domain at the CMIS Server.

Key Features

Solves the Refresh issue, where the objects are updated in the server and the client (not applicable for CMIS clients though) has to refreshed explicitly to get the updated information
gRPC based client-server communication support full bidirectional streaming
Golang based implementation using concurrency for high-performance
Database Modelling is using GORM library, a versatile ORM library in Golang
Just 1 week to build from concept to implementation of all 3 components ;)

1. Metadata Server

Follows 3factor.app design pattern between Metadata Server & TUI Client (Create/Update/Delete actions are initiated by client -> server while Reads are pushed from server -> client)
CMIS based domain modelling (minimal containing Repository, Type Definition, Property Definition, Cmis Object, Cmis Property, Multifiling/Unfiling) (See dao.go)

2. CMIS Server

CMIS Server is a separate independant component, and can scale independently, which interacts with Metadata Server via gRPC
CMIS Server has basic set of features for a CMIS client like CMIS Workbench is operational. In order to bridge the gap between CMIS models and Metadata Server's models, certain data are enriched in the CMIS Server
CMIS Server has following CMIS services supported

3. TUI Client

Folders/Documents can be created, and support navigating in & out of folders. It maintains real-time connection with server, updating the folder list, in real time, as folders/documents are created in the server by other instance of connected clients.
Workbench client is inspired by CMIS Workbench. This is a terminal based UI (commonly termed as tui) and is built using tui-go. You can navigate the UI using ⬆️/⬇️ arrow keys and jump between the sections using ➡️ tab key and enter into a folder or trigger an action using ↩️ enter/return key.

How to Use

1) TUI Client

Use the ➡️ tab keys to jump between the sections in the following order
'Documents' area -> Folder Name -> Create Folder -> Document Name -> Create Document -> Delete Object
While in 'Documents' area, use ⬆️/⬇️ arrow keys to select a folder/document
While in 'Documents' area, press ↩️ enter/return key to navigate into/out of the folder
While in 'Actions' area, pressing ↩️ enter/return key after selecting any of the actions, triggers the action
Partner With Merbin J
View Services

More Projects by Merbin J