📄 accesslogsamplerbeaninfo.java
字号:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
/*
* Created on May 24, 2004
*
*/
package org.apache.jmeter.protocol.http.sampler;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.util.List;
import org.apache.jmeter.protocol.http.util.accesslog.Filter;
import org.apache.jmeter.protocol.http.util.accesslog.LogParser;
import org.apache.jmeter.testbeans.BeanInfoSupport;
import org.apache.jmeter.testbeans.gui.FileEditor;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.jorphan.reflect.ClassFinder;
import org.apache.log.Logger;
public class AccessLogSamplerBeanInfo extends BeanInfoSupport {
private static final Logger log = LoggingManager.getLoggerForClass();
public AccessLogSamplerBeanInfo() {
super(AccessLogSampler.class);
log.debug("Entered access log sampler bean info");
try {
createPropertyGroup("defaults", // $NON-NLS-1$
new String[] { "domain", "portString", "imageParsing" });// $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
createPropertyGroup("plugins", // $NON-NLS-1$
new String[] { "parserClassName", "filterClassName" }); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
createPropertyGroup("accesslogfile", // $NON-NLS-1$
new String[] { "logFile" }); // $NON-NLS-1$
PropertyDescriptor p;
p = property("parserClassName");
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, AccessLogSampler.DEFAULT_CLASS);
p.setValue(NOT_OTHER, Boolean.TRUE);
p.setValue(NOT_EXPRESSION, Boolean.TRUE);
final List logParserClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { LogParser.class });
if (log.isDebugEnabled()) {
log.debug("found parsers: " + logParserClasses);
}
p.setValue(TAGS, logParserClasses.toArray(new String[0]));
p = property("filterClassName"); // $NON-NLS-1$
p.setValue(NOT_UNDEFINED, Boolean.FALSE);
p.setValue(DEFAULT, ""); // $NON-NLS-1$
p.setValue(NOT_EXPRESSION, Boolean.TRUE);
p.setValue(TAGS, ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
new Class[] { Filter.class }, false).toArray(new String[0]));
p = property("logFile"); // $NON-NLS-1$
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, "");
p.setPropertyEditorClass(FileEditor.class);
p = property("domain"); // $NON-NLS-1$
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, "");
p = property("portString"); // $NON-NLS-1$
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, ""); // $NON-NLS-1$
p = property("imageParsing"); // $NON-NLS-1$
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, Boolean.FALSE);
p.setValue(NOT_OTHER, Boolean.TRUE);
} catch (IOException e) {
log.warn("couldn't find classes and set up properties", e);
throw new RuntimeException("Could not find classes with class finder");
}
log.debug("Got to end of access log samper bean info init");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -