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.doxia.site.inheritance;
20
21 import org.apache.maven.doxia.site.SiteModel;
22
23 /**
24 * Manage inheritance of the site model.
25 *
26 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
27 */
28 public interface SiteModelInheritanceAssembler {
29 /**
30 * Manage inheritance of the site model between a parent and child.
31 *
32 * Any relative links in the parent model will be re-based to work from the merged child
33 * model, otherwise no content from either the parent or child model should be modified.
34 *
35 * @param name a name, used for breadcrumb.
36 * If the parent model contains breadcrumbs and the child doesn't,
37 * a child breadcrumb will be added to the merged model with this name. Not null.
38 * @param child the child SiteModel to be merged with parent.
39 * Not null. If parent == null, the child is unchanged, otherwise
40 * child will contain the merged model upon exit.
41 * @param parent the parent SiteModel. Unchanged upon exit.
42 * May be null in which case the child is not changed.
43 * @param childBaseUrl the child base URL.
44 * May be null, in which case relative links inherited from the parent
45 * will not be resolved in the merged child.
46 * @param parentBaseUrl the parent base URL.
47 * May be null, in which case relative links inherited from the parent
48 * will not be resolved in the merged child.
49 */
50 void assembleModelInheritance(
51 String name, SiteModel child, SiteModel parent, String childBaseUrl, String parentBaseUrl);
52
53 /**
54 * Resolve relative paths for a SiteModel given a base URL.
55 *
56 * Note that 'resolve' here means 'relativize' in the sense of
57 * {@link java.net.URI#relativize(java.net.URI)}, ie if any link in the site model
58 * has a base URL that is equal to the given baseUrl, it is replaced by a relative link
59 * with respect to that base.
60 *
61 * @param siteModel the SiteModel.
62 * Not null.
63 * @param baseUrl the base URL.
64 * May be null in which case the site model is unchanged.
65 */
66 void resolvePaths(SiteModel siteModel, String baseUrl);
67 }