mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -34,10 +34,6 @@ public class WallConfig {
|
|||||||
|
|
||||||
private String dir;
|
private String dir;
|
||||||
|
|
||||||
private boolean loadDefault = true;
|
|
||||||
|
|
||||||
private boolean loadExtend = true;
|
|
||||||
|
|
||||||
private boolean inited;
|
private boolean inited;
|
||||||
|
|
||||||
public WallConfig(){
|
public WallConfig(){
|
||||||
@@ -62,54 +58,19 @@ public class WallConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
if (loadDefault) {
|
loadConfig(dir);
|
||||||
loadDefault(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadExtend) {
|
|
||||||
loadExtend(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
inited = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoadDefault() {
|
public void loadConfig(String dir) {
|
||||||
return loadDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoadDefault(boolean loadDefault) {
|
|
||||||
this.loadDefault = loadDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLoadExtend() {
|
|
||||||
return loadExtend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoadExtend(boolean loadExtend) {
|
|
||||||
this.loadExtend = loadExtend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadDefault(String dir) {
|
|
||||||
if (dir.endsWith("/")) {
|
|
||||||
dir = dir.substring(0, dir.length() - 1);
|
|
||||||
}
|
|
||||||
loadResource(getPermitNames(), dir + "/permit-name-default.txt");
|
|
||||||
loadResource(getPermitSchemas(), dir + "/permit-schema-default.txt");
|
|
||||||
loadResource(getPermitFunctions(), dir + "/permit-function-default.txt");
|
|
||||||
loadResource(getPermitTables(), dir + "/permit-table-default.txt");
|
|
||||||
loadResource(getPermitObjects(), dir + "/permit-object-default.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadExtend(String dir) {
|
|
||||||
if (dir.endsWith("/")) {
|
if (dir.endsWith("/")) {
|
||||||
dir = dir.substring(0, dir.length() - 1);
|
dir = dir.substring(0, dir.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadResource(getPermitNames(), dir + "permit-name.txt");
|
loadResource(getPermitNames(), dir + "/permit-name.txt");
|
||||||
loadResource(getPermitSchemas(), dir + "permit-schema.txt");
|
loadResource(getPermitSchemas(), dir + "/permit-schema.txt");
|
||||||
loadResource(getPermitFunctions(), dir + "permit-function.txt");
|
loadResource(getPermitFunctions(), dir + "/permit-function.txt");
|
||||||
loadResource(getPermitTables(), dir + "permit-table.txt");
|
loadResource(getPermitTables(), dir + "/permit-table.txt");
|
||||||
loadResource(getPermitObjects(), dir + "permit-object.txt");
|
loadResource(getPermitObjects(), dir + "/permit-object.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelelctAllow() {
|
public boolean isSelelctAllow() {
|
||||||
|
|||||||
Reference in New Issue
Block a user