1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache license, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the license for the specific language governing permissions and 15 * limitations under the license. 16 */ 17 package org.apache.log4j; 18 19 import java.io.InputStream; 20 import java.net.URL; 21 import java.util.Properties; 22 23 import org.apache.log4j.spi.LoggerRepository; 24 25 /** 26 * A configurator for properties. 27 */ 28 public class PropertyConfigurator { 29 30 /** 31 * Read configuration options from configuration file. 32 * 33 * @param configFileName The configuration file 34 * @param hierarchy The hierarchy 35 */ 36 public void doConfigure(final String configFileName, final LoggerRepository hierarchy) { 37 38 } 39 40 /** 41 * Read configuration options from <code>properties</code>. 42 * 43 * See {@link #doConfigure(String, LoggerRepository)} for the expected format. 44 * 45 * @param properties The properties 46 * @param hierarchy The hierarchy 47 */ 48 public void doConfigure(final Properties properties, final LoggerRepository hierarchy) { 49 } 50 51 /** 52 * Read configuration options from an InputStream. 53 * 54 * @param inputStream The input stream 55 * @param hierarchy The hierarchy 56 */ 57 public void doConfigure(final InputStream inputStream, final LoggerRepository hierarchy) { 58 } 59 60 /** 61 * Read configuration options from url <code>configURL</code>. 62 * 63 * @param configURL The configuration URL 64 * @param hierarchy The hierarchy 65 */ 66 public void doConfigure(final java.net.URL configURL, final LoggerRepository hierarchy) { 67 } 68 69 /** 70 * Read configuration options from configuration file. 71 * 72 * @param configFileName The configuration file. 73 */ 74 public static void configure(final String configFileName) { 75 } 76 77 /** 78 * Read configuration options from url <code>configURL</code>. 79 * 80 * @param configURL The configuration URL 81 */ 82 public static void configure(final URL configURL) { 83 } 84 85 /** 86 * Reads configuration options from an InputStream. 87 * 88 * @param inputStream The input stream 89 */ 90 public static void configure(final InputStream inputStream) { 91 } 92 93 /** 94 * Read configuration options from <code>properties</code>. 95 * 96 * See {@link #doConfigure(String, LoggerRepository)} for the expected format. 97 * 98 * @param properties The properties 99 */ 100 public static void configure(final Properties properties) { 101 } 102 103 /** 104 * Like {@link #configureAndWatch(String, long)} except that the 105 * default delay as defined by FileWatchdog.DEFAULT_DELAY is 106 * used. 107 * 108 * @param configFilename A file in key=value format. 109 */ 110 public static void configureAndWatch(final String configFilename) { 111 } 112 113 /** 114 * Read the configuration file <code>configFilename</code> if it 115 * exists. Moreover, a thread will be created that will periodically 116 * check if <code>configFilename</code> has been created or 117 * modified. The period is determined by the <code>delay</code> 118 * argument. If a change or file creation is detected, then 119 * <code>configFilename</code> is read to configure log4j. 120 * 121 * @param configFilename A file in key=value format. 122 * @param delay The delay in milliseconds to wait between each check. 123 */ 124 public static void configureAndWatch(final String configFilename, final long delay) { 125 } 126 }