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 */ 017package org.apache.logging.log4j.spi; 018 019import java.net.URL; 020import java.util.Properties; 021 022/** 023 * 024 */ 025public class Provider { 026 private static final Integer DEFAULT_PRIORITY = Integer.valueOf(-1); 027 private static final String FACTORY_PRIORITY = "FactoryPriority"; 028 private static final String THREAD_CONTEXT_MAP = "ThreadContextMap"; 029 private static final String LOGGER_CONTEXT_FACTORY = "LoggerContextFactory"; 030 031 private final Integer priority; 032 private final String className; 033 private final String threadContextMap; 034 private final URL url; 035 036 public Provider(final Properties props, final URL url) { 037 this.url = url; 038 final String weight = props.getProperty(FACTORY_PRIORITY); 039 priority = weight == null ? DEFAULT_PRIORITY : Integer.valueOf(weight); 040 className = props.getProperty(LOGGER_CONTEXT_FACTORY); 041 threadContextMap = props.getProperty(THREAD_CONTEXT_MAP); 042 } 043 044 public Integer getPriority() { 045 return priority; 046 } 047 048 public String getClassName() { 049 return className; 050 } 051 052 public String getThreadContextMap() { 053 return threadContextMap; 054 } 055 056 public URL getURL() { 057 return url; 058 } 059}