Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c3aa3b1
Configured project dependencies and architecture structure
SAIFMOHSIN8 May 20, 2026
203c0ea
Added decoded number parser model
SAIFMOHSIN8 May 20, 2026
a91f593
Redesigned parser decoding method signature
SAIFMOHSIN8 May 20, 2026
14f52ba
Implemented decoded number model accessors
SAIFMOHSIN8 May 20, 2026
50799d2
Implemented basic standalone value decoding
SAIFMOHSIN8 May 20, 2026
a87f590
Implemented continuation mode decoding
SAIFMOHSIN8 May 20, 2026
59bea6a
Implemented package count decoding
SAIFMOHSIN8 May 21, 2026
63a7597
Added package accumulation variables
SAIFMOHSIN8 May 21, 2026
3b875c0
Created application version tracking file
SAIFMOHSIN8 May 21, 2026
7d798e4
Implemented package value accumulation
SAIFMOHSIN8 May 21, 2026
2c69aee
Implemented package result finalization
SAIFMOHSIN8 May 21, 2026
2d0a8fb
Finalized package result storage logic
SAIFMOHSIN8 May 21, 2026
dc7af43
Added parser standalone test harness
SAIFMOHSIN8 May 21, 2026
d30f74a
Validated parser engine functionality
SAIFMOHSIN8 May 21, 2026
27283a4
Updated application version history
SAIFMOHSIN8 May 21, 2026
5dee6b0
Created measurement service contract
SAIFMOHSIN8 May 21, 2026
ddd19b9
Implemented measurement service layer
SAIFMOHSIN8 May 21, 2026
64cfb88
Configured Spring service bean
SAIFMOHSIN8 May 21, 2026
a25926f
Implemented measurement REST controller
SAIFMOHSIN8 May 21, 2026
105099a
Disabled temporary datasource auto configuration
SAIFMOHSIN8 May 21, 2026
d255e04
Integrated parser engine with REST API
SAIFMOHSIN8 May 21, 2026
da30cb8
Created exception handling package
SAIFMOHSIN8 May 23, 2026
265fe4d
Implemented global API exception handling
SAIFMOHSIN8 May 23, 2026
9346813
Implemented service input validation
SAIFMOHSIN8 May 23, 2026
23973b7
Updated application version history
SAIFMOHSIN8 May 23, 2026
1621ae4
Added service logging infrastructure
SAIFMOHSIN8 May 23, 2026
4c182b8
Implemented service activity logging
SAIFMOHSIN8 May 23, 2026
c7e846b
Implemented service activity logging
SAIFMOHSIN8 May 23, 2026
dd02c6a
Configured rolling application logging
SAIFMOHSIN8 May 23, 2026
18f8ce8
Implemented production logging infrastructure
SAIFMOHSIN8 May 23, 2026
442397e
Created entity package
SAIFMOHSIN8 May 23, 2026
2164011
Created measurement persistence entity
SAIFMOHSIN8 May 23, 2026
b3e0a40
Created measurement persistence repository
SAIFMOHSIN8 May 23, 2026
1fb500e
Configured Oracle datasource integration
SAIFMOHSIN8 May 23, 2026
eaf3bdb
Updated application version history
SAIFMOHSIN8 May 23, 2026
b9dc701
Implemented Oracle database persistence workflow
SAIFMOHSIN8 May 23, 2026
1ee782c
Added measurement history service contract
SAIFMOHSIN8 May 23, 2026
d5a9489
Implemented measurement history retrieval service
SAIFMOHSIN8 May 23, 2026
9ca7967
Implemented measurement history REST endpoint
SAIFMOHSIN8 May 23, 2026
efd7c48
Implemented measurement history retrieval API
SAIFMOHSIN8 May 23, 2026
c0c24bd
Added README.md file
SAIFMOHSIN8 May 24, 2026
55af2bb
Added deployment and setup documentation
SAIFMOHSIN8 May 24, 2026
f9066ad
Completed final API validation and deployment testing
SAIFMOHSIN8 May 24, 2026
6942efa
Finalising Functional Requirements
SAIFMOHSIN8 May 25, 2026
4ed0249
Final production-ready evaluation release
SAIFMOHSIN8 May 25, 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
Binary file added .DS_Store
Binary file not shown.
444 changes: 383 additions & 61 deletions README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions logs/application.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
2026-05-25 11:14:12 [INFO] c.o.o.OraclequantapiApplicationTests - Starting OraclequantapiApplicationTests using Java 25.0.2 with PID 49186 (started by saif in /Users/saif/Desktop/measurement-api/oraclequantapi)
2026-05-25 11:14:12 [INFO] c.o.o.OraclequantapiApplicationTests - No active profile set, falling back to 1 default profile: "default"
2026-05-25 11:14:12 [INFO] o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2026-05-25 11:14:13 [INFO] o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 44 ms. Found 1 JPA repository interface.
2026-05-25 11:14:13 [INFO] o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
2026-05-25 11:14:13 [INFO] org.hibernate.Version - HHH000412: Hibernate ORM core version 6.6.49.Final
2026-05-25 11:14:13 [INFO] o.h.c.i.RegionFactoryInitiator - HHH000026: Second-level cache disabled
2026-05-25 11:14:13 [INFO] o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
2026-05-25 11:14:13 [INFO] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2026-05-25 11:14:14 [INFO] com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection oracle.jdbc.driver.T4CConnection@45796b2a
2026-05-25 11:14:14 [INFO] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2026-05-25 11:14:15 [INFO] o.hibernate.orm.connections.pooling - HHH10001005: Database info:
Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
Database driver: undefined/unknown
Database version: 21.3
Autocommit mode: undefined/unknown
Isolation level: undefined/unknown
Minimum pool size: undefined/unknown
Maximum pool size: undefined/unknown
2026-05-25 11:14:15 [INFO] o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2026-05-25 11:14:20 [INFO] o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
2026-05-25 11:14:21 [WARN] o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2026-05-25 11:14:21 [INFO] c.o.o.OraclequantapiApplicationTests - Started OraclequantapiApplicationTests in 9.811 seconds (process running for 10.569)
2026-05-25 11:14:22 [INFO] o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
2026-05-25 11:14:22 [INFO] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2026-05-25 11:14:23 [INFO] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
Binary file added logs/application.log.2026-05-23.0.gz
Binary file not shown.
Binary file added logs/application.log.2026-05-24.0.gz
Binary file not shown.
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

