001package ch.qos.logback.core.joran.action; 002 003import org.xml.sax.Attributes; 004 005import ch.qos.logback.core.joran.spi.SaxEventInterpretationContext; 006import ch.qos.logback.core.model.AppenderModel; 007import ch.qos.logback.core.model.Model; 008 009public class AppenderAction extends BaseModelAction { 010 011 @Override 012 protected boolean validPreconditions(SaxEventInterpretationContext ic, String name, Attributes attributes) { 013 PreconditionValidator validator = new PreconditionValidator(this, ic, name, attributes); 014 validator.validateClassAttribute(); 015 validator.validateNameAttribute(); 016 return validator.isValid(); 017 } 018 019 @Override 020 protected Model buildCurrentModel(SaxEventInterpretationContext interpretationContext, String name, 021 Attributes attributes) { 022 AppenderModel appenderModel = new AppenderModel(); 023 appenderModel.setClassName(attributes.getValue(CLASS_ATTRIBUTE)); 024 appenderModel.setName(attributes.getValue(NAME_ATTRIBUTE)); 025 return appenderModel; 026 } 027 028}