Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
5559439
Create makefile.yml
iTerminate Oct 9, 2025
e758e9a
:tada: Add basic models that represent certain mqtt events/topics pub…
iTerminate Nov 10, 2025
8f651d9
:wastebasket: No need for github actions. Not ready yet.
iTerminate Nov 10, 2025
143913e
:sparkles: Add support for basic events such as add update delete.
iTerminate Nov 10, 2025
6f7e60e
:boom: Add a session utility call that fetches configured mqtt connec…
iTerminate Nov 10, 2025
27386c6
Standardize mqtt event to use CdbEnttiy that can be specified in clas…
iTerminate Nov 17, 2025
4acfb07
Add details for the log entry and log reply events.
iTerminate Nov 17, 2025
55de953
Add a hint for the framework to correctly resolve the mqtt connection…
iTerminate Nov 17, 2025
afadac1
Handle no notificaton for system logs.
iTerminate Nov 17, 2025
773f332
Allow a list of action events to be passed in for notification hints.…
iTerminate Nov 17, 2025
5bde930
Resolve syntax.
iTerminate Nov 17, 2025
0974626
Implement a new saveLog function that also gathers what has changed.
iTerminate Nov 17, 2025
0c54c1a
Utilize the new standardized save log function that logs changes.
iTerminate Nov 17, 2025
4a303bd
Add functionality for saving action events per entity.
iTerminate Nov 17, 2025
888af97
Add a log reply topic.
iTerminate Nov 17, 2025
ca1376a
:package: Add required dependencies to support the new mqtt functiona…
iTerminate Nov 17, 2025
bcffdff
:sparkles: add a script that downloads and build mqtt connector for p…
iTerminate Nov 17, 2025
5378c85
:boom: add scripts to create mqtt configuration and deploy connector …
iTerminate Nov 17, 2025
987de94
Disable MDB variables in configuration.
iTerminate Nov 19, 2025
a278f2f
:sprkles: Add functionality to include logbook information.
iTerminate Nov 19, 2025
3a8472b
:recycle: refactor the parent logbook info to log document info.
iTerminate Nov 19, 2025
db969cf
:sparkles: add support for log event textDiff.
iTerminate Nov 19, 2025
73ff6b0
:recycle: Add updated mqtt resource name.
iTerminate Nov 19, 2025
2deffdb
Add event timestamp functionality.
iTerminate Nov 20, 2025
18bd457
:sparkles: Add functioanlity to provide the username of who triggered…
iTerminate Nov 20, 2025
17c682f
Add loggo template for troubleshooting mqtt
iTerminate Nov 20, 2025
c2631b6
:boom: Split up update and add for log entry and log entry reply
iTerminate Nov 21, 2025
c16979e
:recycle: reafctor the detail entities within the log entry event class.
iTerminate Nov 24, 2025
57d3e3c
:construction: Add new topics to support log reaction add and delete.
iTerminate Nov 24, 2025
9c9f67d
:recylce: resolve camelcase
iTerminate Nov 24, 2025
0069848
Add a new event for log reaction event.
iTerminate Nov 24, 2025
d596362
:recycle: expose fetching of log document
iTerminate Nov 24, 2025
8215336
:sparkles: update the log reaction entity to support adding the log r…
iTerminate Nov 24, 2025
70c5a33
:sparkles: add new controller utility to handle log reactions and int…
iTerminate Nov 24, 2025
022b060
:sparkles: Add initial commit for a framework for handling mqtt events.
iTerminate Nov 25, 2025
129b7e1
update docs
iTerminate Nov 25, 2025
8ea71bb
Add more documentation for bely mqtt framework.
iTerminate Nov 25, 2025
064060b
Add a default topic pattern. Handlers don't need to override unless w…
iTerminate Nov 25, 2025
6300289
:see_no_evil: ignore conda build for mqtt-message-broker
iTerminate Nov 25, 2025
84c973f
add conda build/recipe script for the mqtt framework.
iTerminate Nov 25, 2025
8536260
Enforce paho-mqtt client newer than 2.0 since the syntax follows newe…
iTerminate Nov 25, 2025
cf8b49a
:see_no_evil: ignore dev config.
iTerminate Nov 25, 2025
4f11b02
do not use a topic pattern for this handler.
iTerminate Nov 25, 2025
e6ff018
apply global configuration for apprise mailto configurations. support…
iTerminate Nov 26, 2025
a69d67d
:sparkles: Add functioanlity to support shared global configuration.
iTerminate Nov 26, 2025
2233819
Store the bely URL from the global configuration for use later in thi…
iTerminate Nov 26, 2025
4c0da81
:recycle: Add a base class for log entry events since they share simi…
iTerminate Nov 26, 2025
86911af
Add text diff that comes out of the log entry events.
iTerminate Nov 26, 2025
c4148e4
:recycle: Add base class for reactions to simplify handling reaction …
iTerminate Nov 26, 2025
f441085
:sparkles: Add support for reactions notifications.
iTerminate Nov 26, 2025
894578b
:recycle: refactor code to simplify overlap in reaction handling.
iTerminate Nov 26, 2025
a8a7c52
:white_check_mark: Add a workflow tests for the new mqtt-message-brok…
iTerminate Nov 26, 2025
e8524da
:recycle: run linter
iTerminate Nov 26, 2025
3a19a46
Only run 3.11 for now.
iTerminate Nov 26, 2025
7814177
only run test for pull request
iTerminate Nov 26, 2025
5df4e4f
Clean up the tests. Should fail if any of the quality checks fail.
iTerminate Nov 26, 2025
5d1ed09
Resolve one of the issues by type-check
iTerminate Nov 26, 2025
4fd98a4
Perform code quality checks before running tests.
iTerminate Nov 26, 2025
a9ccd93
Resolve type-check issues.
iTerminate Dec 1, 2025
3bc43aa
Resolve type fixes that cause functional issues. Ignore checks that c…
iTerminate Dec 1, 2025
155cf2f
Require python 3.11 or newer.
iTerminate Dec 1, 2025
e1b5cab
lint and format.
iTerminate Dec 1, 2025
5a1af29
Add ability to display the reason of why the notification was sent.
iTerminate Dec 1, 2025
41ac38c
Add support for new replies added to owner document.
iTerminate Dec 1, 2025
8ea26bf
:sparkles: Add support for sending notification if another user updat…
iTerminate Dec 2, 2025
de0b48a
:recycle: refactor similar functionality for update and add events.
iTerminate Dec 2, 2025
ca5c555
Standardize configuration to yaml.
iTerminate Dec 2, 2025
71cdf27
Add plugin loading for directories or python packages/modules.
iTerminate Dec 2, 2025
95cbba3
:recycle: refactor the apprise notification handler to a python module.
iTerminate Dec 2, 2025
8f34779
:white_check_mark: Include the apprise smart notification package in …
iTerminate Dec 2, 2025
afc91fd
Resolve code quality issues.
iTerminate Dec 2, 2025
52ce842
Resolve the build issues.
iTerminate Dec 2, 2025
3a0b4ac
Remove the refactored handler.
iTerminate Dec 3, 2025
7ca7f0b
Update the systemd files to match the CLI and work for user level dep…
iTerminate Dec 3, 2025
c532481
Add integration tests for the apprise handler.
iTerminate Dec 5, 2025
f2fba76
Integrate the apprise handler tests into the makefile workflow.
iTerminate Dec 5, 2025
c49812c
Require py10 or greater to run the mqtt broker framework.
iTerminate Dec 5, 2025
5d0b044
Resolve code quality issues.
iTerminate Dec 5, 2025
15e1515
Make apprise an official requirement for the framewokrk.
iTerminate Dec 5, 2025
61f97bb
No need for redunant requirements file.
iTerminate Dec 5, 2025
9c74965
Add new topics for removal of log entries.
iTerminate Dec 17, 2025
b5b8f39
Standardize the various actions for better reuse of event class for l…
iTerminate Dec 17, 2025
0579b4b
Add functionality for delete log entry and standardize creation of ev…
iTerminate Dec 17, 2025
6cdb297
add table support of flexmark
caraxlr Dec 18, 2025
32eb800
Resolve dep import
iTerminate Dec 18, 2025
cb6df06
Merge branch 'master' into add-table-support
iTerminate Dec 18, 2025
a1957b4
Merge branch 'add-table-support' into mqtt-integration
iTerminate Dec 18, 2025
4f5a851
Reintroduce the dependency lost in resolving conflict
iTerminate Dec 18, 2025
100659b
Add support for delete of log entries and replies within the mqtt fra…
iTerminate Dec 22, 2025
4e9e47d
Resolve the init function with all appropriate models.
iTerminate Dec 22, 2025
ed83ff0
Update the apprise notification handler to handle the new delete events.
iTerminate Dec 22, 2025
dee863c
:recycle: refactor to standardize the log entry reply events.
iTerminate Dec 22, 2025
7c27bee
Refactor handler tests to a test directory.
iTerminate Dec 22, 2025
4a2a49b
Add new rule that can be applied to ensure that terminal commands run…
iTerminate Dec 22, 2025
dfb0103
add support for grouping emails into threads.
iTerminate Dec 22, 2025
26adc5c
Add tests for groupped emails into threads.
iTerminate Dec 22, 2025
48b1656
Add updated continue rules.
iTerminate Dec 22, 2025
7d1aa62
Only support mailto: prefix.
iTerminate Dec 22, 2025
8eceac8
Resolve code formatting issues.
iTerminate Dec 22, 2025
98c0f99
Resolve `make quality`
iTerminate Dec 22, 2025
704871b
Add apprise email wrapper to expose the headers when sending emails.
iTerminate Dec 23, 2025
8c2f267
All headers going into apprise need to be str.
iTerminate Dec 23, 2025
15a2479
add tests for the new header wrapper functionality.
iTerminate Dec 23, 2025
08f5994
Resolve test issue when running all the tests. Remove edge no headers…
iTerminate Dec 23, 2025
87be978
Add make quality-fix.
iTerminate Dec 23, 2025
6876917
Run make quality-fix
iTerminate Dec 23, 2025
de45d42
Add extra notes
iTerminate Dec 23, 2025
cd2275d
Add extra notes
iTerminate Dec 23, 2025
6c7245d
Resolve linter issues.
iTerminate Dec 23, 2025
c5d2b47
Remove APPRISE_AVAILABLE should be required.
iTerminate Dec 23, 2025
4d5e0d5
resolve make test-cov
iTerminate Dec 23, 2025
f68e465
Improve messaging. remove "your"
iTerminate Dec 23, 2025
7c72f6c
Add new functionality to format the timestamps based on the timezone …
iTerminate Dec 23, 2025
f57d01c
:recycle: refactor to not quire tzlocal dependency
iTerminate Dec 23, 2025
609ee45
Covert view entry notification text to hyperlink.
iTerminate Jan 6, 2026
0dd0082
make quality fix
iTerminate Jan 6, 2026
449f535
Resolve tests
iTerminate Jan 6, 2026
8a93e3c
:recycle: refactor te mqtt event to have a generic event and a entity…
iTerminate Jan 7, 2026
f3d7250
:recycle: finalize the refactor with a basic mqtt event.
iTerminate Jan 7, 2026
5a69890
Initial search event functionality.
iTerminate Jan 7, 2026
b1e76f5
add table support of flexmark
caraxlr Dec 18, 2025
4e423b7
update the deployment scripts
caraxlr Jan 30, 2026
c58437f
adjust table's css styles
caraxlr Jan 30, 2026
fb11ea5
add table example to markdown help
caraxlr Jan 30, 2026
1f1c2f8
Merge branch 'table-support' into mqtt-integration
iTerminate Feb 3, 2026
f386622
Revert the python 3 changes.
iTerminate Feb 3, 2026
446ea1a
revise the markdown example
caraxlr Feb 3, 2026
c8c7edf
Merge branch 'table-support' into mqtt-integration
iTerminate Feb 5, 2026
c30572a
Add new tables to support the new notfication configuration UI.
iTerminate Feb 16, 2026
7a3837f
Add db entties and facades for the new tables.
iTerminate Feb 16, 2026
7e9b9f9
:recycle: refactor user id to user info
iTerminate Feb 17, 2026
d97626d
:recycle: more refactoring of the variables with id in name.
iTerminate Feb 17, 2026
0771380
Add variables needed for handling the UI for adding notificaiton conf…
iTerminate Feb 17, 2026
2c11f7e
:sparkles: Add improved handling of errors. If the exception happens …
iTerminate Feb 17, 2026
547cffa
Add empty setting object to fulfill the reqiurement of creating a not…
iTerminate Feb 17, 2026
c42c935
Add notification configuration controllers and utility.
iTerminate Feb 17, 2026
6041477
Add view to add notification configurations per user.
iTerminate Feb 17, 2026
c1dc97d
Resolve destroy redirect to list.
iTerminate Feb 19, 2026
9e370d1
Add notification configurations to user settings page.
iTerminate Feb 19, 2026
2cb05a5
Add send test notification to the notification dialog.
iTerminate Feb 19, 2026
aa6c6f2
Add handing of the send test notification button to send it to the ha…
iTerminate Feb 19, 2026
2d2dbd6
:recycle: standardize sending of mqtt event since it is referenced fr…
iTerminate Feb 19, 2026
ec56f32
Add support for handling notification test event.
iTerminate Feb 19, 2026
692c0ee
Add a handler for sending test notification to apprise handler.
iTerminate Feb 19, 2026
25d5dc2
Add a new API for fetching notification configurations.
iTerminate Feb 19, 2026
68cef20
Match the signlar format for route names.
iTerminate Feb 19, 2026
ad98e21
format and add notification configuration api to factory.
iTerminate Feb 19, 2026
0f60b0a
Simplify the return structure of a notification configuration.
iTerminate Feb 19, 2026
317c987
Add details needed to load up the notitication handler.
iTerminate Feb 19, 2026
8ee5260
Use BelyAPIFactory as the API client.
iTerminate Feb 19, 2026
c26f9c1
Update interface.
iTerminate Feb 19, 2026
0558f52
Load the notification configuration from the API.
iTerminate Feb 20, 2026
3aa7b22
Resolve existing handler tests with recent changes.
iTerminate Feb 20, 2026
56f865c
Add a new test to verify that API endpoint parses data correctly.
iTerminate Feb 20, 2026
d9ec528
Resolve linter issues.
iTerminate Feb 20, 2026
748ad37
Fix quality issues.
iTerminate Feb 20, 2026
8f725f4
Update the api publish script for publishing BELY api to pypi.
iTerminate Feb 20, 2026
af099ab
Add the dep for beliy API to the project.
iTerminate Feb 20, 2026
836e1b7
Resolve more quality issues.
iTerminate Feb 20, 2026
b45da5b
Ignore type markers.
iTerminate Feb 20, 2026
483d757
Add handling of automtic reloading of the notification configuration.
iTerminate Feb 23, 2026
1b6240f
Add a notification configuration id for later quick lookup and matchi…
iTerminate Feb 23, 2026
f6097e7
Ensure that the api_url can be specified in the configuration file in…
iTerminate Feb 23, 2026
baa2b48
Add view and handling for unsubcribe permalink that can be provided w…
iTerminate Feb 23, 2026
7234022
Include unsubscribe link with the notifications that can be unsubscri…
iTerminate Feb 23, 2026
fbf4c10
Only allow one instance of the mqtt broker at a time.
iTerminate Feb 24, 2026
e9ef537
Clean up the unsubscribe flow.
iTerminate Feb 24, 2026
62c0298
Merge pull request #10 from AdvancedPhotonSource/mqtt-integration-ui
iTerminate Feb 24, 2026
3ae8742
Upgrade log4j.
iTerminate Feb 24, 2026
0773da2
Ensure that only the user with permission can edit the notifications.
iTerminate Feb 24, 2026
df330e1
Ensure that standard users get the notifications conrrectly expanded.
iTerminate Feb 24, 2026
b805b69
Shorten the URL if needed to have a clean UI.
iTerminate Feb 24, 2026
fcd1d63
Use the consistent div to display the action buttons seciton.
iTerminate Feb 25, 2026
d796cd1
Expose the desciptions of the various notification keys better.
iTerminate Feb 25, 2026
746d495
Add instructions text field for providers.
iTerminate Feb 27, 2026
d668d1f
Update default instructions.
iTerminate Feb 27, 2026
f8a69f0
Add a help dialog that shows instructions for the provider.
iTerminate Feb 27, 2026
6806277
Add a copy button to codeblocks in BELY.
iTerminate Feb 27, 2026
0d1ada5
Resolve copy button on the markdown help dialog.
iTerminate Feb 27, 2026
2405df3
:recycle: the provider instructions dialog is now in its own file.
iTerminate Feb 27, 2026
adaf9f0
Merge pull request #14 from AdvancedPhotonSource/notificationPoviderI…
iTerminate Feb 27, 2026
ae1c4c1
Merge pull request #16 from AdvancedPhotonSource/codeblock-copy-btn
iTerminate Feb 27, 2026
d49dea8
Standardize the search function for consistency between UI and API.
iTerminate Feb 27, 2026
85ea5c6
Add a stadardized way to search logbooks via API that matches the web…
iTerminate Feb 27, 2026
c8cc23d
Add updated search event specific to logbook/log entry search.
iTerminate Feb 27, 2026
18f8a06
Publish search event from API and UI.
iTerminate Feb 27, 2026
276753d
Capture the search event in the mqtt framework.
iTerminate Feb 27, 2026
5310ae1
remove unused import.
iTerminate Feb 27, 2026
6d539d0
Clean up the search results.
iTerminate Feb 27, 2026
f27409a
Ensure similar metadata is provided from the search results as on the…
iTerminate Feb 27, 2026
530afe0
Merge pull request #17 from AdvancedPhotonSource/search-improvement
iTerminate Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/test-mqtt-broker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test BELY MQTT Message Broker

