List of usage examples for io.vertx.core DeploymentOptions fromJson
public void fromJson(JsonObject json)
From source file:io.knotx.launcher.KnotxModuleVerticleFactory.java
License:Apache License
@Override public void resolve(String id, DeploymentOptions deploymentOptions, ClassLoader classLoader, Future<String> resolution) { String identifier = VerticleFactory.removePrefix(id); String descriptorFile = identifier + ".json"; try {/*from w w w.ja va 2 s . c o m*/ JsonObject descriptor = readDescriptor(classLoader, descriptorFile); String main = readVerticleMainClass(descriptor, descriptorFile); // Any options specified in the module config will override anything specified at deployment time // Options and Config specified in knotx starter JSON will override those configurations JsonObject depOptions = deploymentOptions.toJson(); JsonObject depConfig = depOptions.getJsonObject(CONFIG_KEY, new JsonObject()); JsonObject knotOptions = descriptor.getJsonObject(OPTIONS_KEY, new JsonObject()); JsonObject knotConfig = knotOptions.getJsonObject(CONFIG_KEY, new JsonObject()); depOptions.mergeIn(knotOptions); depOptions.put(CONFIG_KEY, JsonObjectUtil.deepMerge(knotConfig, depConfig)); JsonObject serviceDescriptor = new JsonObject().put(OPTIONS_KEY, depOptions); // Any options or config provided by system properties will override anything specified // at deployment time and on starter Json config serviceDescriptor = overrideConfigWithSystemProperties(identifier, serviceDescriptor); deploymentOptions.fromJson(serviceDescriptor.getJsonObject(OPTIONS_KEY)); resolution.complete(main); } catch (Exception e) { resolution.fail(e); } }
From source file:io.knotx.launcher.KnotxStarterVerticle.java
License:Apache License
private DeploymentOptions getModuleOptions(final String module) { DeploymentOptions deploymentOptions = new DeploymentOptions(); if (config().containsKey(CONFIG_OVERRIDE) && config().getJsonObject(CONFIG_OVERRIDE).containsKey(module)) { JsonObject moduleConfig = config().getJsonObject(CONFIG_OVERRIDE).getJsonObject(module); if (moduleConfig.containsKey(MODULE_OPTIONS)) { deploymentOptions.fromJson(moduleConfig.getJsonObject(MODULE_OPTIONS)); }/*from ww w . j a v a 2s.c om*/ } return deploymentOptions; }