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
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CHANGELOG

## version [1.0.0] - 2026-05-24

### Added
- Integrated Oracle XE Pluggable Database (`XEPDB1`) via JDBC data source connections.
- Added explicit mapping layer configurations for `SEQUENCE_HISTORY` transaction records.
- Configured production SQL formatter property engines (`hibernate.format_sql`).

### Fixed
- Fixed critical `SchemaManagementException` initialization crash by routing the database URL context away from the root container and straight to the active pluggable container.

## version [0.2.0] - 2026-05-24
### Added
- Restored original entity schema structural bindings on the application core workspace module.
- Re-activated constructor-based dependency injections for the Spring Data JPA layer in `SequenceService`.
- Restored live business logic trace logging engines targeting native persistent system tables.

### Changed
- Re-enabled Spring Boot's global database and repository autoconfiguration layers (`DataSourceAutoConfiguration`, `HibernateJpaAutoConfiguration`).

## version [0.1.1] - 2026-05-24
### Fixed
- Fixed runtime class initialization crashes (`Cannot load driver class: oracle.jdbc.OracleDriver`) by adding missing `ojdbc11` runtime library engines to the project build system.
- Fixed broken code compilation blocks by pulling down correct `spring-boot-starter-data-jpa` dependencies via Maven synchronization passes.

## version [0.1.0] - 2026-05-24
### Added
- Implemented temporary pure-logic isolation testing parameters using Spring container auto-configuration exclusion blocks.
- Swapped active enterprise connection profiles for lightweight, decoupled, non-blocking code verification structures.
- Added inline stubs for relational record tracking logic blocks to allow quick endpoint evaluations via Postman.

## version [0.0.1] - 2026-05-21
### Added
- Initial deployment sprint of the `OraclequantapiApplication` built on Java 17 and Spring Boot.
- Configured REST endpoints (`/api/v1/convert-measurements`) for parsing encoded data streams.
- Established basic character grouping processing algorithms to handle weight total aggregations.
121 changes: 73 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,86 @@
## Submission Instructions
#Package Measurement Conversion API

To submit your Oracle JAVA Spring Boot Maven project as a solution, please follow these steps:
## Features
- Convert measurement strings to numeric package totals.
- Persist conversion history in Oracle Database 21c Express Edition (XEPDB1) via Hibernate ORM.
- Configured to run as a native background Systemd service on an Oracle Linux Host.
- Logging system with real-time operational trace output directly to the console and system logs.

