1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/Controller.java,v 1.8 2004/02/13 02:21:38 sebb Exp $ 2 /* 3 * Copyright 2001-2004 The Apache Software Foundation. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 package org.apache.jmeter.control; 20 21 import org.apache.jmeter.engine.event.LoopIterationListener; 22 import org.apache.jmeter.samplers.Sampler; 23 import org.apache.jmeter.testelement.TestElement; 24 25 /** 26 * This interface will typically be used in the following manner: 27 * 28 * Controller controller; //gets initialized 29 * while(!controller.isDone() && controller.hasNext()) 30 * { 31 * Sampler sampler = controller.next(); 32 * return sampler; 33 * } 34 * 35 * @author Michael Stover 36 * @author Thad Smith 37 * @version $Revision: 1.8 $ 38 */ 39 public interface Controller extends TestElement 40 { 41 /** 42 * Delivers the next Sampler. 43 * @return org.apache.jmeter.samplers.Sampler 44 */ 45 public Sampler next(); 46 47 /** 48 * Indicates whether the Controller is done delivering Samplers for 49 * the rest of the test. 50 * @return boolean 51 */ 52 public boolean isDone(); 53 54 /** 55 * Controllers have to notify listeners of when they begin an iteration 56 * through their sub-elements. 57 */ 58 public void addIterationListener(LoopIterationListener listener); 59 60 /** 61 * Called to initialize a controller at the beginning of a test 62 * iteration. 63 */ 64 public void initialize(); 65 } 66