<commit_before>package org.wyona.yanel.impl.scheduler;

import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
//import org.quartz.impl.JobDetailImpl;

import java.util.Date;

import org.apache.log4j.Logger;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import org.wyona.yanel.core.map.Realm;

/**
 * Utility class to schedule jobs per realm
 */
public class QuartzSchedulerUtil {

    private static Logger log = Logger.getLogger(QuartzSchedulerUtil.class);

    /**
     * Schedule jobs based on XML configuration
     * @param scheduler Scheduler instance
     * @param doc XML document containing job configurations
     * @param realm Realm which job(s) is(are) associated with
     */
    public static void schedule(Scheduler scheduler, Document doc, Realm realm) throws Exception {
        String groupName = realm.getID();
        log.info("Add jobs for group/realm '" + groupName + "' to scheduler.");

        Element jobsElement = (Element) doc.getDocumentElement().getElementsByTagName("jobs").item(0);
        String enabled = jobsElement.getAttribute("enabled");
        if (enabled != null && enabled.equals("false")) {
            log.warn("Jobs of group/realm '" + groupName + "' have been disabled.");
            return;
        }

        NodeList jobElements = doc.getDocumentElement().getElementsByTagName("job");
   
        for (int i = 0; i < jobElements.getLength(); i++) {
            Element jobE = (Element) jobElements.item(i);
            log.info("Add job with class: " + jobE.getAttribute("class"));
            String jobName = jobE.getAttribute("name");

            String jobDesc = jobE.getAttribute("description");
            if (jobDesc != null && jobDesc.length() > 0) {
                // INFO: Leave job description as it is.
            } else {
                jobDesc = jobName;<commit_msg>todo added<commit_after>package org.wyona.yanel.impl.scheduler;

import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
//import org.quartz.impl.JobDetailImpl;

import java.util.Date;

import org.apache.log4j.Logger;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import org.wyona.yanel.core.map.Realm;

/**
 * Utility class to schedule jobs per realm
 */
public class QuartzSchedulerUtil {

    private static Logger log = Logger.getLogger(QuartzSchedulerUtil.class);

    /**
     * Schedule jobs based on XML configuration
     * @param scheduler Scheduler instance
     * @param doc XML document containing job configurations
     * @param realm Realm which job(s) is(are) associated with
     */
    public static void schedule(Scheduler scheduler, Document doc, Realm realm) throws Exception {
        String groupName = realm.getID();
        log.info("Add jobs for group/realm '" + groupName + "' to scheduler.");

        Element jobsElement = (Element) doc.getDocumentElement().getElementsByTagName("jobs").item(0);
        String enabled = jobsElement.getAttribute("enabled");
        if (enabled != null && enabled.equals("false")) {
            log.warn("Jobs of group/realm '" + groupName + "' have been disabled.");
            return;
        }

        NodeList jobElements = doc.getDocumentElement().getElementsByTagName("job");
   
        for (int i = 0; i < jobElements.getLength(); i++) {
            Element jobE = (Element) jobElements.item(i);
            log.info("Add job with class: " + jobE.getAttribute("class"));
            String jobName = jobE.getAttribute("name"); // TODO: Maybe it's better to set the name automatically!

            String jobDesc = jobE.getAttribute("description");
            if (jobDesc != null && jobDesc.length() > 0) {
                // INFO: Leave job description as it is.
            } else {
                jobDesc = jobName;
{'fraction_non_alphanumeric': 0.11754252348311754, 'fraction_numerical': 0.003554201574003554, 'mean_word_length': 2.8932806324110674, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7250799', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1104, 'n_words': 297}