com.logicbus.backend.NothingAccessController Maven / Gradle / Ivy
package com.logicbus.backend;
import java.util.Map;
import org.w3c.dom.Element;
import com.alogic.metrics.stream.MetricsCollector;
import com.anysoft.util.Properties;
import com.logicbus.models.catalog.Path;
import com.logicbus.models.servant.ServiceDescription;
/**
* 空访问控制
* @author duanyy
*
* @version 1.2.8.2 [20141015 duanyy]
* - 实现Reportable和MetricsReportable
*
* @version 1.6.3.9 [20150324 duanyy]
* - 修正NothingAccessController无法实例化问题
* @version 1.6.4.35 [20160315 duanyy]
* - 实现XMLConfigurable和Configurable接口
*
* @version 1.6.5.5 [20160515 duanyy]
* - 增加reload接口
*
* @version 1.6.7.4 [20170118 duanyy]
* - 淘汰com.anysoft.metrics包 ,改用新的指标框架
*
* @version 1.6.10.12 [20171211 duanyy]
* - 兼容混合模式
*/
public class NothingAccessController implements AccessController {
@Override
public void reload(String id){
// nothing to do
}
public String createSessionId(Path serviceId, ServiceDescription servant,
Context ctx) {
return ctx.getClientIp() + ":" + serviceId.getPath();
}
public int accessStart(String sessionId, Path serviceId,
ServiceDescription servant, Context ctx) {
return 1;
}
public int accessEnd(String sessionId, Path serviceId,
ServiceDescription servant, Context ctx) {
return 0;
}
@Override
public String [] getGroupList(){
return new String[]{"default"};
}
@Override
public AccessController getGroup(String id){
return this;
}
public void report(Element root) {
if (root != null){
root.setAttribute("module", getClass().getName());
}
}
public void report(Map json) {
if (json != null){
json.put("module", getClass().getName());
}
}
public void report(MetricsCollector collector) {
}
@Override
public void configure(Element e, Properties p) {
}
@Override
public void configure(Properties p) {
}
}