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 e09b10f7f21eae5257b6c6f1f3cafbeb976280d8..0578554b9f38ee4b2e3bce7ebb41afca0290ef1a 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 9c4ec1759e844dca91c14389918e0445c10e18ca..0000000000000000000000000000000000000000 --- 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 b8c07e129f516499bd03fda9fc44c641fc8dd674..0000000000000000000000000000000000000000 --- 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 1463be9785e3005f519784445fb21f340bf727b2..0000000000000000000000000000000000000000 --- 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 9f1bbf3182bcb0aec6fae7ef5b7da943efb89c79..0000000000000000000000000000000000000000 --- 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 f73b56471bbf094d25c6b7df93fee32a7c7fbee9..03aa480f361dfb02b6846da3d4b39efb86760c25 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 1766594c8a5d1dce55371281526e4e252a593e98..63b35ae354159da614c05ad4312aeb7f421225bf 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 63b672ee8b149c3141ef91cb49e4d8729dc23edf..026a5fd8afaab57af5414eb96ffef1f9c7950a2f 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'