- parser.parse(jsonObject);
- this.appConfig.setConfiguration(parser.getRicConfigs(), parser.getDmaapConsumerConfig());
- } catch (ServiceException e) {
- logger.error("Could not parse configuration {}", e.toString(), e);
+ return Mono.just(parser.parse(jsonObject));
+ } catch (Exception e) {
+ String str = e.toString();
+ logger.error("Could not parse configuration {}", str);
+ return Mono.empty();
+ }
+ }
+
+ private Flux<RicConfigUpdate> updateConfig(ApplicationConfigParser.ConfigParserResult config) {
+ return this.appConfig.setConfiguration(config);
+ }
+
+ boolean fileExists(String filepath) {
+ return (filepath != null && (new File(filepath).exists()));
+ }
+
+ private void handleUpdatedRicConfig(RicConfigUpdate updatedInfo) {
+ synchronized (this.rics) {
+ String ricName = updatedInfo.getRicConfig().name();
+ RicConfigUpdate.Type event = updatedInfo.getType();
+ if (event == RicConfigUpdate.Type.ADDED) {
+ addRic(updatedInfo.getRicConfig());
+ } else if (event == RicConfigUpdate.Type.REMOVED) {
+ rics.remove(ricName);
+ this.policies.removePoliciesForRic(ricName);
+ } else if (event == RicConfigUpdate.Type.CHANGED) {
+ Ric ric = this.rics.get(ricName);
+ if (ric == null) {
+ // Should not happen,just for robustness
+ addRic(updatedInfo.getRicConfig());
+ } else {
+ ric.setRicConfig(updatedInfo.getRicConfig());
+ }
+ }