Tabnine Logo
org.jolokia.config
Code IndexAdd Tabnine to your IDE (free)

How to use org.jolokia.config

Best Java code snippets using org.jolokia.config (Showing top 20 results out of 315)

origin: rhuss/jolokia

/**
 * Get a processing configuration or null if not set
 * @param pConfigKey configuration key to fetch
 * @return string value or <code>null</code> if not set
 */
public String getParameter(ConfigKey pConfigKey) {
  return processingConfig.get(pConfigKey);
}
origin: rhuss/jolokia

private void initContext() {
  context = jolokiaConfig.get(ConfigKey.AGENT_CONTEXT);
  if (context == null) {
    context = ConfigKey.AGENT_CONTEXT.getDefaultValue();
  }
  if (!context.endsWith("/")) {
    context += "/";
  }
}
origin: rhuss/jolokia

private JSONObject configToJSONObject() {
  JSONObject info = new JSONObject();
  if (config != null) {
    for (ConfigKey key : ConfigKey.values()) {
      if (key.isGlobalConfig()) {
        String value = config.get(key);
        if (value != null) {
          info.put(key.getKeyValue(), value);
        }
      }
    }
  }
  return info;
}
origin: rhuss/jolokia

private String findAgentUrl(Configuration pConfig) {
  // System property has precedence
  String url = System.getProperty("jolokia." + ConfigKey.DISCOVERY_AGENT_URL.getKeyValue());
  if (url == null) {
    url = System.getenv("JOLOKIA_DISCOVERY_AGENT_URL");
    if (url == null) {
      url = pConfig.get(ConfigKey.DISCOVERY_AGENT_URL);
    }
  }
  return NetworkUtil.replaceExpression(url);
}
origin: rhuss/jolokia

/**
 * Update this global configuration from a string-string. Only the known keys are taken
 * from this map
 *
 * @param pConfig config map from where to take the configuration
 */
public void updateGlobalConfiguration(Map<String, String> pConfig) {
  for (ConfigKey c : ConfigKey.values()) {
    if (c.isGlobalConfig()) {
      String value = pConfig.get(c.getKeyValue());
      if (value != null) {
        globalConfig.put(c,value);
      }
    }
  }
}
origin: rhuss/jolokia

private boolean listenForDiscoveryMcRequests(Configuration pConfig) {
  String enable = pConfig.get(ConfigKey.DISCOVERY_ENABLED);
  String url = pConfig.get(ConfigKey.DISCOVERY_AGENT_URL);
  return url != null || enable == null || Boolean.valueOf(enable);
}
origin: rhuss/jolokia

private boolean listenForDiscoveryMcRequests(Configuration pConfig) {
  // Check for system props, system env and agent config
  boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null;
  boolean env     = System.getenv("JOLOKIA_DISCOVERY") != null;
  boolean config  = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED);
  return sysProp || env || config;
}
/**
origin: rhuss/jolokia

private String getConfiguration(ConfigKey pKey) {
  // TODO: Use fragments if available.
  String value = getConfigurationFromConfigAdmin(pKey);
  if (value == null) {
    value = bundleContext.getProperty(CONFIG_PREFIX + "." + pKey.getKeyValue());
  }
  if (value == null) {
    value = pKey.getDefaultValue();
  }
  return value;
}
origin: rhuss/jolokia

/**
 * Update the configuration hold by this object
 *
 * @param pExtractor an extractor for retrieving the configuration from some external object
 */
public void updateGlobalConfiguration(ConfigExtractor pExtractor) {
  Enumeration e = pExtractor.getNames();
  while (e.hasMoreElements()) {
    String keyS = (String) e.nextElement();
    ConfigKey key = ConfigKey.getGlobalConfigKey(keyS);
    if (key != null) {
      globalConfig.put(key,pExtractor.getParameter(keyS));
    }
  }
}
origin: rhuss/jolokia

/**
 * Get processing parameters from a string-string map
 *
 * @param pParams params to extra. A parameter "p" is used as extra path info
 * @return the processing parameters
 */
public ProcessingParameters getProcessingParameters(Map<String,String> pParams) {
  Map<ConfigKey,String> procParams = ProcessingParameters.convertToConfigMap(pParams);
  for (Map.Entry<ConfigKey,String> entry : globalConfig.entrySet()) {
    ConfigKey key = entry.getKey();
    if (key.isRequestConfig() && !procParams.containsKey(key)) {
      procParams.put(key,entry.getValue());
    }
  }
  return new ProcessingParameters(procParams,pParams.get(PATH_QUERY_PARAM));
}
origin: rhuss/jolokia