on:
pull_request:
paths:
- 'tools/developer_tools/bely-mqtt-message-broker/**'
- '.github/workflows/test-mqtt-broker.yml'
workflow_dispatch:

jobs:
test:
name: Run MQTT Broker Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: tools/developer_tools/bely-mqtt-message-broker

strategy:
matrix:
python-version: ['3.11', '3.12']
# python-version: ['3.11']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install-dev

- name: Run code quality linter
run: |
make lint

- name: Run code quality type-check
run: |
make type-check

- name: Run tests with coverage
run: |
make test-cov

# - name: Upload coverage reports
# if: matrix.python-version == '3.11'
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: tools/developer_tools/bely-mqtt-message-broker/htmlcov/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode
.DS_Store
src/python/.loglogin
.loglogin

# Compiled files
*.pyc
Expand Down Expand Up @@ -56,3 +57,5 @@ docs/python/_build/
# Temporary testing csv files
tools/developer_tools/python-client/cdbCli/service/cli/Spreadsheets/
.env
tools/developer_tools/bely-mqtt-message-broker/conda-bld
tools/developer_tools/bely-mqtt-message-broker/dev-config
237 changes: 237 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

BELY (Best Electronic Logbook Yet) is a Java EE web application for electronic logbook management. It is deployed on Payara Server (GlassFish fork) and uses MySQL/MariaDB as its database. The project includes:

