예제 #1
0
def main():
    usage = "usage: %prog path/to/config.yaml <print_settings|dump_harvesting|report_points_of_contact|report_distribution_info>"
    option_parser = optparse.OptionParser(usage=usage)
    (options, args) = option_parser.parse_args()

    if len(args) != 2:
        option_parser.error("incorrect number of arguments")

    context = execute_config(args[0])
    with java_vm(context):
        with db_connection(context) as db_statement:
            if args[1] == 'print_settings':
                print_settings(list_settings(db_statement))
            elif args[1] == 'dump_harvesting':
                dump_harvesting_data(context, db_statement)
            elif args[1] == 'report_points_of_contact':
                dump_points_of_contact_report(context, db_statement)
            elif args[1] == 'report_distribution_info':
                dump_distribution_info_report(context, db_statement)
            else:
                option_parser.error("Unknown command %r" % args[1])
예제 #2
0
def main():
    usage = "usage: %prog path/to/config.yaml <print_settings|dump_harvesting|report_points_of_contact|report_distribution_info>"
    option_parser = optparse.OptionParser(usage=usage)
    (options, args) = option_parser.parse_args()

    if len(args) != 2:
        option_parser.error("incorrect number of arguments")

    context = execute_config(args[0])
    with java_vm(context):
        with db_connection(context) as db_statement:
            if args[1] == 'print_settings':
                print_settings(list_settings(db_statement))
            elif args[1] == 'dump_harvesting':
                dump_harvesting_data(context, db_statement)
            elif args[1] == 'report_points_of_contact':
                dump_points_of_contact_report(context, db_statement)
            elif args[1] == 'report_distribution_info':
                dump_distribution_info_report(context, db_statement)
            else:
                option_parser.error("Unknown command %r" % args[1])
예제 #3
0
def list_sources(db_statement):
    settings = list_settings(db_statement)
    harvesting_entry = list(settings.children_with_name('harvesting'))[0]
    for node in harvesting_entry.children_with_name('node'):
        for source_info in parse_source_info(node):
            yield source_info
예제 #4
0
def list_sources(db_statement):
    settings = list_settings(db_statement)
    harvesting_entry = list(settings.children_with_name('harvesting'))[0]
    for node in harvesting_entry.children_with_name('node'):
        for source_info in parse_source_info(node):
            yield source_info