# shashwat-kotiyal/water-hmi architecture

> Architecture diagram of the GitHub repository shashwat-kotiyal/water-hmi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shashwat-kotiyal/water-hmi
- Repository: https://github.com/shashwat-kotiyal/water-hmi

## Overview

#### Purpose and Delivery
Water-HMI is a Java web application for a water-distribution HMI: user login, telemetry indication/measurand views, tank visualization, alarms, reports, and session/cache pages. It is packaged as a deployable WAR for a servlet container.
- `dist/WATERv3.war`
- `build.xml`
- `WATER_DISTRUBUTION_SYS_DBv2.0.SQL`

#### Runtime Entry Surface
The application enters through JSP pages and servlet mappings declared by the web deployment descriptor. Login is the apparent initial authentication surface; operational pages provide the HMI dashboard and telemetry screens.
- `web/WEB-INF/web.xml`
- `web/login.jsp`
- `web/wdsys.jsp`
- `web/wtp.jsp`

#### Authentication and Session Boundary
Login is split into request handling, action orchestration, operation/business logic, and a login bean. Logout has its own servlet handler, while JSP pages expose session and cache-management functionality. Authentication/session state is the boundary controlling access to operational views.
- `src/java/com/servlet/LoginHandler.java`
- `src/java/com/action/LoginAction.java`
- `src/java/com/Operation/LoginOperation.java`
- `src/java/com/servlet/LogoutHandler.java`
- `web/SessionManager.jsp`

#### Telemetry Processing Pipeline
Telemetry is organized into two parallel flows: tele-indications and tele-measurands. Each flow has a servlet handler for incoming/request processing, an action layer, an operation layer, and a view servlet for rendering/query results. Shared telemetry state is represented by `TelBeans`.
- `src/java/com/servlet/TeleIndicationHandler.java`
- `src/java/com/action/TeleIndicationAction.java`
- `src/java/com/Operation/TeleOperation.java`
- `src/java/com/servlet/ViewTeleInd.java`
- `src/java/com/servlet/TeleMeasurandHandler.java`
- `src/java/com/bean/TelBeans.java`

#### HMI Presentation Layer
JSP pages are server-rendered operational screens, supported by client-side JavaScript and CSS. The HMI includes telemetry pages, an alarm screen, reporting, and a dynamic water/tank visualization endpoint.
- `web/Tele_indication.jsp`
- `web/Tele_measurand.jsp`
- `web/Alarm.jsp`
- `web/Report.jsp`
- `src/java/com/servlet/DynamicTank.java`
- `web/water.js`

#### Persistence and Infrastructure
The application uses a MySQL database, with schema/setup SQL supplied in the repository. Java database access is centralized through a connection component; the MySQL Connector/J driver is bundled in the built web artifact. Deployment metadata includes a GlassFish-specific descriptor, indicating GlassFish compatibility.
- `src/java/com/connection/MyConnection.java`
- `WATER_DISTRUBUTION_SYS_DBv2.0.SQL`
- `build/web/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar`
- `build/web/WEB-INF/glassfish-web.xml`

#### Build Artifact Boundary
Source lives under `src/java` and web assets under `web`; generated deployment output is represented under `build/web` and distributed as the WAR. Changes should target source directories rather than generated build output.
- `src/java/com`
- `web/WEB-INF/web.xml`
- `build/web/WEB-INF/web.xml`
- `dist/WATERv3.war`

