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.comm.command; 17 18 import de.smartics.ci.comm.CiSystem; 19 20 /** 21 * The type of the generic job commands. A generic job can be configured to do 22 * anything regarding a job (build, delete, enable, ...). 23 * 24 * @param <T> the concrete type of the command. 25 */ 26 public abstract class AbstractGenericJobCommand<T extends Command<T>> extends 27 AbstractJobCommand<T> 28 { 29 // ********************************* Fields ********************************* 30 31 // --- constants ------------------------------------------------------------ 32 33 // --- members -------------------------------------------------------------- 34 35 // ****************************** Initializer ******************************* 36 37 // ****************************** Constructors ****************************** 38 39 /** 40 * Default constructor. 41 * 42 * @param jobName the name of the job that shall be enabled. 43 */ 44 protected AbstractGenericJobCommand(final String jobName) 45 { 46 super(jobName); 47 } 48 49 // ****************************** Inner Classes ***************************** 50 51 // ********************************* Methods ******************************** 52 53 // --- init ----------------------------------------------------------------- 54 55 // --- get&set -------------------------------------------------------------- 56 57 // --- business ------------------------------------------------------------- 58 59 /** 60 * Executes the command. 61 * 62 * @param target the target to execute the command against. 63 * @throws CommandException signals problems encountered while executing the 64 * command. 65 */ 66 public abstract void execute(final CiSystem target) throws CommandException; 67 68 /** 69 * Returns the result of the execution of this command. When this command has 70 * not been called until now, <code>null</code> is returned. 71 * 72 * @return the result or null. 73 */ 74 public abstract CommandResult<T> getResult(); 75 76 // --- object basics -------------------------------------------------------- 77 78 }