1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations 15 * under the License. 16 * 17 */ 18 19 package org.apache.jmeter.extractor; 20 21 import org.apache.bsf.BSFException; 22 import org.apache.bsf.BSFManager; 23 import org.apache.jmeter.processor.PostProcessor; 24 import org.apache.jmeter.testbeans.TestBean; 25 import org.apache.jmeter.util.BSFTestElement; 26 import org.apache.jorphan.logging.LoggingManager; 27 import org.apache.log.Logger; 28 29 public class BSFPostProcessor extends BSFTestElement implements Cloneable, PostProcessor, TestBean 30 { 31 private static final Logger log = LoggingManager.getLoggerForClass(); 32 33 private static final long serialVersionUID = 232L; 34 35 public void process(){ 36 try { 37 BSFManager mgr = getManager(); 38 if (mgr == null) { return; } 39 processFileOrScript(mgr); 40 mgr.terminate(); 41 } catch (BSFException e) { 42 log.warn("Problem in BSF script "+e); 43 } 44 } 45 }