com.jfinal.plugin.IPlugin Java Examples

The following examples show how to use com.jfinal.plugin.IPlugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpgradeController.java    From zrlog with Apache License 2.0 6 votes vote down vote up
private CheckVersionResponse getCheckVersionResponse(boolean fetchAble) {
    Plugins plugins = (Plugins) JFinal.me().getServletContext().getAttribute("plugins");
    CheckVersionResponse checkVersionResponse = new CheckVersionResponse();
    for (IPlugin plugin : plugins.getPluginList()) {
        if (plugin instanceof UpdateVersionPlugin) {
            Version version = ((UpdateVersionPlugin) plugin).getLastVersion(fetchAble);
            if (version != null) {
                checkVersionResponse.setUpgrade(true);
                checkVersionResponse.setVersion(version);
            }
        }
    }
    if (checkVersionResponse.getVersion() != null) {
        //不在页面展示SNAPSHOT
        checkVersionResponse.getVersion().setVersion(checkVersionResponse.getVersion().getVersion().replaceAll("-SNAPSHOT", ""));
    }
    return checkVersionResponse;
}
 
Example #2
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
public static void stopPlugin(String pluginName) {
    for (IPlugin iPlugin : pluginList) {
        if (iPlugin.getClass().getSimpleName().equals(pluginName)) {
            iPlugin.stop();
        }
    }
}
 
Example #3
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
public static List<IPlugin> findPlugin(String pluginName) {
    List<IPlugin> plugins = Lists.newArrayList();
    for (IPlugin iPlugin : pluginList) {
        if (iPlugin.getClass().getSimpleName().equals(pluginName)) {
            plugins.add(iPlugin);
        }
    }
    return plugins;
}
 
Example #4
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
public static void startPlugin(String pluginName) {
    for (IPlugin iPlugin : pluginList) {
        if (iPlugin.getClass().getSimpleName().equals(pluginName)) {
            iPlugin.start();
        }
    }
}
 
Example #5
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
public static void restartPlugin(String pluginName) {
    for (IPlugin iPlugin : pluginList) {
        if (iPlugin.getClass().getSimpleName().equals(pluginName)) {
            iPlugin.stop();
            iPlugin.start();
        }
    }
}
 
Example #6
Source File: ZrLogConfig.java    From zrlog with Apache License 2.0 5 votes vote down vote up
/**
 * 重写了JFinal的stop方法,目的是为了,系统正常停止后(如使用sh catalina.sh stop,进行自动更新时),正常关闭插件,防治内存泄漏。
 */
@Override
public void beforeJFinalStop() {
    PluginCoreProcess.getInstance().stopPluginCore();
    for (IPlugin plugin : plugins.getPluginList()) {
        plugin.stop();
    }
}
 
Example #7
Source File: ZrLogConfig.java    From zrlog with Apache License 2.0 5 votes vote down vote up
/**
 * 当安装流程正常执行完成时,调用了该方法,主要用于配置,启动JFinal插件功能,以及相应的Zrlog的插件服务。
 */
public void installFinish() {
    configPlugin(plugins);
    List<IPlugin> pluginList = plugins.getPluginList();
    for (IPlugin plugin : pluginList) {
        plugin.start();
    }
    initDatabaseVersion();
}
 
Example #8
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 4 votes vote down vote up
public static List<IPlugin> findPlugin(Class<? extends IPlugin> plugin) {
    return findPlugin(plugin.getSimpleName());
}
 
Example #9
Source File: JfinalPlugins.java    From jboot with Apache License 2.0 4 votes vote down vote up
public JfinalPlugins add(IPlugin plugin) {
    Aop.inject(plugin);
    plugins.add(plugin);
    return this;
}