- **LogrPortal**: Main Java EE web application (JSF/PrimeFaces frontend + REST API)
- **Python web service**: Python-based web service components
- **MQTT integration**: Python framework for handling MQTT events and notifications
- **CLI utilities**: Command-line tools for searching and querying the system

## Build and Development Commands

### Environment Setup

Always source the environment setup script before running any commands:
```bash
source setup.sh
```

This sets up critical environment variables:
- `LOGR_ROOT_DIR`: Root directory of the repository
- `LOGR_SUPPORT_DIR`: Support software directory (Payara, Java, MySQL, etc.)
- `LOGR_INSTALL_DIR`: Installation directory
- `LOGR_DATA_DIR`: Data directory
- `PYTHONPATH`: Includes `src/python` and Python client paths

### Initial Setup

```bash
# Install support software (Java, Payara, etc.)
make support

# Install MySQL (if needed)
make support-mysql

# Install NetBeans IDE
make support-netbeans

# Create development configuration
make dev-config
```

### Database Management

```bash
# Create clean database with schema
make clean-db

# Create test database with test data
make test-db

# Backup database
make backup

# Development database variants
make clean-db-dev
make backup-dev
```

Database SQL files are located in `db/sql/`:
- `clean/`: Clean database schema initialization scripts
- `test/`: Test data initialization scripts
- `static/`: Static lookup data (e.g., notification providers)
- `updates/`: Database migration scripts (e.g., `updateTo2025.3.sql`)
- `create_logr_tables.sql`: Main table creation script
- `create_stored_procedures.sql`: Stored procedures
- `create_views.sql`: Database views

