All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.easyopen.config.processor.UpdatePermissionConfigProcessor Maven / Gradle / Ivy

Go to download

一个简单易用的接口开放平台,平台封装了常用的参数校验、结果返回等功能,开发者只需实现业务代码即可。https://gitee.com/durcframework/easyopen

There is a newer version: 1.16.20
Show newest version
package com.gitee.easyopen.config.processor;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

import com.gitee.easyopen.ApiContext;
import com.gitee.easyopen.bean.Consts;
import com.gitee.easyopen.config.ConfigClient;
import com.gitee.easyopen.config.NettyOpt;

import io.netty.channel.Channel;

/**
 * 更新权限配置
 * @author tanghc
 */
public class UpdatePermissionConfigProcessor extends AbstractNettyProcessorNoLock {

    public UpdatePermissionConfigProcessor(ConfigClient configClient, NettyOpt nettyOpt) {
        super(configClient, nettyOpt);
    }

    @Override
    protected void doProcess(Channel channel, String data) {
        logger.info("配置中心推送权限设置");
        try {
            String localConfigFile = ApiContext.getApiConfig().getLocalPermissionConfigFile();
            FileUtils.write(new File(localConfigFile), data, Consts.UTF8);
            this.configClient.getPermissionManager().loadPermissionCache(data);
        } catch (IOException e) {
            logger.error("配置中心推送权限写文件失败", e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy