public static void storeControlHubConfigs ( RuntimeInfo runtimeInfo , Map < String , String > newConfigs ) throws IOException { File configFile = new File ( runtimeInfo . getDataDir ( ) , SCH_CONF_OVERRIDE ) ; Properties properties = new Properties ( ) ; // Load existing properties from disk if they exists if ( configFile . exists ( ) ) { try ( FileReader reader = new FileReader ( configFile ) ) { properties . load ( reader ) ; } } // Propagate updated configuration for ( Map . Entry < String , String > entry : newConfigs . entrySet ( ) ) { if ( entry . getValue ( ) == null ) { properties . remove ( entry . getKey ( ) ) ; } else { properties . setProperty ( entry . getKey ( ) , entry . getValue ( ) ) ; } } // Store the new updated configuration back to disk try ( FileWriter writer = new FileWriter ( configFile ) ) { properties . store ( writer , null ) ; } }
Store configuration from control hub in persistent manner inside data directory . This configuration will be loaded on data collector start and will override any configuration from sdc . properties .