Main entry points: [`web/wdsys.jsp`](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/wdsys.jsp) (Operational HMI pages), [`web/Tele_indication.jsp`](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/Tele_indication.jsp) (Telemetry views), [`src/java/com/Operation/TeleOperation.java`](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/Operation/TeleOperation.java) (Telemetry operation), [`web/WEB-INF/web.xml`](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/WEB-INF/web.xml) (Servlet mappings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["HMI Presentation"]
  node_entry["Servlet mappings<br/>deployment descriptor<br/>[web.xml]"]
  node_login_page["Login page<br/>JSP<br/>[login.jsp]"]
  node_hmi_pages["Operational HMI pages<br/>JSP screens<br/>[wdsys.jsp]"]
  node_telemetry_views["Telemetry views<br/>JSP screens"]
  node_tank["Dynamic tank view<br/>servlet<br/>[DynamicTank.java]"]
  node_client_js["HMI client script<br/>JavaScript<br/>[water.js]"]
end

subgraph group_auth["Authentication &amp; Session"]
  node_login_handler["Login handler<br/>servlet<br/>[LoginHandler.java]"]
  node_login_action["Login action<br/>[LoginAction.java]"]
  node_login_operation["Login operation<br/>business operation"]
  node_logout["Logout handler<br/>servlet<br/>[LogoutHandler.java]"]
  node_session["Session manager<br/>JSP<br/>[SessionManager.jsp]"]
end

subgraph group_telemetry["Telemetry Pipeline"]
  node_tele_indication["Tele-indication flow<br/>servlet → action"]
  node_tele_measurand["Tele-measurand flow<br/>servlet"]
  node_tele_operation["Telemetry operation<br/>business operation<br/>[TeleOperation.java]"]
  node_tele_state["Telemetry state<br/>bean<br/>[TelBeans.java]"]
  node_tele_view["Telemetry result view<br/>servlet<br/>[ViewTeleInd.java]"]
end

subgraph group_persistence["Persistence &amp; Deployment"]
  node_db_access["Database connection<br/>connection component<br/>[MyConnection.java]"]
  node_mysql[("Water distribution DB<br/>MySQL schema")]
  node_war["Deployable WAR<br/>WAR artifact<br/>[WATERv3.war]"]
  node_glassfish["GlassFish deployment<br/>container descriptor<br/>[glassfish-web.xml]"]
end

node_entry -->|"routes to"| node_login_page
node_entry -->|"routes to"| node_hmi_pages
node_login_page -->|"submits credentials"| node_login_handler
node_login_handler -->|"delegates"| node_login_action
node_login_action -->|"orchestrates"| node_login_operation
node_login_operation -->|"authenticates via"| node_db_access
node_logout -->|"clears access state"| node_session
node_session -.->|"controls access to"| node_hmi_pages
node_hmi_pages -->|"navigates to"| node_telemetry_views
node_telemetry_views -->|"requests indications"| node_tele_indication
node_telemetry_views -->|"requests measurands"| node_tele_measurand
node_tele_indication -->|"processes"| node_tele_operation
node_tele_measurand -->|"processes"| node_tele_operation
node_tele_operation -->|"updates"| node_tele_state
node_tele_operation -->|"reads and writes"| node_db_access
node_tele_state -->|"supplies results"| node_tele_view
node_tele_view -->|"renders"| node_telemetry_views
node_hmi_pages -->|"loads visualization"| node_tank
node_client_js -.->|"drives dynamic display"| node_tank
node_db_access -->|"connects to"| node_mysql
node_war -->|"deployed with"| node_glassfish
node_war -.->|"packages web application"| node_entry

click node_entry "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/WEB-INF/web.xml"
click node_login_page "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/login.jsp"
click node_hmi_pages "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/wdsys.jsp"
click node_telemetry_views "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/Tele_indication.jsp"
click node_tank "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/DynamicTank.java"
click node_client_js "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/water.js"
click node_login_handler "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/LoginHandler.java"
click node_login_action "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/action/LoginAction.java"
click node_login_operation "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/Operation/LoginOperation.java"
click node_logout "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/LogoutHandler.java"
click node_session "https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/SessionManager.jsp"
click node_tele_indication "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/TeleIndicationHandler.java"
click node_tele_measurand "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/TeleMeasurandHandler.java"
click node_tele_operation "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/Operation/TeleOperation.java"
click node_tele_state "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/bean/TelBeans.java"
click node_tele_view "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/ViewTeleInd.java"
click node_db_access "https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/connection/MyConnection.java"
click node_mysql "https://github.com/shashwat-kotiyal/water-hmi/blob/master/WATER_DISTRUBUTION_SYS_DBv2.0.SQL"
click node_war "https://github.com/shashwat-kotiyal/water-hmi/blob/master/dist/WATERv3.war"
click node_glassfish "https://github.com/shashwat-kotiyal/water-hmi/blob/master/build/web/WEB-INF/glassfish-web.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_login_page,node_hmi_pages,node_telemetry_views,node_tank,node_client_js toneBlue
class node_login_handler,node_login_action,node_login_operation,node_logout,node_session toneAmber
class node_tele_indication,node_tele_measurand,node_tele_operation,node_tele_state,node_tele_view toneMint
class node_db_access,node_mysql,node_war,node_glassfish toneRose
```

## Components

### HMI Presentation

Server-rendered operational screens and client behavior.

- [Servlet mappings](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/WEB-INF/web.xml): deployment descriptor · Declares JSP and servlet runtime entry points. · `web/WEB-INF/web.xml`
- [Login page](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/login.jsp): JSP · `web/login.jsp`
- [Operational HMI pages](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/wdsys.jsp): JSP screens · Dashboard, telemetry, alarm, and report views. · `web/wdsys.jsp`
- [Telemetry views](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/Tele_indication.jsp): JSP screens · `web/Tele_indication.jsp`
- [Dynamic tank view](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/DynamicTank.java): servlet · Provides dynamic water and tank visualization. · `src/java/com/servlet/DynamicTank.java`
- [HMI client script](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/water.js): JavaScript · `web/water.js`

### Authentication & Session

Login orchestration and access-state boundary.

- [Login handler](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/LoginHandler.java): servlet · `src/java/com/servlet/LoginHandler.java`
- [Login action](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/action/LoginAction.java): action · `src/java/com/action/LoginAction.java`
- [Login operation](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/Operation/LoginOperation.java): business operation · `src/java/com/Operation/LoginOperation.java`
- [Logout handler](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/LogoutHandler.java): servlet · `src/java/com/servlet/LogoutHandler.java`
- [Session manager](https://github.com/shashwat-kotiyal/water-hmi/blob/master/web/SessionManager.jsp): JSP · Exposes session and cache management. · `web/SessionManager.jsp`

### Telemetry Pipeline

Parallel indication and measurand processing.

- [Tele-indication flow](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/TeleIndicationHandler.java): servlet → action · Handles tele-indication requests. · `src/java/com/servlet/TeleIndicationHandler.java`
- [Tele-measurand flow](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/TeleMeasurandHandler.java): servlet · Handles tele-measurand requests. · `src/java/com/servlet/TeleMeasurandHandler.java`
- [Telemetry operation](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/Operation/TeleOperation.java): business operation · Shared telemetry processing layer. · `src/java/com/Operation/TeleOperation.java`
- [Telemetry state](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/bean/TelBeans.java): bean · Shared tele-indication and measurand state. · `src/java/com/bean/TelBeans.java`
- [Telemetry result view](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/servlet/ViewTeleInd.java): servlet · Renders or queries tele-indication results. · `src/java/com/servlet/ViewTeleInd.java`

### Persistence & Deployment

Database access, packaging, and servlet-container deployment.

- [Database connection](https://github.com/shashwat-kotiyal/water-hmi/blob/master/src/java/com/connection/MyConnection.java): connection component · Centralizes Java database access. · `src/java/com/connection/MyConnection.java`
- [Water distribution DB](https://github.com/shashwat-kotiyal/water-hmi/blob/master/WATER_DISTRUBUTION_SYS_DBv2.0.SQL): MySQL schema · Database schema and setup script. · `WATER_DISTRUBUTION_SYS_DBv2.0.SQL`
- [Deployable WAR](https://github.com/shashwat-kotiyal/water-hmi/blob/master/dist/WATERv3.war): WAR artifact · Deployable application package. · `dist/WATERv3.war`
- [GlassFish deployment](https://github.com/shashwat-kotiyal/water-hmi/blob/master/build/web/WEB-INF/glassfish-web.xml): container descriptor · GlassFish-specific deployment metadata. · `build/web/WEB-INF/glassfish-web.xml`

## Connections

- Servlet mappings → Login page: routes to
- Servlet mappings → Operational HMI pages: routes to
- Login page → Login handler: submits credentials
- Login handler → Login action: delegates
- Login action → Login operation: orchestrates
- Login operation → Database connection: authenticates via
- Logout handler → Session manager: clears access state
- Session manager → Operational HMI pages: controls access to
- Operational HMI pages → Telemetry views: navigates to
- Telemetry views → Tele-indication flow: requests indications
- Telemetry views → Tele-measurand flow: requests measurands
- Tele-indication flow → Telemetry operation: processes
- Tele-measurand flow → Telemetry operation: processes
- Telemetry operation → Telemetry state: updates
- Telemetry operation → Database connection: reads and writes
- Telemetry state → Telemetry result view: supplies results
- Telemetry result view → Telemetry views: renders
- Operational HMI pages → Dynamic tank view: loads visualization
- HMI client script → Dynamic tank view: drives dynamic display
- Database connection → Water distribution DB: connects to
- Deployable WAR → GlassFish deployment: deployed with
- Deployable WAR → Servlet mappings: packages web application
