diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0a1169752..d6b0198195 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: BACKEND: [memory, cassandra, scylladb, hbase, rocksdb, mysql, postgresql] - JAVA_VERSION: ['8'] + JAVA_VERSION: ['8', '11'] steps: - name: Install JDK ${{ matrix.JAVA_VERSION }} @@ -50,12 +50,24 @@ jobs: - name: Compile run: | - mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded" + mvn clean compile -U -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded" + + - name: Install JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' - name: Prepare env and service run: | $TRAVIS_DIR/install-backend.sh $BACKEND + - name: Install JDK ${{ matrix.JAVA_VERSION }} + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.JAVA_VERSION }} + distribution: 'zulu' + # - name: Init MySQL Env # if: ${{ env.BACKEND == 'mysql' }} # uses: mirromutth/mysql-action@v1.1 diff --git a/hugegraph-api/pom.xml b/hugegraph-api/pom.xml index 3632e75d37..0bc3a36bb7 100644 --- a/hugegraph-api/pom.xml +++ b/hugegraph-api/pom.xml @@ -93,27 +93,27 @@ org.glassfish.grizzly grizzly-http - 2.4.4 + 3.0.1 org.glassfish.grizzly grizzly-framework - 2.4.4 + 3.0.1 org.glassfish.grizzly grizzly-http-server - 2.4.4 + 3.0.1 org.glassfish.grizzly grizzly-http-servlet - 2.4.4 + 3.0.1 io.dropwizard.metrics - metrics-jersey2 + metrics-jersey3 diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java index 0ecee3f9e5..8aabf505bb 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java @@ -24,10 +24,10 @@ import java.util.concurrent.Callable; import java.util.function.Consumer; -import javax.ws.rs.ForbiddenException; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.NotSupportedException; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.ForbiddenException; +import jakarta.ws.rs.NotFoundException; +import jakarta.ws.rs.NotSupportedException; +import jakarta.ws.rs.core.MediaType; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java index 4d947837f3..1225f30ffd 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java @@ -21,19 +21,19 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - +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.slf4j.Logger; import com.baidu.hugegraph.HugeGraph; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java index 634bade2da..0807f4c257 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java @@ -21,19 +21,19 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - +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 jakarta.inject.Singleton; import org.slf4j.Logger; import com.baidu.hugegraph.HugeGraph; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java index e884c544ce..cc59eb5622 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java @@ -21,19 +21,19 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - +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 jakarta.inject.Singleton; import org.slf4j.Logger; import com.baidu.hugegraph.HugeGraph; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java index 51cd1f3976..12eec8cfde 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java @@ -19,20 +19,20 @@ package com.baidu.hugegraph.api.auth; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import javax.security.sasl.AuthenticationException; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.NotAuthorizedException; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.NotAuthorizedException; +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 jakarta.ws.rs.core.HttpHeaders; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java index 4eb9573fda..e91b4f4309 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java @@ -23,18 +23,18 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java index 04c1181522..e1d5e17f89 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java @@ -22,18 +22,18 @@ import java.util.List; import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java index 0bb744a976..9811459f78 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java @@ -21,18 +21,18 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java index bbc6745b85..0dc1305eed 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java @@ -25,18 +25,18 @@ import java.util.List; import java.util.Map; -import javax.annotation.Priority; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.NotAuthorizedException; -import javax.ws.rs.Priorities; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.core.UriInfo; -import javax.ws.rs.ext.Provider; +import jakarta.annotation.Priority; +import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.NotAuthorizedException; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.PreMatching; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.UriInfo; +import jakarta.ws.rs.ext.Provider; import javax.xml.bind.DatatypeConverter; import org.apache.commons.lang3.StringUtils; @@ -71,10 +71,10 @@ public class AuthenticationFilter implements ContainerRequestFilter { ); @Context - private javax.inject.Provider managerProvider; + private jakarta.inject.Provider managerProvider; @Context - private javax.inject.Provider requestProvider; + private jakarta.inject.Provider requestProvider; @Override public void filter(ContainerRequestContext context) throws IOException { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java index 447617b17a..fe5ec1ff58 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java @@ -26,13 +26,13 @@ import java.lang.annotation.RetentionPolicy; import java.util.zip.GZIPOutputStream; -import javax.inject.Singleton; -import javax.ws.rs.NameBinding; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.Provider; -import javax.ws.rs.ext.WriterInterceptor; -import javax.ws.rs.ext.WriterInterceptorContext; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/DecompressInterceptor.java index 563e6990d0..496cf6ecd9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/DecompressInterceptor.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/DecompressInterceptor.java @@ -24,11 +24,11 @@ import java.lang.annotation.RetentionPolicy; import java.util.zip.GZIPInputStream; -import javax.inject.Singleton; -import javax.ws.rs.NameBinding; -import javax.ws.rs.ext.Provider; -import javax.ws.rs.ext.ReaderInterceptor; -import javax.ws.rs.ext.ReaderInterceptorContext; +import jakarta.inject.Singleton; +import jakarta.ws.rs.NameBinding; +import jakarta.ws.rs.ext.Provider; +import jakarta.ws.rs.ext.ReaderInterceptor; +import jakarta.ws.rs.ext.ReaderInterceptorContext; @Provider @Singleton diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/ExceptionFilter.java index 0b1260c78a..252f715da1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/ExceptionFilter.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/ExceptionFilter.java @@ -23,23 +23,24 @@ import java.util.Map; import java.util.NoSuchElementException; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; import javax.json.Json; import javax.json.JsonArrayBuilder; import javax.json.JsonObjectBuilder; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; + +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; import org.apache.commons.lang3.StringUtils; import org.glassfish.hk2.api.MultiException; @@ -67,7 +68,7 @@ public static class TracedExceptionMapper extends API { private static boolean forcedTrace = false; @Context - private javax.inject.Provider configProvider; + private jakarta.inject.Provider configProvider; protected boolean trace() { if (forcedTrace) { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadDetectFilter.java index d52cf12374..ba59f1ab80 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadDetectFilter.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadDetectFilter.java @@ -22,14 +22,14 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.ServiceUnavailableException; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.PathSegment; -import javax.ws.rs.ext.Provider; +import jakarta.inject.Singleton; +import jakarta.ws.rs.ServiceUnavailableException; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.PreMatching; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.PathSegment; +import jakarta.ws.rs.ext.Provider; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.config.ServerOptions; @@ -56,9 +56,9 @@ public class LoadDetectFilter implements ContainerRequestFilter { RateLimiter.create(1.0 / 30); @Context - private javax.inject.Provider configProvider; + private jakarta.inject.Provider configProvider; @Context - private javax.inject.Provider loadProvider; + private jakarta.inject.Provider loadProvider; @Override public void filter(ContainerRequestContext context) { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadReleaseFilter.java index c393b0107b..210f996c19 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadReleaseFilter.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/LoadReleaseFilter.java @@ -19,12 +19,12 @@ package com.baidu.hugegraph.api.filter; -import javax.inject.Singleton; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.ext.Provider; +import jakarta.inject.Singleton; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.ext.Provider; import com.baidu.hugegraph.define.WorkLoad; @@ -33,7 +33,7 @@ public class LoadReleaseFilter implements ContainerResponseFilter { @Context - private javax.inject.Provider loadProvider; + private jakarta.inject.Provider loadProvider; @Override public void filter(ContainerRequestContext requestContext, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/StatusFilter.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/StatusFilter.java index f27f3f58db..3d93b9ef9c 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/StatusFilter.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/StatusFilter.java @@ -24,11 +24,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import javax.ws.rs.NameBinding; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.ext.Provider; +import jakarta.ws.rs.NameBinding; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.ext.Provider; @Provider public class StatusFilter implements ContainerResponseFilter { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java index caa6a21341..33909ec1c9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java @@ -26,19 +26,19 @@ import java.util.Map; import java.util.NoSuchElementException; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java index 0ab4f638f3..a968806b6d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java @@ -27,19 +27,19 @@ import java.util.Map; import java.util.NoSuchElementException; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java index d071c45f73..5c897cb730 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java @@ -22,18 +22,17 @@ import java.util.Map; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriInfo; import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.api.filter.CompressInterceptor.Compress; @@ -45,6 +44,8 @@ import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import jakarta.inject.Provider; +import jakarta.inject.Singleton; @Path("gremlin") @Singleton @@ -57,7 +58,7 @@ public class GremlinAPI extends API { private static final Set FORBIDDEN_REQUEST_EXCEPTIONS = ImmutableSet.of("java.lang.SecurityException", - "javax.ws.rs.ForbiddenException"); + "jakarta.ws.rs.ForbiddenException"); private static final Set BAD_REQUEST_EXCEPTIONS = ImmutableSet.of( "java.lang.IllegalArgumentException", "java.util.concurrent.TimeoutException", @@ -67,7 +68,7 @@ public class GremlinAPI extends API { ); @Context - private javax.inject.Provider configProvider; + private Provider configProvider; private GremlinClient client; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinClient.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinClient.java index b3d1d21d32..b2b2725f87 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinClient.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinClient.java @@ -22,12 +22,12 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import com.baidu.hugegraph.api.filter.CompressInterceptor; import com.baidu.hugegraph.rest.AbstractRestClient; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java index e3ffe1eeca..14eab1fcf7 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java @@ -21,14 +21,14 @@ import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.NotFoundException; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java index 8c5afe12c9..9d1a5a2151 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java @@ -27,14 +27,14 @@ import java.util.HashMap; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java index b4440205fd..eb382cc933 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java @@ -21,13 +21,13 @@ import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.PUT; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java index 57a64f8905..3add958cb7 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java @@ -26,18 +26,18 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.inject.Singleton; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.NotSupportedException; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.NotSupportedException; +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.groovy.util.Maps; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java index 27c4caed73..23c0ae8aeb 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java @@ -25,12 +25,12 @@ import java.util.LinkedHashMap; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java index b09ac224e7..040ec49be1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java @@ -24,21 +24,21 @@ import java.util.Map; import java.util.Set; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.ForbiddenException; -import javax.ws.rs.GET; -import javax.ws.rs.NotSupportedException; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +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.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.SecurityContext; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -152,7 +152,7 @@ public File getConf(@Context GraphManager manager, HugeGraph g = graph4admin(manager, name); HugeConfig config = (HugeConfig) g.configuration(); - File file = config.getFile(); + 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."); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/ProfileAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/ProfileAPI.java index 5860117f5b..e8cd4bc3dc 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/ProfileAPI.java @@ -26,18 +26,18 @@ import java.util.TreeMap; import java.util.TreeSet; -import javax.inject.Singleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; +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.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.Parameter.Source; import org.glassfish.jersey.server.model.Resource; import org.glassfish.jersey.server.model.ResourceMethod; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/VersionAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/VersionAPI.java index b4e0343b7d..5f107cb363 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/VersionAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/VersionAPI.java @@ -21,11 +21,11 @@ import java.util.Map; -import javax.annotation.security.PermitAll; -import javax.inject.Singleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import jakarta.annotation.security.PermitAll; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.version.ApiVersion; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/raft/RaftAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/raft/RaftAPI.java index 9f06852c6f..e8e7aa7a68 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/raft/RaftAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/raft/RaftAPI.java @@ -22,17 +22,17 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java index e7e8880725..17e895ca44 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java @@ -23,18 +23,18 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java index 5aa6c50814..b98e8b9bd6 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java @@ -23,18 +23,18 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java index 4c3e99b311..fe099552c9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java @@ -23,18 +23,18 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java index 378005e812..c18d46a214 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java @@ -23,13 +23,13 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java index 38e3ecf099..454cc72a98 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java @@ -23,18 +23,18 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java index 2c063264f0..bb96947829 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java @@ -22,14 +22,14 @@ import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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 com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.api.API; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java index cfbde599ee..d6a0078d94 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java @@ -24,14 +24,14 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java index ecda4ad32d..2126b1e6de 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java @@ -27,12 +27,12 @@ import java.util.List; import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java index 8b8f43301e..fb0ba9eee2 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java @@ -23,14 +23,14 @@ import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java index 3162c55acb..5a2549b0ca 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java @@ -30,13 +30,13 @@ import java.util.Map; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java index f50e9e4eb9..2154706b16 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java @@ -32,13 +32,13 @@ import java.util.Map; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java index cfd307f266..137afc3feb 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java @@ -24,14 +24,14 @@ import java.util.Iterator; import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Edge; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java index f4c52a2379..71f5a14c80 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java @@ -26,13 +26,13 @@ import java.util.Iterator; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java index 9aef1013b7..66ffbcbf1f 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java @@ -25,16 +25,16 @@ import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java index 4c721a13e5..ead263c3f8 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java @@ -27,16 +27,16 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java index 3101d045a6..7a3677f3ce 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java @@ -28,16 +28,16 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java index 8a6492aad1..9a531eff49 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java @@ -26,13 +26,13 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java index 0a69036a66..b1a8ca94be 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java @@ -28,12 +28,12 @@ import java.util.List; import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java index 9824a4b938..93ac45808d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java @@ -29,16 +29,16 @@ import java.util.Iterator; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java index 9328798a41..bf09c22bb9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java @@ -26,12 +26,12 @@ import java.util.Map; -import javax.inject.Singleton; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java index bb36766782..ae663dc6b9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java @@ -23,14 +23,14 @@ import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java index d272b5f667..5b034681f9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java @@ -22,14 +22,14 @@ import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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 com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.api.API; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java index 6879da007e..f257267c9e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java @@ -23,14 +23,14 @@ import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java index 05c12d6ad2..745877426d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java @@ -24,14 +24,14 @@ import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java index 87e2f7cd60..85d84ca3be 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java @@ -24,14 +24,14 @@ import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java index 6a2d973809..d7218269f1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java @@ -25,14 +25,14 @@ import java.util.Iterator; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java index 2dc33a8fd8..9674cf8b9a 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java @@ -28,13 +28,13 @@ import java.util.List; import java.util.Set; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java index 9dbf0fad7a..84547ecb52 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java @@ -24,14 +24,14 @@ import java.util.Iterator; import java.util.List; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java index 1c7def2263..8a46cba78e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java @@ -24,14 +24,14 @@ import java.util.Iterator; -import javax.inject.Singleton; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; +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.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java index 64c01d2258..7c55ae3516 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java @@ -22,16 +22,16 @@ import java.util.Map; import java.util.Optional; -import javax.inject.Singleton; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.NotFoundException; +import jakarta.ws.rs.PUT; +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; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java index fb81867829..9dc2d20987 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java @@ -28,8 +28,6 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.configuration.Configuration; - import com.baidu.hugegraph.HugeException; import com.baidu.hugegraph.HugeFactory; import com.baidu.hugegraph.HugeGraph; @@ -57,10 +55,10 @@ import com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy; +import com.baidu.hugegraph.util.Reflection; import com.baidu.hugegraph.variables.HugeVariables; import com.google.common.collect.ImmutableSet; - -import sun.reflect.Reflection; +import org.apache.commons.configuration2.Configuration; public final class HugeFactoryAuthProxy { @@ -93,7 +91,7 @@ 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", "threadLocalRandomProbe", "threadLocalRandomSecondarySeed"); + 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"); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java index 3add4ab17e..8c3846d760 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java @@ -22,6 +22,7 @@ import java.time.Duration; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Objects; @@ -36,17 +37,23 @@ import java.util.function.Supplier; import javax.security.sasl.AuthenticationException; -import javax.ws.rs.ForbiddenException; -import javax.ws.rs.NotAuthorizedException; -import org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator; +import com.baidu.hugegraph.iterator.MapperIterator; +import com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal; +import jakarta.ws.rs.ForbiddenException; +import jakarta.ws.rs.NotAuthorizedException; + +import org.apache.commons.configuration2.Configuration; +import org.apache.groovy.json.internal.MapItemValue; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode.Instruction; -import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin; +import org.apache.tinkerpop.gremlin.process.traversal.Script; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -91,7 +98,6 @@ import com.baidu.hugegraph.task.TaskManager; import com.baidu.hugegraph.task.TaskScheduler; import com.baidu.hugegraph.task.TaskStatus; -import com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal; import com.baidu.hugegraph.type.HugeType; import com.baidu.hugegraph.type.Nameable; import com.baidu.hugegraph.type.define.GraphMode; @@ -550,7 +556,8 @@ public Variables variables() { @Override public HugeConfig configuration() { - throw new NotSupportException("Graph.configuration()"); + this.verifyAdminPermission(); + return (HugeConfig) this.hugegraph.configuration(); } @Override @@ -1611,31 +1618,16 @@ public List> toList() { } @Override - public void applyStrategies(Admin traversal) { - String script; - if (traversal instanceof HugeScriptTraversal) { - script = ((HugeScriptTraversal) traversal).script(); - } else { - GroovyTranslator translator = GroovyTranslator.of("g"); - script = translator.translate(traversal.getBytecode()); - } + public Iterator> iterator() { + if (this.strategies == null) { + return Collections.emptyIterator(); - /* - * Verify gremlin-execute permission for user gremlin(in gremlin- - * server-exec worker) and gremlin job(in task worker). - * But don't check permission in rest worker, because the following - * places need to call traversal(): - * 1.vertices/edges rest api - * 2.oltp rest api (like crosspointpath/neighborrank) - * 3.olap rest api (like centrality/lpa/louvain/subgraph) - */ - String caller = Thread.currentThread().getName(); - if (!caller.contains(REST_WORKER)) { - verifyNamePermission(HugePermission.EXECUTE, - ResourceType.GREMLIN, script); } - - this.strategies.applyStrategies(traversal); + return new MapperIterator, + TraversalStrategy>( + this.strategies.iterator(), (strategy) -> { + return new TraversalStrategyProxy(strategy); + }); } @Override @@ -1674,6 +1666,89 @@ private String translate(Bytecode bytecode) { } } + private final class TraversalStrategyProxy + implements TraversalStrategy { + private final TraversalStrategy origin; + + public TraversalStrategyProxy(TraversalStrategy origin) { + this.origin = origin; + } + + @Override + public void apply(Traversal.Admin traversal) { + String script; + if (traversal instanceof HugeScriptTraversal) { + script = ((HugeScriptTraversal) traversal).script(); + } else { + GroovyTranslator translator = GroovyTranslator.of("g"); + Script script1 = translator.translate(traversal.getBytecode()); + if (script1 != null) { + script = script1.getScript(); + } else { + script = ""; + } + } + + /* + * Verify gremlin-execute permission for user gremlin(in gremlin- + * server-exec worker) and gremlin job(in task worker). + * But don't check permission in rest worker, because the following + * places need to call traversal(): + * 1.vertices/edges rest api + * 2.oltp rest api (like crosspointpath/neighborrank) + * 3.olap rest api (like centrality/lpa/louvain/subgraph) + */ + String caller = Thread.currentThread().getName(); + if (!caller.contains(TraversalStrategiesProxy.REST_WORKER)) { + verifyNamePermission(HugePermission.EXECUTE, + ResourceType.GREMLIN, script); + } + + this.origin.apply(traversal); + } + + @Override + public Set> applyPrior() { + return this.origin.applyPrior(); + } + + @Override + public Set> applyPost() { + return this.origin.applyPost(); + } + + @Override + public Class getTraversalCategory() { + return this.origin.getTraversalCategory(); + } + + @Override + public Configuration getConfiguration() { + return this.origin.getConfiguration(); + } + + @Override + public int compareTo(Class + otherTraversalCategory) { + return this.origin.compareTo(otherTraversalCategory); + } + + @Override + public int hashCode() { + return this.origin.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return this.origin.equals(obj); + } + + @Override + public String toString() { + return this.origin.toString(); + } + } + private static final ThreadLocal contexts = new InheritableThreadLocal<>(); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java index 60a3b772cf..514d8e03db 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java @@ -57,7 +57,7 @@ public class WsAndHttpBasicAuthHandler extends SaslAuthenticationHandler { private static final String HTTP_AUTH = "http-authentication"; public WsAndHttpBasicAuthHandler(Authenticator authenticator, - Settings.AuthenticationSettings settings) { + Settings settings) { super(authenticator, settings); } @@ -70,8 +70,7 @@ public void channelRead(final ChannelHandlerContext ctx, final Object obj) if (authHandler != null) { authHandler = pipeline.remove(HTTP_AUTH); } else { - authHandler = new HttpBasicAuthHandler( - this.authenticator, this.authenticationSettings); + authHandler = new HttpBasicAuthHandler(this.authenticator); } pipeline.addAfter(AUTHENTICATOR, HTTP_AUTH, authHandler); ctx.fireChannelRead(obj); @@ -93,8 +92,7 @@ private static class HttpBasicAuthHandler private final Base64.Decoder decoder = Base64.getUrlDecoder(); - public HttpBasicAuthHandler(Authenticator authenticator, - Settings.AuthenticationSettings settings) { + public HttpBasicAuthHandler(Authenticator authenticator) { super(authenticator); } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java index eed83c0cb7..7f4ccecc2b 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java @@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException; import org.apache.tinkerpop.gremlin.server.util.MetricManager; @@ -334,6 +334,8 @@ private void closeTx(final Set graphSourceNamesToCloseTxOn, private void loadGraph(String name, String path) { final Graph graph = GraphFactory.open(path); this.graphs.put(name, graph); + HugeConfig config = (HugeConfig) graph.configuration(); + config.file(path); LOG.info("Graph '{}' was successfully configured via '{}'", name, path); if (this.requireAuthentication() && diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java index 69949009a8..b5c0801770 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java @@ -19,7 +19,7 @@ package com.baidu.hugegraph.server; -import javax.ws.rs.ApplicationPath; +import jakarta.ws.rs.ApplicationPath; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.glassfish.hk2.api.Factory; @@ -40,7 +40,7 @@ import com.baidu.hugegraph.event.EventHub; import com.baidu.hugegraph.util.E; import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.jersey2.InstrumentedResourceMethodApplicationListener; +import com.codahale.metrics.jersey3.InstrumentedResourceMethodApplicationListener; @ApplicationPath("/") public class ApplicationConfig extends ResourceConfig { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/RestServer.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/RestServer.java index 4ef4dc4cb1..1a8320b9de 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/RestServer.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/RestServer.java @@ -25,7 +25,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; -import javax.ws.rs.core.UriBuilder; +import jakarta.ws.rs.core.UriBuilder; import org.glassfish.grizzly.CompletionHandler; import org.glassfish.grizzly.GrizzlyFuture; diff --git a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraSessionPool.java index 42dfb936e5..232fa85492 100644 --- a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraSessionPool.java +++ b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraSessionPool.java @@ -66,8 +66,15 @@ public synchronized void open() { int port = config.get(CassandraOptions.CASSANDRA_PORT); assert this.cluster == null || this.cluster.isClosed(); + /* + * We disable cassandra metrics through withoutMetrics(), due to + * metrics versions are incompatible, java11 glassfish use metrics 4, + * but cassandra use metrics 3. + * TODO: fix it after after cassandra upgrade metrics version + */ Builder builder = Cluster.builder() .addContactPoints(hosts.split(",")) + .withoutMetrics() .withPort(port); // Timeout options diff --git a/hugegraph-core/pom.xml b/hugegraph-core/pom.xml index 4351d29290..1e5a02f241 100644 --- a/hugegraph-core/pom.xml +++ b/hugegraph-core/pom.xml @@ -19,7 +19,7 @@ com.baidu.hugegraph hugegraph-common - 2.0.1 + 2.1.2 diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java index 56ee22e84b..b12e2b1378 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java @@ -26,9 +26,10 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.slf4j.Logger; import com.baidu.hugegraph.config.CoreOptions; @@ -72,11 +73,14 @@ public static synchronized HugeGraph open(HugeConfig config) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { // Not allowed to read file via Gremlin when SecurityManager enabled - String configFile = config.getFileName(); + String configFileName; + File configFile = config.file(); if (configFile == null) { - configFile = config.toString(); + configFileName = config.toString(); + } else { + configFileName = configFile.getName(); } - sm.checkRead(configFile); + sm.checkRead(configFileName); } String name = config.get(CoreOptions.STORE); @@ -123,7 +127,7 @@ public static PropertiesConfiguration getLocalConfig(String path) { "Please specify a proper config file rather than: %s", file.toString()); try { - return new PropertiesConfiguration(file); + return new Configurations().properties(file); } catch (ConfigurationException e) { throw new HugeException("Unable to load config file: %s", e, path); } @@ -131,7 +135,7 @@ public static PropertiesConfiguration getLocalConfig(String path) { public static PropertiesConfiguration getRemoteConfig(URL url) { try { - return new PropertiesConfiguration(url); + return new Configurations().properties(url); } catch (ConfigurationException e) { throw new HugeException("Unable to load remote config file: %s", e, url); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java index 1336fd98d4..bada80de85 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java @@ -912,7 +912,9 @@ public void create(String configPath, Id server, NodeRole role) { this.serverStarted(server, role); // Write config to disk file - ConfigUtil.writeToFile(configPath, this.name(), this.configuration()); + String confPath = ConfigUtil.writeToFile(configPath, this.name(), + this.configuration()); + this.configuration.file(confPath); } @Override @@ -921,7 +923,7 @@ public void drop() { HugeConfig config = this.configuration(); this.storeProvider.onDeleteConfig(config); - ConfigUtil.deleteFile(config.getFile()); + ConfigUtil.deleteFile(config.file()); try { /* @@ -940,7 +942,6 @@ public void drop() { @Override public HugeConfig cloneConfig(String newGraph) { HugeConfig config = (HugeConfig) this.configuration().clone(); - config.setDelimiterParsingDisabled(true); this.storeProvider.onCloneConfig(config, newGraph); return config; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/HugeTarget.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/HugeTarget.java index 799aba4eb2..ed01fcb820 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/HugeTarget.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/HugeTarget.java @@ -36,7 +36,7 @@ import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.JsonUtil; -import jersey.repackaged.com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList; public class HugeTarget extends Entity { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java index a8ef386e39..c6640bc9b2 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java @@ -28,7 +28,8 @@ import java.util.concurrent.Callable; import javax.security.sasl.AuthenticationException; -import javax.ws.rs.ForbiddenException; + +import jakarta.ws.rs.ForbiddenException; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java index 50937ec923..ef73d890d4 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.crypto.SecretKey; -import javax.ws.rs.NotAuthorizedException; +import jakarta.ws.rs.NotAuthorizedException; import com.baidu.hugegraph.config.AuthOptions; import com.baidu.hugegraph.config.HugeConfig; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BytesBuffer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BytesBuffer.java index 3d29a51e67..7caba21716 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BytesBuffer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BytesBuffer.java @@ -20,6 +20,7 @@ package com.baidu.hugegraph.backend.serializer; import java.io.OutputStream; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Collection; @@ -122,7 +123,7 @@ public ByteBuffer asByteBuffer() { } public BytesBuffer forReadWritten() { - this.buffer.flip(); + ((Buffer) this.buffer).flip(); return this; } @@ -172,7 +173,7 @@ private void require(int size) { "Capacity exceeds max buffer capacity: %s", MAX_BUFFER_CAPACITY); ByteBuffer newBuffer = ByteBuffer.allocate(newcapacity); - this.buffer.flip(); + ((Buffer) this.buffer).flip(); newBuffer.put(this.buffer); this.buffer = newBuffer; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java index e50d507b02..55be0ce0ab 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java @@ -32,8 +32,7 @@ import java.util.function.Consumer; import java.util.function.Function; -import javax.ws.rs.ForbiddenException; - +import jakarta.ws.rs.ForbiddenException; import org.apache.commons.collections.CollectionUtils; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java index 971d927639..05db47330f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java @@ -25,11 +25,18 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.configuration.tree.ConfigurationNode; -import org.apache.tinkerpop.gremlin.util.config.YamlConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.YAMLConfiguration; +import org.apache.commons.configuration2.io.FileHandler; +import org.apache.commons.configuration2.tree.ImmutableNode; +import org.apache.commons.configuration2.tree.NodeHandler; +import org.apache.commons.configuration2.tree.NodeModel; import org.slf4j.Logger; import com.baidu.hugegraph.HugeException; @@ -71,7 +78,7 @@ public abstract class AbstractComputer implements Computer { protected static final String CATEGORY_RANK = "rank"; protected static final String CATEGORY_COMM = "community"; - private YamlConfiguration config; + private YAMLConfiguration config; private Map commonConfig = new HashMap<>(); @Override @@ -146,8 +153,9 @@ private void initializeConfig(ComputerJob job) throws Exception { E.checkArgument(configPath.endsWith(".yaml"), "Expect a yaml config file."); - this.config = new YamlConfiguration(); - this.config.load(configPath); + this.config = new YAMLConfiguration(); + FileHandler fileHandler = new FileHandler(this.config); + fileHandler.load(configPath); // Read common and computer specified parameters this.commonConfig = this.readCommonConfig(); @@ -162,16 +170,22 @@ private Map readEnvConfig() { } private Map readSubConfig(String sub) { - List nodes = this.config.getRootNode() - .getChildren(sub); - E.checkArgument(nodes.size() == 1, - "Must contain one '%s' node in config file '%s'", - sub, this.config.getFileName()); - - List subConfigs = nodes.get(0).getChildren(); - Map results = new HashMap<>(subConfigs.size()); - for (ConfigurationNode node : subConfigs) { - results.put(node.getName(), node.getValue()); + List> nodes = + this.config.childConfigurationsAt(sub); + + E.checkArgument(nodes.size() >= 1, + "'%s' must be contained in config '%s'", sub); + + ImmutableNode root = null; + NodeHandler nodeHandler = null; + Map results = new HashMap<>(nodes.size()); + for (HierarchicalConfiguration node : nodes) { + NodeModel nodeModel = node.getNodeModel(); + E.checkArgument(nodeModel != null && + (nodeHandler = nodeModel.getNodeHandler()) != null && + (root = nodeHandler.getRootNode()) != null, + "Node '%s' must contain root", node); + results.put(root.getNodeName(), root.getValue()); } return results; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java index fa4aa7f79f..87c93006a4 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java @@ -55,9 +55,11 @@ public class HugeSecurityManager extends SecurityManager { private static final Set ACCEPT_CLASS_LOADERS = ImmutableSet.of( "groovy.lang.GroovyClassLoader", "sun.reflect.DelegatingClassLoader", + "jdk.internal.reflect.DelegatingClassLoader", "org.codehaus.groovy.reflection.SunClassLoader", "org.codehaus.groovy.runtime.callsite.CallSiteClassLoader", - "org.apache.hadoop.hbase.util.DynamicClassLoader" + "org.apache.hadoop.hbase.util.DynamicClassLoader", + "org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader" ); private static final Set CAFFEINE_CLASSES = ImmutableSet.of( @@ -367,16 +369,6 @@ public void checkPrintJobAccess() { super.checkPrintJobAccess(); } - @Override - @SuppressWarnings("deprecation") - public void checkSystemClipboardAccess() { - if (callFromGremlin()) { - throw newSecurityException( - "Not allowed to access system clipboard via Gremlin"); - } - super.checkSystemClipboardAccess(); - } - @Override public void checkPackageAccess(String pkg) { super.checkPackageAccess(pkg); @@ -392,24 +384,6 @@ public void checkSecurityAccess(String target) { super.checkSecurityAccess(target); } - @Override - @SuppressWarnings("deprecation") - public void checkMemberAccess(Class clazz, int which) { - super.checkMemberAccess(clazz, which); - } - - @Override - @SuppressWarnings("deprecation") - public boolean checkTopLevelWindow(Object window) { - return super.checkTopLevelWindow(window); - } - - @Override - @SuppressWarnings("deprecation") - public void checkAwtEventQueueAccess() { - super.checkAwtEventQueueAccess(); - } - private static SecurityException newSecurityException(String message, Object... args) { if (args.length > 0) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeElement.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeElement.java index 34edd4c7bd..7c5a2598f9 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeElement.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeElement.java @@ -431,7 +431,7 @@ public static final ElementKeys classifyKeys(Object... keyValues) { .providedKeyValuesMustHaveALegalKeyOnEvenIndices(); } if (val == null) { - throw Property.Exceptions.propertyValueCanNotBeNull(); + throw Property.Exceptions.propertyDoesNotExist(); } if (key.equals(T.id)) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizePathsTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizePathsTraverser.java index ad5bf5c80b..ea2333f772 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizePathsTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizePathsTraverser.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java index 253c7bb200..312f126ddb 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java @@ -26,7 +26,7 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java index 020a8b449a..00c6b4eaad 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java @@ -24,8 +24,8 @@ import java.util.Map; import java.util.Set; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.commons.lang3.mutable.MutableInt; import org.apache.tinkerpop.gremlin.structure.Edge; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java index 84dc3a2070..340838bf50 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java @@ -28,8 +28,8 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.commons.collections.CollectionUtils; import org.apache.tinkerpop.gremlin.structure.Edge; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java index e6f21f4493..c1441b4730 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Set; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.tinkerpop.gremlin.structure.Edge; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java index a21fa536ea..fd84848f04 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java @@ -25,6 +25,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Consumer; +import com.google.common.base.Objects; import org.apache.commons.lang3.tuple.Pair; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; @@ -37,7 +38,6 @@ import com.baidu.hugegraph.iterator.FilterIterator; import com.baidu.hugegraph.util.Consumers; -import jersey.repackaged.com.google.common.base.Objects; public abstract class OltpTraverser extends HugeTraverser implements AutoCloseable { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SubGraphTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SubGraphTraverser.java index 87c8032a52..abf78c058c 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SubGraphTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SubGraphTraverser.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Set; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java index 817d188feb..123015095f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java @@ -24,7 +24,7 @@ import java.util.Set; import java.util.function.BiConsumer; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.backend.id.Id; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStepStrategy.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStepStrategy.java index 8a499b74f8..ec22a5809f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStepStrategy.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStepStrategy.java @@ -31,7 +31,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountGlobalStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateGlobalStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateLocalStep; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.IdentityStep; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectStep; import org.apache.tinkerpop.gremlin.process.traversal.step.util.CollectingBarrierStep; @@ -83,7 +84,8 @@ public void apply(Traversal.Admin traversal) { (step instanceof TraversalParent && TraversalHelper.anyStepRecursively(s -> { return s instanceof SideEffectStep || - s instanceof AggregateStep; + s instanceof AggregateGlobalStep || + s instanceof AggregateLocalStep; }, (TraversalParent) step))) { return; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeScriptTraversal.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeScriptTraversal.java index 5bd45b303e..0889c08988 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeScriptTraversal.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeScriptTraversal.java @@ -25,6 +25,9 @@ import javax.script.ScriptEngine; import javax.script.ScriptException; +import com.baidu.hugegraph.auth.HugePermission; +import com.baidu.hugegraph.auth.ResourceType; +import org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator; import org.apache.tinkerpop.gremlin.jsr223.SingleGremlinScriptEngineManager; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java index 2361d686fa..6755ee326e 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java @@ -30,6 +30,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.google.common.collect.Collections2; import org.apache.tinkerpop.gremlin.process.traversal.Compare; import org.apache.tinkerpop.gremlin.process.traversal.Contains; import org.apache.tinkerpop.gremlin.process.traversal.Order; @@ -568,6 +569,15 @@ public static void convAllHasSteps(Traversal.Admin traversal) { List steps = TraversalHelper.getStepsOfAssignableClassRecursively( HasStep.class, traversal); + /* + * The graph may be null. + * For example: + * g.V().hasLabel('person').union(__.has("birth", dates[0])) + * Here "__.has" will create a new traversal, but the graph is null + */ + if (steps.isEmpty() || !traversal.getGraph().isPresent()) { + return; + } HugeGraph graph = (HugeGraph) traversal.getGraph().get(); for (HasStep step : steps) { TraversalUtil.convHasStep(graph, step); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/ConfigUtil.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/ConfigUtil.java index 348266993f..81cc1f02c7 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/ConfigUtil.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/ConfigUtil.java @@ -19,22 +19,26 @@ package com.baidu.hugegraph.util; -import java.io.ByteArrayInputStream; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; import java.nio.file.Paths; import java.util.List; import java.util.Map; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.configuration.tree.ConfigurationNode; +import org.apache.commons.configuration2.FileBasedConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.YAMLConfiguration; +import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.tree.ImmutableNode; +import org.apache.commons.configuration2.tree.NodeHandler; +import org.apache.commons.configuration2.tree.NodeModel; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.tinkerpop.gremlin.util.config.YamlConfiguration; import org.slf4j.Logger; import com.baidu.hugegraph.HugeException; @@ -50,24 +54,38 @@ public final class ConfigUtil { private static final String CHARSET = "UTF-8"; public static void checkGremlinConfig(String conf) { - YamlConfiguration yamlConfig = new YamlConfiguration(); + Parameters params = new Parameters(); try { - yamlConfig.load(conf); + + FileBasedConfigurationBuilder builder = + new FileBasedConfigurationBuilder(YAMLConfiguration.class) + .configure(params.fileBased().setFileName(conf)); + YAMLConfiguration config = (YAMLConfiguration) builder + .getConfiguration(); + + List> nodes = + config.childConfigurationsAt( + NODE_GRAPHS); + if (nodes == null || nodes.isEmpty()) { + return; + } + E.checkArgument(nodes.size() == 1, + "Not allowed to specify multiple '%s' " + + "nodes in config file '%s'", NODE_GRAPHS, conf); + + ImmutableNode root = null; + NodeHandler nodeHandler = null; + for (HierarchicalConfiguration node : nodes) { + NodeModel nodeModel = node.getNodeModel(); + E.checkArgument(nodeModel != null && + (nodeHandler = nodeModel.getNodeHandler()) != null && + (root = nodeHandler.getRootNode()) != null, + "Node '%s' must contain root", node); + } } catch (ConfigurationException e) { throw new HugeException("Failed to load yaml config file '%s'", conf); } - List nodes = yamlConfig.getRootNode() - .getChildren(NODE_GRAPHS); - E.checkArgument(nodes == null || nodes.size() == 1, - "Not allowed to specify multiple '%s' nodes in " + - "config file '%s'", NODE_GRAPHS, conf); - if (nodes != null) { - List graphNames = nodes.get(0).getChildren(); - E.checkArgument(graphNames.isEmpty(), - "Don't allow to fill value for '%s' node in " + - "config file '%s'", NODE_GRAPHS, conf); - } } public static Map scanGraphsDir(String graphsDirPath) { @@ -91,23 +109,24 @@ public static Map scanGraphsDir(String graphsDirPath) { return graphConfs; } - public static void writeToFile(String dir, String graphName, - HugeConfig config) { + public static String writeToFile(String dir, String graphName, + HugeConfig config) { E.checkArgument(FileUtils.getFile(dir).exists(), "The directory '%s' must exist", dir); String fileName = Paths.get(dir, graphName + CONF_SUFFIX).toString(); - try (OutputStream os = new FileOutputStream(fileName)) { - config.save(os, CHARSET); - config.setFileName(fileName); + try { + config.save(new File(fileName)); LOG.info("Write HugeConfig to file: '{}'", fileName); - } catch (IOException | ConfigurationException e) { + } catch (ConfigurationException e) { throw new HugeException("Failed to write HugeConfig to file '%s'", e, fileName); } + + return fileName; } public static void deleteFile(File file) { - if (!file.exists()) { + if (file == null || !file.exists()) { return; } try { @@ -123,10 +142,8 @@ public static PropertiesConfiguration buildConfig(String configText) { "The config text can't be null or empty"); PropertiesConfiguration propConfig = new PropertiesConfiguration(); try { - InputStream in = new ByteArrayInputStream(configText.getBytes( - CHARSET)); - propConfig.setDelimiterParsingDisabled(true); - propConfig.load(in); + Reader in = new StringReader(configText); + propConfig.read(in); } catch (Exception e) { throw new IllegalStateException("Failed to read config options", e); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java new file mode 100644 index 0000000000..0016a996f7 --- /dev/null +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java @@ -0,0 +1,116 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.util; + +import com.baidu.hugegraph.HugeException; +import com.baidu.hugegraph.exception.NotSupportException; +import org.slf4j.Logger; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; + +public class Reflection { + + private static final Logger LOG = Log.logger(Reflection.class); + + private static final Class reflectionClazz; + private static final Method registerFieldsToFilterMethod; + private static final Method registerMethodsToFilterMethod; + + public static final String JDK_INTERNAL_REFLECT_REFLECTION = + "jdk.internal.reflect.Reflection"; + public static final String SUN_REFLECT_REFLECTION = + "sun.reflect.Reflection"; + + static { + Method registerFieldsToFilterMethodTemp = null; + Method registerMethodsToFilterMethodTemp = null; + Class reflectionClazzTemp = null; + try { + reflectionClazzTemp = Class.forName( + JDK_INTERNAL_REFLECT_REFLECTION); + } catch (ClassNotFoundException e) { + try { + reflectionClazzTemp = Class.forName(SUN_REFLECT_REFLECTION); + } catch (ClassNotFoundException ex) { + LOG.error("Can't find Reflection class", ex); + } + } + + reflectionClazz = reflectionClazzTemp; + + if (reflectionClazz != null) { + try { + registerFieldsToFilterMethodTemp = + reflectionClazz.getMethod("registerFieldsToFilter", + Class.class, String[].class); + } catch (Throwable e) { + LOG.error("Can't find registerFieldsToFilter method", e); + } + + try { + registerMethodsToFilterMethodTemp = + reflectionClazz.getMethod("registerMethodsToFilter", + Class.class, String[].class); + } catch (NoSuchMethodException e) { + LOG.error("Can't find registerMethodsToFilter method", e); + } + } + registerFieldsToFilterMethod = registerFieldsToFilterMethodTemp; + registerMethodsToFilterMethod = registerMethodsToFilterMethodTemp; + } + + public static void registerFieldsToFilter(Class containingClass, + String... fieldNames) { + if (registerFieldsToFilterMethod == null) { + throw new NotSupportException( + "Reflection.registerFieldsToFilter()"); + } + + try { + registerFieldsToFilterMethod.setAccessible(true); + registerFieldsToFilterMethod.invoke(reflectionClazz, + containingClass, fieldNames); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new HugeException( + "Failed to register class '%s' fields to filter: %s", + containingClass, Arrays.toString(fieldNames)); + } + } + + public static void registerMethodsToFilter(Class containingClass, + String... methodNames) { + if (registerMethodsToFilterMethod == null) { + throw new NotSupportException( + "Reflection.registerMethodsToFilterMethod()"); + } + + try { + registerMethodsToFilterMethod.setAccessible(true); + registerMethodsToFilterMethod.invoke(reflectionClazz, + containingClass, methodNames); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new HugeException( + "Failed to register class '%s' methods to filter: %s", + containingClass, Arrays.toString(methodNames)); + } + } +} diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/version/CoreVersion.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/version/CoreVersion.java index 4ff12ab021..b3b5cd603f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/version/CoreVersion.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/version/CoreVersion.java @@ -39,7 +39,7 @@ public class CoreVersion { public static void check() { // Check version of hugegraph-common - VersionUtil.check(CommonVersion.VERSION, "2.0.0", "2.1", + VersionUtil.check(CommonVersion.VERSION, "2.1.0", "2.2.0", CommonVersion.NAME); } } diff --git a/hugegraph-dist/pom.xml b/hugegraph-dist/pom.xml index f37cc24759..627cdf0fd8 100644 --- a/hugegraph-dist/pom.xml +++ b/hugegraph-dist/pom.xml @@ -23,16 +23,34 @@ com.baidu.hugegraph hugegraph-core ${project.version} + + + metrics-core + io.dropwizard.metrics + + com.baidu.hugegraph hugegraph-api ${project.version} + + + metrics-core + com.codahale.metrics + + com.baidu.hugegraph hugegraph-cassandra ${project.version} + + + metrics-core + io.dropwizard.metrics + + com.baidu.hugegraph diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh b/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh index 5e5ed521a9..765f9a1882 100644 --- a/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh +++ b/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh @@ -102,6 +102,12 @@ if [ "$JAVA_OPTIONS" = "" ]; then # -Xloggc:./logs/gc.log -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps" fi +if [[ $JAVA_VERSION > "1.9" ]]; then + JAVA_OPTIONS="${JAVA_OPTIONS} --add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED \ + --add-modules=jdk.unsupported \ + --add-exports=java.base/sun.nio.ch=ALL-UNNAMED " +fi + # Using G1GC as the default garbage collector (Recommended for large memory machines) case "$GC_OPTION" in g1) diff --git a/hugegraph-dist/src/assembly/static/bin/init-store.sh b/hugegraph-dist/src/assembly/static/bin/init-store.sh index daf2997ad3..d36e5e57f3 100755 --- a/hugegraph-dist/src/assembly/static/bin/init-store.sh +++ b/hugegraph-dist/src/assembly/static/bin/init-store.sh @@ -30,9 +30,17 @@ fi cd ${TOP} +DEFAULT_JAVA_OPTIONS="" +JAVA_VERSION=$($JAVA -version 2>&1 | awk 'NR==1{gsub(/"/,""); print $3}' \ + | awk -F'_' '{print $1}') +if [[ $? -eq 0 && $JAVA_VERSION > "1.9" ]]; then + DEFAULT_JAVA_OPTIONS="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED" +fi + echo "Initializing HugeGraph Store..." -${JAVA} -cp ${LIB}/hugegraph-dist-*.jar -Djava.ext.dirs=${LIB}:${PLUGINS} \ - com.baidu.hugegraph.cmd.InitStore ${CONF}/rest-server.properties +CP=$(find "${LIB}" "${PLUGINS}" -name "*.jar" | tr "\n" ":") +$JAVA -cp $CP ${DEFAULT_JAVA_OPTIONS} \ +com.baidu.hugegraph.cmd.InitStore "${CONF}"/rest-server.properties echo "Initialization finished." diff --git a/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml b/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml index 9edf5cf47d..44fbb4668f 100644 --- a/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml @@ -3,7 +3,7 @@ #port: 8182 # timeout in ms of gremlin query -scriptEvaluationTimeout: 30000 +evaluationTimeout: 30000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml index 41b02ac781..e10207140f 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8181 # timeout in ms of gremlin query -scriptEvaluationTimeout: 60000 +evaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml index 119763cc4d..dcac0fa65c 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8182 # timeout in ms of gremlin query -scriptEvaluationTimeout: 60000 +evaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml index 9ecfd01fe9..10ea42661a 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8183 # timeout in ms of gremlin query -scriptEvaluationTimeout: 60000 +evaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/jacocoagent.jar b/hugegraph-dist/src/assembly/travis/jacocoagent.jar index 1a9e96dbff..7799b3c02e 100644 Binary files a/hugegraph-dist/src/assembly/travis/jacocoagent.jar and b/hugegraph-dist/src/assembly/travis/jacocoagent.jar differ diff --git a/hugegraph-dist/src/assembly/travis/jacococli.jar b/hugegraph-dist/src/assembly/travis/jacococli.jar index 78a57e7caa..27a66d56e3 100644 Binary files a/hugegraph-dist/src/assembly/travis/jacococli.jar and b/hugegraph-dist/src/assembly/travis/jacococli.jar differ diff --git a/hugegraph-dist/src/assembly/travis/start-server.sh b/hugegraph-dist/src/assembly/travis/start-server.sh index 3a94a0dae0..6476d2eac1 100755 --- a/hugegraph-dist/src/assembly/travis/start-server.sh +++ b/hugegraph-dist/src/assembly/travis/start-server.sh @@ -38,7 +38,7 @@ fi if [ "$BACKEND" == "hbase" ]; then sed -i '$arestserver.request_timeout=200' $REST_CONF sed -i '$agremlinserver.timeout=200' $REST_CONF - sed -i 's/scriptEvaluationTimeout.*/scriptEvaluationTimeout: 200000/' $GREMLIN_CONF + sed -i 's/evaluationTimeout.*/evaluationTimeout: 200000/' $GREMLIN_CONF fi # Append schema.sync_deletion=true to config file diff --git a/hugegraph-dist/src/main/java/com/baidu/hugegraph/dist/RegisterUtil.java b/hugegraph-dist/src/main/java/com/baidu/hugegraph/dist/RegisterUtil.java index 8ce07f7b21..f137946bda 100644 --- a/hugegraph-dist/src/main/java/com/baidu/hugegraph/dist/RegisterUtil.java +++ b/hugegraph-dist/src/main/java/com/baidu/hugegraph/dist/RegisterUtil.java @@ -20,11 +20,15 @@ package com.baidu.hugegraph.dist; import java.io.InputStream; +import java.net.URL; import java.util.List; import java.util.ServiceLoader; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.kerby.config.Conf; import org.slf4j.Logger; import com.baidu.hugegraph.HugeException; @@ -50,15 +54,13 @@ public class RegisterUtil { public static void registerBackends() { String confFile = "/backend.properties"; - InputStream input = RegisterUtil.class.getClass() - .getResourceAsStream(confFile); + URL input = RegisterUtil.class.getResource(confFile); E.checkState(input != null, "Can't read file '%s' as stream", confFile); - PropertiesConfiguration props = new PropertiesConfiguration(); - props.setDelimiterParsingDisabled(true); + PropertiesConfiguration props = null; try { - props.load(input); + props = new Configurations().properties(input); } catch (ConfigurationException e) { throw new HugeException("Can't load config file: %s", e, confFile); } diff --git a/hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlTables.java b/hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlTables.java index c7f3ab9813..a7598cfe47 100644 --- a/hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlTables.java +++ b/hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlTables.java @@ -41,8 +41,8 @@ import com.baidu.hugegraph.type.define.Directions; import com.baidu.hugegraph.type.define.HugeKeys; import com.baidu.hugegraph.util.E; +import com.google.common.collect.ImmutableMap; -import jersey.repackaged.com.google.common.collect.ImmutableMap; public class MysqlTables { diff --git a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloHttpClient.java b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloHttpClient.java index 6f46b26f07..38d696da30 100644 --- a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloHttpClient.java +++ b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloHttpClient.java @@ -21,9 +21,9 @@ import java.util.Map; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.rest.AbstractRestClient; diff --git a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlTables.java b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlTables.java index 6442014adb..f61022490b 100644 --- a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlTables.java +++ b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlTables.java @@ -35,7 +35,7 @@ import com.baidu.hugegraph.type.define.Directions; import com.baidu.hugegraph.type.define.HugeKeys; -import jersey.repackaged.com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap; import static com.baidu.hugegraph.backend.store.mysql.MysqlTables.BOOLEAN; import static com.baidu.hugegraph.backend.store.mysql.MysqlTables.HUGE_TEXT; diff --git a/hugegraph-test/pom.xml b/hugegraph-test/pom.xml index 31190185b7..19ff26ea28 100644 --- a/hugegraph-test/pom.xml +++ b/hugegraph-test/pom.xml @@ -176,7 +176,7 @@ org.jacoco jacoco-maven-plugin - 0.8.4 + 0.8.8 com/baidu/hugegraph/traversal/algorithm/*.class diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java index 7ccb75b723..ffe8a08524 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java @@ -29,13 +29,12 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.apache.http.util.TextUtils; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.glassfish.jersey.client.filter.EncodingFilter; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeApiTest.java index a7b9abfd53..486a3cddf7 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeApiTest.java @@ -21,8 +21,7 @@ import java.io.IOException; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeLabelApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeLabelApiTest.java index c23e406485..aeec84826d 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeLabelApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/EdgeLabelApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/GremlinApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/GremlinApiTest.java index cff29cedb1..f5843875d4 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/GremlinApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/GremlinApiTest.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.Assume; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/IndexLabelApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/IndexLabelApiTest.java index c47dc508af..ac68408364 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/IndexLabelApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/IndexLabelApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java index 44530e5e02..5ebc025174 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java @@ -22,12 +22,11 @@ import java.nio.file.Paths; import java.util.Map; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference; import org.junit.After; import org.junit.Before; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java index 6b6d5bd710..6b9a4cad1f 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Test; import com.baidu.hugegraph.testutil.Assert; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/ProjectApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/ProjectApiTest.java index b0ca27c972..89d6611ae0 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/ProjectApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/ProjectApiTest.java @@ -22,9 +22,8 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.Response; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.junit.After; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/PropertyKeyApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/PropertyKeyApiTest.java index 4eff83ee43..fe804325b0 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/PropertyKeyApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/PropertyKeyApiTest.java @@ -19,8 +19,7 @@ package com.baidu.hugegraph.api; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Test; import com.baidu.hugegraph.testutil.Assert; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/SchemaApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/SchemaApiTest.java index 34291bc8e7..d24df28212 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/SchemaApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/SchemaApiTest.java @@ -19,8 +19,7 @@ package com.baidu.hugegraph.api; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Test; public class SchemaApiTest extends BaseApiTest { diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java index da486078d0..ff936bae7c 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java @@ -22,15 +22,13 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import com.baidu.hugegraph.testutil.Assert; -import jersey.repackaged.com.google.common.collect.ImmutableMap; - public class TaskApiTest extends BaseApiTest { private static String path = "/graphs/hugegraph/tasks/"; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/UserApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/UserApiTest.java index 36f1a13303..29eb5a7a8a 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/UserApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/UserApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference; import org.hamcrest.CoreMatchers; import org.junit.After; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexApiTest.java index 25b878b55c..3be1c26514 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexApiTest.java @@ -21,8 +21,7 @@ import java.io.IOException; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexLabelApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexLabelApiTest.java index b56f0cfaa2..006db0d1b2 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexLabelApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/VertexLabelApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java index 4d65c274a8..52fe7992de 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java @@ -21,7 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java index 26e83f2e01..529f2adb89 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java @@ -19,8 +19,7 @@ package com.baidu.hugegraph.api.traversers; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java index e29bd46ddc..bf59b2c9e4 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java index 27bd4de139..e1ee4e642f 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java index 3f7ed557f8..042842bf2d 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java index b00e222409..da6bbff33e 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java index e69f3ad738..23a1df8107 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java index 158d7c37ae..a2b54a18be 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java index 00a43ba44d..e26fed0c76 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java index 86bc047406..1a51d593a9 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java index a803dfd041..f25e7cb749 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java index a9181d875d..ab71bba758 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java index 3d81f64d8c..51c77ac56f 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java index 289c202f94..811ee8301a 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java index 72101e68eb..236ab144f4 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java @@ -21,7 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java index 468e1f0287..a1d7820aef 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java index 8b0c8a9dd5..64f3837a61 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java index e5d783dadf..c105ddf321 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java index ffb9a455bb..76a9d8aed5 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java @@ -21,8 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java index 647f9e9130..e5f4ed436d 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathApiTest.java index e64dbfc6b3..86879069a8 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathApiTest.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.Response; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/MultiGraphsTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/MultiGraphsTest.java index a63b29548e..42d2b48680 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/MultiGraphsTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/MultiGraphsTest.java @@ -24,9 +24,10 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.configuration.BaseConfiguration; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.PropertiesConfiguration; +import com.google.common.collect.ImmutableList; +import org.apache.commons.configuration2.BaseConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; @@ -49,7 +50,6 @@ import com.baidu.hugegraph.testutil.Utils; import com.baidu.hugegraph.type.define.NodeRole; -import jersey.repackaged.com.google.common.collect.ImmutableList; public class MultiGraphsTest { @@ -384,7 +384,6 @@ private static Configuration buildConfig(String graphName) { String key = keys.next(); config.setProperty(key, conf.getProperty(key)); } - ((BaseConfiguration) config).setDelimiterParsingDisabled(true); config.setProperty(CoreOptions.STORE.name(), graphName); String dataPath = config.getString(RocksDBOptions.DATA_PATH.name()); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java index 3883495870..7f178f4afd 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java @@ -23,8 +23,9 @@ import java.util.Date; import java.util.List; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -96,7 +97,7 @@ public static PropertiesConfiguration getConf() { PropertiesConfiguration config; try { - config = new PropertiesConfiguration(file); + config = new Configurations().properties(file); } catch (ConfigurationException e) { throw new HugeException("Unable to load config file: %s", e, confFile); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraph.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraph.java index 22cf61454b..be8c7e809b 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraph.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraph.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Set; -import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration2.Configuration; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphFactory.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphFactory.java index 7c4012976f..204cfa3fd3 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphFactory.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphFactory.java @@ -19,9 +19,8 @@ package com.baidu.hugegraph.tinkerpop; -import org.apache.commons.configuration.Configuration; - import com.baidu.hugegraph.HugeFactory; +import org.apache.commons.configuration2.Configuration; public class TestGraphFactory { diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphProvider.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphProvider.java index a8673c3570..3a9a1fb1fb 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphProvider.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/tinkerpop/TestGraphProvider.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.tinkerpop.gremlin.AbstractGraphProvider; import org.apache.tinkerpop.gremlin.FeatureRequirement; import org.apache.tinkerpop.gremlin.FeatureRequirements; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/FakeObjects.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/FakeObjects.java index 2b31de8c6f..4da5056280 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/FakeObjects.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/FakeObjects.java @@ -22,8 +22,8 @@ import java.util.Collections; import java.util.Date; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.mockito.Mockito; import com.baidu.hugegraph.HugeGraph; @@ -61,8 +61,7 @@ public FakeObjects() { } public static HugeConfig newConfig() { - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()).thenReturn(Collections.emptyIterator()); + Configuration conf = new PropertiesConfiguration(); return new HugeConfig(conf); } diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cache/CacheTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cache/CacheTest.java index 198b9f6691..7774ae8ff9 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cache/CacheTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cache/CacheTest.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.UUID; +import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -44,7 +45,6 @@ import com.baidu.hugegraph.util.Blob; import com.baidu.hugegraph.util.Bytes; -import jersey.repackaged.com.google.common.collect.ImmutableList; public abstract class CacheTest extends BaseUnitTest { diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cassandra/CassandraTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cassandra/CassandraTest.java index b9dcab3913..07aea36aba 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cassandra/CassandraTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/cassandra/CassandraTest.java @@ -21,8 +21,9 @@ import java.util.Map; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.PropertiesConfiguration; +import com.baidu.hugegraph.config.OptionSpace; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -40,7 +41,8 @@ public class CassandraTest { @Before public void setup() { - // pass + OptionSpace.register("cassandra", + "com.baidu.hugegraph.backend.store.cassandra.CassandraOptions"); } @After @@ -53,13 +55,9 @@ public void testParseReplicaWithSimpleStrategy() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("SimpleStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("5")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "SimpleStrategy"); + conf.setProperty(replica, ImmutableList.of("5")); HugeConfig config = new HugeConfig(conf); Map result = Whitebox.invokeStatic(CassandraStore.class, @@ -77,13 +75,9 @@ public void testParseReplicaWithNetworkTopologyStrategy() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("NetworkTopologyStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("dc1:2", "dc2:1")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "NetworkTopologyStrategy"); + conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:1")); HugeConfig config = new HugeConfig(conf); Map result = Whitebox.invokeStatic(CassandraStore.class, @@ -102,13 +96,9 @@ public void testParseReplicaWithSimpleStrategyAndEmptyReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("SimpleStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "SimpleStrategy"); + conf.setProperty(replica, ImmutableList.of("")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -121,13 +111,9 @@ public void testParseReplicaWithSimpleStrategyAndDoubleReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("SimpleStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("1.5")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "SimpleStrategy"); + conf.setProperty(replica, ImmutableList.of("1.5")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -140,13 +126,9 @@ public void testParseReplicaWithSimpleStrategyAndStringReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("SimpleStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("string")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "SimpleStrategy"); + conf.setProperty(replica, ImmutableList.of("string")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -159,13 +141,9 @@ public void testParseReplicaWithNetworkTopologyStrategyAndStringReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("NetworkTopologyStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("dc1:2", "dc2:string")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "NetworkTopologyStrategy"); + conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:string")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -178,13 +156,9 @@ public void testParseReplicaWithNetworkTopologyStrategyWithoutDatacenter() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("NetworkTopologyStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of(":2", "dc2:1")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "NetworkTopologyStrategy"); + conf.setProperty(replica, ImmutableList.of(":2", "dc2:1")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -197,13 +171,9 @@ public void testParseReplicaWithNetworkTopologyStrategyAndEmptyReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("NetworkTopologyStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("dc1:", "dc2:1")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "NetworkTopologyStrategy"); + conf.setProperty(replica, ImmutableList.of("dc1:", "dc2:1")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { @@ -216,13 +186,9 @@ public void testParseReplicaWithNetworkTopologyStrategyAndDoubleReplica() { String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - Configuration conf = Mockito.mock(PropertiesConfiguration.class); - Mockito.when(conf.getKeys()) - .thenReturn(ImmutableList.of(strategy, replica).iterator()); - Mockito.when(conf.getProperty(strategy)) - .thenReturn("NetworkTopologyStrategy"); - Mockito.when(conf.getProperty(replica)) - .thenReturn(ImmutableList.of("dc1:3.5", "dc2:1")); + Configuration conf = new PropertiesConfiguration(); + conf.setProperty(strategy, "NetworkTopologyStrategy"); + conf.setProperty(replica, ImmutableList.of("dc1:3.5", "dc2:1")); HugeConfig config = new HugeConfig(conf); Assert.assertThrows(RuntimeException.class, () -> { diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/SecurityManagerTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/SecurityManagerTest.java index 759b85e0fb..5c35f544af 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/SecurityManagerTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/SecurityManagerTest.java @@ -262,15 +262,6 @@ public void testPrintJobAccess() { assertError(result, "Not allowed to print job via Gremlin"); } - @Test - public void testSystemClipboardAccess() { - sm.checkSystemClipboardAccess(); - String result = runGremlinJob("System.getSecurityManager()" + - ".checkSystemClipboardAccess()"); - assertError(result, - "Not allowed to access system clipboard via Gremlin"); - } - @Test public void testPackageDefinition() { sm.checkPackageDefinition("com.baidu.hugegraph.util"); @@ -281,21 +272,6 @@ public void testSecurityAccess() { sm.checkSecurityAccess("link"); } - @Test - public void testMemberAccess() { - sm.checkMemberAccess(HugeSecurityManager.class, 0); - } - - @Test - public void testTopLevelWindow() { - sm.checkTopLevelWindow(new Object()); - } - - @Test - public void testAwtEventQueueAccess() { - sm.checkAwtEventQueueAccess(); - } - private static void assertError(String result, String message) { Assert.assertTrue(result, result.endsWith(message) || result.contains(message)); diff --git a/pom.xml b/pom.xml index e7b03f1bde..1b3aa16757 100644 --- a/pom.xml +++ b/pom.xml @@ -98,12 +98,12 @@ 1.2.17 2.17.1 4.12 - 3.4.3 + 3.5.1 2.7 25.1-jre 4.5.13 - 2.25.1 - 3.1.0 + 3.0.3 + 4.2.4 3.21.0-GA bash 3.1.2 @@ -261,7 +261,7 @@ io.dropwizard.metrics - metrics-jersey2 + metrics-jersey3 ${metrics.version}