Tabnine Logo
Configuration.get
Code IndexAdd Tabnine to your IDE (free)

How to use
get
method
in
org.jolokia.config.Configuration

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

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

/**
 * 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

/**
 * Create a new HttpHandler for processing HTTP request
 *
 * @param pConfig     jolokia specific config tuning the processing behaviour
 * @param pLogHandler log-handler the log handler to use for jolokia
 */
public JolokiaHttpHandler(Configuration pConfig, LogHandler pLogHandler) {
  configuration = pConfig;
  context = pConfig.get(ConfigKey.AGENT_CONTEXT);
  if (!context.endsWith("/")) {
    context += "/";
  }
  logHandler = pLogHandler != null ? pLogHandler : createLogHandler(pConfig.get(ConfigKey.LOGHANDLER_CLASS), pConfig.get(ConfigKey.DEBUG));
}
origin: rhuss/jolokia

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

private Map getPluginOptions(Configuration pConfig, LogHandler pLogHandler) {
  String options = pConfig.get(ConfigKey.MBEAN_PLUGIN_OPTIONS);
  try {
    return options != null ? (JSONObject) new JSONParser().parse(options) : new JSONObject();
  } catch (ParseException e) {
    throw new IllegalStateException("Could not parse plugin options '" + options + "' as JSON Objects" + e,e);
  }
}
origin: rhuss/jolokia

private Set<String> extractWhiteList(Configuration pConfig) {
  return extractFrom(pConfig != null ? pConfig.get(ConfigKey.JSR160_PROXY_ALLOWED_TARGETS) : null,
            System.getProperty(ALLOWED_TARGETS_SYSPROP),
            System.getenv(ALLOWED_TARGETS_ENV));
}
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 List<RequestDispatcher> createRequestDispatchers(Configuration pConfig,
                             Converters pConverters,
                             ServerHandle pServerHandle,
                             Restrictor pRestrictor) {
  List<RequestDispatcher> ret = new ArrayList<RequestDispatcher>();
  String classes = pConfig != null ? pConfig.get(DISPATCHER_CLASSES) : null;
  if (classes != null && classes.length() > 0) {
    String[] names = classes.split("\\s*,\\s*");
    for (String name : names) {
      ret.add(createDispatcher(name, pConverters, pServerHandle, pRestrictor, pConfig));
    }
  }
  return ret;
}
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

private void initCustomAuthenticator() {
  String authenticatorClass = jolokiaConfig.get(ConfigKey.AUTH_CLASS);
  if (authenticatorClass != null) {
    try {
      Class authClass = Class.forName(authenticatorClass);
      if (!Authenticator.class.isAssignableFrom(authClass)) {
        throw new IllegalArgumentException("Provided authenticator class [" + authenticatorClass +
                          "] is not a subclass of Authenticator");
      }
      lookupAuthenticator(authClass);
    } catch (ClassNotFoundException e) {
      throw new IllegalArgumentException("Cannot find authenticator class", e);
    }
  }
}
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

private void initLimits(Configuration pConfig) {
  // Max traversal depth
  if (pConfig != null) {
    convertOptionsBuilder = new JsonConvertOptions.Builder(
        getNullSaveIntLimit(pConfig.get(MAX_DEPTH)),
        getNullSaveIntLimit(pConfig.get(MAX_COLLECTION_SIZE)),
        getNullSaveIntLimit(pConfig.get(MAX_OBJECTS))
    );
  } else {
    convertOptionsBuilder = new JsonConvertOptions.Builder();
  }
}
origin: rhuss/jolokia

private static Restrictor createCustomRestrictor(Configuration pConfig) {
  String restrictorClassName = pConfig.get(ConfigKey.RESTRICTOR_CLASS);
  if (restrictorClassName == null) {
    return null;
  }
  Class restrictorClass = ClassUtil.classForName(restrictorClassName);
  if (restrictorClass == null) {
    throw new IllegalArgumentException("No custom restrictor class " + restrictorClassName + " found");
  }
  return lookupRestrictor(pConfig, restrictorClass);
}
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

  /**
   * Get the optional options used for detectors. This should be a JSON string specifying all options
   * for all detectors. Keys are the name of the detector's product, the values are JSON object containing
   * specific parameters for this agent. E.g.
   *
   * <pre>
   *    {
   *        "glassfish" : { "bootAmx": true  }
   *    }
   * </pre>
   *
   *
   * @param pConfig the agent configuration
   * @param pLogHandler a log handler for putting out error messages
   * @return the detector specific configuration
   */
  protected JSONObject getDetectorOptions(Configuration pConfig, LogHandler pLogHandler) {
    String options = pConfig.get(ConfigKey.DETECTOR_OPTIONS);
    try {
      if (options != null) {
          JSONObject opts = (JSONObject) new JSONParser().parse(options);
          return (JSONObject) opts.get(getProduct());
      }
      return null;
    } catch (ParseException e) {
      pLogHandler.error("Could not parse detector options '" + options + "' as JSON object: " + e,e);
    }
    return null;
  }
}
origin: rhuss/jolokia