### Step 1: Install git on your PC
- Install "git" as shown in this tutorial: [How to install git](https://youtu.be/iYkLrXobBbA?si=_l0haibv_X9NpIjJ)
- Open command prompt and run
```bash
git version
```
- If you see the version, then git is successfully installed.
## Prerequisites
- Java 17 (OpenJDK) runtime environment.
- Oracle Database 21c XE (Express Edition) pluggable container instance active.
- Oracle Linux Host VM configured on Oracle VirtualBox.
- Apache Maven or included Maven wrapper configuration (mvnw).
- Docker & Docker Compose installed
- DB Visualizer 26.1.2

### Step 2: Fork the Repository
- Navigate to [this repository](https://github.com/CodelineAtyab/oraclequantapi) provided by Codeline.
- Click on the "Fork" button at the top-right corner of the page to create a copy of the repository under your own GitHub account.
To compile the source code and assemble the executable standalone .jar production artifact, run the following command in your local host terminal:
# Using the Maven Wrapper script to bypass local system dependencies
.\mvnw clean package -DskipTests

### Step 3: Clone the Forked Repository
- Open your terminal or command prompt.
- Clone the forked repository to your local machine using the following command:
```bash
git clone https://github.com/your-username/repo-name.git
```
The compiled output unit will be generated at:
- 📁 target/oraclequantapi-1.0.0.jar

### Step 4: Create a new branch
- Navigate to the cloned repository directory
```bash
cd repo-name
```
- Create a new branch for your code submissions (Replace your-name with your name in your-name-submission-branch):
```bash
git checkout -b your-name-submission-branch
```

# Execution & Deployment on Oracle Linux
1. Transfer Artifact:
- Securely copy the production bundle from your host system to your Oracle Linux VM using an SCP tool or terminal shortcut:
```bash
java -jar oraclequantapi-1.0.0.jar --spring.datasource.url=jdbc:oracle:thin:@//192.168.100.191:1521/XEPDB1
```

2. Configure background Systemd Service
- To ensure the application runs continuously in production, package it into a system service file located at /etc/systemd/system/oracleapi.service:
```bash
[Unit]
Description=Package Measurement Conversion REST API Service
After=syslog.target network.target

[Service]
User=mariya
Group=mariya
WorkingDirectory=/home/mariya/Documents
ExecStart=/usr/bin/java -jar /home/mariya/Documents/oraclequantapi-1.0.0.jar
SuccessExitStatus=143
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
```
3. Spin up the Service Engine
```bash
# Refresh system configurations
sudo systemctl daemon-reload

# Enable and start the service thread background worker
sudo systemctl enable oracleapi-service
sudo systemctl start oracleapi-service
```

### Step 5: Add Your Code
- Implement the API

### Step 6: Commit your changes
- Run the following commands in order to commit your changes:
```bash
git add *
git commit -m "Meaningful commit message here"
```
## API Endpoints
Convert Measurements

### Step 7: Push Your Branch to GitHub
- Run the following commands to upload the changes to the forked github repository (Replace your-name with your name in your-name-submission-branch):
Method: GET

Endpoint: /api/v1/convert-measurements

Query Parameter: input=<string>

## Example Request
```bash
git push origin your-name-submission-branch
```
GET http://localhost:8080/api/v1/convert-measurements?input=abbcc
```

## Response
```bash
[2, 6]
```

### Step 8: Create a Pull Request
- Go to your forked repository on GitHub.
- You should see a prompt to create a pull request. Click on "Compare & pull request".
- Provide a title and description for your pull request, then click "Create pull request".
## View Conversion Trace History
Method: GET

### Step 9: Notify Codeline
- Notify on slack that you have created a PR for your solution.
Endpoint: /api/v1/history

## Note: If you face any issues in the process above, Please do the following:
- Watch [this youtube tutorial](https://www.youtube.com/watch?v=a_FLqX3vGR4)
- Contact Ikhlas or Atyab.
Target URL: http://localhost:8080/api/v1/history
23 changes: 22 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
<version>3.5.14</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>com.oraclequantapi</groupId>
<artifactId>oraclequantapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0</version>

<name/>
<description/>
<url/>
Expand All @@ -30,6 +32,24 @@
<java.version>17</java.version>
</properties>
<dependencies>

<!-- <dependency>-->
<!-- <groupId>com.h2database</groupId>-->
<!-- <artifactId>h2</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->

<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<scope>runtime</scope>
</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-web</artifactId>
Expand All @@ -40,6 +60,7 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

@SpringBootApplication
public class OraclequantapiApplication {

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

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.oraclequantapi.oraclequantapi.controllers;


import com.oraclequantapi.oraclequantapi.models.Sequence;
import com.oraclequantapi.oraclequantapi.models.SequenceHistory;
import com.oraclequantapi.oraclequantapi.services.SequenceService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1")
public class SequenceController {

private final SequenceService sequenceService;

public SequenceController(SequenceService sequenceService) {
this.sequenceService = sequenceService;
}

// Endpoint maps directly to: GET /api/v1/convert-measurements?input=XYZ
@GetMapping("/convert-measurements")
public ResponseEntity<?> convertMeasurements(
@RequestParam("input") String rawInput,
HttpServletRequest request) {

Sequence sequence = new Sequence(rawInput);

if (!sequence.is_valid()) {
return ResponseEntity.badRequest().body("Validation failed: Strings must contain characters between 'a' and 'z' or '_' only.");
}

String clientIp = request.getRemoteAddr();
List<Integer> result = sequenceService.process_sequence(sequence, clientIp);

return ResponseEntity.ok(result);
}

// History Read All
@GetMapping("/history")
public List<SequenceHistory> getAllHistory() {
return sequenceService.getAllHistory();
}

// History Read Single Item
@GetMapping("/history/{id}")
public ResponseEntity<SequenceHistory> getHistoryById(@PathVariable Long id) {
return sequenceService.getHistoryById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}

// History Update
@PutMapping("/history/{id}")
public ResponseEntity<SequenceHistory> updateHistory(@PathVariable Long id, @RequestBody SequenceHistory updatedData) {
try {
return ResponseEntity.ok(sequenceService.updateHistory(id, updatedData));
} catch (RuntimeException e) {
return ResponseEntity.notFound().build();
}
}

// History Wipeout Clear
@DeleteMapping("/history")
public ResponseEntity<Void> clearHistory() {
sequenceService.deleteHistory();
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.oraclequantapi.oraclequantapi.models;

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

public class Sequence {

private final List<String> value;

public Sequence() {
this.value = new ArrayList<>();
}

public Sequence(String rawInput) {
this.value = new ArrayList<>();
set_value(rawInput);
}

public void set_value(String rawInput) {
this.value.clear();
if (rawInput != null) {
for (char ch : rawInput.toCharArray()) {
this.value.add(String.valueOf(ch));
}
}
}

public String get_value_as_str() {
return String.join("", this.value);
}

public boolean is_valid() {
if (this.value == null || this.value.isEmpty()) {
return false;
}
for (String s : this.value) {
char ch = s.charAt(0);
// Validates that characters are strictly between 'a' and 'z' OR an underscore '_'
if ((ch < 'a' || ch > 'z') && ch != '_') {
return false;
}
}
return true;
}

public List<String> getValue() {
return value;
}
}
Loading