View Javadoc

1   package org.apache.maven.model.building;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.io.IOException;
24  import java.io.InputStream;
25  import java.io.Reader;
26  import java.util.Map;
27  
28  import org.apache.maven.model.Model;
29  import org.apache.maven.model.io.ModelReader;
30  import org.apache.maven.model.locator.ModelLocator;
31  import org.codehaus.plexus.component.annotations.Component;
32  import org.codehaus.plexus.component.annotations.Requirement;
33  
34  @Component( role = ModelProcessor.class )
35  public class DefaultModelProcessor
36      implements ModelProcessor
37  {
38  
39      @Requirement
40      private ModelLocator locator;
41  
42      @Requirement
43      private ModelReader reader;
44  
45      public DefaultModelProcessor setModelLocator( ModelLocator locator )
46      {
47          this.locator = locator;
48          return this;
49      }
50  
51      public DefaultModelProcessor setModelReader( ModelReader reader )
52      {
53          this.reader = reader;
54          return this;
55      }
56  
57      public File locatePom( File projectDirectory )
58      {
59          return locator.locatePom( projectDirectory );
60      }
61  
62      public Model read( File input, Map<String, ?> options )
63          throws IOException
64      {
65          return reader.read( input, options );
66      }
67  
68      public Model read( Reader input, Map<String, ?> options )
69          throws IOException
70      {
71          return reader.read( input, options );
72      }
73  
74      public Model read( InputStream input, Map<String, ?> options )
75          throws IOException
76      {
77          return reader.read( input, options );
78      }
79  
80  }