use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ZpmInstall method readOrDefaultConfig.
private ZpmConfiguration readOrDefaultConfig(Path zpmFile) throws IOException {
ZpmConfiguration config = new ZpmConfiguration();
config.repositories = emptyList();
config.imports = emptyList();
config.dependencies = emptyList();
Jsonb builder = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withFormatting(true)).build();
if (Files.exists(zpmFile)) {
try (InputStream in = newInputStream(zpmFile)) {
config = builder.fromJson(in, ZpmConfiguration.class);
}
}
return config;
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ZpmInstall method writeLockFile.
private void writeLockFile(ZpmConfiguration config, Path lockFile) throws IOException {
Jsonb builder = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withFormatting(true)).build();
createDirectories(lockDir);
try (OutputStream out = newOutputStream(lockFile)) {
builder.toJson(config, out);
}
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ZpmEncrypt method readSecurity.
private ZpmSecurity readSecurity(Path settingsDir) throws IOException, PlexusCipherException {
Path securityFile = settingsDir.resolve("security.json");
ZpmSecurity security = new ZpmSecurity();
Jsonb builder = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withFormatting(true)).build();
if (Files.exists(securityFile)) {
try (InputStream in = newInputStream(securityFile)) {
security = builder.fromJson(in, ZpmSecurity.class);
}
}
return security;
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class NamespaceConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new NamespaceAdapter());
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class OptionsConfigAdapterTest method initJson.
@Before
public void initJson() {
adapter = new OptionsAdapter(OptionsConfigAdapterSpi.Kind.BINDING);
adapter.adaptType("test");
JsonbConfig config = new JsonbConfig().withAdapters(adapter);
jsonb = JsonbBuilder.create(config);
}
Aggregations