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.maven; 17 18 import java.util.Properties; 19 20 import de.smartics.ci.comm.CiController; 21 import de.smartics.ci.comm.command.CommandException; 22 23 24 /** 25 * Check status of a job in hudson ci mojo. 26 * 27 * @goal checkStatusJobs 28 * @requiresProject 29 * @description checks the status of a job in the ci-server. 30 */ 31 public class CheckStatusJobHudsonCiMojo extends AbstractConfigChoiceHudsonCiMojo 32 { 33 // ********************************* Fields ********************************* 34 35 // --- constants ------------------------------------------------------------ 36 37 // --- members -------------------------------------------------------------- 38 39 /** 40 * The xmlQueryString to use for the xml api. 41 * 42 * @parameter expression="${hudson-maven-plugin.xmlQueryString}" 43 * default-value= 44 * "tree=jobs[name]&xpath=hudson/job[name=\"${jobName}\"]/name/text()" 45 * @since 1.0 46 */ 47 private String xmlQueryString; 48 49 // ****************************** Initializer ******************************* 50 51 // ****************************** Constructors ****************************** 52 53 // ****************************** Inner Classes ***************************** 54 55 // ********************************* Methods ******************************** 56 57 // --- init ----------------------------------------------------------------- 58 59 // --- get&set -------------------------------------------------------------- 60 61 // --- business ------------------------------------------------------------- 62 63 /** 64 * {@inheritDoc} 65 * 66 * @throws CommandException 67 */ 68 public final void executeCommand(final String jobName, 69 final String jobConfigString, final CiController controller) 70 throws CommandException 71 { 72 checkStatusJob(controller, jobName); 73 } 74 75 private void checkStatusJob(final CiController controller, 76 final String jobName) throws CommandException 77 { 78 final Properties properties = project.getProperties(); 79 controller.checkStatusJob(jobName, xmlQueryString, properties); 80 } 81 82 // --- object basics -------------------------------------------------------- 83 84 }