'Return a tuple (jmx_checks, invalid_checks, java_bin_path, java_options, tools_jar_path)
jmx_checks: list of yaml files that are jmx checks
(they have the is_jmx flag enabled or they are in JMX_CHECKS)
and that have at least one instance configured
invalid_checks: dictionary whose keys are check names that are JMX checks but
they have a bad configuration. Values of the dictionary are exceptions generated
when checking the configuration
java_bin_path: is the path to the java executable. It was
previously set in the "instance" part of the yaml file of the
jmx check. So we need to parse yaml files to get it.
We assume that this value is alwayws the same for every jmx check
so we can return the first value returned
java_options: is string contains options that will be passed to java_bin_path
We assume that this value is alwayws the same for every jmx check
so we can return the first value returned
tools_jar_path:  Path to tools.jar, which is only part of the JDK and that is
required to connect to a local JMX instance using the attach api.'

@classmethod
def get_configuration(cls, confd_path, checks_list=None):

    jmx_checks = []
    java_bin_path = None
    java_options = None
    tools_jar_path = None
    custom_jar_paths = []
    invalid_checks = {}
    jmx_confd_checks = get_jmx_checks(confd_path, auto_conf=False)
    for check in jmx_confd_checks:
        check_config = check['check_config']
        check_name = check['check_name']
        filename = check['filename']
        try:
            (is_jmx, check_java_bin_path, check_java_options, check_tools_jar_path, check_custom_jar_paths) = cls._is_jmx_check(check_config, check_name, checks_list)
            if is_jmx:
                jmx_checks.append(filename)
                if ((java_bin_path is None) and (check_java_bin_path is not None)):
                    java_bin_path = check_java_bin_path
                if ((java_options is None) and (check_java_options is not None)):
                    java_options = check_java_options
                if ((tools_jar_path is None) and (check_tools_jar_path is not None)):
                    tools_jar_path = check_tools_jar_path
                if check_custom_jar_paths:
                    custom_jar_paths.extend(check_custom_jar_paths)
        except InvalidJMXConfiguration as e:
            log.error(('%s    check    does    not    have    a    valid    JMX    configuration:    %s' % (check_name, e)))
            check_name = check_name.encode('ascii', 'ignore')
            invalid_checks[check_name] = str(e)
    return (jmx_checks, invalid_checks, java_bin_path, java_options, tools_jar_path, custom_jar_paths)