### Building and Deployment

```bash
# Build the web portal
cd src/java/LogrPortal
ant clean
ant dist

# Deploy to Payara (from project root)
make deploy-web-portal

# Deploy web service
make deploy-web-service

# Undeploy
make undeploy-web-portal
make undeploy-web-service

# Development deployment variants
make deploy-web-portal-dev
make deploy-web-service-dev
```

### Running Tests

```bash
# Run full test suite (backs up DB, deploys test DB, runs tests, restores DB)
make test

# Manual API tests
cd tools/developer_tools/python-client/
pytest test/api_test.py

# Test requirements
pip install -r tools/developer_tools/python-client/test/requirements.txt
```

### Python Web Service Development

```bash
# Start the Python web service
./sbin/cdbWebService.sh
```

Python code is in `src/python/cdb/`.

## Architecture

### Java Package Structure

All Java code is under `src/java/LogrPortal/src/java/gov/anl/aps/logr/`:

**portal** - Main web portal application
- `controllers/` - JSF managed beans for UI logic
- `model/db/entities/` - JPA entity classes (e.g., `Log`, `UserInfo`, `NotificationConfiguration`)
- `model/db/beans/` - EJB facades for database operations (stateless session beans)
- `view/` - View objects and JSF utilities
- `import_export/` - Import/export functionality
- `plugins/` - Plugin support system
- `utilities/` - General utility classes

