View Javadoc

1   /*
2    * Copyright 2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.ci.config.hudson;
17  
18  import org.jdom.Document;
19  import org.jdom.Element;
20  
21  /**
22   * Base implementation for helper that deal with accessing and manipulating
23   * information in a Hudson configuration XML document.
24   */
25  public abstract class AbstractHudsonConfigHelper
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    // --- members --------------------------------------------------------------
32  
33    /**
34     * The Hudson configuration XML file to add to.
35     */
36    protected final Document hudsonConfig;
37  
38    // ****************************** Initializer *******************************
39  
40    // ****************************** Constructors ******************************
41  
42    /**
43     * Default constructor.
44     *
45     * @param hudsonConfig the Hudson configuration XML file to add to.
46     */
47    protected AbstractHudsonConfigHelper(final Document hudsonConfig)
48    {
49      this.hudsonConfig = hudsonConfig;
50    }
51  
52    // ****************************** Inner Classes *****************************
53  
54    // ********************************* Methods ********************************
55  
56    // --- init -----------------------------------------------------------------
57  
58    // --- get&set --------------------------------------------------------------
59  
60    /**
61     * Returns the Hudson configuration XML file to add to.
62     *
63     * @return the Hudson configuration XML file to add to.
64     */
65    public Document getHudsonConfig()
66    {
67      return hudsonConfig;
68    }
69  
70    // --- business -------------------------------------------------------------
71  
72    /**
73     * Creates an empty Hudson configuration XML document.
74     *
75     * @return an empty Hudson configuration XML document.
76     */
77    public static final Document createDocument()
78    {
79      return new Document(new Element("maven2-moduleset"));
80    }
81  
82    // --- object basics --------------------------------------------------------
83  
84  }