001package 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 022import java.io.File; 023import java.io.IOException; 024import java.io.InputStream; 025import java.io.Reader; 026import java.util.Map; 027 028import org.apache.maven.model.Model; 029import org.apache.maven.model.io.ModelReader; 030import org.apache.maven.model.locator.ModelLocator; 031import org.codehaus.plexus.component.annotations.Component; 032import org.codehaus.plexus.component.annotations.Requirement; 033 034@Component( role = ModelProcessor.class ) 035public class DefaultModelProcessor 036 implements ModelProcessor 037{ 038 039 @Requirement 040 private ModelLocator locator; 041 042 @Requirement 043 private ModelReader reader; 044 045 public DefaultModelProcessor setModelLocator( ModelLocator locator ) 046 { 047 this.locator = locator; 048 return this; 049 } 050 051 public DefaultModelProcessor setModelReader( ModelReader reader ) 052 { 053 this.reader = reader; 054 return this; 055 } 056 057 @Override 058 public File locatePom( File projectDirectory ) 059 { 060 return locator.locatePom( projectDirectory ); 061 } 062 063 @Override 064 public Model read( File input, Map<String, ?> options ) 065 throws IOException 066 { 067 return reader.read( input, options ); 068 } 069 070 @Override 071 public Model read( Reader input, Map<String, ?> options ) 072 throws IOException 073 { 074 return reader.read( input, options ); 075 } 076 077 @Override 078 public Model read( InputStream input, Map<String, ?> options ) 079 throws IOException 080 { 081 return reader.read( input, options ); 082 } 083 084}