**rest** - REST API
- `routes/` - JAX-RS resource classes (e.g., `LogbookRoute`, `SearchRoute`)
- `authentication/` - Authentication filters and utilities
- `entities/` - DTO classes for API responses
- `provider/` - JAX-RS providers

**common** - Shared utilities
- `mqtt/` - MQTT integration models and utilities
- `objects/` - Common data objects
- `utilities/` - Shared utility classes
- `search/` - Search functionality

**api** - API client interfaces

### Web Application Structure

Location: `src/java/LogrPortal/web/`

- `views/` - XHTML pages organized by entity type (e.g., `log/`, `userInfo/`, `notificationConfiguration/`)
- `templates/` - XHTML template files
- `resources/` - Static resources (CSS, JavaScript, images)
- `WEB-INF/` - Web application configuration

### Technology Stack

- **Framework**: Java EE 8 (JSF 2.3, EJB 3.2, JPA 2.2, JAX-RS 2.1)
- **UI**: PrimeFaces 11 + PrimeFaces Extensions, OmniFaces 3
- **App Server**: Payara 5.2022.5 (GlassFish fork)
- **Database**: MySQL/MariaDB (driver: mariadb-java-client-3.1.0.jar)
- **ORM**: EclipseLink (JPA implementation)
- **Build**: Apache Ant + NetBeans project
- **API Docs**: Swagger/OpenAPI 2.1.5
- **PDF Generation**: iText 5.5.13.1
- **Markdown**: Flexmark 0.64.8
- **Logging**: Log4j 2.17.0

