Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, QOS.ch. All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
package ch.qos.logback.core.joran.spi;

Author(s):
Ceki Gücü
public class ConfigurationWatchList extends ContextAwareBase {
  public void clear() {
    this. = null;
  }

  
The mainURL for the configuration file. Null values are allowed.

Parameters:
mainURL
  public void setMainURL(URL mainURL) {
    // main url can be null
    this. = mainURL;
    if (mainURL != null)
      addAsFileToWatch(mainURL);
  }
  private void addAsFileToWatch(URL url) {
    File file = convertToFile(url);
    if (file != null) {
      .add(file);
      .add(file.lastModified());
    }
  }
  public void addToWatchList(URL url) {
    addAsFileToWatch(url);
  }
  public URL getMainURL() {
    return ;
  }
    return new ArrayList<File>();
  }
  public boolean changeDetected() {
    int len = .size();
    for (int i = 0; i < leni++) {
      long lastModified = .get(i);
      File file = .get(i);
      if (lastModified != file.lastModified()) {
        return true;
      }
    }
    return false;
    //return (lastModified != fileToScan.lastModified() && lastModified != SENTINEL);
  }
  @SuppressWarnings("deprecation")
  File convertToFile(URL url) {
    String protocol = url.getProtocol();
    if ("file".equals(protocol)) {
      return new File(URLDecoder.decode(url.getFile()));
    } else {
      addInfo("URL [" + url + "] is not of type file");
      return null;
    }
  }
New to GrepCode? Check out our FAQ X