add Plugin's dtd and scvProvider definition xml
add Plugin's dtd and scvProvider definition xml
This commit is contained in:
parent
bc269cfbfc
commit
0238c8d91c
|
@ -91,7 +91,11 @@
|
|||
<artifactId>hadoop-core</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jdom</groupId>
|
||||
<artifactId>jdom</artifactId>
|
||||
<version>b7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -78,4 +78,9 @@ public class PluginController {
|
|||
return model;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public void info() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,5 @@ public @interface Parameter {
|
|||
String value();
|
||||
|
||||
SupportTypes type();
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.log4j.Logger;
|
|||
import org.bench4q.agent.helper.ClassHelper;
|
||||
import org.bench4q.agent.helper.ClassLoadRestriction;
|
||||
import org.bench4q.agent.share.DealWithLog;
|
||||
import org.jdom.input.SAXBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -19,11 +20,21 @@ public class PluginManager {
|
|||
private static final String PLUGIN_PACKAGE_NAME = "org.bench4q.agent.plugin";
|
||||
private ClassHelper classHelper;
|
||||
private TypeConverter typeConverter;
|
||||
private SAXBuilder saxBuilder;
|
||||
private Map<String, Class<?>> plugins;
|
||||
private Logger logger = Logger.getLogger(PluginManager.class);
|
||||
|
||||
private SAXBuilder getSaxBuilder() {
|
||||
return saxBuilder;
|
||||
}
|
||||
|
||||
private void setSaxBuilder(SAXBuilder saxBuilder) {
|
||||
this.saxBuilder = saxBuilder;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public PluginManager(ClassHelper classHelper, TypeConverter typeConverter) {
|
||||
this.setSaxBuilder(new SAXBuilder());
|
||||
this.setClassHelper(classHelper);
|
||||
this.setTypeConverter(typeConverter);
|
||||
this.setPlugins(this.getClassHelper().loadClasses(PLUGIN_PACKAGE_NAME,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.bench4q.agent.plugin;
|
||||
|
||||
public @interface Property {
|
||||
String key();
|
||||
|
||||
String value();
|
||||
}
|
|
@ -12,6 +12,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bench4q.agent.plugin.BaseParameterization;
|
||||
import org.bench4q.agent.plugin.Behavior;
|
||||
import org.bench4q.agent.plugin.Constructor;
|
||||
import org.bench4q.agent.plugin.Parameter;
|
||||
import org.bench4q.agent.plugin.Plugin;
|
||||
|
@ -129,6 +130,7 @@ public class CsvProvider extends BaseParameterization {
|
|||
}
|
||||
}
|
||||
|
||||
@Behavior(value = "reset")
|
||||
public void reset() {
|
||||
position = -1;
|
||||
currentValues = null;
|
||||
|
@ -148,6 +150,7 @@ public class CsvProvider extends BaseParameterization {
|
|||
}
|
||||
}
|
||||
|
||||
@Behavior(value = "next")
|
||||
public void doNext() {
|
||||
if (shared) {
|
||||
position = parent.position;
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE ui SYSTEM "../../dtd/ui.dtd">
|
||||
<ui>
|
||||
<plugin name="CsvProvider">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="separator"
|
||||
label="The separator of the input file and the following fieldNames">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="fieldNames" label="fields names:">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="shared" label="to share the file descriptor">
|
||||
<checkbox>
|
||||
<choice value="enable" default="false" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loop" label="when to the EOF, is in loop">
|
||||
<checkbox>
|
||||
<choice value="enable" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="next">
|
||||
<params />
|
||||
</behavior>
|
||||
<behavior name="reset">
|
||||
<params />
|
||||
</behavior>
|
||||
</ui>
|
|
@ -0,0 +1,41 @@
|
|||
<!ELEMENT ui (plugin,(behavior|timer)*)>
|
||||
<!ELEMENT plugin (params)>
|
||||
<!ATTLIST plugin
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT behavior (params)>
|
||||
<!ATTLIST behavior
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT timer (params)>
|
||||
<!ATTLIST timer
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT params (param|group)*>
|
||||
<!ELEMENT param (radiobutton|field|checkbox|nfield|combo|table)>
|
||||
<!ATTLIST param
|
||||
name CDATA #REQUIRED
|
||||
label CDATA #IMPLIED
|
||||
>
|
||||
<!ELEMENT group (param|group)*>
|
||||
<!ATTLIST group
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT radiobutton (choice*)>
|
||||
<!ELEMENT choice EMPTY>
|
||||
<!ATTLIST choice
|
||||
value CDATA #REQUIRED
|
||||
default (true|false) "false"
|
||||
>
|
||||
<!ELEMENT checkbox (choice*)>
|
||||
<!ELEMENT field EMPTY>
|
||||
<!ATTLIST field
|
||||
size CDATA #REQUIRED
|
||||
text CDATA ""
|
||||
>
|
||||
<!ELEMENT nfield EMPTY>
|
||||
<!ELEMENT table EMPTY>
|
||||
<!ATTLIST table
|
||||
cols CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT combo (choice*)>
|
Loading…
Reference in New Issue