/**
 * Create a new local dispatcher which accesses local MBeans.
 *
 * @param pConverters object/string converters
 * @param pRestrictor restrictor which checks the access for various operations
 * @param pConfig agent configuration
 * @param pLogHandler local handler used for logging out errors and warnings
 */
public LocalRequestDispatcher(Converters pConverters, Restrictor pRestrictor, Configuration pConfig, LogHandler pLogHandler) {
  // Get all MBean servers we can find. This is done by a dedicated
  // handler object
  mBeanServerHandler = new MBeanServerHandler(pConfig,pLogHandler);
  qualifier = pConfig.get(ConfigKey.MBEAN_QUALIFIER);
  log = pLogHandler;
  agentId = NetworkUtil.replaceExpression(pConfig.get(ConfigKey.AGENT_ID));
  // Request handling manager 
  requestHandlerManager =
      new RequestHandlerManager(pConfig,pConverters,mBeanServerHandler.getServerHandle(),pRestrictor);
}
origin: rhuss/jolokia

/**
 * Start this server. If we manage an own HttpServer, then the HttpServer will
 * be started as well.
 */
public void start() {
  // URL as configured takes precedence
  String configUrl = NetworkUtil.replaceExpression(config.getJolokiaConfig().get(ConfigKey.DISCOVERY_AGENT_URL));
  jolokiaHttpHandler.start(lazy,configUrl != null ? configUrl : url, config.getAuthenticator() != null);
  if (httpServer != null) {
    // Starting our own server in an own thread group with a fixed name
    // so that the cleanup thread can recognize it.
    ThreadGroup threadGroup = new ThreadGroup("jolokia");
    threadGroup.setDaemon(false);
    Thread starterThread = new Thread(threadGroup,new Runnable() {
    @Override
    public void run() {
      httpServer.start();
    }
  });
    starterThread.start();
    cleaner = new CleanupThread(httpServer,threadGroup);
    cleaner.start();
  }
}
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

/**
 * Create a new MBeanServer handler who is responsible for managing multiple intra VM {@link MBeanServer} at once
 * An optional qualifier used for registering this object as an MBean is taken from the given configuration as well
 *
 * @param pConfig configuration for this agent which is also given to the {@see ServerHandle#postDetect()} method for
 *                special initialization.
 *
 * @param pLogHandler log handler used for logging purposes
 */
public MBeanServerHandler(Configuration pConfig, LogHandler pLogHandler) {
  // A qualifier, if given, is used to add the MBean Name of this MBean
  qualifier = pConfig.get(ConfigKey.MBEAN_QUALIFIER);
  List<ServerDetector> detectors = lookupDetectors();
  mBeanServerManager = new MBeanServerExecutorLocal(detectors);
  initServerHandle(pConfig, pLogHandler, detectors);
  initMBean();
  initPlugins(pConfig, pLogHandler);
}
origin: rhuss/jolokia

public static Restrictor createRestrictor(Configuration pConfig, LogHandler logHandler) {
  Restrictor customRestrictor = createCustomRestrictor(pConfig);
  if (customRestrictor != null) {
    logHandler.info("Using restrictor " + customRestrictor.getClass().getCanonicalName());
    return customRestrictor;
  }
  String location = NetworkUtil.replaceExpression(pConfig.get(ConfigKey.POLICY_LOCATION));
  try {
    Restrictor ret = RestrictorFactory.lookupPolicyRestrictor(location);
    if (ret != null) {
      logHandler.info("Using policy access restrictor " + location);
      return ret;
    } else {
      logHandler.info("No access restrictor found, access to any MBean is allowed");
      return new AllowAllRestrictor();
    }
  } catch (IOException e) {
    logHandler.error("Error while accessing access restrictor at " + location +
             ". Denying all access to MBeans for security reasons. Exception: " + e, e);
    return new DenyAllRestrictor();
  }
}
org.jolokia.configConfigurationget

Javadoc

Get a configuration value if set as configuration or the default value if not

Popular methods of Configuration

  • <init>
    Convenience constructor for setting up base configuration with key values pairs. This constructor is
  • getAsBoolean
    Get an configuration value as boolean value. The value must be configured as 'true' for this method
  • getProcessingParameters
    Get processing parameters from a string-string map
  • updateGlobalConfiguration
    Update the configuration hold by this object
  • getAsInt
    Get an configuration value as int value

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • JList (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for Android Studio
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