Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/

### VS Code ###
.vscode/

### Runtime logs ###
logs/
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

## [0.0.1-SNAPSHOT] - 2026-05-21
### Added
- Spring Boot 3.5 REST API with Oracle XE backend
- Package-measurement sequence conversion endpoint (`GET /convert-measurements`)
- History CRUD endpoints (`GET/PUT/PATCH/DELETE /history`)
- JPA entity `HistoryRecord` with auto-generated sequence IDs
- DTO `ConversionResponse` for API responses
- Rolling log appender with 7-day retention (`logs/pkc-api.log`)
- Sequence conversion algorithm supporting:
- Count encoding via leading `z` (+26 each) + non-z terminator
- Value reading with `_` as zero-value character
- `z` value character contributing 27
- 8 test cases for conversion algorithm (all passing)
- Input validation with `@NotBlank` and `@Pattern(regexp = "[a-z_]+")`
- Global exception handler (`@RestControllerAdvice`) returning structured error JSON
- `ConversionResponse` DTO wrapping response in `{"packages": [...]}` format
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:17-jre-alpine
COPY target/oraclequantapi-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]
90 changes: 90 additions & 0 deletions README-DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Docker Setup for OracleQuant PKC API

Run the entire project with a single command using Docker.

## Prerequisites

- Docker Desktop installed and running
- Java 17 and Maven (only for the initial JAR build)

## How to Build and Run with Docker

```bash
# 1. Build the JAR file
mvn clean package -DskipTests

# 2. Build Docker images and start containers
docker-compose up --build
```

The application will be available at `http://localhost:8080`.

> **Note:** Oracle XE takes 2–3 minutes to start for the first time. The `pkc-api` service waits for the database health check to pass before starting.

## How to Stop

```bash
docker-compose down
```

To also remove the persisted database volume:

```bash
docker-compose down -v
```

## How to Test

All endpoints are available at `http://localhost:8080`.

### Convert Measurements

```bash
curl "http://localhost:8080/convert-measurements?input=abbcc"
```

Response:
```json
{"packages": [2, 6]}
```

### Get All History Records

```bash
curl "http://localhost:8080/history"
```

### Get Single History Record

```bash
curl "http://localhost:8080/history/1"
```

### Update History Record

```bash
curl -X PUT "http://localhost:8080/history/1" \
-H "Content-Type: application/json" \
-d '{"input":"aa","output":"[1]","sourceIpAddress":"10.0.0.1","timestamp":"2026-05-21T10:00:00"}'
```

### Partial Update History Record

```bash
curl -X PATCH "http://localhost:8080/history/1" \
-H "Content-Type: application/json" \
-d '{"input":"aa"}'
```

### Delete All History Records

```bash
curl -X DELETE "http://localhost:8080/history"
```

### View Container Logs

```bash
docker-compose logs -f pkc-api
docker-compose logs -f oracle-db
```
Loading