private String getHostName(InetSocketAddress address) {
  return configuration.getAsBoolean(ConfigKey.ALLOW_DNS_REVERSE_LOOKUP) ? address.getHostName() : null;
}
origin: rhuss/jolokia

/**
 * Get a processing parameter
 *
 * @param pKey key to lookup
 * @return the value or the default value from the key if no config value is set
 */
public String get(ConfigKey pKey) {
  String value = params.get(pKey);
  if (value != null) {
    return value;
  } else {
    return pKey.getDefaultValue();
  }
}
origin: rhuss/jolokia

private String getMimeType(ParsedUri pParsedUri) {
  return MimeTypeUtil.getResponseMimeType(
    pParsedUri.getParameter(ConfigKey.MIME_TYPE.getKeyValue()),
    configuration.get(ConfigKey.MIME_TYPE),
    pParsedUri.getParameter(ConfigKey.CALLBACK.getKeyValue()));
}
origin: rhuss/jolokia

/**
 * Get an configuration value as int value
 * @param pKey the configuration key
 * @return the value set or, if not, the default value
 */
public int getAsInt(ConfigKey pKey) {
  int ret;
  try {
    ret = Integer.parseInt(get(pKey));
  } catch (NumberFormatException exp) {
    ret = Integer.parseInt(pKey.getDefaultValue());
  }
  return ret;
}
origin: rhuss/jolokia

/**
 * Get an configuration value as boolean value. The value must
 * be configured as 'true' for this method to return true
 *
 * @param pKey the configuration key for which a boolean config value is requested
 * @return true if the configuration (or the default value, if the configuration is not set)
 *         is "true" for this key, false otherwise.
 */
public boolean getAsBoolean(ConfigKey pKey) {
  return Boolean.valueOf(get(pKey));
}
origin: rhuss/jolokia

private void sendResponse(HttpExchange pExchange, ParsedUri pParsedUri, JSONAware pJson) throws IOException {
  boolean streaming = configuration.getAsBoolean(ConfigKey.STREAMING);
  if (streaming) {
    JSONStreamAware jsonStream = (JSONStreamAware)pJson;
    sendStreamingResponse(pExchange, pParsedUri, jsonStream);
  } else {
    // Fallback, send as one object
    // TODO: Remove for 2.0
    sendAllJSON(pExchange, pParsedUri, pJson);
  }
}
origin: rhuss/jolokia

/**
 * Get a configuration value if set as configuration or the default
 * value if not
 *
 * @param pKey the configuration key to lookup
 * @return the configuration value or the default value if no configuration
 *         was given.
 */
public String get(ConfigKey pKey) {
  String value = globalConfig.get(pKey);
  if (value == null) {
    value = pKey.getDefaultValue();
  }
  return value;
}
origin: rhuss/jolokia

private void initParameters(ProcessingParameters pParams) {
  processingConfig = pParams;
  String ignoreErrors = processingConfig.get(ConfigKey.IGNORE_ERRORS);
  if (ignoreErrors != null && ignoreErrors.matches("^(true|yes|on|1)$")) {
    valueFaultHandler = ValueFaultHandler.IGNORING_VALUE_FAULT_HANDLER;
  } else {
    valueFaultHandler = ValueFaultHandler.THROWING_VALUE_FAULT_HANDLER;
  }
}
origin: rhuss/jolokia

public AgentDetails(Configuration pConfig) {
  this(NetworkUtil.replaceExpression(pConfig.get(ConfigKey.AGENT_ID)));
  agentDescription = pConfig.get(ConfigKey.AGENT_DESCRIPTION);
}
origin: rhuss/jolokia

/**
 * Get a processing configuration as integer or null
 * if not set
 *
 * @param pConfigKey configuration to lookup
 * @return integer value of configuration or 0 if not set.
 */
public int getParameterAsInt(ConfigKey pConfigKey) {
  String intValueS = processingConfig.get(pConfigKey);
  if (intValueS != null) {
    return Integer.parseInt(intValueS);
  } else {
    return 0;
  }
}
org.jolokia.config

Most used classes

  • Configuration
    Class encapsulating all Agent configuration, global config and processing parameters
  • ConfigKey
    Enumeration defining the various configuration constant names which can be used to configure the age
  • ConfigExtractor
    Interface used for extracting configuration from various backend configuration like SevletContext or
  • ProcessingParameters
    Class encapsulating parameters used during processing
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now