How simplifiedlogic/creoson works
Project type and purpose
• This is not a classic three-tier web app but an open-source automation “micro-server” (CREOSON) for PTC’s CREO Parametric.
• It exposes a JSON/HTTP API (and a lightweight web UI) so any language or script can drive CREO via the free JLINK interface.
File structure
Top-level folders each build to a JAR (via Ant):
• creoson-core – low-level JLINK call wrappers, data models, JNI bridges
• creoson-intf – Java interfaces and data classes used to marshal JLINK results
• creoson-json – JSON parsing/templating, command dispatch to jShell providers
• creoson-json-const – typed request/response parameter classes for JSON
• creoson-server – HTTP server (MainServer.java), REST/JShell endpoints, static web assets (UI + docs)
• creofuncs & creo4funcs – example “functions” built on top of jShell to expose common tasks (ExportPDF, ExportGeometry, etc.)
• jshell_native – C++ JNI native library that bridges Java jShell calls through the PTC JLINK DLL into CREO
Root contains build scripts (build-all.xml, build-zip.xml, build-javadoc.xml), README, license, release notes.
README for insights
• CREOSON listens for JSON requests over HTTP, translates them via a jShell interface into JLINK calls, and returns JSON responses.
• The “geeky” section confirms the layering: JSON ⇄ jShell ⇄ JLINK ⇄ CREO.
Main architectural layers and components
a. Client layer
• Any JSON-capable client (curl, Python, JS front-end, custom script)
• Web UI in creoson-server/web (HTML + JS + Ace Editor)
b. HTTP/JSON API layer (creoson-server)
• MainServer.java starts an HTTP listener
• ServerHttpHandler, JsHellHttpHandler, FileHttpHandler route requests
• Static asset handler serves the UI/docs
c. JSON dispatch layer (creoson-json + creoson-json-const)
• JShellJsonHandler orchestrates:
– parse incoming JSON into typed request objects (requests in creoson-json-const)
– locate the correct JLJson*Handler to handle the command
– build a JSON response object (typed response classes)
d. Business logic / jShell provider layer (creoson-intf + creoson-core)
• JShellProvider interface (creoson-core/src/.../JShellProvider.java)
• Default implementation uses the JNI C++ library from jshell_native or the pure-Java JLINK wrapper
• creoson-core packages (“calls” + “impl”) encapsulate every JLINK operation as a CallXXX object with arguments
e. Native JNI bridge (jshell_native)
• JCConnection.cpp, JCFeature.cpp, etc.: native C++ code that loads the JLINK DLL and marshals calls into CREO
• Exposes a “jshell_native.dll” that the Java layer loads
f. External system
• PTC CREO Parametric running on the same machine
• JLINK API (a PTC-provided DLL)
Final advice
– Capture the end-to-end flow of data: Client → JSON → calls → CREO → back
– Show extension points: where to drop in new command handlers or alternative JShellProviders