优化目录
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
package com.jsh.erp.config;
|
||||
|
||||
import com.gitee.starblues.integration.application.PluginApplication;
|
||||
import com.gitee.starblues.integration.listener.PluginListener;
|
||||
import com.gitee.starblues.integration.user.PluginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* 插件监听者
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ExamplePluginListener implements PluginListener {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private final PluginUser pluginUser;
|
||||
|
||||
public ExamplePluginListener(PluginApplication pluginApplication){
|
||||
this.pluginUser = pluginApplication.getPluginUser();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registry(String pluginId) {
|
||||
logger.info("Listener: registry pluginId {}", pluginId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegistry(String pluginId) {
|
||||
logger.info("Listener: unRegistry pluginId {}", pluginId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(String pluginId, Throwable throwable) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.jsh.erp.config;
|
||||
|
||||
import com.gitee.starblues.integration.listener.PluginInitializerListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 插件监听者
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class PluginListener implements PluginInitializerListener {
|
||||
@Override
|
||||
public void before() {
|
||||
System.out.println("before");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete() {
|
||||
System.out.println("complete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(Throwable throwable) {
|
||||
System.out.println("failure:"+throwable.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
/**
|
||||
* 插件之间互相调用的类
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CommonParam {
|
||||
|
||||
private String name;
|
||||
private Integer age;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CommonParam{" +
|
||||
"name='" + name + '\'' +
|
||||
", age=" + age +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
/**
|
||||
* 插件之间互相调用的类
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CommonReturn {
|
||||
|
||||
private String returnName;
|
||||
private Boolean result;
|
||||
|
||||
public String getReturnName() {
|
||||
return returnName;
|
||||
}
|
||||
|
||||
public void setReturnName(String returnName) {
|
||||
this.returnName = returnName;
|
||||
}
|
||||
|
||||
public Boolean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Boolean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CommonReturn{" +
|
||||
"returnName='" + returnName + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
/**
|
||||
* 在主程序定义一个接口。插件中可以实现该接口
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ConsoleName {
|
||||
|
||||
/**
|
||||
* 返回名称
|
||||
* @return 输出名称
|
||||
*/
|
||||
String name();
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
import com.gitee.starblues.integration.application.PluginApplication;
|
||||
import com.gitee.starblues.integration.refresh.AbstractPluginSpringBeanRefresh;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 输出名称工厂
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class ConsoleNameFactory extends AbstractPluginSpringBeanRefresh<ConsoleName> {
|
||||
public ConsoleNameFactory(PluginApplication pluginApplication) {
|
||||
super(pluginApplication);
|
||||
pluginApplication.addListener(this);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 默认的主程序输入名称接口实现
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class DefaultConsoleName implements ConsoleName{
|
||||
@Override
|
||||
public String name() {
|
||||
return "My name is Main-start-DefaultConsoleName";
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.jsh.erp.plugin;
|
||||
|
||||
import org.pf4j.ExtensionPoint;
|
||||
|
||||
/**
|
||||
* 测试非Spring管理的bean接口
|
||||
* 实现类需要使用 @Extension 注解
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface Hello extends ExtensionPoint {
|
||||
|
||||
String getName();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user