001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.sift; 015 016import ch.qos.logback.core.Context; 017import ch.qos.logback.core.model.processor.DefaultProcessor; 018import ch.qos.logback.core.model.processor.ModelInterpretationContext; 019 020public class SiftProcessor<E> extends DefaultProcessor { 021 022 023 public SiftProcessor(Context context, ModelInterpretationContext mic) { 024 super(mic.getContext(), mic); 025 } 026 027 ModelInterpretationContext getModelInterpretationContext() { 028 return mic; 029 } 030 031// final static String ONE_AND_ONLY_ONE_URL = CoreConstants.CODES_URL + "#1andOnly1"; 032 033 034// void foo() { 035// this.modelInterpretationContext = new ModelInterpretationContext(context); 036// buildModelInterpretationContext(); 037// DefaultProcessor defaultProcessor = new DefaultProcessor(context, this.modelInterpretationContext); 038// addModelHandlerAssociations(defaultProcessor); 039// 040// } 041 042 043 //abstract public Appender<E> getAppender(); 044 045// int errorEmmissionCount = 0; 046// 047// protected void oneAndOnlyOneCheck(Map<?, ?> appenderMap) { 048// String errMsg = null; 049// if (appenderMap.size() == 0) { 050// errorEmmissionCount++; 051// errMsg = "No nested appenders found within the <sift> element in SiftingAppender."; 052// } else if (appenderMap.size() > 1) { 053// errorEmmissionCount++; 054// errMsg = "Only and only one appender can be nested the <sift> element in SiftingAppender. See also " 055// + ONE_AND_ONLY_ONE_URL; 056// } 057// 058// if (errMsg != null && errorEmmissionCount < CoreConstants.MAX_ERROR_COUNT) { 059// addError(errMsg); 060// } 061// } 062 063// @Override 064// public String toString() { 065// return this.getClass().getName() + "{" + key + "=" + value + '}'; 066// } 067 068}