update plugin, which can contains cn
This commit is contained in:
parent
e682f608b5
commit
b2b15ab555
|
@ -147,6 +147,7 @@ public class PluginController extends BaseController {
|
||||||
"addPlugin/{pluginName}/{methodName}");
|
"addPlugin/{pluginName}/{methodName}");
|
||||||
}
|
}
|
||||||
String pluginUIContent = plugin;
|
String pluginUIContent = plugin;
|
||||||
|
System.out.println(pluginUIContent);
|
||||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||||
pluginUIContent));
|
pluginUIContent));
|
||||||
|
|
|
@ -14,17 +14,17 @@ import javax.persistence.Table;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "behaviorInfo")
|
@Table(name = "behaviorInfo")
|
||||||
public class BehaviorInfo extends ParamsContainer {
|
public class BehaviorInfo extends ParamsContainer {
|
||||||
private String behavoirType;
|
private String behaviorType;
|
||||||
private PluginUI pluginUI;
|
private PluginUI pluginUI;
|
||||||
private Set<Group> groups;
|
private Set<Group> groups;
|
||||||
|
|
||||||
@Column(name = "behavoirType")
|
@Column(name = "behaviorType")
|
||||||
public String getBehavoirType() {
|
public String getBehaviorType() {
|
||||||
return behavoirType;
|
return behaviorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBehavoirType(String behavoirType) {
|
public void setBehaviorType(String behaviorType) {
|
||||||
this.behavoirType = behavoirType;
|
this.behaviorType = behaviorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package org.bench4q.master.domain.entity.plugin;
|
package org.bench4q.master.domain.entity.plugin;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="dateType")
|
@Table(name="dateType")
|
||||||
public class DateType extends ParamType {
|
public class DateType extends ParamType {
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
@Column(name="size")
|
@Column(name="size")
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSize(int size) {
|
public void setSize(int size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package org.bench4q.master.domain.entity.plugin;
|
package org.bench4q.master.domain.entity.plugin;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "fileType")
|
@Table(name = "fileType")
|
||||||
public class FileType extends ParamType {
|
public class FileType extends ParamType {
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
@Column(name = "text")
|
@Column(name = "text")
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +1,73 @@
|
||||||
package org.bench4q.master.domain.entity.plugin;
|
package org.bench4q.master.domain.entity.plugin;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "param")
|
@Table(name = "param")
|
||||||
public class ParamInfo {
|
public class ParamInfo {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
private String lable;
|
private String lable;
|
||||||
private ParamType paramType;
|
private ParamType paramType;
|
||||||
private ParamsContainer paramsContainer;
|
private ParamsContainer paramsContainer;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "name", nullable = false)
|
@Column(name = "name", nullable = false)
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "lable")
|
@Column(name = "lable")
|
||||||
public String getLable() {
|
public String getLable() {
|
||||||
return lable;
|
return lable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLable(String lable) {
|
public void setLable(String lable) {
|
||||||
this.lable = lable;
|
this.lable = lable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "typeId", nullable = false)
|
@JoinColumn(name = "typeId", nullable = false)
|
||||||
public ParamType getParamType() {
|
public ParamType getParamType() {
|
||||||
return paramType;
|
return paramType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParamType(ParamType paramType) {
|
public void setParamType(ParamType paramType) {
|
||||||
this.paramType = paramType;
|
this.paramType = paramType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "paramsContainerId", nullable = false)
|
@JoinColumn(name = "paramsContainerId", nullable = false)
|
||||||
public ParamsContainer getParamsContainer() {
|
public ParamsContainer getParamsContainer() {
|
||||||
return paramsContainer;
|
return paramsContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParamsContainer(ParamsContainer paramsContainer) {
|
public void setParamsContainer(ParamsContainer paramsContainer) {
|
||||||
this.paramsContainer = paramsContainer;
|
this.paramsContainer = paramsContainer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +1,64 @@
|
||||||
package org.bench4q.master.domain.entity.plugin;
|
package org.bench4q.master.domain.entity.plugin;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
import javax.persistence.InheritanceType;
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
@Entity
|
@Table(name = "paramsContainer")
|
||||||
@Table(name = "paramsContainer")
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
public abstract class ParamsContainer {
|
||||||
public abstract class ParamsContainer {
|
private int id;
|
||||||
private int id;
|
private String name;
|
||||||
private String name;
|
private String nameCN;
|
||||||
private Set<ParamInfo> params;
|
private Set<ParamInfo> params;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "containerName",nullable=false)
|
@Column(name = "containerName", nullable = false)
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(mappedBy = "paramsContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
@Column(name = "nameCN", nullable = false)
|
||||||
public Set<ParamInfo> getParams() {
|
public String getNameCN() {
|
||||||
return params;
|
return nameCN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParams(Set<ParamInfo> params) {
|
public void setNameCN(String nameCN) {
|
||||||
this.params = params;
|
this.nameCN = nameCN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "paramsContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
}
|
public Set<ParamInfo> getParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParams(Set<ParamInfo> params) {
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ public class PluginUI {
|
||||||
private PluginInfo pluginInfo;
|
private PluginInfo pluginInfo;
|
||||||
private Set<BehaviorInfo> behaviorInfos;
|
private Set<BehaviorInfo> behaviorInfos;
|
||||||
private Date createDateTime;
|
private Date createDateTime;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
|
@ -62,4 +61,5 @@ public class PluginUI {
|
||||||
this.createDateTime = createDateTime;
|
this.createDateTime = createDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
package org.bench4q.master.domain.entity.plugin;
|
package org.bench4q.master.domain.entity.plugin;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.CollectionTable;
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "selectType")
|
@Table(name = "selectType")
|
||||||
public class SelectType extends ParamType {
|
public class SelectType extends ParamType {
|
||||||
private int size;
|
private int size;
|
||||||
private Set<String> options;
|
private Set<String> options;
|
||||||
|
|
||||||
@Column(name = "size")
|
@Column(name = "size")
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSize(int size) {
|
public void setSize(int size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
@CollectionTable(name = "selectOptions", joinColumns = @JoinColumn(name = "select_id"))
|
@CollectionTable(name = "selectOptions", joinColumns = @JoinColumn(name = "select_id"))
|
||||||
@Column(name = "selectOption", nullable = false)
|
@Column(name = "selectOption", nullable = false)
|
||||||
public Set<String> getOptions() {
|
public Set<String> getOptions() {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOptions(Set<String> options) {
|
public void setOptions(Set<String> options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class PluginDomainFactory {
|
||||||
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
||||||
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
||||||
pluginInfoModel.setName(pluginInfo.getName());
|
pluginInfoModel.setName(pluginInfo.getName());
|
||||||
|
pluginInfoModel.setNameCN(pluginInfo.getNameCN());
|
||||||
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
||||||
.getParams()));
|
.getParams()));
|
||||||
pluginInfoModel
|
pluginInfoModel
|
||||||
|
@ -81,6 +82,7 @@ public class PluginDomainFactory {
|
||||||
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
||||||
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
||||||
behaviorInfoModel.setName(behaviorInfo.getName());
|
behaviorInfoModel.setName(behaviorInfo.getName());
|
||||||
|
behaviorInfoModel.setNameCN(behaviorInfo.getNameCN());
|
||||||
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
||||||
.getParams()));
|
.getParams()));
|
||||||
behaviorInfoModel.setGroupModels(createGroupModels(behaviorInfo
|
behaviorInfoModel.setGroupModels(createGroupModels(behaviorInfo
|
||||||
|
@ -141,6 +143,7 @@ public class PluginDomainFactory {
|
||||||
}
|
}
|
||||||
GroupModel groupModel = new GroupModel();
|
GroupModel groupModel = new GroupModel();
|
||||||
groupModel.setName(group.getName());
|
groupModel.setName(group.getName());
|
||||||
|
groupModel.setNameCN(group.getNameCN());
|
||||||
groupModel.setParamInfoModels(createParamInfoModels(group.getParams()));
|
groupModel.setParamInfoModels(createParamInfoModels(group.getParams()));
|
||||||
return groupModel;
|
return groupModel;
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,9 @@ public class PluginEntityFactory {
|
||||||
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
||||||
PluginUI pluginUI) {
|
PluginUI pluginUI) {
|
||||||
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
||||||
behaviorInfo.setBehavoirType(element.getName());
|
behaviorInfo.setBehaviorType(element.getName());
|
||||||
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||||
|
behaviorInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||||
behaviorInfo.setPluginUI(pluginUI);
|
behaviorInfo.setPluginUI(pluginUI);
|
||||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||||
element, "params");
|
element, "params");
|
||||||
|
@ -91,6 +92,7 @@ public class PluginEntityFactory {
|
||||||
|
|
||||||
PluginInfo pluginInfo = new PluginInfo();
|
PluginInfo pluginInfo = new PluginInfo();
|
||||||
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||||
|
pluginInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||||
element, "params");
|
element, "params");
|
||||||
pluginInfo.setGroups(createGroups(
|
pluginInfo.setGroups(createGroups(
|
||||||
|
@ -124,6 +126,8 @@ public class PluginEntityFactory {
|
||||||
Group paramsContainer = new Group();
|
Group paramsContainer = new Group();
|
||||||
paramsContainer.setName(XmlParseHelper.getAttribute(groupElement,
|
paramsContainer.setName(XmlParseHelper.getAttribute(groupElement,
|
||||||
"name"));
|
"name"));
|
||||||
|
paramsContainer.setNameCN(XmlParseHelper.getAttribute(groupElement,
|
||||||
|
"nameCN"));
|
||||||
|
|
||||||
List<Element> paramElements = XmlParseHelper.getChildElementsByName(
|
List<Element> paramElements = XmlParseHelper.getChildElementsByName(
|
||||||
groupElement, "param");
|
groupElement, "param");
|
||||||
|
@ -148,6 +152,7 @@ public class PluginEntityFactory {
|
||||||
}
|
}
|
||||||
return paramInfos;
|
return paramInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParamInfo createParamInfoWithOutId(Element paramElement,
|
private ParamInfo createParamInfoWithOutId(Element paramElement,
|
||||||
ParamsContainer paramsContainer) {
|
ParamsContainer paramsContainer) {
|
||||||
if (!paramElement.getName().equals("param")) {
|
if (!paramElement.getName().equals("param")) {
|
||||||
|
|
|
@ -145,10 +145,8 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
|
||||||
|
|
||||||
@Scheduled(cron = "0,30 */2 * * * *")
|
@Scheduled(cron = "0,30 */2 * * * *")
|
||||||
public synchronized void checkAllHeartBeat() {
|
public synchronized void checkAllHeartBeat() {
|
||||||
long time = System.nanoTime();
|
|
||||||
heartBeatsAndUpdateHAPool();
|
heartBeatsAndUpdateHAPool();
|
||||||
doSubstituteIfRequired();
|
doSubstituteIfRequired();
|
||||||
System.out.println("finish heart beat:" + (System.nanoTime() - time));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void heartBeatsAndUpdateHAPool() {
|
private void heartBeatsAndUpdateHAPool() {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class Test_PluginEntityFactory {
|
||||||
int timerCount = 0;
|
int timerCount = 0;
|
||||||
System.out.println(pluginUI.getBehaviorInfos().size());
|
System.out.println(pluginUI.getBehaviorInfos().size());
|
||||||
for (BehaviorInfo behaviorInfo : pluginUI.getBehaviorInfos()) {
|
for (BehaviorInfo behaviorInfo : pluginUI.getBehaviorInfos()) {
|
||||||
if (behaviorInfo.getBehavoirType().equals("timer"))
|
if (behaviorInfo.getBehaviorType().equals("timer"))
|
||||||
timerCount++;
|
timerCount++;
|
||||||
}
|
}
|
||||||
assertEquals(1, timerCount);
|
assertEquals(1, timerCount);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue