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