001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache license, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the license for the specific language governing permissions and 015 * limitations under the license. 016 */ 017 package org.apache.logging.log4j.spi; 018 019 import java.net.URL; 020 import java.util.Properties; 021 022 /** 023 * 024 */ 025 public class Provider { 026 private static final String FACTORY_PRIORITY = "FactoryPriority"; 027 private static final String THREAD_CONTEXT_MAP = "ThreadContextMap"; 028 private static final String LOGGER_CONTEXT_FACTORY = "LoggerContextFactory"; 029 030 private final Integer priority; 031 private final String className; 032 private final String threadContextMap; 033 private final URL url; 034 035 public Provider(final Properties props, final URL url) { 036 this.url = url; 037 final String weight = props.getProperty(FACTORY_PRIORITY); 038 priority = weight == null ? -1 : Integer.valueOf(weight); 039 className = props.getProperty(LOGGER_CONTEXT_FACTORY); 040 threadContextMap = props.getProperty(THREAD_CONTEXT_MAP); 041 } 042 043 public Integer getPriority() { 044 return priority; 045 } 046 047 public String getClassName() { 048 return className; 049 } 050 051 public String getThreadContextMap() { 052 return threadContextMap; 053 } 054 055 public URL getURL() { 056 return url; 057 } 058 }