public final class Lineage2Cli extends Object
scripts/lineage2/gold/check_gold.py and compare.sh):
java -cp gsqlparser.jar gudusoft.gsqlparser.lineage2.cli.Lineage2Cli \
--sql <file> [--vendor mssql] [--artifact-locator <name>] \
[--workspace <ws>] [--default-database <db>] \
[--default-schema <schema>] [--catalog <catalog.json>]
Prints the contract JSON document on stdout (one trailing newline) and exits 0. SQL-level failures degrade into document diagnostics per contract §2 and still exit 0; usage and I/O errors print to stderr and exit 2.
The --catalog sidecar uses the gold-fixture format:
{"defaultDatabase", "defaultSchema", "objects": [{"name", "kind",
"columns": [...]}], "primaryKeys"?, "synonyms"?}. Object names and
columns are loaded into the Semantic IR Catalog DTO;
kind/primaryKeys/synonyms are parsed but not yet
consumed (they feed the BindingGate and LOOKUP stories, US-025+).
Internal API: not part of the public gsqlparser surface.
| Modifier and Type | Class and Description |
|---|---|
static class |
Lineage2Cli.UsageException
Thrown on bad command-line arguments (exit code 2).
|
| Modifier and Type | Method and Description |
|---|---|
static Catalog |
loadCatalog(String path)
Reads a catalog sidecar JSON file into a
Catalog. |
static void |
main(String[] args) |
static String |
run(String[] args)
Embeddable core of
main(java.lang.String[]): parses arguments, runs the analyzer,
and RETURNS the contract JSON (without trailing newline) instead of
printing it and terminating the JVM. |
public static String run(String[] args) throws IOException
main(java.lang.String[]): parses arguments, runs the analyzer,
and RETURNS the contract JSON (without trailing newline) instead of
printing it and terminating the JVM.
Public because this is the form a caller actually wants when driving
the tool in-process: main(java.lang.String[]) writes to stdout and calls
System.exit(int), which would take the host application down with it.
It is also what makes the CLI testable against the shipped
(ProGuard-obfuscated) jar - a package-private method is renamed there and
cannot be reached, by a test or by anyone else.
args - the same arguments main(java.lang.String[]) acceptsIOException - if the SQL or artifact input cannot be readpublic static Catalog loadCatalog(String path) throws IOException
Catalog.
Public for the same reason as run(String[]): it is a useful
entry point for a caller assembling the same inputs the CLI takes, and a
package-private method is renamed in the shipped obfuscated jar.
path - path to the catalog sidecar JSONIOException - if the file cannot be read or parsed