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.net.URI;
23  
24  /**
25   * Provides access to the contents of a POM independently of the backing store (e.g. file system, database, memory).
26   * <p>
27   * Unlike {@link ModelSource}, this interface supports loading of parent POM(s) from the same backing store and allows
28   * construction of MavenProject instances without the need to have parent POM(s) available from local or remote
29   * repositories.
30   * <p>
31   * ModelSource2 instances are cached in {@link ModelBuildingRequest#getModelCache()}. Implementations must guarantee
32   * that the connection to the backing store remains active until request's {@link ModelCache} is discarded or flushed.
33   */
34  public interface ModelSource2
35      extends ModelSource
36  {
37      /**
38       * Returns model source identified by a path relative to this model source POM. Implementation <strong>MUST</strong>
39       * be able to accept <code>relPath</code> parameter values that
40       * <ul>
41       * <li>use either / or \ file path separator</li>
42       * <li>have .. parent directory references</li>
43       * <li>point either at file or directory, in the latter case POM file name 'pom.xml' needs to be used by the
44       * requested model source.</li>
45       * </ul>
46       * 
47       * @param relPath is the path of the requested model source relative to this model source POM.
48       * @return related model source or <code>null</code> if no such model source.
49       */
50      ModelSource2 getRelatedSource( String relPath );
51  
52      /**
53       * Returns location of the POM, never <code>null</code>.
54       */
55      URI getLocationURI();
56  }