### MQTT Integration

The MQTT notification framework is a pluggable Python system for handling MQTT events:
- Location: `tools/developer_tools/bely-mqtt-message-broker/`
- Features: Type-safe Pydantic models, topic matching with wildcards, notification handlers (email, Slack, Discord)
- See `tools/developer_tools/bely-mqtt-message-broker/README.md` for details

### Plugins System

BELY supports custom plugins for extending functionality:
- Templates: `tools/developer_tools/logr_plugins/pluginTemplates/`
- Deployment: `make deploy-cdb-plugin` or `make deploy-cdb-plugin-dev`

## Development Workflow

### NetBeans Setup

1. Open NetBeans: `netbeans &`
2. File > Open Project > Select `src/java/LogrPortal`
3. Resolve missing server: Right-click project > "Resolve Missing Server Problem"
4. Add Payara Server pointing to `$LOGR_SUPPORT_DIR/netbeans/payara`
5. Copy MariaDB driver to Payara:
```bash
cp src/java/LogrPortal/lib/mariadb-java-client-3.1.0.jar \
$LOGR_SUPPORT_DIR/netbeans/payara/glassfish/domains/domain1/lib/
```
6. Run project from NetBeans

### Adding New Entities

When adding new database entities (e.g., notification system):

1. Update `db/sql/create_logr_tables.sql` with new table definitions
2. Add static data SQL files to `db/sql/static/` if needed
3. Create JPA `@Entity` class in `portal/model/db/entities/`
4. Create `@Stateless` facade in `portal/model/db/beans/` (extends `AbstractFacade`)
5. Create JSF controller in `portal/controllers/` (extends appropriate base controller)
6. Create XHTML views in `web/views/<entity_name>/`
7. Update database with `make clean-db` or create migration in `db/sql/updates/`

