1+ package com .newrelic .videoagent .core .config ;
2+
3+ /**
4+ * Configuration manager for New Relic Video Agent functionality.
5+ * Default values are sourced from local.properties, can be overridden by client configuration.
6+ */
7+ public class NRVideoConfig {
8+
9+ private static final NRVideoConfig INSTANCE = new NRVideoConfig ();
10+
11+ // Configuration value - set from local.properties via BuildConfig
12+ private boolean qoeAggregate ;
13+ private boolean initialized = false ;
14+
15+ private NRVideoConfig () {
16+ }
17+
18+ /**
19+ * Get the singleton instance of NRVideoConfig
20+ * @return NRVideoConfig instance
21+ */
22+ public static NRVideoConfig getInstance () {
23+ return INSTANCE ;
24+ }
25+
26+ /**
27+ * Check if QOE_AGGREGATE events should be sent during harvest cycles
28+ * @return true if QOE_AGGREGATE should be sent, false otherwise
29+ */
30+ public boolean isQoeAggregateEnabled () {
31+ if (!initialized ) {
32+ throw new IllegalStateException ("NRVideoConfig not initialized! Call initializeDefaults() first." );
33+ }
34+ return qoeAggregate ;
35+ }
36+
37+ /**
38+ * Set whether QOE_AGGREGATE events should be sent during harvest cycles
39+ * This will be called with client configuration in the future
40+ * @param enabled true to enable QOE_AGGREGATE, false to disable
41+ */
42+ public void setQoeAggregateEnabled (boolean enabled ) {
43+ this .qoeAggregate = enabled ;
44+ }
45+
46+ /**
47+ * Initialize configuration with default values from local.properties
48+ * This method should be called during app initialization
49+ * @param defaultQoeAggregateEnabled Default value for QOE aggregate from BuildConfig
50+ */
51+ public void initializeDefaults (boolean defaultQoeAggregateEnabled ) {
52+ if (!initialized ) {
53+ this .qoeAggregate = defaultQoeAggregateEnabled ;
54+ this .initialized = true ;
55+ }
56+ }
57+
58+ /**
59+ * Initialize configuration with client settings
60+ * @param clientQoeAggregateEnabled QOE aggregate setting from client (null if not provided)
61+ */
62+ public void initializeFromClient (Boolean clientQoeAggregateEnabled ) {
63+ // If client provides a value, use it; otherwise keep current default
64+ if (clientQoeAggregateEnabled != null ) {
65+ this .qoeAggregate = clientQoeAggregateEnabled ;
66+ }
67+ }
68+ }
0 commit comments