From ddb4a46f78dcbfe0d101a797b5532bfd2409e03e Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Sat, 13 Jan 2024 14:04:21 -0800 Subject: [PATCH] lc-esp-eo: Removed dead modules --- .../java/lc/esp/eo/json/EOJsonSerializer.java | 4 +- java/lc-esp-eo-svc/build.gradle | 22 -- java/lc-esp-eo-svc/eo.yaml | 213 ------------------ .../java/lc/esp/eo/service/EOService.java | 32 --- java/lc-esp-eo-sync-cmd/build.gradle | 18 -- java/lc-ris-svc/build.gradle | 1 + .../main/java/lc/ris/svc/ItemReadHandler.java | 6 +- java/settings.gradle | 2 - 8 files changed, 8 insertions(+), 290 deletions(-) delete mode 100644 java/lc-esp-eo-svc/build.gradle delete mode 100644 java/lc-esp-eo-svc/eo.yaml delete mode 100644 java/lc-esp-eo-svc/src/main/java/lc/esp/eo/service/EOService.java delete mode 100644 java/lc-esp-eo-sync-cmd/build.gradle diff --git a/java/lc-esp-eo-json/src/main/java/lc/esp/eo/json/EOJsonSerializer.java b/java/lc-esp-eo-json/src/main/java/lc/esp/eo/json/EOJsonSerializer.java index e09b10f7f..0578554b9 100644 --- a/java/lc-esp-eo-json/src/main/java/lc/esp/eo/json/EOJsonSerializer.java +++ b/java/lc-esp-eo-json/src/main/java/lc/esp/eo/json/EOJsonSerializer.java @@ -102,7 +102,9 @@ public class EOJsonSerializer { } obj.put(TYPE_KEY, eo.getType()); - obj.put(ID_KEY, eo.getId().toString()); + EOId id = eo.getId(); + if (id != null) + obj.put(ID_KEY, id.toString()); return obj; } diff --git a/java/lc-esp-eo-svc/build.gradle b/java/lc-esp-eo-svc/build.gradle deleted file mode 100644 index 9c4ec1759..000000000 --- a/java/lc-esp-eo-svc/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java' -} - -version = '20.0-SNAPSHOT' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -repositories { - mavenCentral() -} - -dependencies { - implementation project(':lc-esp-eo-engine') - implementation project(':lc-esp-engine') - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/java/lc-esp-eo-svc/eo.yaml b/java/lc-esp-eo-svc/eo.yaml deleted file mode 100644 index b8c07e129..000000000 --- a/java/lc-esp-eo-svc/eo.yaml +++ /dev/null @@ -1,213 +0,0 @@ -openapi: 3.0.3 -info: - title: ESP/EO 20.0 - description: This is an API for ESP/Enterprise Objects. - version: 20.0.0 -externalDocs: - description: LEIGH&CO - url: http://leigh-co.com -servers: - - url: https://esp.leigh-co.com/api/eo/v20 -tags: - - name: transaction -paths: - /execute: - put: - tags: - - transaction - summary: Execute a transaction - description: Execute a transaction - operationId: execute - requestBody: - description: Execute a transaction - content: - application/json: - schema: - $ref: '#/components/schemas/Transaction' - application/xml: - schema: - $ref: '#/components/schemas/Transaction' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/Transaction' - required: true - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionResult' - '400': - description: Invalid ID supplied - '405': - description: Validation exception - security: - - esp_auth: - - write:eo - - read:eo -components: - schemas: - Transaction: - type: object - properties: - ops: - type: array - items: - - $ref: '#/components/schemas/ObjectCreate' - - $ref: '#/components/schemas/ObjectUpdate' - - $ref: '#/components/schemas/ObjectDelete' - - $ref: '#/components/schemas/AssocCreate' - - $ref: '#/components/schemas/AssocRead' - - $ref: '#/components/schemas/AssocDelete' - - $ref: '#/components/schemas/AssocRange' - - $ref: '#/components/schemas/AssocCount' - KeyValue: - type: object - properties: - key: - type: string - value: - type: string - ObjectCreate: - type: object - properties: - otype: - type: string - data: - type: array - items: - $ref: '#/components/schemas/KeyValue' - ObjectUpdate: - type: object - properties: - id: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/KeyValue' - ObjectDelete: - type: object - properties: - id: - type: integer - AssocCreate: - type: object - properties: - obj1: - type: integer - obj2: - type: integer - atype: - type: string - data: - type: array - items: - $ref: '#/components/schemas/KeyValue' - AssocDelete: - type: object - properties: - obj1: - type: integer - obj2: - type: integer - atype: - type: string - AssocRead: - type: object - properties: - id: - type: integer - atype: - type: string - id2set: - type: array - items: - type: integer - ObjectRead: - type: object - properties: - id: - type: integer - otype: - type: string - id2set: - type: array - items: - type: integer - AssocRange: - type: object - properties: - id: - type: integer - atype: - type: string - offset: - type: integer - limit: - type: integer - AssocCount: - type: object - properties: - id: - type: integer - atype: - type: string - ObjectCreateResult: - type: object - properties: - id: - type: integer - AssocCreateResult: - type: object - properties: - id: - type: integer - ObjectUpdateResult: - type: object - ObjectReadResult: - type: object - properties: - create_time: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/KeyValue' - ObjectDeleteResult: - type: object - AssocDeleteResult: - type: object - AssocReadResult: - type: object - properties: - create_time: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/KeyValue' - AssocCountResult: - type: object - AssocRangeResult: - type: object - TransactionResult: - type: object - properties: - reults: - type: array - items: - - $ref: '#/components/schemas/ObjectCreateResult' - - $ref: '#/components/schemas/ObjectUpdateResult' - - $ref: '#/components/schemas/ObjectReadResult' - - $ref: '#/components/schemas/ObjectDeleteResult' - - $ref: '#/components/schemas/AssocCreateResult' - - $ref: '#/components/schemas/AssocDeleteResult' - - $ref: '#/components/schemas/AssocCountResult' - - $ref: '#/components/schemas/AssocReadResult' - - $ref: '#/components/schemas/AssocRangeResult' - securitySchemes: - esp_auth: - type: http - scheme: basic \ No newline at end of file diff --git a/java/lc-esp-eo-svc/src/main/java/lc/esp/eo/service/EOService.java b/java/lc-esp-eo-svc/src/main/java/lc/esp/eo/service/EOService.java deleted file mode 100644 index 1463be978..000000000 --- a/java/lc-esp-eo-svc/src/main/java/lc/esp/eo/service/EOService.java +++ /dev/null @@ -1,32 +0,0 @@ -package lc.esp.eo.service; - -import lc.esp.engine.ESPEngine; -import lc.mecha.fabric.HandlerStatus; -import lc.mecha.http.server.HttpTransaction; -import lc.mecha.http.server.PrefixedHandler; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.util.Set; - -/** - * The EO front-end service. This provides EO & EOFS services to callers both internal and external. - * - * @author Alex Leigh - * @since mk20 (TOKYO PROTOCOL) - */ -public class EOService { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(EOService.class); - - public static void main(String[] args) throws Exception { - ESPEngine esp = new ESPEngine(); - esp.register(new PrefixedHandler(Set.of("/api/eo")) { - @Override - public HandlerStatus handlePrefixedWebRequest(HttpTransaction request) throws Throwable { - request.httpServletResponse.getOutputStream().write("Hello World\n".getBytes()); - return HandlerStatus.BREAK; - } - }); - esp.runDangerously(); - } -} diff --git a/java/lc-esp-eo-sync-cmd/build.gradle b/java/lc-esp-eo-sync-cmd/build.gradle deleted file mode 100644 index 9f1bbf318..000000000 --- a/java/lc-esp-eo-sync-cmd/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'java' -} - -version = '20.0-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/java/lc-ris-svc/build.gradle b/java/lc-ris-svc/build.gradle index f73b56471..03aa480f3 100644 --- a/java/lc-ris-svc/build.gradle +++ b/java/lc-ris-svc/build.gradle @@ -13,6 +13,7 @@ repositories { dependencies { implementation project(':lc-ris') implementation project(':lc-esp-engine') + implementation project(':lc-esp-eo-json') testImplementation platform('org.junit:junit-bom:5.9.1') testImplementation 'org.junit.jupiter:junit-jupiter' } diff --git a/java/lc-ris-svc/src/main/java/lc/ris/svc/ItemReadHandler.java b/java/lc-ris-svc/src/main/java/lc/ris/svc/ItemReadHandler.java index 1766594c8..63b35ae35 100644 --- a/java/lc-ris-svc/src/main/java/lc/ris/svc/ItemReadHandler.java +++ b/java/lc-ris-svc/src/main/java/lc/ris/svc/ItemReadHandler.java @@ -1,10 +1,12 @@ package lc.ris.svc; +import lc.esp.eo.json.EOJsonSerializer; import lc.esp.eo.sdk.EO; import lc.mecha.fabric.HandlerStatus; import lc.mecha.http.server.HttpTransaction; import lc.mecha.http.server.PrefixedHandler; +import java.nio.charset.StandardCharsets; import java.util.Set; public class ItemReadHandler extends PrefixedHandler { @@ -16,7 +18,7 @@ public class ItemReadHandler extends PrefixedHandler { public HandlerStatus handlePrefixedWebRequest(HttpTransaction request) throws Throwable { EO eo = new EO(); eo.setValue("description", "Sake, Bottle, 750ml"); - // request.httpServletResponse.getOutputStream().write(); - return null; + request.httpServletResponse.getOutputStream().write(EOJsonSerializer.toJson(eo).toString().getBytes(StandardCharsets.UTF_8)); + return HandlerStatus.BREAK; } } diff --git a/java/settings.gradle b/java/settings.gradle index 63b672ee8..026a5fd8a 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -3,8 +3,6 @@ include 'lc-esp-engine' include 'lc-esp-eo-engine' include 'lc-esp-eo-json' include 'lc-esp-eo-sdk' -include 'lc-esp-eo-svc' -include 'lc-esp-eo-sync-cmd' include 'lc-esp-example-svc' include 'lc-esp-job' include 'lc-esp-job-svc-example' -- GitLab