Class ExampleUtil
Object
ExampleUtil
General helper utilities for example scenarios:
- Configuration loading
- Authentication
- JSON serialization (with Java Time support)
- Cryptographic helpers
- Error handling
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnkaSecureSdk
authenticate
(Properties props) Authenticate application using encrypted credentials in props.static void
ensureTempDir
(Path dir) Ensures the given directory exists.static void
Print an error message and terminate the JVM.static Properties
Load CLI configuration in order: 1. .static String
Serialize any object to pretty-printed JSON, including ZonedDateTime.
-
Method Details
-
loadProperties
Load CLI configuration in order: 1. ./cli.properties 2. System property -Dcli.config 3. Classpath resource /cli.properties- Returns:
- loaded Properties
- Throws:
UncheckedIOException
- on I/O failure
-
authenticate
Authenticate application using encrypted credentials in props. Exits the JVM on failure.- Parameters:
props
- Properties from loadProperties()- Returns:
- an authenticated AnkaSecureSdk instance
-
toJson
Serialize any object to pretty-printed JSON, including ZonedDateTime.- Parameters:
o
- object to serialize- Returns:
- JSON string
- Throws:
UncheckedIOException
- on serialization failure
-
ensureTempDir
Ensures the given directory exists. Creates it (and any parents) if needed. Exits the JVM on failure.- Parameters:
dir
- path to ensure
-
fatal
-