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.maven; 17 18 import de.smartics.util.lang.Arguments; 19 import de.smartics.util.lang.NullArgumentException; 20 21 /** 22 * Provides access to information of a Maven POM. 23 */ 24 public final class MavenConfig 25 { 26 // ********************************* Fields ********************************* 27 28 // --- constants ------------------------------------------------------------ 29 30 // --- members -------------------------------------------------------------- 31 32 /** 33 * The information provided by the <code>settings.xml</code>. 34 */ 35 private final MavenSettings settings; 36 37 /** 38 * The information provided by the Maven project's <code>pom.xml</code>. 39 */ 40 private final MavenPom pom; 41 42 // ****************************** Initializer ******************************* 43 44 // ****************************** Constructors ****************************** 45 46 /** 47 * Default constructor. 48 * 49 * @param settings the information provided by the <code>settings</code>. 50 * @param pom the information provided by the Maven project's <code>pom</code> 51 * . 52 * @throws NullArgumentException if either {@code settings} or {@code pom} is 53 * <code>null</code>. 54 */ 55 public MavenConfig(final MavenSettings settings, final MavenPom pom) 56 throws NullArgumentException 57 { 58 checkArguments(settings, pom); 59 60 this.settings = settings; 61 this.pom = pom; 62 } 63 64 // ****************************** Inner Classes ***************************** 65 66 // ********************************* Methods ******************************** 67 68 // --- init ----------------------------------------------------------------- 69 70 private void checkArguments(final MavenSettings settings, final MavenPom pom) 71 throws NullArgumentException 72 { 73 Arguments.checkNotNull("settings", settings); 74 Arguments.checkNotNull("pom", pom); 75 } 76 77 // --- get&set -------------------------------------------------------------- 78 79 /** 80 * Returns the information provided by the <code>settings. xml</code>. 81 * 82 * @return the information provided by the <code>settings</code>. 83 */ 84 public MavenSettings getSettings() 85 { 86 return settings; 87 } 88 89 /** 90 * Returns the information provided by the Maven project's 91 * <code>pom. xml</code>. 92 * 93 * @return the information provided by the Maven project's <code>pom</code>. 94 */ 95 public MavenPom getPom() 96 { 97 return pom; 98 } 99 100 // --- business ------------------------------------------------------------- 101 102 // --- object basics -------------------------------------------------------- 103 104 }