Skip to content

Commit 6ba8f43

Browse files
committed
1 parent f9be7e2 commit 6ba8f43

15 files changed

Lines changed: 2405 additions & 0 deletions

pom.xml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>apijson.framework</groupId>
7+
<artifactId>apijson-framework</artifactId>
8+
<version>4.0.0</version>
9+
<packaging>jar</packaging>
10+
11+
<name>APIJSONFramework</name>
12+
<description>APIJSON Server Framework</description>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
17+
<java.version>1.8</java.version>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>com.alibaba</groupId>
23+
<artifactId>fastjson</artifactId>
24+
<version>1.2.61</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>com.github.APIJSON</groupId>
28+
<artifactId>apijson-orm</artifactId>
29+
<version>4.0.0</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>javax.servlet</groupId>
33+
<artifactId>javax.servlet-api</artifactId>
34+
<version>4.0.1</version>
35+
</dependency>
36+
37+
38+
<!-- 数据库 JDBC 驱动 <<<<<<<<<<< -->
39+
<dependency>
40+
<groupId>mysql</groupId>
41+
<artifactId>mysql-connector-java</artifactId>
42+
<version>8.0.11</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.postgresql</groupId>
46+
<artifactId>postgresql</artifactId>
47+
<version>42.2.5</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>net.sourceforge.jtds</groupId>
51+
<artifactId>jtds</artifactId>
52+
<version>1.3.1</version>
53+
</dependency>
54+
<!-- 数据库 JDBC 驱动 >>>>>>>>>>>> -->
55+
56+
</dependencies>
57+
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-compiler-plugin</artifactId>
63+
<configuration>
64+
<source>1.8</source>
65+
<target>1.8</target>
66+
</configuration>
67+
</plugin>
68+
</plugins>
69+
</build>
70+
71+
<repositories>
72+
<repository>
73+
<id>jitpack.io</id>
74+
<url>https://jitpack.io</url>
75+
</repository>
76+
</repositories>
77+
78+
</project>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package apijson.framework;
16+
17+
import apijson.NotNull;
18+
import apijson.orm.ParserCreator;
19+
import apijson.orm.SQLCreator;
20+
21+
22+
/**SpringBootApplication
23+
* 右键这个类 > Run As > Java Application
24+
* @author Lemon
25+
*/
26+
public class APIJSONApplication {
27+
28+
@NotNull
29+
public static APIJSONCreator DEFAULT_APIJSON_CREATOR;
30+
static {
31+
DEFAULT_APIJSON_CREATOR = new APIJSONCreator();
32+
}
33+
34+
35+
public static void init() throws Exception {
36+
init(true);
37+
}
38+
public static void init(boolean shutdownWhenServerError) throws Exception {
39+
init(shutdownWhenServerError, null, null);
40+
}
41+
public static void init(APIJSONCreator creator) throws Exception {
42+
init(false, creator);
43+
}
44+
public static void init(boolean shutdownWhenServerError, APIJSONCreator creator) throws Exception {
45+
init(shutdownWhenServerError, creator, creator);
46+
}
47+
public static void init(boolean shutdownWhenServerError, ParserCreator<Long> parserCreator, SQLCreator sqlCreator) throws Exception {
48+
System.out.println("\n\n\n\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON 开始启动 >>>>>>>>>>>>>>>>>>>>>>>>\n");
49+
50+
if (parserCreator == null) {
51+
parserCreator = DEFAULT_APIJSON_CREATOR;
52+
}
53+
if (sqlCreator == null) {
54+
sqlCreator = DEFAULT_APIJSON_CREATOR;
55+
}
56+
57+
System.out.println("\n\n\n开始初始化:远程函数配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
58+
try {
59+
APIJSONFunctionParser.init(shutdownWhenServerError, parserCreator);
60+
}
61+
catch (Exception e) {
62+
e.printStackTrace();
63+
}
64+
System.out.println("\n完成初始化:远程函数配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
65+
66+
System.out.println("开始测试:远程函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
67+
try {
68+
APIJSONFunctionParser.test();
69+
}
70+
catch (Exception e) {
71+
e.printStackTrace();
72+
}
73+
System.out.println("\n完成测试:远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
74+
75+
76+
77+
System.out.println("\n\n\n开始初始化:请求校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
78+
try {
79+
StructureUtil.init(shutdownWhenServerError, parserCreator);
80+
}
81+
catch (Exception e) {
82+
e.printStackTrace();
83+
}
84+
System.out.println("\n完成初始化:请求校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
85+
86+
System.out.println("\n\n\n开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
87+
try {
88+
StructureUtil.test(sqlCreator);
89+
}
90+
catch (Exception e) {
91+
e.printStackTrace();
92+
}
93+
System.out.println("\n完成测试:请求校验 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
94+
95+
96+
97+
System.out.println("\n\n\n开始初始化:权限校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
98+
try {
99+
APIJSONVerifier.init(shutdownWhenServerError, parserCreator);
100+
}
101+
catch (Exception e) {
102+
e.printStackTrace();
103+
}
104+
System.out.println("\n完成初始化:权限校验配置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
105+
106+
107+
System.out.println("\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON 启动完成,试试调用自动化 API 吧 ^_^ >>>>>>>>>>>>>>>>>>>>>>>>\n");
108+
}
109+
110+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package apijson.framework;
2+
3+
import apijson.JSONResponse;
4+
import apijson.orm.JSONRequest;
5+
import apijson.orm.Visitor;
6+
import apijson.orm.model.Access;
7+
import apijson.orm.model.Column;
8+
import apijson.orm.model.Document;
9+
import apijson.orm.model.ExtendedProperty;
10+
import apijson.orm.model.Function;
11+
import apijson.orm.model.PgAttribute;
12+
import apijson.orm.model.PgClass;
13+
import apijson.orm.model.Request;
14+
import apijson.orm.model.Response;
15+
import apijson.orm.model.SysColumn;
16+
import apijson.orm.model.SysTable;
17+
import apijson.orm.model.Table;
18+
import apijson.orm.model.Test;
19+
import apijson.orm.model.TestRecord;
20+
21+
public class APIJSONConstant {
22+
23+
public static final String DEFAULTS = "defaults";
24+
public static final String USER_ = "User";
25+
public static final String PRIVACY_ = "Privacy";
26+
public static final String VISITOR_ID = "visitorId";
27+
28+
public static final String ID = JSONRequest.KEY_ID;
29+
public static final String USER_ID = JSONRequest.KEY_USER_ID;
30+
public static final String TAG = JSONRequest.KEY_TAG;
31+
public static final String VERSION = JSONRequest.KEY_VERSION;
32+
public static final String FORMAT = JSONRequest.KEY_FORMAT;
33+
34+
public static final String CODE = JSONResponse.KEY_CODE;
35+
public static final String MSG = JSONResponse.KEY_MSG;
36+
public static final String COUNT = JSONResponse.KEY_COUNT;
37+
public static final String TOTAL = JSONResponse.KEY_TOTAL;
38+
39+
public static final String ACCESS_;
40+
public static final String COLUMN_;
41+
public static final String DOCUMENT_;
42+
public static final String EXTENDED_PROPERTY_;
43+
public static final String FUNCTION_;
44+
public static final String PG_ATTRIBUTE_;
45+
public static final String PG_CLASS_;
46+
public static final String RESPONSE_;
47+
public static final String REQUEST_;
48+
public static final String SYS_COLUMN_;
49+
public static final String SYS_TABLE_;
50+
public static final String TABLE_;
51+
public static final String TEST_;
52+
public static final String TEST_RECORD_;
53+
54+
public static final String VISITOR_;
55+
56+
static {
57+
ACCESS_ = Access.class.getSimpleName();
58+
COLUMN_ = Column.class.getSimpleName();
59+
DOCUMENT_ = Document.class.getSimpleName();
60+
EXTENDED_PROPERTY_ = ExtendedProperty.class.getSimpleName();
61+
FUNCTION_ = Function.class.getSimpleName();
62+
PG_ATTRIBUTE_ = PgAttribute.class.getSimpleName();
63+
PG_CLASS_ = PgClass.class.getSimpleName();
64+
REQUEST_ = Request.class.getSimpleName();
65+
RESPONSE_ = Response.class.getSimpleName();
66+
SYS_COLUMN_ = SysColumn.class.getSimpleName();
67+
SYS_TABLE_ = SysTable.class.getSimpleName();
68+
TABLE_ = Table.class.getSimpleName();
69+
TEST_ = Test.class.getSimpleName();
70+
TEST_RECORD_ = TestRecord.class.getSimpleName();
71+
72+
VISITOR_ = Visitor.class.getSimpleName();
73+
}
74+
75+
76+
77+
}

0 commit comments

Comments
 (0)