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