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  /**
35   * DefaultModelProcessor
36   */
37  @Component( role = ModelProcessor.class )
38  public class DefaultModelProcessor
39      implements ModelProcessor
40  {
41  
42      @Requirement
43      private ModelLocator locator;
44  
45      @Requirement
46      private ModelReader reader;
47  
48      public DefaultModelProcessor setModelLocator( ModelLocator locator )
49      {
50          this.locator = locator;
51          return this;
52      }
53  
54      public DefaultModelProcessor setModelReader( ModelReader reader )
55      {
56          this.reader = reader;
57          return this;
58      }
59  
60      @Override
61      public File locatePom( File projectDirectory )
62      {
63          return locator.locatePom( projectDirectory );
64      }
65  
66      @Override
67      public Model read( File input, Map<String, ?> options )
68          throws IOException
69      {
70          return reader.read( input, options );
71      }
72  
73      @Override
74      public Model read( Reader input, Map<String, ?> options )
75          throws IOException
76      {
77          return reader.read( input, options );
78      }
79  
80      @Override
81      public Model read( InputStream input, Map<String, ?> options )
82          throws IOException
83      {
84          return reader.read( input, options );
85      }
86  
87  }