### Database Migrations

Version updates go in `db/sql/updates/updateToYYYY.X.sql` (e.g., `updateTo2025.3.sql`)

## Key Patterns

- **Entity/Facade/Controller**: Standard Java EE pattern - JPA entities, EJB facades for CRUD, JSF controllers for UI
- **Named Queries**: Use JPA `@NamedQuery` annotations on entities for common queries
- **Lazy Loading**: JSF data tables use lazy loading models
- **Session Management**: Session-scoped JSF beans maintain user state
- **REST Authentication**: Token-based auth via `rest/authentication/`
- **MQTT Events**: Notification configurations trigger MQTT messages handled by Python framework

## Important Files

- `Makefile`: Top-level make targets for building, deploying, testing
- `setup.sh`: Environment variable setup (must be sourced)
- `sbin/`: Deployment and utility scripts
- `src/java/LogrPortal/build.xml`: Ant build file
- `src/java/LogrPortal/nbproject/project.properties`: NetBeans project configuration
- `db/sql/create_logr_tables.sql`: Main database schema

## Notes

- The project is also known as "ComponentDB" or "CDB" in some contexts
- Default database name: `logr` (development: `logr_dev`)
- Application URL after deployment: `https://<hostname>:8181/bely` or `https://<hostname>:8181/cdb`
- The main branch is `master` (not `main`)
- Always run database operations and deployments from the repository root after sourcing `setup.sh`
Loading