-
Notifications
You must be signed in to change notification settings - Fork 112
BREAKING CHANGE(hubble): upgrade to new version 2.0 [WIP] #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 24 commits
e638ba6
cac690d
2b46abf
96e7f70
5e9e16a
9e1c872
7ce5b0c
35290c6
46231e3
e27f64b
99160e9
6760f2c
acd6948
b7f63de
7b74852
0362086
5a50a92
3a4818d
ba7423e
d3a3afb
5c79ea4
deadd30
b346b81
62e04ca
1c0b6fa
2d86424
137d87f
198a089
8dd679e
b388817
dd19092
8b207b2
abe45ce
cf171ce
5ecbae6
7bd6bc3
54211b8
ae8e62e
1e749b6
229548e
0dac10c
140df68
f385e15
269be6a
fadf4e4
6e1d76b
9a205ff
71b5b32
1bb75cd
75ad6ce
2b8925b
4b8a166
10e95a9
450fb2a
60f650c
f4cd8f8
f2a960f
057f283
85b67f3
6d251f3
3dda528
bbdf31b
d6e0a40
4061f2d
073a3e8
1c7c4bc
b3878d0
433bc62
8226ab6
4f62d5c
3b46c8d
d5b0bc7
7c8c55e
96f4c92
0824574
3025674
42d62d4
c5078ba
5767c30
7cd43dd
cb89f99
9a5e526
ee744bf
56a897a
f03597f
dc66f13
2725dfd
dd560bf
872c8cd
5f2d2f3
446a336
0865f1c
1c6f667
abf123c
bb1a873
0063ff6
f56cadb
9d66b90
a374b3f
b71e165
60b8c5d
97ae2df
1959dd0
c2a5937
065730d
891b627
41182fe
2d9c85e
ce44d2f
4daf310
b88dbe4
3f5eb28
6d00fe1
81faeef
1f02ff5
4715a60
0a337a0
f48e31c
1398deb
17812f9
5cb63d5
7b45e67
6c2ff3b
3d6fc4d
839e112
2f0e033
d0e1cc5
8734732
50eac9b
70c585f
cf149c2
0b2c987
afe4048
f33480d
e5d71f8
e80b1f8
08f099d
9ad47a6
ec14090
5addfcd
49c1a91
16c9962
dfefb70
ce23e66
c29132a
4090a96
4129415
1c2f3ee
4b374ae
3b317f9
955fc17
084eecf
564e155
00adffa
4cc4b16
42c8e09
89f6b78
ba95f40
befacd3
4f371ae
bffdec4
b23fca5
9028817
3810b2c
fe3f86b
d19d7d8
d283b0c
878d5e7
129af43
0bb18ad
3963d24
2b4b312
2e96379
c32a8bb
ba56fdb
3cb593c
6429058
99e1b50
10d6c0d
30c4484
7f1b6be
119b6e5
508c7c6
27c7156
4953245
76521f7
691b30d
836470a
22ca6e0
dd4fd43
4748f88
a6017cd
136554c
5a65c15
fa6eb56
ddb5407
a6f0683
07e2c66
b3b4dbf
044cf89
20ce7b6
99d44bf
3308efd
7a2457a
460a2b0
8035a69
3820257
9b2ef6c
41168f3
cbe0e1f
2545991
f04b22a
bf0d34d
81f28e8
cfdef2e
3d1fe8c
03e89a8
e0c4d76
58bb3a5
035375a
0a445bc
86ccdf4
4e3bdda
7fbe313
1bb505b
ba85ea5
e2a9dd4
9a29f52
6e17aa3
390b7f6
de2e6cf
78a7c5c
f81b23f
1d64607
6194499
0b543e8
671520f
f06e02a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,28 +27,34 @@ | |
| import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
|
||
| import java.time.ZoneOffset; | ||
| import java.util.TimeZone; | ||
|
|
||
| @SpringBootApplication | ||
| @EnableScheduling | ||
| @MapperScan("org.apache.hugegraph.mapper") | ||
| public class HugeGraphHubble extends SpringBootServletInitializer { | ||
|
|
||
| public static void main(String[] args) { | ||
| System.out.println("user.dir ==> " + System.getProperty("user.dir")); | ||
| initEnv(); | ||
| TimeZone.setDefault(TimeZone.getTimeZone(ZoneOffset.of("+8"))); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the zone default +8 should set by config, because the repo not only use in china
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some. infra cant auto transform zone, so maybe wo shouldn't set default zone |
||
| SpringApplication.run(HugeGraphHubble.class, args); | ||
| } | ||
|
|
||
| public static void initEnv() { | ||
| String hubbleHomePath = System.getProperty("hubble.home.path"); | ||
| Ex.check(StringUtils.isNotEmpty(hubbleHomePath), | ||
| "The system property 'hubble.home.path' must be set"); | ||
| "The system property 'hubble.home.path' must be set"); | ||
| String loaderHomePath = System.getProperty("loader.home.path"); | ||
| if (StringUtils.isEmpty(loaderHomePath)) { | ||
| System.setProperty("loader.home.path", hubbleHomePath); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
| protected SpringApplicationBuilder configure( | ||
| SpringApplicationBuilder builder) { | ||
| return builder.sources(this.getClass()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.hugegraph.common; | ||
|
|
||
|
|
||
| import org.apache.hugegraph.type.define.SerialEnum; | ||
|
|
||
| public enum AppName implements SerialEnum { | ||
| GREMLIN(1, "GREMLIN"), | ||
|
|
||
| VERTEX_UPDATE(2, "VERTEX_UPDATE"), | ||
|
|
||
| EDGE_UPDATE(3, "EDGE_UPDATE") | ||
| ; | ||
|
|
||
| private final byte code; | ||
| private final String name; | ||
|
|
||
| static { | ||
| SerialEnum.register(AppName.class); | ||
| } | ||
|
|
||
| AppName(int code, String name) { | ||
| assert code < 256; | ||
| this.code = (byte) code; | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public byte code() { | ||
| return this.code; | ||
| } | ||
|
|
||
| public String string() { | ||
| return this.name; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.hugegraph.common; | ||
|
|
||
|
|
||
| import org.apache.hugegraph.type.define.SerialEnum; | ||
|
|
||
| public enum AppType implements SerialEnum { | ||
| // 通用功能 | ||
| GENERAL(1, "GENERAL"), | ||
|
|
||
| // 定制功能 | ||
| CUSTOMIZED(2, "CUSTOMIZED"), | ||
|
|
||
| ; | ||
|
|
||
| private final byte code; | ||
| private final String name; | ||
|
|
||
| static { | ||
| SerialEnum.register(AppName.class); | ||
| } | ||
|
|
||
| AppType(int code, String name) { | ||
| assert code < 256; | ||
| this.code = (byte) code; | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public byte code() { | ||
| return this.code; | ||
| } | ||
|
|
||
| public String string() { | ||
| return this.name; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,5 +19,4 @@ | |
| package org.apache.hugegraph.common; | ||
|
|
||
| public interface Mergeable { | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.hugegraph.common; | ||
|
|
||
|
|
||
| import org.apache.hugegraph.type.define.SerialEnum; | ||
|
|
||
| public enum OptionType implements SerialEnum { | ||
|
|
||
|
|
||
| DELETE(1, "DELETE"), | ||
|
|
||
| ADD(2, "ADD"), | ||
|
|
||
| UPDATE(3, "UPDATE"), | ||
|
|
||
| ; | ||
|
|
||
| private final byte code; | ||
| private final String name; | ||
|
|
||
| static { | ||
| SerialEnum.register(OptionType.class); | ||
| } | ||
|
|
||
| OptionType(int code, String name) { | ||
| assert code < 256; | ||
| this.code = (byte) code; | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public byte code() { | ||
| return this.code; | ||
| } | ||
|
|
||
| public String string() { | ||
| return this.name; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.hugegraph.config; | ||
|
|
||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.apache.http.HttpRequest; | ||
| import org.apache.http.HttpResponse; | ||
| import org.apache.http.HttpVersion; | ||
| import org.apache.http.entity.StringEntity; | ||
| import org.apache.http.message.BasicHttpResponse; | ||
| import org.apache.hugegraph.common.Constant; | ||
| import org.mitre.dsmiley.httpproxy.ProxyServlet; | ||
|
|
||
| import javax.servlet.http.HttpServletRequest; | ||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.io.IOException; | ||
|
|
||
| public class IngestionProxyServlet extends ProxyServlet { | ||
| @Override | ||
| protected String rewriteQueryStringFromRequest( | ||
| HttpServletRequest servletRequest, String queryString) { | ||
| String username = | ||
| (String) servletRequest.getSession().getAttribute("username"); | ||
|
|
||
| String requestQueryString = servletRequest.getQueryString(); | ||
|
|
||
| if (StringUtils.isEmpty(requestQueryString)) { | ||
| requestQueryString = String.format("user=%s", username); | ||
| } else { | ||
| requestQueryString += String.format("&user=%s", username); | ||
| } | ||
|
|
||
| return requestQueryString; | ||
| } | ||
|
|
||
| @Override | ||
| protected HttpResponse doExecute(HttpServletRequest servletRequest, | ||
| HttpServletResponse servletResponse, | ||
| HttpRequest proxyRequest) throws IOException { | ||
| String username = | ||
| (String) servletRequest.getSession().getAttribute("username"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. magic |
||
|
|
||
| if (username == null) { | ||
| // check user login | ||
| HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, | ||
| Constant.STATUS_OK, | ||
| "{\"status\": 401}"); | ||
|
|
||
| response.setEntity(new StringEntity("{\"status\": 401}")); | ||
|
|
||
| return response; | ||
| } | ||
|
|
||
| return super.doExecute(servletRequest, servletResponse, proxyRequest); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log replace system.out