View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.model.building;
20  
21  import org.apache.maven.model.locator.ModelLocator;
22  
23  /**
24   * Enhancement to the {@link ModelSource2} to support locating POM files using the {@link ModelLocator}
25   * when pointing to a directory.
26   *
27   * @deprecated use {@link org.apache.maven.api.services.ModelBuilder} instead
28   */
29  @Deprecated(since = "4.0.0")
30  public interface ModelSource3 extends ModelSource2 {
31      /**
32       * Returns model source identified by a path relative to this model source POM. Implementation <strong>MUST</strong>
33       * accept <code>relPath</code> parameter values that
34       * <ul>
35       * <li>use either / or \ file path separator</li>
36       * <li>have .. parent directory references</li>
37       * <li>point either at file or directory</li>
38       * </ul>
39       * If the given path points at a directory, the provided {@code ModelLocator} will be used
40       * to find the POM file, else if no locator is provided, a file named 'pom.xml' needs to be
41       * used by the requested model source.
42       *
43       * @param locator locator used to locate the pom file
44       * @param relPath path of the requested model source relative to this model source POM
45       * @return related model source or <code>null</code> if no such model source
46       */
47      ModelSource3 getRelatedSource(ModelLocator locator, String relPath);
48  
49      /**
50       * When using a ModelSource3, the method with a {@code ModelLocator} argument should
51       * be used instead.
52       *
53       * @deprecated use {@link #getRelatedSource(ModelLocator, String)} instead
54       */
55      @Deprecated
56      default ModelSource3 getRelatedSource(String relPath) {
57          return getRelatedSource(null, relPath);
58      }
59  }