khammond 01/09/27 21:08:46 Modified: src/org/apache/jmeter/control ModifyController.java Log: Override getGuiClass() to return new ModifyControllerGui class. Revision Changes Path 1.7 +212 -196 jakarta-jmeter/src/org/apache/jmeter/control/ModifyController.java Index: ModifyController.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/control/ModifyController.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ModifyController.java 2001/08/31 00:46:43 1.6 +++ ModifyController.java 2001/09/28 04:08:46 1.7 @@ -1,196 +1,212 @@ -/* - * ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache JMeter" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called "Apache", - * "Apache JMeter", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ -package org.apache.jmeter.control; - -import java.util.*; -import java.io.*; -import org.apache.jmeter.samplers.*; -import org.apache.jmeter.util.ClassFinder; -import org.apache.jmeter.gui.MenuFactory; -import org.apache.jmeter.config.Modifier; -import org.apache.jmeter.config.ResponseBasedModifier; -import org.apache.jmeter.config.ConfigElement; -import org.apache.jmeter.gui.JMeterComponentModel; - -/************************************************************ - * !ToDo (Class description) - * - *@author $Author: mstover1 $ - *@created $Date: 2001/08/31 00:46:43 $ - *@version $Revision: 1.6 $ - ***********************************************************/ -public class ModifyController extends LogicController implements SampleListener, - Serializable -{ - private String currentResponse; - protected List modifiers,responseBasedModifiers; - SampleResult currentResult; - - private static List addableList = null; - - /************************************************************ - * Constructor for the GeneratorManager object - ***********************************************************/ - public ModifyController() - { - modifiers = new LinkedList(); - responseBasedModifiers = new LinkedList(); - } - - /************************************************************ - * Gets the ClassLabel attribute of the GeneratorManager object - * - *@return The ClassLabel value - ***********************************************************/ - public String getClassLabel() - { - return "Modification Manager"; - } - - /************************************************************ - * Find all Generators and make them addable to this Controller - * - *@return The ParserChoices value - ***********************************************************/ - public Collection getAddList() - { - if (addableList == null) - { - addableList = new LinkedList(); - addableList.add(MenuFactory.getLogicControllerMenu()); - addableList.add(MenuFactory.getGenerativeControllerMenu()); - addableList.add(MenuFactory.getModifierMenu()); - addableList.add(MenuFactory.getResponseBasedModifierMenu()); - } - return addableList; - } - - /************************************************************ - * - * Easy method to override if your controller wishes to add itself as - * a listener. Simply call listeners.add(this), and your controller will - * be added, and sub-controllers will also be given a chance to add themselves. - * This is easier than overriding getListeners() and having to replicate - * that logic. - * - *@param listeners The feature to be added to the SelfOrNot attribute - ***********************************************************/ - protected void addSelfOrNot(Collection listeners) - { - listeners.add(this); - } - - /************************************************************ - * Adds a feature to the ConfigElements attribute of the GenericController - * object - * - *@param entry The feature to be added to the ConfigElements attribute - ***********************************************************/ - protected void addConfigElements(Entry entry) - { - if(entry != null) - { - Iterator iter = this.getConfigElements().iterator(); - while(iter.hasNext()) - { - Object item = iter.next(); - if(item instanceof Modifier) - { - ((Modifier)item).modifyEntry(entry); - } - else if(item instanceof ResponseBasedModifier) - { - ((ResponseBasedModifier)item).modifyEntry(entry,currentResult); - } - else - { - entry.addConfigElement((ConfigElement)item); - } - } - } - } - - public Object clone() - { - ModifyController control = new ModifyController(); - Iterator iter = modifiers.iterator(); - while (iter.hasNext()) { - control.addJMeterComponent((JMeterComponentModel)iter.next()); - } - iter = responseBasedModifiers.iterator(); - while (iter.hasNext()) { - control.addJMeterComponent((JMeterComponentModel)iter.next()); - } - super.standardCloneProc(control); - return control; - } - - /** - * Methods to satisfy SampleListener interface. - */ - public void sampleStarted(SampleEvent event) - { - } - - public void sampleStopped(SampleEvent event) - { - } - - public void sampleOccurred(SampleEvent event) - { - this.currentResult = event.getResult(); - } -} - +/* + * ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache JMeter" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache", + * "Apache JMeter", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +package org.apache.jmeter.control; + +import java.util.*; +import java.io.*; + +import org.apache.jmeter.samplers.*; +import org.apache.jmeter.util.ClassFinder; +import org.apache.jmeter.gui.MenuFactory; +import org.apache.jmeter.config.Modifier; +import org.apache.jmeter.config.ResponseBasedModifier; +import org.apache.jmeter.config.ConfigElement; +import org.apache.jmeter.gui.JMeterComponentModel; + +/************************************************************ + * !ToDo (Class description) + * + *@author $Author: khammond $ + *@created $Date: 2001/09/28 04:08:46 $ + *@version $Revision: 1.7 $ + ***********************************************************/ + +public class ModifyController extends LogicController implements SampleListener, + Serializable +{ + private String currentResponse; + protected List modifiers,responseBasedModifiers; + SampleResult currentResult; + private static List addableList = null; + + /************************************************************ + * Constructor for the GeneratorManager object + ***********************************************************/ + public ModifyController() + { + modifiers = new LinkedList(); + responseBasedModifiers = new LinkedList(); + } + + /************************************************************ + * Gets the ClassLabel attribute of the GeneratorManager object + * + *@return The ClassLabel value + ***********************************************************/ + public String getClassLabel() + { + return "Modification Manager"; + } + + /************************************************************ + * Find all Generators and make them addable to this Controller + * + *@return The ParserChoices value + ***********************************************************/ + public Collection getAddList() + { + if (addableList == null) + { + addableList = new LinkedList(); + addableList.add(MenuFactory.getLogicControllerMenu()); + addableList.add(MenuFactory.getGenerativeControllerMenu()); + addableList.add(MenuFactory.getModifierMenu()); + addableList.add(MenuFactory.getResponseBasedModifierMenu()); + } + + return addableList; + } + + /************************************************************ + * + * Easy method to override if your controller wishes to add itself as + * a listener. Simply call listeners.add(this), and your controller will + * be added, and sub-controllers will also be given a chance to add themselves. + * This is easier than overriding getListeners() and having to replicate + * that logic. + * + *@param listeners The feature to be added to the SelfOrNot attribute + ***********************************************************/ + protected void addSelfOrNot(Collection listeners) + { + listeners.add(this); + } + + /************************************************************ + * Adds a feature to the ConfigElements attribute of the GenericController + * object + * + *@param entry The feature to be added to the ConfigElements attribute + ***********************************************************/ + protected void addConfigElements(Entry entry) + { + if(entry != null) + { + Iterator iter = this.getConfigElements().iterator(); + while(iter.hasNext()) + { + Object item = iter.next(); + if(item instanceof Modifier) + { + ((Modifier)item).modifyEntry(entry); + } + else if(item instanceof ResponseBasedModifier) + { + ((ResponseBasedModifier)item).modifyEntry(entry,currentResult); + } + else + { + entry.addConfigElement((ConfigElement)item); + } + } + } + } + + /************************************************************ + *@return The GuiClass value + ***********************************************************/ + public Class getGuiClass() + { + return org.apache.jmeter.control.gui.ModifyControllerGui.class; + } + + public Object clone() + { + ModifyController control = new ModifyController(); + Iterator iter = modifiers.iterator(); + + while (iter.hasNext()) + { + control.addJMeterComponent((JMeterComponentModel)iter.next()); + } + + iter = responseBasedModifiers.iterator(); + + while (iter.hasNext()) + { + control.addJMeterComponent((JMeterComponentModel)iter.next()); + } + + super.standardCloneProc(control); + return control; + } + + /** + * Methods to satisfy SampleListener interface. + */ + public void sampleStarted(SampleEvent event) + { + } + + public void sampleStopped(SampleEvent event) + { + } + + public void sampleOccurred(SampleEvent event) + { + this.currentResult = event.getResult(); + } +}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
