From 6efc446daa98d5732da7d6e308b064417aa9ccdd Mon Sep 17 00:00:00 2001 From: M <1216063060@qq.com> Date: Thu, 8 Feb 2024 21:04:21 +0800 Subject: [PATCH 01/13] format&clean code in api --- .../java/org/apache/hugegraph/api/API.java | 15 +- .../hugegraph/api/arthas/ArthasAPI.java | 1 - .../apache/hugegraph/api/auth/AccessAPI.java | 36 +- .../apache/hugegraph/api/auth/BelongAPI.java | 34 +- .../apache/hugegraph/api/auth/GroupAPI.java | 34 +- .../apache/hugegraph/api/auth/ProjectAPI.java | 36 +- .../apache/hugegraph/api/auth/TargetAPI.java | 32 +- .../apache/hugegraph/api/auth/UserAPI.java | 36 +- .../hugegraph/api/cypher/CypherAPI.java | 1 - .../hugegraph/api/cypher/CypherClient.java | 26 +- .../hugegraph/api/cypher/CypherModel.java | 2 + .../api/filter/AuthenticationFilter.java | 10 +- .../api/filter/CompressInterceptor.java | 19 +- .../api/filter/DecompressInterceptor.java | 3 +- .../hugegraph/api/filter/ExceptionFilter.java | 52 +-- .../api/filter/LoadDetectFilter.java | 35 +- .../api/filter/LoadReleaseFilter.java | 4 +- .../hugegraph/api/filter/RedirectFilter.java | 1 + .../hugegraph/api/filter/StatusFilter.java | 3 +- .../apache/hugegraph/api/graph/BatchAPI.java | 22 +- .../apache/hugegraph/api/graph/EdgeAPI.java | 80 ++-- .../apache/hugegraph/api/graph/VertexAPI.java | 62 +-- .../api/gremlin/AbstractJerseyRestClient.java | 2 +- .../hugegraph/api/gremlin/GremlinAPI.java | 16 +- .../api/gremlin/GremlinQueryAPI.java | 1 + .../hugegraph/api/job/AlgorithmAPI.java | 1 - .../apache/hugegraph/api/job/GremlinAPI.java | 4 +- .../org/apache/hugegraph/api/job/TaskAPI.java | 12 +- .../hugegraph/api/metrics/MetricsAPI.java | 1 - .../hugegraph/api/profile/GraphsAPI.java | 48 +- .../hugegraph/api/profile/ProfileAPI.java | 31 +- .../hugegraph/api/profile/VersionAPI.java | 19 +- .../hugegraph/api/profile/WhiteIpListAPI.java | 6 +- .../apache/hugegraph/api/raft/RaftAPI.java | 34 +- .../api/traversers/AdamicAdarAPI.java | 21 +- .../hugegraph/api/traversers/CountAPI.java | 22 +- .../api/traversers/EdgeExistenceAPI.java | 1 - .../api/traversers/NeighborRankAPI.java | 22 +- .../api/traversers/PersonalRankAPI.java | 20 +- .../api/traversers/ResourceAllocationAPI.java | 21 +- .../hugegraph/api/traversers/Vertices.java | 10 +- .../hugegraph/api/variables/VariablesAPI.java | 22 +- .../hugegraph/auth/ConfigAuthenticator.java | 5 +- .../hugegraph/auth/ContextGremlinServer.java | 8 +- .../hugegraph/auth/HugeAuthenticator.java | 10 +- .../hugegraph/auth/HugeFactoryAuthProxy.java | 441 ++++++++++++++---- .../hugegraph/auth/HugeGraphAuthProxy.java | 72 +-- .../hugegraph/auth/StandardAuthenticator.java | 7 +- .../auth/WsAndHttpBasicAuthHandler.java | 10 +- .../hugegraph/config/ServerOptions.java | 48 +- .../apache/hugegraph/core/GraphManager.java | 16 +- .../hugegraph/define/UpdateStrategy.java | 9 +- .../hugegraph/metrics/MetricsModule.java | 2 +- .../hugegraph/metrics/ServerReporter.java | 5 +- .../hugegraph/metrics/SystemMetrics.java | 5 +- .../opencypher/CypherOpProcessor.java | 38 +- .../hugegraph/opencypher/CypherPlugin.java | 28 +- .../rpc/RpcClientProviderWithAuth.java | 3 +- .../hugegraph/server/ApplicationConfig.java | 32 +- .../apache/hugegraph/server/RestServer.java | 21 +- 60 files changed, 956 insertions(+), 662 deletions(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java index 444549a805..b7f564e8d8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java @@ -48,22 +48,23 @@ public class API { public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN; public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON; public static final String APPLICATION_JSON_WITH_CHARSET = - APPLICATION_JSON + ";charset=" + CHARSET; - public static final String APPLICATION_TEXT_WITH_CHARSET = MediaType.TEXT_PLAIN + ";charset=" + CHARSET; + APPLICATION_JSON + ";charset=" + CHARSET; + public static final String APPLICATION_TEXT_WITH_CHARSET = + MediaType.TEXT_PLAIN + ";charset=" + CHARSET; public static final String JSON = MediaType.APPLICATION_JSON_TYPE - .getSubtype(); + .getSubtype(); public static final String ACTION_APPEND = "append"; public static final String ACTION_ELIMINATE = "eliminate"; public static final String ACTION_CLEAR = "clear"; protected static final Logger LOG = Log.logger(API.class); private static final Meter SUCCEED_METER = - MetricsUtil.registerMeter(API.class, "commit-succeed"); + MetricsUtil.registerMeter(API.class, "commit-succeed"); private static final Meter ILLEGAL_ARG_ERROR_METER = - MetricsUtil.registerMeter(API.class, "illegal-arg"); + MetricsUtil.registerMeter(API.class, "illegal-arg"); private static final Meter EXPECTED_ERROR_METER = - MetricsUtil.registerMeter(API.class, "expected-error"); + MetricsUtil.registerMeter(API.class, "expected-error"); private static final Meter UNKNOWN_ERROR_METER = - MetricsUtil.registerMeter(API.class, "unknown-error"); + MetricsUtil.registerMeter(API.class, "unknown-error"); public static HugeGraph graph(GraphManager manager, String graph) { HugeGraph g = manager.graph(graph); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index cb819057ca..7cd9a98f8a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -29,7 +29,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java index 75dbad7fb0..5c07681da8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java @@ -19,37 +19,37 @@ import java.util.List; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import jakarta.inject.Singleton; -import jakarta.ws.rs.Path; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.HugeAccess; import org.apache.hugegraph.auth.HugePermission; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/accesses") @Singleton @Tag(name = "AccessAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java index 7880e434eb..da66c0cecc 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java @@ -19,7 +19,24 @@ import java.util.List; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeBelong; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -32,23 +49,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import jakarta.inject.Singleton; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeBelong; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/belongs") @Singleton @Tag(name = "BelongAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java index e70c88d316..f0ac7f6ea2 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java @@ -19,7 +19,24 @@ import java.util.List; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeGroup; +import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -32,23 +49,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import jakarta.inject.Singleton; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeGroup; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/groups") @Singleton @Tag(name = "GroupAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java index 1f048e9a01..c90323ef97 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java @@ -21,39 +21,39 @@ import java.util.List; import java.util.Set; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.AuthManager; import org.apache.hugegraph.auth.HugeProject; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/projects") @Singleton @Tag(name = "ProjectAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java index c13fff1517..eb52e455c1 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java @@ -20,6 +20,22 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeTarget; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; @@ -34,22 +50,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeTarget; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/targets") @Singleton @Tag(name = "TargetAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java index 25d812104f..ed26573f83 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java @@ -19,39 +19,39 @@ import java.util.List; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.HugeUser; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.StringEncoding; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/users") @Singleton @Tag(name = "UserAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java index c8cc3929fd..b24169aaaf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java @@ -34,7 +34,6 @@ import com.codahale.metrics.annotation.Timed; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java index eb3a86ff65..92ae18c54d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java @@ -17,16 +17,6 @@ package org.apache.hugegraph.api.cypher; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.commons.configuration2.Configuration; -import org.apache.tinkerpop.gremlin.driver.*; -import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; -import org.slf4j.Logger; - -import javax.annotation.Nullable; -import javax.annotation.concurrent.ThreadSafe; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -35,6 +25,20 @@ import java.util.concurrent.ExecutionException; import java.util.function.Supplier; +import javax.annotation.Nullable; +import javax.annotation.concurrent.ThreadSafe; + +import org.apache.commons.configuration2.Configuration; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.driver.Client; +import org.apache.tinkerpop.gremlin.driver.Cluster; +import org.apache.tinkerpop.gremlin.driver.Result; +import org.apache.tinkerpop.gremlin.driver.ResultSet; +import org.apache.tinkerpop.gremlin.driver.Tokens; +import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; +import org.slf4j.Logger; + @ThreadSafe public final class CypherClient { @@ -93,7 +97,7 @@ private RequestMessage createRequest(String cypherQuery) { } private List doQueryList(Client client, RequestMessage request) - throws ExecutionException, InterruptedException { + throws ExecutionException, InterruptedException { ResultSet results = client.submitAsync(request).get(); Iterator iter = results.iterator(); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java index c85a0aff0e..cd5a769237 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java @@ -50,12 +50,14 @@ private CypherModel() { } public static class Status { + public String message = ""; public int code; public Map attributes = Collections.EMPTY_MAP; } private static class Result { + public List data; public Map meta = Collections.EMPTY_MAP; } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java index ba69fd9c00..fffe5ef9e5 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java @@ -143,8 +143,8 @@ protected User authenticate(ContainerRequestContext context) { String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION); if (auth == null) { throw new NotAuthorizedException( - "Authentication credentials are required", - "Missing authentication credentials"); + "Authentication credentials are required", + "Missing authentication credentials"); } if (auth.startsWith(BASIC_AUTH_PREFIX)) { @@ -154,7 +154,7 @@ protected User authenticate(ContainerRequestContext context) { String[] values = auth.split(":"); if (values.length != 2) { throw new BadRequestException( - "Invalid syntax for username and password"); + "Invalid syntax for username and password"); } final String username = values[0]; @@ -163,7 +163,7 @@ protected User authenticate(ContainerRequestContext context) { if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { throw new BadRequestException( - "Invalid syntax for username and password"); + "Invalid syntax for username and password"); } credentials.put(HugeAuthenticator.KEY_USERNAME, username); @@ -173,7 +173,7 @@ protected User authenticate(ContainerRequestContext context) { credentials.put(HugeAuthenticator.KEY_TOKEN, token); } else { throw new BadRequestException( - "Only HTTP Basic or Bearer authentication is supported"); + "Only HTTP Basic or Bearer authentication is supported"); } credentials.put(HugeAuthenticator.KEY_ADDRESS, peer); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java index a5cf78aa4f..f38ffd78f3 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java @@ -24,18 +24,17 @@ import java.lang.annotation.RetentionPolicy; import java.util.zip.GZIPOutputStream; +import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import jakarta.inject.Singleton; import jakarta.ws.rs.NameBinding; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.ext.Provider; import jakarta.ws.rs.ext.WriterInterceptor; import jakarta.ws.rs.ext.WriterInterceptorContext; -import jakarta.inject.Singleton; - -import org.slf4j.Logger; - -import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; -import org.apache.hugegraph.util.Log; @Provider @Singleton @@ -51,7 +50,7 @@ public class CompressInterceptor implements WriterInterceptor { @Override public void aroundWriteTo(WriterInterceptorContext context) - throws IOException, WebApplicationException { + throws IOException, WebApplicationException { // If there is no annotation(like exception), we don't compress it if (context.getAnnotations().length > 0) { try { @@ -70,14 +69,14 @@ public void aroundWriteTo(WriterInterceptorContext context) } private void compress(WriterInterceptorContext context) - throws IOException { + throws IOException { // Get compress info from the @Compress annotation final Compress compression = getCompressAnnotation(context); final String encoding = compression.value(); final int buffer = compression.buffer(); // Update header - MultivaluedMap headers = context.getHeaders(); + MultivaluedMap headers = context.getHeaders(); headers.remove("Content-Length"); headers.add("Content-Encoding", encoding); @@ -104,7 +103,9 @@ private static Compress getCompressAnnotation(WriterInterceptorContext c) { @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Compress { + String value() default GZIP; + int buffer() default BUFFER_SIZE; } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java index d8de560900..af8615a4cb 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java @@ -37,7 +37,7 @@ public class DecompressInterceptor implements ReaderInterceptor { @Override public Object aroundReadFrom(ReaderInterceptorContext context) - throws IOException { + throws IOException { // NOTE: Currently we just support GZIP String encoding = context.getHeaders().getFirst("Content-Encoding"); if (!GZIP.equalsIgnoreCase(encoding)) { @@ -51,6 +51,7 @@ public Object aroundReadFrom(ReaderInterceptorContext context) @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Decompress { + String value() default GZIP; } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java index 894f38c661..ded04b3545 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java @@ -25,6 +25,18 @@ import javax.json.JsonArrayBuilder; import javax.json.JsonObjectBuilder; +import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.exception.HugeGremlinException; +import org.apache.hugegraph.exception.NotFoundException; +import org.glassfish.hk2.api.MultiException; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; @@ -41,18 +53,6 @@ import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.config.ServerOptions; -import org.glassfish.hk2.api.MultiException; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.HugeGremlinException; -import org.apache.hugegraph.exception.NotFoundException; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - public class ExceptionFilter { private static final int BAD_REQUEST_ERROR = @@ -107,8 +107,8 @@ public Object trace(boolean trace) { @Provider public static class HugeExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(HugeException exception) { @@ -121,8 +121,8 @@ public Response toResponse(HugeException exception) { @Provider public static class IllegalArgumentExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(IllegalArgumentException exception) { @@ -135,8 +135,8 @@ public Response toResponse(IllegalArgumentException exception) { @Provider public static class NotFoundExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(NotFoundException exception) { @@ -149,8 +149,8 @@ public Response toResponse(NotFoundException exception) { @Provider public static class NoSuchElementExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(NoSuchElementException exception) { @@ -163,8 +163,8 @@ public Response toResponse(NoSuchElementException exception) { @Provider public static class WebApplicationExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(WebApplicationException exception) { @@ -189,8 +189,8 @@ private boolean trace(int status) { @Provider public static class HugeGremlinExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(HugeGremlinException exception) { @@ -204,7 +204,7 @@ public Response toResponse(HugeGremlinException exception) { @Provider public static class AssertionErrorMapper extends TracedExceptionMapper - implements ExceptionMapper { + implements ExceptionMapper { @Override public Response toResponse(AssertionError exception) { @@ -217,7 +217,7 @@ public Response toResponse(AssertionError exception) { @Provider public static class UnknownExceptionMapper extends TracedExceptionMapper - implements ExceptionMapper { + implements ExceptionMapper { @Override public Response toResponse(Throwable exception) { diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java index 42344e613f..7bda2b7562 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java @@ -20,6 +20,15 @@ import java.util.List; import java.util.Set; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.define.WorkLoad; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.E; + +import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.RateLimiter; + import jakarta.inject.Singleton; import jakarta.ws.rs.ServiceUnavailableException; import jakarta.ws.rs.container.ContainerRequestContext; @@ -29,14 +38,6 @@ import jakarta.ws.rs.core.PathSegment; import jakarta.ws.rs.ext.Provider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.define.WorkLoad; -import org.apache.hugegraph.util.Bytes; -import org.apache.hugegraph.util.E; -import com.google.common.collect.ImmutableSet; -import com.google.common.util.concurrent.RateLimiter; - @Provider @Singleton @PreMatching @@ -51,7 +52,7 @@ public class LoadDetectFilter implements ContainerRequestFilter { // Call gc every 30+ seconds if memory is low and request frequently private static final RateLimiter GC_RATE_LIMITER = - RateLimiter.create(1.0 / 30); + RateLimiter.create(1.0 / 30); @Context private jakarta.inject.Provider configProvider; @@ -71,9 +72,9 @@ public void filter(ContainerRequestContext context) { // There will be a thread doesn't work, dedicated to statistics if (load.incrementAndGet() >= maxWorkerThreads) { throw new ServiceUnavailableException(String.format( - "The server is too busy to process the request, " + - "you can config %s to adjust it or try again later", - ServerOptions.MAX_WORKER_THREADS.name())); + "The server is too busy to process the request, " + + "you can config %s to adjust it or try again later", + ServerOptions.MAX_WORKER_THREADS.name())); } long minFreeMemory = config.get(ServerOptions.MIN_FREE_MEMORY); @@ -84,11 +85,11 @@ public void filter(ContainerRequestContext context) { if (presumableFreeMem < minFreeMemory) { gcIfNeeded(); throw new ServiceUnavailableException(String.format( - "The server available memory %s(MB) is below than " + - "threshold %s(MB) and can't process the request, " + - "you can config %s to adjust it or try again later", - presumableFreeMem, minFreeMemory, - ServerOptions.MIN_FREE_MEMORY.name())); + "The server available memory %s(MB) is below than " + + "threshold %s(MB) and can't process the request, " + + "you can config %s to adjust it or try again later", + presumableFreeMem, minFreeMemory, + ServerOptions.MIN_FREE_MEMORY.name())); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java index 04f2fada5d..83a6b0d73a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java @@ -17,6 +17,8 @@ package org.apache.hugegraph.api.filter; +import org.apache.hugegraph.define.WorkLoad; + import jakarta.inject.Singleton; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerResponseContext; @@ -24,8 +26,6 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.ext.Provider; -import org.apache.hugegraph.define.WorkLoad; - @Provider @Singleton public class LoadReleaseFilter implements ContainerResponseFilter { diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java index 35dc3793de..2a2a9142ef 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java @@ -151,5 +151,6 @@ private void initClientIfNeeded() { @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface RedirectMasterRole { + } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java index 70f6cb16de..980c714d31 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java @@ -34,7 +34,7 @@ public class StatusFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { + throws IOException { if (responseContext.getStatus() == 200) { for (Annotation i : responseContext.getEntityAnnotations()) { if (i instanceof Status) { @@ -48,6 +48,7 @@ public void filter(ContainerRequestContext requestContext, @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Status { + int OK = 200; int CREATED = 201; int ACCEPTED = 202; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java index c533a7d990..a3da3df4bf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java @@ -21,21 +21,21 @@ import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.metrics.MetricsUtil; import org.apache.hugegraph.server.RestServer; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.slf4j.Logger; + import com.codahale.metrics.Meter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -113,8 +113,8 @@ protected void updateExistElement(JsonElement oldElement, if (oldElement.properties.get(key) != null && newElement.properties.get(key) != null) { Object value = updateStrategy.checkAndUpdateProperty( - oldElement.properties.get(key), - newElement.properties.get(key)); + oldElement.properties.get(key), + newElement.properties.get(key)); newElement.properties.put(key, value); } else if (oldElement.properties.get(key) != null && newElement.properties.get(key) == null) { @@ -139,8 +139,8 @@ protected void updateExistElement(HugeGraph g, if (oldElement.property(key).isPresent() && newElement.properties.get(key) != null) { Object value = updateStrategy.checkAndUpdateProperty( - oldElement.property(key).value(), - newElement.properties.get(key)); + oldElement.property(key).value(), + newElement.properties.get(key)); value = g.propertyKey(key).validValueOrThrow(value); newElement.properties.put(key, value); } else if (oldElement.property(key).isPresent() && diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java index c0a8577e55..ac76618fab 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java @@ -24,31 +24,6 @@ import java.util.Map; import java.util.NoSuchElementException; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.util.function.TriFunction; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.UpdateStrategy; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; @@ -58,6 +33,9 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; @@ -69,9 +47,31 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.util.function.TriFunction; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/graph/edges") @Singleton @Tag(name = "EdgeAPI") @@ -136,7 +136,7 @@ public String create(@Context HugeConfig config, HugeGraph g = graph(manager, graph); TriFunction getVertex = - checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; + checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; return this.commit(config, g, jsonEdges.size(), () -> { List ids = new ArrayList<>(jsonEdges.size()); @@ -180,7 +180,7 @@ public String update(@Context HugeConfig config, HugeGraph g = graph(manager, graph); Map map = new HashMap<>(req.jsonEdges.size()); TriFunction getVertex = - req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; + req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; return this.commit(config, g, map.size(), () -> { // 1.Put all newEdges' properties into map (combine first) @@ -372,10 +372,10 @@ public void delete(@Context GraphManager manager, g.removeEdge(label, id); } catch (NotFoundException e) { throw new IllegalArgumentException(String.format( - "No such edge with id: '%s', %s", id, e)); + "No such edge with id: '%s', %s", id, e)); } catch (NoSuchElementException e) { throw new IllegalArgumentException(String.format( - "No such edge with id: '%s'", id)); + "No such edge with id: '%s'", id)); } }); } @@ -385,12 +385,12 @@ private static void checkBatchSize(HugeConfig config, int max = config.get(ServerOptions.MAX_EDGES_PER_BATCH); if (edges.size() > max) { throw new IllegalArgumentException(String.format( - "Too many edges for one time post, " + - "the maximum number is '%s'", max)); + "Too many edges for one time post, " + + "the maximum number is '%s'", max)); } if (edges.size() == 0) { throw new IllegalArgumentException( - "The number of edges can't be 0"); + "The number of edges can't be 0"); } } @@ -401,13 +401,13 @@ private static Vertex getVertex(HugeGraph graph, vertex = (HugeVertex) graph.vertices(id).next(); } catch (NoSuchElementException e) { throw new IllegalArgumentException(String.format( - "Invalid vertex id '%s'", id)); + "Invalid vertex id '%s'", id)); } if (label != null && !vertex.label().equals(label)) { throw new IllegalArgumentException(String.format( - "The label of vertex '%s' is unmatched, users expect " + - "label '%s', actual label stored is '%s'", - id, label, vertex.label())); + "The label of vertex '%s' is unmatched, users expect " + + "label '%s', actual label stored is '%s'", + id, label, vertex.label())); } // Clone a new vertex to support multi-thread access return vertex.copy(); @@ -437,8 +437,8 @@ public static Direction parseDirection(String direction) { return Direction.valueOf(direction); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "Direction value must be in [OUT, IN, BOTH], " + - "but got '%s'", direction)); + "Direction value must be in [OUT, IN, BOTH], " + + "but got '%s'", direction)); } } @@ -492,7 +492,7 @@ private static void checkUpdate(BatchEdgeRequest req) { E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(), "Parameter 'update_strategies' can't be empty"); - E.checkArgument(req.createIfNotExist == true, + E.checkArgument(req.createIfNotExist, "Parameter 'create_if_not_exist' " + "dose not support false now"); } @@ -548,7 +548,7 @@ public void checkUpdate() { String key = entry.getKey(); Object value = entry.getValue(); E.checkArgumentNotNull(value, "Not allowed to set value of " + - "property '%s' to null for edge '%s'", + "property '%s' to null for edge '%s'", key, this.id); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java index 98032d2ad7..7d2b99bc87 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java @@ -25,29 +25,6 @@ import java.util.Map; import java.util.NoSuchElementException; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.UpdateStrategy; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; @@ -57,6 +34,9 @@ import org.apache.hugegraph.backend.id.SplicingIdGenerator; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; @@ -68,9 +48,29 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/graph/vertices") @Singleton @Tag(name = "VertexAPI") @@ -319,10 +319,10 @@ public void delete(@Context GraphManager manager, g.removeVertex(label, id); } catch (NotFoundException e) { throw new IllegalArgumentException(String.format( - "No such vertex with id: '%s', %s", id, e)); + "No such vertex with id: '%s', %s", id, e)); } catch (NoSuchElementException e) { throw new IllegalArgumentException(String.format( - "No such vertex with id: '%s'", id)); + "No such vertex with id: '%s'", id)); } }); } @@ -340,8 +340,8 @@ public static Id checkAndParseVertexId(String idValue) { return uuid ? Text.uuid((String) id) : HugeVertex.getIdValue(id); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "The vertex id must be formatted as Number/String/UUID" + - ", but got '%s'", idValue)); + "The vertex id must be formatted as Number/String/UUID" + + ", but got '%s'", idValue)); } } @@ -350,12 +350,12 @@ private static void checkBatchSize(HugeConfig config, int max = config.get(ServerOptions.MAX_VERTICES_PER_BATCH); if (vertices.size() > max) { throw new IllegalArgumentException(String.format( - "Too many vertices for one time post, " + - "the maximum number is '%s'", max)); + "Too many vertices for one time post, " + + "the maximum number is '%s'", max)); } if (vertices.size() == 0) { throw new IllegalArgumentException( - "The number of vertices can't be 0"); + "The number of vertices can't be 0"); } } @@ -435,7 +435,7 @@ public void checkUpdate() { String key = e.getKey(); Object value = e.getValue(); E.checkArgumentNotNull(value, "Not allowed to set value of " + - "property '%s' to null for vertex '%s'", + "property '%s' to null for vertex '%s'", key, this.id); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java index 37963a371e..810dbc8b45 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java @@ -83,7 +83,7 @@ private static PoolingHttpClientConnectionManager configConnectionManager(Client * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 */ PoolingHttpClientConnectionManager pool = - new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL); Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java index 09459ca4c7..4373b0f006 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java @@ -17,7 +17,15 @@ package org.apache.hugegraph.api.gremlin; +import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.metrics.MetricsUtil; + +import com.codahale.metrics.Histogram; +import com.codahale.metrics.annotation.Timed; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; @@ -29,14 +37,6 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.UriInfo; -import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; -import org.apache.hugegraph.api.filter.RedirectFilter; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.metrics.MetricsUtil; -import com.codahale.metrics.Histogram; -import com.codahale.metrics.annotation.Timed; -import jakarta.inject.Singleton; - @Path("gremlin") @Singleton @Tag(name = "GremlinAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java index 009f44dbd7..ad4a6452b5 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; import org.apache.hugegraph.exception.HugeGremlinException; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java index 408d27a39d..8ebf1f6d10 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java @@ -37,7 +37,6 @@ import com.google.common.collect.ImmutableMap; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.NotFoundException; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java index 5bb8274b77..e7def05065 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java @@ -190,11 +190,11 @@ public static GremlinRequest fromJson(String json) { String gremlin = (String) map.get("gremlin"); @SuppressWarnings("unchecked") Map bindings = (Map) - map.get("bindings"); + map.get("bindings"); String language = (String) map.get("language"); @SuppressWarnings("unchecked") Map aliases = (Map) - map.get("aliases"); + map.get("aliases"); GremlinRequest request = new GremlinRequest(); request.gremlin(gremlin); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java index 4705df54b7..42cc7d7f02 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java @@ -92,7 +92,7 @@ public Map list(@Context GraphManager manager, // Set limit to NO_LIMIT to ignore limit when query task by ids limit = NO_LIMIT; List idList = ids.stream().map(IdGenerator::of) - .collect(Collectors.toList()); + .collect(Collectors.toList()); iter = scheduler.tasks(idList); } else { if (status == null) { @@ -158,7 +158,7 @@ public Map update(@Context GraphManager manager, if (!ACTION_CANCEL.equals(action)) { throw new NotSupportedException(String.format( - "Not support action '%s'", action)); + "Not support action '%s'", action)); } TaskScheduler scheduler = graph(manager, graph).taskScheduler(); @@ -172,8 +172,8 @@ public Map update(@Context GraphManager manager, assert task.completed() || task.cancelling(); throw new BadRequestException(String.format( - "Can't cancel task '%s' which is completed or cancelling", - id)); + "Can't cancel task '%s' which is completed or cancelling", + id)); } private static TaskStatus parseStatus(String status) { @@ -181,8 +181,8 @@ private static TaskStatus parseStatus(String status) { return TaskStatus.valueOf(status.toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "Status value must be in %s, but got '%s'", - Arrays.asList(TaskStatus.values()), status)); + "Status value must be in %s, but got '%s'", + Arrays.asList(TaskStatus.values()), status)); } } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java index 605abef1d7..4682c35df7 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java @@ -72,7 +72,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; import jakarta.ws.rs.GET; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java index 8bcc9311d1..f45c228baf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java @@ -22,6 +22,23 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; +import org.apache.hugegraph.auth.HugePermission; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.type.define.GraphMode; +import org.apache.hugegraph.type.define.GraphReadMode; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; @@ -30,8 +47,8 @@ import jakarta.ws.rs.ForbiddenException; import jakarta.ws.rs.GET; import jakarta.ws.rs.NotSupportedException; -import jakarta.ws.rs.PUT; import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; @@ -39,23 +56,6 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.SecurityContext; -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; -import org.apache.hugegraph.auth.HugePermission; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.define.GraphMode; -import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("graphs") @Singleton @Tag(name = "GraphsAPI") @@ -154,7 +154,7 @@ public File getConf(@Context GraphManager manager, File file = config.file(); if (file == null) { throw new NotSupportedException("Can't access the api in " + - "a node which started with non local file config."); + "a node which started with non local file config."); } return file; } @@ -255,9 +255,9 @@ public Map mode(@Context GraphManager manager, @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed("admin") public Map graphReadMode( - @Context GraphManager manager, - @PathParam("name") String name, - GraphReadMode readMode) { + @Context GraphManager manager, + @PathParam("name") String name, + GraphReadMode readMode) { LOG.debug("Set graph-read-mode to: '{}' of graph '{}'", readMode, name); @@ -275,8 +275,8 @@ public Map graphReadMode( @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed({"admin", "$owner=$name"}) public Map graphReadMode( - @Context GraphManager manager, - @PathParam("name") String name) { + @Context GraphManager manager, + @PathParam("name") String name) { LOG.debug("Get graph-read-mode of graph '{}'", name); HugeGraph g = graph(manager, name); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java index 26a7873e45..279f095569 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java @@ -24,31 +24,30 @@ import java.util.TreeMap; import java.util.TreeSet; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Application; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.MediaType; - import org.apache.commons.lang3.StringUtils; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.version.CoreVersion; import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty; import org.glassfish.jersey.model.Parameter.Source; import org.glassfish.jersey.server.model.Parameter; import org.glassfish.jersey.server.model.Resource; import org.glassfish.jersey.server.model.ResourceMethod; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.version.CoreVersion; - import com.codahale.metrics.annotation.Timed; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; + @Path("/") @Singleton @Tag(name = "ProfileAPI") @@ -154,8 +153,8 @@ public void put(APICategory category, APIProfile profile) { categories = this.apis.computeIfAbsent(category.dir, k -> new TreeMap<>()); List profiles = categories.computeIfAbsent( - category.category, - k -> new ArrayList<>()); + category.category, + k -> new ArrayList<>()); profiles.add(profile); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java index b6a095c9ec..5f951e7ac7 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java @@ -19,6 +19,13 @@ import java.util.Map; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.version.ApiVersion; +import org.apache.hugegraph.version.CoreVersion; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.PermitAll; import jakarta.inject.Singleton; @@ -26,12 +33,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.version.ApiVersion; -import org.apache.hugegraph.version.CoreVersion; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("versions") @Singleton @Tag(name = "VersionAPI") @@ -43,9 +44,9 @@ public class VersionAPI extends API { @PermitAll public Object list() { Map versions = ImmutableMap.of("version", "v1", - "core", CoreVersion.VERSION.toString(), - "gremlin", CoreVersion.GREMLIN_VERSION, - "api", ApiVersion.VERSION.toString()); + "core", CoreVersion.VERSION.toString(), + "gremlin", CoreVersion.GREMLIN_VERSION, + "api", ApiVersion.VERSION.toString()); return ImmutableMap.of("versions", versions); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java index f765ff46ab..e965ed21a9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java @@ -76,7 +76,8 @@ public Map list(@Context GraphManager manager) { @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed("admin") @Operation(summary = "update white ip list") - public Map updateWhiteIPs(@Context GraphManager manager, Map actionMap) { + public Map updateWhiteIPs(@Context GraphManager manager, + Map actionMap) { E.checkArgument(actionMap != null, "Missing argument: actionMap"); Set whiteIpList = manager.authManager().listWhiteIPs(); @@ -137,7 +138,8 @@ public Map updateWhiteIPs(@Context GraphManager manager, Map updateStatus(@Context GraphManager manager, @QueryParam("status") String status) { + public Map updateStatus(@Context GraphManager manager, + @QueryParam("status") String status) { LOG.debug("Enable or disable white ip list"); E.checkArgument("true".equals(status) || "false".equals(status), diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java index 2c2d893b66..76f44a5248 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java @@ -21,38 +21,38 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.api.filter.RedirectFilter; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.RedirectFilter; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob; import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.job.JobBuilder; import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/raft") @Singleton @Tag(name = "RaftAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java index 1154d71447..82ad79e38e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java @@ -20,16 +20,6 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.graph.EdgeAPI; @@ -40,9 +30,20 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + /** * AdamicAdar is one of the prediction algorithms in graph, you can get more * info and definition in: diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java index f2e3f0c9a5..0855c8cb62 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java @@ -25,31 +25,31 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.CountTraverser; import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/count") @Singleton @Tag(name = "CountAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java index 5237fdcdb7..f52c2b57ee 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java @@ -25,7 +25,6 @@ import org.apache.hugegraph.api.graph.VertexAPI; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.EdgeExistenceTraverser; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java index 9c1fda3be2..d5bf74ee20 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java @@ -26,29 +26,29 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/neighborrank") @Singleton @Tag(name = "NeighborRankAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java index 8619fb1711..aefc9daaa0 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java @@ -24,16 +24,6 @@ import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; @@ -43,9 +33,19 @@ import org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/personalrank") @Singleton @Tag(name = "PersonalRankAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java index 881138bbf9..fb4d73e5af 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java @@ -20,16 +20,6 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.graph.EdgeAPI; @@ -40,9 +30,20 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + /** * ResourceAllocation is one of the prediction algorithms in graph, you can get * more info and definition in: diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java index 183c27d87c..bf231ca90a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java @@ -23,8 +23,6 @@ import java.util.Map; import java.util.Set; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; @@ -33,6 +31,8 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Vertex; + import com.fasterxml.jackson.annotation.JsonProperty; public class Vertices { @@ -47,8 +47,8 @@ public class Vertices { public Iterator vertices(HugeGraph g) { Map props = this.properties; E.checkArgument(!((this.ids == null || this.ids.isEmpty()) && - (props == null || props.isEmpty()) && - this.label == null), "No source vertices provided"); + (props == null || props.isEmpty()) && + this.label == null), "No source vertices provided"); Iterator iterator; if (this.ids != null && !this.ids.isEmpty()) { List sourceIds = new ArrayList<>(this.ids.size()); @@ -72,7 +72,7 @@ public Iterator vertices(HugeGraph g) { assert !query.empty(); iterator = g.vertices(query); E.checkArgument(iterator.hasNext(), "Not exist source vertex " + - "with label '%s' and properties '%s'", + "with label '%s' and properties '%s'", this.label, props); } return iterator; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java index 89272fb8f5..2ea29aaf1d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java @@ -20,6 +20,16 @@ import java.util.Map; import java.util.Optional; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; @@ -32,16 +42,6 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("graphs/{graph}/variables") @Singleton @Tag(name = "VariablesAPI") @@ -91,7 +91,7 @@ public Map get(@Context GraphManager manager, Optional object = g.variables().get(key); if (!object.isPresent()) { throw new NotFoundException(String.format( - "Variable '%s' does not exist", key)); + "Variable '%s' does not exist", key)); } return ImmutableMap.of(key, object.get()); } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java index 2106d54dc4..21cf39682d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java @@ -50,8 +50,9 @@ public void setup(HugeConfig config) { /** * Verify if a user is legal - * @param username the username for authentication - * @param password the password for authentication + * + * @param username the username for authentication + * @param password the password for authentication * @return String No permission if return ROLE_NONE else return a role */ @Override diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java index f753fc2ca7..7f8829974e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java @@ -115,8 +115,8 @@ public void injectTraversalSource() { String gName = G_PREFIX + graph; if (manager.getTraversalSource(gName) != null) { throw new HugeException( - "Found existing name '%s' in global bindings, " + - "it may lead to gremlin query error.", gName); + "Found existing name '%s' in global bindings, " + + "it may lead to gremlin query error.", gName); } // Add a traversal source for all graphs with customed rule. manager.putTraversalSource(gName, g); @@ -136,7 +136,7 @@ private void injectGraph(HugeGraph graph) { manager.putTraversalSource(G_PREFIX + name, g); Whitebox.invoke(executor, "globalBindings", - new Class[]{ String.class, Object.class }, + new Class[]{String.class, Object.class}, "put", name, graph); } @@ -149,7 +149,7 @@ private void removeGraph(String name) { manager.removeGraph(name); manager.removeTraversalSource(G_PREFIX + name); Whitebox.invoke(executor, "globalBindings", - new Class[]{ Object.class }, + new Class[]{Object.class}, "remove", name); } catch (Exception e) { throw new HugeException("Failed to remove graph '%s' from " + diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java index e1077d9469..1e67680953 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java @@ -81,7 +81,7 @@ default void setup(final Map config) { @Override default User authenticate(final Map credentials) - throws AuthenticationException { + throws AuthenticationException { HugeGraphAuthProxy.resetContext(); @@ -118,11 +118,7 @@ default boolean requireAuthentication() { } default boolean verifyRole(RolePermission role) { - if (role == ROLE_NONE || role == null) { - return false; - } else { - return true; - } + return role != ROLE_NONE && role != null; } void initAdminUser(String password) throws Exception; @@ -334,7 +330,7 @@ private static Object matchedAction(HugePermission action, return null; } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) public static RolePerm fromJson(Object role) { RolePermission table = RolePermission.fromJson(role); return new RolePerm((Map) table.map()); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java index 0c748445a2..201511fe87 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java @@ -65,7 +65,7 @@ public final class HugeFactoryAuthProxy { public static final String GRAPH_FACTORY = - "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy"; + "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy"; private static final Set PROTECT_METHODS = ImmutableSet.of("instance"); @@ -92,108 +92,385 @@ public static synchronized HugeGraph open(Configuration config) { private static void registerPrivateActions() { // Thread - Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", "eetop", "single_step", "daemon", "stillborn", "target", "group", "contextClassLoader", "inheritedAccessControlContext", "threadInitNumber", "threadLocals", "inheritableThreadLocals", "stackSize", "nativeParkEventPointer", "tid", "threadSeqNumber", "threadStatus", "parkBlocker", "blocker", "blockerLock", "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", "uncaughtExceptionHandler", "defaultUncaughtExceptionHandler", "threadLocalRandomSeed", "threadLocalRandomSecondarySeed"); - Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", "dispatchUncaughtException", "clone", "isInterrupted", "registerNatives", "init", "init", "nextThreadNum", "nextThreadID", "blockedOn", "start0", "isCCLOverridden", "auditSubclass", "dumpThreads", "getThreads", "processQueue", "setPriority0", "stop0", "suspend0", "resume0", "interrupt0", "setNativeName"); - Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", "nextHashCode", "HASH_INCREMENT"); - Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", "createInheritedMap", "nextHashCode", "initialValue", "setInitialValue", "getMap", "createMap", "childValue"); - Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", "createMap", "childValue"); + Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", + "eetop", "single_step", "daemon", "stillborn", "target", + "group", "contextClassLoader", + "inheritedAccessControlContext", "threadInitNumber", + "threadLocals", "inheritableThreadLocals", "stackSize", + "nativeParkEventPointer", "tid", "threadSeqNumber", + "threadStatus", "parkBlocker", "blocker", "blockerLock", + "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", + "uncaughtExceptionHandler", + "defaultUncaughtExceptionHandler", + "threadLocalRandomSeed", + "threadLocalRandomSecondarySeed"); + Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", + "dispatchUncaughtException", "clone", "isInterrupted", + "registerNatives", "init", "init", "nextThreadNum", + "nextThreadID", "blockedOn", "start0", "isCCLOverridden", + "auditSubclass", "dumpThreads", "getThreads", + "processQueue", "setPriority0", "stop0", "suspend0", + "resume0", "interrupt0", "setNativeName"); + Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", + "nextHashCode", "HASH_INCREMENT"); + Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", + "createInheritedMap", "nextHashCode", "initialValue", + "setInitialValue", "getMap", "createMap", "childValue"); + Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", + "createMap", "childValue"); // HugeGraph Reflection.registerFieldsToFilter(StandardAuthenticator.class, "graph"); - Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", "inputPassword", "graph"); + Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", + "inputPassword", "graph"); Reflection.registerFieldsToFilter(ConfigAuthenticator.class, "tokens"); Reflection.registerFieldsToFilter(HugeFactoryAuthProxy.class, "PROTECT_METHODS"); - Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", "registerClass", "registerPrivateActions", "registerPrivateActions", "c"); + Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", + "registerClass", "registerPrivateActions", + "registerPrivateActions", "c"); Reflection.registerFieldsToFilter(HugeAuthenticator.User.class, "role", "client"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", "taskScheduler", "authManager", "contexts", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "resetContext", "logUser", "verifyAdminPermission", "verifyStatusPermission", "verifyPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifyNamePermission", "verifyNameExistsPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyResPermission", "verifyResPermission", "verifyUserPermission", "verifyUserPermission", "verifyUserPermission", "getContextString", "access$6", "access$7", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "lambda$20", "lambda$21", "lambda$22", "lambda$23", "lambda$24", "access$8", "access$9", "access$10", "setContext", "getContext"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "currentUsername", "updateCreator"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "taskScheduler", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", "lambda$1", "lambda$2", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "hasTaskPermission"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, "this$0"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, "connection", "graph", "strategies", "bytecode"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "REST_WOEKER", "serialVersionUID", "strategies", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "translate"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", "this$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", + "taskScheduler", "authManager", "contexts", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", + "access$4", "access$2", "access$5", "resetContext", + "logUser", "verifyAdminPermission", + "verifyStatusPermission", "verifyPermission", + "verifySchemaPermission", "verifySchemaPermission", + "verifySchemaPermission", "verifySchemaPermission", + "verifyNamePermission", "verifyNameExistsPermission", + "verifyElemPermission", "verifyElemPermission", + "verifyElemPermission", "verifyElemPermission", + "verifyResPermission", "verifyResPermission", + "verifyUserPermission", "verifyUserPermission", + "verifyUserPermission", "getContextString", "access$6", + "access$7", "lambda$1", "lambda$2", "lambda$3", + "lambda$4", "lambda$5", "lambda$6", "lambda$7", + "lambda$8", "lambda$9", "lambda$10", "lambda$11", + "lambda$12", "lambda$13", "lambda$14", "lambda$15", + "lambda$16", "lambda$17", "lambda$18", "lambda$19", + "lambda$20", "lambda$21", "lambda$22", "lambda$23", + "lambda$24", "access$8", "access$9", "access$10", + "setContext", "getContext"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", + "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, + "currentUsername", "updateCreator"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, + "taskScheduler", "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", + "lambda$1", "lambda$2", "verifyTaskPermission", + "verifyTaskPermission", "verifyTaskPermission", + "verifyTaskPermission", "hasTaskPermission"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, + "this$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, + "connection", "graph", "strategies", "bytecode"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, + "REST_WOEKER", "serialVersionUID", "strategies", + "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, + "translate"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", + "this$0"); Reflection.registerFieldsToFilter(HugeGraphAuthProxy.Context.class, "ADMIN", "user"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", "context"); - Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "access$18", "serializer", "loadSchemaStore", "loadSystemStore", "loadGraphStore", "closeTx", "analyzer", "serverInfoManager", "reloadRamtable", "reloadRamtable", "access$19", "access$20", "access$21"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners"); - Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g"); - Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0"); - Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); - Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxSize", "checkTxVerticesCapacity", "checkTxEdgesCapacity", "verticesInTxUpdated", "verticesInTxRemoved", "removingEdgeOwner", "prepareDeletions", "prepareDeletions", "prepareUpdates", "prepareAdditions", "checkVertexExistIfCustomizedId", "checkAggregateProperty", "checkAggregateProperty", "checkNonnullProperty", "queryEdgesFromBackend", "commitPartOfEdgeDeletions", "optimizeQueries", "checkVertexLabel", "checkId", "queryVerticesFromBackend", "joinTxVertices", "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", "verifyVerticesConditionQuery", "verifyEdgesConditionQuery", "indexQuery", "joinTxRecords", "propertyUpdated", "parseEntry", "traverseByLabel", "reset", "queryVerticesByIds", "filterUnmatchedRecords", "skipOffsetOrStopLimit", "filterExpiredResultFromFromBackend", "queryEdgesByIds", "matchEdgeSortKeys", "rightResultFromIndexQuery"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", + "context"); + Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", + "mode", "variables", "name", "params", "configuration", + "schemaEventHub", "graphEventHub", "indexEventHub", + "writeRateLimiter", "readRateLimiter", "taskManager", + "authManager", "features", "storeProvider", "tx", + "ramtable", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", + "access$4", "access$2", "access$5", "access$6", + "access$7", "waitUntilAllTasksCompleted", "access$8", + "loadStoreProvider", "graphTransaction", + "schemaTransaction", "openSchemaTransaction", + "checkGraphNotClosed", "openSystemTransaction", + "openGraphTransaction", "systemTransaction", "access$9", + "access$10", "access$11", "access$12", "access$13", + "access$14", "access$15", "access$16", "access$17", + "access$18", "serializer", "loadSchemaStore", + "loadSystemStore", "loadGraphStore", "closeTx", + "analyzer", "serverInfoManager", "reloadRamtable", + "reloadRamtable", "access$19", "access$20", "access$21"); + Reflection.registerFieldsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), + "graph", "this$0"); + Reflection.registerMethodsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), + "access$1", "graph"); + Reflection.registerFieldsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", + "opened", "transactions", "this$0", "$assertionsDisabled"); + Reflection.registerMethodsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), + "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", + "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", + "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", + "setClosed", "getOrNewTransaction", "access$0", "resetState"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, + "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners"); + Reflection.registerMethodsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, + "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", + "lambda$fireOnRollback$1", "lambda$fireOnCommit$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g"); + Reflection.registerMethodsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", + "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite"); + Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), + "schemaTx", "systemTx", "graphTx", "openedTime", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), + "access$2", "access$1", "access$0"); + Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", + "removedVertices", "addedEdges", "removedEdges", + "addedProps", "removedProps", "updatedVertices", + "updatedEdges", "updatedOldestProps", "locksTable", + "checkCustomVertexExist", "checkAdjacentVertexExist", + "lazyLoadAdjacentVertex", "ignoreInvalidEntry", + "commitPartOfAdjacentEdges", "batchSize", "pageSize", + "verticesCapacity", "edgesCapacity", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); + Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", + "lambda$2", "lambda$3", "lambda$4", "lambda$5", + "lambda$6", "lambda$7", "lambda$8", "lambda$9", + "lambda$10", "lambda$11", "lambda$12", "lambda$13", + "lambda$14", "lambda$15", "lambda$16", "lambda$17", + "lambda$18", "lambda$19", "access$1", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "indexTransaction", "indexTransaction", "beforeWrite", + "prepareCommit", "verticesInTxSize", "edgesInTxSize", + "checkTxVerticesCapacity", "checkTxEdgesCapacity", + "verticesInTxUpdated", "verticesInTxRemoved", + "removingEdgeOwner", "prepareDeletions", + "prepareDeletions", "prepareUpdates", "prepareAdditions", + "checkVertexExistIfCustomizedId", + "checkAggregateProperty", "checkAggregateProperty", + "checkNonnullProperty", "queryEdgesFromBackend", + "commitPartOfEdgeDeletions", "optimizeQueries", + "checkVertexLabel", "checkId", + "queryVerticesFromBackend", "joinTxVertices", + "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", + "verifyVerticesConditionQuery", + "verifyEdgesConditionQuery", "indexQuery", + "joinTxRecords", "propertyUpdated", "parseEntry", + "traverseByLabel", "reset", "queryVerticesByIds", + "filterUnmatchedRecords", "skipOffsetOrStopLimit", + "filterExpiredResultFromFromBackend", "queryEdgesByIds", + "matchEdgeSortKeys", "rightResultFromIndexQuery"); Reflection.registerFieldsToFilter(IndexableTransaction.class, "$assertionsDisabled"); - Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", "commit2Backend", "reset"); - Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", "autoCommit", "closed", "committing", "committing2Backend", "graph", "store", "mutation", "serializer", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", "prepareCommit", "params", "mutation", "commit2Backend", "autoCommit", "beforeRead", "afterWrite", "afterRead", "commitMutation2Backend", "checkOwnerThread", "doAction", "store", "reset"); + Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", + "commit2Backend", "reset"); + Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", + "autoCommit", "closed", "committing", + "committing2Backend", "graph", "store", "mutation", + "serializer", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", + "prepareCommit", "params", "mutation", "commit2Backend", + "autoCommit", "beforeRead", "afterWrite", "afterRead", + "commitMutation2Backend", "checkOwnerThread", "doAction", + "store", "reset"); Reflection.registerFieldsToFilter(HugeFactory.class, "LOG", "NAME_REGEX", "graphs"); Reflection.registerMethodsToFilter(HugeFactory.class, "lambda$0"); - Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", "status"); - Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys"); - Reflection.registerMethodsToFilter(HugeVertex.class, "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "checkIdLength", "onUpdateProperty", "ensureFilledProperties", "clone", "clone"); - Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", "properties", "expiredTime", "removed", "fresh", "propLoaded", "defaultValueUpdated", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality"); - Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", "newProperty", "tx", "onUpdateProperty", "ensureFilledProperties", "propLoaded", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", "getIdValue", "fresh", "updateToDefaultValueIfNone", "copyProperties"); - Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", "targetVertex", "isOutEdge", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction"); - Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "onUpdateProperty", "ensureFilledProperties", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", "clone", "clone"); + Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", + "status"); + Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys"); + Reflection.registerMethodsToFilter(HugeVertex.class, + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "newProperty", "newProperty", "tx", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "checkIdLength", "onUpdateProperty", + "ensureFilledProperties", "clone", "clone"); + Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", + "properties", "expiredTime", "removed", "fresh", + "propLoaded", "defaultValueUpdated", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality"); + Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", + "newProperty", "tx", "onUpdateProperty", + "ensureFilledProperties", "propLoaded", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", + "getIdValue", "fresh", "updateToDefaultValueIfNone", + "copyProperties"); + Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", + "targetVertex", "isOutEdge", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction"); + Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", + "newProperty", "newProperty", "tx", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "onUpdateProperty", "ensureFilledProperties", + "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", + "clone", "clone"); Reflection.registerFieldsToFilter(HugeProperty.class, "owner", "pkey", "value"); - Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", "params", "graph"); - Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", "queryAllVariableVertices", "queryVariableVertex", "createVariableVertex", "removeVariableVertex", "extractSingleObject", "setProperty"); + Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", + "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", + "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", + "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", + "params", "graph"); + Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", + "queryAllVariableVertices", "queryVariableVertex", + "createVariableVertex", "removeVariableVertex", + "extractSingleObject", "setProperty"); Reflection.registerFieldsToFilter(SchemaManager.class, "transaction", "graph"); - Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "checkExists"); - Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", "cardinality", "aggregateType", "checkExist", "userdata", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", "checkAggregateType", "hasSameProperties"); + Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", + "lambda$3", "checkExists"); + Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", + "cardinality", "aggregateType", "checkExist", "userdata", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", + "checkAggregateType", "hasSameProperties"); Reflection.registerFieldsToFilter(AbstractBuilder.class, "transaction", "graph"); - Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", "checkSchemaName", "validOrGenerateId", "lockCheckAndCreateSchema", "propertyKeyOrNull", "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", "edgeLabelOrNull", "indexLabelOrNull", "updateSchemaStatus"); - Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", "properties", "primaryKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); - Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkIdStrategy", "checkPrimaryKeys", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name"); - Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", "targetLabel", "frequency", "properties", "sortKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action"); - Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkSortKeys", "checkRelation", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name"); - Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", "baseValue", "indexType", "indexFields", "userdata", "checkExist", "rebuild", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType"); - Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", "checkBaseType", "checkIndexType", "checkFields4Range", "loadElement", "checkFields", "checkRepeatIndex", "checkRepeatIndex", "checkRepeatIndex", "checkPrimaryKeyIndex", "checkRepeatRangeIndex", "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", "checkRepeatShardIndex", "checkRepeatUniqueIndex", "removeSubIndex", "hasSubIndex", "allStringIndex", "oneNumericField", "hasSameProperties"); - Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", "serverInfoDbExecutor", "schedulerExecutor", "contexts", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", "closeTaskTx", "setContext", "instance", "closeSchedulerTx", "notifyNewTask", "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph"); - Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", "serverManager", "taskExecutor", "taskDbExecutor", "eventListener", "tasks", "taskTx", "NO_LIMIT", "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "tx", "listenChanges", "unlistenChanges", "submitTask", "queryTask", "queryTask", "queryTask", "call", "call", "remove", "sleep", "taskDone", "serverManager", "supportsPaging", "restore", "checkOnMasterNode", "waitUntilTaskCompleted", "scheduleTasks", "executeTasksOnWorker", "cancelTasksOnWorker"); - Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", "callable", "type", "name", "id", "parent", "dependencies", "description", "context", "create", "server", "load", "status", "progress", "update", "retries", "input", "result", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", "asArray", "checkPropertySize", "checkPropertySize", "checkDependenciesSuccess", "toOrderSet", "done", "callable", "setException", "set", "result", "status"); - Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", "ERROR_MESSAGES", "task", "graph", "lastSaveTime", "saveInterval"); - Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", "done", "task", "save", "needSaveWithEx"); + Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", + "checkSchemaName", "validOrGenerateId", + "lockCheckAndCreateSchema", "propertyKeyOrNull", + "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", + "edgeLabelOrNull", "indexLabelOrNull", + "updateSchemaStatus"); + Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", + "properties", "primaryKeys", "nullableKeys", "ttl", + "ttlStartTime", "enableLabelIndex", "userdata", + "checkExist", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); + Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "checkProperties", "checkNullableKeys", + "checkIdStrategy", "checkPrimaryKeys", + "hasSameProperties", "checkTtl", "checkUserdata", + "mapPkId2Name", "mapPkId2Name"); + Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", + "targetLabel", "frequency", "properties", "sortKeys", + "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", + "userdata", "checkExist", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action"); + Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "checkProperties", "checkNullableKeys", "checkSortKeys", + "checkRelation", "hasSameProperties", "checkTtl", + "checkUserdata", "mapPkId2Name", "mapPkId2Name"); + Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", + "baseValue", "indexType", "indexFields", "userdata", + "checkExist", "rebuild", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType"); + Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", + "checkBaseType", "checkIndexType", "checkFields4Range", + "loadElement", "checkFields", "checkRepeatIndex", + "checkRepeatIndex", "checkRepeatIndex", + "checkPrimaryKeyIndex", "checkRepeatRangeIndex", + "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", + "checkRepeatShardIndex", "checkRepeatUniqueIndex", + "removeSubIndex", "hasSubIndex", "allStringIndex", + "oneNumericField", "hasSameProperties"); + Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", + "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", + "serverInfoDbExecutor", "schedulerExecutor", "contexts", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", + "closeTaskTx", "setContext", "instance", + "closeSchedulerTx", "notifyNewTask", + "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph"); + Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", + "serverManager", "taskExecutor", "taskDbExecutor", + "eventListener", "tasks", "taskTx", "NO_LIMIT", + "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", + "lambda$2", "lambda$3", "lambda$4", "lambda$5", + "lambda$6", "lambda$7", "tx", "listenChanges", + "unlistenChanges", "submitTask", "queryTask", + "queryTask", "queryTask", "call", "call", "remove", + "sleep", "taskDone", "serverManager", "supportsPaging", + "restore", "checkOnMasterNode", "waitUntilTaskCompleted", + "scheduleTasks", "executeTasksOnWorker", + "cancelTasksOnWorker"); + Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", + "callable", "type", "name", "id", "parent", + "dependencies", "description", "context", "create", + "server", "load", "status", "progress", "update", + "retries", "input", "result", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", + "asArray", "checkPropertySize", "checkPropertySize", + "checkDependenciesSuccess", "toOrderSet", "done", + "callable", "setException", "set", "result", "status"); + Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", + "ERROR_MESSAGES", "task", "graph", "lastSaveTime", + "saveInterval"); + Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", + "done", "task", "save", "needSaveWithEx"); Reflection.registerFieldsToFilter(TaskCallable.SysTaskCallable.class, "params"); Reflection.registerMethodsToFilter(TaskCallable.SysTaskCallable.class, "params", "params"); - Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", "eventListener", "usersCache", "users", "groups", "targets", "belong", "access", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", "unlistenChanges", "invalidCache", "initSchemaIfNeeded", "rolePermission", "rolePermission", "rolePermission", "cache"); + Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", + "eventListener", "usersCache", "users", "groups", + "targets", "belong", "access", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", + "unlistenChanges", "invalidCache", "initSchemaIfNeeded", + "rolePermission", "rolePermission", "rolePermission", + "cache"); Reflection.registerFieldsToFilter(SchemaDefine.class, "graph", "label"); - Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", "createPropertyKey", "createPropertyKey", "existEdgeLabel", "createRangeIndex", "unhideField", "hideField", "existVertexLabel", "initProperties"); - Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryEntity", "constructVertex", "save", "query"); - Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryRelationship", "newVertex", "save"); - Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", "timer"); - Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", "instance"); - Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "INSTANCE", "lockGroupMap"); - Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "instance"); - Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", "histograms", "meters", "timers"); + Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", + "createPropertyKey", "createPropertyKey", + "existEdgeLabel", "createRangeIndex", "unhideField", + "hideField", "existVertexLabel", "initProperties"); + Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", + "NO_LIMIT", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", + "commitOrRollback", "unhideLabel", "queryById", + "queryEntity", "constructVertex", "save", "query"); + Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", + "NO_LIMIT", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", + "tx", "commitOrRollback", "unhideLabel", "queryById", + "queryRelationship", "newVertex", "save"); + Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", + "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", + "timer"); + Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", + "instance"); + Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, + "INSTANCE", "lockGroupMap"); + Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, + "instance"); + Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", + "histograms", "meters", "timers"); Reflection.registerMethodsToFilter(ServerReporter.class, "instance", "instance"); - Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", "FACTORY_ID", "registry", "executor", "shutdownExecutorOnStop", "disabledMetricAttributes", "scheduledFuture", "filter", "durationFactor", "durationUnit", "rateFactor", "rateUnit"); - Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, "convertDuration", "convertRate", "getRateUnit", "getDurationUnit", "isShutdownExecutorOnStop", "getDisabledMetricAttributes", "calculateRateUnit", "createDefaultExecutor", "lambda$start$0", "start"); + Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", + "FACTORY_ID", "registry", "executor", + "shutdownExecutorOnStop", "disabledMetricAttributes", + "scheduledFuture", "filter", "durationFactor", + "durationUnit", "rateFactor", "rateUnit"); + Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, + "convertDuration", "convertRate", "getRateUnit", + "getDurationUnit", "isShutdownExecutorOnStop", + "getDisabledMetricAttributes", "calculateRateUnit", + "createDefaultExecutor", "lambda$start$0", "start"); Reflection.registerFieldsToFilter(JsonSerializer.class, "LBUF_SIZE", "INSTANCE"); Reflection.registerMethodsToFilter(JsonSerializer.class, "writeIterator", "instance"); - Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeVertexStepStrategy.class, "instance"); - Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeGraphStepStrategy.class, "instance"); - Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeCountStepStrategy.class, "lambda$0", "instance"); // Enable this line to generate registration statement diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java index a038ef67fa..062e4a044b 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java @@ -147,7 +147,7 @@ public HugeGraph hugegraph() { @Override public C compute(Class clazz) - throws IllegalArgumentException { + throws IllegalArgumentException { this.verifyAnyPermission(); return this.hugegraph.compute(clazz); } @@ -164,7 +164,7 @@ public GraphTraversalSource traversal() { return new GraphTraversalSourceProxy(this); } - @SuppressWarnings({ "rawtypes", "deprecation" }) + @SuppressWarnings({"rawtypes", "deprecation"}) @Override public I io(final Io.Builder builder) { this.verifyAnyPermission(); @@ -832,14 +832,14 @@ private void verifyPermission(HugePermission actionPerm, } private V verifyUserPermission( - HugePermission actionPerm, - V elementFetcher) { + HugePermission actionPerm, + V elementFetcher) { return verifyUserPermission(actionPerm, true, () -> elementFetcher); } private List verifyUserPermission( - HugePermission actionPerm, - List elems) { + HugePermission actionPerm, + List elems) { List results = new ArrayList<>(); for (V elem : elems) { V r = verifyUserPermission(actionPerm, false, () -> elem); @@ -851,9 +851,9 @@ private List verifyUserPermission( } private V verifyUserPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier elementFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); V elem = elementFetcher.get(); @@ -869,14 +869,14 @@ private void verifyElemPermission(HugePermission actionPerm, Element elem) { } private V verifyElemPermission( - HugePermission actionPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + Supplier elementFetcher) { return verifyElemPermission(actionPerm, true, elementFetcher); } private Iterator verifyElemPermission( - HugePermission actionPerm, - Iterator elems) { + HugePermission actionPerm, + Iterator elems) { return new FilterIterator<>(elems, elem -> { V r = verifyElemPermission(actionPerm, false, () -> elem); return r != null; @@ -884,9 +884,9 @@ private Iterator verifyElemPermission( } private V verifyElemPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier elementFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); HugeElement elem = (HugeElement) elementFetcher.get(); @@ -916,8 +916,8 @@ private void verifySchemaPermission(HugePermission actionPerm, } private Collection verifySchemaPermission( - HugePermission actionPerm, - Collection schemas) { + HugePermission actionPerm, + Collection schemas) { List results = new ArrayList<>(); for (V schema : schemas) { V r = verifySchemaPermission(actionPerm, false, () -> schema); @@ -929,15 +929,15 @@ private Collection verifySchemaPermission( } private V verifySchemaPermission( - HugePermission actionPerm, - Supplier schemaFetcher) { + HugePermission actionPerm, + Supplier schemaFetcher) { return verifySchemaPermission(actionPerm, true, schemaFetcher); } private V verifySchemaPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier schemaFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier schemaFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); SchemaElement elem = schemaFetcher.get(); @@ -1099,21 +1099,21 @@ public boolean close() { @Override public HugeTask waitUntilTaskCompleted(Id id, long seconds) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); return this.taskScheduler.waitUntilTaskCompleted(id, seconds); } @Override public HugeTask waitUntilTaskCompleted(Id id) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); return this.taskScheduler.waitUntilTaskCompleted(id); } @Override public void waitUntilAllTasksCompleted(long seconds) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); this.taskScheduler.waitUntilAllTasksCompleted(seconds); } @@ -1134,8 +1134,8 @@ private HugeTask verifyTaskPermission(HugePermission actionPerm, } private Iterator> verifyTaskPermission( - HugePermission actionPerm, - Iterator> tasks) { + HugePermission actionPerm, + Iterator> tasks) { return new FilterIterator<>(tasks, task -> { return verifyTaskPermission(actionPerm, false, task) != null; }); @@ -1695,7 +1695,7 @@ public TraversalStrategies addStrategies(TraversalStrategy... strategies) { @SuppressWarnings({"unchecked"}) @Override public TraversalStrategies removeStrategies( - Class... strategyClasses) { + Class... strategyClasses) { return this.strategies.removeStrategies(strategyClasses); } @@ -1724,14 +1724,14 @@ private String translate(Bytecode bytecode) { } private final class TraversalStrategyProxy> - implements TraversalStrategy { + implements TraversalStrategy { private static final long serialVersionUID = 2071829024642435735L; private final TraversalStrategy origin; public TraversalStrategyProxy(TraversalStrategy origin) { - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) TraversalStrategy strategy = (TraversalStrategy) origin; this.origin = strategy; } @@ -1812,17 +1812,17 @@ public String toString() { private static final ThreadLocal CONTEXTS = new InheritableThreadLocal<>(); - protected static Context setContext(Context context) { + static Context setContext(Context context) { Context old = CONTEXTS.get(); CONTEXTS.set(context); return old; } - protected static void resetContext() { + static void resetContext() { CONTEXTS.remove(); } - protected static Context getContext() { + private static Context getContext() { // Return task context first String taskContext = TaskManager.getContext(); User user = User.fromJson(taskContext); @@ -1833,7 +1833,7 @@ protected static Context getContext() { return CONTEXTS.get(); } - protected static String getContextString() { + private static String getContextString() { Context context = getContext(); if (context == null) { return null; @@ -1841,7 +1841,7 @@ protected static String getContextString() { return context.user().toJson(); } - protected static void logUser(User user, String path) { + static void logUser(User user, String path) { LOG.info("User '{}' login from client [{}] with path '{}'", user.username(), user.client(), path); } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java index 4922533760..3e276046f9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java @@ -110,7 +110,7 @@ private String inputPassword() { public void setup(HugeConfig config) { String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE); Map graphConfs = ConfigUtil.scanGraphsDir( - config.get(ServerOptions.GRAPHS)); + config.get(ServerOptions.GRAPHS)); String graphPath = graphConfs.get(graphName); E.checkArgument(graphPath != null, "Can't find graph name '%s' in config '%s' at " + @@ -137,7 +137,7 @@ public void setup(HugeConfig config) { String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL); if (StringUtils.isNotEmpty(remoteUrl)) { RpcClientProviderWithAuth clientProvider = - new RpcClientProviderWithAuth(config); + new RpcClientProviderWithAuth(config); this.graph.switchAuthManager(clientProvider.authManager()); } } @@ -159,9 +159,10 @@ private void transferRoleWorkerConfig(HugeConfig graphConfig, HugeConfig config) /** * Verify if a user is legal + * * @param username the username for authentication * @param password the password for authentication - * @param token the token for authentication + * @param token the token for authentication * @return String No permission if return ROLE_NONE else return a role */ @Override diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java index 205074ae78..1b329e19f9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java @@ -24,7 +24,7 @@ import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD; import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.HashMap; import java.util.Map; @@ -61,7 +61,7 @@ public WsAndHttpBasicAuthHandler(Authenticator authenticator, @Override public void channelRead(final ChannelHandlerContext ctx, final Object obj) - throws Exception { + throws Exception { if (obj instanceof HttpMessage && !isWebSocket((HttpMessage) obj)) { ChannelPipeline pipeline = ctx.pipeline(); ChannelHandler authHandler = pipeline.get(HTTP_AUTH); @@ -86,7 +86,7 @@ public static boolean isWebSocket(final HttpMessage msg) { @ChannelHandler.Sharable private static class HttpBasicAuthHandler - extends AbstractAuthenticationHandler { + extends AbstractAuthenticationHandler { private final Base64.Decoder decoder = Base64.getUrlDecoder(); @@ -122,7 +122,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { return; } String authorization = new String(userPass, - Charset.forName("UTF-8")); + StandardCharsets.UTF_8); String[] split = authorization.split(":"); if (split.length != 2) { sendError(ctx, msg); @@ -134,7 +134,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { address = address.substring(1); } - final Map credentials = new HashMap<>(); + final Map credentials = new HashMap<>(); credentials.put(PROPERTY_USERNAME, split[0]); credentials.put(PROPERTY_PASSWORD, split[1]); credentials.put(HugeAuthenticator.KEY_ADDRESS, address); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index e18d5139a5..b46735c8f0 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -274,36 +274,36 @@ public static synchronized ServerOptions instance() { ); public static final ConfigOption ARTHAS_TELNET_PORT = - new ConfigOption<>( - "arthas.telnet_port", - "The telnet port provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "8562" - ); + new ConfigOption<>( + "arthas.telnet_port", + "The telnet port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8562" + ); public static final ConfigOption ARTHAS_HTTP_PORT = - new ConfigOption<>( - "arthas.http_port", - "The HTTP port provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "8561" - ); + new ConfigOption<>( + "arthas.http_port", + "The HTTP port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8561" + ); public static final ConfigOption ARTHAS_IP = - new ConfigOption<>( - "arthas.ip", - "The IP provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "0.0.0.0" - ); + new ConfigOption<>( + "arthas.ip", + "The IP provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "0.0.0.0" + ); public static final ConfigOption ARTHAS_DISABLED_COMMANDS = - new ConfigOption<>( - "arthas.disabled_commands", - "The disabled Arthas commands due to high risk.", - null, - "jad" - ); + new ConfigOption<>( + "arthas.disabled_commands", + "The disabled Arthas commands due to high risk.", + null, + "jad" + ); public static final ConfigOption SLOW_QUERY_LOG_TIME_THRESHOLD = new ConfigOption<>( diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java index 9b3c3a10ae..1830d81c76 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java @@ -158,7 +158,7 @@ public HugeGraph cloneGraph(String name, String newName, String configText) { HugeConfig cloneConfig = cloneGraph.cloneConfig(newName); if (StringUtils.isNotEmpty(configText)) { PropertiesConfiguration propConfig = ConfigUtil.buildConfig( - configText); + configText); // Use the passed config to overwrite the old one propConfig.getKeys().forEachRemaining(key -> { cloneConfig.setProperty(key, propConfig.getProperty(key)); @@ -259,7 +259,7 @@ public boolean requireAuthentication() { } public HugeAuthenticator.User authenticate(Map credentials) - throws AuthenticationException { + throws AuthenticationException { return this.authenticator().authenticate(credentials); } @@ -436,20 +436,20 @@ private void checkBackendVersionOrExit(HugeConfig config) { this.authenticator().initAdminUser(token); } catch (Exception e) { throw new BackendException( - "The backend store of '%s' can't " + - "initialize admin user", hugegraph.name()); + "The backend store of '%s' can't " + + "initialize admin user", hugegraph.name()); } } } BackendStoreInfo info = hugegraph.backendStoreInfo(); if (!info.exists()) { throw new BackendException( - "The backend store of '%s' has not been initialized", - hugegraph.name()); + "The backend store of '%s' has not been initialized", + hugegraph.name()); } if (!info.checkVersion()) { throw new BackendException( - "The backend store version is inconsistent"); + "The backend store version is inconsistent"); } } } @@ -521,7 +521,7 @@ private void addMetrics(HugeConfig config) { }); // Add metrics for caches - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Map> caches = (Map) CacheManager.instance() .caches(); registerCacheMetrics(caches); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java index c910dc8c26..887bf7d456 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java @@ -26,6 +26,7 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.NumericUtil; + import com.google.common.collect.Sets; public enum UpdateStrategy { @@ -113,7 +114,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) { // Batch update Set should use union because of higher efficiency APPEND { @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Object updatePropertyValue(Object oldProperty, Object newProperty) { ((Collection) oldProperty).addAll((Collection) newProperty); return oldProperty; @@ -127,7 +128,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) { ELIMINATE { @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Object updatePropertyValue(Object oldProperty, Object newProperty) { ((Collection) oldProperty).removeAll((Collection) newProperty); return oldProperty; @@ -186,7 +187,7 @@ protected static Object compareNumber(Object oldProperty, Number newNum = NumericUtil.convertToNumber(newProperty); int result = NumericUtil.compareNumber(oldNum, newNum); return strategy == BIGGER ? (result > 0 ? oldProperty : newProperty) : - (result < 0 ? oldProperty : newProperty); + (result < 0 ? oldProperty : newProperty); } protected static Set combineSet(Object oldProperty, Object newProperty, @@ -198,6 +199,6 @@ protected static Set combineSet(Object oldProperty, Object newProperty, (Set) newProperty : new HashSet<>((List) newProperty); return strategy == UNION ? Sets.union(oldSet, newSet) : - Sets.intersection(oldSet, newSet); + Sets.intersection(oldSet, newSet); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java index 5107b46113..0d42b6369e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java @@ -227,7 +227,7 @@ public void serialize(Timer timer, JsonGenerator json, } private static class MetricRegistrySerializer - extends StdSerializer { + extends StdSerializer { private static final long serialVersionUID = 3717001164181726933L; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java index d3cd6855b7..b302ddc5d2 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import org.apache.hugegraph.util.E; + import com.codahale.metrics.Counter; import com.codahale.metrics.Gauge; import com.codahale.metrics.Histogram; @@ -47,7 +48,7 @@ public class ServerReporter extends ScheduledReporter { private SortedMap timers; public static synchronized ServerReporter instance( - MetricRegistry registry) { + MetricRegistry registry) { if (instance == null) { synchronized (ServerReporter.class) { if (instance == null) { @@ -97,7 +98,7 @@ public Map meters() { return Collections.unmodifiableMap(this.meters); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void report(SortedMap gauges, SortedMap counters, diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java index 903ac6103d..3aeaca3445 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; - import org.apache.hugegraph.util.Bytes; public class SystemMetrics { @@ -112,7 +111,7 @@ private Map getThreadMetrics() { private Map getClassLoadingMetrics() { Map metrics = new LinkedHashMap<>(); ClassLoadingMXBean classLoadingMxBean = ManagementFactory - .getClassLoadingMXBean(); + .getClassLoadingMXBean(); metrics.put("count", classLoadingMxBean.getLoadedClassCount()); metrics.put("loaded", classLoadingMxBean.getTotalLoadedClassCount()); metrics.put("unloaded", classLoadingMxBean.getUnloadedClassCount()); @@ -122,7 +121,7 @@ private Map getClassLoadingMetrics() { private Map getGarbageCollectionMetrics() { Map metrics = new LinkedHashMap<>(); List gcMxBeans = ManagementFactory - .getGarbageCollectorMXBeans(); + .getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean gcMxBean : gcMxBeans) { String name = formatName(gcMxBean.getName()); metrics.put(name + "_count", gcMxBean.getCollectionCount()); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java index a4dfff60a4..dfad9b9594 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java @@ -16,7 +16,22 @@ package org.apache.hugegraph.opencypher; -import io.netty.channel.ChannelHandlerContext; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonList; +import static java.util.Optional.empty; +import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR; +import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN; +import static org.slf4j.LoggerFactory.getLogger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; import org.apache.tinkerpop.gremlin.driver.Tokens; import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; @@ -45,20 +60,9 @@ import org.opencypher.gremlin.traversal.ReturnNormalizer; import org.slf4j.Logger; +import io.netty.channel.ChannelHandlerContext; import scala.collection.Seq; -import java.util.*; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; - -import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonList; -import static java.util.Optional.empty; -import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR; -import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN; -import static org.slf4j.LoggerFactory.getLogger; - /** * Description of the modifications: *

@@ -80,7 +84,7 @@ *

* 3) Set the logger level from info to trace *

- * + *

* {@link OpProcessor} implementation for processing Cypher {@link RequestMessage}s: *

  * {
@@ -94,7 +98,7 @@
 public class CypherOpProcessor extends AbstractEvalOpProcessor {
 
     private static final String DEFAULT_TRANSLATOR_DEFINITION =
-        "gremlin+cfog_server_extensions+inline_parameters";
+            "gremlin+cfog_server_extensions+inline_parameters";
 
     private static final Logger logger = getLogger(CypherOpProcessor.class);
 
@@ -242,8 +246,8 @@ protected void handleIterator(Context context, Iterator traversal) {
                                                  .getExecutorService().submit(evalFuture);
         if (timeout > 0) {
             context.getScheduledExecutorService().schedule(
-                () -> executionFuture.cancel(true)
-                , timeout, TimeUnit.MILLISECONDS);
+                    () -> executionFuture.cancel(true)
+                    , timeout, TimeUnit.MILLISECONDS);
         }
 
     }
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
index 98cf98eeef..6d7899dd19 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
@@ -28,13 +28,6 @@
 
 package org.apache.hugegraph.opencypher;
 
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.opencypher.gremlin.traversal.CustomFunctions;
-import org.opencypher.gremlin.traversal.CustomPredicate;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.List;
@@ -42,15 +35,24 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.opencypher.gremlin.traversal.CustomFunctions;
+import org.opencypher.gremlin.traversal.CustomPredicate;
+
 public class CypherPlugin implements GremlinPlugin {
 
     private static final ImportCustomizer IMPORTS =
-        DefaultImportCustomizer.build()
-                               .addClassImports(CustomPredicate.class)
-                               .addMethodImports(getDeclaredPublicMethods(CustomPredicate.class))
-                               .addClassImports(CustomFunctions.class)
-                               .addMethodImports(getDeclaredPublicMethods(CustomFunctions.class))
-                               .create();
+            DefaultImportCustomizer.build()
+                                   .addClassImports(CustomPredicate.class)
+                                   .addMethodImports(
+                                           getDeclaredPublicMethods(CustomPredicate.class))
+                                   .addClassImports(CustomFunctions.class)
+                                   .addMethodImports(
+                                           getDeclaredPublicMethods(CustomFunctions.class))
+                                   .create();
 
     private static List getDeclaredPublicMethods(Class klass) {
         Method[] declaredMethods = klass.getDeclaredMethods();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
index 1311e3e32d..80af0ab368 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
@@ -17,12 +17,13 @@
 
 package org.apache.hugegraph.rpc;
 
-import com.alipay.sofa.rpc.common.utils.StringUtils;
 import org.apache.hugegraph.auth.AuthManager;
 import org.apache.hugegraph.config.HugeConfig;
 import org.apache.hugegraph.config.ServerOptions;
 import org.apache.hugegraph.util.E;
 
+import com.alipay.sofa.rpc.common.utils.StringUtils;
+
 public class RpcClientProviderWithAuth extends RpcClientProvider {
 
     private final RpcConsumerConfig authConsumerConfig;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
index e477fce1d0..7784613f53 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
@@ -42,32 +42,32 @@
 
 import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
 import io.swagger.v3.oas.annotations.info.Contact;
 import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import io.swagger.v3.oas.annotations.security.SecurityScheme;
 import jakarta.ws.rs.ApplicationPath;
 
 @SecurityScheme(
-    name = "basic",
-    type = SecuritySchemeType.HTTP,
-    scheme = "basic"
+        name = "basic",
+        type = SecuritySchemeType.HTTP,
+        scheme = "basic"
 )
 @SecurityScheme(
-    name = "bearer",
-    type = SecuritySchemeType.HTTP,
-    scheme = "bearer"
+        name = "bearer",
+        type = SecuritySchemeType.HTTP,
+        scheme = "bearer"
 )
 @ApplicationPath("/")
 @OpenAPIDefinition(
-    info = @Info(
-        title = "HugeGraph RESTful API",
-        version = CoreVersion.DEFAULT_VERSION,
-        description = "All management API for HugeGraph",
-        contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
-    ),
-    security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
+        info = @Info(
+                title = "HugeGraph RESTful API",
+                version = CoreVersion.DEFAULT_VERSION,
+                description = "All management API for HugeGraph",
+                contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
+        ),
+        security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
 )
 public class ApplicationConfig extends ResourceConfig {
 
@@ -131,9 +131,9 @@ private class GraphManagerFactory extends AbstractBinder implements Factory
Date: Thu, 8 Feb 2024 21:05:32 +0800
Subject: [PATCH 02/13] format&clean code in cassandra

---
 .../cassandra/CassandraEntryIterator.java     |  2 +-
 .../store/cassandra/CassandraMetrics.java     |  6 +--
 .../store/cassandra/CassandraSerializer.java  |  1 +
 .../store/cassandra/CassandraSessionPool.java |  1 +
 .../store/cassandra/CassandraShard.java       | 42 ++++++++++---------
 .../store/cassandra/CassandraStore.java       | 37 ++++++++--------
 .../store/cassandra/CassandraTable.java       | 30 ++++++-------
 .../store/cassandra/CassandraTables.java      |  8 ++--
 8 files changed, 65 insertions(+), 62 deletions(-)

diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
index 8cb0bc78ba..2f057007f1 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
@@ -43,7 +43,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
     private BackendEntry next;
 
     public CassandraEntryIterator(ResultSet results, Query query,
-           BiFunction merger) {
+                                  BiFunction merger) {
         super(query);
         this.results = results;
         this.rows = results.iterator();
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
index e3e3eb51a6..400efd024c 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
@@ -108,7 +108,7 @@ protected Map getMetricsByHost(String host) {
             metrics.put(MEM_UNIT, "MB");
 
             long diskSize = UnitUtil.bytesFromReadableString(
-                            probe.getLoadString());
+                    probe.getLoadString());
             metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize));
             metrics.put(DISK_USAGE + READABLE,
                         UnitUtil.bytesToReadableString(diskSize));
@@ -213,7 +213,7 @@ protected static void appendTimerMetrics(Map metrics,
         String name = humpToLine(metric + "_" + suffix);
         // Aggregation of metrics for the whole host if keyspace=null
         JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric(
-                              keyspace, null, metric);
+                keyspace, null, metric);
         Map timerMap = InsertionOrderUtil.newMap();
         timerMap.put("count", value.getCount());
         timerMap.put("min", value.getMin());
@@ -316,7 +316,7 @@ private Map executeAllHosts(Function func) {
     }
 
     private NodeProbe newNodeProbe(String host) throws IOException {
-        LOG.debug("Probe to cassandra node: '{}:{}'", host,  this.port);
+        LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
         return this.username.isEmpty() ?
                new NodeProbe(host, this.port) :
                new NodeProbe(host, this.port, this.username, this.password);
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
index 0901a0231c..fc3c499a81 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
@@ -45,6 +45,7 @@
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.InsertionOrderUtil;
 import org.apache.hugegraph.util.JsonUtil;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
index a50cc3099c..7a9ffa2b91 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
@@ -26,6 +26,7 @@
 import org.apache.hugegraph.backend.store.BackendSessionPool;
 import org.apache.hugegraph.config.HugeConfig;
 import org.apache.hugegraph.util.E;
+
 import com.datastax.driver.core.BatchStatement;
 import com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.Cluster.Builder;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
index 30bd148346..5f37922985 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
@@ -32,7 +32,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
-import org.apache.cassandra.schema.SchemaConstants;
 import org.apache.cassandra.db.SystemKeyspace;
 import org.apache.cassandra.dht.ByteOrderedPartitioner;
 import org.apache.cassandra.dht.IPartitioner;
@@ -41,10 +40,11 @@
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.dht.Token.TokenFactory;
-
+import org.apache.cassandra.schema.SchemaConstants;
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.store.Shard;
 import org.apache.hugegraph.util.Bytes;
+
 import com.datastax.driver.core.Host;
 import com.datastax.driver.core.Metadata;
 import com.datastax.driver.core.ResultSet;
@@ -82,9 +82,10 @@ public CassandraShard(CassandraSessionPool.Session session,
 
     /**
      * Get splits of a table
+     *
      * @param splitPartitions: expected partitions count per split
-     * @param splitSize: expected size(bytes) per split,
-     *        splitPartitions will be ignored if splitSize is passed
+     * @param splitSize:       expected size(bytes) per split,
+     *                         splitPartitions will be ignored if splitSize is passed
      * @return a list of Shard
      */
     public List getSplits(long splitPartitions, long splitSize) {
@@ -105,7 +106,7 @@ public List getSplits(long splitPartitions, long splitSize) {
                  * compute bite-sized splits.
                  */
                 futures.add(executor.submit(new SplitCallable(
-                            range, splitPartitions, splitSize)));
+                        range, splitPartitions, splitSize)));
             }
 
             // Wait until we have all the results back
@@ -128,11 +129,12 @@ public List getSplits(long splitPartitions, long splitSize) {
     /**
      * Get splits of a table in specified range
      * NOTE: maybe we don't need this method
-     * @param start: the start of range
-     * @param end: the end of range
+     *
+     * @param start:           the start of range
+     * @param end:             the end of range
      * @param splitPartitions: expected partitions count per split
-     * @param splitSize: expected size(bytes) per split,
-     *        splitPartitions will be ignored if splitSize is passed
+     * @param splitSize:       expected size(bytes) per split,
+     *                         splitPartitions will be ignored if splitSize is passed
      * @return a list of Shard
      */
     public List getSplits(String start, String end,
@@ -146,8 +148,8 @@ public List getSplits(String start, String end,
             List>> futures = new ArrayList<>();
             TokenFactory tokenFactory = this.partitioner.getTokenFactory();
             TokenRange tokenRange = rangeToTokenRange(new Range<>(
-                                    tokenFactory.fromString(start),
-                                    tokenFactory.fromString(end)));
+                    tokenFactory.fromString(start),
+                    tokenFactory.fromString(end)));
 
             // Canonical ranges and nodes holding replicas
             Map> masterRangeNodes = getRangeMap();
@@ -157,7 +159,7 @@ public List getSplits(String start, String end,
                     // For each tokenRange, pick a live owner and ask it
                     // to compute bite-sized splits
                     futures.add(executor.submit(new SplitCallable(
-                                r, splitPartitions, splitSize)));
+                            r, splitPartitions, splitSize)));
                 }
             }
 
@@ -187,8 +189,8 @@ private TokenRange rangeToTokenRange(Range range) {
         TokenFactory tokenFactory = this.partitioner.getTokenFactory();
         Metadata metadata = this.session.metadata();
         return metadata.newTokenRange(
-                        metadata.newToken(tokenFactory.toString(range.left)),
-                        metadata.newToken(tokenFactory.toString(range.right)));
+                metadata.newToken(tokenFactory.toString(range.left)),
+                metadata.newToken(tokenFactory.toString(range.right)));
     }
 
     private Map getSubSplits(TokenRange tokenRange,
@@ -205,8 +207,8 @@ private Map getSubSplits(TokenRange tokenRange,
     private Map> getRangeMap() {
         Metadata metadata = this.session.metadata();
         return metadata.getTokenRanges().stream().collect(Collectors.toMap(
-            p -> p,
-            p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
+                p -> p,
+                p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
     }
 
     private static Map describeSplits(
@@ -274,15 +276,15 @@ public SplitCallable(TokenRange tokenRange,
                              long splitPartitions, long splitSize) {
             if (splitSize <= 0 && splitPartitions <= 0) {
                 throw new IllegalArgumentException(String.format(
-                          "The split-partitions must be > 0, but got %s",
-                          splitPartitions));
+                        "The split-partitions must be > 0, but got %s",
+                        splitPartitions));
             }
 
             if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) {
                 // splitSize should be at least 1M if passed
                 throw new IllegalArgumentException(String.format(
-                          "The split-size must be >= %s bytes, but got %s",
-                          MIN_SHARD_SIZE, splitSize));
+                        "The split-size must be >= %s bytes, but got %s",
+                        MIN_SHARD_SIZE, splitSize));
             }
 
             this.tokenRange = tokenRange;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
index 4c9ef8334b..890f0853c9 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
@@ -26,8 +26,6 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.slf4j.Logger;
-
 import org.apache.hugegraph.HugeException;
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.id.Id;
@@ -45,6 +43,7 @@
 import org.apache.hugegraph.type.HugeType;
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
 
 import com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.KeyspaceMetadata;
@@ -170,7 +169,7 @@ public synchronized void open(HugeConfig config) {
             } catch (InvalidQueryException e) {
                 // TODO: the error message may be changed in different versions
                 if (!e.getMessage().contains(String.format(
-                    "Keyspace '%s' does not exist", this.keyspace))) {
+                        "Keyspace '%s' does not exist", this.keyspace))) {
                     throw e;
                 }
                 if (this.isSchemaStore()) {
@@ -211,7 +210,7 @@ public void mutate(BackendMutation mutation) {
         this.checkOpened();
         CassandraSessionPool.Session session = this.sessions.session();
 
-        for (Iterator it = mutation.mutation(); it.hasNext();) {
+        for (Iterator it = mutation.mutation(); it.hasNext(); ) {
             this.mutate(session, it.next());
         }
     }
@@ -296,7 +295,7 @@ private void mutate(CassandraSessionPool.Session session,
                 break;
             default:
                 throw new AssertionError(String.format(
-                          "Unsupported mutate action: %s", item.action()));
+                        "Unsupported mutate action: %s", item.action()));
         }
     }
 
@@ -305,7 +304,7 @@ public Iterator query(Query query) {
         this.checkOpened();
         HugeType type = CassandraTable.tableType(query);
         String tableName = query.olap() ? this.olapTableName(type) :
-                                          type.string();
+                           type.string();
         CassandraTable table = this.table(tableName);
         Iterator entries = table.query(this.session(null), query);
         // Merge olap results as needed
@@ -445,9 +444,9 @@ public void commitTx() {
             LOG.error("Failed to commit statements due to:", e);
             assert session.statements().size() > 0;
             throw new BackendException(
-                      "Failed to commit %s statements: '%s'...", e,
-                      session.statements().size(),
-                      session.statements().iterator().next());
+                    "Failed to commit %s statements: '%s'...", e,
+                    session.statements().size(),
+                    session.statements().iterator().next());
         }
     }
 
@@ -512,7 +511,7 @@ private static Map parseReplica(HugeConfig conf) {
         switch (strategy) {
             case "SimpleStrategy":
                 List replicas =
-                             conf.get(CassandraOptions.CASSANDRA_REPLICATION);
+                        conf.get(CassandraOptions.CASSANDRA_REPLICATION);
                 E.checkArgument(replicas.size() == 1,
                                 "Individual factor value should be provided " +
                                 "with SimpleStrategy for Cassandra");
@@ -522,7 +521,7 @@ private static Map parseReplica(HugeConfig conf) {
             case "NetworkTopologyStrategy":
                 // The replicas format is like 'dc1:2,dc2:1'
                 Map replicaMap =
-                            conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
+                        conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
                 for (Map.Entry e : replicaMap.entrySet()) {
                     E.checkArgument(!e.getKey().isEmpty(),
                                     "The datacenter can't be empty");
@@ -531,9 +530,9 @@ private static Map parseReplica(HugeConfig conf) {
                 break;
             default:
                 throw new AssertionError(String.format(
-                          "Illegal replication strategy '%s', valid strategy " +
-                          "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
-                          strategy));
+                        "Illegal replication strategy '%s', valid strategy " +
+                        "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
+                        strategy));
         }
         return replication;
     }
@@ -543,8 +542,8 @@ private static int convertFactor(String factor) {
             return Integer.valueOf(factor);
         } catch (NumberFormatException e) {
             throw new BackendException(
-                      "Expect int factor value for SimpleStrategy, " +
-                      "but got '%s'", factor);
+                    "Expect int factor value for SimpleStrategy, " +
+                    "but got '%s'", factor);
         }
     }
 
@@ -720,19 +719,19 @@ public CassandraGraphStore(BackendStoreProvider provider,
         @Override
         public Id nextId(HugeType type) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.nextId()");
+                    "CassandraGraphStore.nextId()");
         }
 
         @Override
         public void increaseCounter(HugeType type, long num) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.increaseCounter()");
+                    "CassandraGraphStore.increaseCounter()");
         }
 
         @Override
         public long getCounter(HugeType type) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.getCounter()");
+                    "CassandraGraphStore.getCounter()");
         }
 
         @Override
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
index 633c98bc8e..395b0230e3 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
@@ -27,9 +27,6 @@
 import java.util.function.BiFunction;
 import java.util.function.Function;
 
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.slf4j.Logger;
-
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.id.Id;
 import org.apache.hugegraph.backend.page.PageState;
