public class DefaultPluginOperator extends Object implements PluginOperator
默认的插件操作者
| 限定符和类型 | 字段和说明 |
|---|---|
protected IntegrationConfiguration |
integrationConfiguration |
protected org.slf4j.Logger |
log |
protected PluginFactory |
pluginFactory |
protected PluginInitializerListenerFactory |
pluginInitializerListenerFactory |
protected PluginLegalVerify |
pluginLegalVerify |
protected org.pf4j.PluginManager |
pluginManager |
| 构造器和说明 |
|---|
DefaultPluginOperator(org.springframework.context.ApplicationContext applicationContext,
IntegrationConfiguration integrationConfiguration,
org.pf4j.PluginManager pluginManager,
PluginListenerFactory pluginListenerFactory) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected boolean |
backup(Path sourcePath,
String sign,
int type)
备份
|
boolean |
backupPlugin(Path path,
String sign)
通过路径备份文件。
|
boolean |
backupPlugin(String pluginId,
String sign)
通过插件id备份插件。
|
protected String |
getNowTimeByFormat()
获取现在的时间
|
Set<String> |
getPluginFilePaths()
得到插件文件的路径 [适用于生产环境]
|
List<PluginInfo> |
getPluginInfo()
获取插件信息 [适用于生产环境、开发环境]
|
PluginInfo |
getPluginInfo(String pluginId)
根据插件id获取插件信息 [适用于生产环境、开发环境]
|
List<org.pf4j.PluginWrapper> |
getPluginWrapper()
得到所有插件的包装类 [适用于生产环境、开发环境]
|
org.pf4j.PluginWrapper |
getPluginWrapper(String pluginId)
通过插件id得到插件的包装类 [适用于生产环境、开发环境]
|
protected org.pf4j.PluginWrapper |
getPluginWrapper(String pluginId,
String errorMsg)
得到插件包装类
|
void |
initPlugins(PluginInitializerListener pluginInitializerListener)
初始化插件。
|
boolean |
install(Path path)
通过路径安装插件(会启用), 该插件文件必须存在于服务器 [适用于生产环境]
如果在插件目录存在同名的插件包, 系统会自动备份该插件包。
|
boolean |
installConfigFile(Path path)
通过路径安装插件的配置文件。
|
protected boolean |
isDev()
是否是开发环境
|
void |
setUploadPluginVerify(PluginLegalVerify uploadPluginVerify)
设置插件校验器
|
boolean |
start(String pluginId)
启用插件 [适用于生产环境、开发环境]
|
boolean |
stop(String pluginId)
停止插件 [适用于生产环境、开发环境]
|
boolean |
uninstall(String pluginId,
boolean isBackup)
卸载插件 [适用于生产环境]
|
boolean |
uploadConfigFile(org.springframework.web.multipart.MultipartFile configFile)
上传配置文件。
|
protected Path |
uploadPlugin(org.springframework.web.multipart.MultipartFile pluginFile)
上传插件
|
boolean |
uploadPluginAndStart(org.springframework.web.multipart.MultipartFile pluginFile)
上传插件并启用插件。
|
protected void |
verifyFailureDelete(Path tempPluginFile,
Exception e)
校验文件失败后, 删除临时文件
|
protected final org.slf4j.Logger log
protected final IntegrationConfiguration integrationConfiguration
protected final org.pf4j.PluginManager pluginManager
protected final PluginFactory pluginFactory
protected final PluginInitializerListenerFactory pluginInitializerListenerFactory
protected PluginLegalVerify pluginLegalVerify
public DefaultPluginOperator(org.springframework.context.ApplicationContext applicationContext,
IntegrationConfiguration integrationConfiguration,
org.pf4j.PluginManager pluginManager,
PluginListenerFactory pluginListenerFactory)
public void setUploadPluginVerify(PluginLegalVerify uploadPluginVerify)
uploadPluginVerify - uploadPluginVerifypublic void initPlugins(PluginInitializerListener pluginInitializerListener)
PluginOperatorinitPlugins 在接口中 PluginOperatorpluginInitializerListener - 插件初始化监听者public boolean install(Path path)
PluginOperatorinstall 在接口中 PluginOperatorpath - 插件路径public boolean uninstall(String pluginId, boolean isBackup)
PluginOperatoruninstall 在接口中 PluginOperatorpluginId - 插件idisBackup - 是否备份原来的插件。备份文件命名规则为;[uninstall][时间]_原jar名.jarpublic boolean start(String pluginId)
PluginOperatorstart 在接口中 PluginOperatorpluginId - 插件idpublic boolean stop(String pluginId)
PluginOperatorstop 在接口中 PluginOperatorpluginId - 插件idpublic boolean uploadPluginAndStart(org.springframework.web.multipart.MultipartFile pluginFile)
PluginOperatoruploadPluginAndStart 在接口中 PluginOperatorpluginFile - 配置文件public boolean installConfigFile(Path path)
PluginOperatorinstallConfigFile 在接口中 PluginOperatorpath - 配置文件路径。public boolean uploadConfigFile(org.springframework.web.multipart.MultipartFile configFile)
PluginOperatoruploadConfigFile 在接口中 PluginOperatorconfigFile - 配置文件public boolean backupPlugin(Path path, String sign)
PluginOperatorbackupPlugin 在接口中 PluginOperatorpath - 路径sign - 备份文件的自定义标识public boolean backupPlugin(String pluginId, String sign)
PluginOperatorbackupPlugin 在接口中 PluginOperatorpluginId - 插件idsign - 备份文件的自定义标识public List<PluginInfo> getPluginInfo()
PluginOperatorgetPluginInfo 在接口中 PluginOperatorpublic PluginInfo getPluginInfo(String pluginId)
PluginOperatorgetPluginInfo 在接口中 PluginOperatorpluginId - 插件idpublic Set<String> getPluginFilePaths()
PluginOperatorgetPluginFilePaths 在接口中 PluginOperatorpublic List<org.pf4j.PluginWrapper> getPluginWrapper()
PluginOperatorgetPluginWrapper 在接口中 PluginOperatorpublic org.pf4j.PluginWrapper getPluginWrapper(String pluginId)
PluginOperatorgetPluginWrapper 在接口中 PluginOperatorpluginId - 插件idprotected Path uploadPlugin(org.springframework.web.multipart.MultipartFile pluginFile)
pluginFile - 插件文件protected org.pf4j.PluginWrapper getPluginWrapper(String pluginId, String errorMsg)
pluginId - 插件iderrorMsg - 错误信息protected void verifyFailureDelete(Path tempPluginFile, Exception e)
tempPluginFile - 临时文件路径e - 异常信息protected boolean backup(Path sourcePath, String sign, int type)
sourcePath - 源文件的路径sign - 文件标志type - 类型 1移动 2拷贝protected String getNowTimeByFormat()
protected boolean isDev()
Copyright © 2020. All rights reserved.