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      /** Plexus lookup role. */
32      String ROLE = DecorationModelInheritanceAssembler.class.getName();
33  
34      /**
35       * Manage inheritance of the decoration model between a parent and child.
36       *
37       * Any relative links in the parent model will be re-based to work from the merged child
38       * model, otherwise no content from either the parent or child model should be modified.
39       *
40       * @param name a name, used for breadcrumb.
41       *      If the parent model contains breadcrumbs and the child doesn't,
42       *      a child breadcrumb will be added to the merged model with this name. Not null.
43       * @param child the child DecorationModel to be merged with parent.
44       *      Not null. If parent == null, the child is unchanged, otherwise
45       *      child will contain the merged model upon exit.
46       * @param parent the parent DecorationModel. Unchanged upon exit.
47       *      May be null in which case the child is not changed.
48       * @param childBaseUrl the child 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       * @param parentBaseUrl the parent base URL.
52       *      May be null, in which case relative links inherited from the parent
53       *      will not be resolved in the merged child.
54       */
55      void assembleModelInheritance( String name, DecorationModel child, DecorationModel parent,
56                                     String childBaseUrl, String parentBaseUrl );
57  
58      /**
59       * Resolve relative paths for a DecorationModel given a base URL.
60       *
61       * Note that 'resolve' here means 'relativize' in the sense of
62       * {@link java.net.URI#relativize(java.net.URI)}, ie if any link in the decoration model
63       * has a base URL that is equal to the given baseUrl, it is replaced by a relative link
64       * with respect to that base.
65       *
66       * @param decoration the DecorationModel.
67       *      Not null.
68       * @param baseUrl the base URL.
69       *      May be null in which case the decoration model is unchanged.
70       */
71      void resolvePaths( DecorationModel decoration, String baseUrl );
72  }