@@ -70,14 +70,14 @@ public static class Property {
7070 private final Set <String > dataExclusions ;
7171 private final PluginManager pluginManager ;
7272 @ Getter private final StorageProviderIF storageProvider ;
73- @ Getter private ValueProvider <String > apiKey ;
74- @ Getter private ValueProvider <String > serverUrl ;
75- @ Getter private ValueProvider <String > heartbeatServerUrl ;
76- @ Getter private ValueProvider <String > configServerUrl ;
77- @ Getter private ValueProvider <Long > updateSettingsWhenIdleInterval ;
78- @ Getter private ValueProvider <Integer > submissionBatchSize ;
79- @ Getter private ValueProvider <Integer > submissionClientTimeoutInMillis ;
80- @ Getter private ValueProvider <Integer > settingsClientTimeoutInMillis ;
73+ @ Getter private final ValueProvider <String > apiKey ;
74+ @ Getter private final ValueProvider <String > serverUrl ;
75+ @ Getter private final ValueProvider <String > heartbeatServerUrl ;
76+ @ Getter private final ValueProvider <String > configServerUrl ;
77+ @ Getter private final ValueProvider <Long > updateSettingsWhenIdleInterval ;
78+ @ Getter private final ValueProvider <Integer > submissionBatchSize ;
79+ @ Getter private final ValueProvider <Integer > submissionClientTimeoutInMillis ;
80+ @ Getter private final ValueProvider <Integer > settingsClientTimeoutInMillis ;
8181 private final PropertyChangeSupport propertyChangeSupport ;
8282
8383 @ Builder
@@ -98,6 +98,38 @@ public ConfigurationManager(
9898 Integer submissionBatchSize ,
9999 Integer submissionClientTimeoutInMillis ,
100100 Integer settingsClientTimeoutInMillis ) {
101+ this .apiKey = ValueProvider .of (apiKey );
102+ this .serverUrl =
103+ serverUrl == null ? ValueProvider .of (DEFAULT_SERVER_URL ) : ValueProvider .of (serverUrl );
104+ this .heartbeatServerUrl =
105+ heartbeatServerUrl == null
106+ ? (serverUrl == null
107+ ? ValueProvider .of (DEFAULT_HEARTBEAT_SERVER_URL )
108+ : ValueProvider .of (serverUrl ))
109+ : ValueProvider .of (heartbeatServerUrl );
110+ this .configServerUrl =
111+ configServerUrl == null
112+ ? (serverUrl == null
113+ ? ValueProvider .of (DEFAULT_CONFIG_SERVER_URL )
114+ : ValueProvider .of (serverUrl ))
115+ : ValueProvider .of (configServerUrl );
116+ this .updateSettingsWhenIdleInterval =
117+ updateSettingsWhenIdleInterval == null
118+ ? ValueProvider .of (DEFAULT_UPDATE_SETTINGS_WHEN_IDLE_INTERVAL )
119+ : ValueProvider .of (updateSettingsWhenIdleInterval );
120+ this .submissionBatchSize =
121+ submissionBatchSize == null
122+ ? ValueProvider .of (DEFAULT_SUBMISSION_BATCH_SIZE )
123+ : ValueProvider .of (submissionBatchSize );
124+ this .submissionClientTimeoutInMillis =
125+ submissionClientTimeoutInMillis == null
126+ ? ValueProvider .of (DEFAULT_SUBMISSION_CLIENT_TIMEOUT_IN_MILLIS )
127+ : ValueProvider .of (submissionClientTimeoutInMillis );
128+ this .settingsClientTimeoutInMillis =
129+ settingsClientTimeoutInMillis == null
130+ ? ValueProvider .of (DEFAULT_SETTINGS_CLIENT_TIMEOUT_IN_MILLIS )
131+ : ValueProvider .of (settingsClientTimeoutInMillis );
132+ this .propertyChangeSupport = new PropertyChangeSupport (this );
101133 this .lastReferenceIdManager =
102134 lastReferenceIdManager == null
103135 ? DefaultLastReferenceIdManager .builder ().build ()
@@ -144,38 +176,6 @@ public ConfigurationManager(
144176 this .onChangedHandlers = new ArrayList <>();
145177 this .dataExclusions = new HashSet <>();
146178 this .privateInformationInclusions = PrivateInformationInclusions .builder ().build ();
147- this .apiKey = ValueProvider .of (apiKey );
148- this .serverUrl =
149- serverUrl == null ? ValueProvider .of (DEFAULT_SERVER_URL ) : ValueProvider .of (serverUrl );
150- this .heartbeatServerUrl =
151- heartbeatServerUrl == null
152- ? (serverUrl == null
153- ? ValueProvider .of (DEFAULT_HEARTBEAT_SERVER_URL )
154- : ValueProvider .of (serverUrl ))
155- : ValueProvider .of (heartbeatServerUrl );
156- this .configServerUrl =
157- configServerUrl == null
158- ? (serverUrl == null
159- ? ValueProvider .of (DEFAULT_CONFIG_SERVER_URL )
160- : ValueProvider .of (serverUrl ))
161- : ValueProvider .of (configServerUrl );
162- this .updateSettingsWhenIdleInterval =
163- updateSettingsWhenIdleInterval == null
164- ? ValueProvider .of (DEFAULT_UPDATE_SETTINGS_WHEN_IDLE_INTERVAL )
165- : ValueProvider .of (updateSettingsWhenIdleInterval );
166- this .submissionBatchSize =
167- submissionBatchSize == null
168- ? ValueProvider .of (DEFAULT_SUBMISSION_BATCH_SIZE )
169- : ValueProvider .of (submissionBatchSize );
170- this .submissionClientTimeoutInMillis =
171- submissionClientTimeoutInMillis == null
172- ? ValueProvider .of (DEFAULT_SUBMISSION_CLIENT_TIMEOUT_IN_MILLIS )
173- : ValueProvider .of (submissionClientTimeoutInMillis );
174- this .settingsClientTimeoutInMillis =
175- settingsClientTimeoutInMillis == null
176- ? ValueProvider .of (DEFAULT_SETTINGS_CLIENT_TIMEOUT_IN_MILLIS )
177- : ValueProvider .of (settingsClientTimeoutInMillis );
178- this .propertyChangeSupport = new PropertyChangeSupport (this );
179179 checkApiKeyIsValid ();
180180 addPropertyChangeListeners ();
181181 addLogCapturer (logCatpurer );
@@ -192,8 +192,7 @@ private void checkApiKeyIsValid() {
192192 return ;
193193 }
194194
195- throw new InvalidApiKeyException (
196- String .format ("Apikey is not valid: [%s]" , this .apiKey .get ()));
195+ throw new InvalidApiKeyException (String .format ("Apikey is not valid: [%s]" , this .apiKey .get ()));
197196 }
198197
199198 private void addLogCapturer (LogCapturerIF logCatpurer ) {
@@ -210,35 +209,35 @@ private void addLogCapturer(LogCapturerIF logCatpurer) {
210209 public void setApiKey (String apiKey ) {
211210 String prevValue = this .apiKey .get ();
212211 this .apiKey .update (apiKey );
213- propertyChangeSupport .firePropertyChange (Configuration . Property .API_KEY , prevValue , apiKey );
212+ propertyChangeSupport .firePropertyChange (Property .API_KEY , prevValue , apiKey );
214213 }
215214
216215 public void setServerUrl (String serverUrl ) {
217216 String prevValue = this .serverUrl .get ();
218217 this .serverUrl .update (serverUrl );
219218 propertyChangeSupport .firePropertyChange (
220- Configuration . Property .SERVER_URL , prevValue , serverUrl );
219+ Property .SERVER_URL , prevValue , serverUrl );
221220 }
222221
223222 public void setConfigServerUrl (String configServerUrl ) {
224223 String prevValue = this .configServerUrl .get ();
225224 this .configServerUrl .update (configServerUrl );
226225 propertyChangeSupport .firePropertyChange (
227- Configuration . Property .CONFIG_SERVER_URL , prevValue , configServerUrl );
226+ Property .CONFIG_SERVER_URL , prevValue , configServerUrl );
228227 }
229228
230229 public void setHeartbeatServerUrl (String heartbeatServerUrl ) {
231230 String prevValue = this .heartbeatServerUrl .get ();
232231 this .heartbeatServerUrl .update (heartbeatServerUrl );
233232 propertyChangeSupport .firePropertyChange (
234- Configuration . Property .HEART_BEAT_SERVER_URL , prevValue , heartbeatServerUrl );
233+ Property .HEART_BEAT_SERVER_URL , prevValue , heartbeatServerUrl );
235234 }
236235
237236 public void setUpdateSettingsWhenIdleInterval (Long updateSettingsWhenIdleInterval ) {
238237 Long prevValue = this .updateSettingsWhenIdleInterval .get ();
239238 this .updateSettingsWhenIdleInterval .update (updateSettingsWhenIdleInterval );
240239 propertyChangeSupport .firePropertyChange (
241- Configuration . Property .UPDATE_SETTINGS_WHEN_IDLE_INTERVAL ,
240+ Property .UPDATE_SETTINGS_WHEN_IDLE_INTERVAL ,
242241 prevValue ,
243242 updateSettingsWhenIdleInterval );
244243 }
@@ -247,14 +246,14 @@ public void setSubmissionBatchSize(Integer submissionBatchSize) {
247246 Integer prevValue = this .submissionBatchSize .get ();
248247 this .submissionBatchSize .update (submissionBatchSize );
249248 propertyChangeSupport .firePropertyChange (
250- Configuration . Property .SUBMISSION_BATCH_SIZE , prevValue , submissionBatchSize );
249+ Property .SUBMISSION_BATCH_SIZE , prevValue , submissionBatchSize );
251250 }
252251
253252 public void setSubmissionClientTimeoutInMillis (Integer submissionClientTimeoutInMillis ) {
254253 Integer prevValue = this .submissionClientTimeoutInMillis .get ();
255254 this .submissionClientTimeoutInMillis .update (submissionClientTimeoutInMillis );
256255 propertyChangeSupport .firePropertyChange (
257- Configuration . Property .SUBMISSION_CLIENT_TIMEOUT_IN_MILLIS ,
256+ Property .SUBMISSION_CLIENT_TIMEOUT_IN_MILLIS ,
258257 prevValue ,
259258 submissionClientTimeoutInMillis );
260259 }
@@ -263,7 +262,7 @@ public void setSettingsClientTimeoutInMillis(Integer settingsClientTimeoutInMill
263262 Integer prevValue = this .settingsClientTimeoutInMillis .get ();
264263 this .settingsClientTimeoutInMillis .update (settingsClientTimeoutInMillis );
265264 propertyChangeSupport .firePropertyChange (
266- Configuration . Property .SETTINGS_CLIENT_TIMEOUT_IN_MILLIS ,
265+ Property .SETTINGS_CLIENT_TIMEOUT_IN_MILLIS ,
267266 prevValue ,
268267 settingsClientTimeoutInMillis );
269268 }
0 commit comments