<commit_before>/* $Id: FolderWatcher.java,v 1.5 2007/12/04 13:22:01 mke Exp $
 * $Revision: 1.5 $
 * $Date: 2007/12/04 13:22:01 $
 * $Author: mke $
 *
 * The SB Util Library.
 * Copyright (C) 2005-2007  The State and University Library of Denmark
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
/*
 * The State and University Library of Denmark
 * CVS:  $Id: FolderWatcher.java,v 1.5 2007/12/04 13:22:01 mke Exp $
 */
package dk.statsbiblioteket.util.watch;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

import org.apache.log4j.Logger;
import dk.statsbiblioteket.util.qa.QAInfo;
import dk.statsbiblioteket.util.LineReader;

/**
 * Watches folders for content changes, the notifies listeners about these
 * changes. A grace-period can be set: If one or more files are added, the
 * watcher waits a little bit, then checks the file sizes for the added files.
 * If the files have grown, the watcher waits again and so on.
 */
// TODO: Wait until all files have been copied into the changing folder, before notifying
@QAInfo(state=QAInfo.State.QA_NEEDED,
        level=QAInfo.Level.NORMAL,
        author="te")
public class FolderWatcher extends Observable<FolderListener> implements
                                                              Runnable {
    private static Logger log = Logger.getLogger(LineReader.class);

    private File watchedFolder;
    private List<File> oldContent;
    private int pollInterval;
    private boolean watch = true;

     // Waits 200 ms before notifying of additions
    private static final int DEFAULT_GRACE = 200;<commit_msg>Fix logging domain from LineReader to FolderWatcher<commit_after>/* $Id: FolderWatcher.java,v 1.5 2007/12/04 13:22:01 mke Exp $
 * $Revision: 1.5 $
 * $Date: 2007/12/04 13:22:01 $
 * $Author: mke $
 *
 * The SB Util Library.
 * Copyright (C) 2005-2007  The State and University Library of Denmark
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
/*
 * The State and University Library of Denmark
 * CVS:  $Id: FolderWatcher.java,v 1.5 2007/12/04 13:22:01 mke Exp $
 */
package dk.statsbiblioteket.util.watch;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

import org.apache.log4j.Logger;
import dk.statsbiblioteket.util.qa.QAInfo;
import dk.statsbiblioteket.util.LineReader;

/**
 * Watches folders for content changes, the notifies listeners about these
 * changes. A grace-period can be set: If one or more files are added, the
 * watcher waits a little bit, then checks the file sizes for the added files.
 * If the files have grown, the watcher waits again and so on.
 */
// TODO: Wait until all files have been copied into the changing folder, before notifying
@QAInfo(state=QAInfo.State.QA_NEEDED,
        level=QAInfo.Level.NORMAL,
        author="te")
public class FolderWatcher extends Observable<FolderListener> implements
                                                              Runnable {
    private static Logger log = Logger.getLogger(FolderWatcher.class);

    private File watchedFolder;
    private List<File> oldContent;
    private int pollInterval;
    private boolean watch = true;

     // Waits 200 ms before notifying of additions
    private static final int DEFAULT_GRACE = 200;
{'fraction_non_alphanumeric': 0.07641967489972556, 'fraction_numerical': 0.03208781929491239, 'mean_word_length': 3.4156570363466914, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4259723', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1304, 'n_words': 571}