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