com.jfinal.config.Plugins Java Examples

The following examples show how to use com.jfinal.config.Plugins. 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: DemoConfig.java    From sqlhelper with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 配置插件
 */
public void configPlugin(Plugins me) {
	// 配置 druid 数据库连接池插件
	DruidPlugin druidPlugin = new DruidPlugin(p.get("jdbcUrl"), p.get("user"), p.get("password").trim());
	me.add(druidPlugin);
	
	// 配置ActiveRecord插件
	ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin);
	arp.setDialect(new JFinalCommonDialect("h2"));
	// 所有映射在 MappingKit 中自动化搞定
	_MappingKit.mapping(arp);
	me.add(arp);
}
 
Example #3
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
/**
 * Config plugin
 */
public void configPlugin(Plugins me) {
	String[] dses = this.getDataSource();
	for (String ds : dses) {
		if (!this.getDbActiveState(ds)) {
			continue;
		}
		DruidPlugin drp = this.getDruidPlugin(ds);
		me.add(drp);
		ActiveRecordPlugin arp = this.getActiveRecordPlugin(ds, drp);
		me.add(arp);
	}
	// config ModelRedisPlugin
	String[] caches = this.getRedisCaches();
	for (String cache : caches) {
		if (!this.getRedisActiveState(cache)) {
			continue;
		}
		// conf redis plguin
		RedisPlugin rp = null;
		String redisPassword = this.getRedisPassword(cache);
		if (StrKit.isBlank(redisPassword)) {
			rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache));
		} else {
			rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache), this.getRedisPassword(cache));
		}
		me.add(rp);
		// conf redis model plugin
		ModelRedisPlugin mrp = new ModelRedisPlugin(cache, this.getRedisCacheTables(cache));
		me.add(mrp);
	}
	// config others
	configMorePlugins(me);
}
 
Example #4
Source File: WeixinConfig.java    From jfinal-weixin with Apache License 2.0 5 votes vote down vote up
public void configPlugin(Plugins me) {
	// C3p0Plugin c3p0Plugin = new C3p0Plugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
	// me.add(c3p0Plugin);
	
	// EhCachePlugin ecp = new EhCachePlugin();
	// me.add(ecp);
	
	// RedisPlugin redisPlugin = new RedisPlugin("weixin", "127.0.0.1");
	// me.add(redisPlugin);
}
 
Example #5
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 4 votes vote down vote up
public static Plugins getPlugins() {
    return JFinalKit.plugins;
}
 
Example #6
Source File: XlsConfig.java    From jfinal-ext3 with Apache License 2.0 4 votes vote down vote up
@Override
public void configPlugin(Plugins me) {
}
 
Example #7
Source File: JfinalPlugins.java    From jboot with Apache License 2.0 4 votes vote down vote up
public JfinalPlugins(Plugins plugins) {
    this.plugins = plugins;
}
 
Example #8
Source File: JfinalPlugins.java    From jboot with Apache License 2.0 4 votes vote down vote up
public Plugins getPlugins() {
    return plugins;
}
 
Example #9
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
/**
 * Config other more plugin
 */
public abstract void configMorePlugins(Plugins me);
 
Example #10
Source File: StandaloneAppConfig.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMorePlugins(Plugins me) {
	
}
 
Example #11
Source File: TestConfig.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMorePlugins(Plugins me) {
	
}
 
Example #12
Source File: ApiConfigPropDemo.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMorePlugins(Plugins me) {
	
}