247 startLocalManagementAgent(); 248 } 249 250 } catch (AgentConfigurationError e) { 251 error(e.getError(), e.getParams()); 252 } catch (Exception e) { 253 error(e); 254 } 255 } 256 257 public static Properties loadManagementProperties() { 258 Properties props = new Properties(); 259 260 // Load the management properties from the config file 261 262 String fname = System.getProperty(CONFIG_FILE); 263 readConfiguration(fname, props); 264 265 // management properties can be overridden by system properties 266 // which take precedence 267 props.putAll(System.getProperties()); 268 269 return props; 270 } 271 272 public static synchronized Properties getManagementProperties() { 273 if (mgmtProps == null) { 274 String configFile = System.getProperty(CONFIG_FILE); 275 String snmpPort = System.getProperty(SNMP_PORT); 276 String jmxremote = System.getProperty(JMXREMOTE); 277 String jmxremotePort = System.getProperty(JMXREMOTE_PORT); 278 279 if (configFile == null && snmpPort == null && 280 jmxremote == null && jmxremotePort == null) { 281 // return if out-of-the-management option is not specified 282 return null; 283 } 284 mgmtProps = loadManagementProperties(); 285 } 286 return mgmtProps; 287 } 288 | 247 startLocalManagementAgent(); 248 } 249 250 } catch (AgentConfigurationError e) { 251 error(e.getError(), e.getParams()); 252 } catch (Exception e) { 253 error(e); 254 } 255 } 256 257 public static Properties loadManagementProperties() { 258 Properties props = new Properties(); 259 260 // Load the management properties from the config file 261 262 String fname = System.getProperty(CONFIG_FILE); 263 readConfiguration(fname, props); 264 265 // management properties can be overridden by system properties 266 // which take precedence 267 // putAll will fail if system properties are modified 268 // while copying them, so we need synchronize the system properties 269 Properties sysProps = System.getProperties(); 270 synchronized (sysProps) { 271 props.putAll(sysProps); 272 } 273 return props; 274 } 275 276 public static synchronized Properties getManagementProperties() { 277 if (mgmtProps == null) { 278 String configFile = System.getProperty(CONFIG_FILE); 279 String snmpPort = System.getProperty(SNMP_PORT); 280 String jmxremote = System.getProperty(JMXREMOTE); 281 String jmxremotePort = System.getProperty(JMXREMOTE_PORT); 282 283 if (configFile == null && snmpPort == null && 284 jmxremote == null && jmxremotePort == null) { 285 // return if out-of-the-management option is not specified 286 return null; 287 } 288 mgmtProps = loadManagementProperties(); 289 } 290 return mgmtProps; 291 } 292 |