@@ -51,6 +48,9 @@
 import org.apache.hugegraph.util.CopyUtil;
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.slf4j.Logger;
+
 import com.datastax.driver.core.ColumnDefinitions.Definition;
 import com.datastax.driver.core.DataType;
 import com.datastax.driver.core.PagingState;
@@ -74,7 +74,7 @@
 import com.google.common.collect.ImmutableMap;
 
 public abstract class CassandraTable
-                extends BackendTable {
+        extends BackendTable {
 
     private static final Logger LOG = Log.logger(CassandraTable.class);
     private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;
@@ -90,8 +90,8 @@ protected void registerMetaHandlers() {
                             "The args count of %s must be 1", meta);
             long splitSize = (long) args[0];
             CassandraShard splitter = new CassandraShard(session,
-                                                        session.keyspace(),
-                                                        this.table());
+                                                         session.keyspace(),
+                                                         this.table());
             return splitter.getSplits(0, splitSize);
         });
     }
@@ -118,12 +118,12 @@ public Number queryNumber(CassandraSessionPool.Session session,
             statement.setReadTimeoutMillis(timeout * 1000);
             return session.query(statement);
         }, (q, rs) -> {
-                Row row = rs.one();
-                if (row == null) {
-                    return IteratorUtils.of(aggregate.defaultValue());
-                }
-                return IteratorUtils.of(row.getLong(0));
-            });
+            Row row = rs.one();
+            if (row == null) {
+                return IteratorUtils.of(aggregate.defaultValue());
+            }
+            return IteratorUtils.of(row.getLong(0));
+        });
         return aggregate.reduce(results);
     }
 
@@ -136,7 +136,7 @@ public Iterator query(CassandraSessionPool.Session session,
     protected  Iterator query(Query query,
                                     Function fetcher,
                                     BiFunction>
-                                    parser) {
+                                            parser) {
         ExtendableIterator rs = new ExtendableIterator<>();
 
         if (query.limit() == 0L && !query.noLimit()) {
@@ -279,8 +279,8 @@ protected List