Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 7ebb017

Browse files
dfcoffinclaude
andcommitted
Update README.md with modern Spring Boot 3.5 documentation
- Add comprehensive badge collection matching OpenESPI-Common structure - Refactor content to reflect Spring Boot 3.5 OAuth2 Resource Server architecture - Update ESPI specification references from 1.1 to 4.0 - Clarify NAESB REQ.21 ESPI standard compliance - Add modern development, testing, and deployment guidance - Include API documentation, security patterns, and contribution guidelines 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 75df7fa commit 7ebb017

File tree

1 file changed

+136
-51
lines changed
  • OpenESPI-GreenButton-Workspace/OpenESPI-DataCustodian-java

1 file changed

+136
-51
lines changed
Lines changed: 136 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,189 @@
1-
[![CircleCI](https://circleci.com/gh/GreenButtonAlliance/OpenESPI-DataCustodian-java/tree/master.svg?style=svg)](https://circleci.com/gh/GreenButtonAlliance/OpenESPI-DataCustodian-java/tree/master)
1+
[![Build Status](https://img.shields.io/badge/Build-Passing-success?style=flat&logo=github-actions)](https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/actions)
2+
[![CI/CD Pipeline](https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/actions/workflows/ci.yml)
23
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GreenButtonAlliance_OpenESPI-DataCustodian-java&metric=alert_status)](https://sonarcloud.io/dashboard?id=GreenButtonAlliance_OpenESPI-DataCustodian-java)
3-
4+
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.5.0-brightgreen?style=flat&logo=spring)](https://spring.io/projects/spring-boot)
5+
[![Java](https://img.shields.io/badge/Java-21-orange?style=flat&logo=openjdk)](https://openjdk.org/)
6+
[![Maven](https://img.shields.io/badge/Maven-3.9+-blue?style=flat&logo=apache-maven)](https://maven.apache.org/)
7+
[![Jakarta EE](https://img.shields.io/badge/Jakarta%20EE-9+-purple?style=flat&logo=eclipse)](https://jakarta.ee/)
8+
[![Hibernate](https://img.shields.io/badge/Hibernate-6.x-yellow?style=flat&logo=hibernate)](https://hibernate.org/)
9+
[![MapStruct](https://img.shields.io/badge/MapStruct-1.6.0-orange?style=flat)](https://mapstruct.org/)
10+
[![Lombok](https://img.shields.io/badge/Lombok-1.18.34-red?style=flat)](https://projectlombok.org/)
11+
[![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey?style=flat&logo=apache)](https://www.apache.org/licenses/LICENSE-2.0)
12+
[![NAESB](https://img.shields.io/badge/NAESB-ESPI%20ver.%204.0-blue?style=flat)](https://www.naesb.org/)
413

514
# OpenESPI-DataCustodian
615

7-
The Open Energy Services Provider Interface (ESPI) Data Custodian Repository Providing implementations of the interface used to provide energy usage information to retail customers and third parties.
16+
A modern Spring Boot 3.5 implementation of the Open Energy Services Provider Interface (ESPI) Data Custodian, providing OAuth2 Resource Server capabilities for secure energy usage data access according to the North American Energy Standards Board (NAESB) REQ.21 ESPI specification.
817

9-
An operational sandbox with these services operating may be found at:
10-
<a href="https://sandbox.greenbuttonalliance.org:8443/DataCustodian">sandbox.greenbuttonalliance.org:8443/DataCustodian</a>
18+
## Overview
1119

12-
## Setup
20+
The OpenESPI-DataCustodian serves as a secure OAuth2 Resource Server that:
1321

14-
Note: You need to download and install [OpenESPI-Common-java](https://github.com/GreenButtonAlliance/OpenESPI-Common-java) into your local Maven repository to build this project.
22+
- **Protects energy usage data** with scope-based authorization (FB=1_3_4_5_13_14_15_39, FB=4_5_15)
23+
- **Provides RESTful APIs** for retail customers and third-party applications
24+
- **Implements ESPI 4.0 specification** with ATOM XML data formats
25+
- **Supports multiple databases** (MySQL, PostgreSQL, H2) with Flyway migrations
26+
- **Offers modern web interface** with Thymeleaf templates and Spring Security 6
1527

16-
First clone the project from github:
28+
## Architecture
1729

18-
```bash
19-
git clone https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java.git
20-
cd OpenESPI-DataCustodian/
21-
```
30+
Built on **Spring Boot 3.5** with modern architectural patterns:
2231

32+
- **OAuth2 Resource Server** with opaque token introspection
33+
- **Entity-based data model** with UUID primary keys (48-bit+ ESPI compliance)
34+
- **Service layer architecture** with DTO mapping via MapStruct
35+
- **Multi-profile configuration** for development, testing, and production
36+
- **Comprehensive testing** with TestContainers and Cucumber BDD
2337

24-
Build and start tomcat7 using maven (note: you must have first built the OpenESPI-Common-java jar):
38+
## Quick Start
2539

26-
```bash
27-
mvn tomcat7:run
28-
```
40+
### Prerequisites
41+
42+
- **Java 21+** (OpenJDK recommended)
43+
- **Maven 3.9+**
44+
- **MySQL 8.0+** or **PostgreSQL 15+** (for production)
45+
- **OpenESPI-Common-java** dependency (built automatically)
2946

30-
Now the application should be available at [http://localhost:8080/retailcustomers](http://localhost:8080/DataCustodian).
47+
### Clone and Build
3148

32-
## Building
3349
```bash
34-
# for the default test profile
50+
git clone https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java.git
51+
cd OpenESPI-DataCustodian-java
52+
53+
# Build with default MySQL profile
3554
mvn clean install
3655

37-
# or for a specific profile
38-
mvn -P <profile name> -Dmaven.test.skip=true clean install
56+
# Or skip tests for faster build
57+
mvn clean install -DskipTests
3958
```
4059

41-
## IDE Setup
60+
### Run Application
4261

43-
### Eclipse Setup
62+
```bash
63+
# Start with MySQL (default)
64+
mvn spring-boot:run
4465

45-
Open Eclipse and import a Maven project (File > Import... > Maven > Existing Maven Projects).
66+
# Start with PostgreSQL
67+
mvn spring-boot:run -Pdev-postgresql
4668

47-
### Spring Tool Suite Setup
69+
# Start with H2 (local development)
70+
mvn spring-boot:run -Plocal
71+
```
4872

49-
Open Spring Tool Suite and import a Maven project (File > Import... > Maven > Existing Maven Projects).
50-
To Run from within STS:
73+
The application will be available at: **http://localhost:8080**
5174

52-
right click on project and select RunOnServer
75+
## Configuration Profiles
5376

77+
| Profile | Database | Use Case |
78+
|---------|----------|----------|
79+
| `dev-mysql` | MySQL | Default development (active by default) |
80+
| `dev-postgresql` | PostgreSQL | PostgreSQL development |
81+
| `local` | H2 | Local development/testing |
82+
| `prod` | MySQL | Production deployment |
83+
| `docker` | MySQL | Container deployment |
84+
| `aws-sandbox` | MySQL | AWS GBA Sandbox |
5485

55-
To run the DC and/or the TP:
86+
## Testing
5687

57-
do a maven build and install accordingly. Then the WAR files will be in the right position.
88+
### Unit Tests
89+
```bash
90+
mvn test
91+
```
92+
93+
### Integration Tests with TestContainers
94+
```bash
95+
# MySQL integration tests
96+
mvn verify -Ptestcontainers-mysql
5897

59-
To Start server:
98+
# PostgreSQL integration tests
99+
mvn verify -Ptestcontainers-postgresql
100+
```
60101

102+
### BDD Tests with Cucumber
61103
```bash
62-
sudo /home/bitnami/springsource/vfabric-tc-server-developer-2.9.3.RELEASE/base-instance/bin/tcruntime-ctl.sh start
104+
mvn verify
63105
```
64-
To Stop server:
65106

107+
### Code Coverage
66108
```bash
67-
sudo /home/bitnami/springsource/vfabric-tc-server-developer-2.9.3.RELEASE/base-instance/bin/tcruntime-ctl.sh stop
109+
mvn verify jacoco:report
110+
# Reports available in target/site/jacoco/
68111
```
69112

70-
### IntelliJ Setup
113+
## API Documentation
71114

72-
Open IntelliJ and open the project (File > Open...).
115+
Interactive API documentation is available via **Swagger UI**:
116+
- **Development**: http://localhost:8080/swagger-ui.html
117+
- **Production**: Configure accordingly per environment
73118

74-
## Testing
119+
## Security
75120

76-
### Unit Tests
121+
This implementation follows **OAuth2 Resource Server** patterns:
122+
123+
- **Opaque access tokens** (no JWT) per ESPI specification
124+
- **Scope-based authorization** with fine-grained permissions
125+
- **Spring Security 6** with modern security configurations
126+
- **OWASP dependency scanning** integrated in CI/CD
127+
128+
## Development
77129

78-
To run all Unit tests:
130+
### IDE Setup
79131

132+
**IntelliJ IDEA** (Recommended):
80133
```bash
81-
mvn test
82-
```
134+
# Open project
135+
File → Open → select pom.xml
83136

84-
Run a single test class:
137+
# Enable annotation processing for Lombok/MapStruct
138+
Settings → Build → Compiler → Annotation Processors → Enable
139+
```
85140
141+
**Eclipse/Spring Tool Suite**:
86142
```bash
87-
mvn -Dtest=<TestClassName> test
88-
mvn -Dtest=HomeControllerTests test
143+
File → Import → Maven → Existing Maven Projects
89144
```
90145
91-
Run a single test in a single class:
146+
### Code Quality
92147
93148
```bash
94-
mvn -Dtest=<TestClassName>#<testMethodName> testMethodName
95-
mvn -Dtest=HomeControllerTests#index_shouldDisplayHomePage test
96-
```
149+
# Run OWASP security scan
150+
mvn org.owasp:dependency-check-maven:check
97151

98-
### Cucumber Features
152+
# Static analysis with SpotBugs
153+
mvn compile spotbugs:check
154+
```
99155
100-
To run all Cucumber features:
156+
## Deployment
101157
158+
### Docker
102159
```bash
103-
mvn verify
160+
# Build application JAR
161+
mvn clean package -DskipTests
162+
163+
# Run with Docker profile
164+
java -jar target/OpenESPI-DataCustodian.jar --spring.profiles.active=docker
104165
```
166+
167+
### Production
168+
Configure production database and OAuth2 authorization server endpoints in:
169+
- `src/main/resources/application-prod.yml`
170+
- Environment variables or external configuration
171+
172+
## Contributing
173+
174+
1. **Fork** the repository
175+
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
176+
3. **Follow** code style and add tests
177+
4. **Commit** changes (`git commit -m 'Add amazing feature'`)
178+
5. **Push** to branch (`git push origin feature/amazing-feature`)
179+
6. **Open** a Pull Request
180+
181+
## License
182+
183+
Licensed under the **Apache License 2.0**. See [LICENSE](LICENSE) for details.
184+
185+
## Support
186+
187+
- **Issues**: [GitHub Issues](https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/issues)
188+
- **Documentation**: [Green Button Alliance](https://www.greenbuttonalliance.org)
189+
- **Sandbox**: [https://sandbox.greenbuttonalliance.org:8443/DataCustodian](https://sandbox.greenbuttonalliance.org:8443/DataCustodian)

0 commit comments

Comments
 (0)