Skip to content

Commit

Permalink
数据和结构校验类 StructureUtil 整合到 APIJSONVerifier;APIJSONParser 中 IdCallback…
Browse files Browse the repository at this point in the history
… 相关方法移到 APIJSONVerifier;
  • Loading branch information
TommyLemon committed Nov 28, 2020
1 parent 9836b28 commit d929503
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 206 deletions.
26 changes: 13 additions & 13 deletions src/main/java/apijson/framework/APIJSONApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,54 @@ public static void init(boolean shutdownWhenServerError, @NotNull APIJSONCreator
APIJSONController.APIJSON_CREATOR = creator;


System.out.println("\n\n\n开始初始化:权限校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
System.out.println("\n\n\n开始初始化: 权限校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
try {
APIJSONVerifier.init(shutdownWhenServerError, creator);
APIJSONVerifier.initAccess(shutdownWhenServerError, creator);
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("\n完成初始化:权限校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("\n完成初始化: 权限校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");



System.out.println("\n\n\n开始初始化:远程函数配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
System.out.println("\n\n\n开始初始化: 远程函数配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
try {
APIJSONFunctionParser.init(shutdownWhenServerError, creator);
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("\n完成初始化:远程函数配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("\n完成初始化: 远程函数配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

System.out.println("开始测试:远程函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
System.out.println("开始测试: 远程函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
try {
APIJSONFunctionParser.test();
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("\n完成测试:远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("\n完成测试: 远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");



System.out.println("\n\n\n开始初始化:请求校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
System.out.println("\n\n\n开始初始化: 请求结构校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
try {
StructureUtil.init(shutdownWhenServerError, creator);
APIJSONVerifier.initRequest(shutdownWhenServerError, creator);
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("\n完成初始化:请求校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("\n完成初始化: 请求结构校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

System.out.println("\n\n\n开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
System.out.println("\n\n\n开始测试: Request 和 Response 的数据结构校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
try {
StructureUtil.test();
APIJSONVerifier.testStructure();
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("\n完成测试:请求校验 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("\n完成测试: Request 和 Response 的数据结构校验 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");



Expand Down
18 changes: 9 additions & 9 deletions src/main/java/apijson/framework/APIJSONController.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,30 +175,30 @@ public JSONObject reload(String type) {

boolean reloadAll = StringUtil.isEmpty(type, true) || "ALL".equals(type);

if (reloadAll || "FUNCTION".equals(type)) {
if (reloadAll || "ACCESS".equals(type)) {
try {
result.put(FUNCTION_, APIJSONFunctionParser.init());
result.put(ACCESS_, APIJSONVerifier.initAccess());
} catch (ServerException e) {
e.printStackTrace();
result.put(FUNCTION_, APIJSONParser.newErrorResult(e));
result.put(ACCESS_, APIJSONParser.newErrorResult(e));
}
}

if (reloadAll || "REQUEST".equals(type)) {
if (reloadAll || "FUNCTION".equals(type)) {
try {
result.put(REQUEST_, StructureUtil.init());
result.put(FUNCTION_, APIJSONFunctionParser.init());
} catch (ServerException e) {
e.printStackTrace();
result.put(REQUEST_, APIJSONParser.newErrorResult(e));
result.put(FUNCTION_, APIJSONParser.newErrorResult(e));
}
}

if (reloadAll || "ACCESS".equals(type)) {
if (reloadAll || "REQUEST".equals(type)) {
try {
result.put(ACCESS_, APIJSONVerifier.init());
result.put(REQUEST_, APIJSONVerifier.initRequest());
} catch (ServerException e) {
e.printStackTrace();
result.put(ACCESS_, APIJSONParser.newErrorResult(e));
result.put(REQUEST_, APIJSONParser.newErrorResult(e));
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/main/java/apijson/framework/APIJSONParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,5 @@ public void onVerifyContent() throws Exception {
// return 50;
// }

@Override
public String getIdKey(String database, String schema, String table) {
return APIJSONSQLConfig.SIMPLE_CALLBACK.getIdKey(database, schema, table);
}
@Override
public String getUserIdKey(String database, String schema, String table) {
return APIJSONSQLConfig.SIMPLE_CALLBACK.getUserIdKey(database, schema, table);
}
@Override
public Object newId(RequestMethod method, String database, String schema, String table) {
return APIJSONSQLConfig.SIMPLE_CALLBACK.newId(method, database, schema, table);
}

}
Loading

0 comments on commit d929503

Please sign in to comment.