001 package org.apache.maven.model.building; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import java.util.ArrayList; 023 import java.util.List; 024 025 import org.apache.maven.model.InputLocation; 026 import org.apache.maven.model.building.ModelProblem.Severity; 027 028 /** 029 * A simple model problem collector for testing the model building components. 030 * 031 * @author Benjamin Bentmann 032 */ 033 public class SimpleProblemCollector 034 implements ModelProblemCollector 035 { 036 037 private List<String> warnings = new ArrayList<String>(); 038 039 private List<String> errors = new ArrayList<String>(); 040 041 private List<String> fatals = new ArrayList<String>(); 042 043 public List<String> getWarnings() 044 { 045 return warnings; 046 } 047 048 public List<String> getErrors() 049 { 050 return errors; 051 } 052 053 public List<String> getFatals() 054 { 055 return fatals; 056 } 057 058 public void add( Severity severity, String message, InputLocation location, Exception cause ) 059 { 060 switch ( severity ) 061 { 062 case FATAL: 063 fatals.add( message ); 064 break; 065 case ERROR: 066 errors.add( message ); 067 break; 068 case WARNING: 069 warnings.add( message ); 070 break; 071 } 072 073 } 074 075 }