@Test public void testApplyConfig() { assertThat(configService.getSubjectFactory(String.class), nullValue()); assertThat(configService.getSubjectFactory("key"), nullValue()); registry.registerConfigFactory(config1Factory); registry.registerConfigFactory(config2Factory); configService.applyConfig("configKey", BasicConfig1.class, new ObjectMapper().createObjectNode()); Config newConfig = configService.getConfig("configKey", BasicConfig1.class); assertThat(newConfig, notNullValue()); assertThat(configService.getSubjectFactory(String.class), notNullValue()); assertThat(configService.getSubjectFactory("key1"), notNullValue()); }
@Override public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); checkNotNull(json, NULL_JSON_MSG); return store.applyConfig(subject, configClass, json); }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); checkNotNull(json, NULL_JSON_MSG); return store.applyConfig(subject, configClass, json); } }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); checkNotNull(json, NULL_JSON_MSG); return store.applyConfig(subject, configClass, json); }  }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); checkNotNull(json, NULL_JSON_MSG); return store.applyConfig(subject, configClass, json); }  @Activate void activate(); @Deactivate void deactivate(); @Override @SuppressWarnings("unchecked") void registerConfigFactory(ConfigFactory configFactory); @Override void unregisterConfigFactory(ConfigFactory configFactory); @Override Set<ConfigFactory> getConfigFactories(); @Override @SuppressWarnings("unchecked") Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass); @Override ConfigFactory<S, C> getConfigFactory(Class<C> configClass); @Override Set<Class> getSubjectClasses(); @Override SubjectFactory getSubjectFactory(String subjectClassKey); @Override SubjectFactory getSubjectFactory(Class subjectClass); @Override Class<? extends Config> getConfigClass(String subjectClassKey, String configKey); @Override Set<S> getSubjects(Class<S> subjectClass); @Override Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass); @Override Set<Config<S>> getConfigs(S subject); @Override C getConfig(S subject, Class<C> configClass); @Override C addConfig(S subject, Class<C> configClass); @Override C applyConfig(S subject, Class<C> configClass, JsonNode json); @Override @SuppressWarnings("unchecked") C applyConfig(String subjectClassKey, S subject,
                                                  String configKey, JsonNode json); @Override void removeConfig(S subject, Class<C> configClass); @Override void removeConfig(String subjectClassKey, S subject, String configKey); @Override void removeConfig(S subject); @Override void removeConfig(); }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); checkNotNull(json, NULL_JSON_MSG); return store.applyConfig(subject, configClass, json); }  @Activate void activate(); @Deactivate void deactivate(); @Override @SuppressWarnings("unchecked") void registerConfigFactory(ConfigFactory configFactory); @Override void unregisterConfigFactory(ConfigFactory configFactory); @Override Set<ConfigFactory> getConfigFactories(); @Override @SuppressWarnings("unchecked") Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass); @Override ConfigFactory<S, C> getConfigFactory(Class<C> configClass); @Override Set<Class> getSubjectClasses(); @Override SubjectFactory getSubjectFactory(String subjectClassKey); @Override SubjectFactory getSubjectFactory(Class subjectClass); @Override Class<? extends Config> getConfigClass(String subjectClassKey, String configKey); @Override Set<S> getSubjects(Class<S> subjectClass); @Override Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass); @Override Set<Config<S>> getConfigs(S subject); @Override C getConfig(S subject, Class<C> configClass); @Override C addConfig(S subject, Class<C> configClass); @Override C applyConfig(S subject, Class<C> configClass, JsonNode json); @Override @SuppressWarnings("unchecked") C applyConfig(String subjectClassKey, S subject,
                                                  String configKey, JsonNode json); @Override void removeConfig(S subject, Class<C> configClass); @Override void removeConfig(String subjectClassKey, S subject, String configKey); @Override void removeConfig(S subject); @Override void removeConfig();  }