List of usage examples for org.apache.commons.configuration SubsetConfiguration containsKey
public boolean containsKey(String key)
From source file:com.chocolatefactory.newrelic.plugins.hadoop.NewRelicSink.java
@Override public void init(SubsetConfiguration conf) { debugEnabled = false;//from w w w. j a v a 2s. c om getGroupings = false; div = NewRelicMetrics.kMetricTreeDivider; categoryName = NewRelicMetrics.kCategoryMetricName; deltaName = NewRelicMetrics.kDeltaMetricName; overviewName = NewRelicMetrics.kOverviewMetricName; hadoopProcType = conf.getString("proctype", NewRelicMetrics.kDefaultAgentName); nrLicenseKey = conf.getString("nrlicensekey", ""); logger = Logger.getLogger(NewRelicSink.class); if (hadoopProcType.equals(NewRelicMetrics.kDefaultAgentName) && !conf.containsKey("enabled")) { logger.info("Monitoring disabled for this procees."); logger.info("Shutting down New Relic sink."); return; } else if ("".equals(nrLicenseKey) || (nrLicenseKey == null)) { logger.info("No New Relic License Key given."); logger.info("Shutting down New Relic sink."); return; } else { context = buildContext(nrLicenseKey, conf.getString("hostname", ""), hadoopProcType); component = context.getComponents().next(); } // Debug stuff if (conf.getString("debug", "false").equals("true")) { debugEnabled = true; logger.info("New Relic Sink: DEBUG enabled."); } if (conf.getString("nrgroupings", "false").equals("true")) { getGroupings = true; metricGroupings = new HashMap<String, Integer>(); logger.info("New Relic Sink: Getting Metric Groupings"); } // For Insights nrInsightsKey = conf.getString("nrinsightskey", ""); nrAccountId = conf.getString("nraccountid", ""); if ("".equals(nrInsightsKey) || (nrInsightsKey == null) || "".equals(nrAccountId) || (nrAccountId == null)) { logger.info("No New Relic (Insights Insert Key || Account ID) given."); logger.info("Metrics will not be fed to insights."); useInsights = false; } else { logger.info("Insights metric recording is enabled!"); useInsights = true; insightsService = InsightsService.withAccountId(nrAccountId).withApiKey(nrInsightsKey).withSsl(true); } // Initializing hashmaps to hold metrics metricNames = new HashMap<String, String[]>(); oldMetricValues = new HashMap<String, Float>(); insightsMetrics = new HashMap<String, Object>(); }