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.io.File; 023 import java.io.IOException; 024 import java.io.InputStream; 025 import java.io.Reader; 026 import java.util.Map; 027 028 import org.apache.maven.model.Model; 029 import org.apache.maven.model.io.ModelReader; 030 import org.apache.maven.model.locator.ModelLocator; 031 import org.codehaus.plexus.component.annotations.Component; 032 import org.codehaus.plexus.component.annotations.Requirement; 033 034 @Component( role = ModelProcessor.class ) 035 public 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 public File locatePom( File projectDirectory ) 058 { 059 return locator.locatePom( projectDirectory ); 060 } 061 062 public Model read( File input, Map<String, ?> options ) 063 throws IOException 064 { 065 return reader.read( input, options ); 066 } 067 068 public Model read( Reader input, Map<String, ?> options ) 069 throws IOException 070 { 071 return reader.read( input, options ); 072 } 073 074 public Model read( InputStream input, Map<String, ?> options ) 075 throws IOException 076 { 077 return reader.read( input, options ); 078 } 079 080 }