public class OraclequantapiApplication {

public static void main(String[] args) {
SpringApplication.run(OraclequantapiApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.oraclequantapi.oraclequantapi.controller;

import com.oraclequantapi.oraclequantapi.service.MeasurementService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.oraclequantapi.oraclequantapi.entity.MeasurementRecord;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.DeleteMapping;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

@RestController
public class MeasurementController {

private final MeasurementService measurementService;

public MeasurementController(
MeasurementService measurementService
) {
this.measurementService = measurementService;
}

@GetMapping("/convert-measurements")
public List<Integer> convertMeasurements(
@RequestParam String input,
HttpServletRequest request

) {

return measurementService.convertMeasurements(
input,
request.getRemoteAddr()
);
}

@GetMapping("/measurement-history")
public List<MeasurementRecord> getMeasurementHistory() {

return measurementService.getMeasurementHistory();

}

@GetMapping("/measurement-history/{id}")
public MeasurementRecord getMeasurementById(
@PathVariable Long id
) {
return measurementService.getMeasurementById(id);
}

@PutMapping("/measurement-history/{id}")
public MeasurementRecord updateMeasurementRecord(
@PathVariable Long id,
@RequestBody MeasurementRecord updatedRecord

) {
return measurementService.updateMeasurementRecord(
id,
updatedRecord
);
}

@DeleteMapping("/measurement-history/{id}")
public void deleteMeasurementRecord(
@PathVariable Long id
) {

measurementService.deleteMeasurementRecord(id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.oraclequantapi.oraclequantapi.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import java.time.LocalDateTime;

@Entity
public class MeasurementRecord {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private LocalDateTime timestamp;

private String sourceIpAddress;

private String input;

private String output;

public MeasurementRecord() {

}

public MeasurementRecord(
String input,
String output,
String sourceIpAddress

) {
this.input = input;
this.output = output;
this.sourceIpAddress = sourceIpAddress;
this.timestamp = LocalDateTime.now();
}

public Long getId() {
return id;
}

public LocalDateTime getTimestamp() {
return timestamp;
}

public String getSourceIpAddress() {
return sourceIpAddress;
}

public String getInput() {
return input;
}

public String getOutput() {
return output;
}

public void setInput(String input) {
this.input = input;
}

public void setOutput(String output) {
this.output = output;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.oraclequantapi.oraclequantapi.exception;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.util.Map;

@ControllerAdvice
public class GlobalExceptionHandler {

@ExceptionHandler(InvalidMeasurementInputException.class)
public ResponseEntity<Map<String, String>>
handleInvalidMeasurementInputException(
InvalidMeasurementInputException exception

) {

return ResponseEntity
.status(HttpStatus.BAD_REQUEST)
.body(
Map.of(
"error",
exception.getMessage()
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.oraclequantapi.oraclequantapi.exception;

public class InvalidMeasurementInputException extends RuntimeException {

public InvalidMeasurementInputException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.oraclequantapi.oraclequantapi.parser;

public class DecodedNumber {

private final int value;

private final int nextIndex;

public DecodedNumber(int value, int nextIndex) {
this.value = value;
this.nextIndex = nextIndex;
}

public int getValue() {
return value;
}

public int getNextIndex() {
return nextIndex;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.oraclequantapi.oraclequantapi.parser;

import com.oraclequantapi.oraclequantapi.exception.InvalidMeasurementInputException;

import java.util.ArrayList;
import java.util.List;

public class MeasurementParser {

public List<Integer> parseMeasurements(String input) {

List<Integer> results = new ArrayList<>();

int currentIndex = 0;

while (currentIndex < input.length()) {

DecodedNumber packageCountResult =
readEncodedNumber(input, currentIndex);

int packageCount = packageCountResult.getValue();

currentIndex = packageCountResult.getNextIndex();

int packageTotal = 0;
int valuesRead = 0;

while (valuesRead < packageCount
&& currentIndex < input.length()) {

DecodedNumber valueResult =
readEncodedNumber(input, currentIndex);

packageTotal += valueResult.getValue();

currentIndex = valueResult.getNextIndex();

valuesRead++;
}
results.add(packageTotal);
}
return results;
}

private DecodedNumber readEncodedNumber(
String input,
int currentIndex

) {

char currentCharacter = input.charAt(currentIndex);

if (!(currentCharacter == '_'
|| (currentCharacter >= 'a'
&& currentCharacter <= 'z'))) {

throw new InvalidMeasurementInputException(
"Invalid character in measurement input"
);
}

int value = 0;

if (currentCharacter == 'z') {

while (currentIndex < input.length()
&& input.charAt(currentIndex) == 'z') {

value += 26;
currentIndex++;

}

if (currentIndex < input.length()) {
char terminatingCharacter = input.charAt(currentIndex);

if (terminatingCharacter != '_') {
value += (terminatingCharacter - 'a') + 1;
}
currentIndex++;
}
}

else {
if (currentCharacter == '_') {
value = 0;

} else {
value = (currentCharacter - 'a') + 1;
}
currentIndex++;
}
return new DecodedNumber(value, currentIndex);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.oraclequantapi.oraclequantapi.repository;

import com.oraclequantapi.oraclequantapi.entity.MeasurementRecord;

import org.springframework.data.jpa.repository.JpaRepository;

public interface MeasurementRecordRepository

extends JpaRepository<MeasurementRecord, Long> {

}
Loading