private static void updateDpmProperties ( Context context , String dpmBaseURL , List < String > labels , boolean enableSch ) { if ( context . skipUpdatingDpmProperties ) { return ; } try { FileBasedConfigurationBuilder < PropertiesConfiguration > builder = new FileBasedConfigurationBuilder <> ( PropertiesConfiguration . class ) . configure ( new Parameters ( ) . properties ( ) . setFileName ( context . runtimeInfo . getConfigDir ( ) + "/dpm.properties" ) . setThrowExceptionOnMissing ( true ) . setListDelimiterHandler ( new DefaultListDelimiterHandler ( ' ' ) ) . setIncludesAllowed ( false ) ) ; PropertiesConfiguration config = null ; config = builder . getConfiguration ( ) ; config . setProperty ( RemoteSSOService . DPM_ENABLED , Boolean . toString ( enableSch ) ) ; config . setProperty ( RemoteSSOService . DPM_BASE_URL_CONFIG , dpmBaseURL ) ; config . setProperty ( RemoteSSOService . SECURITY_SERVICE_APP_AUTH_TOKEN_CONFIG , APP_TOKEN_FILE_PROP_VAL ) ; if ( labels != null && labels . size ( ) > 0 ) { config . setProperty ( RemoteEventHandlerTask . REMOTE_JOB_LABELS , StringUtils . join ( labels , ' ' ) ) ; } else { config . setProperty ( RemoteEventHandlerTask . REMOTE_JOB_LABELS , "" ) ; } builder . save ( ) ; } catch ( ConfigurationException e ) { throw new RuntimeException ( Utils . format ( "Updating dpm.properties file failed: {}" , e . getMessage ( ) ) , e ) ; } }
Update dpm . properties file with new configuration .