From e4bd6446f01c587279723146e0eb2654730f6f43 Mon Sep 17 00:00:00 2001 From: V_Galaxy Date: Tue, 20 Feb 2024 18:25:48 +0800 Subject: [PATCH 01/37] fix(pd-store): correct license in hugegraph-store (#2447) * fix: correct license in hugegraph-store * add header for protobuf files * remove mvnw --- hugegraph-store/build-change.sh | 35 -- hugegraph-store/build-pre.sh | 105 ------ hugegraph-store/build.sh | 33 -- hugegraph-store/ci.yml | 43 --- hugegraph-store/deploy-release.sh | 25 -- hugegraph-store/deploy-snapshot.sh | 23 -- .../hg-store-cli/deploy-snapshot.sh | 22 -- hugegraph-store/hg-store-cli/pom.xml | 18 +- .../apache/hugegraph/store/cli/AppConfig.java | 18 +- .../store/cli/StoreConsoleApplication.java | 18 +- .../store/cli/loader/HgThread2DB.java | 20 +- .../store/cli/scan/GrpcShardScanner.java | 18 +- .../store/cli/scan/HgStoreCommitter.java | 18 +- .../store/cli/scan/HgStoreScanner.java | 18 +- .../hugegraph/store/cli/util/HgCliUtil.java | 18 +- .../hugegraph/store/cli/util/HgMetricX.java | 18 +- .../main/resources/hg-store-client.properties | 21 +- .../src/main/resources/log4j2.xml | 18 +- .../hg-store-client/deploy-snapshot.sh | 23 -- hugegraph-store/hg-store-client/pom.xml | 18 +- .../org/apache/hugegraph/store/HgKvEntry.java | 18 +- .../apache/hugegraph/store/HgKvIterator.java | 18 +- .../hugegraph/store/HgKvOrderedIterator.java | 18 +- .../hugegraph/store/HgKvPagingIterator.java | 18 +- .../org/apache/hugegraph/store/HgKvStore.java | 18 +- .../apache/hugegraph/store/HgOwnerKey.java | 18 +- .../apache/hugegraph/store/HgPageSize.java | 18 +- .../org/apache/hugegraph/store/HgPrivate.java | 18 +- .../apache/hugegraph/store/HgScanQuery.java | 18 +- .../apache/hugegraph/store/HgSeekAble.java | 18 +- .../hugegraph/store/HgSessionManager.java | 18 +- .../hugegraph/store/HgSessionProvider.java | 18 +- .../apache/hugegraph/store/HgStoreClient.java | 18 +- .../hugegraph/store/HgStoreSession.java | 18 +- .../apache/hugegraph/store/HgTkvEntry.java | 18 +- .../apache/hugegraph/store/HgTokvEntry.java | 18 +- .../store/client/HgNodePartition.java | 18 +- .../client/HgNodePartitionerBuilder.java | 18 +- .../hugegraph/store/client/HgPrivate.java | 18 +- .../hugegraph/store/client/HgStoreNode.java | 20 +- .../store/client/HgStoreNodeBuilder.java | 18 +- .../store/client/HgStoreNodeCandidates.java | 18 +- .../store/client/HgStoreNodeManager.java | 18 +- .../store/client/HgStoreNodeNotifier.java | 18 +- .../store/client/HgStoreNodePartitioner.java | 18 +- .../client/HgStoreNodePartitionerImpl.java | 18 +- .../store/client/HgStoreNodeProvider.java | 18 +- .../store/client/HgStoreNodeSession.java | 18 +- .../hugegraph/store/client/HgStoreNotice.java | 18 +- .../store/client/HgStoreService.java | 18 +- .../store/client/HgStoreSessionProvider.java | 18 +- .../store/client/HgTkvEntryImpl.java | 18 +- .../store/client/HgTokvEntryImpl.java | 18 +- .../store/client/MultiNodeSessionFactory.java | 18 +- .../hugegraph/store/client/NodeTkv.java | 18 +- .../store/client/NodeTxExecutor.java | 18 +- .../store/client/NodeTxSessionProxy.java | 18 +- .../store/client/SequencedIterator.java | 18 +- .../store/client/ShiftWorkIteratorProxy.java | 18 +- .../store/client/TopWorkIteratorProxy.java | 18 +- .../store/client/grpc/AbstractGrpcClient.java | 18 +- .../store/client/grpc/GrpcKvEntryImpl.java | 20 +- .../store/client/grpc/GrpcKvIteratorImpl.java | 18 +- .../client/grpc/GrpcNodeHealthyClient.java | 18 +- .../client/grpc/GrpcStoreNodeBuilder.java | 18 +- .../store/client/grpc/GrpcStoreNodeImpl.java | 18 +- .../client/grpc/GrpcStoreNodeSessionImpl.java | 18 +- .../client/grpc/GrpcStoreSessionClient.java | 18 +- .../client/grpc/GrpcStoreStateClient.java | 18 +- .../client/grpc/GrpcStoreStreamClient.java | 18 +- .../hugegraph/store/client/grpc/GrpcUtil.java | 18 +- .../client/grpc/KvBatchOneShotScanner.java | 20 +- .../store/client/grpc/KvBatchScanner.java | 18 +- .../store/client/grpc/KvBatchScanner5.java | 20 +- .../client/grpc/KvBatchScannerMerger.java | 18 +- .../store/client/grpc/KvBatchUtil.java | 20 +- .../client/grpc/KvCloseableIterator.java | 18 +- .../store/client/grpc/KvListIterator.java | 18 +- .../store/client/grpc/KvOneShotScanner.java | 20 +- .../store/client/grpc/KvPageScanner.java | 18 +- .../store/client/grpc/NotifyingExecutor.java | 18 +- .../hugegraph/store/client/grpc/ScanUtil.java | 18 +- .../store/client/grpc/SeekAbleIterator.java | 20 +- .../store/client/grpc/SwitchingExecutor.java | 18 +- .../store/client/type/HgNodeStatus.java | 18 +- .../client/type/HgStoreClientException.java | 18 +- .../hugegraph/store/client/util/Base58.java | 18 +- .../store/client/util/ExecutorPool.java | 18 +- .../hugegraph/store/client/util/HgAssert.java | 20 +- .../store/client/util/HgBufferProxy.java | 18 +- .../client/util/HgStoreClientConfig.java | 18 +- .../store/client/util/HgStoreClientConst.java | 18 +- .../store/client/util/HgStoreClientUtil.java | 18 +- .../hugegraph/store/client/util/HgUuid.java | 18 +- .../hugegraph/store/client/util/MetricX.java | 18 +- .../store/client/util/PropertyUtil.java | 18 +- .../main/resources/hg-store-client.properties | 21 +- .../src/main/resources/log4j2.xml | 18 +- hugegraph-store/hg-store-common/mvnw | 310 ------------------ hugegraph-store/hg-store-common/mvnw.cmd | 182 ---------- hugegraph-store/hg-store-common/pom.xml | 18 +- .../store/buffer/ByteBufferAllocator.java | 18 +- .../hugegraph/store/buffer/KVByteBuffer.java | 18 +- .../org/apache/hugegraph/store/term/Bits.java | 18 +- .../apache/hugegraph/store/term/HgPair.java | 20 +- .../apache/hugegraph/store/term/HgTriple.java | 18 +- hugegraph-store/hg-store-core/build.sh | 32 -- hugegraph-store/hg-store-core/pom.xml | 18 +- .../hugegraph/store/HeartbeatService.java | 18 +- .../apache/hugegraph/store/HgStoreEngine.java | 18 +- .../hugegraph/store/HgStoreStateListener.java | 18 +- .../hugegraph/store/PartitionEngine.java | 18 +- .../store/PartitionInstructionProcessor.java | 18 +- .../store/PartitionStateListener.java | 18 +- .../business/AbstractSelectIterator.java | 18 +- .../store/business/BusinessHandler.java | 18 +- .../store/business/BusinessHandlerImpl.java | 18 +- .../hugegraph/store/business/DataMover.java | 18 +- .../store/business/DefaultDataMover.java | 18 +- .../store/business/FilterIterator.java | 18 +- .../store/business/GraphStoreIterator.java | 18 +- .../store/business/InnerKeyCreator.java | 18 +- .../store/business/InnerKeyFilter.java | 18 +- .../business/MultiPartitionIterator.java | 18 +- .../store/business/SelectIterator.java | 18 +- .../hugegraph/store/cmd/BatchPutRequest.java | 18 +- .../hugegraph/store/cmd/BatchPutResponse.java | 18 +- .../hugegraph/store/cmd/CleanDataRequest.java | 18 +- .../store/cmd/CleanDataResponse.java | 18 +- .../store/cmd/CreateRaftRequest.java | 18 +- .../store/cmd/CreateRaftResponse.java | 18 +- .../store/cmd/DbCompactionRequest.java | 18 +- .../store/cmd/DbCompactionResponse.java | 20 +- .../store/cmd/DestroyRaftRequest.java | 18 +- .../store/cmd/DestroyRaftResponse.java | 18 +- .../store/cmd/FutureClosureAdapter.java | 18 +- .../store/cmd/GetStoreInfoRequest.java | 18 +- .../store/cmd/GetStoreInfoResponse.java | 18 +- .../apache/hugegraph/store/cmd/HgCmdBase.java | 18 +- .../hugegraph/store/cmd/HgCmdClient.java | 18 +- .../hugegraph/store/cmd/HgCmdProcessor.java | 18 +- .../store/cmd/UpdatePartitionRequest.java | 18 +- .../store/cmd/UpdatePartitionResponse.java | 18 +- .../store/meta/DeletedFileManager.java | 18 +- .../apache/hugegraph/store/meta/Graph.java | 18 +- .../hugegraph/store/meta/GraphIdManager.java | 20 +- .../hugegraph/store/meta/GraphManager.java | 18 +- .../store/meta/MetadataKeyHelper.java | 18 +- .../hugegraph/store/meta/Partition.java | 18 +- .../store/meta/PartitionManager.java | 18 +- .../hugegraph/store/meta/PartitionRole.java | 18 +- .../hugegraph/store/meta/PartitionStats.java | 18 +- .../apache/hugegraph/store/meta/Shard.java | 18 +- .../hugegraph/store/meta/ShardGroup.java | 18 +- .../apache/hugegraph/store/meta/Store.java | 18 +- .../hugegraph/store/meta/StoreMetadata.java | 18 +- .../hugegraph/store/meta/TaskManager.java | 18 +- .../meta/asynctask/AbstractAsyncTask.java | 18 +- .../store/meta/asynctask/AsyncTask.java | 18 +- .../store/meta/asynctask/AsyncTaskState.java | 18 +- .../store/meta/asynctask/CleanTask.java | 18 +- .../store/meta/base/DBSessionBuilder.java | 18 +- .../store/meta/base/GlobalMetaStore.java | 18 +- .../store/meta/base/MetaStoreBase.java | 18 +- .../store/meta/base/PartitionMetaStore.java | 18 +- .../store/metric/HgMetricService.java | 18 +- .../hugegraph/store/metric/HgStoreMetric.java | 18 +- .../store/metric/SystemMetricService.java | 18 +- .../store/options/HgStoreEngineOptions.java | 18 +- .../store/options/MetadataOptions.java | 18 +- .../store/options/PartitionEngineOptions.java | 18 +- .../store/options/RaftRocksdbOptions.java | 18 +- .../hugegraph/store/pd/DefaultPdProvider.java | 18 +- .../store/pd/FakePdServiceProvider.java | 18 +- .../pd/PartitionInstructionListener.java | 18 +- .../apache/hugegraph/store/pd/PdProvider.java | 18 +- .../store/raft/HgStoreStateMachine.java | 18 +- .../hugegraph/store/raft/RaftClosure.java | 18 +- .../hugegraph/store/raft/RaftOperation.java | 18 +- .../store/raft/RaftStateListener.java | 18 +- .../hugegraph/store/raft/RaftTaskHandler.java | 18 +- .../hugegraph/store/raft/util/RaftUtils.java | 18 +- .../store/snapshot/HgSnapshotHandler.java | 18 +- .../apache/hugegraph/store/util/Asserts.java | 20 +- .../store/util/CopyOnWriteCache.java | 20 +- .../hugegraph/store/util/FutureClosure.java | 18 +- .../hugegraph/store/util/HgRaftError.java | 18 +- .../hugegraph/store/util/HgStoreConst.java | 18 +- .../store/util/HgStoreException.java | 18 +- .../apache/hugegraph/store/util/IpUtil.java | 18 +- .../hugegraph/store/util/Lifecycle.java | 18 +- .../store/util/ManualResetEvent.java | 18 +- .../store/util/PartitionMetaStoreWrapper.java | 18 +- .../hugegraph/store/util/UnsafeUtf8Util.java | 18 +- .../hugegraph/store/util/UnsafeUtil.java | 18 +- .../apache/hugegraph/store/util/Version.java | 18 +- .../apache/hugegraph/store/util/ZipUtils.java | 18 +- hugegraph-store/hg-store-dist/pom.xml | 18 +- .../assembly/descriptor/server-assembly.xml | 18 +- .../static/bin/restart-hugegraph-store.sh | 20 +- .../static/bin/start-hugegraph-store.sh | 18 +- .../static/bin/stop-hugegraph-store.sh | 18 +- .../src/assembly/static/bin/util.sh | 18 +- .../src/assembly/static/conf/log4j2.xml | 18 +- hugegraph-store/hg-store-grpc/build.sh | 26 -- hugegraph-store/hg-store-grpc/pom.xml | 18 +- .../store/grpc/stream/HgStoreStreamGrpc.java | 18 +- .../store/grpc/stream/HgStoreStreamProto.java | 18 +- .../hugegraph/store/grpc/stream/KvStream.java | 18 +- .../store/grpc/stream/KvStreamOrBuilder.java | 18 +- .../store/grpc/stream/store_stream.proto | 17 + .../src/main/proto/graphpb.proto | 17 + .../src/main/proto/healthy.proto | 19 +- .../src/main/proto/store_common.proto | 19 +- .../src/main/proto/store_session.proto | 17 + .../src/main/proto/store_state.proto | 17 + .../src/main/proto/store_stream_meta.proto | 17 + hugegraph-store/hg-store-node/pom.xml | 18 +- .../src/assembly/static/bin/app.sh | 72 ---- .../src/assembly/static/bin/hg-get-release.sh | 72 ---- .../src/assembly/static/bin/hg-update.sh | 48 --- .../hugegraph/store/node/AppConfig.java | 18 +- .../hugegraph/store/node/AppShutdownHook.java | 18 +- .../store/node/StoreNodeApplication.java | 18 +- .../controller/HgStoreMetricsController.java | 18 +- .../controller/HgStoreStatusController.java | 18 +- .../node/controller/HgTestController.java | 18 +- .../store/node/controller/IndexAPI.java | 18 +- .../store/node/controller/PartitionAPI.java | 18 +- .../store/node/entry/RestResult.java | 18 +- .../store/node/grpc/BatchGrpcClosure.java | 20 +- .../store/node/grpc/BatchScanIterator.java | 18 +- .../store/node/grpc/EmptyIterator.java | 18 +- .../store/node/grpc/FusingScanIterator.java | 20 +- .../store/node/grpc/GRpcServerConfig.java | 18 +- .../store/node/grpc/GrpcClosure.java | 20 +- .../store/node/grpc/HgStoreNodeService.java | 18 +- .../store/node/grpc/HgStoreNodeState.java | 18 +- .../store/node/grpc/HgStoreSessionImpl.java | 18 +- .../store/node/grpc/HgStoreStateService.java | 18 +- .../store/node/grpc/HgStoreStateSubject.java | 18 +- .../store/node/grpc/HgStoreStreamImpl.java | 18 +- .../store/node/grpc/HgStoreWrapperEx.java | 18 +- .../store/node/grpc/ParallelScanIterator.java | 18 +- .../store/node/grpc/QueryCondition.java | 18 +- .../node/grpc/ScanBatchOneShotResponse.java | 20 +- .../store/node/grpc/ScanBatchResponse.java | 18 +- .../store/node/grpc/ScanBatchResponse3.java | 20 +- .../node/grpc/ScanBatchResponseFactory.java | 18 +- .../store/node/grpc/ScanOneShotResponse.java | 20 +- .../hugegraph/store/node/grpc/ScanQuery.java | 18 +- .../store/node/grpc/ScanQueryProducer.java | 18 +- .../store/node/grpc/ScanStreamResponse.java | 20 +- .../hugegraph/store/node/grpc/ScanUtil.java | 20 +- .../store/node/grpc/scan/GraphStoreImpl.java | 18 +- .../node/grpc/scan/ScanResponseObserver.java | 18 +- .../node/listener/ContextClosedListener.java | 18 +- .../node/listener/PdConfigureListener.java | 20 +- .../store/node/metrics/DriveMetrics.java | 18 +- .../store/node/metrics/GRpcExMetrics.java | 18 +- .../store/node/metrics/JRaftMetrics.java | 18 +- .../store/node/metrics/MetricsConfig.java | 18 +- .../store/node/metrics/MetricsUtil.java | 18 +- .../store/node/metrics/ProcfsEntry.java | 11 +- .../store/node/metrics/ProcfsMetrics.java | 18 +- .../store/node/metrics/ProcfsReader.java | 11 +- .../store/node/metrics/ProcfsSmaps.java | 11 +- .../store/node/metrics/RocksDBMetrics.java | 18 +- .../node/metrics/RocksDBMetricsConst.java | 18 +- .../store/node/metrics/StoreMetrics.java | 18 +- .../store/node/metrics/SystemMetrics.java | 18 +- .../store/node/model/HgNodeStatus.java | 18 +- .../hugegraph/store/node/util/Base58.java | 18 +- .../apache/hugegraph/store/node/util/Err.java | 18 +- .../hugegraph/store/node/util/HgAssert.java | 20 +- .../store/node/util/HgBufferProxy.java | 18 +- .../hugegraph/store/node/util/HgChannel.java | 18 +- .../store/node/util/HgExecutorUtil.java | 18 +- .../hugegraph/store/node/util/HgGrpc.java | 18 +- .../store/node/util/HgRegexUtil.java | 18 +- .../store/node/util/HgStoreConst.java | 18 +- .../store/node/util/HgStoreNodeUtil.java | 20 +- .../store/node/util/PropertyUtil.java | 18 +- .../hugegraph/store/node/util/Result.java | 18 +- .../hugegraph/store/node/util/TkEntry.java | 18 +- .../src/main/resources/log4j2-dev.xml | 18 +- .../store/boot/StoreNodeServer00.java | 20 +- .../store/boot/StoreNodeServer01.java | 20 +- .../store/boot/StoreNodeServer02.java | 20 +- .../store/boot/StoreNodeServer03.java | 20 +- .../store/boot/StoreNodeServer04.java | 20 +- .../store/boot/StoreNodeServer05.java | 20 +- .../store/boot/StoreNodeServer06.java | 20 +- .../store/node/HgStoreNodeServiceTest.java | 18 +- .../store/node/metrics/JraftMetricsTest.java | 18 +- .../src/test/resources/log4j2-dev.xml | 18 +- hugegraph-store/hg-store-rocksdb/pom.xml | 18 +- .../rocksdb/access/DBSnapshotMeta.java | 18 +- .../rocksdb/access/DBStoreException.java | 18 +- .../rocksdb/access/RocksDBFactory.java | 18 +- .../rocksdb/access/RocksDBOptions.java | 18 +- .../rocksdb/access/RocksDBScanIterator.java | 18 +- .../rocksdb/access/RocksDBSession.java | 18 +- .../rocksdb/access/ScanIterator.java | 18 +- .../rocksdb/access/SessionOperator.java | 18 +- .../rocksdb/access/SessionOperatorImpl.java | 18 +- .../rocksdb/access/util/Asserts.java | 20 +- .../hugegraph/rocksdb/access/util/CRC64.java | 18 +- .../rocksdb/access/util/ZipUtils.java | 18 +- .../rocksdb/access/RocksDBFactoryTest.java | 20 +- .../rocksdb/access/RocksDBSessionTest.java | 20 +- .../hugegraph/rocksdb/access/RocksdbDump.java | 18 +- .../rocksdb/access/SnapshotManagerTest.java | 18 +- .../src/test/resources/hugegraph-2.properties | 19 +- .../src/test/resources/hugegraph.properties | 19 +- .../src/test/resources/log4j2.xml | 26 +- hugegraph-store/hg-store-test/pom.xml | 18 +- .../hugegraph/store/HgBusinessImplTest.java | 18 +- .../HgSessionManagerOneRaftFakePDTest.java | 20 +- .../store/HgSessionManagerRaftFakePDTest.java | 20 +- .../store/HgSessionManagerRaftPDTest.java | 20 +- .../hugegraph/store/HgSessionManagerTest.java | 18 +- .../hugegraph/store/PartitionEngineTest.java | 18 +- .../apache/hugegraph/store/UnitTestBase.java | 18 +- .../store/client/BaseClientTest.java | 18 +- .../store/client/ChangeShardNumTest.java | 18 +- .../store/client/ClientSuiteTest.java | 18 +- .../hugegraph/store/client/ClientTest.java | 18 +- .../hugegraph/store/client/HgAssertTest.java | 18 +- .../hugegraph/store/client/HgKvStoreTest.java | 18 +- .../hugegraph/store/client/HgPairTest.java | 18 +- .../client/HgSessionManagerRaftPDTest.java | 18 +- .../store/client/HgStoreClientBase.java | 18 +- .../store/client/HgStoreClientTest.java | 18 +- .../store/client/HgStoreNodeSessionTest.java | 18 +- .../store/client/HgStoreNodeStateTest.java | 18 +- .../store/client/HgStoreNodeStreamTest.java | 18 +- .../client/graph/GraphStoreClientTest.java | 18 +- .../store/common/BaseCommonTest.java | 18 +- .../hugegraph/store/common/BitsTest.java | 18 +- .../store/common/ByteBufferAllocatorTest.java | 18 +- .../store/common/CommonSuiteTest.java | 18 +- .../store/common/KVByteBufferTest.java | 18 +- .../hugegraph/store/core/BaseCoreTest.java | 18 +- .../hugegraph/store/core/CoreSuiteTest.java | 18 +- .../apache/hugegraph/store/core/CoreTest.java | 18 +- .../store/core/HgBusinessImplTest.java | 18 +- .../hugegraph/store/core/HgCmdClientTest.java | 18 +- .../store/core/MetricServiceTest.java | 18 +- .../store/core/StoreEngineTestBase.java | 18 +- .../core/raft/HgStoreStateMachineTest.java | 18 +- .../store/core/raft/MockStateMachine.java | 18 +- .../store/core/raft/RaftOperationTest.java | 18 +- .../store/core/raft/RaftUtilsTest.java | 18 +- .../core/snapshot/HgSnapshotHandlerTest.java | 18 +- .../store/core/store/HgStoreEngineTest.java | 18 +- .../store/core/store/PartitionEngineTest.java | 18 +- .../PartitionInstructionProcessorTest.java | 18 +- .../store/meta/MetadataKeyHelperTest.java | 18 +- .../core/store/meta/PartitionManagerTest.java | 18 +- .../core/store/meta/TaskManagerTest.java | 18 +- .../store/meta/asynctask/CleanTaskTest.java | 18 +- .../core/store/util/MiscUtilClassTest.java | 18 +- .../util/PartitionMetaStoreWrapperTest.java | 18 +- .../store/core/store/util/ZipUtilsTest.java | 18 +- .../store/meta/GraphIDManagerTest.java | 18 +- .../store/meta/GraphManagerTest.java | 18 +- .../store/raftcore/BytesCarrierTest.java | 18 +- .../store/raftcore/RaftSuiteTest.java | 18 +- .../raftcore/ZeroByteStringHelperTest.java | 18 +- .../store/rocksdb/BaseRocksDbTest.java | 18 +- .../store/rocksdb/RocksDBFactoryTest.java | 18 +- .../store/rocksdb/RocksDbSuiteTest.java | 18 +- .../store/service/BaseServerTest.java | 18 +- .../store/service/ServerSuiteTest.java | 18 +- .../hugegraph/store/service/SessionTest.java | 18 +- .../store/util/CopyOnWriteCacheTest.java | 18 +- .../store/util/FutureClosureTest.java | 18 +- .../hugegraph/store/util/HgStoreTestUtil.java | 18 +- .../hugegraph/store/util/UnitTestBase.java | 18 +- .../hugegraph/store/util/UnsafeUtilTest.java | 18 +- .../src/main/resources/log4j2.xml | 18 +- hugegraph-store/init.sh | 25 -- hugegraph-store/local-release.sh | 25 -- hugegraph-store/pom.xml | 18 +- hugegraph-store/run.sh | 22 -- hugegraph-store/settings.xml | 133 -------- 387 files changed, 3410 insertions(+), 4540 deletions(-) delete mode 100644 hugegraph-store/build-change.sh delete mode 100644 hugegraph-store/build-pre.sh delete mode 100755 hugegraph-store/build.sh delete mode 100644 hugegraph-store/ci.yml delete mode 100755 hugegraph-store/deploy-release.sh delete mode 100644 hugegraph-store/deploy-snapshot.sh delete mode 100644 hugegraph-store/hg-store-cli/deploy-snapshot.sh delete mode 100644 hugegraph-store/hg-store-client/deploy-snapshot.sh delete mode 100644 hugegraph-store/hg-store-common/mvnw delete mode 100644 hugegraph-store/hg-store-common/mvnw.cmd delete mode 100755 hugegraph-store/hg-store-core/build.sh delete mode 100644 hugegraph-store/hg-store-grpc/build.sh delete mode 100755 hugegraph-store/hg-store-node/src/assembly/static/bin/app.sh delete mode 100644 hugegraph-store/hg-store-node/src/assembly/static/bin/hg-get-release.sh delete mode 100644 hugegraph-store/hg-store-node/src/assembly/static/bin/hg-update.sh delete mode 100644 hugegraph-store/init.sh delete mode 100644 hugegraph-store/local-release.sh delete mode 100644 hugegraph-store/run.sh delete mode 100644 hugegraph-store/settings.xml diff --git a/hugegraph-store/build-change.sh b/hugegraph-store/build-change.sh deleted file mode 100644 index e88f920221..0000000000 --- a/hugegraph-store/build-change.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export PATH=$MAVEN_3_5_3_BIN:$ORACLEJDK_11_0_7_BIN:$PATH -export JAVA_HOME=$ORACLEJDK_11_0_7_HOME -export MAVEN_HOME=$MAVEN_3_5_3_HOME - -readonly VER=3.6.3 -# TODO: remove thie repo -readonly REPO_URL=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots - -$MAVEN_3_5_3_BIN/mvn clean install -Dmaven.test.skip=true -DaltDeploymentRepository=Baidu_Local_Snapshots::default::${REPO_URL} - -echo "mv dist...." -mv dist output -ls output -echo "mv dist done" -echo "show output...." -ls output -echo "show output done" \ No newline at end of file diff --git a/hugegraph-store/build-pre.sh b/hugegraph-store/build-pre.sh deleted file mode 100644 index 1d89ff87b7..0000000000 --- a/hugegraph-store/build-pre.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# -# 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. -# - -mkdir output -touch output/1 -export JAVA_HOME=$ORACLEJDK_1_8_0_HOME - -readonly VER=3.6.3 -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-local - -$MAVEN_3_5_3_BIN/mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -$MAVEN_3_5_3_BIN/mvn --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy -$MAVEN_3_5_3_BIN/mvn versions:revert - -#------------------repo-server----------------------- -readonly FILE_NAME=hugegraph-store-3.6.3.tar.gz -readonly REPO_URL_FILE=http://10.14.139.8:8081/artifactory/star-file - -localFilePath=dist/${FILE_NAME} -targetFolder="${REPO_URL_FILE}/dist/$(date '+%Y-%m-%d')/" -artifactoryUser="admin" -artifactoryPassword="JFrog12345" - -md5Value="$(md5sum "$localFilePath")" -md5Value="${md5Value:0:32}" -sha1Value="$(sha1sum "$localFilePath")" -sha1Value="${sha1Value:0:40}" -sha256Value="$(sha256sum "$localFilePath")" -sha256Value="${sha256Value:0:65}" - -#curl -X PUT -u admin:JFrog12345 -T ${localFilePath} "${REPO_URL_FILE}/dist/${data_folder}/" -echo "INFO: Uploading $localFilePath to $targetFolder" -curl -i -X PUT -u "$artifactoryUser:$artifactoryPassword" \ - -H "X-Checksum-Md5: $md5Value" \ - -H "X-Checksum-Sha1: $sha1Value" \ - -H "X-Checksum-Sha256: $sha256Value" \ - -T "$localFilePath" \ - "$targetFolder" - - - #------------------repo-client----------------------- - # TODO: remove thie repo -readonly REPO_SNAPSHOT_PATH=http://10.14.139.8:8082/artifactory/star -readonly REPO_FILE_PATH=http://10.14.139.8:8082/artifactory/star-file -readonly REPO_BAIDU_LOCAL_PATH=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local -readonly PACKAGE_PATH=${REPO_SNAPSHOT_PATH}/com/baidu/hugegraph - -dest=store-client-${VER} -mkdir ${dest} - -curl ${PACKAGE_PATH}/hg-store-client/${VER}/hg-store-client-${VER}.jar -o ./${dest}/hg-store-client-${VER}.jar -curl ${PACKAGE_PATH}/hg-store-client/${VER}/hg-store-client-${VER}.pom -o ./${dest}/hg-store-client-pom.xml - -curl ${PACKAGE_PATH}/hg-store-grpc/${VER}/hg-store-grpc-${VER}.jar -o ./${dest}/hg-store-grpc-${VER}.jar -curl ${PACKAGE_PATH}/hg-store-grpc/${VER}/hg-store-grpc-${VER}.pom -o ./${dest}/hg-store-grpc-pom.xml - -curl ${PACKAGE_PATH}/hg-store-common/${VER}/hg-store-common-${VER}.jar -o ./${dest}/hg-store-common-${VER}.jar -curl ${PACKAGE_PATH}/hg-store-common/${VER}/hg-store-common-${VER}.pom -o ./${dest}/hg-store-common-pom.xml - -curl ${PACKAGE_PATH}/hg-pd-client/${VER}/hg-pd-client-${VER}.jar -o ./${dest}/hg-pd-client-${VER}.jar -curl ${PACKAGE_PATH}/hg-pd-client/${VER}/hg-pd-client-${VER}.pom -o ./${dest}/hg-pd-client-pom.xml - -curl ${PACKAGE_PATH}/hg-pd-grpc/${VER}/hg-pd-grpc-${VER}.jar -o ./${dest}/hg-pd-grpc-${VER}.jar -curl ${PACKAGE_PATH}/hg-pd-grpc/${VER}/hg-pd-grpc-${VER}.pom -o ./${dest}/hg-pd-grpc-pom.xml - -curl ${PACKAGE_PATH}/hg-pd-common/${VER}/hg-pd-common-${VER}.jar -o ./${dest}/hg-pd-common-${VER}.jar -curl ${PACKAGE_PATH}/hg-pd-common/${VER}/hg-pd-common-${VER}.pom -o ./${dest}/hg-pd-common-pom.xml - -tar -cvf ${dest}.tar ${dest} - -localFilePath=${dest}.tar -targetFolder="${REPO_URL_FILE}/dist/$(date '+%Y-%m-%d')/" -artifactoryUser="admin" -artifactoryPassword="JFrog12345" - -md5Value="$(md5sum "$localFilePath")" -md5Value="${md5Value:0:32}" -sha1Value="$(sha1sum "$localFilePath")" -sha1Value="${sha1Value:0:40}" -sha256Value="$(sha256sum "$localFilePath")" -sha256Value="${sha256Value:0:65}" - -#curl -X PUT -u admin:JFrog12345 -T ${localFilePath} "${REPO_URL_FILE}/dist/${data_folder}/" -echo "INFO: Uploading $localFilePath to $targetFolder" -curl -i -X PUT -u "$artifactoryUser:$artifactoryPassword" \ - -H "X-Checksum-Md5: $md5Value" \ - -H "X-Checksum-Sha1: $sha1Value" \ - -H "X-Checksum-Sha256: $sha256Value" \ - -T "$localFilePath" \ - "$targetFolder" \ No newline at end of file diff --git a/hugegraph-store/build.sh b/hugegraph-store/build.sh deleted file mode 100755 index a8129c6187..0000000000 --- a/hugegraph-store/build.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export PATH=$MAVEN_3_5_3_BIN:$ORACLEJDK_11_0_7_BIN:$PATH -export JAVA_HOME=$ORACLEJDK_11_0_7_HOME -export MAVEN_HOME=$MAVEN_3_5_3_HOME - -readonly VER=3.6.3 -readonly REPO_URL=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots - -$MAVEN_3_5_3_BIN/mvn -Dmaven.test.skip=true -DaltDeploymentRepository=Baidu_Local_Snapshots::default::${REPO_URL} -U clean deploy -echo "mv dist...." -mv dist output -ls output -echo "mv dist done" -echo "show output...." -ls output -echo "show output done" \ No newline at end of file diff --git a/hugegraph-store/ci.yml b/hugegraph-store/ci.yml deleted file mode 100644 index d0d6539a05..0000000000 --- a/hugegraph-store/ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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. -# - -Global: - tool: build_submitter - languages: - # Java Version: 1.7, 1.8, 9, 10 - - language: java - version: 11 - envs: - # Maven Version: 3.0.4, 3.1.1, 3.2.5, 3.3.9, 3.5.3 - - env: maven - version: 3.5.3 -Default: - profile: [ dev ] -Profiles: - - profile: - name: dev - tool: build_submitter - env: DECK_CENTOS7U5_K3 - command: sh build.sh - release: true - - - profile: - name: change - tool: build_submitter - env: DECK_CENTOS7U5_K3 - command: sh build-change.sh - release: true diff --git a/hugegraph-store/deploy-release.sh b/hugegraph-store/deploy-release.sh deleted file mode 100755 index e9421724aa..0000000000 --- a/hugegraph-store/deploy-release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly VER=3.6.3 -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-local -#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set - -./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -./mvnw --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy -./mvnw versions:revert diff --git a/hugegraph-store/deploy-snapshot.sh b/hugegraph-store/deploy-snapshot.sh deleted file mode 100644 index 14ff592390..0000000000 --- a/hugegraph-store/deploy-snapshot.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# -# 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. -# - -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-snapshot - -mvn --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-snapshot::default::${REPO_URL} clean deploy - diff --git a/hugegraph-store/hg-store-cli/deploy-snapshot.sh b/hugegraph-store/hg-store-cli/deploy-snapshot.sh deleted file mode 100644 index ce2277626f..0000000000 --- a/hugegraph-store/hg-store-cli/deploy-snapshot.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-snapshot - -mvn --settings ../settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy - diff --git a/hugegraph-store/hg-store-cli/pom.xml b/hugegraph-store/hg-store-cli/pom.xml index e7482af26b..8757a09c8f 100644 --- a/hugegraph-store/hg-store-cli/pom.xml +++ b/hugegraph-store/hg-store-cli/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-store/hg-store-client/deploy-snapshot.sh b/hugegraph-store/hg-store-client/deploy-snapshot.sh deleted file mode 100644 index d4f643995a..0000000000 --- a/hugegraph-store/hg-store-client/deploy-snapshot.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# -# 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. -# - -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-snapshot - -mvn --settings ../settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-snapshot::default::${REPO_URL} clean deploy - diff --git a/hugegraph-store/hg-store-client/pom.xml b/hugegraph-store/hg-store-client/pom.xml index f91113ccbb..2c402d37aa 100644 --- a/hugegraph-store/hg-store-client/pom.xml +++ b/hugegraph-store/hg-store-client/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-store/hg-store-common/mvnw b/hugegraph-store/hg-store-common/mvnw deleted file mode 100644 index 41c0f0c23d..0000000000 --- a/hugegraph-store/hg-store-common/mvnw +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/hugegraph-store/hg-store-common/mvnw.cmd b/hugegraph-store/hg-store-common/mvnw.cmd deleted file mode 100644 index 86115719e5..0000000000 --- a/hugegraph-store/hg-store-common/mvnw.cmd +++ /dev/null @@ -1,182 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/hugegraph-store/hg-store-common/pom.xml b/hugegraph-store/hg-store-common/pom.xml index 5e7bb44d8f..7746c76155 100644 --- a/hugegraph-store/hg-store-common/pom.xml +++ b/hugegraph-store/hg-store-common/pom.xml @@ -1,19 +1,19 @@ T isNonNull(T obj, String message) { } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCache.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCache.java index 0606d08b3b..ad09769a1e 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCache.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/CopyOnWriteCache.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; @@ -147,4 +147,4 @@ public synchronized V replace(K k, V v) { } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/FutureClosure.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/FutureClosure.java index c51900454d..6459c50089 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/FutureClosure.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/FutureClosure.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgRaftError.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgRaftError.java index 7a933a09c4..638080b0c1 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgRaftError.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgRaftError.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreConst.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreConst.java index af285e3e06..ab2164807a 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreConst.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreConst.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreException.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreException.java index 54353c2114..18923a86b1 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreException.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/HgStoreException.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java index 4040fa4ec4..990d3c9e68 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/IpUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Lifecycle.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Lifecycle.java index e7b646abf6..5250ac21f7 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Lifecycle.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Lifecycle.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ManualResetEvent.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ManualResetEvent.java index 1d19dcc71f..407116052d 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ManualResetEvent.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ManualResetEvent.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/PartitionMetaStoreWrapper.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/PartitionMetaStoreWrapper.java index 1d3e3debf5..eafe92da6e 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/PartitionMetaStoreWrapper.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/PartitionMetaStoreWrapper.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtf8Util.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtf8Util.java index 9bf548734e..165d664515 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtf8Util.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtf8Util.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtil.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtil.java index d583185319..8df26a8f9d 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtil.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/UnsafeUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Version.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Version.java index 7193e223ad..47cefd3dd0 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Version.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/Version.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ZipUtils.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ZipUtils.java index d226dc8633..ca5bafcb7a 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ZipUtils.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/util/ZipUtils.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.util; diff --git a/hugegraph-store/hg-store-dist/pom.xml b/hugegraph-store/hg-store-dist/pom.xml index 9c548e0611..7ce6b8d8dd 100644 --- a/hugegraph-store/hg-store-dist/pom.xml +++ b/hugegraph-store/hg-store-dist/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/restart-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/restart-hugegraph-store.sh index 085ddad43c..d1655353be 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/restart-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/restart-hugegraph-store.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # function abs_path() { @@ -29,4 +29,4 @@ function abs_path() { BIN=$(abs_path) . "$BIN"/stop-hugegraph-store.sh -. "$BIN"/start-hugegraph-store.sh \ No newline at end of file +. "$BIN"/start-hugegraph-store.sh diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index 4bf1e85347..0b069a4c0c 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # function abs_path() { diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh index 50d6ec9ec7..056eec559f 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # abs_path() { diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh index ef09ed515a..93eae7b890 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # function command_available() { diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml index 9dbaa7e89d..388d09e2fd 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-store/hg-store-grpc/build.sh b/hugegraph-store/hg-store-grpc/build.sh deleted file mode 100644 index 42aafffc75..0000000000 --- a/hugegraph-store/hg-store-grpc/build.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# 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. -# - -mkdir output -touch output/1 -export JAVA_HOME=$ORACLEJDK_1_8_0_HOME - -#$MAVEN_3_5_3_BIN/mvn -U deploy - -mvn -U install - diff --git a/hugegraph-store/hg-store-grpc/pom.xml b/hugegraph-store/hg-store-grpc/pom.xml index c30d7a7a25..dac8a811d7 100644 --- a/hugegraph-store/hg-store-grpc/pom.xml +++ b/hugegraph-store/hg-store-grpc/pom.xml @@ -1,19 +1,19 @@ > ${LOG_PATH} 2>&1 & - pid=$! - echo $pid>>${CUR_SHELL_DIR}/app.pid -} - -stop(){ - while read pid; do - kill ${pid} - done <${CUR_SHELL_DIR}/app.pid - echo >${CUR_SHELL_DIR}/app.pid -} - -help(){ - _log "syntax: /bin/bash $CUR_SHELL_NAME [ start | stop ]" - exit 1 -} -function _log(){ - echo -e "$(_getTime) : $1" 2>&1 -} -function _err(){ - echo -e "$(_getTime) : ERROR: $1" 1>&2 - return $2; -} -function _getTime(){ - local res=`date +"%Y/%m/%d %H:%M:%S"` - echo $res -} - -#entrance -case ${CMD} in - "start") - #init - start;; - "stop") - stop;; - "alive") - alive;; - *) - help;; -esac \ No newline at end of file diff --git a/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-get-release.sh b/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-get-release.sh deleted file mode 100644 index b083c6d55c..0000000000 --- a/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-get-release.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# 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. -# - -# TODO: remove thie repo -readonly REPO_SNAPSHOT_PATH=http://10.14.139.8:8082/artifactory/star -readonly REPO_FILE_PATH=http://10.14.139.8:8082/artifactory/star-file -readonly REPO_BAIDU_LOCAL_PATH=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local -readonly PACKAGE_PATH=${REPO_SNAPSHOT_PATH}/com/baidu/hugegraph - -readonly VER=3.6.3 -{ - #command parameters - cmd=$1 - ver=$2 -} - -case ${cmd} in - "server") - curl ${REPO_FILE_PATH}/hugegraph/hugegraph-${ver}.tar.gz -o hugegraph-${ver}.tar.gz - ;; - "client") - dest=store-client-${VER} - mkdir ${dest} - - curl ${PACKAGE_PATH}/hg-store-client/${VER}/hg-store-client-${VER}.jar -o ./${dest}/hg-store-client-${VER}.jar - curl ${PACKAGE_PATH}/hg-store-client/${VER}/hg-store-client-${VER}.pom -o ./${dest}/hg-store-client-pom.xml - - curl ${PACKAGE_PATH}/hg-store-grpc/${VER}/hg-store-grpc-${VER}.jar -o ./${dest}/hg-store-grpc-${VER}.jar - curl ${PACKAGE_PATH}/hg-store-grpc/${VER}/hg-store-grpc-${VER}.pom -o ./${dest}/hg-store-grpc-pom.xml - - curl ${PACKAGE_PATH}/hg-store-common/${VER}/hg-store-common-${VER}.jar -o ./${dest}/hg-store-common-${VER}.jar - curl ${PACKAGE_PATH}/hg-store-common/${VER}/hg-store-common-${VER}.pom -o ./${dest}/hg-store-common-pom.xml - - curl ${PACKAGE_PATH}/hg-pd-client/${VER}/hg-pd-client-${VER}.jar -o ./${dest}/hg-pd-client-${VER}.jar - curl ${PACKAGE_PATH}/hg-pd-client/${VER}/hg-pd-client-${VER}.pom -o ./${dest}/hg-pd-client-pom.xml - - curl ${PACKAGE_PATH}/hg-pd-grpc/${VER}/hg-pd-grpc-${VER}.jar -o ./${dest}/hg-pd-grpc-${VER}.jar - curl ${PACKAGE_PATH}/hg-pd-grpc/${VER}/hg-pd-grpc-${VER}.pom -o ./${dest}/hg-pd-grpc-pom.xml - - curl ${PACKAGE_PATH}/hg-pd-common/${VER}/hg-pd-common-${VER}.jar -o ./${dest}/hg-pd-common-${VER}.jar - curl ${PACKAGE_PATH}/hg-pd-common/${VER}/hg-pd-common-${VER}.pom -o ./${dest}/hg-pd-common-pom.xml - - ;; - "store") - dest=hugegraph-store-${VER} - mkdir ${dest} - curl ${PACKAGE_PATH}/hugegraph-store/${VER}/hugegraph-store-${VER}.jar -o ./${dest}/hugegraph-store-${VER}.jar -o hugegraph-store-${VER}.jar - ;; - "pd") - dest=hugegraph-pd-${VER} - mkdir ${dest} - curl ${PACKAGE_PATH}/hugegraph-pd/${VER}/hugegraph-pd-${VER}.jar -o ./${dest}/hugegraph-pd-${VER}.jar -o hugegraph-pd-${VER}.jar - ;; - *) - echo "./hg-get-release.sh [client|store|server|pd ]" - ;; -esac diff --git a/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-update.sh b/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-update.sh deleted file mode 100644 index fa8abd7872..0000000000 --- a/hugegraph-store/hg-store-node/src/assembly/static/bin/hg-update.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# -# 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. -# - -#ver 0.1.0 liyan75 on 2021/12/17 -readonly REPO_SNAPSHOT_PATH=http://10.14.139.8:8082/artifactory/star-snapshot -readonly REPO_FILE_PATH=http://10.14.139.8:8082/artifactory/star-file -readonly REPO_BAIDU_LOCAL_PATH=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local -{ - #command parameters - cmd=$1 - ver=$2 -} - -case ${cmd} in - "server") - if [ -z "${ver}" ]; then - echo "The argument is empty. e.g. 0.13.0" - exit 1; - fi - curl ${REPO_FILE_PATH}/hugegraph/hugegraph-${ver}.tar.gz -o hugegraph-${ver}.tar.gz - ;; - "client") - curl ${REPO_SNAPSHOT_PATH}/com/baidu/hugegraph/hg-store-client/1.0-SNAPSHOT/hg-store-client-1.0-SNAPSHOT.jar -o hg-store-client-1.0-SNAPSHOT.jar - curl ${REPO_SNAPSHOT_PATH}/com/baidu/hugegraph/hg-store-grpc/1.0-SNAPSHOT/hg-store-grpc-1.0-SNAPSHOT.jar -o hg-store-grpc-1.0-SNAPSHOT.jar - curl ${REPO_BAIDU_LOCAL_PATH}/com/baidu/hugegraph/hg-store-common/1.0.1/hg-store-common-1.0.1.jar -o hg-store-term-1.0.1.jar - ;; - "node") - curl ${REPO_SNAPSHOT_PATH}/com/baidu/hugegraph/hg-store-node/1.0-SNAPSHOT/hg-store-node-1.0-SNAPSHOT-spring-boot.jar -o hg-store-node-1.0-SNAPSHOT-spring-boot.jar - ;; - *) - echo "./hg-update.sh [client|node|server ]" - ;; -esac diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java index 473a8a3b3d..214e196f1c 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java index 5a08b7964d..4b02e4e498 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppShutdownHook.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/StoreNodeApplication.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/StoreNodeApplication.java index 1f16c5ac1e..c74ccc3295 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/StoreNodeApplication.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/StoreNodeApplication.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreMetricsController.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreMetricsController.java index 99ff83954a..aa6e175196 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreMetricsController.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreMetricsController.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.controller; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreStatusController.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreStatusController.java index bc2a8483c2..e02315623c 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreStatusController.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreStatusController.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.controller; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgTestController.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgTestController.java index 23203ab2fc..fac0ccc610 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgTestController.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgTestController.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.controller; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/IndexAPI.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/IndexAPI.java index ede36b7f58..b3a542f794 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/IndexAPI.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/IndexAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.controller; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/PartitionAPI.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/PartitionAPI.java index 43118d6273..3b12dbf388 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/PartitionAPI.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/PartitionAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.controller; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/entry/RestResult.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/entry/RestResult.java index 5d65cd271d..14e7109bd4 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/entry/RestResult.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/entry/RestResult.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.entry; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java index 80ea6bdcf4..f7ad7ff75a 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchGrpcClosure.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -209,4 +209,4 @@ public FeedbackRes selectError(List results) { } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchScanIterator.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchScanIterator.java index dbbb7a6709..56851d8f9a 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchScanIterator.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/BatchScanIterator.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/EmptyIterator.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/EmptyIterator.java index 6df461fc09..a6d2b6283d 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/EmptyIterator.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/EmptyIterator.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/FusingScanIterator.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/FusingScanIterator.java index 0e31a9c2cf..01d5778684 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/FusingScanIterator.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/FusingScanIterator.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -117,4 +117,4 @@ public void close() { this.iterator.close(); } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GRpcServerConfig.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GRpcServerConfig.java index 68b1809f7f..2e3b74c29b 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GRpcServerConfig.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GRpcServerConfig.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GrpcClosure.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GrpcClosure.java index 14f39b3f5e..825a57ef90 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GrpcClosure.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/GrpcClosure.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -69,4 +69,4 @@ public Map getLeaderMap() { public void onLeaderChanged(Integer partId, Long storeId) { leaderMap.put(partId, storeId); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java index c0e19df41d..86239bf3d2 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeState.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeState.java index 823ee4f94e..aecb176878 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeState.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeState.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java index 981715ef0f..aff054917a 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreSessionImpl.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateService.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateService.java index 760748c11d..57d5165006 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateService.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateSubject.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateSubject.java index 76fe769edd..5541b16f58 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateSubject.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStateSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStreamImpl.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStreamImpl.java index 3b688eb04e..7d01fa3db4 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStreamImpl.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreStreamImpl.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java index de602f585e..414eaa7de7 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreWrapperEx.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java index 7b3598d5ad..e5d297b69e 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ParallelScanIterator.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/QueryCondition.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/QueryCondition.java index edc6e3602c..efcda92438 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/QueryCondition.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/QueryCondition.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchOneShotResponse.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchOneShotResponse.java index 685f77fac2..e862c88afe 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchOneShotResponse.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchOneShotResponse.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -102,4 +102,4 @@ public static void scanOneShot(ScanStreamBatchReq request, } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java index d6a8eef459..caac4eeaf5 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse3.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse3.java index 6da57804de..df81a7bbb4 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse3.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponse3.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -414,4 +414,4 @@ private void working() { } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponseFactory.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponseFactory.java index 76c05ef3c1..52b3378fc3 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponseFactory.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanBatchResponseFactory.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanOneShotResponse.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanOneShotResponse.java index 5880b71c58..841ca09cab 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanOneShotResponse.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanOneShotResponse.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -93,4 +93,4 @@ public static void scanOneShot(ScanStreamReq request, } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQuery.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQuery.java index 5c17910225..27508e5e76 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQuery.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQuery.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQueryProducer.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQueryProducer.java index 963ff66f42..e5b0d32a62 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQueryProducer.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanQueryProducer.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanStreamResponse.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanStreamResponse.java index 16ff7f0e08..26aaec3175 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanStreamResponse.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanStreamResponse.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -258,4 +258,4 @@ private void timeoutSever() { } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanUtil.java index 2fb2a2104f..aa97842db0 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/ScanUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc; @@ -328,4 +328,4 @@ public ScanIterator get() { } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/GraphStoreImpl.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/GraphStoreImpl.java index b7cd6c11c5..864ba3b889 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/GraphStoreImpl.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/GraphStoreImpl.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc.scan; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java index 22a52aecd2..7bf56e4cdf 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/scan/ScanResponseObserver.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.grpc.scan; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/ContextClosedListener.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/ContextClosedListener.java index 18def8dbca..e990acfe6f 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/ContextClosedListener.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/ContextClosedListener.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.listener; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java index 37f70e086a..709e7fdb9d 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/listener/PdConfigureListener.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.listener; @@ -209,4 +209,4 @@ private void restart() throws InterruptedException, IOException { private void writeYml(String yml) throws IOException { FileUtils.writeStringToFile(pdConfFile, yml, Charset.defaultCharset(), false); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/DriveMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/DriveMetrics.java index 9e51f62ac6..8fc578c054 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/DriveMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/DriveMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/GRpcExMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/GRpcExMetrics.java index d9aa233f9e..cb5619a8c1 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/GRpcExMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/GRpcExMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java index 1d70298612..10d5b14791 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/JRaftMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsConfig.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsConfig.java index 8014703708..7062ee7eb8 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsConfig.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsConfig.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsUtil.java index 987d3080db..62c966fbfd 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/MetricsUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsEntry.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsEntry.java index f4266d89f0..ed32d88df1 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsEntry.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsEntry.java @@ -1,9 +1,10 @@ /* - * Copyright © 2016 Michael Weirauch (michael.weirauch@gmail.com) - * - * Licensed 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 + * 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 * diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsMetrics.java index 997b95d8e7..6a3f97f27f 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsReader.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsReader.java index 108719ca5e..b378244f9f 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsReader.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsReader.java @@ -1,9 +1,10 @@ /* - * Copyright © 2016 Michael Weirauch (michael.weirauch@gmail.com) - * - * Licensed 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 + * 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 * diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsSmaps.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsSmaps.java index 72efa47168..69edf52de0 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsSmaps.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/ProcfsSmaps.java @@ -1,9 +1,10 @@ /* - * Copyright © 2016 Michael Weirauch (michael.weirauch@gmail.com) - * - * Licensed 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 + * 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 * diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetrics.java index 4df4b2b711..5575fc3b9a 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetricsConst.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetricsConst.java index e0a89e9f52..79c009a700 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetricsConst.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetricsConst.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/StoreMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/StoreMetrics.java index 1abf176d75..9fcdbc685e 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/StoreMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/StoreMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/SystemMetrics.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/SystemMetrics.java index caf8c59b02..1935c90c05 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/SystemMetrics.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/SystemMetrics.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/model/HgNodeStatus.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/model/HgNodeStatus.java index e615d8046c..6f70e2d48d 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/model/HgNodeStatus.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/model/HgNodeStatus.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.model; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Base58.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Base58.java index 925dd52319..12382e1358 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Base58.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Base58.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Err.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Err.java index d810f79ace..c36b658de5 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Err.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Err.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgAssert.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgAssert.java index 466e24517f..a6dbff59fc 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgAssert.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgAssert.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; @@ -142,4 +142,4 @@ public static boolean isNull(Object... objs) { } return false; } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgBufferProxy.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgBufferProxy.java index 358899d501..580989a7ed 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgBufferProxy.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgBufferProxy.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgChannel.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgChannel.java index b51a38e10f..722ff90ae8 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgChannel.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgChannel.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgExecutorUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgExecutorUtil.java index 250cc32109..b8bb30f13f 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgExecutorUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgExecutorUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgGrpc.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgGrpc.java index b438c88255..adbc96e1e4 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgGrpc.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgGrpc.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgRegexUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgRegexUtil.java index 3f243863b2..1336eaf8d1 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgRegexUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgRegexUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreConst.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreConst.java index ac5b222f79..546cfe8620 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreConst.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreConst.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreNodeUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreNodeUtil.java index e44bf1bc40..2716704bcd 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreNodeUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/HgStoreNodeUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; @@ -80,4 +80,4 @@ public static String toUuidStr(byte[] bytes) { return null; } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/PropertyUtil.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/PropertyUtil.java index 5d24ba2aa5..425a9828ee 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/PropertyUtil.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/PropertyUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Result.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Result.java index a1073037bf..5087deb2cc 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Result.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/Result.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/TkEntry.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/TkEntry.java index 57762de338..d089ed61f3 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/TkEntry.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/util/TkEntry.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.util; diff --git a/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml b/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml index 2ed3977ab0..379acebbae 100644 --- a/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml +++ b/hugegraph-store/hg-store-node/src/main/resources/log4j2-dev.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer00.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer00.java index ce2858b356..dc860826df 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer00.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer00.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -54,4 +54,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer01.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer01.java index a8fbe96e52..ba11facfb8 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer01.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer01.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -56,4 +56,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer02.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer02.java index b1c5e87c45..75bad4ffce 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer02.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer02.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -54,4 +54,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer03.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer03.java index 1abac66189..ea78bb8994 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer03.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer03.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -54,4 +54,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer04.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer04.java index 1730c9505e..e186888500 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer04.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer04.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -38,4 +38,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer05.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer05.java index 61e6e86a1a..9eae17383d 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer05.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer05.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -38,4 +38,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer06.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer06.java index 3f3b5acc49..e6d1c751da 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer06.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/boot/StoreNodeServer06.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.boot; @@ -38,4 +38,4 @@ private static boolean deleteDir(File dir) { } return dir.delete(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/HgStoreNodeServiceTest.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/HgStoreNodeServiceTest.java index 972b7703f8..0ff80ff2e6 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/HgStoreNodeServiceTest.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/HgStoreNodeServiceTest.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node; diff --git a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/metrics/JraftMetricsTest.java b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/metrics/JraftMetricsTest.java index b8fc647477..f41e0ff4af 100644 --- a/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/metrics/JraftMetricsTest.java +++ b/hugegraph-store/hg-store-node/src/test/java/org/apache/hugegraph/store/node/metrics/JraftMetricsTest.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.store.node.metrics; diff --git a/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml b/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml index ba714c018f..913ad3f4a1 100644 --- a/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml +++ b/hugegraph-store/hg-store-node/src/test/resources/log4j2-dev.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-store/hg-store-rocksdb/pom.xml b/hugegraph-store/hg-store-rocksdb/pom.xml index 42e6f37e86..dfc6d9ba8c 100644 --- a/hugegraph-store/hg-store-rocksdb/pom.xml +++ b/hugegraph-store/hg-store-rocksdb/pom.xml @@ -1,19 +1,19 @@ s) { } } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/CRC64.java b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/CRC64.java index f5e02c052a..0dd33054c0 100644 --- a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/CRC64.java +++ b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/CRC64.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access.util; diff --git a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/ZipUtils.java b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/ZipUtils.java index b764843290..2b0b889fc5 100644 --- a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/ZipUtils.java +++ b/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/util/ZipUtils.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access.util; diff --git a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBFactoryTest.java b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBFactoryTest.java index a6f10a67f6..3e2b674e09 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBFactoryTest.java +++ b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBFactoryTest.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access; @@ -99,4 +99,4 @@ public void releaseAllGraphDB() { rFactory.releaseAllGraphDB(); } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBSessionTest.java b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBSessionTest.java index 30e722b2f4..acd3843b6f 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBSessionTest.java +++ b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksDBSessionTest.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access; @@ -477,4 +477,4 @@ private long longFromByteArray(byte[] a) { } -} \ No newline at end of file +} diff --git a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksdbDump.java b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksdbDump.java index ab324da840..3d4b550fc9 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksdbDump.java +++ b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/RocksdbDump.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access; diff --git a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/SnapshotManagerTest.java b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/SnapshotManagerTest.java index 77eb2d5547..45651a1985 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/SnapshotManagerTest.java +++ b/hugegraph-store/hg-store-rocksdb/src/test/java/org/apache/hugegraph/rocksdb/access/SnapshotManagerTest.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.rocksdb.access; diff --git a/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph-2.properties b/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph-2.properties index 4b90d123ea..82c47cd9f4 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph-2.properties +++ b/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph-2.properties @@ -1,19 +1,20 @@ # # 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 +# 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. +# 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. # + # rocksdb backend config rocksdb.data_path=./tmp/rocksdb-2/data rocksdb.wal_path=./tmp/rocksdb-2/data diff --git a/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph.properties b/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph.properties index b2d37ad4fa..0c4cb0943e 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph.properties +++ b/hugegraph-store/hg-store-rocksdb/src/test/resources/hugegraph.properties @@ -1,19 +1,20 @@ # # 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 +# 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. +# 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. # + # rocksdb backend config rocksdb.data_path=./tmp/rocksdb/data rocksdb.wal_path=./tmp/rocksdb/data diff --git a/hugegraph-store/hg-store-rocksdb/src/test/resources/log4j2.xml b/hugegraph-store/hg-store-rocksdb/src/test/resources/log4j2.xml index 30f1ebd3d6..12a42e2530 100644 --- a/hugegraph-store/hg-store-rocksdb/src/test/resources/log4j2.xml +++ b/hugegraph-store/hg-store-rocksdb/src/test/resources/log4j2.xml @@ -1,20 +1,20 @@ + 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. + --> diff --git a/hugegraph-store/hg-store-test/pom.xml b/hugegraph-store/hg-store-test/pom.xml index 7604d77cac..0afa1fdd15 100644 --- a/hugegraph-store/hg-store-test/pom.xml +++ b/hugegraph-store/hg-store-test/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-store/init.sh b/hugegraph-store/init.sh deleted file mode 100644 index 6458ef6185..0000000000 --- a/hugegraph-store/init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -mkdir output -touch output/1 -export JAVA_HOME=$ORACLEJDK_1_8_0_HOME - -mvn -N install #only install root project - -#$MAVEN_3_5_3_BIN/mvn -U deploy diff --git a/hugegraph-store/local-release.sh b/hugegraph-store/local-release.sh deleted file mode 100644 index 53a9bfce2e..0000000000 --- a/hugegraph-store/local-release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly VER=3.6.3 - -#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set - -mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -mvn --settings ./settings.xml -Dmaven.test.skip=true clean install -mvn versions:revert \ No newline at end of file diff --git a/hugegraph-store/pom.xml b/hugegraph-store/pom.xml index 36f8b6982f..b51a232a4d 100644 --- a/hugegraph-store/pom.xml +++ b/hugegraph-store/pom.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - - - - - baidu - - - baidu-nexus - http://maven.baidu-int.com/nexus/content/groups/public - - true - - - false - - - - baidu-nexus-snapshot - http://maven.baidu-int.com/nexus/content/groups/public-snapshots - - false - - - false - - - - - - - - - - - - - - - - - - - - Baidu_Local - http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local - - true - - - false - - - - Baidu_Local_Snapshots - - http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots - - - false - - - true - always - - - - - - baidu-nexus - http://maven.baidu-int.com/nexus/content/groups/public - - true - - - false - - - - baidu-nexus-snapshot - http://maven.baidu-int.com/nexus/content/groups/public-snapshots - - false - - - true - - - - - - - - - baidu - - \ No newline at end of file From d61aaae44fe734750df2811957184a11c34c526c Mon Sep 17 00:00:00 2001 From: V_Galaxy Date: Tue, 20 Feb 2024 18:28:35 +0800 Subject: [PATCH 02/37] fix(pd-store): correct license in hugegraph-pd (#2446) * fix: correct license in hugegraph-pd * minor fix * add header for protobuf files --- hugegraph-pd/.gitignore | 2 - hugegraph-pd/build-pre.sh | 54 ------- hugegraph-pd/build.sh | 39 ----- hugegraph-pd/ci.yml | 43 ------ hugegraph-pd/deploy-release.sh | 25 ---- hugegraph-pd/deploy-snapshot.sh | 25 ---- hugegraph-pd/hg-pd-client/pom.xml | 18 +-- .../hugegraph/pd/client/AbstractClient.java | 18 +-- .../pd/client/AbstractClientStubProxy.java | 18 +-- .../apache/hugegraph/pd/client/Channels.java | 18 +-- .../hugegraph/pd/client/ClientCache.java | 18 +-- .../hugegraph/pd/client/Discoverable.java | 18 +-- .../hugegraph/pd/client/DiscoveryClient.java | 18 +-- .../pd/client/DiscoveryClientImpl.java | 18 +-- .../apache/hugegraph/pd/client/KvClient.java | 18 +-- .../hugegraph/pd/client/LicenseClient.java | 18 +-- .../apache/hugegraph/pd/client/PDClient.java | 18 +-- .../apache/hugegraph/pd/client/PDConfig.java | 18 +-- .../apache/hugegraph/pd/client/PDPulse.java | 18 +-- .../hugegraph/pd/client/PDPulseImpl.java | 18 +-- .../apache/hugegraph/pd/client/PDWatch.java | 18 +-- .../hugegraph/pd/client/PDWatchImpl.java | 18 +-- .../hugegraph/pd/pulse/PartitionNotice.java | 18 +-- .../hugegraph/pd/pulse/PulseServerNotice.java | 18 +-- .../apache/hugegraph/pd/watch/NodeEvent.java | 18 +-- .../apache/hugegraph/pd/watch/PDWatcher.java | 18 +-- .../hugegraph/pd/watch/PartitionEvent.java | 18 +-- .../apache/hugegraph/pd/watch/WatchType.java | 18 +-- hugegraph-pd/hg-pd-clitools/pom.xml | 18 +-- .../apache/hugegraph/pd/clitools/Main.java | 18 +-- hugegraph-pd/hg-pd-common/pom.xml | 18 +-- .../hugegraph/pd/common/GraphCache.java | 18 +-- .../apache/hugegraph/pd/common/HgAssert.java | 20 +-- .../apache/hugegraph/pd/common/KVPair.java | 20 +-- .../hugegraph/pd/common/PDException.java | 18 +-- .../pd/common/PDRuntimeException.java | 18 +-- .../hugegraph/pd/common/PartitionCache.java | 18 +-- .../hugegraph/pd/common/PartitionUtils.java | 18 +-- hugegraph-pd/hg-pd-core/pom.xml | 18 +-- .../apache/hugegraph/pd/ConfigService.java | 18 +-- .../org/apache/hugegraph/pd/IdService.java | 18 +-- .../org/apache/hugegraph/pd/KvService.java | 18 +-- .../org/apache/hugegraph/pd/LogService.java | 18 +-- .../pd/PartitionInstructionListener.java | 18 +-- .../apache/hugegraph/pd/PartitionService.java | 18 +-- .../hugegraph/pd/PartitionStatusListener.java | 18 +-- .../apache/hugegraph/pd/RegistryService.java | 18 +-- .../pd/ShardGroupStatusListener.java | 18 +-- .../hugegraph/pd/StoreMonitorDataService.java | 18 +-- .../apache/hugegraph/pd/StoreNodeService.java | 18 +-- .../hugegraph/pd/StoreStatusListener.java | 18 +-- .../hugegraph/pd/TaskScheduleService.java | 18 +-- .../apache/hugegraph/pd/config/PDConfig.java | 18 +-- .../hugegraph/pd/meta/ConfigMetaStore.java | 18 +-- .../hugegraph/pd/meta/DiscoveryMetaStore.java | 18 +-- .../apache/hugegraph/pd/meta/IdMetaStore.java | 18 +-- .../org/apache/hugegraph/pd/meta/LogMeta.java | 18 +-- .../hugegraph/pd/meta/MetadataFactory.java | 18 +-- .../hugegraph/pd/meta/MetadataKeyHelper.java | 18 +-- .../pd/meta/MetadataRocksDBStore.java | 18 +-- .../hugegraph/pd/meta/MetadataStoreBase.java | 18 +-- .../hugegraph/pd/meta/PartitionMeta.java | 18 +-- .../apache/hugegraph/pd/meta/QueueStore.java | 18 +-- .../hugegraph/pd/meta/StoreInfoMeta.java | 18 +-- .../hugegraph/pd/meta/TaskInfoMeta.java | 18 +-- .../pd/raft/FutureClosureAdapter.java | 20 +-- .../apache/hugegraph/pd/raft/KVOperation.java | 18 +-- .../hugegraph/pd/raft/KVStoreClosure.java | 20 +-- .../apache/hugegraph/pd/raft/RaftEngine.java | 18 +-- .../hugegraph/pd/raft/RaftRpcClient.java | 18 +-- .../hugegraph/pd/raft/RaftRpcProcessor.java | 18 +-- .../hugegraph/pd/raft/RaftStateListener.java | 18 +-- .../hugegraph/pd/raft/RaftStateMachine.java | 18 +-- .../hugegraph/pd/raft/RaftTaskHandler.java | 18 +-- .../apache/hugegraph/pd/raft/ZipUtils.java | 18 +-- .../pd/store/BaseKVStoreClosure.java | 18 +-- .../apache/hugegraph/pd/store/HgKVStore.java | 18 +-- .../hugegraph/pd/store/HgKVStoreImpl.java | 18 +-- .../org/apache/hugegraph/pd/store/KV.java | 18 +-- .../hugegraph/pd/store/RaftKVStore.java | 18 +-- hugegraph-pd/hg-pd-dist/pom.xml | 18 +-- .../assembly/descriptor/server-assembly.xml | 20 +-- .../assembly/static/bin/start-hugegraph-pd.sh | 18 +-- .../assembly/static/bin/stop-hugegraph-pd.sh | 18 +-- .../src/assembly/static/bin/util.sh | 18 +-- .../src/assembly/static/conf/log4j2.xml | 18 +-- hugegraph-pd/hg-pd-grpc/pom.xml | 18 +-- .../hg-pd-grpc/src/main/proto/discovery.proto | 19 ++- .../hg-pd-grpc/src/main/proto/kv.proto | 19 ++- .../hg-pd-grpc/src/main/proto/metaTask.proto | 18 ++- .../hg-pd-grpc/src/main/proto/metapb.proto | 19 ++- .../hg-pd-grpc/src/main/proto/pd_common.proto | 19 ++- .../hg-pd-grpc/src/main/proto/pd_pulse.proto | 19 ++- .../hg-pd-grpc/src/main/proto/pd_watch.proto | 19 ++- .../hg-pd-grpc/src/main/proto/pdpb.proto | 19 ++- hugegraph-pd/hg-pd-service/pom.xml | 18 +-- .../hugegraph/pd/boot/HugePDServer.java | 18 +-- .../hugegraph/pd/metrics/MetricsConfig.java | 18 +-- .../hugegraph/pd/metrics/PDMetrics.java | 18 +-- .../apache/hugegraph/pd/model/DemoModel.java | 18 +-- .../hugegraph/pd/model/GraphRestRequest.java | 18 +-- .../pd/model/GraphSpaceRestRequest.java | 18 +-- .../hugegraph/pd/model/PeerRestRequest.java | 18 +-- .../hugegraph/pd/model/PromTargetsModel.java | 18 +-- .../pd/model/RegistryQueryRestRequest.java | 18 +-- .../pd/model/RegistryRestRequest.java | 18 +-- .../pd/model/RegistryRestResponse.java | 18 +-- .../hugegraph/pd/model/RestApiResponse.java | 18 +-- .../hugegraph/pd/model/StoreRestRequest.java | 18 +-- .../hugegraph/pd/model/TimeRangeRequest.java | 18 +-- .../pd/notice/NoticeBroadcaster.java | 18 +-- .../pd/pulse/AbstractObserverSubject.java | 18 +-- .../hugegraph/pd/pulse/PDPulseSubject.java | 18 +-- .../pd/pulse/PartitionHeartbeatSubject.java | 18 +-- .../pd/pulse/PdInstructionSubject.java | 18 +-- .../hugegraph/pd/pulse/PulseListener.java | 20 +-- .../org/apache/hugegraph/pd/rest/API.java | 18 +-- .../apache/hugegraph/pd/rest/GraphAPI.java | 20 +-- .../hugegraph/pd/rest/GraphSpaceAPI.java | 18 +-- .../apache/hugegraph/pd/rest/IndexAPI.java | 18 +-- .../apache/hugegraph/pd/rest/MemberAPI.java | 18 +-- .../hugegraph/pd/rest/PartitionAPI.java | 18 +-- .../hugegraph/pd/rest/PromTargetsAPI.java | 18 +-- .../apache/hugegraph/pd/rest/RegistryAPI.java | 18 +-- .../apache/hugegraph/pd/rest/ShardAPI.java | 18 +-- .../apache/hugegraph/pd/rest/StoreAPI.java | 18 +-- .../org/apache/hugegraph/pd/rest/TaskAPI.java | 18 +-- .../org/apache/hugegraph/pd/rest/TestAPI.java | 18 +-- .../pd/service/DiscoveryService.java | 18 +-- .../pd/service/KvServiceGrpcImpl.java | 18 +-- .../hugegraph/pd/service/PDPulseService.java | 18 +-- .../hugegraph/pd/service/PDRestService.java | 18 +-- .../hugegraph/pd/service/PDService.java | 18 +-- .../hugegraph/pd/service/PDWatchService.java | 18 +-- .../pd/service/PromTargetsService.java | 18 +-- .../hugegraph/pd/service/ServiceGrpc.java | 18 +-- .../hugegraph/pd/service/UpgradeService.java | 18 +-- .../pd/upgrade/VersionScriptFactory.java | 18 +-- .../pd/upgrade/VersionUpgradeScript.java | 18 +-- .../upgrade/scripts/PartitionMetaUpgrade.java | 18 +-- .../pd/upgrade/scripts/TaskCleanUpgrade.java | 18 +-- .../apache/hugegraph/pd/util/DateUtil.java | 18 +-- .../hugegraph/pd/util/HgExecutorUtil.java | 18 +-- .../apache/hugegraph/pd/util/HgMapCache.java | 18 +-- .../org/apache/hugegraph/pd/util/IdUtil.java | 18 +-- .../pd/util/grpc/GRpcServerConfig.java | 18 +-- .../pd/util/grpc/StreamObserverUtil.java | 18 +-- .../pd/watch/AbstractWatchSubject.java | 18 +-- .../hugegraph/pd/watch/KvWatchSubject.java | 18 +-- .../hugegraph/pd/watch/NodeChangeSubject.java | 18 +-- .../hugegraph/pd/watch/PDWatchSubject.java | 18 +-- .../pd/watch/PartitionChangeSubject.java | 18 +-- .../pd/watch/ShardGroupChangeSubject.java | 18 +-- .../src/main/resources/log4j2.xml | 18 +-- .../apache/hugegraph/pd/live/PDServer0.java | 18 +-- .../apache/hugegraph/pd/live/PDServer1.java | 18 +-- .../apache/hugegraph/pd/live/PDServer2.java | 18 +-- .../apache/hugegraph/pd/live/PDServer3.java | 18 +-- .../src/test/resources/log4j2.xml | 18 +-- hugegraph-pd/hg-pd-test/pom.xml | 18 +-- .../hugegraph/pd/MonitorServiceTest.java | 18 +-- .../hugegraph/pd/PartitionCacheTest.java | 18 +-- .../hugegraph/pd/PartitionServiceTest.java | 18 +-- .../hugegraph/pd/StoreNodeServiceTest.java | 18 +-- .../hugegraph/pd/StoreRegisterTest.java | 18 +-- .../org/apache/hugegraph/pd/UnitTestBase.java | 18 +-- .../hugegraph/pd/client/BaseClientTest.java | 20 +-- .../pd/client/DiscoveryClientImplTest.java | 20 +-- .../pd/client/DiscoveryClientTest.java | 18 +-- .../hugegraph/pd/client/KvClientTest.java | 18 +-- .../pd/client/LicenseClientImplTest.java | 18 +-- .../pd/client/PDClientSuiteTest.java | 18 +-- .../hugegraph/pd/client/PDClientTest.java | 18 +-- .../hugegraph/pd/client/PDPulseTest.java | 18 +-- .../hugegraph/pd/client/PDWatchTest.java | 20 +-- .../pd/client/test/HgPDTestUtil.java | 18 +-- .../pd/clitools/BaseCliToolsTest.java | 20 +-- .../pd/clitools/CliToolsSuiteTest.java | 20 +-- .../hugegraph/pd/clitools/MainTest.java | 20 +-- .../hugegraph/pd/common/BaseCommonTest.java | 20 +-- .../hugegraph/pd/common/CommonSuiteTest.java | 20 +-- .../hugegraph/pd/common/HgAssertTest.java | 18 +-- .../hugegraph/pd/common/KVPairTest.java | 18 +-- .../pd/common/MetadataKeyHelperTest.java | 18 +-- .../pd/common/PartitionCacheTest.java | 18 +-- .../pd/common/PartitionUtilsTest.java | 18 +-- .../hugegraph/pd/core/BaseCoreTest.java | 20 +-- .../hugegraph/pd/core/PDCoreSuiteTest.java | 20 +-- .../pd/core/StoreNodeServiceTest.java | 20 +-- .../pd/core/meta/MetadataKeyHelperTest.java | 18 +-- .../hugegraph/pd/grpc/BaseGrpcTest.java | 20 +-- .../hugegraph/pd/grpc/GrpcSuiteTest.java | 18 +-- .../hugegraph/pd/service/BaseServerTest.java | 20 +-- .../pd/service/ConfigServiceTest.java | 18 +-- .../hugegraph/pd/service/IdServiceTest.java | 18 +-- .../hugegraph/pd/service/KvServiceTest.java | 18 +-- .../hugegraph/pd/service/LogServiceTest.java | 18 +-- .../pd/service/PartitionServiceTest.java | 18 +-- .../hugegraph/pd/service/PdTestBase.java | 18 +-- .../hugegraph/pd/service/RestApiTest.java | 18 +-- .../hugegraph/pd/service/ServerSuiteTest.java | 18 +-- .../service/StoreMonitorDataServiceTest.java | 18 +-- .../pd/service/StoreNodeServiceNewTest.java | 18 +-- .../pd/service/StoreServiceTest.java | 18 +-- .../pd/service/TaskScheduleServiceTest.java | 18 +-- .../hugegraph/pd/store/HgKVStoreImplTest.java | 18 +-- .../hg-pd-test/src/main/resources/log4j2.xml | 18 +-- hugegraph-pd/local-release.sh | 25 ---- hugegraph-pd/pom.xml | 18 +-- hugegraph-pd/settings.xml | 133 ------------------ 210 files changed, 1909 insertions(+), 2120 deletions(-) delete mode 100644 hugegraph-pd/build-pre.sh delete mode 100644 hugegraph-pd/build.sh delete mode 100644 hugegraph-pd/ci.yml delete mode 100644 hugegraph-pd/deploy-release.sh delete mode 100644 hugegraph-pd/deploy-snapshot.sh delete mode 100755 hugegraph-pd/local-release.sh delete mode 100644 hugegraph-pd/settings.xml diff --git a/hugegraph-pd/.gitignore b/hugegraph-pd/.gitignore index 689a7a80b3..9a447456f0 100644 --- a/hugegraph-pd/.gitignore +++ b/hugegraph-pd/.gitignore @@ -7,7 +7,5 @@ **/tmp/ *.log *.iml -/hg-pd-common/target_B000000405016P_Oct-28-114458-2021_conflict_parent/ - dist/ .flattened-pom.xml diff --git a/hugegraph-pd/build-pre.sh b/hugegraph-pd/build-pre.sh deleted file mode 100644 index f92d104eea..0000000000 --- a/hugegraph-pd/build-pre.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# 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. -# - -mkdir output -touch output/1 -export JAVA_HOME=$ORACLEJDK_1_8_0_HOME - -readonly VER=3.6.3 -readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local - -$MAVEN_3_5_3_BIN/mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -$MAVEN_3_5_3_BIN/mvn --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy -$MAVEN_3_5_3_BIN/mvn versions:revert - - -#------------------repo----------------------- -readonly FILE_NAME=hugegraph-pd-3.6.3.tar.gz -readonly REPO_URL_FILE=http://127.0.0.1:8081/artifactory/star-file - -localFilePath=dist/${FILE_NAME} -targetFolder="${REPO_URL_FILE}/dist/$(date '+%Y-%m-%d')/" -artifactoryUser="admin" -artifactoryPassword="JFrog12345" - -md5Value="$(md5sum "$localFilePath")" -md5Value="${md5Value:0:32}" -sha1Value="$(sha1sum "$localFilePath")" -sha1Value="${sha1Value:0:40}" -sha256Value="$(sha256sum "$localFilePath")" -sha256Value="${sha256Value:0:65}" - -#curl -X PUT -u admin:JFrog12345 -T ${localFilePath} "${REPO_URL_FILE}/dist/${data_folder}/" -echo "INFO: Uploading $localFilePath to $targetFolder" -curl -i -X PUT -u "$artifactoryUser:$artifactoryPassword" \ - -H "X-Checksum-Md5: $md5Value" \ - -H "X-Checksum-Sha1: $sha1Value" \ - -H "X-Checksum-Sha256: $sha256Value" \ - -T "$localFilePath" \ - "$targetFolder" diff --git a/hugegraph-pd/build.sh b/hugegraph-pd/build.sh deleted file mode 100644 index f77358e1cc..0000000000 --- a/hugegraph-pd/build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export PATH=$MAVEN_3_5_3_BIN:$ORACLEJDK_11_0_7_BIN:$PATH -export JAVA_HOME=$ORACLEJDK_11_0_7_HOME -export MAVEN_HOME=$MAVEN_3_5_3_HOME - -# TODO: remove later -readonly REPO_URL=http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots - -if [ ! -n "$1" ] ;then - GOAL=package -else - GOAL=$1 -fi - -$MAVEN_3_5_3_BIN/mvn -Dmaven.test.skip=true -DaltDeploymentRepository=Baidu_Local_Snapshots::default::${REPO_URL} clean ${GOAL} -echo "mv dist...." -mv dist output -ls output -echo "mv dist done" -echo "show output...." -ls output -echo "show output done" diff --git a/hugegraph-pd/ci.yml b/hugegraph-pd/ci.yml deleted file mode 100644 index 0eb7515ae3..0000000000 --- a/hugegraph-pd/ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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. -# - -Global: - tool: build_submitter - languages: - # Java Version: 1.7, 1.8, 9, 10 - - language: java - version: 11 - envs: - # Maven Version: 3.0.4, 3.1.1, 3.2.5, 3.3.9, 3.5.3 - - env: maven - version: 3.5.3 -Default: - profile: [ dev ] -Profiles: - - profile: - name: dev - tool: build_submitter - env: DECK_CENTOS7U5_K3 - command: sh build.sh - release: true - - - profile: - name: deploy - tool: build_submitter - env: DECK_CENTOS7U5_K3 - command: sh build.sh deploy - release: true diff --git a/hugegraph-pd/deploy-release.sh b/hugegraph-pd/deploy-release.sh deleted file mode 100644 index 118a214d7f..0000000000 --- a/hugegraph-pd/deploy-release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly VER=3.6.3 -readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local -#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set - -./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -./mvnw --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy -./mvnw versions:revert diff --git a/hugegraph-pd/deploy-snapshot.sh b/hugegraph-pd/deploy-snapshot.sh deleted file mode 100644 index 118a214d7f..0000000000 --- a/hugegraph-pd/deploy-snapshot.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly VER=3.6.3 -readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local -#mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set - -./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -./mvnw --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy -./mvnw versions:revert diff --git a/hugegraph-pd/hg-pd-client/pom.xml b/hugegraph-pd/hg-pd-client/pom.xml index c2d67ff92d..a64756fe94 100644 --- a/hugegraph-pd/hg-pd-client/pom.xml +++ b/hugegraph-pd/hg-pd-client/pom.xml @@ -1,19 +1,19 @@ @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh index 05b3921c71..4bf0f8be8e 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # if [ -z "$GC_OPTION" ];then diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh index 55499ee59c..cda7ba647a 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/stop-hugegraph-pd.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # abs_path() { diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh index d32871f13f..807da92fa1 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh @@ -2,19 +2,19 @@ # # 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 +# 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. +# 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. # function command_available() { diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml index fe6ae6a913..4e2eee329e 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-pd/hg-pd-grpc/pom.xml b/hugegraph-pd/hg-pd-grpc/pom.xml index 538647a7a3..cef49e957d 100644 --- a/hugegraph-pd/hg-pd-grpc/pom.xml +++ b/hugegraph-pd/hg-pd-grpc/pom.xml @@ -1,19 +1,19 @@ { * Invoked on completion. */ void onCompleted(); -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java index dca1d58d02..3ae957dd53 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/API.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java index 78d24be5cd..9b3eb7662e 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; @@ -285,4 +285,4 @@ public GraphStatistics(Metapb.Graph graph) throws PDException { graphName = graphName.substring(0, graphName.length() - postfixLength); } } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java index 1bb4f183a5..c47e1869d4 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/GraphSpaceAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java index 6b1113a2eb..f2cf511a2b 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java index 16f560f92b..28c9fdb98d 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/MemberAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java index 5bc5cdfae0..cdd3ac0ae2 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PartitionAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java index f2432b093f..11a1cdf1e6 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java index 2aedd5f305..482eac40a0 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java index 53249b9436..685d8fa3a0 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/ShardAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java index f288ef877f..2587277745 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java index d1419d2ddb..06b8f0f8b8 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java index 1ab6326112..f15be9b48d 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.rest; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java index e1f6fcef3f..f5d9a45106 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/DiscoveryService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java index 7898248d2d..99c58937b4 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java index 2f21cfbacd..83a1e14169 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java index a7402886ff..76ee4227b8 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java index b7ec32abf1..4ef7401378 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java index d4b9481e9d..ac5dfd2b61 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java index 7683e58073..5f163e17d3 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java index 5aa67f93bf..7cba93a33a 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java index 78af36aaea..d7a121c8bd 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/UpgradeService.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.service; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java index 7f4b4fda4d..5e01952e55 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionScriptFactory.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.upgrade; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java index 8cd54864aa..7b261bce7c 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/VersionUpgradeScript.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.upgrade; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java index e113d95ff4..1b2e5ebe56 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/PartitionMetaUpgrade.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.upgrade.scripts; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java index 6370f839f9..bc302e31e3 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/upgrade/scripts/TaskCleanUpgrade.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.upgrade.scripts; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java index f26be26dd9..729e8c89fc 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java index 7619254483..26e7d97420 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgExecutorUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java index 8b6a4a4dcb..fe84bb4b04 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java index 75e4287178..6ecba60e1e 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java index ad0bad5493..83c198a800 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/GRpcServerConfig.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util.grpc; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java index c3893cc3ae..1eb995eced 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/grpc/StreamObserverUtil.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.util.grpc; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java index 79905511f2..bf25a578b3 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java index 0a2dbd84b5..c70016a319 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java index 0e7c26dde5..3036c00237 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java index 92ef98e8e6..c1a429eb87 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java index 85f5e8b7f0..43f5bc9b7a 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java index d9cfde8e73..3c6dd32ae6 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/ShardGroupChangeSubject.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.watch; diff --git a/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml b/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml index a26fe62d9d..f3cd7c005c 100644 --- a/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml +++ b/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java index 7ef0152ef2..ab4c3b486c 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer0.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.live; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java index 1e07684f85..1a30f5a2d3 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer1.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.live; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java index 6e14ca7f8e..74e72e5191 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer2.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.live; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java index b926118dfc..30fb9a200b 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/org/apache/hugegraph/pd/live/PDServer3.java @@ -1,18 +1,18 @@ /* * 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 + * 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. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.hugegraph.pd.live; diff --git a/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml b/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml index d117f8328c..e51bcb30a1 100644 --- a/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml +++ b/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml @@ -2,19 +2,19 @@ diff --git a/hugegraph-pd/hg-pd-test/pom.xml b/hugegraph-pd/hg-pd-test/pom.xml index 06b940a345..19e1855d8c 100644 --- a/hugegraph-pd/hg-pd-test/pom.xml +++ b/hugegraph-pd/hg-pd-test/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-pd/local-release.sh b/hugegraph-pd/local-release.sh deleted file mode 100755 index 2603bb07c3..0000000000 --- a/hugegraph-pd/local-release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# 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. -# - -readonly VER=3.6.3 - -mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set - -mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set -mvn --settings ./settings.xml -Dmaven.test.skip=true clean install -mvn versions:revert \ No newline at end of file diff --git a/hugegraph-pd/pom.xml b/hugegraph-pd/pom.xml index 26181e5a40..e7ccdce9b0 100644 --- a/hugegraph-pd/pom.xml +++ b/hugegraph-pd/pom.xml @@ -1,19 +1,19 @@ - - - - - - - star-local - superstar - Superstar12345 - - - star-snapshot - superstar - Superstar12345 - - - - - - baidu - - - baidu-nexus - http://maven.baidu-int.com/nexus/content/groups/public - - true - - - false - - - - baidu-nexus-snapshot - http://maven.baidu-int.com/nexus/content/groups/public-snapshots - - false - - - false - - - - - - star - http://127.0.0.1:8082/artifactory/star - - true - always - - - true - always - - - - - - Baidu_Local - http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local - - true - - - false - - - - Baidu_Local_Snapshots - - http://maven.baidu-int.com/nexus/content/repositories/Baidu_Local_Snapshots - - - false - - - true - always - - - - - - baidu-nexus - http://maven.baidu-int.com/nexus/content/groups/public - - true - - - false - - - - baidu-nexus-snapshot - http://maven.baidu-int.com/nexus/content/groups/public-snapshots - - false - - - true - - - - - - - - - baidu - - From 721111d11a919d9b02577a565c6c15cfe23eebf4 Mon Sep 17 00:00:00 2001 From: M <87920097+msgui@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:22:07 +0800 Subject: [PATCH 03/37] fix: format and clean code in dist and example modules (#2441) --- .../assembly/static/conf/gremlin-server.yaml | 50 +++---- .../src/assembly/static/conf/log4j2.xml | 26 ++-- .../assembly/static/conf/remote-objects.yaml | 4 +- .../travis/conf-raft1/gremlin-server.yaml | 40 +++--- .../travis/conf-raft2/gremlin-server.yaml | 40 +++--- .../travis/conf-raft3/gremlin-server.yaml | 40 +++--- .../src/assembly/travis/maven.xml | 40 +++--- .../org/apache/hugegraph/cmd/ConfDumper.java | 7 +- .../org/apache/hugegraph/cmd/InitStore.java | 5 +- .../hugegraph/dist/HugeGraphServer.java | 2 +- .../hugegraph/dist/HugeGremlinServer.java | 7 +- .../apache/hugegraph/dist/HugeRestServer.java | 3 +- .../apache/hugegraph/dist/RegisterUtil.java | 37 +++-- .../src/main/resources/log4j2.xml | 26 ++-- .../apache/hugegraph/example/Example1.java | 29 ++-- .../apache/hugegraph/example/Example2.java | 43 +++--- .../apache/hugegraph/example/Example3.java | 7 +- .../apache/hugegraph/example/ExampleUtil.java | 5 +- .../example/GraphOfTheMoviesExample.java | 134 +++++++++--------- .../hugegraph/example/PerfExample1.java | 6 +- .../hugegraph/example/PerfExample2.java | 6 +- .../hugegraph/example/PerfExample3.java | 7 +- .../hugegraph/example/PerfExample4.java | 6 +- .../hugegraph/example/PerfExampleBase.java | 7 +- .../apache/hugegraph/example/TaskExample.java | 3 +- .../example/ThreadRangePerfTest.java | 3 +- .../src/main/resources/log4j2.xml | 20 +-- 27 files changed, 304 insertions(+), 299 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml index 5946779828..32135163fd 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml @@ -28,8 +28,8 @@ graphs: { scriptEngines: { gremlin-groovy: { staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* ], plugins: { org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, @@ -70,9 +70,9 @@ scriptEngines: { org.opencypher.gremlin.traversal.CustomPredicate ], methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* ] }, org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { @@ -82,29 +82,29 @@ scriptEngines: { } } serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } metrics: { consoleReporter: {enabled: false, interval: 180000}, diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml index 0248da07d6..f1dd7e8395 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml @@ -30,14 +30,14 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> - + @@ -45,8 +45,8 @@ - - + + @@ -54,15 +54,15 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> - + @@ -70,8 +70,8 @@ - - + + @@ -86,7 +86,7 @@ - + @@ -94,8 +94,8 @@ - - + + diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml index 8ba24d00a1..39679d8c30 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml @@ -23,8 +23,8 @@ serializer: { # The duplication of HugeGraphIoRegistry is meant to fix a bug in the # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry ] } } diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml index 55a8c0bb34..7e10eb52b0 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml @@ -74,29 +74,29 @@ scriptEngines: { } } serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } metrics: { consoleReporter: {enabled: false, interval: 180000}, diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml index 54d9a6ddec..5f097f91bc 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml @@ -74,29 +74,29 @@ scriptEngines: { } } serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } metrics: { consoleReporter: {enabled: false, interval: 180000}, diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml index 508abef354..3f50c64778 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml @@ -74,29 +74,29 @@ scriptEngines: { } } serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } } metrics: { consoleReporter: {enabled: false, interval: 180000}, diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml b/hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml index 550716769a..ef01a3f20f 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml @@ -15,24 +15,24 @@ limitations under the License. --> - - - ossrh - ${env.MAVEN_REPO_USERNAME} - ${env.MAVEN_REPO_PASSWORD} - - - - - release - - false - - - gpg - ${env.GPG_KEY_ID} - ${env.GPG_PASSPHRASE} - - - + + + ossrh + ${env.MAVEN_REPO_USERNAME} + ${env.MAVEN_REPO_PASSWORD} + + + + + release + + false + + + gpg + ${env.GPG_KEY_ID} + ${env.GPG_PASSPHRASE} + + + diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java index cdeb321401..6bbb24e26e 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java @@ -23,14 +23,13 @@ import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.io.FileUtils; -import org.apache.hugegraph.dist.RegisterUtil; -import org.slf4j.Logger; - import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.OptionSpace; import org.apache.hugegraph.config.TypedOption; +import org.apache.hugegraph.dist.RegisterUtil; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class ConfDumper { @@ -39,7 +38,7 @@ public class ConfDumper { private static final Logger LOG = Log.logger(ConfDumper.class); public static void main(String[] args) - throws ConfigurationException, IOException { + throws ConfigurationException, IOException { E.checkArgument(args.length == 1, "ConfDumper need a config file."); diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java index 75199d1e7f..e226e381fb 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java @@ -117,9 +117,10 @@ private static HugeGraph initGraph(String configPath) throws Exception { } private static void initBackend(final HugeGraph graph) - throws InterruptedException { + throws InterruptedException { int retries = RETRIES; - retry: do { + retry: + do { try { graph.initBackend(); } catch (Exception e) { diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java index 7af1ff8b0a..ae2c73e2c5 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java @@ -45,7 +45,7 @@ public static void register() { } public HugeGraphServer(String gremlinServerConf, String restServerConf) - throws Exception { + throws Exception { // Only switch on security manager after HugeGremlinServer started SecurityManager securityManager = System.getSecurityManager(); System.setSecurityManager(null); diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java index 7d7a992a5f..edc4391efa 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java @@ -17,16 +17,15 @@ package org.apache.hugegraph.dist; -import org.apache.tinkerpop.gremlin.server.GremlinServer; -import org.apache.tinkerpop.gremlin.server.Settings; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.auth.ContextGremlinServer; import org.apache.hugegraph.event.EventHub; import org.apache.hugegraph.util.ConfigUtil; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.server.GremlinServer; +import org.apache.tinkerpop.gremlin.server.Settings; +import org.slf4j.Logger; public class HugeGremlinServer { diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java index 395ae886d2..6edb818bef 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java @@ -17,11 +17,10 @@ package org.apache.hugegraph.dist; -import org.slf4j.Logger; - import org.apache.hugegraph.event.EventHub; import org.apache.hugegraph.server.RestServer; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class HugeRestServer { diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java index a6570986a7..69d6674d0e 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java @@ -105,10 +105,12 @@ public static void registerCassandra() { "org.apache.hugegraph.backend.store.cassandra.CassandraOptions"); // Register serializer SerializerFactory.register("cassandra", - "org.apache.hugegraph.backend.store.cassandra.CassandraSerializer"); + "org.apache.hugegraph.backend.store.cassandra" + + ".CassandraSerializer"); // Register backend BackendProviderFactory.register("cassandra", - "org.apache.hugegraph.backend.store.cassandra.CassandraStoreProvider"); + "org.apache.hugegraph.backend.store.cassandra" + + ".CassandraStoreProvider"); } public static void registerScyllaDB() { @@ -117,10 +119,12 @@ public static void registerScyllaDB() { "org.apache.hugegraph.backend.store.cassandra.CassandraOptions"); // Register serializer SerializerFactory.register("scylladb", - "org.apache.hugegraph.backend.store.cassandra.CassandraSerializer"); + "org.apache.hugegraph.backend.store.cassandra" + + ".CassandraSerializer"); // Register backend BackendProviderFactory.register("scylladb", - "org.apache.hugegraph.backend.store.scylladb.ScyllaDBStoreProvider"); + "org.apache.hugegraph.backend.store.scylladb" + + ".ScyllaDBStoreProvider"); } public static void registerHBase() { @@ -132,7 +136,8 @@ public static void registerHBase() { "org.apache.hugegraph.backend.store.hbase.HbaseSerializer"); // Register backend BackendProviderFactory.register("hbase", - "org.apache.hugegraph.backend.store.hbase.HbaseStoreProvider"); + "org.apache.hugegraph.backend.store.hbase" + + ".HbaseStoreProvider"); } public static void registerRocksDB() { @@ -141,9 +146,11 @@ public static void registerRocksDB() { "org.apache.hugegraph.backend.store.rocksdb.RocksDBOptions"); // Register backend BackendProviderFactory.register("rocksdb", - "org.apache.hugegraph.backend.store.rocksdb.RocksDBStoreProvider"); + "org.apache.hugegraph.backend.store.rocksdb" + + ".RocksDBStoreProvider"); BackendProviderFactory.register("rocksdbsst", - "org.apache.hugegraph.backend.store.rocksdbsst.RocksDBSstStoreProvider"); + "org.apache.hugegraph.backend.store.rocksdbsst" + + ".RocksDBSstStoreProvider"); } public static void registerMysql() { @@ -155,7 +162,8 @@ public static void registerMysql() { "org.apache.hugegraph.backend.store.mysql.MysqlSerializer"); // Register backend BackendProviderFactory.register("mysql", - "org.apache.hugegraph.backend.store.mysql.MysqlStoreProvider"); + "org.apache.hugegraph.backend.store.mysql" + + ".MysqlStoreProvider"); } public static void registerPalo() { @@ -164,22 +172,25 @@ public static void registerPalo() { "org.apache.hugegraph.backend.store.palo.PaloOptions"); // Register serializer SerializerFactory.register("palo", - "org.apache.hugegraph.backend.store.palo.PaloSerializer"); + "org.apache.hugegraph.backend.store.palo.PaloSerializer"); // Register backend BackendProviderFactory.register("palo", - "org.apache.hugegraph.backend.store.palo.PaloStoreProvider"); + "org.apache.hugegraph.backend.store.palo" + + ".PaloStoreProvider"); } public static void registerPostgresql() { // Register config OptionSpace.register("postgresql", - "org.apache.hugegraph.backend.store.postgresql.PostgresqlOptions"); + "org.apache.hugegraph.backend.store.postgresql.PostgresqlOptions"); // Register serializer SerializerFactory.register("postgresql", - "org.apache.hugegraph.backend.store.postgresql.PostgresqlSerializer"); + "org.apache.hugegraph.backend.store.postgresql" + + ".PostgresqlSerializer"); // Register backend BackendProviderFactory.register("postgresql", - "org.apache.hugegraph.backend.store.postgresql.PostgresqlStoreProvider"); + "org.apache.hugegraph.backend.store.postgresql" + + ".PostgresqlStoreProvider"); } public static void registerServer() { diff --git a/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml index 72bee2a80d..b249fdae48 100644 --- a/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml @@ -30,14 +30,14 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> - + @@ -45,8 +45,8 @@ - - + + @@ -54,15 +54,15 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> - + @@ -70,8 +70,8 @@ - - + + @@ -86,7 +86,7 @@ - + @@ -94,8 +94,8 @@ - - + + diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java index f0e751547f..b9ca383bd3 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java @@ -21,14 +21,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.tinkerpop.gremlin.process.traversal.P; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.BackendException; @@ -45,6 +37,13 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.P; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; public class Example1 { @@ -79,9 +78,9 @@ private static void thread(HugeGraph graph) throws InterruptedException { graph.tx().commit(); // New tx - GraphTransaction tx = Whitebox.invoke(graph.getClass(), - "openGraphTransaction", - graph); + GraphTransaction tx = Whitebox.invoke(graph.getClass(), + "openGraphTransaction", + graph); tx.addVertex(T.label, "book", "name", "java-21"); tx.addVertex(T.label, "book", "name", "java-22"); @@ -214,13 +213,13 @@ public static void loadData(final HugeGraph graph) { graph.tx().commit(); // must commit manually with new backend tx (independent of tinkerpop) - GraphTransaction tx = Whitebox.invoke(graph.getClass(), - "openGraphTransaction", - graph); + GraphTransaction tx = Whitebox.invoke(graph.getClass(), + "openGraphTransaction", + graph); LOG.info("=============== addVertex ================"); Vertex james = tx.addVertex(T.label, "author", "id", 1, - "name", "James Gosling", "age", 62, + "name", "James Gosling", "age", 62, "lived", "San Francisco Bay Area"); Vertex java = tx.addVertex(T.label, "language", "name", "java", diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java index db63e37f44..2933279d19 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java @@ -19,6 +19,10 @@ import java.util.List; +import org.apache.hugegraph.HugeFactory; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.schema.SchemaManager; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Path; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; @@ -29,11 +33,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.schema.SchemaManager; -import org.apache.hugegraph.util.Log; - public class Example2 { private static final Logger LOG = Log.logger(Example2.class); @@ -93,7 +92,7 @@ public static void traversal(final HugeGraph graph) { String person = graph.schema().getVertexLabel("person").id().asString(); String software = graph.schema().getVertexLabel("software").id() - .asString(); + .asString(); String markoId = String.format("%s:%s", person, "marko"); String joshId = String.format("%s:%s", person, "josh"); String lopId = String.format("%s:%s", software, "lop"); @@ -122,30 +121,30 @@ public static void traversal(final HugeGraph graph) { assert paths.get(0).get(1).equals("lop"); LOG.info(">>>> query with out() optimize: {}", - graph.traversal().V(markoId) - .out() - .out() - .values("name").toList()); + graph.traversal().V(markoId) + .out() + .out() + .values("name").toList()); LOG.info(">>>> query with out() optimize and path(): {}", - graph.traversal().V() - .out("knows") - .out("created") - .values("name") - .path() - .toList()); + graph.traversal().V() + .out("knows") + .out("created") + .values("name") + .path() + .toList()); } public static List shortestPath(final HugeGraph graph, Object from, Object to, int maxDepth) { GraphTraversal t = graph.traversal() - .V(from) - .repeat(__.out().simplePath()) - .until(__.hasId(to).or().loops().is(P.gt(maxDepth))) - .hasId(to) - .path().by("name") - .limit(1); + .V(from) + .repeat(__.out().simplePath()) + .until(__.hasId(to).or().loops().is(P.gt(maxDepth))) + .hasId(to) + .path().by("name") + .limit(1); return t.toList(); } diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java index 6dd877c35c..5e1f57d5a9 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java @@ -17,14 +17,13 @@ package org.apache.hugegraph.example; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; public class Example3 { diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java index 06f7517bb7..e81d5e4036 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java @@ -33,6 +33,7 @@ import org.slf4j.Logger; public class ExampleUtil { + private static final Logger LOG = Log.logger(ExampleUtil.class); private static boolean registered = false; @@ -65,13 +66,13 @@ public static HugeGraph loadGraph(boolean needClear, boolean needProfile) { String conf = "hugegraph.properties"; try { String path = ExampleUtil.class.getClassLoader() - .getResource(conf).getPath(); + .getResource(conf).getPath(); File file = new File(path); if (file.exists() && file.isFile()) { conf = path; } } catch (Exception ignored) { - LOG.warn("loadGraph warn {} ",ignored); + LOG.warn("loadGraph warn {} ", ignored); } HugeGraph graph = HugeFactory.open(conf); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java index 3ac67b5af3..60ef236f91 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java @@ -19,17 +19,16 @@ import java.util.List; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.perf.PerfUtil; +import org.apache.hugegraph.schema.SchemaManager; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.perf.PerfUtil; -import org.apache.hugegraph.schema.SchemaManager; -import org.apache.hugegraph.util.Log; - public class GraphOfTheMoviesExample { private static final Logger LOG = Log.logger(GraphOfTheMoviesExample.class); @@ -43,7 +42,7 @@ public static void main(String[] args) { GraphOfTheMoviesExample.load(graph); long endTime = System.currentTimeMillis(); LOG.info(">>>> adding all vertices cost time(s): {}", - (endTime - startTime) / 1000.0); + (endTime - startTime) / 1000.0); GraphOfTheMoviesExample.query(graph); @@ -107,12 +106,12 @@ public static void load(final HugeGraph graph) { .range().create(); Vertex theMatrix = graph.addVertex(T.label, "movie", "title", - "The Matrix", "released", 1999); + "The Matrix", "released", 1999); Vertex keanu = graph.addVertex(T.label, "person", "name", "keanu Reeves", "born", 1964); - Vertex carrie = graph.addVertex(T.label, "person", "name", - "carrie-anne Moss", "born", 1967); - Vertex laurence = graph.addVertex(T.label, "person", "name", - "laurence Fishburne", "born", 1961); + Vertex carrie = graph.addVertex(T.label, "person", "name", + "carrie-anne Moss", "born", 1967); + Vertex laurence = graph.addVertex(T.label, "person", "name", + "laurence Fishburne", "born", 1961); Vertex hugo = graph.addVertex(T.label, "person", "name", "hugo Weaving", "born", 1960); Vertex lillyW = graph.addVertex(T.label, "person", "name", "Lilly Wachowski", "born", 1967); Vertex lanaW = graph.addVertex(T.label, "person", "name", "Lana Wachowski", "born", 1965); @@ -130,7 +129,7 @@ public static void load(final HugeGraph graph) { emil.addEdge("ACTED_IN", theMatrix, "roles", "emil"); Vertex theMatrixReloaded = graph.addVertex(T.label, "movie", "title", - "The Matrix Reloaded", "released", 2003); + "The Matrix Reloaded", "released", 2003); keanu.addEdge("ACTED_IN", theMatrixReloaded, "roles", "Neo"); carrie.addEdge("ACTED_IN", theMatrixReloaded, "roles", "Trinity"); @@ -141,7 +140,7 @@ public static void load(final HugeGraph graph) { joelS.addEdge("PRODUCED", theMatrixReloaded, "score", 10); Vertex theMatrixRevolutions = graph.addVertex(T.label, "movie", "title", - "The Matrix Revolutions", "released", 2003); + "The Matrix Revolutions", "released", 2003); keanu.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "Neo"); carrie.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "Trinity"); @@ -152,10 +151,10 @@ public static void load(final HugeGraph graph) { joelS.addEdge("PRODUCED", theMatrixRevolutions, "score", 10); Vertex theDevilsadvocate = graph.addVertex(T.label, "movie", "title", - "The Devil's advocate", "released", 1997); + "The Devil's advocate", "released", 1997); Vertex charlize = graph.addVertex(T.label, "person", "name", - "charlize Theron", "born", 1975); + "charlize Theron", "born", 1975); Vertex al = graph.addVertex(T.label, "person", "name", "al Pacino", "born", 1940); Vertex taylor = graph.addVertex(T.label, "person", "name", "taylor Hackford", "born", 1944); @@ -165,21 +164,21 @@ public static void load(final HugeGraph graph) { taylor.addEdge("DIRECTED", theDevilsadvocate, "score", 10); Vertex aFewGoodMen = graph.addVertex(T.label, "movie", "title", - "a Few Good Men", "released", 1992); + "a Few Good Men", "released", 1992); Vertex tomC = graph.addVertex(T.label, "person", "name", "Tom Cruise", "born", 1962); Vertex jackN = graph.addVertex(T.label, "person", "name", "Jack Nicholson", "born", 1937); Vertex demiM = graph.addVertex(T.label, "person", "name", "Demi Moore", "born", 1962); Vertex kevinB = graph.addVertex(T.label, "person", "name", "Kevin Bacon", "born", 1958); Vertex kieferS = graph.addVertex(T.label, "person", "name", - "Kiefer Sutherland", "born", 1966); + "Kiefer Sutherland", "born", 1966); Vertex noahW = graph.addVertex(T.label, "person", "name", "Noah Wyle", "born", 1971); Vertex cubaG = graph.addVertex(T.label, "person", "name", "Cuba Gooding Jr.", "born", 1968); Vertex kevinP = graph.addVertex(T.label, "person", "name", "Kevin Pollak", "born", 1957); Vertex jtw = graph.addVertex(T.label, "person", "name", "J.T. Walsh", "born", 1943); Vertex jamesM = graph.addVertex(T.label, "person", "name", "James Marshall", "born", 1967); Vertex christopherG = graph.addVertex(T.label, "person", "name", - "Christopher Guest", "born", 1948); + "Christopher Guest", "born", 1948); Vertex robR = graph.addVertex(T.label, "person", "name", "Rob Reiner", "born", 1947); Vertex aaronS = graph.addVertex(T.label, "person", "name", "aaron Sorkin", "born", 1961); @@ -203,7 +202,7 @@ public static void load(final HugeGraph graph) { Vertex kellyM = graph.addVertex(T.label, "person", "name", "Kelly McGillis", "born", 1957); Vertex valK = graph.addVertex(T.label, "person", "name", "Val Kilmer", "born", 1959); Vertex anthonyE = graph.addVertex(T.label, "person", "name", - "anthony Edwards", "born", 1962); + "anthony Edwards", "born", 1962); Vertex tomS = graph.addVertex(T.label, "person", "name", "Tom Skerritt", "born", 1933); Vertex megR = graph.addVertex(T.label, "person", "name", "Meg Ryan", "born", 1961); Vertex tonyS = graph.addVertex(T.label, "person", "name", "Tony Scott", "born", 1944); @@ -219,7 +218,7 @@ public static void load(final HugeGraph graph) { jimC.addEdge("WROTE", topGun, "score", 10); Vertex jerryMaguire = graph.addVertex(T.label, "movie", "title", - "Jerry Maguire", "released", 2000); + "Jerry Maguire", "released", 2000); Vertex reneeZ = graph.addVertex(T.label, "person", "name", "Renee Zellweger", "born", 1969); Vertex kellyP = graph.addVertex(T.label, "person", "name", "Kelly Preston", "born", 1962); @@ -228,7 +227,7 @@ public static void load(final HugeGraph graph) { Vertex bonnieH = graph.addVertex(T.label, "person", "name", "Bonnie Hunt", "born", 1970); Vertex reginaK = graph.addVertex(T.label, "person", "name", "Regina King", "born", 1961); Vertex jonathanL = graph.addVertex(T.label, "person", "name", - "Jonathan Lipnicki", "born", 1996); + "Jonathan Lipnicki", "born", 1996); Vertex cameronC = graph.addVertex(T.label, "person", "name", "Cameron Crowe", "born", 1957); tomC.addEdge("ACTED_IN", jerryMaguire, "roles", "Jerry Maguire"); @@ -245,14 +244,14 @@ public static void load(final HugeGraph graph) { cameronC.addEdge("WROTE", jerryMaguire, "score", 10); Vertex standByMe = graph.addVertex(T.label, "movie", "title", - "Stand By Me", "released", 1986); + "Stand By Me", "released", 1986); Vertex riverP = graph.addVertex(T.label, "person", "name", "River Phoenix", "born", 1970); Vertex coreyF = graph.addVertex(T.label, "person", "name", "Corey Feldman", "born", 1971); Vertex wilW = graph.addVertex(T.label, "person", "name", "Wil Wheaton", "born", 1972); Vertex johnC = graph.addVertex(T.label, "person", "name", "John Cusack", "born", 1966); Vertex marshallB = graph.addVertex(T.label, "person", "name", - "Marshall Bell", "born", 1942); + "Marshall Bell", "born", 1942); wilW.addEdge("ACTED_IN", standByMe, "roles", "Gordie Lachance"); riverP.addEdge("ACTED_IN", standByMe, "roles", "Chris Chambers"); @@ -264,7 +263,7 @@ public static void load(final HugeGraph graph) { robR.addEdge("DIRECTED", standByMe, "score", 10); Vertex asGoodasItGets = graph.addVertex(T.label, "movie", "title", - "as Good as It Gets", "released", 1997); + "as Good as It Gets", "released", 1997); Vertex helenH = graph.addVertex(T.label, "person", "name", "Helen Hunt", "born", 1963); Vertex gregK = graph.addVertex(T.label, "person", "name", "Greg Kinnear", "born", 1963); @@ -277,10 +276,10 @@ public static void load(final HugeGraph graph) { jamesB.addEdge("DIRECTED", asGoodasItGets, "score", 10); Vertex whatDreamsMayCome = graph.addVertex(T.label, "movie", "title", - "What Dreams May Come", "released", 1998); + "What Dreams May Come", "released", 1998); Vertex annabellaS = graph.addVertex(T.label, "person", "name", - "annabella Sciorra", "born", 1960); + "annabella Sciorra", "born", 1960); Vertex maxS = graph.addVertex(T.label, "person", "name", "Max von Sydow", "born", 1929); Vertex wernerH = graph.addVertex(T.label, "person", "name", "Werner Herzog", "born", 1942); Vertex robin = graph.addVertex(T.label, "person", "name", "robin Williams", "born", 1951); @@ -294,7 +293,7 @@ public static void load(final HugeGraph graph) { vincentW.addEdge("DIRECTED", whatDreamsMayCome, "score", 10); Vertex snowFallingonCedars = graph.addVertex(T.label, "movie", "title", - "Snow Falling on Cedars", "released", 1999); + "Snow Falling on Cedars", "released", 1999); Vertex ethanH = graph.addVertex(T.label, "person", "name", "Ethan Hawke", "born", 1970); Vertex rickY = graph.addVertex(T.label, "person", "name", "Rick Yune", "born", 1971); @@ -308,7 +307,7 @@ public static void load(final HugeGraph graph) { scottH.addEdge("DIRECTED", snowFallingonCedars, "score", 10); Vertex youveGotMail = graph.addVertex(T.label, "movie", "title", - "You've Got Mail", "released", 1998); + "You've Got Mail", "released", 1998); Vertex parkerP = graph.addVertex(T.label, "person", "name", "Parker Posey", "born", 1968); Vertex daveC = graph.addVertex(T.label, "person", "name", "Dave Chappelle", "born", 1973); @@ -325,7 +324,7 @@ public static void load(final HugeGraph graph) { noraE.addEdge("DIRECTED", youveGotMail, "score", 10); Vertex sleeplessInSeattle = graph.addVertex(T.label, "movie", "title", - "Sleepless in Seattle", "released", 1993); + "Sleepless in Seattle", "released", 1993); Vertex ritaW = graph.addVertex(T.label, "person", "name", "Rita Wilson", "born", 1956); Vertex billPull = graph.addVertex(T.label, "person", "name", "Bill Pullman", "born", 1953); @@ -341,20 +340,20 @@ public static void load(final HugeGraph graph) { noraE.addEdge("DIRECTED", sleeplessInSeattle, "score", 10); Vertex joeVersustheVolcano = graph.addVertex(T.label, "movie", "title", - "Joe Versus the Volcano", "released", 1990); + "Joe Versus the Volcano", "released", 1990); Vertex johnS = graph.addVertex(T.label, "person", "name", - "John Patrick Stanley", "born", 1950); + "John Patrick Stanley", "born", 1950); Vertex nathan = graph.addVertex(T.label, "person", "name", "nathan Lane", "born", 1956); tomH.addEdge("ACTED_IN", joeVersustheVolcano, "roles", "Joe Banks"); - megR.addEdge("ACTED_IN", joeVersustheVolcano, "roles", - "DeDe, angelica Graynamore, Patricia Graynamore"); + megR.addEdge("ACTED_IN", joeVersustheVolcano, "roles", + "DeDe, angelica Graynamore, Patricia Graynamore"); nathan.addEdge("ACTED_IN", joeVersustheVolcano, "roles", "Baw"); johnS.addEdge("DIRECTED", joeVersustheVolcano, "score", 10); Vertex whenHarryMetSally = graph.addVertex(T.label, "movie", "title", - "When Harry Met Sally", "released", 1998); + "When Harry Met Sally", "released", 1998); Vertex billyC = graph.addVertex(T.label, "person", "name", "Billy Crystal", "born", 1948); Vertex carrieF = graph.addVertex(T.label, "person", "name", "carrie Fisher", "born", 1956); @@ -370,7 +369,7 @@ public static void load(final HugeGraph graph) { noraE.addEdge("WROTE", whenHarryMetSally, "score", 10); Vertex thatThingYouDo = graph.addVertex(T.label, "movie", "title", - "That Thing You Do", "released", 1996); + "That Thing You Do", "released", 1996); Vertex livT = graph.addVertex(T.label, "person", "name", "Liv Tyler", "born", 1977); @@ -380,7 +379,7 @@ public static void load(final HugeGraph graph) { tomH.addEdge("DIRECTED", thatThingYouDo, "score", 10); Vertex theReplacements = graph.addVertex(T.label, "movie", "title", - "The Replacements", "released", 2000); + "The Replacements", "released", 2000); Vertex brooke = graph.addVertex(T.label, "person", "name", "brooke Langton", "born", 1970); Vertex gene = graph.addVertex(T.label, "person", "name", "gene Hackman", "born", 1930); @@ -394,10 +393,10 @@ public static void load(final HugeGraph graph) { howard.addEdge("DIRECTED", theReplacements, "score", 10); Vertex rescueDawn = graph.addVertex(T.label, "movie", "title", - "rescueDawn", "released", 2006); + "rescueDawn", "released", 2006); Vertex christianB = graph.addVertex(T.label, "person", "name", - "Christian Bale", "born", 1974); + "Christian Bale", "born", 1974); Vertex zachG = graph.addVertex(T.label, "person", "name", "Zach Grenier", "born", 1954); marshallB.addEdge("ACTED_IN", rescueDawn, "roles", "admiral"); @@ -407,7 +406,7 @@ public static void load(final HugeGraph graph) { wernerH.addEdge("DIRECTED", rescueDawn, "score", 10); Vertex theBirdcage = graph.addVertex(T.label, "movie", "title", - "The Birdcage", "released", 1996); + "The Birdcage", "released", 1996); Vertex mikeN = graph.addVertex(T.label, "person", "name", "Mike Nichols", "born", 1931); @@ -417,10 +416,10 @@ public static void load(final HugeGraph graph) { mikeN.addEdge("DIRECTED", theBirdcage, "score", 10); Vertex unforgiven = graph.addVertex(T.label, "movie", "title", - "unforgiven", "released", 1992); + "unforgiven", "released", 1992); Vertex richardH = graph.addVertex(T.label, "person", "name", - "Richard Harris", "born", 1930); + "Richard Harris", "born", 1930); Vertex clintE = graph.addVertex(T.label, "person", "name", "Richard Harris", "born", 1930); richardH.addEdge("ACTED_IN", unforgiven, "roles", "English Bob"); @@ -429,7 +428,7 @@ public static void load(final HugeGraph graph) { clintE.addEdge("DIRECTED", unforgiven, "score", 10); Vertex johnnyMnemonic = graph.addVertex(T.label, "movie", "title", - "Johnny Mnemonic", "released", 1995); + "Johnny Mnemonic", "released", 1995); Vertex takeshi = graph.addVertex(T.label, "person", "name", "takeshi Kitano", "born", 1947); Vertex dina = graph.addVertex(T.label, "person", "name", "dina Meyer", "born", 1968); @@ -443,24 +442,24 @@ public static void load(final HugeGraph graph) { robertL.addEdge("DIRECTED", johnnyMnemonic, "score", 10); Vertex cloudatlas = graph.addVertex(T.label, "movie", "title", - "Cloud atlas", "released", 2012); + "Cloud atlas", "released", 2012); Vertex halleB = graph.addVertex(T.label, "person", "name", "Halle Berry", "born", 1966); Vertex jimB = graph.addVertex(T.label, "person", "name", "Jim Broadbent", "born", 1949); Vertex tomT = graph.addVertex(T.label, "person", "name", "Tom Tykwer", "born", 1965); Vertex davidMitchell = graph.addVertex(T.label, "person", "name", - "David Mitchell", "born", 1969); + "David Mitchell", "born", 1969); Vertex stefanarndt = graph.addVertex(T.label, "person", "name", - "Stefan arndt", "born", 1961); + "Stefan arndt", "born", 1961); tomH.addEdge("ACTED_IN", cloudatlas, "roles", - "Zachry, Dr. Henry Goose, Isaac Sachs, Dermot Hoggins"); + "Zachry, Dr. Henry Goose, Isaac Sachs, Dermot Hoggins"); hugo.addEdge("ACTED_IN", cloudatlas, "roles", - "Bill Smoke, Haskell Moore, Tadeusz Kesselring, Nurse Noakes," + - " Boardman Mephi, Old Georgie"); + "Bill Smoke, Haskell Moore, Tadeusz Kesselring, Nurse Noakes," + + " Boardman Mephi, Old Georgie"); halleB.addEdge("ACTED_IN", cloudatlas, "roles", "Luisa Rey, Jocasta ayrs, Ovid, Meronym"); jimB.addEdge("ACTED_IN", cloudatlas, "roles", - "Vyvyan ayrs, Captain Molyneux, Timothy Cavendish"); + "Vyvyan ayrs, Captain Molyneux, Timothy Cavendish"); tomT.addEdge("DIRECTED", cloudatlas, "score", 10); lillyW.addEdge("DIRECTED", cloudatlas, "score", 10); lanaW.addEdge("DIRECTED", cloudatlas, "score", 10); @@ -468,7 +467,7 @@ public static void load(final HugeGraph graph) { stefanarndt.addEdge("PRODUCED", cloudatlas, "score", 10); Vertex theDaVinciCode = graph.addVertex(T.label, "movie", "title", - "The Da Vinci Code", "released", 2006); + "The Da Vinci Code", "released", 2006); Vertex ianM = graph.addVertex(T.label, "person", "name", "Ian McKellen", "born", 1939); Vertex audreyT = graph.addVertex(T.label, "person", "name", "audrey Tautou", "born", 1976); @@ -482,10 +481,10 @@ public static void load(final HugeGraph graph) { ronH.addEdge("DIRECTED", theDaVinciCode, "score", 10); Vertex vforVendetta = graph.addVertex(T.label, "movie", "title", - "The Da Vinci Code", "released", 2006); + "The Da Vinci Code", "released", 2006); Vertex natalieP = graph.addVertex(T.label, "person", "name", - "Natalie Portman", "born", 1981); + "Natalie Portman", "born", 1981); Vertex stephenR = graph.addVertex(T.label, "person", "name", "Stephen Rea", "born", 1946); Vertex johnH = graph.addVertex(T.label, "person", "name", "John Hurt", "born", 1940); Vertex benM = graph.addVertex(T.label, "person", "name", "Ben Miles", "born", 1967); @@ -503,14 +502,14 @@ public static void load(final HugeGraph graph) { lanaW.addEdge("WROTE", vforVendetta, "score", 10); Vertex speedRacer = graph.addVertex(T.label, "movie", "title", - "Speed Racer", "released", 2008); + "Speed Racer", "released", 2008); Vertex matthewF = graph.addVertex(T.label, "person", "name", "Matthew Fox", "born", 1966); Vertex emileH = graph.addVertex(T.label, "person", "name", "Emile Hirsch", "born", 1985); Vertex johnG = graph.addVertex(T.label, "person", "name", "John Goodman", "born", 1940); Vertex susanS = graph.addVertex(T.label, "person", "name", "Susan Sarandon", "born", 1966); Vertex christinaR = graph.addVertex(T.label, "person", "name", - "Christina Ricci", "born", 1980); + "Christina Ricci", "born", 1980); Vertex rain = graph.addVertex(T.label, "person", "name", "Rain", "born", 1982); emileH.addEdge("ACTED_IN", speedRacer, "roles", "Speed Racer"); @@ -527,7 +526,7 @@ public static void load(final HugeGraph graph) { joelS.addEdge("PRODUCED", speedRacer, "score", 10); Vertex ninjaassassin = graph.addVertex(T.label, "movie", "title", - "Speed Racer", "released", 2009); + "Speed Racer", "released", 2009); Vertex naomieH = graph.addVertex(T.label, "person", "name", "Naomie Harris", "born", 1982); @@ -541,15 +540,15 @@ public static void load(final HugeGraph graph) { joelS.addEdge("PRODUCED", ninjaassassin, "score", 10); Vertex theGreenMile = graph.addVertex(T.label, "movie", "title", - "The Green Mile", "released", 1999); + "The Green Mile", "released", 1999); Vertex michaelD = graph.addVertex(T.label, "person", "name", - "Michael Clarke Duncan", "born", 1957); + "Michael Clarke Duncan", "born", 1957); Vertex davidM = graph.addVertex(T.label, "person", "name", "David Morse", "born", 1953); Vertex samR = graph.addVertex(T.label, "person", "name", "Sam Rockwell", "born", 1968); Vertex garyS = graph.addVertex(T.label, "person", "name", "Gary Sinise", "born", 1955); Vertex patriciaC = graph.addVertex(T.label, "person", "name", - "Patricia Clarkson", "born", 1959); + "Patricia Clarkson", "born", 1959); Vertex frankD = graph.addVertex(T.label, "person", "name", "Frank Darabont", "born", 1959); tomH.addEdge("ACTED_IN", theGreenMile, "roles", "Paul Edgecomb"); @@ -563,7 +562,7 @@ public static void load(final HugeGraph graph) { frankD.addEdge("DIRECTED", theGreenMile, "score", 10); Vertex frostNixon = graph.addVertex(T.label, "movie", "title", - "Frost/Nixon", "released", 2008); + "Frost/Nixon", "released", 2008); Vertex frankL = graph.addVertex(T.label, "person", "name", "Frank Langella", "born", 1938); Vertex michaelS = graph.addVertex(T.label, "person", "name", "Michael Sheen", "born", 1969); @@ -602,7 +601,7 @@ public static void load(final HugeGraph graph) { Vertex twister = graph.addVertex(T.label, "movie", "title", "twister", "released", 1996); Vertex philipH = graph.addVertex(T.label, "person", "name", - "Philip Seymour Hoffman", "born", 1967); + "Philip Seymour Hoffman", "born", 1967); Vertex janB = graph.addVertex(T.label, "person", "name", "Jan de Bont", "born", 1943); billPax.addEdge("ACTED_IN", twister, "roles", "Bill Harding"); @@ -614,14 +613,15 @@ public static void load(final HugeGraph graph) { Vertex castaway = graph.addVertex(T.label, "movie", "title", "Cast away", "released", 2000); Vertex robertZ = graph.addVertex(T.label, "person", "name", - "Robert Zemeckis", "born", 1951); + "Robert Zemeckis", "born", 1951); tomH.addEdge("ACTED_IN", castaway, "roles", "Chuck Noland"); helenH.addEdge("ACTED_IN", castaway, "roles", "Kelly Frears"); robertZ.addEdge("DIRECTED", castaway, "score", 10); Vertex oneFlewOvertheCuckoosNest = graph.addVertex(T.label, "movie", "title", - "One Flew Over the Cuckoo's Nest", "released", 1975); + "One Flew Over the Cuckoo's Nest", + "released", 1975); Vertex milosF = graph.addVertex(T.label, "person", "name", "Milos Forman", "born", 1932); @@ -630,7 +630,7 @@ public static void load(final HugeGraph graph) { milosF.addEdge("DIRECTED", oneFlewOvertheCuckoosNest, "score", 10); Vertex somethingsGottaGive = graph.addVertex(T.label, "movie", "title", - "Something's Gotta Give", "released", 2003); + "Something's Gotta Give", "released", 2003); Vertex dianeK = graph.addVertex(T.label, "person", "name", "Diane Keaton", "born", 1946); Vertex nancyM = graph.addVertex(T.label, "person", "name", "Nancy Meyers", "born", 1949); @@ -643,7 +643,7 @@ public static void load(final HugeGraph graph) { nancyM.addEdge("WROTE", somethingsGottaGive, "score", 10); Vertex bicentennialMan = graph.addVertex(T.label, "movie", "title", - "Bicentennial Man", "released", 2000); + "Bicentennial Man", "released", 2000); Vertex chrisC = graph.addVertex(T.label, "person", "name", "Chris Columbus", "born", 1958); @@ -652,7 +652,7 @@ public static void load(final HugeGraph graph) { chrisC.addEdge("DIRECTED", bicentennialMan, "score", 10); Vertex charlieWilsonsWar = graph.addVertex(T.label, "movie", "title", - "Charlie Wilson's War", "released", 2007); + "Charlie Wilson's War", "released", 2007); Vertex juliaR = graph.addVertex(T.label, "person", "name", "Julia Roberts", "born", 1967); @@ -662,14 +662,14 @@ public static void load(final HugeGraph graph) { mikeN.addEdge("DIRECTED", charlieWilsonsWar, "score", 10); Vertex thePolarExpress = graph.addVertex(T.label, "movie", "title", - "The Polar Express", "released", 2004); + "The Polar Express", "released", 2004); tomH.addEdge("ACTED_IN", thePolarExpress, "roles", "Hero Boy"); robertZ.addEdge("DIRECTED", thePolarExpress, "score", 10); Vertex aLeagueofTheirOwn = graph.addVertex(T.label, "movie", "title", - "a League of Their Own", "released", 1992); + "a League of Their Own", "released", 1992); Vertex madonna = graph.addVertex(T.label, "person", "name", "madonna", "born", 1954); Vertex geenaD = graph.addVertex(T.label, "person", "name", "Geena Davis", "born", 1956); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java index 943e43f6ce..f015b59569 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java @@ -21,12 +21,12 @@ import java.util.List; import java.util.Random; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; + import com.datastax.driver.core.exceptions.NoHostAvailableException; /** diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java index 4316eaa2f2..5dc50f80f9 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java @@ -21,12 +21,12 @@ import java.util.List; import java.util.Random; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; + import com.datastax.driver.core.exceptions.NoHostAvailableException; /** diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java index 8fb9e1d0c4..10ef178d22 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java @@ -17,13 +17,12 @@ package org.apache.hugegraph.example; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; /** * Perf test for: insert vertices with indexes in order diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java index 6dda804651..c686e360d6 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java @@ -19,11 +19,10 @@ import java.util.List; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; /** * Perf test for: query vertices with indexes and limit @@ -34,6 +33,7 @@ public class PerfExample4 extends PerfExample3 { /** * Main method + * * @param args 3 arguments, 1st should be 1, meaning single thread, * product of 2nd and 3rd is total number of "person" vertices * @throws InterruptedException diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java index cf93f7bb84..684866674d 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java @@ -96,7 +96,7 @@ public int test(String[] args) throws Exception { * @throws Exception execute may throw Exception */ public void testInsertPerf(GraphManager graph, int threadCount, int times, int multiple) - throws Exception { + throws Exception { // Total vertices/edges long n = (long) threadCount * times * multiple; long vertices = (PERSON_NUM + SOFTWARE_NUM) * n; @@ -113,7 +113,7 @@ public void testInsertPerf(GraphManager graph, int threadCount, int times, int m } public void testQueryVertexPerf(GraphManager graph, int threadCount, int times, int multiple) - throws Exception { + throws Exception { long cost = this.execute(graph, i -> { this.testQueryVertex(graph, threadCount, i, multiple); }, threadCount); @@ -125,7 +125,7 @@ public void testQueryVertexPerf(GraphManager graph, int threadCount, int times, } public void testQueryEdgePerf(GraphManager graph, int threadCount, int times, int multiple) - throws Exception { + throws Exception { long cost = this.execute(graph, i -> { this.testQueryEdge(graph, threadCount, i, multiple); }, threadCount); @@ -236,6 +236,7 @@ protected void testQueryEdge(GraphManager graph, int threads, int thread, int mu } protected static class GraphManager { + private final HugeGraph hugegraph; private final Cache cache = CacheManager.instance().cache("perf-test"); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java index 3259cc33c1..2afa719b99 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java @@ -20,8 +20,6 @@ import java.util.Iterator; import org.apache.commons.collections.IteratorUtils; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; @@ -32,6 +30,7 @@ import org.apache.hugegraph.task.TaskStatus; import org.apache.hugegraph.testutil.Whitebox; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class TaskExample { diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java index aa6c8dc885..d2da5014ac 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java @@ -17,10 +17,9 @@ package org.apache.hugegraph.example; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class ThreadRangePerfTest { diff --git a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml index fd614545e1..ba2761f6c8 100644 --- a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml @@ -30,14 +30,14 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log" + immediateFlush="false"> - + @@ -45,8 +45,8 @@ - - + + @@ -54,15 +54,15 @@ + filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz" + bufferSize="524288" immediateFlush="false"> - + @@ -70,8 +70,8 @@ - - + + From 960b7330fd8860d6dd7f56b063a874a37e13fa84 Mon Sep 17 00:00:00 2001 From: M <87920097+msgui@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:22:28 +0800 Subject: [PATCH 04/37] fix: format and clean code in core module (#2440) --- .../org/apache/hugegraph/HugeFactory.java | 3 +- .../java/org/apache/hugegraph/HugeGraph.java | 6 +- .../org/apache/hugegraph/HugeGraphParams.java | 9 +- .../apache/hugegraph/StandardHugeGraph.java | 72 +++++---- .../hugegraph/analyzer/AnalyzerFactory.java | 6 +- .../hugegraph/analyzer/AnsjAnalyzer.java | 8 +- .../hugegraph/analyzer/HanLPAnalyzer.java | 23 +-- .../apache/hugegraph/analyzer/IKAnalyzer.java | 8 +- .../hugegraph/analyzer/JcsegAnalyzer.java | 8 +- .../hugegraph/analyzer/JiebaAnalyzer.java | 5 +- .../hugegraph/analyzer/MMSeg4JAnalyzer.java | 7 +- .../hugegraph/analyzer/SmartCNAnalyzer.java | 5 +- .../apache/hugegraph/auth/AuthManager.java | 2 +- .../apache/hugegraph/auth/EntityManager.java | 16 +- .../org/apache/hugegraph/auth/HugeAccess.java | 7 +- .../org/apache/hugegraph/auth/HugeBelong.java | 15 +- .../org/apache/hugegraph/auth/HugeGroup.java | 9 +- .../apache/hugegraph/auth/HugeProject.java | 7 +- .../apache/hugegraph/auth/HugeResource.java | 19 +-- .../org/apache/hugegraph/auth/HugeTarget.java | 9 +- .../org/apache/hugegraph/auth/HugeUser.java | 7 +- .../hugegraph/auth/RelationshipManager.java | 18 +-- .../apache/hugegraph/auth/ResourceObject.java | 2 +- .../apache/hugegraph/auth/ResourceType.java | 9 +- .../apache/hugegraph/auth/RolePermission.java | 26 ++-- .../apache/hugegraph/auth/SchemaDefine.java | 12 +- .../hugegraph/auth/StandardAuthManager.java | 16 +- .../apache/hugegraph/auth/TokenGenerator.java | 2 +- .../hugegraph/backend/BackendException.java | 2 +- .../backend/cache/AbstractCache.java | 5 +- .../hugegraph/backend/cache/CacheManager.java | 7 +- .../backend/cache/CacheNotifier.java | 8 +- .../backend/cache/CachedBackendStore.java | 2 +- .../backend/cache/CachedGraphTransaction.java | 9 +- .../cache/CachedSchemaTransaction.java | 9 +- .../hugegraph/backend/cache/OffheapCache.java | 23 ++- .../hugegraph/backend/cache/RamCache.java | 12 +- .../apache/hugegraph/backend/id/EdgeId.java | 40 ++--- .../apache/hugegraph/backend/id/IdUtil.java | 1 - .../backend/id/SnowflakeIdGenerator.java | 13 +- .../backend/id/SplicingIdGenerator.java | 18 ++- .../hugegraph/backend/page/IdHolder.java | 7 +- .../backend/page/PageEntryIterator.java | 3 +- .../hugegraph/backend/page/PageIds.java | 1 + .../hugegraph/backend/page/QueryList.java | 26 ++-- .../backend/page/SortByCountIdHolderList.java | 3 +- .../backend/query/BatchConditionQuery.java | 2 +- .../hugegraph/backend/query/Condition.java | 44 +++--- .../backend/query/ConditionQuery.java | 19 ++- .../backend/query/ConditionQueryFlatten.java | 2 +- .../hugegraph/backend/query/IdQuery.java | 3 +- .../apache/hugegraph/backend/query/Query.java | 8 +- .../hugegraph/backend/query/QueryResults.java | 13 +- .../serializer/AbstractSerializer.java | 8 +- .../serializer/BinaryScatterSerializer.java | 2 +- .../backend/serializer/BinarySerializer.java | 29 ++-- .../backend/serializer/BytesBuffer.java | 16 +- .../backend/serializer/GraphSerializer.java | 3 +- .../backend/serializer/MergeIterator.java | 4 +- .../backend/serializer/SerializerFactory.java | 2 +- .../backend/serializer/TableBackendEntry.java | 1 - .../backend/serializer/TableSerializer.java | 21 +-- .../backend/serializer/TextBackendEntry.java | 3 +- .../backend/serializer/TextSerializer.java | 27 ++-- .../backend/store/AbstractBackendStore.java | 8 +- .../store/AbstractBackendStoreProvider.java | 10 +- .../backend/store/BackendEntryIterator.java | 1 - .../backend/store/BackendMutation.java | 41 +++-- .../backend/store/BackendProviderFactory.java | 7 +- .../backend/store/BackendSessionPool.java | 5 +- .../hugegraph/backend/store/BackendStore.java | 9 +- .../backend/store/BackendStoreInfo.java | 3 +- .../backend/store/BackendStoreProvider.java | 3 +- .../hugegraph/backend/store/BackendTable.java | 4 +- .../hugegraph/backend/store/TableDefine.java | 1 + .../backend/store/memory/InMemoryDBStore.java | 12 +- .../store/memory/InMemoryDBStoreProvider.java | 2 +- .../backend/store/memory/InMemoryDBTable.java | 24 +-- .../store/memory/InMemoryDBTables.java | 51 +++--- .../backend/store/memory/InMemoryMetrics.java | 1 + .../backend/store/raft/RaftBackendStore.java | 18 +-- .../store/raft/RaftBackendStoreProvider.java | 7 +- .../backend/store/raft/RaftClosure.java | 4 +- .../backend/store/raft/RaftContext.java | 44 +++--- .../backend/store/raft/RaftException.java | 2 +- .../store/raft/RaftGroupManagerImpl.java | 20 ++- .../backend/store/raft/RaftNode.java | 26 ++-- .../backend/store/raft/RaftResult.java | 3 +- .../backend/store/raft/StoreSerializer.java | 2 +- .../backend/store/raft/StoreSnapshotFile.java | 2 +- .../backend/store/raft/StoreStateMachine.java | 22 +-- .../compress/CompressStrategyManager.java | 6 +- .../compress/ParallelCompressStrategy.java | 16 +- .../store/raft/rpc/AddPeerProcessor.java | 11 +- .../store/raft/rpc/ListPeersProcessor.java | 12 +- .../store/raft/rpc/RemovePeerProcessor.java | 11 +- .../backend/store/raft/rpc/RpcForwarder.java | 41 ++--- .../store/raft/rpc/SetLeaderProcessor.java | 4 +- .../store/raft/rpc/StoreCommandProcessor.java | 10 +- .../hugegraph/backend/store/ram/RamTable.java | 8 +- .../backend/tx/AbstractTransaction.java | 16 +- .../backend/tx/GraphIndexTransaction.java | 145 +++++++++--------- .../backend/tx/GraphTransaction.java | 93 ++++++----- .../backend/tx/IndexableTransaction.java | 4 +- .../backend/tx/SchemaIndexTransaction.java | 7 +- .../backend/tx/SchemaTransaction.java | 39 ++--- .../apache/hugegraph/config/CoreOptions.java | 40 ++--- .../hugegraph/io/HugeGraphIoRegistry.java | 2 +- .../hugegraph/io/HugeGraphSONModule.java | 65 ++++---- .../apache/hugegraph/io/HugeGryoModule.java | 2 +- .../org/apache/hugegraph/job/ComputerJob.java | 2 +- .../hugegraph/job/EphemeralJobBuilder.java | 2 +- .../org/apache/hugegraph/job/GremlinJob.java | 12 +- .../org/apache/hugegraph/job/JobBuilder.java | 2 +- .../job/algorithm/AbstractAlgorithm.java | 30 ++-- .../job/algorithm/AlgorithmPool.java | 6 +- .../hugegraph/job/algorithm/BfsTraverser.java | 7 +- .../hugegraph/job/algorithm/Consumers.java | 5 +- .../job/algorithm/CountEdgeAlgorithm.java | 3 +- .../job/algorithm/CountVertexAlgorithm.java | 3 +- .../job/algorithm/SubgraphStatAlgorithm.java | 14 +- .../algorithm/cent/AbstractCentAlgorithm.java | 53 ++++--- .../cent/BetweennessCentralityAlgorithm.java | 13 +- .../BetweennessCentralityAlgorithmV2.java | 5 +- .../cent/ClosenessCentralityAlgorithm.java | 9 +- .../cent/ClosenessCentralityAlgorithmV2.java | 8 +- .../cent/DegreeCentralityAlgorithm.java | 5 +- .../cent/EigenvectorCentralityAlgorithm.java | 5 +- .../cent/StressCentralityAlgorithm.java | 7 +- .../cent/StressCentralityAlgorithmV2.java | 3 +- .../comm/ClusterCoefficientAlgorithm.java | 2 +- .../job/algorithm/comm/KCoreAlgorithm.java | 15 +- .../job/algorithm/comm/LouvainAlgorithm.java | 4 +- .../job/algorithm/comm/LouvainTraverser.java | 38 ++--- .../job/algorithm/comm/LpaAlgorithm.java | 6 +- .../comm/WeakConnectedComponent.java | 21 +-- .../job/algorithm/rank/PageRankAlgorithm.java | 31 ++-- .../FusiformSimilarityAlgorithm.java | 15 +- .../job/computer/AbstractComputer.java | 20 +-- .../job/computer/LouvainComputer.java | 5 +- .../hugegraph/job/computer/LpaComputer.java | 3 +- .../job/computer/PageRankComputer.java | 3 +- .../job/computer/TriangleCountComputer.java | 2 +- .../WeakConnectedComponentComputer.java | 2 +- .../job/schema/EdgeLabelRemoveJob.java | 3 +- .../job/schema/IndexLabelRebuildJob.java | 16 +- .../job/schema/IndexLabelRemoveJob.java | 2 +- .../job/schema/OlapPropertyKeyClearJob.java | 2 +- .../hugegraph/job/schema/SchemaJob.java | 27 ++-- .../job/schema/VertexLabelRemoveJob.java | 11 +- .../job/system/DeleteExpiredElementJob.java | 2 +- .../job/system/DeleteExpiredIndexJob.java | 4 +- .../job/system/DeleteExpiredJob.java | 9 +- .../hugegraph/job/system/JobCounters.java | 4 +- .../hugegraph/masterelection/ClusterRole.java | 8 +- .../masterelection/RoleElectionOptions.java | 2 +- .../masterelection/StandardRoleListener.java | 2 +- .../plugin/HugeGraphGremlinPlugin.java | 6 +- .../hugegraph/plugin/HugeGraphPlugin.java | 2 +- .../apache/hugegraph/schema/EdgeLabel.java | 6 +- .../apache/hugegraph/schema/IndexLabel.java | 19 +-- .../apache/hugegraph/schema/PropertyKey.java | 27 ++-- .../hugegraph/schema/SchemaElement.java | 10 +- .../apache/hugegraph/schema/SchemaLabel.java | 15 +- .../hugegraph/schema/SchemaManager.java | 22 ++- .../org/apache/hugegraph/schema/Userdata.java | 6 +- .../apache/hugegraph/schema/VertexLabel.java | 2 +- .../schema/builder/AbstractBuilder.java | 6 +- .../schema/builder/EdgeLabelBuilder.java | 55 +++---- .../schema/builder/IndexLabelBuilder.java | 11 +- .../schema/builder/PropertyKeyBuilder.java | 48 +++--- .../schema/builder/VertexLabelBuilder.java | 47 +++--- .../security/HugeSecurityManager.java | 56 ++++--- .../apache/hugegraph/structure/GraphType.java | 1 + .../apache/hugegraph/structure/HugeEdge.java | 8 +- .../hugegraph/structure/HugeEdgeProperty.java | 3 +- .../hugegraph/structure/HugeElement.java | 14 +- .../hugegraph/structure/HugeFeatures.java | 18 +-- .../apache/hugegraph/structure/HugeIndex.java | 2 +- .../hugegraph/structure/HugeProperty.java | 3 +- .../hugegraph/structure/HugeVertex.java | 13 +- .../structure/HugeVertexProperty.java | 9 +- .../hugegraph/task/EphemeralJobQueue.java | 6 +- .../apache/hugegraph/task/HugeServerInfo.java | 22 ++- .../org/apache/hugegraph/task/HugeTask.java | 51 +++--- .../hugegraph/task/ServerInfoManager.java | 6 +- .../hugegraph/task/StandardTaskScheduler.java | 36 ++--- .../apache/hugegraph/task/TaskCallable.java | 6 +- .../apache/hugegraph/task/TaskManager.java | 16 +- .../apache/hugegraph/task/TaskScheduler.java | 8 +- .../org/apache/hugegraph/task/TaskStatus.java | 5 +- .../traversal/algorithm/CountTraverser.java | 5 +- .../traversal/algorithm/HugeTraverser.java | 1 + .../algorithm/NeighborRankTraverser.java | 11 +- .../traversal/algorithm/OltpTraverser.java | 6 +- .../algorithm/PersonalRankTraverser.java | 5 +- .../algorithm/PredictionTraverser.java | 1 + .../algorithm/ShortestPathTraverser.java | 9 +- .../algorithm/records/AbstractRecords.java | 4 +- .../records/DoubleWayMultiPathsRecords.java | 4 +- .../algorithm/records/KoutRecords.java | 2 +- .../algorithm/records/record/SyncRecord.java | 2 +- .../traversal/algorithm/steps/EdgeStep.java | 6 +- .../algorithm/steps/RepeatEdgeStep.java | 1 + .../algorithm/steps/WeightedEdgeStep.java | 1 + .../strategy/ConcurrentTraverseStrategy.java | 2 +- .../strategy/SingleTraverseStrategy.java | 10 +- .../algorithm/strategy/TraverseStrategy.java | 4 +- .../traversal/optimize/HugeCountStep.java | 8 +- .../optimize/HugeCountStepStrategy.java | 20 +-- .../traversal/optimize/HugeGraphStep.java | 5 +- .../optimize/HugeGraphStepStrategy.java | 8 +- .../optimize/HugePrimaryKeyStrategy.java | 4 +- .../optimize/HugeScriptTraversal.java | 4 +- .../traversal/optimize/HugeVertexStep.java | 24 +-- .../optimize/HugeVertexStepByBatch.java | 11 +- .../optimize/HugeVertexStepStrategy.java | 14 +- .../traversal/optimize/QueryHolder.java | 3 +- .../traversal/optimize/TraversalUtil.java | 30 ++-- .../org/apache/hugegraph/type/Nameable.java | 1 + .../hugegraph/type/define/CollectionType.java | 2 +- .../hugegraph/type/define/DataType.java | 12 +- .../hugegraph/type/define/Directions.java | 8 +- .../hugegraph/type/define/IndexType.java | 2 +- .../hugegraph/type/define/SerialEnum.java | 1 + .../apache/hugegraph/util/CompressUtil.java | 13 +- .../org/apache/hugegraph/util/ConfigUtil.java | 17 +- .../org/apache/hugegraph/util/Consumers.java | 2 +- .../util/FixedTimerWindowRateLimiter.java | 2 +- .../util/FixedWatchWindowRateLimiter.java | 4 +- .../org/apache/hugegraph/util/GZipUtil.java | 1 - .../org/apache/hugegraph/util/JsonUtil.java | 11 +- .../org/apache/hugegraph/util/KryoUtil.java | 2 +- .../org/apache/hugegraph/util/LockUtil.java | 20 +-- .../apache/hugegraph/util/ParameterUtil.java | 2 - .../apache/hugegraph/util/RateLimiter.java | 3 + .../org/apache/hugegraph/util/Reflection.java | 26 ++-- .../apache/hugegraph/util/StringEncoding.java | 1 - .../util/collection/CollectionFactory.java | 29 ++-- .../hugegraph/util/collection/IdSet.java | 9 +- .../util/collection/Int2IntsMap.java | 2 +- .../util/collection/IntIterator.java | 4 +- .../hugegraph/util/collection/IntMap.java | 21 ++- .../util/collection/IntMapByDynamicHash.java | 36 +++-- .../hugegraph/util/collection/IntSet.java | 11 +- .../collection/ObjectIntMappingFactory.java | 11 +- .../hugegraph/variables/HugeVariables.java | 15 +- 247 files changed, 1551 insertions(+), 1536 deletions(-) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java index 8c2c09faa5..a1d03cf0dc 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java @@ -145,7 +145,8 @@ public static void shutdown(long timeout) { /** * Stop all the daemon threads - * @param timeout wait in seconds + * + * @param timeout wait in seconds * @param ignoreException don't throw exception if true */ public static void shutdown(long timeout, boolean ignoreException) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java index 4566bf2cbe..ab460d495f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java @@ -249,7 +249,7 @@ public interface HugeGraph extends Graph { V option(TypedOption option); void registerRpcServices(RpcServiceConfig4Server serverConfig, - RpcServiceConfig4Client clientConfig); + RpcServiceConfig4Client clientConfig); default List mapPkId2Name(Collection ids) { List names = new ArrayList<>(ids.size()); @@ -316,8 +316,8 @@ default Id[] mapVlName2Id(String[] vertexLabels) { static void registerTraversalStrategies(Class clazz) { TraversalStrategies strategies = TraversalStrategies.GlobalCache - .getStrategies(Graph.class) - .clone(); + .getStrategies(Graph.class) + .clone(); strategies.addStrategies(HugeVertexStepStrategy.instance(), HugeGraphStepStrategy.instance(), HugeCountStepStrategy.instance(), diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java index d29448391c..5556fdfa6a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java @@ -17,21 +17,22 @@ package org.apache.hugegraph; +import org.apache.hugegraph.analyzer.Analyzer; import org.apache.hugegraph.backend.LocalCounter; +import org.apache.hugegraph.backend.serializer.AbstractSerializer; import org.apache.hugegraph.backend.store.BackendFeatures; import org.apache.hugegraph.backend.store.BackendStore; import org.apache.hugegraph.backend.store.ram.RamTable; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.event.EventHub; import org.apache.hugegraph.job.EphemeralJob; import org.apache.hugegraph.task.ServerInfoManager; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.analyzer.Analyzer; -import org.apache.hugegraph.backend.serializer.AbstractSerializer; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.event.EventHub; + import com.google.common.util.concurrent.RateLimiter; /** diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java index 142ca98928..4e9263a488 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java @@ -123,26 +123,26 @@ public class StandardHugeGraph implements HugeGraph { public static final Class[] PROTECT_CLASSES = { - StandardHugeGraph.class, - StandardHugeGraph.StandardHugeGraphParams.class, - TinkerPopTransaction.class, - StandardHugeGraph.Txs.class, - StandardHugeGraph.SysTransaction.class + StandardHugeGraph.class, + StandardHugeGraph.StandardHugeGraphParams.class, + TinkerPopTransaction.class, + StandardHugeGraph.Txs.class, + StandardHugeGraph.SysTransaction.class }; public static final Set> ALLOWED_CONFIGS = ImmutableSet.of( - CoreOptions.TASK_WAIT_TIMEOUT, - CoreOptions.TASK_SYNC_DELETION, - CoreOptions.TASK_TTL_DELETE_BATCH, - CoreOptions.TASK_INPUT_SIZE_LIMIT, - CoreOptions.TASK_RESULT_SIZE_LIMIT, - CoreOptions.OLTP_CONCURRENT_THREADS, - CoreOptions.OLTP_CONCURRENT_DEPTH, - CoreOptions.OLTP_COLLECTION_TYPE, - CoreOptions.VERTEX_DEFAULT_LABEL, - CoreOptions.VERTEX_ENCODE_PK_NUMBER, - CoreOptions.STORE_GRAPH, - CoreOptions.STORE + CoreOptions.TASK_WAIT_TIMEOUT, + CoreOptions.TASK_SYNC_DELETION, + CoreOptions.TASK_TTL_DELETE_BATCH, + CoreOptions.TASK_INPUT_SIZE_LIMIT, + CoreOptions.TASK_RESULT_SIZE_LIMIT, + CoreOptions.OLTP_CONCURRENT_THREADS, + CoreOptions.OLTP_CONCURRENT_DEPTH, + CoreOptions.OLTP_COLLECTION_TYPE, + CoreOptions.VERTEX_DEFAULT_LABEL, + CoreOptions.VERTEX_ENCODE_PK_NUMBER, + CoreOptions.STORE_GRAPH, + CoreOptions.STORE ); private static final Logger LOG = Log.logger(StandardHugeGraph.class); @@ -306,14 +306,17 @@ public void serverStarted(GlobalMasterInfo nodeInfo) { private void initRoleStateMachine(Id serverId) { HugeConfig conf = this.configuration; Config roleConfig = new RoleElectionConfig(serverId.toString(), - conf.get(RoleElectionOptions.NODE_EXTERNAL_URL), - conf.get(RoleElectionOptions.EXCEEDS_FAIL_COUNT), - conf.get(RoleElectionOptions.RANDOM_TIMEOUT_MILLISECOND), - conf.get(RoleElectionOptions.HEARTBEAT_INTERVAL_SECOND), - conf.get(RoleElectionOptions.MASTER_DEAD_TIMES), - conf.get(RoleElectionOptions.BASE_TIMEOUT_MILLISECOND)); + conf.get(RoleElectionOptions.NODE_EXTERNAL_URL), + conf.get(RoleElectionOptions.EXCEEDS_FAIL_COUNT), + conf.get( + RoleElectionOptions.RANDOM_TIMEOUT_MILLISECOND), + conf.get( + RoleElectionOptions.HEARTBEAT_INTERVAL_SECOND), + conf.get(RoleElectionOptions.MASTER_DEAD_TIMES), + conf.get( + RoleElectionOptions.BASE_TIMEOUT_MILLISECOND)); ClusterRoleStore roleStore = new StandardClusterRoleStore(this.params); - this.roleElectionStateMachine = new StandardRoleElectionStateMachine(roleConfig, + this.roleElectionStateMachine = new StandardRoleElectionStateMachine(roleConfig, roleStore); } @@ -596,7 +599,7 @@ protected void reloadRamtable(boolean loadFromFile) { @Override public C compute(Class clazz) - throws IllegalArgumentException { + throws IllegalArgumentException { throw Graph.Exceptions.graphComputerNotSupported(); } @@ -605,11 +608,12 @@ public GraphComputer compute() throws IllegalArgumentException { throw Graph.Exceptions.graphComputerNotSupported(); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) @Override public I io(final Io.Builder builder) { return (I) builder.graph(this).onMapper(mapper -> - mapper.addRegistry(HugeGraphIoRegistry.instance()) + mapper.addRegistry( + HugeGraphIoRegistry.instance()) ).create(); } @@ -1159,12 +1163,12 @@ public void registerRpcServices(RpcServiceConfig4Server serverConfig, // The proxy is sometimes unavailable (issue #664) CacheNotifier proxy = clientConfig.serviceProxy(this.name, clazz1); serverConfig.addService(this.name, clazz1, new HugeGraphCacheNotifier( - this.graphEventHub, proxy)); + this.graphEventHub, proxy)); Class clazz2 = SchemaCacheNotifier.class; proxy = clientConfig.serviceProxy(this.name, clazz2); serverConfig.addService(this.name, clazz2, new HugeSchemaCacheNotifier( - this.schemaEventHub, proxy)); + this.schemaEventHub, proxy)); } private void closeTx() { @@ -1522,7 +1526,7 @@ private Txs getOrNewTransaction() { private void destroyTransaction() { if (this.isOpen()) { throw new HugeException( - "Transaction should be closed before destroying"); + "Transaction should be closed before destroying"); } // Do close if needed, then remove the reference @@ -1663,8 +1667,8 @@ public void reload() { } private static class HugeSchemaCacheNotifier - extends AbstractCacheNotifier - implements SchemaCacheNotifier { + extends AbstractCacheNotifier + implements SchemaCacheNotifier { public HugeSchemaCacheNotifier(EventHub hub, CacheNotifier proxy) { super(hub, proxy); @@ -1672,8 +1676,8 @@ public HugeSchemaCacheNotifier(EventHub hub, CacheNotifier proxy) { } private static class HugeGraphCacheNotifier - extends AbstractCacheNotifier - implements GraphCacheNotifier { + extends AbstractCacheNotifier + implements GraphCacheNotifier { public HugeGraphCacheNotifier(EventHub hub, CacheNotifier proxy) { super(hub, proxy); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java index 463b962278..21dd157b11 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java @@ -64,12 +64,12 @@ private static Analyzer customizedAnalyzer(String name, String mode) { return clazz.getConstructor(String.class).newInstance(mode); } catch (Exception e) { throw new HugeException( - "Failed to construct analyzer '%s' with mode '%s'", - e, name, mode); + "Failed to construct analyzer '%s' with mode '%s'", + e, name, mode); } } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void register(String name, String classPath) { ClassLoader classLoader = SerializerFactory.class.getClassLoader(); Class clazz; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java index f32303518f..2f857cd171 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java @@ -26,9 +26,9 @@ import org.ansj.splitWord.analysis.IndexAnalysis; import org.ansj.splitWord.analysis.NlpAnalysis; import org.ansj.splitWord.analysis.ToAnalysis; - import org.apache.hugegraph.config.ConfigException; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableList; /** @@ -48,8 +48,8 @@ public class AnsjAnalyzer implements Analyzer { public AnsjAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for ansj analyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for ansj analyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } this.analysis = mode; } @@ -72,7 +72,7 @@ public Set segment(String text) { break; default: throw new AssertionError(String.format( - "Unsupported segment mode '%s'", this.analysis)); + "Unsupported segment mode '%s'", this.analysis)); } assert terms != null; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java index baf6c6884a..8b5fa6aa0a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java @@ -22,6 +22,7 @@ import org.apache.hugegraph.config.ConfigException; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableList; import com.hankcs.hanlp.seg.Dijkstra.DijkstraSegment; import com.hankcs.hanlp.seg.NShort.NShortSegment; @@ -38,14 +39,14 @@ public class HanLPAnalyzer implements Analyzer { public static final List SUPPORT_MODES = - ImmutableList.builder() - .add("standard") - .add("nlp") - .add("index") - .add("nShort") - .add("shortest") - .add("speed") - .build(); + ImmutableList.builder() + .add("standard") + .add("nlp") + .add("index") + .add("nShort") + .add("shortest") + .add("speed") + .build(); private static final Segment N_SHORT_SEGMENT = new NShortSegment().enableCustomDictionary(false) @@ -61,8 +62,8 @@ public class HanLPAnalyzer implements Analyzer { public HanLPAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for hanlp analyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for hanlp analyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } this.tokenizer = mode; } @@ -91,7 +92,7 @@ public Set segment(String text) { break; default: throw new AssertionError(String.format( - "Unsupported segment mode '%s'", this.tokenizer)); + "Unsupported segment mode '%s'", this.tokenizer)); } assert terms != null; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java index 2c25c2f41b..ab564f396f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java @@ -22,11 +22,11 @@ import java.util.Set; import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.config.ConfigException; +import org.apache.hugegraph.util.InsertionOrderUtil; import org.wltea.analyzer.core.IKSegmenter; import org.wltea.analyzer.core.Lexeme; -import org.apache.hugegraph.config.ConfigException; -import org.apache.hugegraph.util.InsertionOrderUtil; import com.google.common.collect.ImmutableList; /** @@ -44,8 +44,8 @@ public class IKAnalyzer implements Analyzer { public IKAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for ikanalyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for ikanalyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } this.smartSegMode = SUPPORT_MODES.get(0).equals(mode); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java index ad00ea4769..3740e87b19 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java @@ -22,14 +22,14 @@ import java.util.Set; import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.config.ConfigException; +import org.apache.hugegraph.util.InsertionOrderUtil; import org.lionsoul.jcseg.ISegment; import org.lionsoul.jcseg.IWord; import org.lionsoul.jcseg.dic.ADictionary; import org.lionsoul.jcseg.dic.DictionaryFactory; import org.lionsoul.jcseg.segmenter.SegmenterConfig; -import org.apache.hugegraph.config.ConfigException; -import org.apache.hugegraph.util.InsertionOrderUtil; import com.google.common.collect.ImmutableList; /** @@ -50,8 +50,8 @@ public class JcsegAnalyzer implements Analyzer { public JcsegAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for jcseg analyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for jcseg analyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } if ("Simple".equals(mode)) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java index b79973c9b4..7c280a50a1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java @@ -22,6 +22,7 @@ import org.apache.hugegraph.config.ConfigException; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableList; import com.huaban.analysis.jieba.JiebaSegmenter; import com.huaban.analysis.jieba.SegToken; @@ -43,8 +44,8 @@ public class JiebaAnalyzer implements Analyzer { public JiebaAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for jieba analyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for jieba analyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } this.segMode = JiebaSegmenter.SegMode.valueOf(mode); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java index 62264014b7..26e937a538 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.HugeException; import org.apache.hugegraph.config.ConfigException; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.chenlb.mmseg4j.ComplexSeg; import com.chenlb.mmseg4j.Dictionary; import com.chenlb.mmseg4j.MMSeg; @@ -51,8 +52,8 @@ public class MMSeg4JAnalyzer implements Analyzer { public MMSeg4JAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigException( - "Unsupported segment mode '%s' for mmseg4j analyzer, " + - "the available values are %s", mode, SUPPORT_MODES); + "Unsupported segment mode '%s' for mmseg4j analyzer, " + + "the available values are %s", mode, SUPPORT_MODES); } int index = SUPPORT_MODES.indexOf(mode); switch (index) { @@ -67,7 +68,7 @@ public MMSeg4JAnalyzer(String mode) { break; default: throw new AssertionError(String.format( - "Unsupported segment mode '%s'", mode)); + "Unsupported segment mode '%s'", mode)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java index 0776c8a794..f265ade214 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java @@ -22,19 +22,18 @@ import java.util.Set; import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; -import org.apache.hugegraph.util.InsertionOrderUtil; - /** * Reference from https://lucene.apache.org/core/8_11_2/analyzers-smartcn/index.html */ public class SmartCNAnalyzer implements Analyzer { private static final SmartChineseAnalyzer ANALYZER = - new SmartChineseAnalyzer(); + new SmartChineseAnalyzer(); public SmartCNAnalyzer(String mode) { // pass diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java index 3236c2fe73..51c72fba47 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java @@ -22,8 +22,8 @@ import javax.security.sasl.AuthenticationException; -import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.auth.SchemaDefine.AuthElement; +import org.apache.hugegraph.backend.id.Id; public interface AuthManager { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java index e6beffda4e..4633625729 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java @@ -22,26 +22,26 @@ import java.util.Map; import java.util.function.Function; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Entity; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Condition; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.tx.GraphTransaction; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.iterator.MapperIterator; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Entity; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.iterator.MapperIterator; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.util.E; import com.google.common.collect.ImmutableMap; public class EntityManager { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java index 015b875ce5..85ac82bc15 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java @@ -22,17 +22,16 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Relationship; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.type.define.DataType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Relationship; -import org.apache.hugegraph.util.E; - public class HugeAccess extends Relationship { private static final long serialVersionUID = -7644007602408729385L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java index de197f9e38..ce23f88013 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java @@ -22,15 +22,14 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Relationship; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Relationship; - public class HugeBelong extends Relationship { public static final String UG = "ug"; @@ -103,12 +102,10 @@ protected boolean property(String key, Object value) { if (super.property(key, value)) { return true; } - switch (key) { - case P.DESCRIPTION: - this.description = (String) value; - break; - default: - throw new AssertionError("Unsupported key: " + key); + if (key.equals(P.DESCRIPTION)) { + this.description = (String) value; + } else { + throw new AssertionError("Unsupported key: " + key); } return true; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java index 6b9fd3d894..ee2470076e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java @@ -22,16 +22,15 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Entity; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Entity; -import org.apache.hugegraph.util.E; - public class HugeGroup extends Entity { private static final long serialVersionUID = 2330399818352242686L; @@ -195,7 +194,7 @@ public void initSchemaIfNeeded() { this.graph.schemaTransaction().addVertexLabel(label); } - protected String[] initProperties() { + private String[] initProperties() { List props = new ArrayList<>(); props.add(createPropertyKey(P.NAME)); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java index 7283a31332..f630ba6bc0 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java @@ -25,19 +25,18 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Entity; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Entity; -import org.apache.hugegraph.util.E; - public class HugeProject extends Entity { private static final long serialVersionUID = 8681323499069874520L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java index 3911a58455..9edaac5c65 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java @@ -23,6 +23,10 @@ import java.util.Objects; import java.util.Set; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.auth.SchemaDefine.AuthElement; +import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.traversal.optimize.TraversalUtil; import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.type.Typeable; import org.apache.hugegraph.util.JsonUtil; @@ -39,10 +43,6 @@ import org.apache.tinkerpop.shaded.jackson.databind.module.SimpleModule; import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.auth.SchemaDefine.AuthElement; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.traversal.optimize.TraversalUtil; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -55,7 +55,7 @@ public class HugeResource { public static final List ALL_RES = ImmutableList.of(ALL); private static final Set CHECK_NAME_RESS = ImmutableSet.of( - ResourceType.META); + ResourceType.META); static { SimpleModule module = new SimpleModule(); @@ -143,7 +143,7 @@ private boolean filter(AuthElement element) { private boolean filter(Nameable element) { assert !(element instanceof Typeable) || this.type.match( - ResourceType.from(((Typeable) element).type())); + ResourceType.from(((Typeable) element).type())); return this.matchLabel(element.name()); } @@ -258,7 +258,8 @@ public static HugeResource parseResource(String resource) { } public static List parseResources(String resources) { - TypeReference type = new TypeReference>() {}; + TypeReference type = new TypeReference>() { + }; return JsonUtil.fromJson(resources, type); } @@ -298,7 +299,7 @@ public HugeResourceSer() { @Override public void serialize(HugeResource res, JsonGenerator generator, SerializerProvider provider) - throws IOException { + throws IOException { generator.writeStartObject(); generator.writeObjectField("type", res.type); @@ -320,7 +321,7 @@ public HugeResourceDeser() { @Override public HugeResource deserialize(JsonParser parser, DeserializationContext ctxt) - throws IOException { + throws IOException { HugeResource res = new HugeResource(); while (parser.nextToken() != JsonToken.END_OBJECT) { String key = parser.getCurrentName(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java index 5687fdab8c..56f59c27bf 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java @@ -22,18 +22,17 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Entity; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Entity; -import org.apache.hugegraph.util.E; - import com.google.common.collect.ImmutableList; public class HugeTarget extends Entity { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java index 9df3d0cb34..1fc087a707 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java @@ -22,16 +22,15 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Entity; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Entity; -import org.apache.hugegraph.util.E; - public class HugeUser extends Entity { private static final long serialVersionUID = -8951193710873772717L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java index 2fe2260279..a1c440611e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java @@ -22,29 +22,29 @@ import java.util.Map; import java.util.function.Function; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.SchemaDefine.Relationship; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Condition; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.tx.GraphTransaction; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.iterator.MapperIterator; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.structure.HugeEdge; +import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.SchemaDefine.Relationship; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.iterator.MapperIterator; -import org.apache.hugegraph.structure.HugeEdge; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.util.E; import com.google.common.collect.ImmutableMap; public class RelationshipManager { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java index 40e5c0ec9b..03234f5972 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java @@ -19,8 +19,8 @@ import org.apache.hugegraph.auth.SchemaDefine.AuthElement; import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.util.E; public class ResourceObject { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java index c5ab9b96dd..caeafc8d04 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java @@ -17,6 +17,8 @@ package org.apache.hugegraph.auth; +import java.util.Objects; + import org.apache.hugegraph.type.HugeType; public enum ResourceType { @@ -70,11 +72,8 @@ public boolean match(ResourceType required) { return true; } - switch (required) { - case NONE: - return this != NONE; - default: - break; + if (Objects.requireNonNull(required) == ResourceType.NONE) { + return this != NONE; } switch (this) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java index 033ffa22b5..b7d776d6ff 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java @@ -25,6 +25,7 @@ import java.util.Objects; import java.util.TreeMap; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty; import org.apache.tinkerpop.shaded.jackson.core.JsonGenerator; @@ -37,14 +38,12 @@ import org.apache.tinkerpop.shaded.jackson.databind.module.SimpleModule; import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer; -import org.apache.hugegraph.util.E; - public class RolePermission { public static final RolePermission NONE = RolePermission.role( - "none", HugePermission.NONE); + "none", HugePermission.NONE); public static final RolePermission ADMIN = RolePermission.role( - "admin", HugePermission.ANY); + "admin", HugePermission.ANY); static { SimpleModule module = new SimpleModule(); @@ -64,7 +63,7 @@ public RolePermission() { } private RolePermission(Map>> roles) { + List>> roles) { this.roles = roles; } @@ -76,7 +75,7 @@ protected void add(String graph, String action, protected void add(String graph, HugePermission action, List resources) { Map> permissions = - this.roles.get(graph); + this.roles.get(graph); if (permissions == null) { permissions = new TreeMap<>(); this.roles.put(graph, permissions); @@ -95,14 +94,14 @@ public Map>> map() { public boolean contains(RolePermission other) { for (Map.Entry>> e1 : - other.roles.entrySet()) { + other.roles.entrySet()) { String g = e1.getKey(); Map> perms = this.roles.get(g); if (perms == null) { return false; } for (Map.Entry> e2 : - e1.getValue().entrySet()) { + e1.getValue().entrySet()) { List ress = perms.get(e2.getKey()); if (ress == null) { return false; @@ -189,7 +188,7 @@ public static RolePermission builtin(RolePermission role) { } private static class RolePermissionSer - extends StdSerializer { + extends StdSerializer { private static final long serialVersionUID = -2533310506459479383L; @@ -200,7 +199,7 @@ public RolePermissionSer() { @Override public void serialize(RolePermission role, JsonGenerator generator, SerializerProvider provider) - throws IOException { + throws IOException { generator.writeStartObject(); generator.writeObjectField("roles", role.roles); generator.writeEndObject(); @@ -208,7 +207,7 @@ public void serialize(RolePermission role, JsonGenerator generator, } private static class RolePermissionDeser - extends StdDeserializer { + extends StdDeserializer { private static final long serialVersionUID = -2038234657843260957L; @@ -219,9 +218,10 @@ public RolePermissionDeser() { @Override public RolePermission deserialize(JsonParser parser, DeserializationContext ctxt) - throws IOException { + throws IOException { TypeReference type = new TypeReference>>>() {}; + TreeMap>>>() { + }; if ("roles".equals(parser.nextFieldName())) { parser.nextValue(); return new RolePermission(parser.readValueAs(type)); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java index 5ad5c824fd..faec762a03 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.auth.HugeTarget.P; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; @@ -31,18 +32,15 @@ import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.util.E; - public abstract class SchemaDefine { protected final HugeGraphParams graph; @@ -242,7 +240,7 @@ protected Object[] asArray(List list) { // NOTE: travis-ci fails if class Entity implements Nameable public abstract static class Entity extends AuthElement - implements org.apache.hugegraph.type.Nameable { + implements org.apache.hugegraph.type.Nameable { private static final long serialVersionUID = 4113319546914811762L; @@ -260,7 +258,7 @@ public static T fromVertex(Vertex vertex, T entity) { vertex.label(), entity.label()); entity.id((Id) vertex.id()); for (Iterator> iter = vertex.properties(); - iter.hasNext();) { + iter.hasNext(); ) { VertexProperty prop = iter.next(); entity.property(prop.key(), prop.value()); } @@ -310,7 +308,7 @@ public static T fromEdge(Edge edge, edge.label(), relationship.label()); relationship.id((Id) edge.id()); for (Iterator> iter = edge.properties(); - iter.hasNext();) { + iter.hasNext(); ) { Property prop = iter.next(); relationship.property(prop.key(), prop.value()); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java index d79840380e..60aaf9aab2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java @@ -411,13 +411,13 @@ public Id createProject(HugeProject project) { Id adminGroupId = project.adminGroupId(); Id opGroupId = project.opGroupId(); HugeAccess adminGroupWriteAccess = new HugeAccess( - adminGroupId, targetId, - HugePermission.WRITE); + adminGroupId, targetId, + HugePermission.WRITE); // Ditto adminGroupWriteAccess.creator(project.creator()); HugeAccess adminGroupReadAccess = new HugeAccess( - adminGroupId, targetId, - HugePermission.READ); + adminGroupId, targetId, + HugePermission.READ); // Ditto adminGroupReadAccess.creator(project.creator()); HugeAccess opGroupReadAccess = new HugeAccess(opGroupId, targetId, @@ -634,7 +634,7 @@ private RolePermission rolePermission(HugeTarget target) { @Override public String loginUser(String username, String password) - throws AuthenticationException { + throws AuthenticationException { HugeUser user = this.matchUser(username, password); if (user == null) { String msg = "Incorrect username or password"; @@ -672,10 +672,10 @@ public UserWithRole validateUser(String token) { Claims payload = null; boolean needBuildCache = false; if (username == null) { - try{ + try { payload = this.tokenGenerator.verify(token); - }catch (Throwable t){ - LOG.error(String.format("Failed to verify token:[ %s ], cause:",token),t); + } catch (Throwable t) { + LOG.error(String.format("Failed to verify token:[ %s ], cause:", token), t); return new UserWithRole(""); } username = (String) payload.get(AuthConstant.TOKEN_USER_NAME); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java index e8ee77e8f1..0814e84b1a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java @@ -22,7 +22,6 @@ import java.util.Map; import javax.crypto.SecretKey; -import jakarta.ws.rs.NotAuthorizedException; import org.apache.hugegraph.config.AuthOptions; import org.apache.hugegraph.config.HugeConfig; @@ -34,6 +33,7 @@ import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.security.Keys; +import jakarta.ws.rs.NotAuthorizedException; public class TokenGenerator { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java index 95f271b798..a1f587866e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java @@ -44,7 +44,7 @@ public BackendException(Throwable cause) { } public static final void check(boolean expression, String message, Object... args) - throws BackendException { + throws BackendException { if (!expression) { throw new BackendException(message, args); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java index dff48f509c..e26a779f4c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java @@ -22,10 +22,9 @@ import java.util.concurrent.atomic.LongAdder; import java.util.function.Function; -import org.slf4j.Logger; - import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public abstract class AbstractCache implements Cache { @@ -183,7 +182,7 @@ public long tick() { int expireItems = 0; long current = now(); - for (Iterator> it = this.nodes(); it.hasNext();) { + for (Iterator> it = this.nodes(); it.hasNext(); ) { CacheNode node = it.next(); if (current - node.time() >= expireTime) { // Remove item while iterating map (it must be ConcurrentMap) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java index 8e7742ef87..c7a43e228e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java @@ -24,12 +24,11 @@ import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class CacheManager { @@ -69,7 +68,7 @@ private TimerTask scheduleTimer(float period) { public void run() { try { for (Entry> entry : - caches().entrySet()) { + caches().entrySet()) { this.tick(entry.getKey(), entry.getValue()); } } catch (Throwable e) { @@ -97,7 +96,7 @@ private void tick(String name, Cache cache) { } public Map> caches() { - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Map> caches = (Map) this.caches; return Collections.unmodifiableMap(caches); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java index a6ecebb118..e470f1067a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java @@ -30,7 +30,11 @@ public interface CacheNotifier extends AutoCloseable { void reload(); - interface GraphCacheNotifier extends CacheNotifier {} + interface GraphCacheNotifier extends CacheNotifier { - interface SchemaCacheNotifier extends CacheNotifier {} + } + + interface SchemaCacheNotifier extends CacheNotifier { + + } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java index a6a2bdc71d..a1c632d9f5 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java @@ -19,8 +19,8 @@ import java.util.Iterator; -import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.backend.store.BackendFeatures; import org.apache.hugegraph.backend.store.BackendMutation; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java index bb14444d95..89f047baed 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java @@ -25,15 +25,15 @@ import java.util.List; import java.util.Set; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.cache.CachedBackendStore.QueryId; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.store.BackendMutation; import org.apache.hugegraph.backend.store.BackendStore; import org.apache.hugegraph.backend.store.ram.RamTable; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; @@ -49,6 +49,7 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Events; + import com.google.common.collect.ImmutableSet; public final class CachedGraphTransaction extends GraphTransaction { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java index 69c09aabf1..4f9e5f5937 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java @@ -23,12 +23,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.ram.IntObjectMap; -import org.apache.hugegraph.backend.tx.SchemaTransaction; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.backend.store.BackendStore; +import org.apache.hugegraph.backend.store.ram.IntObjectMap; +import org.apache.hugegraph.backend.tx.SchemaTransaction; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.event.EventHub; import org.apache.hugegraph.event.EventListener; @@ -37,6 +37,7 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Events; + import com.google.common.collect.ImmutableSet; public final class CachedSchemaTransaction extends SchemaTransaction { @@ -437,7 +438,7 @@ private void setValue(HugeType type, int key, V value) { } private static class CachedTypes - extends ConcurrentHashMap { + extends ConcurrentHashMap { private static final long serialVersionUID = -2215549791679355996L; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java index a97898f2ba..d641c8276f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java @@ -24,14 +24,6 @@ import java.util.List; import java.util.function.Consumer; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; -import org.caffinitas.ohc.CacheSerializer; -import org.caffinitas.ohc.CloseableIterator; -import org.caffinitas.ohc.Eviction; -import org.caffinitas.ohc.OHCache; -import org.caffinitas.ohc.OHCacheBuilder; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; @@ -39,6 +31,8 @@ import org.apache.hugegraph.backend.serializer.BinaryBackendEntry; import org.apache.hugegraph.backend.serializer.BinarySerializer; import org.apache.hugegraph.backend.serializer.BytesBuffer; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.HugeType; @@ -46,6 +40,11 @@ import org.apache.hugegraph.util.Bytes; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; +import org.caffinitas.ohc.CacheSerializer; +import org.caffinitas.ohc.CloseableIterator; +import org.caffinitas.ohc.Eviction; +import org.caffinitas.ohc.OHCache; +import org.caffinitas.ohc.OHCacheBuilder; public class OffheapCache extends AbstractCache { @@ -119,7 +118,7 @@ protected boolean write(Id id, Object value, long timeOffset) { } if (serializedSize > VALUE_SIZE_TO_SKIP) { LOG.info("Skip to cache '{}' due to value size {} > limit {}", - id, serializedSize, VALUE_SIZE_TO_SKIP); + id, serializedSize, VALUE_SIZE_TO_SKIP); return false; } @@ -334,13 +333,13 @@ private Object deserializeElement(ValueType type, BytesBuffer buffer) { private HugeException unsupported(ValueType type) { throw new HugeException( - "Unsupported deserialize type: %s", type); + "Unsupported deserialize type: %s", type); } private HugeException unsupported(Object value) { throw new HugeException( - "Unsupported type of serialize value: '%s'(%s)", - value, value.getClass()); + "Unsupported type of serialize value: '%s'(%s)", + value, value.getClass()); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java index 05366f9af0..a5e8d162a8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java @@ -156,7 +156,7 @@ protected final void remove(Id id) { @Override protected Iterator> nodes() { Iterator> iter = this.map.values().iterator(); - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) Iterator> iterSuper = (Iterator) iter; return iterSuper; } @@ -280,8 +280,8 @@ public LinkedQueueNonBigLock() { /** * Reset the head node and rear node * NOTE: - * only called by LinkedQueueNonBigLock() without lock - * or called by clear() with lock(head, rear) + * only called by LinkedQueueNonBigLock() without lock + * or called by clear() with lock(head, rear) */ private void reset() { this.head.prev = this.empty; @@ -316,7 +316,7 @@ private boolean checkNotInQueue(K key) { List keys = this.dumpKeys(); if (keys.contains(key)) { throw new RuntimeException(String.format( - "Expect %s should be not in %s", key, keys)); + "Expect %s should be not in %s", key, keys)); } return true; } @@ -338,8 +338,8 @@ private boolean checkPrevNotInNext(LinkNode self) { int selfPos = keys.indexOf(self.key()); if (prevPos > selfPos && selfPos != -1) { throw new RuntimeException(String.format( - "Expect %s should be before %s, actual %s", - prev.key(), self.key(), keys)); + "Expect %s should be before %s, actual %s", + prev.key(), self.key(), keys)); } return true; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java index 711ee0d87e..a9053e5135 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java @@ -35,12 +35,12 @@ */ public class EdgeId implements Id { - public static final HugeKeys[] KEYS = new HugeKeys[] { - HugeKeys.OWNER_VERTEX, - HugeKeys.DIRECTION, - HugeKeys.LABEL, - HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX + public static final HugeKeys[] KEYS = new HugeKeys[]{ + HugeKeys.OWNER_VERTEX, + HugeKeys.DIRECTION, + HugeKeys.LABEL, + HugeKeys.SORT_VALUES, + HugeKeys.OTHER_VERTEX }; private final Id ownerVertexId; @@ -135,17 +135,17 @@ public String asString() { } if (this.directed) { this.cache = SplicingIdGenerator.concat( - IdUtil.writeString(this.ownerVertexId), - this.direction.type().string(), - IdUtil.writeLong(this.edgeLabelId), - this.sortValues, - IdUtil.writeString(this.otherVertexId)); + IdUtil.writeString(this.ownerVertexId), + this.direction.type().string(), + IdUtil.writeLong(this.edgeLabelId), + this.sortValues, + IdUtil.writeString(this.otherVertexId)); } else { this.cache = SplicingIdGenerator.concat( - IdUtil.writeString(this.sourceVertexId()), - IdUtil.writeLong(this.edgeLabelId), - this.sortValues, - IdUtil.writeString(this.targetVertexId())); + IdUtil.writeString(this.sourceVertexId()), + IdUtil.writeLong(this.edgeLabelId), + this.sortValues, + IdUtil.writeString(this.targetVertexId())); } return this.cache; } @@ -233,7 +233,7 @@ public static EdgeId parse(String id) throws NotFoundException { } public static EdgeId parse(String id, boolean returnNullIfError) - throws NotFoundException { + throws NotFoundException { String[] idParts = SplicingIdGenerator.split(id); if (!(idParts.length == 4 || idParts.length == 5)) { if (returnNullIfError) { @@ -284,10 +284,10 @@ public static Id parseStoredString(String id) { public static String asStoredString(Id id) { EdgeId eid = (EdgeId) id; return SplicingIdGenerator.concat( - IdUtil.writeStoredString(eid.sourceVertexId()), - IdGenerator.asStoredString(eid.edgeLabelId()), - eid.sortValues(), - IdUtil.writeStoredString(eid.targetVertexId())); + IdUtil.writeStoredString(eid.sourceVertexId()), + IdGenerator.asStoredString(eid.edgeLabelId()), + eid.sortValues(), + IdUtil.writeStoredString(eid.targetVertexId())); } public static String concat(String... ids) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java index 11d9378f01..90cd98d4b7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java @@ -20,7 +20,6 @@ import java.nio.ByteBuffer; import org.apache.commons.lang3.StringUtils; - import org.apache.hugegraph.backend.id.Id.IdType; import org.apache.hugegraph.backend.serializer.BytesBuffer; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java index 0ac86353fc..21059e5290 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java @@ -16,8 +16,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; @@ -27,13 +25,14 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.TimeUtil; +import org.slf4j.Logger; public class SnowflakeIdGenerator extends IdGenerator { private static final Logger LOG = Log.logger(SnowflakeIdGenerator.class); private static final Map INSTANCES = - new ConcurrentHashMap<>(); + new ConcurrentHashMap<>(); private final boolean forceString; private final IdWorker idWorker; @@ -114,13 +113,13 @@ public IdWorker(long workerId, long datacenterId) { // Sanity check for workerId if (workerId > MAX_WORKER_ID || workerId < 0) { throw new IllegalArgumentException(String.format( - "Worker id can't > %d or < 0", - MAX_WORKER_ID)); + "Worker id can't > %d or < 0", + MAX_WORKER_ID)); } if (datacenterId > MAX_DC_ID || datacenterId < 0) { throw new IllegalArgumentException(String.format( - "Datacenter id can't > %d or < 0", - MAX_DC_ID)); + "Datacenter id can't > %d or < 0", + MAX_DC_ID)); } this.workerId = workerId; this.datacenterId = datacenterId; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java index 7e6e29262d..47f098fa73 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java @@ -70,8 +70,9 @@ public Id generate(HugeVertex vertex) { /** * Concat multiple ids into one composite id with IDS_SPLITOR + * * @param ids the string id values to be concatted - * @return concatted string value + * @return concatted string value */ public static String concat(String... ids) { // NOTE: must support string id when using this method @@ -80,8 +81,9 @@ public static String concat(String... ids) { /** * Split a composite id into multiple ids with IDS_SPLITOR + * * @param ids the string id value to be splitted - * @return splitted string values + * @return splitted string values */ public static String[] split(String ids) { return IdUtil.unescape(ids, IDS_SPLITOR_STR, ESCAPE_STR); @@ -89,8 +91,9 @@ public static String[] split(String ids) { /** * Concat property values with NAME_SPLITOR + * * @param values the property values to be concatted - * @return concatted string value + * @return concatted string value */ public static String concatValues(List values) { // Convert the object list to string array @@ -104,8 +107,9 @@ public static String concatValues(List values) { /** * Concat property values with NAME_SPLITOR + * * @param values the property values to be concatted - * @return concatted string value + * @return concatted string value */ public static String concatValues(Object... values) { return concatValues(Arrays.asList(values)); @@ -113,8 +117,9 @@ public static String concatValues(Object... values) { /** * Concat multiple parts into a single id with ID_SPLITOR + * * @param parts the string id values to be spliced - * @return spliced id object + * @return spliced id object */ public static Id splicing(String... parts) { String escaped = IdUtil.escape(ID_SPLITOR, ESCAPE, parts); @@ -123,8 +128,9 @@ public static Id splicing(String... parts) { /** * Parse a single id into multiple parts with ID_SPLITOR + * * @param id the id object to be parsed - * @return parsed string id parts + * @return parsed string id parts */ public static String[] parse(Id id) { return IdUtil.unescape(id.asString(), ID_SPLITOR_STR, ESCAPE_STR); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java index 37fe463508..b420648767 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java @@ -23,15 +23,14 @@ import java.util.function.Function; import org.apache.commons.lang.NotImplementedException; +import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - -import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.iterator.CIter; import org.apache.hugegraph.iterator.Metadatable; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public abstract class IdHolder { @@ -133,7 +132,7 @@ public Set all() { } public static class BatchIdHolder extends IdHolder - implements CIter { + implements CIter { private final Iterator entries; private final Function> fetcher; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java index 5d8370824b..bbc93c79b6 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java @@ -21,11 +21,10 @@ import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - import org.apache.hugegraph.exception.NotSupportException; import org.apache.hugegraph.iterator.CIter; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public class PageEntryIterator implements CIter { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java index 96b9d25cce..879821f3db 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java @@ -20,6 +20,7 @@ import java.util.Set; import org.apache.hugegraph.backend.id.Id; + import com.google.common.collect.ImmutableSet; public final class PageIds { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java index 7eb10e0165..d1e11e9220 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java @@ -22,14 +22,14 @@ import java.util.List; import java.util.Set; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.page.IdHolder.BatchIdHolder; +import org.apache.hugegraph.backend.page.IdHolder.FixedIdHolder; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.ConditionQuery.OptimizedType; import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.page.IdHolder.BatchIdHolder; -import org.apache.hugegraph.backend.page.IdHolder.FixedIdHolder; import org.apache.hugegraph.util.Bytes; import org.apache.hugegraph.util.E; @@ -46,7 +46,7 @@ public QueryList(Query parent, QueryResults.Fetcher fetcher) { this.queries = new ArrayList<>(); } - protected Query parent() { + Query parent() { return this.parent; } @@ -98,7 +98,7 @@ public QueryResults fetch(int pageSize) { return QueryResults.flatMap(this.queries.iterator(), FlattenQuery::iterator); } - protected PageResults fetchNext(PageInfo pageInfo, long pageSize) { + PageResults fetchNext(PageInfo pageInfo, long pageSize) { FlattenQuery query = null; int offset = pageInfo.offset(); int visited = 0; @@ -126,16 +126,18 @@ private interface FlattenQuery { /** * For non-paging situation - * @return BackendEntry iterator + * + * @return BackendEntry iterator */ QueryResults iterator(); /** * For paging situation - * @param index position IdHolder(Query) - * @param page set query page - * @param pageSize set query page size - * @return BackendEntry iterator with page + * + * @param index position IdHolder(Query) + * @param page set query page + * @param pageSize set query page size + * @return BackendEntry iterator with page */ PageResults iterator(int index, String page, long pageSize); @@ -323,8 +325,8 @@ private QueryResults queryByIndexIds(Set ids, boolean inOrder) { public static class PageResults { public static final PageResults EMPTY = new PageResults<>( - QueryResults.empty(), - PageState.EMPTY); + QueryResults.empty(), + PageState.EMPTY); private final QueryResults results; private final PageState pageState; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java index f2daad0d42..eeac978672 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java @@ -22,11 +22,12 @@ import java.util.Map; import java.util.Set; -import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.page.IdHolder.FixedIdHolder; +import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.util.CollectionUtil; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableSet; public class SortByCountIdHolderList extends IdHolderList { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java index 99da61efe1..181ee48648 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java @@ -43,7 +43,7 @@ public void mergeToIN(ConditionQuery query, HugeKeys key) { if (this.in == null) { assert !this.containsRelation(RelationType.IN); this.resetConditions(InsertionOrderUtil.newList( - (List) query.conditions())); + (List) query.conditions())); this.unsetCondition(key); List list = new ArrayList<>(this.batchSize); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java index d3746470d4..4756a729c3 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.backend.query; -import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -29,9 +28,8 @@ import java.util.function.BiPredicate; import org.apache.commons.lang.ArrayUtils; - -import org.apache.hugegraph.backend.store.Shard; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.store.Shard; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.type.define.HugeKeys; @@ -39,6 +37,7 @@ import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.NumericUtil; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -49,7 +48,7 @@ public enum ConditionType { RELATION, AND, OR, - NOT; + NOT } public enum RelationType implements BiPredicate { @@ -146,12 +145,12 @@ public enum RelationType implements BiPredicate { private final Class v2Class; RelationType(String op, - BiFunction tester) { + BiFunction tester) { this(op, null, null, tester); } RelationType(String op, Class v1Class, Class v2Class, - BiFunction tester) { + BiFunction tester) { this.operator = op; this.tester = tester; this.v1Class = v1Class; @@ -164,7 +163,8 @@ public String string() { /** * Determine two values of any type equal - * @param first is actual value + * + * @param first is actual value * @param second is value in query condition * @return true if equal, otherwise false */ @@ -188,13 +188,14 @@ private static boolean equals(final Object first, /** * Determine two numbers equal - * @param first is actual value, might be Number/Date or String, It is - * probably that the `first` is serialized to String. + * + * @param first is actual value, might be Number/Date or String, It is + * probably that the `first` is serialized to String. * @param second is value in query condition, must be Number/Date * @return the value 0 if first is numerically equal to second; - * a value less than 0 if first is numerically less than - * second; and a value greater than 0 if first is - * numerically greater than second. + * a value less than 0 if first is numerically less than + * second; and a value greater than 0 if first is + * numerically greater than second. */ private static int compare(final Object first, final Object second) { assert second != null; @@ -206,9 +207,9 @@ private static int compare(final Object first, final Object second) { } throw new IllegalArgumentException(String.format( - "Can't compare between %s(%s) and %s(%s)", first, - first == null ? null : first.getClass().getSimpleName(), - second, second.getClass().getSimpleName())); + "Can't compare between %s(%s) and %s(%s)", first, + first == null ? null : first.getClass().getSimpleName(), + second, second.getClass().getSimpleName())); } private static int compareDate(Object first, Date second) { @@ -220,9 +221,9 @@ private static int compareDate(Object first, Date second) { } throw new IllegalArgumentException(String.format( - "Can't compare between %s(%s) and %s(%s)", - first, first.getClass().getSimpleName(), - second, second.getClass().getSimpleName())); + "Can't compare between %s(%s) and %s(%s)", + first, first.getClass().getSimpleName(), + second, second.getClass().getSimpleName())); } private void checkBaseType(Object value, Class clazz) { @@ -543,7 +544,8 @@ public Condition copy() { } } - public static class Not extends Condition implements Serializable { + public static class Not extends Condition { + Condition condition; public Not(Condition condition) { @@ -629,8 +631,8 @@ public abstract static class Relation extends Condition { protected Object serialValue; protected static final Set UNFLATTEN_RELATION_TYPES = - ImmutableSet.of(RelationType.IN, RelationType.NOT_IN, - RelationType.TEXT_CONTAINS_ANY); + ImmutableSet.of(RelationType.IN, RelationType.NOT_IN, + RelationType.TEXT_CONTAINS_ANY); @Override public ConditionType type() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java index f40870009f..50ef774e32 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java @@ -63,10 +63,11 @@ public class ConditionQuery extends IdQuery { public static final char INDEX_SYM_MAX = '\u0003'; // Note: here we use "new String" to distinguish normal string code - public static final String INDEX_VALUE_NULL = new String(""); - public static final String INDEX_VALUE_EMPTY = new String(""); + public static final String INDEX_VALUE_NULL = ""; + public static final String INDEX_VALUE_EMPTY = ""; public static final Set IGNORE_SYM_SET; + static { List list = new ArrayList<>(INDEX_SYM_MAX - INDEX_SYM_MIN); for (char ch = INDEX_SYM_MIN; ch <= INDEX_SYM_MAX; ch++) { @@ -472,6 +473,7 @@ public Set userpropKeys() { /** * This method is only used for secondary index scenario, * its relation must be EQ + * * @param fields the user property fields * @return the corresponding user property serial values of fields */ @@ -493,8 +495,8 @@ public String userpropValuesString(List fields) { } if (!got) { throw new BackendException( - "No such userprop named '%s' in the query '%s'", - field, this); + "No such userprop named '%s' in the query '%s'", + field, this); } } return concatValues(values); @@ -652,7 +654,7 @@ public boolean mayHasDupKeys(Set keys) { public void optimized(OptimizedType optimizedType) { assert this.optimizedType.ordinal() <= optimizedType.ordinal() : - this.optimizedType + " !<= " + optimizedType; + this.optimizedType + " !<= " + optimizedType; this.optimizedType = optimizedType; Query originQuery = this.originQuery(); @@ -722,7 +724,8 @@ public static String concatValues(List values) { public static String concatValues(Object value) { if (value instanceof String) { return escapeSpecialValueIfNeeded((String) value); - } if (value instanceof List) { + } + if (value instanceof List) { return concatValues((List) value); } else if (needConvertNumber(value)) { return LongEncoding.encodeNumber(value); @@ -798,7 +801,7 @@ public void addIndexValue(Id indexField, Id elementId, this.filed2IndexValues.putIfAbsent(indexField, new HashMap<>()); } Map> element2IndexValueMap = - this.filed2IndexValues.get(indexField); + this.filed2IndexValues.get(indexField); if (element2IndexValueMap.containsKey(elementId)) { element2IndexValueMap.get(elementId).add(indexValue); } else { @@ -843,7 +846,7 @@ public boolean checkRangeIndex(HugeElement element, Condition cond) { } Condition.UserpropRelation propRelation = - (Condition.UserpropRelation) cond; + (Condition.UserpropRelation) cond; Id propId = propRelation.key(); Set fieldValues = this.toRemoveIndexValues(propId, element.id()); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java index fc488cc4b9..83af41b008 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java @@ -40,7 +40,7 @@ public final class ConditionQueryFlatten { private static final Set SPECIAL_KEYS = ImmutableSet.of( - HugeKeys.LABEL + HugeKeys.LABEL ); public static List flatten(ConditionQuery query) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java index e5e3c9a3a6..f7a1c732b3 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java @@ -27,6 +27,7 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -157,7 +158,7 @@ public int idsSize() { @Override public Set ids() { return this.id == null ? ImmutableSet.of() : - ImmutableSet.of(this.id); + ImmutableSet.of(this.id); } @Override diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java index b3115eb4a2..593887d92f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java @@ -412,8 +412,8 @@ public void checkCapacity(long count) throws LimitExceedException { query = query.substring(0, MAX_CHARS) + "..."; } throw new LimitExceedException( - "Too many records(must <= %s) for the query: %s", - this.capacity, query); + "Too many records(must <= %s) for the query: %s", + this.capacity, query); } } @@ -611,8 +611,8 @@ public static long defaultCapacity() { public static void checkForceCapacity(long count) throws LimitExceedException { if (count > Query.DEFAULT_CAPACITY) { throw new LimitExceedException( - "Too many records(must <= %s) for one query", - Query.DEFAULT_CAPACITY); + "Too many records(must <= %s) for one query", + Query.DEFAULT_CAPACITY); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java index 12440dfee0..ca457a63a7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java @@ -26,8 +26,6 @@ import java.util.Set; import java.util.function.Function; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.iterator.CIter; @@ -38,13 +36,14 @@ import org.apache.hugegraph.type.Idfiable; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public class QueryResults { private static final Iterator EMPTY_ITERATOR = new EmptyIterator<>(); private static final QueryResults EMPTY = new QueryResults<>( - emptyIterator(), Query.NONE); + emptyIterator(), Query.NONE); private final Iterator results; private final List queries; @@ -97,7 +96,7 @@ public List queries() { } public Iterator keepInputOrderIfNeeded( - Iterator origin) { + Iterator origin) { if (!origin.hasNext()) { // None result found return origin; @@ -216,7 +215,7 @@ public static void fillMap(Iterator iterator, } public static QueryResults flatMap( - Iterator iterator, Function> func) { + Iterator iterator, Function> func) { @SuppressWarnings("unchecked") QueryResults[] qr = new QueryResults[1]; qr[0] = new QueryResults<>(new FlatMapperIterator<>(iterator, i -> { @@ -266,7 +265,9 @@ public static Iterator emptyIterator() { return (Iterator) EMPTY_ITERATOR; } - public interface Fetcher extends Function> {} + public interface Fetcher extends Function> { + + } private static class EmptyIterator implements CIter { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java index ffebc4dcf5..734cb90426 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java @@ -19,20 +19,18 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.iterator.CIter; -import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.config.HugeConfig; import org.apache.tinkerpop.gremlin.structure.Edge; public abstract class AbstractSerializer - implements GraphSerializer, SchemaSerializer { + implements GraphSerializer, SchemaSerializer { protected HugeConfig config; @@ -41,7 +39,7 @@ public AbstractSerializer() { } public AbstractSerializer(HugeConfig config) { - this.config = config; + this.config = config; } protected BackendEntry convertEntry(BackendEntry entry) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java index 3e0c8f2a77..18b642a001 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java @@ -22,12 +22,12 @@ import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; +import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.config.HugeConfig; public class BinaryScatterSerializer extends BinarySerializer { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java index d46ba83715..9f5e37ce1d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java @@ -17,8 +17,6 @@ package org.apache.hugegraph.backend.serializer; -import static org.apache.hugegraph.schema.SchemaElement.UNDEF; - import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -26,20 +24,12 @@ import java.util.Map; import org.apache.commons.lang.NotImplementedException; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; -import org.apache.hugegraph.iterator.CIter; -import org.apache.hugegraph.iterator.MapperIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.EdgeLabelType; -import org.apache.hugegraph.util.*; import org.apache.hugegraph.backend.query.Condition; import org.apache.hugegraph.backend.query.Condition.RangeConditions; import org.apache.hugegraph.backend.query.ConditionQuery; @@ -47,7 +37,11 @@ import org.apache.hugegraph.backend.query.IdRangeQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.serializer.BinaryBackendEntry.BinaryId; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.iterator.CIter; +import org.apache.hugegraph.iterator.MapperIterator; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; @@ -60,6 +54,7 @@ import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; +import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.AggregateType; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; @@ -71,7 +66,10 @@ import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.type.define.SerialEnum; import org.apache.hugegraph.type.define.WriteType; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.NumericUtil; import org.apache.hugegraph.util.StringEncoding; import org.apache.tinkerpop.gremlin.structure.Edge; @@ -214,7 +212,7 @@ protected void parseProperty(Id pkeyId, BytesBuffer buffer, } else { if (!(value instanceof Collection)) { throw new BackendException( - "Invalid value of non-single property: %s", value); + "Invalid value of non-single property: %s", value); } owner.addProperty(pkey, value); } @@ -532,7 +530,6 @@ public HugeEdge readEdge(HugeGraph graph, BackendEntry bytesEntry) { @Override public CIter readEdges(HugeGraph graph, BackendEntry bytesEntry) { - BinaryBackendEntry entry = this.convertEntry(bytesEntry); // Parse id @@ -914,7 +911,9 @@ public BackendEntry parse(BackendEntry originEntry) { buffer.write(parsedEntry.id().asBytes()); buffer.write(bytes); parsedEntry = new BinaryBackendEntry(originEntry.type(), new BinaryId(buffer.bytes(), - BytesBuffer.wrap(buffer.bytes()).readEdgeId())); + BytesBuffer.wrap( + buffer.bytes()) + .readEdgeId())); for (BackendColumn col : originEntry.columns()) { parsedEntry.column(buffer.bytes(), col.value); @@ -962,9 +961,7 @@ protected static boolean indexIdLengthExceedLimit(Id id) { protected static boolean indexFieldValuesUnmatched(byte[] value, Object fieldValues) { if (value != null && value.length > 0 && fieldValues != null) { - if (!StringEncoding.decode(value).equals(fieldValues)) { - return true; - } + return !StringEncoding.decode(value).equals(fieldValues); } return false; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java index add37f701b..f293dd2873 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java @@ -18,7 +18,6 @@ package org.apache.hugegraph.backend.serializer; import java.io.OutputStream; -import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Collection; @@ -29,13 +28,14 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.Id.IdType; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.backend.serializer.BinaryBackendEntry.BinaryId; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; -import org.apache.hugegraph.util.*; -import org.apache.hugegraph.backend.serializer.BinaryBackendEntry.BinaryId; import org.apache.hugegraph.util.Blob; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.KryoUtil; import org.apache.hugegraph.util.StringEncoding; @@ -170,7 +170,7 @@ private void require(int size) { "Capacity exceeds max buffer capacity: %s", MAX_BUFFER_CAPACITY); ByteBuffer newBuffer = ByteBuffer.allocate(newCapacity); - ((Buffer) this.buffer).flip(); + this.buffer.flip(); newBuffer.put(this.buffer); this.buffer = newBuffer; } @@ -344,7 +344,7 @@ public BytesBuffer writeStringWithEnding(String value) { * 0xFF is not a valid byte in UTF8 bytes */ assert !Bytes.contains(bytes, STRING_ENDING_BYTE_FF) : - "Invalid UTF8 bytes: " + value; + "Invalid UTF8 bytes: " + value; if (Bytes.contains(bytes, STRING_ENDING_BYTE)) { E.checkArgument(false, "Can't contains byte '0x00' in string: '%s'", @@ -421,7 +421,7 @@ public BytesBuffer writeVInt(int value) { this.write(0x80 | ((value >>> 14) & 0x7f)); } if (value > 0x7f || value < 0) { - this.write(0x80 | ((value >>> 7) & 0x7f)); + this.write(0x80 | ((value >>> 7) & 0x7f)); } this.write(value & 0x7f); @@ -485,7 +485,7 @@ public BytesBuffer writeVLong(long value) { this.write(0x80 | ((int) (value >>> 14) & 0x7f)); } if (value > 0x7fL || value < 0L) { - this.write(0x80 | ((int) (value >>> 7) & 0x7f)); + this.write(0x80 | ((int) (value >>> 7) & 0x7f)); } this.write((int) value & 0x7f); @@ -906,7 +906,7 @@ private long readNumber(byte b) { value |= this.readUInt16(); break; case 2: - value |= this.readUInt8() << 16 | this.readUInt16(); + value |= (long) this.readUInt8() << 16 | this.readUInt16(); break; case 3: value |= this.readUInt32(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java index 3b65130eba..2d14df1c84 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java @@ -23,12 +23,12 @@ import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.iterator.CIter; -import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.structure.HugeEdgeProperty; import org.apache.hugegraph.structure.HugeIndex; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; +import org.apache.hugegraph.type.HugeType; import org.apache.tinkerpop.gremlin.structure.Edge; public interface GraphSerializer { @@ -46,6 +46,7 @@ public interface GraphSerializer { BackendEntry writeEdgeProperty(HugeEdgeProperty prop); HugeEdge readEdge(HugeGraph graph, BackendEntry entry); + CIter readEdges(HugeGraph graph, BackendEntry bytesEntry); BackendEntry writeIndex(HugeIndex index); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java index a885626238..fa7cfe9542 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java @@ -36,12 +36,12 @@ public MergeIterator(Iterator originIterator, List> iterators, BiFunction merger) { E.checkArgumentNotNull(originIterator, "The origin iterator of " + - "MergeIterator can't be null"); + "MergeIterator can't be null"); E.checkArgument(iterators != null && !iterators.isEmpty(), "The iterators of MergeIterator can't be " + "null or empty"); E.checkArgumentNotNull(merger, "The merger function of " + - "MergeIterator can't be null"); + "MergeIterator can't be null"); this.originIterator = originIterator; this.headElements = new ArrayList<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java index 39b52c7160..db5fe0a8cd 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java @@ -56,7 +56,7 @@ public static AbstractSerializer serializer(HugeConfig config, String name) { } } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void register(String name, String classPath) { ClassLoader classLoader = SerializerFactory.class.getClassLoader(); Class clazz; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java index c33cd97aa3..918a95b511 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java @@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.NotImplementedException; - import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.type.HugeType; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java index 9d38260985..fbca2a9a19 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java @@ -32,8 +32,6 @@ import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; @@ -48,6 +46,7 @@ import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; +import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.AggregateType; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; @@ -60,6 +59,7 @@ import org.apache.hugegraph.type.define.SerialEnum; import org.apache.hugegraph.type.define.WriteType; import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; public abstract class TableSerializer extends AbstractSerializer { @@ -108,7 +108,7 @@ protected void parseProperty(Id key, Object colValue, HugeElement owner) { } else { if (!(value instanceof Collection)) { throw new BackendException( - "Invalid value of non-single property: %s", value); + "Invalid value of non-single property: %s", value); } owner.addProperty(pkey, value); } @@ -157,9 +157,10 @@ protected TableBackendEntry.Row formatEdge(HugeEdge edge) { /** * Parse an edge from a entry row - * @param row edge entry + * + * @param row edge entry * @param vertex null or the source vertex - * @param graph the HugeGraph context object + * @param graph the HugeGraph context object * @return the source vertex */ protected HugeEdge parseEdge(TableBackendEntry.Row row, @@ -560,8 +561,8 @@ public PropertyKey readPropertyKey(HugeGraph graph, AggregateType aggregateType = schemaEnum(entry, HugeKeys.AGGREGATE_TYPE, AggregateType.class); WriteType writeType = schemaEnumOrDefault( - entry, HugeKeys.WRITE_TYPE, - WriteType.class, WriteType.OLTP); + entry, HugeKeys.WRITE_TYPE, + WriteType.class, WriteType.OLTP); Object properties = schemaColumn(entry, HugeKeys.PROPERTIES); SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class); @@ -697,9 +698,9 @@ private static T schemaEnum(TableBackendEntry entry, } private static T schemaEnumOrDefault( - TableBackendEntry entry, - HugeKeys key, Class clazz, - T defaultValue) { + TableBackendEntry entry, + HugeKeys key, Class clazz, + T defaultValue) { assert entry.type().isSchema(); Number value = entry.column(key); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java index 871da99893..2dfdb2cba9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java @@ -165,7 +165,7 @@ public boolean containsPrefix(String column) { } public boolean containsValue(String value) { - return this.columns.values().contains(value); + return this.columns.containsValue(value); } public void append(TextBackendEntry entry) { @@ -371,6 +371,7 @@ public boolean equals(Object obj) { return true; } + @Override public int hashCode() { return this.id().hashCode() ^ this.columns().hashCode(); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java index 9d7b3bcfdd..ed6c12241f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java @@ -23,16 +23,10 @@ import java.util.List; import java.util.Map; +import org.apache.commons.lang.NotImplementedException; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.commons.lang.NotImplementedException; - -import org.apache.hugegraph.iterator.CIter; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; @@ -43,6 +37,9 @@ import org.apache.hugegraph.backend.query.IdPrefixQuery; import org.apache.hugegraph.backend.query.IdRangeQuery; import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.iterator.CIter; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; @@ -56,6 +53,7 @@ import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; +import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.AggregateType; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; @@ -67,6 +65,7 @@ import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.type.define.WriteType; import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.gremlin.structure.Edge; import com.google.common.collect.ImmutableMap; @@ -75,7 +74,7 @@ public class TextSerializer extends AbstractSerializer { private static final String VALUE_SPLITOR = TextBackendEntry.VALUE_SPLITOR; private static final String EDGE_NAME_ENDING = - ConditionQuery.INDEX_SYM_ENDING; + ConditionQuery.INDEX_SYM_ENDING; private static final String EDGE_OUT_TYPE = writeType(HugeType.EDGE_OUT); @@ -166,7 +165,7 @@ private void parseProperty(String colName, String colValue, } else { if (!(value instanceof Collection)) { throw new BackendException( - "Invalid value of non-single property: %s", colValue); + "Invalid value of non-single property: %s", colValue); } for (Object v : (Collection) value) { v = JsonUtil.castNumber(v, pkey.dataType().clazz()); @@ -316,7 +315,7 @@ public HugeVertex readVertex(HugeGraph graph, BackendEntry backendEntry) { HugeVertex vertex = new HugeVertex(graph, id, vertexLabel); String expiredTime = entry.column(this.formatSyspropName( - HugeKeys.EXPIRED_TIME)); + HugeKeys.EXPIRED_TIME)); // Expired time is null when backend entry is fake vertex with edges if (expiredTime != null) { vertex.expiredTime(readLong(expiredTime)); @@ -395,11 +394,11 @@ public HugeIndex readIndex(HugeGraph graph, ConditionQuery query, TextBackendEntry entry = this.convertEntry(backendEntry); String indexValues = entry.column( - formatSyspropName(HugeKeys.FIELD_VALUES)); + formatSyspropName(HugeKeys.FIELD_VALUES)); String indexLabelId = entry.column( - formatSyspropName(HugeKeys.INDEX_LABEL_ID)); + formatSyspropName(HugeKeys.INDEX_LABEL_ID)); String elemIds = entry.column( - formatSyspropName(HugeKeys.ELEMENT_IDS)); + formatSyspropName(HugeKeys.ELEMENT_IDS)); IndexLabel indexLabel = IndexLabel.label(graph, readId(indexLabelId)); HugeIndex index = new HugeIndex(graph, indexLabel); @@ -875,7 +874,7 @@ private static IdWithExpiredTime[] readElementIds(String str) { Map map = (Map) values[i]; idValue = map.get(HugeKeys.ID.string()); expiredTime = ((Number) map.get( - HugeKeys.EXPIRED_TIME.string())).longValue(); + HugeKeys.EXPIRED_TIME.string())).longValue(); } else { idValue = values[i]; expiredTime = 0L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java index d1cc0515d3..2ef9a6db73 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java @@ -21,7 +21,7 @@ import org.apache.hugegraph.type.HugeType; public abstract class AbstractBackendStore - implements BackendStore { + implements BackendStore { // TODO: move SystemSchemaStore into backend like MetaStore private final SystemSchemaStore systemSchemaStore; @@ -43,7 +43,7 @@ public void registerMetaHandler(String name, MetaHandler handler) { @Override public String storedVersion() { throw new UnsupportedOperationException( - "AbstractBackendStore.storedVersion()"); + "AbstractBackendStore.storedVersion()"); } @Override @@ -68,8 +68,8 @@ public R metadata(HugeType type, String meta, Object[] args) { protected void checkOpened() throws ConnectionException { if (!this.opened()) { throw new ConnectionException( - "The '%s' store of %s has not been opened", - this.database(), this.provider().type()); + "The '%s' store of %s has not been opened", + this.database(), this.provider().type()); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java index bfd9031ce5..906d795149 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java @@ -21,11 +21,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; -import org.apache.hugegraph.backend.store.raft.StoreSnapshotFile; -import org.slf4j.Logger; - -import com.alipay.remoting.rpc.RpcServer; import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.backend.store.raft.StoreSnapshotFile; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.event.EventHub; @@ -33,9 +30,12 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Events; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.alipay.remoting.rpc.RpcServer; public abstract class AbstractBackendStoreProvider - implements BackendStoreProvider { + implements BackendStoreProvider { private static final Logger LOG = Log.logger(AbstractBackendStoreProvider.class); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java index 4ffb3660a1..f13798dd63 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java @@ -213,7 +213,6 @@ protected PageState pageState() { @Override public void close() throws Exception { - return; } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java index d1ed767252..02b3429006 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java @@ -46,7 +46,8 @@ public BackendMutation(int initialCapacity) { /** * Add data entry with an action to collection `updates` - * @param entry the backend entry + * + * @param entry the backend entry * @param action operate action on the entry */ @Watched(prefix = "mutation") @@ -72,11 +73,11 @@ public void put(BackendEntry entry, Action action) { /** * The optimized scenes include but are not limited to: * 1.If you want to delete an entry, the other mutations previously - * can be ignored. + * can be ignored. * 2.As similar to the No.1 item, If you want to insert an entry, - * the other mutations previously also can be ignored. + * the other mutations previously also can be ignored. * 3.If you append an entry and then eliminate it, the new action - * can override the old one. + * can override the old one. */ @Watched(prefix = "mutation") private void optimizeUpdates(BackendEntry entry, Action action) { @@ -85,7 +86,7 @@ private void optimizeUpdates(BackendEntry entry, Action action) { final List items = this.updates.get(entry.type(), id); assert items != null; boolean ignoreCurrent = false; - for (Iterator iter = items.iterator(); iter.hasNext();) { + for (Iterator iter = items.iterator(); iter.hasNext(); ) { BackendAction originItem = iter.next(); Action originAction = originItem.action(); switch (action) { @@ -105,9 +106,9 @@ private void optimizeUpdates(BackendEntry entry, Action action) { if (entry.type().isUniqueIndex() && originAction == Action.APPEND) { throw new IllegalArgumentException(String.format( - "Unique constraint conflict is found in" + - " transaction between %s and %s", - entry, originItem.entry())); + "Unique constraint conflict is found in" + + " transaction between %s and %s", + entry, originItem.entry())); } if (originAction == Action.INSERT || @@ -137,7 +138,7 @@ private void optimizeUpdates(BackendEntry entry, Action action) { break; default: throw new AssertionError(String.format( - "Unknown mutate action: %s", action)); + "Unknown mutate action: %s", action)); } } if (!ignoreCurrent) { @@ -146,8 +147,8 @@ private void optimizeUpdates(BackendEntry entry, Action action) { } private static HugeException incompatibleActionException( - Action newAction, - Action originAction) { + Action newAction, + Action originAction) { return new HugeException("The action '%s' is incompatible with " + "action '%s'", newAction, originAction); } @@ -156,11 +157,12 @@ private static HugeException incompatibleActionException( * Merges another mutation into this mutation. Ensures that all additions * and deletions are added to this mutation. Does not remove duplicates * if such exist - this needs to be ensured by the caller. + * * @param mutation another mutation to be merged */ public void merge(BackendMutation mutation) { E.checkNotNull(mutation, "mutation"); - for (Iterator it = mutation.mutation(); it.hasNext();) { + for (Iterator it = mutation.mutation(); it.hasNext(); ) { BackendAction item = it.next(); this.add(item.entry(), item.action()); } @@ -172,6 +174,7 @@ public Set types() { /** * Get all mutations + * * @return mutations */ public Iterator mutation() { @@ -180,6 +183,7 @@ public Iterator mutation() { /** * Get mutations by type + * * @param type entry type * @return mutations */ @@ -189,8 +193,9 @@ public Iterator mutation(HugeType type) { /** * Get mutations by type and id + * * @param type entry type - * @param id entry id + * @param id entry id * @return mutations */ public List mutation(HugeType type, Id id) { @@ -199,7 +204,8 @@ public List mutation(HugeType type, Id id) { /** * Whether mutation contains entry and action - * @param entry entry + * + * @param entry entry * @param action action * @return true if exist, otherwise false */ @@ -218,12 +224,13 @@ public boolean contains(BackendEntry entry, Action action) { /** * Whether mutation contains type and action - * @param type type + * + * @param type type * @param action action * @return true if exist, otherwise false */ public boolean contains(HugeType type, Action action) { - for (Iterator i = this.updates.get(type); i.hasNext();) { + for (Iterator i = this.updates.get(type); i.hasNext(); ) { BackendAction entry = i.next(); if (entry.action() == action) { return true; @@ -234,6 +241,7 @@ public boolean contains(HugeType type, Action action) { /** * Whether this mutation is empty + * * @return true if empty, otherwise false */ public boolean isEmpty() { @@ -242,6 +250,7 @@ public boolean isEmpty() { /** * Get size of mutations + * * @return size */ public int size() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java index 6b804b74fa..bcfb31e4fc 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java @@ -20,8 +20,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.store.memory.InMemoryDBStoreProvider; @@ -29,6 +27,7 @@ import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class BackendProviderFactory { @@ -83,7 +82,7 @@ private static BackendStoreProvider newProvider(HugeConfig config) { return instance; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void register(String name, String classPath) { ClassLoader classLoader = BackendProviderFactory.class.getClassLoader(); Class clazz = null; @@ -96,7 +95,7 @@ public static void register(String name, String classPath) { // Check subclass boolean subclass = BackendStoreProvider.class.isAssignableFrom(clazz); BackendException.check(subclass, "Class '%s' is not a subclass of " + - "class BackendStoreProvider", classPath); + "class BackendStoreProvider", classPath); // Check exists BackendException.check(!providers.containsKey(name), diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java index c7e3411bd5..521f44556f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java @@ -23,11 +23,10 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; - import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public abstract class BackendSessionPool { @@ -47,7 +46,7 @@ public BackendSessionPool(HugeConfig config, String name) { this.sessionCount = new AtomicInteger(0); this.sessions = new ConcurrentHashMap<>(); this.reconnectDetectInterval = this.config.get( - CoreOptions.STORE_CONN_DETECT_INTERVAL); + CoreOptions.STORE_CONN_DETECT_INTERVAL); } public HugeConfig config() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java index 20e5441c62..5c05e37c5a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java @@ -106,7 +106,7 @@ default Id nextId(HugeType type) { } E.checkState(counter != 0L, "Please check whether '%s' is OK", - this.provider().type()); + this.provider().type()); E.checkState(counter == expect, "'%s' is busy please try again", this.provider().type()); @@ -179,6 +179,11 @@ default void resumeSnapshot(String snapshotDir, boolean deleteSnapshot) { } enum TxState { - BEGIN, COMMITTING, COMMITT_FAIL, ROLLBACKING, ROLLBACK_FAIL, CLEAN + BEGIN, + COMMITTING, + COMMITT_FAIL, + ROLLBACKING, + ROLLBACK_FAIL, + CLEAN } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java index 5f3c3f25c9..f489e9572a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java @@ -18,9 +18,8 @@ package org.apache.hugegraph.backend.store; import org.apache.hugegraph.config.HugeConfig; -import org.slf4j.Logger; - import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class BackendStoreInfo { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java index 1d2b1bfae7..44e58c2289 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java @@ -17,11 +17,12 @@ package org.apache.hugegraph.backend.store; -import com.alipay.remoting.rpc.RpcServer; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.event.EventHub; import org.apache.hugegraph.event.EventListener; +import com.alipay.remoting.rpc.RpcServer; + public interface BackendStoreProvider { String SCHEMA_STORE = "m"; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java index b8e6de1f1e..a9ee4b5c72 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java @@ -280,8 +280,8 @@ public List splitEven(int count) { assert count > 1; byte[] each = align(new BigInteger(1, subtract(end, start)) - .divide(BigInteger.valueOf(count)) - .toByteArray(), + .divide(BigInteger.valueOf(count)) + .toByteArray(), length); byte[] offset = start; byte[] last = offset; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java index f926119d0e..aae2793b92 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java @@ -26,6 +26,7 @@ import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableMap; public class TableDefine { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java index 85a3d49ee5..c482749744 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java @@ -53,7 +53,7 @@ * 2.append/subtract edge-property */ public abstract class InMemoryDBStore - extends AbstractBackendStore { + extends AbstractBackendStore { private static final Logger LOG = Log.logger(InMemoryDBStore.class); @@ -125,7 +125,7 @@ public Number queryNumber(Query query) { @Override public void mutate(BackendMutation mutation) { - for (Iterator it = mutation.mutation(); it.hasNext();) { + for (Iterator it = mutation.mutation(); it.hasNext(); ) { this.mutate(it.next()); } } @@ -229,7 +229,7 @@ public void commitTx() { @Override public void rollbackTx() { throw new UnsupportedOperationException( - "Unsupported rollback operation by InMemoryDBStore"); + "Unsupported rollback operation by InMemoryDBStore"); } @Override @@ -340,19 +340,19 @@ public boolean isSchemaStore() { @Override public Id nextId(HugeType type) { throw new UnsupportedOperationException( - "InMemoryGraphStore.nextId()"); + "InMemoryGraphStore.nextId()"); } @Override public void increaseCounter(HugeType type, long num) { throw new UnsupportedOperationException( - "InMemoryGraphStore.increaseCounter()"); + "InMemoryGraphStore.increaseCounter()"); } @Override public long getCounter(HugeType type) { throw new UnsupportedOperationException( - "InMemoryGraphStore.getCounter()"); + "InMemoryGraphStore.getCounter()"); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java index d3460e554f..aaf8e47001 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java @@ -22,11 +22,11 @@ import org.apache.hugegraph.backend.store.AbstractBackendStoreProvider; import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.util.Events; import org.apache.hugegraph.backend.store.memory.InMemoryDBStore.InMemoryGraphStore; import org.apache.hugegraph.backend.store.memory.InMemoryDBStore.InMemorySchemaStore; import org.apache.hugegraph.backend.store.memory.InMemoryDBStore.InMemorySystemStore; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.util.Events; public class InMemoryDBStoreProvider extends AbstractBackendStoreProvider { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java index 1a6b3cef00..fb6ef7c021 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java @@ -27,15 +27,6 @@ import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.serializer.TextBackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendSession; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.type.HugeType; -import org.slf4j.Logger; - import org.apache.hugegraph.backend.query.Aggregate; import org.apache.hugegraph.backend.query.Aggregate.AggregateFunc; import org.apache.hugegraph.backend.query.Condition; @@ -44,14 +35,23 @@ import org.apache.hugegraph.backend.query.IdRangeQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; +import org.apache.hugegraph.backend.serializer.TextBackendEntry; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendSession; +import org.apache.hugegraph.backend.store.BackendTable; +import org.apache.hugegraph.backend.store.Shard; +import org.apache.hugegraph.exception.NotSupportException; +import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; public class InMemoryDBTable extends BackendTable { + TextBackendEntry> { private static final Logger LOG = Log.logger(InMemoryDBTable.class); @@ -260,8 +260,8 @@ protected Map queryByIdRange(Id start, } protected Map queryByFilter( - Collection conditions, - Map entries) { + Collection conditions, + Map entries) { assert conditions.size() > 0; Map rs = new HashMap<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java index e3ea17179e..0fdd36f09c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java @@ -32,23 +32,24 @@ import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.serializer.TextBackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; -import org.apache.hugegraph.backend.store.BackendSession; -import org.apache.hugegraph.structure.HugeIndex; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.backend.query.Condition; import org.apache.hugegraph.backend.query.Condition.RangeConditions; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; +import org.apache.hugegraph.backend.serializer.TextBackendEntry; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn; +import org.apache.hugegraph.backend.store.BackendSession; import org.apache.hugegraph.iterator.ExtendableIterator; +import org.apache.hugegraph.structure.HugeIndex; +import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.hugegraph.util.NumericUtil; + import com.google.common.collect.ImmutableList; public class InMemoryDBTables { @@ -103,18 +104,18 @@ public void eliminate(BackendSession session, TextBackendEntry entry) { @Override protected Map queryById( - Collection ids, - Map entries) { + Collection ids, + Map entries) { // Query edge(in a vertex) by id return this.queryEdgeById(ids, false, entries); } @Override protected Map queryByIdPrefix( - Id start, - boolean inclusiveStart, - Id prefix, - Map entries) { + Id start, + boolean inclusiveStart, + Id prefix, + Map entries) { // Query edge(in a vertex) by v-id + column-name-prefix BackendEntry value = this.getEntryById(start, entries); if (value == null) { @@ -145,11 +146,11 @@ protected Map queryByIdPrefix( @Override protected Map queryByIdRange( - Id start, - boolean inclusiveStart, - Id end, - boolean inclusiveEnd, - Map entries) { + Id start, + boolean inclusiveStart, + Id end, + boolean inclusiveEnd, + Map entries) { BackendEntry value = this.getEntryById(start, entries); if (value == null) { return Collections.emptyMap(); @@ -178,8 +179,8 @@ protected Map queryByIdRange( } private Map queryEdgeById( - Collection ids, boolean prefix, - Map entries) { + Collection ids, boolean prefix, + Map entries) { assert ids.size() > 0; Map rs = InsertionOrderUtil.newMap(); @@ -195,7 +196,7 @@ private Map queryEdgeById( } else if ((!prefix && entry.contains(column)) || (prefix && entry.containsPrefix(column))) { BackendEntry edges = new TextBackendEntry( - HugeType.VERTEX, entry.id()); + HugeType.VERTEX, entry.id()); if (prefix) { // Some edges with specified prefix in the vertex edges.columns(entry.columnsWithPrefix(column)); @@ -229,8 +230,8 @@ private BackendEntry getEntryById(Id id, @Override protected Map queryByFilter( - Collection conditions, - Map entries) { + Collection conditions, + Map entries) { if (conditions.isEmpty()) { return entries; } @@ -405,7 +406,7 @@ public void delete(BackendSession session, TextBackendEntry entry) { E.checkState(indexLabel != null, "Expect index label"); Iterator> iter; - for (iter = this.store().entrySet().iterator(); iter.hasNext();) { + for (iter = this.store().entrySet().iterator(); iter.hasNext(); ) { Entry e = iter.next(); // Delete if prefix with index label if (e.getKey().asString().startsWith(indexLabel)) { @@ -535,7 +536,7 @@ public void delete(BackendSession session, TextBackendEntry entry) { SortedMap subStore; subStore = this.store().subMap(min, max); Iterator> iter; - for (iter = subStore.entrySet().iterator(); iter.hasNext();) { + for (iter = subStore.entrySet().iterator(); iter.hasNext(); ) { iter.next(); // Delete if prefix with index label iter.remove(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java index 9625456850..9e7caa38ed 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java @@ -20,6 +20,7 @@ import java.util.Map; import org.apache.hugegraph.backend.store.BackendMetrics; + import com.google.common.collect.ImmutableMap; public class InMemoryMetrics implements BackendMetrics { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java index 1f92cdb0b4..bf89c6b17a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java @@ -22,11 +22,6 @@ import java.util.List; import java.util.function.Function; -import org.slf4j.Logger; - -import com.alipay.sofa.jraft.Status; -import com.alipay.sofa.jraft.closure.ReadIndexClosure; -import com.alipay.sofa.jraft.util.BytesUtil; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.store.BackendEntry; @@ -41,6 +36,11 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.alipay.sofa.jraft.Status; +import com.alipay.sofa.jraft.closure.ReadIndexClosure; +import com.alipay.sofa.jraft.util.BytesUtil; public class RaftBackendStore implements BackendStore { @@ -149,13 +149,13 @@ public void mutate(BackendMutation mutation) { @SuppressWarnings("unchecked") public Iterator query(Query query) { return (Iterator) - this.queryByRaft(query, o -> this.store.query(query)); + this.queryByRaft(query, o -> this.store.query(query)); } @Override public Number queryNumber(Query query) { return (Number) - this.queryByRaft(query, o -> this.store.queryNumber(query)); + this.queryByRaft(query, o -> this.store.queryNumber(query)); } @Override @@ -231,8 +231,8 @@ public void run(Status status, long index, byte[] reqCtx) { future.complete(status, () -> func.apply(query)); } else { future.failure(status, new BackendException( - "Failed to do raft read-index: %s", - status)); + "Failed to do raft read-index: %s", + status)); } } }; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java index 32688da6c1..ecdff19bd5 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java @@ -20,9 +20,6 @@ import java.util.Set; import java.util.concurrent.Future; -import org.slf4j.Logger; - -import com.alipay.remoting.rpc.RpcServer; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.store.BackendStore; @@ -35,6 +32,9 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Events; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.alipay.remoting.rpc.RpcServer; import com.google.common.collect.ImmutableSet; public class RaftBackendStoreProvider implements BackendStoreProvider { @@ -47,6 +47,7 @@ public class RaftBackendStoreProvider implements BackendStoreProvider { private RaftBackendStore schemaStore; private RaftBackendStore graphStore; private RaftBackendStore systemStore; + public RaftBackendStoreProvider(HugeGraphParams params, BackendStoreProvider provider) { this.provider = provider; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java index 2f9479e138..bd4e45da42 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java @@ -23,12 +23,12 @@ import java.util.concurrent.TimeoutException; import java.util.function.Supplier; +import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.Closure; import com.alipay.sofa.jraft.Status; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.util.Log; public class RaftClosure implements Closure { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java index 852b56423d..a70cd3022d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java @@ -184,11 +184,11 @@ public RaftNode node() { return this.raftNode; } - protected RpcServer rpcServer() { + RpcServer rpcServer() { return this.raftRpcServer; } - protected RpcForwarder rpcForwarder() { + RpcForwarder rpcForwarder() { return this.rpcForwarder; } @@ -216,7 +216,7 @@ public StoreType storeType(String store) { } } - protected RaftBackendStore[] stores() { + RaftBackendStore[] stores() { return this.stores; } @@ -233,13 +233,13 @@ public NodeOptions nodeOptions() throws IOException { NodeOptions nodeOptions = new NodeOptions(); nodeOptions.setEnableMetrics(false); nodeOptions.setRpcProcessorThreadPoolSize( - config.get(CoreOptions.RAFT_RPC_THREADS)); + config.get(CoreOptions.RAFT_RPC_THREADS)); nodeOptions.setRpcConnectTimeoutMs( - config.get(CoreOptions.RAFT_RPC_CONNECT_TIMEOUT)); + config.get(CoreOptions.RAFT_RPC_CONNECT_TIMEOUT)); nodeOptions.setRpcDefaultTimeout( - 1000 * config.get(CoreOptions.RAFT_RPC_TIMEOUT)); + 1000 * config.get(CoreOptions.RAFT_RPC_TIMEOUT)); nodeOptions.setRpcInstallSnapshotTimeout( - 1000 * config.get(CoreOptions.RAFT_INSTALL_SNAPSHOT_TIMEOUT)); + 1000 * config.get(CoreOptions.RAFT_INSTALL_SNAPSHOT_TIMEOUT)); int electionTimeout = config.get(CoreOptions.RAFT_ELECTION_TIMEOUT); nodeOptions.setElectionTimeoutMs(electionTimeout); @@ -269,27 +269,27 @@ public NodeOptions nodeOptions() throws IOException { */ raftOptions.setApplyBatch(config.get(CoreOptions.RAFT_APPLY_BATCH)); raftOptions.setDisruptorBufferSize( - config.get(CoreOptions.RAFT_QUEUE_SIZE)); + config.get(CoreOptions.RAFT_QUEUE_SIZE)); raftOptions.setDisruptorPublishEventWaitTimeoutSecs( - config.get(CoreOptions.RAFT_QUEUE_PUBLISH_TIMEOUT)); + config.get(CoreOptions.RAFT_QUEUE_PUBLISH_TIMEOUT)); raftOptions.setReplicatorPipeline( - config.get(CoreOptions.RAFT_REPLICATOR_PIPELINE)); + config.get(CoreOptions.RAFT_REPLICATOR_PIPELINE)); raftOptions.setOpenStatistics(false); raftOptions.setReadOnlyOptions( - ReadOnlyOption.valueOf( - config.get(CoreOptions.RAFT_READ_STRATEGY))); + ReadOnlyOption.valueOf( + config.get(CoreOptions.RAFT_READ_STRATEGY))); return nodeOptions; } - protected void clearCache() { + void clearCache() { // Just choose two representatives used to represent schema and graph this.notifyCache(Cache.ACTION_CLEAR, HugeType.VERTEX_LABEL, null); this.notifyCache(Cache.ACTION_CLEAR, HugeType.VERTEX, null); } - protected void updateCacheIfNeeded(BackendMutation mutation, - boolean forwarded) { + void updateCacheIfNeeded(BackendMutation mutation, + boolean forwarded) { // Update cache only when graph run in general mode if (this.graphMode() != GraphMode.NONE) { return; @@ -317,7 +317,7 @@ protected void updateCacheIfNeeded(BackendMutation mutation, } } - protected void notifyCache(String action, HugeType type, List ids) { + private void notifyCache(String action, HugeType type, List ids) { EventHub eventHub; if (type.isGraph()) { eventHub = this.params.graphEventHub(); @@ -373,18 +373,18 @@ private HugeConfig config() { @SuppressWarnings("unused") private RpcServer initAndStartRpcServer() { Integer lowWaterMark = this.config().get( - CoreOptions.RAFT_RPC_BUF_LOW_WATER_MARK); + CoreOptions.RAFT_RPC_BUF_LOW_WATER_MARK); System.setProperty("bolt.channel_write_buf_low_water_mark", String.valueOf(lowWaterMark)); Integer highWaterMark = this.config().get( - CoreOptions.RAFT_RPC_BUF_HIGH_WATER_MARK); + CoreOptions.RAFT_RPC_BUF_HIGH_WATER_MARK); System.setProperty("bolt.channel_write_buf_high_water_mark", String.valueOf(highWaterMark)); PeerId endpoint = this.endpoint(); NodeManager.getInstance().addAddress(endpoint.getEndpoint()); RpcServer rpcServer = RaftRpcServerFactory.createAndStartRaftRpcServer( - endpoint.getEndpoint()); + endpoint.getEndpoint()); LOG.info("Raft-RPC server is started successfully"); return rpcServer; } @@ -392,11 +392,11 @@ private RpcServer initAndStartRpcServer() { private RpcServer wrapRpcServer(com.alipay.remoting.rpc.RpcServer rpcServer) { // TODO: pass ServerOptions instead of CoreOptions, to share by graphs Integer lowWaterMark = this.config().get( - CoreOptions.RAFT_RPC_BUF_LOW_WATER_MARK); + CoreOptions.RAFT_RPC_BUF_LOW_WATER_MARK); System.setProperty("bolt.channel_write_buf_low_water_mark", String.valueOf(lowWaterMark)); Integer highWaterMark = this.config().get( - CoreOptions.RAFT_RPC_BUF_HIGH_WATER_MARK); + CoreOptions.RAFT_RPC_BUF_HIGH_WATER_MARK); System.setProperty("bolt.channel_write_buf_high_water_mark", String.valueOf(highWaterMark)); @@ -439,7 +439,7 @@ private ExecutorService createSnapshotExecutor(int coreThreads) { private ExecutorService createBackendExecutor(int threads) { String name = "store-backend-executor"; RejectedExecutionHandler handler = - new ThreadPoolExecutor.CallerRunsPolicy(); + new ThreadPoolExecutor.CallerRunsPolicy(); return newPool(threads, threads, name, handler); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java index cce4db182d..85e6915bf8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java @@ -45,7 +45,7 @@ public RaftException(Throwable cause) { public static final void check(boolean expression, String message, Object... args) - throws RaftException { + throws RaftException { if (!expression) { throw new RaftException(message, args); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java index ee1e328708..0f231d734c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java @@ -20,21 +20,19 @@ import java.util.List; import java.util.stream.Collectors; -import com.alipay.sofa.jraft.Node; -import com.alipay.sofa.jraft.Status; -import com.alipay.sofa.jraft.entity.PeerId; -import org.apache.hugegraph.backend.store.raft.rpc.RpcForwarder; import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.AddPeerRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.RemovePeerRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.AddPeerRequest; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.AddPeerResponse; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.RemovePeerRequest; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.RemovePeerResponse; - +import org.apache.hugegraph.backend.store.raft.rpc.RpcForwarder; import org.apache.hugegraph.util.E; + +import com.alipay.sofa.jraft.Node; +import com.alipay.sofa.jraft.Status; +import com.alipay.sofa.jraft.entity.PeerId; import com.google.protobuf.Message; public class RaftGroupManagerImpl implements RaftGroupManager { @@ -87,8 +85,8 @@ public String transferLeaderTo(String endpoint) { Status status = this.raftNode.node().transferLeadershipTo(peerId); if (!status.isOk()) { throw new BackendException( - "Failed to transfer leader to '%s', raft error: %s", - endpoint, status.getErrorMsg()); + "Failed to transfer leader to '%s', raft error: %s", + endpoint, status.getErrorMsg()); } return peerId.toString(); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java index 6f703f5c53..a8e07b4114 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java @@ -24,6 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; +import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.util.LZ4Util; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.Node; @@ -37,9 +40,6 @@ import com.alipay.sofa.jraft.option.NodeOptions; import com.alipay.sofa.jraft.rpc.RpcServer; import com.alipay.sofa.jraft.util.BytesUtil; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.util.LZ4Util; -import org.apache.hugegraph.util.Log; public final class RaftNode { @@ -69,11 +69,11 @@ public RaftNode(RaftContext context) { this.busyCounter = new AtomicInteger(); } - protected RaftContext context() { + private RaftContext context() { return this.context; } - protected Node node() { + Node node() { assert this.node != null; return this.node; } @@ -105,7 +105,7 @@ public void shutdown() { this.raftGroupService.join(); } catch (final InterruptedException e) { throw new RaftException( - "Interrupted while shutdown raftGroupService"); + "Interrupted while shutdown raftGroupService"); } } } @@ -147,7 +147,7 @@ public T submitAndWait(StoreCommand command, RaftStoreClosure future) { private void submitCommand(StoreCommand command, RaftStoreClosure future) { // Wait leader elected LeaderInfo leaderInfo = this.waitLeaderElected( - RaftContext.WAIT_LEADER_TIMEOUT); + RaftContext.WAIT_LEADER_TIMEOUT); // If myself is not leader, forward to the leader if (!leaderInfo.selfIsLeader) { this.context.rpcForwarder().forwardToLeader(leaderInfo.leaderId, @@ -171,7 +171,7 @@ private void submitCommand(StoreCommand command, RaftStoreClosure future) { this.node.apply(task); } - protected LeaderInfo waitLeaderElected(int timeout) { + LeaderInfo waitLeaderElected(int timeout) { String group = this.context.group(); LeaderInfo leaderInfo = this.leaderInfo.get(); if (leaderInfo.leaderId != null) { @@ -189,8 +189,8 @@ protected LeaderInfo waitLeaderElected(int timeout) { long consumedTime = System.currentTimeMillis() - beginTime; if (timeout > 0 && consumedTime >= timeout) { throw new BackendException( - "Waiting for raft group '%s' election timeout(%sms)", - group, consumedTime); + "Waiting for raft group '%s' election timeout(%sms)", + group, consumedTime); } leaderInfo = this.leaderInfo.get(); assert leaderInfo != null; @@ -199,7 +199,7 @@ protected LeaderInfo waitLeaderElected(int timeout) { return leaderInfo; } - protected void waitRaftLogSynced(int timeout) { + void waitRaftLogSynced(int timeout) { String group = this.context.group(); LOG.info("Waiting for raft group '{}' log synced", group); long beginTime = System.currentTimeMillis(); @@ -219,8 +219,8 @@ public void run(Status status, long index, byte[] reqCtx) { long consumedTime = System.currentTimeMillis() - beginTime; if (timeout > 0 && consumedTime >= timeout) { throw new BackendException( - "Waiting for raft group '%s' log synced timeout(%sms)", - group, consumedTime); + "Waiting for raft group '%s' log synced timeout(%sms)", + group, consumedTime); } } LOG.info("Waited for raft group '{}' log synced successfully", group); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java index ad9c397027..74f8f8b485 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java @@ -19,9 +19,10 @@ import java.util.function.Supplier; -import com.alipay.sofa.jraft.Status; import org.apache.hugegraph.util.E; +import com.alipay.sofa.jraft.Status; + public final class RaftResult { private final Status status; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java index 8c6c4fc7d4..69937737da 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java @@ -68,7 +68,7 @@ public static byte[] writeMutation(BackendMutation mutation) { // write mutation size buffer.writeVInt(mutation.size()); for (Iterator items = mutation.mutation(); - items.hasNext();) { + items.hasNext(); ) { BackendAction item = items.next(); // write Action buffer.write(item.action().code()); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java index f59899fb4d..dd9e6b8914 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java @@ -218,7 +218,7 @@ private String decompressSnapshot(SnapshotReader reader, archiveFile, parentPath, (end - begin) / 1000.0F); } catch (Throwable e) { throw new RaftException( - "Failed to decompress snapshot, zip=%s", e, archiveFile); + "Failed to decompress snapshot, zip=%s", e, archiveFile); } if (meta.hasChecksum()) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java index 81cb1af09d..df54a8276d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java @@ -23,6 +23,16 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; +import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.backend.serializer.BytesBuffer; +import org.apache.hugegraph.backend.store.BackendMutation; +import org.apache.hugegraph.backend.store.BackendStore; +import org.apache.hugegraph.backend.store.raft.RaftBackendStore.IncrCounter; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.LZ4Util; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.Closure; @@ -35,16 +45,6 @@ import com.alipay.sofa.jraft.error.RaftException; import com.alipay.sofa.jraft.storage.snapshot.SnapshotReader; import com.alipay.sofa.jraft.storage.snapshot.SnapshotWriter; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.raft.RaftBackendStore.IncrCounter; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.LZ4Util; -import org.apache.hugegraph.util.Log; public final class StoreStateMachine extends StateMachineAdapter { @@ -165,7 +165,7 @@ private Object applyCommand(StoreType type, StoreAction action, break; case COMMIT_TX: List mutations = StoreSerializer.readMutations( - buffer); + buffer); // RaftBackendStore doesn't write raft log for beginTx store.beginTx(); for (BackendMutation mutation : mutations) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java index 640807c9d5..2e17c456d1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java @@ -56,10 +56,10 @@ public static void init(final HugeConfig config) { // add parallel compress strategy if (compressStrategies[PARALLEL_STRATEGY] == null) { CompressStrategy compressStrategy = new ParallelCompressStrategy( - config.get(CoreOptions.RAFT_SNAPSHOT_COMPRESS_THREADS), - config.get(CoreOptions.RAFT_SNAPSHOT_DECOMPRESS_THREADS)); + config.get(CoreOptions.RAFT_SNAPSHOT_COMPRESS_THREADS), + config.get(CoreOptions.RAFT_SNAPSHOT_DECOMPRESS_THREADS)); CompressStrategyManager.addCompressStrategy( - CompressStrategyManager.PARALLEL_STRATEGY, compressStrategy); + CompressStrategyManager.PARALLEL_STRATEGY, compressStrategy); DEFAULT_STRATEGY = PARALLEL_STRATEGY; } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java index 040bebb68c..09b2b3e9e6 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java @@ -104,10 +104,10 @@ public void compressZip(String rootDir, String sourceDir, String outputZipFile, FileUtils.forceMkdir(zipFile.getParentFile()); ExecutorService compressExecutor = - newFixedPool(compressThreads, compressThreads, "raft-snapshot-compress-executor", - new ThreadPoolExecutor.CallerRunsPolicy()); + newFixedPool(compressThreads, compressThreads, "raft-snapshot-compress-executor", + new ThreadPoolExecutor.CallerRunsPolicy()); ZipArchiveScatterOutputStream scatterOutput = - new ZipArchiveScatterOutputStream(compressExecutor); + new ZipArchiveScatterOutputStream(compressExecutor); compressDirectoryToZipFile(rootFile, scatterOutput, sourceDir, ZipEntry.DEFLATED); try (FileOutputStream fos = new FileOutputStream(zipFile); @@ -127,9 +127,9 @@ public void decompressZip(String sourceZipFile, String outputDir, Checksum checksum) throws Throwable { LOG.info("Start to decompress snapshot in parallel mode"); ExecutorService decompressExecutor = - newFixedPool(decompressThreads, decompressThreads, - "raft-snapshot-decompress-executor", - new ThreadPoolExecutor.CallerRunsPolicy()); + newFixedPool(decompressThreads, decompressThreads, + "raft-snapshot-decompress-executor", + new ThreadPoolExecutor.CallerRunsPolicy()); // compute the checksum in a single thread Future checksumFuture = decompressExecutor.submit(() -> { computeZipFileChecksumValue(sourceZipFile, checksum); @@ -209,7 +209,7 @@ private void unZipFile(ZipFile zipFile, ZipArchiveEntry entry, try (InputStream is = zipFile.getInputStream(entry); BufferedInputStream fis = new BufferedInputStream(is); BufferedOutputStream bos = - new BufferedOutputStream(Files.newOutputStream(targetFile.toPath()))) { + new BufferedOutputStream(Files.newOutputStream(targetFile.toPath()))) { IOUtils.copy(fis, bos); } } @@ -219,7 +219,7 @@ private void unZipFile(ZipFile zipFile, ZipArchiveEntry entry, */ private void computeZipFileChecksumValue(String zipPath, Checksum checksum) throws Exception { try (BufferedInputStream bis = - new BufferedInputStream(Files.newInputStream(Paths.get(zipPath))); + new BufferedInputStream(Files.newInputStream(Paths.get(zipPath))); CheckedInputStream cis = new CheckedInputStream(bis, checksum); ZipArchiveInputStream zis = new ZipArchiveInputStream(cis)) { // checksum is calculated in the process diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java index d1bdbf004a..275de3fc23 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java @@ -17,19 +17,20 @@ package org.apache.hugegraph.backend.store.raft.rpc; -import com.alipay.sofa.jraft.rpc.RpcRequestClosure; -import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; -import com.google.protobuf.Message; import org.apache.hugegraph.backend.store.raft.RaftContext; import org.apache.hugegraph.backend.store.raft.RaftGroupManager; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.AddPeerRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.AddPeerResponse; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.util.Log; import org.slf4j.Logger; +import com.alipay.sofa.jraft.rpc.RpcRequestClosure; +import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; +import com.google.protobuf.Message; + public class AddPeerProcessor - extends RpcRequestProcessor { + extends RpcRequestProcessor { private static final Logger LOG = Log.logger(AddPeerProcessor.class); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java index 807092899c..ebe96b7a74 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java @@ -17,21 +17,21 @@ package org.apache.hugegraph.backend.store.raft.rpc; -import org.slf4j.Logger; - -import com.alipay.sofa.jraft.rpc.RpcRequestClosure; -import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; -import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.backend.store.raft.RaftContext; +import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.alipay.sofa.jraft.rpc.RpcRequestClosure; +import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; import com.google.common.collect.ImmutableList; import com.google.protobuf.Message; public class ListPeersProcessor - extends RpcRequestProcessor { + extends RpcRequestProcessor { private static final Logger LOG = Log.logger(ListPeersProcessor.class); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java index fd2ba2eac2..31d10f41d4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java @@ -17,19 +17,20 @@ package org.apache.hugegraph.backend.store.raft.rpc; -import com.alipay.sofa.jraft.rpc.RpcRequestClosure; -import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; -import com.google.protobuf.Message; import org.apache.hugegraph.backend.store.raft.RaftContext; import org.apache.hugegraph.backend.store.raft.RaftGroupManager; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.RemovePeerRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.RemovePeerResponse; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.util.Log; import org.slf4j.Logger; +import com.alipay.sofa.jraft.rpc.RpcRequestClosure; +import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; +import com.google.protobuf.Message; + public class RemovePeerProcessor - extends RpcRequestProcessor { + extends RpcRequestProcessor { private static final Logger LOG = Log.logger(RemovePeerProcessor.class); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java index a9f9d8ee69..0944f5cc39 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java @@ -19,8 +19,16 @@ import java.util.concurrent.ExecutionException; +import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.backend.store.raft.RaftClosure; +import org.apache.hugegraph.backend.store.raft.RaftContext; import org.apache.hugegraph.backend.store.raft.RaftStoreClosure; import org.apache.hugegraph.backend.store.raft.StoreCommand; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest; +import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.Node; @@ -31,14 +39,6 @@ import com.alipay.sofa.jraft.rpc.RaftClientService; import com.alipay.sofa.jraft.rpc.RpcResponseClosure; import com.alipay.sofa.jraft.util.Endpoint; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.raft.RaftClosure; -import org.apache.hugegraph.backend.store.raft.RaftContext; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest; -import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; import com.google.protobuf.Descriptors.FieldDescriptor; import com.google.protobuf.Message; import com.google.protobuf.ZeroByteStringHelper; @@ -77,10 +77,13 @@ public void forwardToLeader(PeerId leaderId, StoreCommand command, public void setResponse(StoreCommandResponse response) { if (response.getStatus()) { LOG.debug("StoreCommandResponse status ok"); - // This code forwards the request to the Raft leader and considers the operation successful + // This code forwards the request to the Raft leader and considers the + // operation successful // if it's forwarded successfully. It returns a RaftClosure because the calling - // logic expects a RaftClosure result. Specifically, if the current instance is the Raft leader, - // it executes the corresponding logic locally and notifies the calling logic asynchronously + // logic expects a RaftClosure result. Specifically, if the current instance + // is the Raft leader, + // it executes the corresponding logic locally and notifies the calling logic + // asynchronously // via RaftClosure. Therefore, the result is returned as a RaftClosure here. RaftClosure supplierFuture = new RaftClosure<>(); supplierFuture.complete(Status.OK()); @@ -90,10 +93,10 @@ public void setResponse(StoreCommandResponse response) { Status status = new Status(RaftError.UNKNOWN, "fowared request failed"); BackendException e = new BackendException( - "Current node isn't leader, leader " + - "is [%s], failed to forward request " + - "to leader: %s", - leaderId, response.getMessage()); + "Current node isn't leader, leader " + + "is [%s], failed to forward request " + + "to leader: %s", + leaderId, response.getMessage()); future.failure(status, e); } } @@ -133,10 +136,10 @@ public void setResponse(T response) { Status status = new Status(RaftError.UNKNOWN, "fowared request failed"); BackendException e = new BackendException( - "Current node isn't leader, leader " + - "is [%s], failed to forward request " + - "to leader: %s", - leaderId, commonResponse.getMessage()); + "Current node isn't leader, leader " + + "is [%s], failed to forward request " + + "to leader: %s", + leaderId, commonResponse.getMessage()); future.failure(status, e); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java index d9fa36323d..58589fe269 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java @@ -22,15 +22,15 @@ import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.rpc.RpcRequestClosure; import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; -import org.apache.hugegraph.util.Log; import com.google.protobuf.Message; public class SetLeaderProcessor - extends RpcRequestProcessor { + extends RpcRequestProcessor { private static final Logger LOG = Log.logger(SetLeaderProcessor.class); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java index 8739c22691..e8863c5129 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java @@ -25,18 +25,18 @@ import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse; import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; import com.alipay.sofa.jraft.rpc.RpcRequestClosure; import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; -import org.apache.hugegraph.util.Log; import com.google.protobuf.Message; public class StoreCommandProcessor - extends RpcRequestProcessor { + extends RpcRequestProcessor { private static final Logger LOG = Log.logger( - StoreCommandProcessor.class); + StoreCommandProcessor.class); private final RaftContext context; @@ -60,8 +60,8 @@ public Message processRequest(StoreCommandRequest request, LOG.warn("Failed to process StoreCommandRequest: {}", request.getAction(), e); StoreCommandResponse.Builder builder = StoreCommandResponse - .newBuilder() - .setStatus(false); + .newBuilder() + .setStatus(false); if (e.getMessage() != null) { builder.setMessage(e.getMessage()); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java index 0729f4b80f..f71c44acd1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java @@ -75,8 +75,8 @@ public final class RamTable { private static final int NULL = 0; private static final Condition BOTH_COND = Condition.or( - Condition.eq(HugeKeys.DIRECTION, Directions.OUT), - Condition.eq(HugeKeys.DIRECTION, Directions.IN)); + Condition.eq(HugeKeys.DIRECTION, Directions.OUT), + Condition.eq(HugeKeys.DIRECTION, Directions.IN)); private final HugeGraph graph; private final long verticesCapacity; @@ -145,7 +145,7 @@ private void loadFromFile(String fileName) throws Exception { File file = Paths.get(EXPORT_PATH, fileName).toFile(); if (!file.exists() || !file.isFile() || !file.canRead()) { throw new IllegalArgumentException(String.format( - "File '%s' does not existed or readable", fileName)); + "File '%s' does not existed or readable", fileName)); } try (FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); @@ -301,7 +301,7 @@ public Iterator query(Query query) { assert this.edgesSize() > 0; List cqs = ConditionQueryFlatten.flatten( - (ConditionQuery) query); + (ConditionQuery) query); if (cqs.size() == 1) { ConditionQuery cq = cqs.get(0); return this.query(cq); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java index 5611a43e11..43393252d2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java @@ -20,17 +20,15 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.query.QueryResults; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.Transaction; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.IdQuery; +import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.serializer.AbstractSerializer; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.backend.store.BackendEntryIterator; @@ -47,6 +45,8 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.collection.IdSet; +import org.slf4j.Logger; + import com.google.common.util.concurrent.RateLimiter; public abstract class AbstractTransaction implements Transaction { @@ -192,8 +192,8 @@ public BackendEntry get(HugeType type, Id id) { BackendEntry entry = this.query(type, id); if (entry == null) { throw new NotFoundException( - "Not found the %s entry with id '%s'", - type.readableName(), id); + "Not found the %s entry with id '%s'", + type.readableName(), id); } return entry; } @@ -387,7 +387,7 @@ public void commitOrRollback() { */ throw new BackendException("Failed to commit changes: %s(%s)", StringUtils.abbreviateMiddle( - e1.getMessage(), ".", 256), + e1.getMessage(), ".", 256), HugeException.rootCause(e1)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java index 1670f7db94..ba2680f09e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java @@ -32,15 +32,6 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.backend.page.PageIds; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.task.EphemeralJobQueue; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; @@ -51,7 +42,9 @@ import org.apache.hugegraph.backend.page.IdHolder.FixedIdHolder; import org.apache.hugegraph.backend.page.IdHolder.PagingIdHolder; import org.apache.hugegraph.backend.page.IdHolderList; +import org.apache.hugegraph.backend.page.PageIds; import org.apache.hugegraph.backend.page.PageInfo; +import org.apache.hugegraph.backend.page.PageState; import org.apache.hugegraph.backend.page.SortByCountIdHolderList; import org.apache.hugegraph.backend.query.Condition; import org.apache.hugegraph.backend.query.Condition.RangeConditions; @@ -63,6 +56,8 @@ import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.serializer.AbstractSerializer; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendStore; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.exception.NoIndexException; @@ -81,6 +76,7 @@ import org.apache.hugegraph.structure.HugeIndex.IdWithExpiredTime; import org.apache.hugegraph.structure.HugeProperty; import org.apache.hugegraph.structure.HugeVertex; +import org.apache.hugegraph.task.EphemeralJobQueue; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Action; import org.apache.hugegraph.type.define.HugeKeys; @@ -91,6 +87,10 @@ import org.apache.hugegraph.util.LockUtil; import org.apache.hugegraph.util.LongEncoding; import org.apache.hugegraph.util.NumericUtil; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -111,7 +111,7 @@ public GraphIndexTransaction(HugeGraphParams graph, BackendStore store) { final HugeConfig conf = graph.configuration(); this.indexIntersectThresh = - conf.get(CoreOptions.QUERY_INDEX_INTERSECT_THRESHOLD); + conf.get(CoreOptions.QUERY_INDEX_INTERSECT_THRESHOLD); } protected void asyncRemoveIndexLeft(ConditionQuery query, @@ -186,9 +186,10 @@ private void updateVertexOlapIndex(HugeVertex vertex, boolean removed) { /** * Update index(user properties) of vertex or edge - * @param ilId the id of index label - * @param element the properties owner - * @param removed remove or add index + * + * @param ilId the id of index label + * @param element the properties owner + * @param removed remove or add index */ protected void updateIndex(Id ilId, HugeElement element, boolean removed) { ISchemaTransaction schema = this.params().schemaTransaction(); @@ -242,7 +243,7 @@ protected void updateIndex(Id ilId, HugeElement element, boolean removed) { "Expect only one property in search index"); value = nnPropValues.get(0); Set words = - this.segmentWords(propertyValueToString(value)); + this.segmentWords(propertyValueToString(value)); for (String word : words) { this.updateIndex(indexLabel, word, element.id(), expiredTime, removed); @@ -263,7 +264,7 @@ protected void updateIndex(Id ilId, HugeElement element, boolean removed) { } else { for (int i = 0, n = nnPropValues.size(); i < n; i++) { List prefixValues = - nnPropValues.subList(0, i + 1); + nnPropValues.subList(0, i + 1); value = ConditionQuery.concatValues(prefixValues); this.updateIndex(indexLabel, value, element.id(), expiredTime, removed); @@ -282,15 +283,15 @@ protected void updateIndex(Id ilId, HugeElement element, boolean removed) { // TODO: add lock for updating unique index if (!removed && this.existUniqueValue(indexLabel, value, id)) { throw new IllegalArgumentException(String.format( - "Unique constraint %s conflict is found for %s", - indexLabel, element)); + "Unique constraint %s conflict is found for %s", + indexLabel, element)); } this.updateIndex(indexLabel, value, element.id(), expiredTime, removed); break; default: throw new AssertionError(String.format( - "Unknown index type '%s'", indexLabel.indexType())); + "Unknown index type '%s'", indexLabel.indexType())); } } @@ -355,8 +356,9 @@ private boolean existUniqueValueInStore(IndexLabel indexLabel, Object value) { * Single index, an index involving only one column. * Joint indexes, join of single indexes, composite indexes or mixed * of single indexes and composite indexes. + * * @param query original condition query - * @return converted id query + * @return converted id query */ @Watched(prefix = "index") public IdHolderList queryIndex(ConditionQuery query) { @@ -453,9 +455,9 @@ private IdHolderList queryByUserprop(ConditionQuery query) { PropertyKey propertyKey = this.graph().propertyKey(pkId); if (propertyKey.olap()) { throw new NotAllowException( - "Not allowed to query by olap property key '%s'" + - " when graph-read-mode is '%s'", - propertyKey, this.graph().readMode()); + "Not allowed to query by olap property key '%s'" + + " when graph-read-mode is '%s'", + propertyKey, this.graph().readMode()); } } } @@ -581,7 +583,7 @@ private IdHolder doJointIndex(IndexQueries queries) { } assert this.indexIntersectThresh > 0; // default value is 1000 Set ids = ((BatchIdHolder) holder).peekNext( - this.indexIntersectThresh).ids(); + this.indexIntersectThresh).ids(); if (ids.size() >= this.indexIntersectThresh) { // Transform into filtering filtering = true; @@ -619,7 +621,7 @@ private void storeSelectedIndexField(IndexLabel indexLabel, } ConditionQuery originConditionQuery = - query.originConditionQuery(); + query.originConditionQuery(); if (originConditionQuery != null) { originConditionQuery.selectedIndexField(indexLabel.indexField()); } @@ -743,8 +745,8 @@ private Set collectMatchedIndexes(ConditionQuery query) { schemaLabel = schema.getEdgeLabel(label); } else { throw new AssertionError(String.format( - "Unsupported index query type: %s", - query.resultType())); + "Unsupported index query type: %s", + query.resultType())); } schemaLabels = ImmutableList.of(schemaLabel); } else { @@ -755,8 +757,8 @@ private Set collectMatchedIndexes(ConditionQuery query) { schemaLabels = schema.getEdgeLabels(); } else { throw new AssertionError(String.format( - "Unsupported index query type: %s", - query.resultType())); + "Unsupported index query type: %s", + query.resultType())); } } @@ -773,8 +775,9 @@ private Set collectMatchedIndexes(ConditionQuery query) { /** * Collect matched IndexLabel(s) in a SchemaLabel for a query + * * @param schemaLabel find indexLabels of this schemaLabel - * @param query conditions container + * @param query conditions container * @return MatchedLabel object contains schemaLabel and matched indexLabels */ @Watched(prefix = "index") @@ -917,8 +920,8 @@ private void removeExpiredIndexIfNeeded(HugeIndex index, } private static Set matchSingleOrCompositeIndex( - ConditionQuery query, - Set indexLabels) { + ConditionQuery query, + Set indexLabels) { if (query.hasNeqCondition()) { return ImmutableSet.of(); } @@ -958,8 +961,8 @@ private static Set matchSingleOrCompositeIndex( * property-keys in query */ private static Set matchJointIndexes( - ConditionQuery query, - Set indexLabels) { + ConditionQuery query, + Set indexLabels) { if (query.hasNeqCondition()) { return ImmutableSet.of(); } @@ -1015,8 +1018,8 @@ private static Set matchJointIndexes( } private static Set matchRangeOrSearchIndexLabels( - ConditionQuery query, - Set indexLabels) { + ConditionQuery query, + Set indexLabels) { Set matchedIndexLabels = InsertionOrderUtil.newSet(); for (Relation relation : query.userpropRelations()) { if (!relation.relation().isRangeType() && @@ -1098,11 +1101,12 @@ private static IndexQueries buildJointIndexesQueries(ConditionQuery query, * Traverse C(m, n) combinations of a list to find first matched * result combination and call back with the result. * TODO: move this method to common module. - * @param all list to contain all items for combination - * @param m m of C(m, n) - * @param n n of C(m, n) + * + * @param all list to contain all items for combination + * @param m m of C(m, n) + * @param n n of C(m, n) * @param current current position in list - * @param result list to contains selected items + * @param result list to contains selected items * @return true if matched items combination else false */ private static boolean cmn(List all, int m, int n, @@ -1140,10 +1144,7 @@ private static boolean cmn(List all, int m, int n, } // Not select current item, continue to select C(m-1, n) result.remove(index); - if (cmn(all, m - 1, n, current, result, callback)) { - return true; - } - return false; + return cmn(all, m - 1, n, current, result, callback); } private static boolean shouldRecordIndexValue(ConditionQuery query, @@ -1154,8 +1155,8 @@ private static boolean shouldRecordIndexValue(ConditionQuery query, } private static IndexQueries constructJointSecondaryQueries( - ConditionQuery query, - List ils) { + ConditionQuery query, + List ils) { Set indexLabels = InsertionOrderUtil.newSet(); indexLabels.addAll(ils); indexLabels = matchJointIndexes(query, indexLabels); @@ -1241,8 +1242,8 @@ private static ConditionQuery constructQuery(ConditionQuery query, case RANGE_DOUBLE: if (query.userpropConditions().size() > 2) { throw new HugeException( - "Range query has two conditions at most, " + - "but got: %s", query.userpropConditions()); + "Range query has two conditions at most, " + + "but got: %s", query.userpropConditions()); } // Replace the query key with PROPERTY_VALUES, set number value indexQuery = new ConditionQuery(indexType.type(), query); @@ -1252,8 +1253,8 @@ private static ConditionQuery constructQuery(ConditionQuery query, Relation r = (Relation) condition; Number value = NumericUtil.convertToNumber(r.value()); Relation sys = new Condition.SyspropRelation( - HugeKeys.FIELD_VALUES, - r.relation(), value); + HugeKeys.FIELD_VALUES, + r.relation(), value); condition = condition.replace(r, sys); indexQuery.query(condition); } @@ -1263,13 +1264,13 @@ private static ConditionQuery constructQuery(ConditionQuery query, indexQuery = new ConditionQuery(type, query); indexQuery.eq(HugeKeys.INDEX_LABEL_ID, indexLabel.id()); List conditions = constructShardConditions( - query, indexLabel.indexFields(), - HugeKeys.FIELD_VALUES); + query, indexLabel.indexFields(), + HugeKeys.FIELD_VALUES); indexQuery.query(conditions); break; default: throw new AssertionError(String.format( - "Unknown index type '%s'", indexType)); + "Unknown index type '%s'", indexType)); } /* @@ -1287,9 +1288,9 @@ private static ConditionQuery constructQuery(ConditionQuery query, } protected static List constructShardConditions( - ConditionQuery query, - List fields, - HugeKeys key) { + ConditionQuery query, + List fields, + HugeKeys key) { List conditions = new ArrayList<>(2); boolean hasRange = false; int processedCondCount = 0; @@ -1380,9 +1381,9 @@ protected static List constructShardConditions( } private static Relation shardFieldValuesCondition(HugeKeys key, - List prefixes, - Object number, - RelationType type) { + List prefixes, + Object number, + RelationType type) { List values = new ArrayList<>(prefixes); String num = LongEncoding.encodeNumber(number); if (type == RelationType.LTE) { @@ -1488,9 +1489,9 @@ private static NoIndexException noIndexException(HugeGraph graph, ConditionQuery query, Id label) { String name = label == null ? "any label" : String.format("label '%s'", - query.resultType().isVertex() ? - graph.vertexLabel(label).name() : - graph.edgeLabel(label).name()); + query.resultType().isVertex() ? + graph.vertexLabel(label).name() : + graph.edgeLabel(label).name()); List mismatched = new ArrayList<>(); if (query.hasSecondaryCondition()) { mismatched.add("secondary"); @@ -1619,7 +1620,7 @@ public boolean equals(Object other) { } private static class IndexQueries - extends HashMap { + extends HashMap { private static final long serialVersionUID = 1400326138090922676L; private static final IndexQueries EMPTY = new IndexQueries(null); @@ -1664,7 +1665,7 @@ public Query rootQuery() { } public Query asJointQuery() { - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) Collection queries = (Collection) this.values(); return new JointQuery(this.rootQuery().resultType(), this.parentQuery, queries); @@ -1713,7 +1714,7 @@ private static Query parent(Collection queries) { } public static class RemoveLeftIndexJob extends EphemeralJob - implements EphemeralJobQueue.Reduce { + implements EphemeralJobQueue.Reduce { private static final String REMOVE_LEFT_INDEX = "remove_left_index"; @@ -1772,7 +1773,7 @@ protected long removeIndexLeft(ConditionQuery query, long rCount = 0; long sCount = 0; - for (ConditionQuery cq: ConditionQueryFlatten.flatten(query)) { + for (ConditionQuery cq : ConditionQueryFlatten.flatten(query)) { // Process range index rCount += this.processRangeIndexLeft(cq, element); // Process secondary index or search index @@ -1810,7 +1811,7 @@ private long processRangeIndexLeft(ConditionQuery query, private IndexLabel findMatchedIndexLabel(ConditionQuery query, ConditionQuery.LeftIndex - leftIndex) { + leftIndex) { Set matchedIndexes = this.tx.collectMatchedIndexes(query); for (MatchedIndex index : matchedIndexes) { for (IndexLabel label : index.indexLabels()) { @@ -1839,16 +1840,16 @@ private long processSecondaryOrSearchIndexLeft(ConditionQuery query, .map(PropertyKey::id) .collect(Collectors.toSet()); Collection incorrectIndexFields = CollectionUtil.intersect( - il.indexFields(), - incorrectPkIds); + il.indexFields(), + incorrectPkIds); if (incorrectIndexFields.isEmpty()) { continue; } // Skip if search index is not wrong if (il.indexType().isSearch()) { Id field = il.indexField(); - String cond = deletion.getPropertyValue(field); - String actual = element.getPropertyValue(field); + String cond = deletion.getPropertyValue(field); + String actual = element.getPropertyValue(field); if (this.tx.matchSearchIndexWords(actual, cond)) { /* * If query by two search index, one is correct but @@ -1880,8 +1881,8 @@ private long processSecondaryOrSearchIndexLeft(ConditionQuery query, } private HugeElement constructErrorElem( - ConditionQuery query, HugeElement element, - Map incorrectPKs) { + ConditionQuery query, HugeElement element, + Map incorrectPKs) { HugeElement errorElem = element.copyAsFresh(); Set propKeys = query.userpropKeys(); for (Id key : propKeys) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java index 23f396bcf5..a094631186 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java @@ -144,19 +144,19 @@ public GraphTransaction(HugeGraphParams graph, BackendStore store) { final HugeConfig conf = graph.configuration(); this.checkCustomVertexExist = - conf.get(CoreOptions.VERTEX_CHECK_CUSTOMIZED_ID_EXIST); + conf.get(CoreOptions.VERTEX_CHECK_CUSTOMIZED_ID_EXIST); this.checkAdjacentVertexExist = - conf.get(CoreOptions.VERTEX_ADJACENT_VERTEX_EXIST); + conf.get(CoreOptions.VERTEX_ADJACENT_VERTEX_EXIST); this.lazyLoadAdjacentVertex = - conf.get(CoreOptions.VERTEX_ADJACENT_VERTEX_LAZY); + conf.get(CoreOptions.VERTEX_ADJACENT_VERTEX_LAZY); this.removeLeftIndexOnOverwrite = - conf.get(CoreOptions.VERTEX_REMOVE_LEFT_INDEX); + conf.get(CoreOptions.VERTEX_REMOVE_LEFT_INDEX); this.commitPartOfAdjacentEdges = - conf.get(CoreOptions.VERTEX_PART_EDGE_COMMIT_SIZE); + conf.get(CoreOptions.VERTEX_PART_EDGE_COMMIT_SIZE); this.ignoreInvalidEntry = - conf.get(CoreOptions.QUERY_IGNORE_INVALID_DATA); + conf.get(CoreOptions.QUERY_IGNORE_INVALID_DATA); this.optimizeAggrByIndex = - conf.get(CoreOptions.QUERY_OPTIMIZE_AGGR_BY_INDEX); + conf.get(CoreOptions.QUERY_OPTIMIZE_AGGR_BY_INDEX); this.batchSize = conf.get(CoreOptions.QUERY_BATCH_SIZE); this.pageSize = conf.get(CoreOptions.QUERY_PAGE_SIZE); @@ -444,7 +444,7 @@ protected void prepareUpdates(Set> addedProps, // Eliminate the property(OUT and IN owner edge) this.doEliminate(this.serializer.writeEdgeProperty(prop)); this.doEliminate(this.serializer.writeEdgeProperty( - prop.switchEdgeOwner())); + prop.switchEdgeOwner())); } else { // Override edge(it will be in addedEdges & updatedEdges) this.addEdge(prop.element()); @@ -473,7 +473,7 @@ protected void prepareUpdates(Set> addedProps, // Append new property(OUT and IN owner edge) this.doAppend(this.serializer.writeEdgeProperty(prop)); this.doAppend(this.serializer.writeEdgeProperty( - prop.switchEdgeOwner())); + prop.switchEdgeOwner())); } else { // Override edge (it will be in addedEdges & updatedEdges) this.addEdge(prop.element()); @@ -535,7 +535,7 @@ public QueryResults query(Query query) { QueryList queries = this.optimizeQueries(query, super::query); LOG.debug("{}", queries); return queries.empty() ? QueryResults.empty() : - queries.fetch(this.pageSize); + queries.fetch(this.pageSize); } @Override @@ -810,7 +810,7 @@ protected Iterator queryVerticesByIds(Object[] vertexIds, if (vertex == null) { if (checkMustExist) { throw new NotFoundException( - "Vertex '%s' does not exist", id); + "Vertex '%s' does not exist", id); } else if (adjacentVertex) { assert !checkMustExist; // Return undefined if adjacentVertex but !checkMustExist @@ -1052,9 +1052,7 @@ protected Iterator queryEdgesFromBackend(Query query) { if (vertex == null) { return null; } - if (query.idsSize() == 1) { - assert vertex.getEdges().size() == 1; - } + assert query.idsSize() != 1 || vertex.getEdges().size() == 1; /* * Copy to avoid ConcurrentModificationException when removing edge * because HugeEdge.remove() will update edges in owner vertex @@ -1252,8 +1250,8 @@ public static ConditionQuery constructEdgesQuery(Id sourceVertex, // Edge direction if (direction == Directions.BOTH) { query.query(Condition.or( - Condition.eq(HugeKeys.DIRECTION, Directions.OUT), - Condition.eq(HugeKeys.DIRECTION, Directions.IN))); + Condition.eq(HugeKeys.DIRECTION, Directions.OUT), + Condition.eq(HugeKeys.DIRECTION, Directions.IN))); } else { assert direction == Directions.OUT || direction == Directions.IN; query.eq(HugeKeys.DIRECTION, direction); @@ -1414,8 +1412,8 @@ private static void verifyEdgesConditionQuery(ConditionQuery query) { if (matched != total) { throw new HugeException( - "Not supported querying edges by %s, expect %s", - query.conditions(), EdgeId.KEYS[count]); + "Not supported querying edges by %s, expect %s", + query.conditions(), EdgeId.KEYS[count]); } } @@ -1430,7 +1428,7 @@ private QueryList optimizeQueries(Query query, boolean supportIn = this.storeFeatures().supportsQueryWithInCondition(); for (ConditionQuery cq : ConditionQueryFlatten.flatten( - (ConditionQuery) query, supportIn)) { + (ConditionQuery) query, supportIn)) { // Optimize by sysprop Query q = this.optimizeQuery(cq); /* @@ -1450,7 +1448,7 @@ private QueryList optimizeQueries(Query query, private Query optimizeQuery(ConditionQuery query) { if (query.idsSize() > 0) { throw new HugeException( - "Not supported querying by id and conditions: %s", query); + "Not supported querying by id and conditions: %s", query); } Id label = query.condition(HugeKeys.LABEL); @@ -1492,7 +1490,7 @@ private Query optimizeQuery(ConditionQuery query) { // Serialize sort-values List keys = this.graph().edgeLabel(label).sortKeys(); List conditions = - GraphIndexTransaction.constructShardConditions( + GraphIndexTransaction.constructShardConditions( query, keys, HugeKeys.SORT_VALUES); query.query(conditions); /* @@ -1640,15 +1638,15 @@ private void checkNonnullProperty(HugeVertex vertex) { // Check whether passed all non-null property @SuppressWarnings("unchecked") Collection nonNullKeys = CollectionUtils.subtract( - vertexLabel.properties(), - vertexLabel.nullableKeys()); + vertexLabel.properties(), + vertexLabel.nullableKeys()); if (!keys.containsAll(nonNullKeys)) { @SuppressWarnings("unchecked") Collection missed = CollectionUtils.subtract(nonNullKeys, keys); HugeGraph graph = this.graph(); E.checkArgument(false, "All non-null property keys %s of " + - "vertex label '%s' must be set, missed keys %s", + "vertex label '%s' must be set, missed keys %s", graph.mapPkId2Name(nonNullKeys), vertexLabel.name(), graph.mapPkId2Name(missed)); } @@ -1675,11 +1673,11 @@ private void checkVertexExistIfCustomizedId(Map vertices) { HugeVertex newVertex = vertices.get(existedVertex.id()); if (!existedVertex.label().equals(newVertex.label())) { throw new HugeException( - "The newly added vertex with id:'%s' label:'%s' " + - "is not allowed to insert, because already exist " + - "a vertex with same id and different label:'%s'", - newVertex.id(), newVertex.label(), - existedVertex.label()); + "The newly added vertex with id:'%s' label:'%s' " + + "is not allowed to insert, because already exist " + + "a vertex with same id and different label:'%s'", + newVertex.id(), newVertex.label(), + existedVertex.label()); } } finally { CloseableIterator.closeIterator(results); @@ -1743,8 +1741,8 @@ private void removeLeftIndexIfNeeded(Map vertices) { } private Iterator filterUnmatchedRecords( - Iterator results, - Query query) { + Iterator results, + Query query) { // Filter unused or incorrect records return new FilterIterator<>(results, elem -> { // TODO: Left vertex/edge should to be auto removed via async task @@ -1763,12 +1761,9 @@ private Iterator filterUnmatchedRecords( return false; } // Process results that query from left index or primary-key - if (query.resultType().isVertex() == elem.type().isVertex() && - !rightResultFromIndexQuery(query, elem)) { - // Only index query will come here - return false; - } - return true; + // Only index query will come here + return query.resultType().isVertex() != elem.type().isVertex() || + rightResultFromIndexQuery(query, elem); }); } @@ -1820,7 +1815,7 @@ private boolean rightResultFromIndexQuery(Query query, HugeElement elem) { } private Iterator filterExpiredResultFromBackend( - Query query, Iterator results) { + Query query, Iterator results) { if (this.store().features().supportsTtl() || query.showExpired()) { return results; } @@ -1906,12 +1901,12 @@ private Iterator joinTxEdges(Query query, Iterator edges, } private Iterator joinTxRecords( - Query query, - Iterator records, - BiFunction matchFunc, - Map addedTxRecords, - Map removedTxRecords, - Map updatedTxRecords) { + Query query, + Iterator records, + BiFunction matchFunc, + Map addedTxRecords, + Map removedTxRecords, + Map updatedTxRecords) { this.checkOwnerThread(); // Return the origin results if there is no change in tx if (addedTxRecords.isEmpty() && @@ -1957,16 +1952,16 @@ private Iterator joinTxRecords( private void checkTxVerticesCapacity() throws LimitExceedException { if (this.verticesInTxSize() >= this.verticesCapacity) { throw new LimitExceedException( - "Vertices size has reached tx capacity %d", - this.verticesCapacity); + "Vertices size has reached tx capacity %d", + this.verticesCapacity); } } private void checkTxEdgesCapacity() throws LimitExceedException { if (this.edgesInTxSize() >= this.edgesCapacity) { throw new LimitExceedException( - "Edges size has reached tx capacity %d", - this.edgesCapacity); + "Edges size has reached tx capacity %d", + this.edgesCapacity); } } @@ -2109,7 +2104,7 @@ private void traverseByLabel(SchemaLabel label, HugeType type = label.type() == HugeType.VERTEX_LABEL ? HugeType.VERTEX : HugeType.EDGE; Query query = label.enableLabelIndex() ? new ConditionQuery(type) : - new Query(type); + new Query(type); query.capacity(Query.NO_CAPACITY); query.limit(Query.NO_LIMIT); if (this.store().features().supportsQueryByPage()) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java index e3ce7fd243..7c481b05c2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java @@ -17,10 +17,10 @@ package org.apache.hugegraph.backend.tx; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStore; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.BackendException; +import org.apache.hugegraph.backend.store.BackendMutation; +import org.apache.hugegraph.backend.store.BackendStore; public abstract class IndexableTransaction extends AbstractTransaction { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java index 54443fa0db..1fbade3190 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java @@ -19,15 +19,13 @@ import java.util.Iterator; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.store.BackendEntry; import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - -import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.SchemaElement; @@ -35,6 +33,7 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public class SchemaIndexTransaction extends AbstractTransaction { @@ -86,7 +85,7 @@ private QueryResults queryByName(ConditionQuery query) { IndexLabel il = IndexLabel.label(query.resultType()); String name = query.condition(HugeKeys.NAME); E.checkState(name != null, "The name in condition can't be null " + - "when querying schema by name"); + "when querying schema by name"); ConditionQuery indexQuery; indexQuery = new ConditionQuery(HugeType.SECONDARY_INDEX, query); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java index 8af1695ba6..1d7f595f0d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java @@ -23,21 +23,18 @@ import java.util.Set; import java.util.function.Consumer; -import org.apache.hugegraph.backend.query.ConditionQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.query.QueryResults; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.SystemSchemaStore; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.LocalCounter; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.backend.query.ConditionQuery; +import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.backend.query.QueryResults; +import org.apache.hugegraph.backend.store.BackendEntry; +import org.apache.hugegraph.backend.store.BackendStore; +import org.apache.hugegraph.backend.store.SystemSchemaStore; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.exception.NotAllowException; import org.apache.hugegraph.job.JobBuilder; @@ -66,6 +63,9 @@ import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.LockUtil; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; + import com.google.common.collect.ImmutableSet; public class SchemaTransaction extends IndexableTransaction implements ISchemaTransaction { @@ -160,9 +160,9 @@ public Id removePropertyKey(Id id) { for (VertexLabel vertexLabel : vertexLabels) { if (vertexLabel.properties().contains(id)) { throw new NotAllowException( - "Not allowed to remove property key: '%s' " + - "because the vertex label '%s' is still using it.", - propertyKey, vertexLabel.name()); + "Not allowed to remove property key: '%s' " + + "because the vertex label '%s' is still using it.", + propertyKey, vertexLabel.name()); } } @@ -170,9 +170,9 @@ public Id removePropertyKey(Id id) { for (EdgeLabel edgeLabel : edgeLabels) { if (edgeLabel.properties().contains(id)) { throw new NotAllowException( - "Not allowed to remove property key: '%s' " + - "because the edge label '%s' is still using it.", - propertyKey, edgeLabel.name()); + "Not allowed to remove property key: '%s' " + + "because the edge label '%s' is still using it.", + propertyKey, edgeLabel.name()); } } @@ -469,10 +469,11 @@ protected T getSchema(HugeType type, Id id) { /** * Currently doesn't allow to exist schema with the same name + * * @param type the query schema type * @param name the query schema name * @param SubClass of SchemaElement - * @return the queried schema object + * @return the queried schema object */ protected T getSchema(HugeType type, String name) { @@ -559,7 +560,7 @@ private BackendEntry serialize(SchemaElement schema) { return this.serializer.writeIndexLabel((IndexLabel) schema); default: throw new AssertionError(String.format( - "Unknown schema type '%s'", schema.type())); + "Unknown schema type '%s'", schema.type())); } } @@ -576,7 +577,7 @@ private T deserialize(BackendEntry entry, HugeType type) { return (T) this.serializer.readIndexLabel(this.graph(), entry); default: throw new AssertionError(String.format( - "Unknown schema type '%s'", type)); + "Unknown schema type '%s'", type)); } } @@ -620,7 +621,7 @@ private void checkIdAndUpdateNextId(HugeType type, Id id, return; } throw new IllegalStateException(String.format( - "Invalid system id '%s'", id)); + "Invalid system id '%s'", id)); } E.checkState(id.number() && id.asLong() > 0L, "Schema id must be number and >0, but got '%s'", id); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java index 388834b27e..39f0f0bd7c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java @@ -146,28 +146,28 @@ public static synchronized CoreOptions instance() { ); public static final ConfigOption RAFT_SNAPSHOT_PARALLEL_COMPRESS = - new ConfigOption<>( - "raft.snapshot_parallel_compress", - "Whether to enable parallel compress.", - disallowEmpty(), - false - ); + new ConfigOption<>( + "raft.snapshot_parallel_compress", + "Whether to enable parallel compress.", + disallowEmpty(), + false + ); public static final ConfigOption RAFT_SNAPSHOT_COMPRESS_THREADS = - new ConfigOption<>( - "raft.snapshot_compress_threads", - "The thread number used to do snapshot compress.", - rangeInt(0, Integer.MAX_VALUE), - 4 - ); + new ConfigOption<>( + "raft.snapshot_compress_threads", + "The thread number used to do snapshot compress.", + rangeInt(0, Integer.MAX_VALUE), + 4 + ); public static final ConfigOption RAFT_SNAPSHOT_DECOMPRESS_THREADS = - new ConfigOption<>( - "raft.snapshot_decompress_threads", - "The thread number used to do snapshot decompress.", - rangeInt(0, Integer.MAX_VALUE), - 4 - ); + new ConfigOption<>( + "raft.snapshot_decompress_threads", + "The thread number used to do snapshot decompress.", + rangeInt(0, Integer.MAX_VALUE), + 4 + ); public static final ConfigOption RAFT_BACKEND_THREADS = new ConfigOption<>( @@ -446,7 +446,7 @@ public static synchronized CoreOptions instance() { new ConfigOption<>( "edge.tx_capacity", "The max size(items) of edges(uncommitted) in " + - "transaction.", + "transaction.", rangeInt(COMMIT_BATCH, 1000000), 10000 ); @@ -629,7 +629,7 @@ public static synchronized CoreOptions instance() { "Specify the mode for the text analyzer, " + "the available mode of analyzer are " + "ansj: [BaseAnalysis, IndexAnalysis, ToAnalysis, " + - "NlpAnalysis], " + + "NlpAnalysis], " + "hanlp: [standard, nlp, index, nShort, shortest, speed], " + "smartcn: [], " + "jieba: [SEARCH, INDEX], " + diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java index b9154e56cd..71733fa588 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java @@ -23,7 +23,7 @@ public class HugeGraphIoRegistry extends AbstractIoRegistry { private static final HugeGraphIoRegistry INSTANCE = - new HugeGraphIoRegistry(); + new HugeGraphIoRegistry(); public static HugeGraphIoRegistry instance() { return INSTANCE; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java index c641a26687..416c3b0e4c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java @@ -29,6 +29,7 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hugegraph.HugeException; import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; @@ -40,6 +41,10 @@ import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.structure.HugeEdge; +import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.structure.HugeProperty; +import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.Blob; import org.apache.tinkerpop.gremlin.process.traversal.Path; @@ -64,12 +69,6 @@ import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer; import org.apache.tinkerpop.shaded.jackson.databind.ser.std.UUIDSerializer; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.structure.HugeEdge; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeProperty; -import org.apache.hugegraph.structure.HugeVertex; - @SuppressWarnings("serial") public class HugeGraphSONModule extends TinkerPopJacksonModule { @@ -83,7 +82,7 @@ public class HugeGraphSONModule extends TinkerPopJacksonModule { private static final Map TYPE_DEFINITIONS; private static final GraphSONSchemaSerializer SCHEMA_SERIALIZER = - new GraphSONSchemaSerializer(); + new GraphSONSchemaSerializer(); // NOTE: jackson will synchronize DateFormat private static final String DF = "yyyy-MM-dd HH:mm:ss.SSS"; @@ -158,7 +157,7 @@ public static void registerCommonSerializers(SimpleModule module) { module.addSerializer(Date.class, new DateSerializer(useTimestamp, DATE_FORMAT)); module.addDeserializer(Date.class, new DateDeserializer( - new DateDeserializer(), DATE_FORMAT, DF)); + new DateDeserializer(), DATE_FORMAT, DF)); module.addSerializer(UUID.class, new UUIDSerializer()); module.addDeserializer(UUID.class, new UUIDDeserializer()); @@ -220,7 +219,7 @@ public OptionalSerializer() { public void serialize(Optional optional, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { if (optional.isPresent()) { jsonGenerator.writeObject(optional.get()); } else { @@ -239,7 +238,7 @@ public IdSerializer(Class clazz) { public void serialize(T value, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { if (value.number()) { jsonGenerator.writeNumber(value.asLong()); } else { @@ -252,7 +251,7 @@ public void serializeWithType(T value, JsonGenerator jsonGenerator, SerializerProvider provider, TypeSerializer typeSer) - throws IOException { + throws IOException { // https://github.com/FasterXML/jackson-databind/issues/2320 WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING); typeSer.writeTypePrefix(jsonGenerator, typeId); @@ -262,7 +261,7 @@ public void serializeWithType(T value, } private static class IdDeserializer - extends StdDeserializer { + extends StdDeserializer { public IdDeserializer(Class clazz) { super(clazz); @@ -272,7 +271,7 @@ public IdDeserializer(Class clazz) { @Override public T deserialize(JsonParser jsonParser, DeserializationContext ctxt) - throws IOException { + throws IOException { Class clazz = this.handledType(); if (clazz.equals(LongId.class)) { Number idValue = ctxt.readValue(jsonParser, Number.class); @@ -292,7 +291,7 @@ public T deserialize(JsonParser jsonParser, } private static class PropertyKeySerializer - extends StdSerializer { + extends StdSerializer { public PropertyKeySerializer() { super(PropertyKey.class); @@ -302,13 +301,13 @@ public PropertyKeySerializer() { public void serialize(PropertyKey pk, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writePropertyKey(pk)); } } private static class VertexLabelSerializer - extends StdSerializer { + extends StdSerializer { public VertexLabelSerializer() { super(VertexLabel.class); @@ -318,7 +317,7 @@ public VertexLabelSerializer() { public void serialize(VertexLabel vl, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeVertexLabel(vl)); } } @@ -333,13 +332,13 @@ public EdgeLabelSerializer() { public void serialize(EdgeLabel el, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeEdgeLabel(el)); } } private static class IndexLabelSerializer - extends StdSerializer { + extends StdSerializer { public IndexLabelSerializer() { super(IndexLabel.class); @@ -349,14 +348,14 @@ public IndexLabelSerializer() { public void serialize(IndexLabel il, JsonGenerator jsonGenerator, SerializerProvider provider) - throws IOException { + throws IOException { writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeIndexLabel(il)); } } private static void writeEntry(JsonGenerator jsonGenerator, Map schema) - throws IOException { + throws IOException { jsonGenerator.writeStartObject(); for (Map.Entry entry : schema.entrySet()) { jsonGenerator.writeFieldName(entry.getKey().string()); @@ -366,7 +365,7 @@ private static void writeEntry(JsonGenerator jsonGenerator, } protected abstract static class HugeElementSerializer - extends StdSerializer { + extends StdSerializer { public HugeElementSerializer(Class clazz) { super(clazz); @@ -374,7 +373,7 @@ public HugeElementSerializer(Class clazz) { public void writeIdField(String fieldName, Id id, JsonGenerator generator) - throws IOException { + throws IOException { generator.writeFieldName(fieldName); if (id.number()) { generator.writeNumber(id.asLong()); @@ -386,7 +385,7 @@ public void writeIdField(String fieldName, Id id, public void writePropertiesField(Collection> properties, JsonGenerator generator, SerializerProvider provider) - throws IOException { + throws IOException { // Start write properties generator.writeFieldName("properties"); generator.writeStartObject(); @@ -405,8 +404,8 @@ public void writePropertiesField(Collection> properties, } } catch (IOException e) { throw new HugeException( - "Failed to serialize property(%s: %s) " + - "for vertex '%s'", key, val, property.element()); + "Failed to serialize property(%s: %s) " + + "for vertex '%s'", key, val, property.element()); } } // End write properties @@ -415,7 +414,7 @@ public void writePropertiesField(Collection> properties, } private static class HugeVertexSerializer - extends HugeElementSerializer { + extends HugeElementSerializer { public HugeVertexSerializer() { super(HugeVertex.class); @@ -424,7 +423,7 @@ public HugeVertexSerializer() { @Override public void serialize(HugeVertex vertex, JsonGenerator generator, SerializerProvider provider) - throws IOException { + throws IOException { vertex.forceLoad(); generator.writeStartObject(); @@ -442,7 +441,7 @@ public void serialize(HugeVertex vertex, JsonGenerator generator, public void serializeWithType(HugeVertex value, JsonGenerator generator, SerializerProvider provider, TypeSerializer typeSer) - throws IOException { + throws IOException { WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING); typeSer.writeTypePrefix(generator, typeId); this.serialize(value, generator, provider); @@ -451,7 +450,7 @@ public void serializeWithType(HugeVertex value, JsonGenerator generator, } private static class HugeEdgeSerializer - extends HugeElementSerializer { + extends HugeElementSerializer { public HugeEdgeSerializer() { super(HugeEdge.class); @@ -460,7 +459,7 @@ public HugeEdgeSerializer() { @Override public void serialize(HugeEdge edge, JsonGenerator generator, SerializerProvider provider) - throws IOException { + throws IOException { edge.forceLoad(); generator.writeStartObject(); @@ -486,7 +485,7 @@ public void serialize(HugeEdge edge, JsonGenerator generator, public void serializeWithType(HugeEdge value, JsonGenerator generator, SerializerProvider provider, TypeSerializer typeSer) - throws IOException { + throws IOException { WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING); typeSer.writeTypePrefix(generator, typeId); this.serialize(value, generator, provider); @@ -591,7 +590,7 @@ public BlobDeserializer() { @Override public Blob deserialize(JsonParser jsonParser, DeserializationContext ctxt) - throws IOException { + throws IOException { byte[] bytes = jsonParser.getBinaryValue(); return Blob.wrap(bytes); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java index 334eba96f8..0feee228f6 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java @@ -40,7 +40,7 @@ public class HugeGryoModule { private static GraphSONSchemaSerializer schemaSerializer = - new GraphSONSchemaSerializer(); + new GraphSONSchemaSerializer(); public static void register(HugeGraphIoRegistry io) { io.register(GryoIo.class, Optional.class, new OptionalSerializer()); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java index 6665304b69..5e1f93e145 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java @@ -22,8 +22,8 @@ import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.job.computer.Computer; import org.apache.hugegraph.job.computer.ComputerPool; -import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; public class ComputerJob extends SysJob { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java index 81e9e3d24d..a8a0966fa7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java @@ -17,11 +17,11 @@ package org.apache.hugegraph.job; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.task.HugeTask; import org.apache.hugegraph.task.TaskScheduler; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.util.E; public class EphemeralJobBuilder { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java index 491fe29422..8bde61feb4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java @@ -23,10 +23,10 @@ import java.util.Map; import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.exception.LimitExceedException; import org.apache.hugegraph.traversal.optimize.HugeScriptTraversal; import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; public class GremlinJob extends UserJob { @@ -71,9 +71,9 @@ public Object execute() throws Exception { bindings.put(TASK_BIND_NAME, new GremlinJobProxy()); HugeScriptTraversal traversal = new HugeScriptTraversal<>( - this.graph().traversal(), - language, gremlin, - bindings, aliases); + this.graph().traversal(), + language, gremlin, + bindings, aliases); List results = new ArrayList<>(); long capacity = Query.defaultCapacity(Query.NO_CAPACITY); try { @@ -105,8 +105,8 @@ private void checkResultsSize(Object results) { } if (size > TASK_RESULTS_MAX_SIZE) { throw new LimitExceedException( - "Job results size %s has exceeded the max limit %s", - size, TASK_RESULTS_MAX_SIZE); + "Job results size %s has exceeded the max limit %s", + size, TASK_RESULTS_MAX_SIZE); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java index 11868a5601..fc7067b419 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java @@ -19,12 +19,12 @@ import java.util.Set; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.task.HugeTask; import org.apache.hugegraph.task.TaskCallable; import org.apache.hugegraph.task.TaskScheduler; import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.util.E; public class JobBuilder { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java index 51cde31f65..0e249ebe25 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java @@ -29,18 +29,10 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.mutable.MutableLong; +import org.apache.hugegraph.HugeException; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.Query; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.Transaction; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - -import org.apache.hugegraph.HugeException; import org.apache.hugegraph.iterator.FilterIterator; import org.apache.hugegraph.iterator.FlatMapperIterator; import org.apache.hugegraph.job.UserJob; @@ -55,6 +47,14 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.ParameterUtil; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Transaction; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; + import com.google.common.base.Objects; @SuppressWarnings("deprecation") // StringEscapeUtils @@ -87,7 +87,7 @@ public abstract class AbstractAlgorithm implements Algorithm { public static final String KEY_TIMES = "times"; public static final String KEY_STABLE_TIMES = "stable_times"; public static final String KEY_PRECISION = "precision"; - public static final String KEY_SHOW_MOD= "show_modularity"; + public static final String KEY_SHOW_MOD = "show_modularity"; public static final String KEY_SHOW_COMM = "show_community"; public static final String KEY_EXPORT_COMM = "export_community"; public static final String KEY_SKIP_ISOLATED = "skip_isolated"; @@ -104,7 +104,7 @@ public abstract class AbstractAlgorithm implements Algorithm { public static final long DEFAULT_DEGREE = 100L; public static final long DEFAULT_SAMPLE = 1L; public static final long DEFAULT_TIMES = 20L; - public static final long DEFAULT_STABLE_TIMES= 3L; + public static final long DEFAULT_STABLE_TIMES = 3L; public static final double DEFAULT_PRECISION = 1.0 / 1000; public static final double DEFAULT_ALPHA = 0.5D; @@ -267,13 +267,13 @@ protected static Directions parseDirection(Object direction) { return Directions.IN; } else { throw new IllegalArgumentException(String.format( - "The value of direction must be in [OUT, IN, BOTH], " + - "but got '%s'", direction)); + "The value of direction must be in [OUT, IN, BOTH], " + + "but got '%s'", direction)); } } public static class AlgoTraverser extends HugeTraverser - implements AutoCloseable { + implements AutoCloseable { private final UserJob job; protected final ExecutorService executor; @@ -369,7 +369,7 @@ protected Iterator vertices(Object label, String key, if (value != null) { vertices = filter(vertices, key, value); } - return vertices; + return vertices; } protected Iterator vertices(Object label, long limit) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java index 3644ab67be..0a73e2037d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java @@ -20,9 +20,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.hugegraph.job.algorithm.path.RingsDetectAlgorithm; -import org.apache.hugegraph.job.algorithm.rank.PageRankAlgorithm; -import org.apache.hugegraph.job.algorithm.similarity.FusiformSimilarityAlgorithm; import org.apache.hugegraph.job.algorithm.cent.BetweennessCentralityAlgorithm; import org.apache.hugegraph.job.algorithm.cent.BetweennessCentralityAlgorithmV2; import org.apache.hugegraph.job.algorithm.cent.ClosenessCentralityAlgorithm; @@ -37,6 +34,9 @@ import org.apache.hugegraph.job.algorithm.comm.LpaAlgorithm; import org.apache.hugegraph.job.algorithm.comm.TriangleCountAlgorithm; import org.apache.hugegraph.job.algorithm.comm.WeakConnectedComponent; +import org.apache.hugegraph.job.algorithm.path.RingsDetectAlgorithm; +import org.apache.hugegraph.job.algorithm.rank.PageRankAlgorithm; +import org.apache.hugegraph.job.algorithm.similarity.FusiformSimilarityAlgorithm; import org.apache.hugegraph.util.E; public class AlgorithmPool { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java index b3d12f9f9f..4a6cda246e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java @@ -24,15 +24,14 @@ import java.util.Stack; import org.apache.hugegraph.backend.id.Id; -import org.apache.tinkerpop.gremlin.structure.Edge; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.type.define.Directions; +import org.apache.tinkerpop.gremlin.structure.Edge; public abstract class BfsTraverser - extends AbstractAlgorithm.AlgoTraverser - implements AutoCloseable { + extends AbstractAlgorithm.AlgoTraverser + implements AutoCloseable { private final Stack traversedVertices = new Stack<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java index bc4ece38b3..dc04bdf605 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java @@ -25,12 +25,11 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.task.TaskManager.ContextCallable; import org.apache.hugegraph.util.ExecutorUtil; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class Consumers { @@ -147,7 +146,7 @@ public void provide(V v) throws Throwable { try { this.queue.put(v); } catch (InterruptedException e) { - LOG.warn("Interrupted", e);; + LOG.warn("Interrupted", e); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java index 62252b7d4a..fd20f8a827 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java @@ -22,10 +22,9 @@ import java.util.Map; import org.apache.commons.lang3.mutable.MutableLong; -import org.apache.tinkerpop.gremlin.structure.Edge; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.util.JsonUtil; +import org.apache.tinkerpop.gremlin.structure.Edge; public class CountEdgeAlgorithm extends AbstractAlgorithm { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java index 960f8fc8f4..c325370b3b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java @@ -22,11 +22,10 @@ import java.util.Map; import org.apache.commons.lang3.mutable.MutableLong; +import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; - public class CountVertexAlgorithm extends AbstractAlgorithm { @Override diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java index 2bf2d36871..d6a1be8aa2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java @@ -21,15 +21,10 @@ import java.util.Map; import org.apache.commons.configuration2.PropertiesConfiguration; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.util.ParameterUtil; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.StandardHugeGraph; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.task.HugeTask; @@ -38,6 +33,11 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.util.ParameterUtil; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableMap; public class SubgraphStatAlgorithm extends AbstractAlgorithm { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java index 4a76b77cb7..8ab6ca81f7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java @@ -25,6 +25,13 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.iterator.MapperIterator; +import org.apache.hugegraph.job.UserJob; +import org.apache.hugegraph.job.algorithm.AbstractAlgorithm; +import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.structure.HugeVertex; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.process.traversal.Order; import org.apache.tinkerpop.gremlin.process.traversal.Pop; import org.apache.tinkerpop.gremlin.process.traversal.Scope; @@ -35,14 +42,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import org.apache.hugegraph.iterator.MapperIterator; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.job.algorithm.AbstractAlgorithm; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.Log; - public abstract class AbstractCentAlgorithm extends AbstractAlgorithm { private static final Logger LOG = Log.logger(AbstractCentAlgorithm.class); @@ -72,11 +71,11 @@ public Traverser(UserJob job) { } protected GraphTraversal constructSource( - String sourceLabel, - long sourceSample, - String sourceCLabel) { + String sourceLabel, + long sourceSample, + String sourceCLabel) { GraphTraversal t = this.graph().traversal() - .withSack(1f).V(); + .withSack(1f).V(); if (sourceLabel != null) { t = t.hasLabel(sourceLabel); @@ -95,9 +94,9 @@ protected GraphTraversal constructSource( } protected GraphTraversal constructPath( - GraphTraversal t, Directions dir, - String label, long degree, long sample, - String sourceLabel, String sourceCLabel) { + GraphTraversal t, Directions dir, + String label, long degree, long sample, + String sourceLabel, String sourceCLabel) { GraphTraversal unit = constructPathUnit(dir, label, degree, sample, sourceLabel, @@ -108,10 +107,10 @@ protected GraphTraversal constructPath( } protected GraphTraversal constructPathUnit( - Directions dir, String label, - long degree, long sample, - String sourceLabel, - String sourceCLabel) { + Directions dir, String label, + long degree, long sample, + String sourceLabel, + String sourceCLabel) { if (dir == null) { dir = Directions.BOTH; } @@ -139,10 +138,10 @@ protected GraphTraversal constructPathUnit( } protected GraphTraversal filterNonShortestPath( - GraphTraversal t, - boolean keepOneShortestPath) { + GraphTraversal t, + boolean keepOneShortestPath) { long size = this.graph().traversal().V().limit(100000L) - .count().next(); + .count().next(); Map, Integer> triples = new HashMap<>((int) size); return t.filter(it -> { Id start = it.path(Pop.first, "v").id(); @@ -168,15 +167,15 @@ protected GraphTraversal filterNonShortestPath( } protected GraphTraversal substractPath( - GraphTraversal t, - boolean withBoundary) { + GraphTraversal t, + boolean withBoundary) { // t.select(Pop.all, "v").unfold().id() return t.select(Pop.all, "v").flatMap(it -> { List path = (List) it.get(); if (withBoundary) { @SuppressWarnings("unchecked") Iterator items = (Iterator) - path.iterator(); + path.iterator(); return new MapperIterator<>(items, HugeVertex::id); } int len = path.size(); @@ -185,11 +184,11 @@ protected GraphTraversal substractPath( } LOG.debug("CentAlgorithm substract path: {}", path); - path.remove(path.size() -1); + path.remove(path.size() - 1); path.remove(0); @SuppressWarnings("unchecked") Iterator items = (Iterator) - path.iterator(); + path.iterator(); return new MapperIterator<>(items, HugeVertex::id); }); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java index b63bab4043..512d14a158 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java @@ -25,16 +25,15 @@ import org.apache.commons.lang3.mutable.MutableFloat; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.SplicingIdGenerator; +import org.apache.hugegraph.job.UserJob; +import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.type.define.Directions; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Pop; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.type.define.Directions; - public class BetweennessCentralityAlgorithm extends AbstractCentAlgorithm { @Override @@ -97,7 +96,7 @@ public Object betweennessCentrality(Directions direction, } protected GraphTraversal groupPathByEndpoints( - GraphTraversal t) { + GraphTraversal t) { return t.map(it -> { // t.select(Pop.all, "v").unfold().id() List path = it.path(Pop.all, "v"); @@ -112,13 +111,13 @@ public Object betweennessCentrality(Directions direction, List path = (List) it; assert path.size() >= 2; String first = path.get(0).toString(); - String last = path.get(path.size() -1).toString(); + String last = path.get(path.size() - 1).toString(); return SplicingIdGenerator.concat(first, last); }).unfold(); } protected GraphTraversal computeBetweenness( - GraphTraversal t) { + GraphTraversal t) { return t.fold(new HashMap(), (results, it) -> { @SuppressWarnings("unchecked") Map.Entry> entry = (Map.Entry>) it; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java index 63dd9210b6..d33dc54eb8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java @@ -24,13 +24,12 @@ import org.apache.commons.lang3.mutable.MutableFloat; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Query; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.job.algorithm.BfsTraverser; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.type.define.Directions; +import org.apache.tinkerpop.gremlin.structure.Vertex; public class BetweennessCentralityAlgorithmV2 extends AbstractCentAlgorithm { @@ -129,7 +128,7 @@ protected void backtrack(Id startVertex, Id currentVertex, return; } MutableFloat betweenness = this.globalBetweennesses.get( - currentVertex); + currentVertex); if (betweenness == null) { betweenness = new MutableFloat(0.0F); this.globalBetweennesses.put(currentVertex, betweenness); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java index cec4406154..db7eff5a48 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java @@ -19,6 +19,8 @@ import java.util.Map; +import org.apache.hugegraph.job.UserJob; +import org.apache.hugegraph.type.define.Directions; import org.apache.tinkerpop.gremlin.process.traversal.Operator; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Pop; @@ -27,9 +29,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.type.define.Directions; - public class ClosenessCentralityAlgorithm extends AbstractCentAlgorithm { public static final long DEFAULT_DEGREE = 100L; @@ -96,8 +95,8 @@ public Object closenessCentrality(Directions direction, */ GraphTraversal tg; tg = t.group().by(__.select(Pop.first, "v").id()) - .by(__.select(Pop.all, "v").count(Scope.local) - .math("_-1").sack(Operator.div).sack().sum()); + .by(__.select(Pop.all, "v").count(Scope.local) + .math("_-1").sack(Operator.div).sack().sum()); GraphTraversal tLimit = topN(tg, topN); return this.execute(tLimit, tLimit::next); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java index 3879f29dda..e95eae587c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java @@ -16,6 +16,10 @@ */ package org.apache.hugegraph.job.algorithm.cent; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.exception.NotSupportException; @@ -26,10 +30,6 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.tinkerpop.gremlin.structure.Vertex; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - public class ClosenessCentralityAlgorithmV2 extends AbstractCentAlgorithm { @Override diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java index 4c44d2632b..5a995d6dd7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java @@ -23,13 +23,12 @@ import java.util.Map; import org.apache.hugegraph.backend.id.Id; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.type.define.Directions; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; public class DegreeCentralityAlgorithm extends AbstractCentAlgorithm { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java index 13e4a6dc90..ef45587d41 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java @@ -19,14 +19,13 @@ import java.util.Map; +import org.apache.hugegraph.job.UserJob; +import org.apache.hugegraph.type.define.Directions; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.type.define.Directions; - public class EigenvectorCentralityAlgorithm extends AbstractCentAlgorithm { public static final long DEFAULT_DEGREE = 100L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java index 30890987b4..8371f73807 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java @@ -19,15 +19,14 @@ import java.util.Map; +import org.apache.hugegraph.job.UserJob; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.ParameterUtil; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.ParameterUtil; - public class StressCentralityAlgorithm extends AbstractCentAlgorithm { public static final String KEY_WITH_BOUNDARY = "with_boundary"; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java index 314c2b837d..5817e03867 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java @@ -24,13 +24,12 @@ import org.apache.commons.lang3.mutable.MutableLong; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Query; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.job.algorithm.BfsTraverser; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.type.define.Directions; +import org.apache.tinkerpop.gremlin.structure.Vertex; public class StressCentralityAlgorithmV2 extends AbstractCentAlgorithm { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java index 6399b86e66..e0f0ca5a6f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java @@ -73,7 +73,7 @@ public Object clusterCoefficient(Directions direction, long degree) { assert triangles <= triads; double coefficient = triads == 0L ? 0d : 1d * triangles / triads; - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) Map converted = (Map) results; converted.put("cluster_coefficient", coefficient); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java index 58a63986c9..e51aa27ac0 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java @@ -26,11 +26,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.mutable.MutableInt; -import org.apache.hugegraph.backend.id.Id; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; - import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser; import org.apache.hugegraph.type.define.Directions; @@ -38,6 +35,9 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.ParameterUtil; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; + import com.google.common.collect.ImmutableSet; public class KCoreAlgorithm extends AbstractCommAlgorithm { @@ -198,7 +198,7 @@ private static Set extractKcore(SimilarsMap similarsMap, int k) { .iterator().next(); Id source = entry.getKey(); Set similars = new HashSet<>(); - for (Similar similar: entry.getValue()) { + for (Similar similar : entry.getValue()) { similars.add(new KcoreSimilar(similar)); } @@ -236,7 +236,8 @@ private static Set extractKcore(SimilarsMap similarsMap, int k) { } Set survivedIds = new HashSet<>(CollectionUtils - .subtract(similar.ids(), failedIds)); + .subtract(similar.ids(), + failedIds)); if (survivedIds.size() < k) { for (Id id : survivedIds) { counts.get(id).decrement(); @@ -247,7 +248,7 @@ private static Set extractKcore(SimilarsMap similarsMap, int k) { } } similars = new HashSet<>(CollectionUtils.subtract( - similars, failedSimilars)); + similars, failedSimilars)); } while (!stop); if (similars.isEmpty()) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java index 5b5a8ca5f8..17bfd22ad2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java @@ -62,8 +62,8 @@ public Object call(UserJob job, Map parameters) { Long exportPass = exportCommunity(parameters); try (LouvainTraverser traverser = new LouvainTraverser( - job, workers, degree, - label, clabel, skipIsolated)) { + job, workers, degree, + label, clabel, skipIsolated)) { if (clearPass != null) { return traverser.clearPass(clearPass.intValue()); } else if (modPass != null) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java index 8b8158b16e..6b125d6895 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java @@ -40,28 +40,28 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.job.algorithm.Consumers; -import org.apache.hugegraph.schema.SchemaLabel; -import org.apache.hugegraph.schema.SchemaManager; -import org.apache.hugegraph.schema.VertexLabel; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.exception.ExistedException; import org.apache.hugegraph.iterator.ListIterator; import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.job.algorithm.AbstractAlgorithm; import org.apache.hugegraph.job.algorithm.AbstractAlgorithm.AlgoTraverser; +import org.apache.hugegraph.job.algorithm.Consumers; +import org.apache.hugegraph.schema.SchemaLabel; +import org.apache.hugegraph.schema.SchemaManager; +import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.StringEncoding; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableMap; public class LouvainTraverser extends AlgoTraverser { @@ -107,7 +107,7 @@ private void defineSchemaOfPk() { if (this.graph().existsVertexLabel(label) || this.graph().existsEdgeLabel(label)) { throw new IllegalArgumentException( - "Please clear historical results before proceeding"); + "Please clear historical results before proceeding"); } SchemaManager schema = this.graph().schema(); @@ -136,7 +136,7 @@ private void defineSchemaOfPassN(int pass) { .create(); } catch (ExistedException e) { throw new IllegalArgumentException( - "Please clear historical results before proceeding", e); + "Please clear historical results before proceeding", e); } } @@ -452,11 +452,11 @@ private void mergeCommunities(int pass) { LOG.info("Merge community for pass {}", pass); // merge each community as a vertex Collection>> comms = this.cache.communities(); - assert this.skipIsolated || this.allMembersExist(comms, pass - 1); + assert this.skipIsolated || this.allMembersExist(comms, pass - 1); this.cache.resetVertexWeight(); Consumers>> consumers = new Consumers<>( - this.executor, pair -> { + this.executor, pair -> { // called by multi-threads this.mergeCommunity(pass, pair.getLeft(), pair.getRight()); }, () -> { @@ -551,10 +551,10 @@ private boolean allMembersExist(int pass) { tryNext(this.g.V().hasLabel(label).count()).longValue(); } else { expected = tryNext(this.g.V().hasLabel(labelOfPassN(lastPass)) - .values(C_WEIGHT).sum()); + .values(C_WEIGHT).sum()); } Number actual = tryNext(this.g.V().hasLabel(label) - .values(C_WEIGHT).sum()); + .values(C_WEIGHT).sum()); boolean allExist = actual.floatValue() == expected.floatValue(); assert allExist : actual + "!=" + expected; return allExist; @@ -821,7 +821,7 @@ public boolean equals(Object object) { @Override public String toString() { return String.format("[%s](size=%s weight=%s kin=%s kout=%s)", - this.cid , this.size, this.weight, + this.cid, this.size, this.weight, this.kin, this.kout); } } @@ -900,7 +900,7 @@ public Id genId2(int pass, Id cid) { return IdGenerator.of(id); } - public Collection>> communities(){ + public Collection>> communities() { // TODO: get communities from backend store instead of ram Map>> comms = new HashMap<>(); for (Entry e : this.vertex2Community.entrySet()) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java index 70d677a0f6..6e92921284 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java @@ -27,15 +27,15 @@ import org.apache.commons.lang3.mutable.MutableInt; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.process.traversal.Scope; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.job.UserJob; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.E; import com.google.common.collect.ImmutableMap; public class LpaAlgorithm extends AbstractCommAlgorithm { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java index d26fde6e16..674ec50235 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java @@ -24,17 +24,17 @@ import java.util.Map; import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.schema.VertexLabel; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.schema.SchemaManager; +import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableMap; public class WeakConnectedComponent extends AbstractCommAlgorithm { @@ -101,16 +101,16 @@ public Object connectedComponent(int maxTimes, } } else { changeCount += this.findAndSetMinComponent( - currentSourceVertexId, - adjacentVertices); + currentSourceVertexId, + adjacentVertices); adjacentVertices = new ArrayList<>(); currentSourceVertexId = sourceVertexId; adjacentVertices.add(targetVertexId); } } changeCount += this.findAndSetMinComponent( - currentSourceVertexId, - adjacentVertices); + currentSourceVertexId, + adjacentVertices); LOG.debug("iterationTimes:{}, changeCount:{}", times, changeCount); @@ -145,7 +145,8 @@ private void initVertexComponentMap() { /** * process for a vertex and its adjacentVertices - * @param sourceVertexId the source vertex + * + * @param sourceVertexId the source vertex * @param adjacentVertices the adjacent vertices attached to source * vertex * @return the count of vertex that changed Component diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java index f5d43bb132..5c11c37e1f 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java @@ -17,27 +17,26 @@ package org.apache.hugegraph.job.algorithm.rank; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.traversal.algorithm.HugeTraverser; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - +import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.job.algorithm.comm.AbstractCommAlgorithm; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.structure.HugeVertex; +import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableMap; public class PageRankAlgorithm extends AbstractCommAlgorithm { @@ -96,11 +95,11 @@ public Traverser(UserJob job) { * If topN > 0, then return topN elements with rank value in json. */ private Object pageRank(double alpha, - int maxTimes, - double precision, - long degree, - Directions direction, - long topN) { + int maxTimes, + double precision, + long degree, + Directions direction, + long topN) { this.initSchema(); int times; @@ -155,10 +154,10 @@ private Object pageRank(double alpha, if (topN > 0) { Object topNJson = this.getTopRank(topN); return ImmutableMap.of("alpha", alpha, - "iteration_times", times, - "last_changed_rank", changedRank, - "times", maxTimes, - "top", topNJson); + "iteration_times", times, + "last_changed_rank", changedRank, + "times", maxTimes, + "top", topNJson); } return ImmutableMap.of("alpha", alpha, "iteration_times", times, diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java index 8462e1c95e..0d153091ee 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java @@ -20,8 +20,6 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicLong; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.job.UserJob; import org.apache.hugegraph.job.algorithm.AbstractAlgorithm; @@ -32,6 +30,7 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.ParameterUtil; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; public class FusiformSimilarityAlgorithm extends AbstractAlgorithm { @@ -164,7 +163,7 @@ public Object fusiformSimilars(String sourceLabel, String sourceCLabel, HugeGraph graph = this.graph(); FusiformSimilarityTraverser traverser = - new FusiformSimilarityTraverser(graph); + new FusiformSimilarityTraverser(graph); AtomicLong count = new AtomicLong(0L); JsonMap similarsJson = new JsonMap(); @@ -172,11 +171,11 @@ public Object fusiformSimilars(String sourceLabel, String sourceCLabel, this.traverse(sourceLabel, sourceCLabel, v -> { SimilarsMap similars = traverser.fusiformSimilarity( - IteratorUtils.of(v), direction, - label, minNeighbors, alpha, - minSimilars, (int) topSimilars, - groupProperty, minGroups, degree, - MAX_CAPACITY, NO_LIMIT, true); + IteratorUtils.of(v), direction, + label, minNeighbors, alpha, + minSimilars, (int) topSimilars, + groupProperty, minGroups, degree, + MAX_CAPACITY, NO_LIMIT, true); if (similars.isEmpty()) { return; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java index 73400b4620..5158ec7916 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java @@ -90,7 +90,7 @@ public Object call(Job job, Map parameters) { this.initializeConfig((ComputerJob) job); } catch (Exception e) { throw new HugeException( - "Failed to initialize computer config file", e); + "Failed to initialize computer config file", e); } // Set current computer job's specified parameters @@ -112,8 +112,8 @@ public Object call(Job job, Map parameters) { StringBuilder output = new StringBuilder(); try (LineNumberReader reader = new LineNumberReader( - new InputStreamReader( - process.getInputStream()))) { + new InputStreamReader( + process.getInputStream()))) { String line; while ((line = reader.readLine()) != null) { output.append(line).append("\n"); @@ -165,7 +165,7 @@ private Map readEnvConfig() { private Map readSubConfig(String sub) { List> nodes = - this.config.childConfigurationsAt(sub); + this.config.childConfigurationsAt(sub); E.checkArgument(nodes.size() >= 1, "'%s' must be contained in config '%s'", sub); @@ -176,9 +176,9 @@ private Map readSubConfig(String sub) { 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); + (nodeHandler = nodeModel.getNodeHandler()) != null && + (root = nodeHandler.getRootNode()) != null, + "Node '%s' must contain root", node); results.put(root.getNodeName(), root.getValue()); } @@ -198,7 +198,7 @@ private String[] constructShellCommands(Map configs) { } protected abstract Map checkAndCollectParameters( - Map parameters); + Map parameters); protected static int maxSteps(Map parameters) { if (!parameters.containsKey(MAX_STEPS)) { @@ -259,8 +259,8 @@ protected static Directions parseDirection(Object direction) { return Directions.IN; } else { throw new IllegalArgumentException(String.format( - "The value of direction must be in [OUT, IN, BOTH], " + - "but got '%s'", direction)); + "The value of direction must be in [OUT, IN, BOTH], " + + "but got '%s'", direction)); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java index cbc2aa4a8a..f907205024 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java @@ -19,9 +19,10 @@ import java.util.Map; -import org.apache.hugegraph.util.ParameterUtil; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.ParameterUtil; + import com.google.common.collect.ImmutableMap; public class LouvainComputer extends AbstractComputer { @@ -64,7 +65,7 @@ public void checkParameters(Map parameters) { @Override protected Map checkAndCollectParameters( - Map parameters) { + Map parameters) { return ImmutableMap.of(TIMES, times(parameters), PRECISION, precision(parameters), DIRECTION, direction(parameters), diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java index 61c6bb8dbf..89618ee7cf 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java @@ -21,6 +21,7 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.ParameterUtil; + import com.google.common.collect.ImmutableMap; public class LpaComputer extends AbstractComputer { @@ -51,7 +52,7 @@ public void checkParameters(Map parameters) { @Override protected Map checkAndCollectParameters( - Map parameters) { + Map parameters) { return ImmutableMap.of(TIMES, times(parameters), PROPERTY, property(parameters), PRECISION, precision(parameters), diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java index 89fe1b67ea..51388c08c0 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java @@ -21,6 +21,7 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.ParameterUtil; + import com.google.common.collect.ImmutableMap; public class PageRankComputer extends AbstractComputer { @@ -49,7 +50,7 @@ public void checkParameters(Map parameters) { @Override protected Map checkAndCollectParameters( - Map parameters) { + Map parameters) { return ImmutableMap.of(MAX_STEPS, maxSteps(parameters), ALPHA, alpha(parameters), PRECISION, precision(parameters)); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java index e794f4ba76..73206f24ac 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java @@ -43,7 +43,7 @@ public void checkParameters(Map parameters) { @Override protected Map checkAndCollectParameters( - Map parameters) { + Map parameters) { return ImmutableMap.of(DIRECTION, direction(parameters), DEGREE, degree(parameters)); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java index 60c740f2e1..d84522b289 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java @@ -43,7 +43,7 @@ public void checkParameters(Map parameters) { @Override protected Map checkAndCollectParameters( - Map parameters) { + Map parameters) { return ImmutableMap.of(MAX_STEPS, maxSteps(parameters), PRECISION, precision(parameters)); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java index 5d24fc332d..e8d3461e34 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java @@ -19,6 +19,7 @@ import java.util.Set; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; @@ -26,7 +27,7 @@ import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.LockUtil; -import org.apache.hugegraph.HugeGraphParams; + import com.google.common.collect.ImmutableSet; public class EdgeLabelRemoveJob extends SchemaJob { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java index 480a00d7ee..5e4acf92e9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java @@ -26,18 +26,18 @@ import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.SchemaStatus; -import org.apache.hugegraph.util.LockUtil; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.SchemaElement; import org.apache.hugegraph.schema.SchemaLabel; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeElement; +import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.type.define.SchemaStatus; +import org.apache.hugegraph.util.LockUtil; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; + import com.google.common.collect.ImmutableSet; public class IndexLabelRebuildJob extends SchemaJob { @@ -79,7 +79,7 @@ private void rebuildIndex(SchemaElement schema) { default: assert schema.type() == HugeType.PROPERTY_KEY; throw new AssertionError(String.format( - "The %s can't rebuild index", schema.type())); + "The %s can't rebuild index", schema.type())); } } @@ -186,7 +186,7 @@ private SchemaElement schemaElement() { return this.graph().indexLabel(id); default: throw new AssertionError(String.format( - "Invalid HugeType '%s' for rebuild", type)); + "Invalid HugeType '%s' for rebuild", type)); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java index 213ed949e8..b87978d8b2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java @@ -17,6 +17,7 @@ package org.apache.hugegraph.job.schema; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; @@ -24,7 +25,6 @@ import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.LockUtil; -import org.apache.hugegraph.HugeGraphParams; public class IndexLabelRemoveJob extends SchemaJob { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java index c94e5470fe..155a6b8bfa 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java @@ -17,6 +17,7 @@ package org.apache.hugegraph.job.schema; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; @@ -24,7 +25,6 @@ import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.LockUtil; -import org.apache.hugegraph.HugeGraphParams; public class OlapPropertyKeyClearJob extends IndexLabelRemoveJob { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java index 0ad9f4f055..ce399fe402 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java @@ -27,10 +27,9 @@ import org.apache.hugegraph.job.SysJob; import org.apache.hugegraph.schema.SchemaElement; import org.apache.hugegraph.type.HugeType; -import org.slf4j.Logger; - import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public abstract class SchemaJob extends SysJob { @@ -83,21 +82,22 @@ public static String formatTaskName(HugeType type, Id id, String name) { /** * Use reflection to call SchemaTransaction.removeSchema(), * which is protected - * @param tx The remove operation actual executer - * @param schema the schema to be removed + * + * @param tx The remove operation actual executer + * @param schema the schema to be removed */ protected static void removeSchema(ISchemaTransaction tx, SchemaElement schema) { try { - Method method = ISchemaTransaction.class - .getDeclaredMethod("removeSchema", - SchemaElement.class); + Method method = SchemaTransaction.class + .getDeclaredMethod("removeSchema", + SchemaElement.class); method.setAccessible(true); method.invoke(tx, schema); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new AssertionError( - "Can't call SchemaTransaction.removeSchema()", e); + "Can't call SchemaTransaction.removeSchema()", e); } } @@ -105,21 +105,22 @@ protected static void removeSchema(ISchemaTransaction tx, /** * Use reflection to call SchemaTransaction.updateSchema(), * which is protected - * @param tx The update operation actual execute - * @param schema the schema to be updated + * + * @param tx The update operation actual execute + * @param schema the schema to be updated */ protected static void updateSchema(SchemaTransaction tx, SchemaElement schema) { try { Method method = SchemaTransaction.class - .getDeclaredMethod("updateSchema", - SchemaElement.class); + .getDeclaredMethod("updateSchema", + SchemaElement.class); method.setAccessible(true); method.invoke(tx, schema); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new AssertionError( - "Can't call SchemaTransaction.updateSchema()", e); + "Can't call SchemaTransaction.updateSchema()", e); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java index 1bfdfaa687..86c059e8f7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.Set; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.ISchemaTransaction; @@ -28,8 +30,7 @@ import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.LockUtil; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraphParams; + import com.google.common.collect.ImmutableSet; public class VertexLabelRemoveJob extends SchemaJob { @@ -64,9 +65,9 @@ private static void removeVertexLabel(HugeGraphParams graph, Id id) { for (EdgeLabel edgeLabel : edgeLabels) { if (edgeLabel.linkWithLabel(id)) { throw new HugeException( - "Not allowed to remove vertex label '%s' " + - "because the edge label '%s' still link with it", - vertexLabel.name(), edgeLabel.name()); + "Not allowed to remove vertex label '%s' " + + "because the edge label '%s' still link with it", + vertexLabel.name(), edgeLabel.name()); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java index 57dcc397e9..493bbdde59 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java @@ -19,8 +19,8 @@ import java.util.Set; -import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.util.E; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java index c154716de1..5556febb89 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java @@ -20,12 +20,12 @@ import java.util.Iterator; import java.util.Set; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.query.IdQuery; import org.apache.hugegraph.backend.tx.GraphTransaction; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.structure.HugeIndex; +import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; public class DeleteExpiredIndexJob extends DeleteExpiredJob { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java index ca5fed6112..9ffa9e955b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java @@ -17,18 +17,17 @@ package org.apache.hugegraph.job.system; -import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.task.HugeTask; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.job.EphemeralJob; import org.apache.hugegraph.job.EphemeralJobBuilder; import org.apache.hugegraph.job.system.JobCounters.JobCounter; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.structure.HugeIndex; +import org.apache.hugegraph.task.HugeTask; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public abstract class DeleteExpiredJob extends EphemeralJob { @@ -77,7 +76,7 @@ public static void asyncDeleteExpiredObject(HugeGraph graph, V object) { } public static EphemeralJob newDeleteExpiredElementJob( - JobCounter jobCounter, V object) { + JobCounter jobCounter, V object) { if (object instanceof HugeElement) { return new DeleteExpiredElementJob<>(jobCounter.elements()); } else { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java index d117dbe6ed..8e76664096 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java @@ -21,8 +21,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.structure.HugeIndex; @@ -90,6 +90,7 @@ public boolean addAndTriggerDelete(Object object) { /** * Try to add element in collection waiting to be deleted + * * @param element * @return true if we should create a new delete job, false otherwise */ @@ -103,6 +104,7 @@ public boolean addElementAndTriggerDelete(HugeElement element) { /** * Try to add edge in collection waiting to be deleted + * * @param index * @return true if we should create a new delete job, false otherwise */ diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java index 1292693624..f85f29cc88 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java @@ -87,9 +87,9 @@ public int hashCode() { @Override public String toString() { return "RoleStateData{" + - "node='" + node + '\'' + - ", clock=" + clock + - ", epoch=" + epoch + - '}'; + "node='" + node + '\'' + + ", clock=" + clock + + ", epoch=" + epoch + + '}'; } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java index 9d04d1fc0f..748ec36bd0 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java @@ -23,7 +23,7 @@ import org.apache.hugegraph.config.ConfigOption; import org.apache.hugegraph.config.OptionHolder; -public class RoleElectionOptions extends OptionHolder { +public class RoleElectionOptions extends OptionHolder { private RoleElectionOptions() { super(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java index 716cf34e25..dbbea6d91e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java @@ -33,7 +33,7 @@ public class StandardRoleListener implements RoleListener { private volatile boolean selfIsMaster; - public StandardRoleListener(TaskManager taskManager, + public StandardRoleListener(TaskManager taskManager, GlobalMasterInfo roleInfo) { this.taskManager = taskManager; this.taskManager.enableRoleElection(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java index e21b3d7788..0b3b19ba7e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java @@ -22,13 +22,13 @@ import java.util.Iterator; import java.util.Set; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeFactory; +import org.apache.hugegraph.util.ReflectionUtil; import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin; import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer; import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath; public class HugeGraphGremlinPlugin extends AbstractGremlinPlugin { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java index d77c4816b6..7b7f87653c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java @@ -17,9 +17,9 @@ package org.apache.hugegraph.plugin; -import org.apache.hugegraph.backend.store.BackendProviderFactory; import org.apache.hugegraph.analyzer.AnalyzerFactory; import org.apache.hugegraph.backend.serializer.SerializerFactory; +import org.apache.hugegraph.backend.store.BackendProviderFactory; import org.apache.hugegraph.config.OptionSpace; public interface HugeGraphPlugin { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java index a1900770b4..be8d2d50f3 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java @@ -26,16 +26,16 @@ import java.util.Set; import java.util.stream.Collectors; -import org.apache.commons.lang3.tuple.Pair; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.schema.builder.SchemaBuilder; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.EdgeLabelType; import org.apache.hugegraph.type.define.Frequency; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.E; + import com.google.common.base.Objects; public class EdgeLabel extends SchemaLabel { @@ -179,7 +179,7 @@ public interface Builder extends SchemaBuilder { @Override public Map asMap() { - Map map = new HashMap<>(); + Map map = new HashMap<>(); if (this.sourceLabel() != null && this.sourceLabel() != NONE_ID) { map.put(P.SOURCE_LABEL, this.sourceLabel().asString()); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java index a97ee44e3a..e20a728c2b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java @@ -25,14 +25,15 @@ import java.util.Map; import java.util.stream.Collectors; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.schema.builder.SchemaBuilder; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.IndexType; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.E; + import com.google.common.base.Objects; public class IndexLabel extends SchemaElement { @@ -93,10 +94,10 @@ public HugeType queryType() { return HugeType.SYS_SCHEMA; default: throw new AssertionError(String.format( - "Query type of index label is either '%s' or '%s', " + - "but '%s' is used", - HugeType.VERTEX_LABEL, HugeType.EDGE_LABEL, - this.baseType)); + "Query type of index label is either '%s' or '%s', " + + "but '%s' is used", + HugeType.VERTEX_LABEL, HugeType.EDGE_LABEL, + this.baseType)); } } @@ -185,7 +186,7 @@ public static IndexLabel label(HugeType type) { return ILN_IL; default: throw new AssertionError(String.format( - "No primitive index label for '%s'", type)); + "No primitive index label for '%s'", type)); } } @@ -207,7 +208,7 @@ public static IndexLabel label(HugeGraph graph, Id id) { return ILN_IL; default: throw new AssertionError(String.format( - "No primitive index label for '%s'", id)); + "No primitive index label for '%s'", id)); } } return graph.indexLabel(id); @@ -243,8 +244,8 @@ public static SchemaLabel getBaseLabel(HugeGraph graph, break; default: throw new AssertionError(String.format( - "Unsupported base type '%s' of index label", - baseType)); + "Unsupported base type '%s' of index label", + baseType)); } E.checkArgumentNotNull(label, "Can't find the %s with name '%s'", diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java index 6198c7e5b8..64d5115d80 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java @@ -26,9 +26,9 @@ import java.util.Map; import java.util.Set; -import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.exception.NotSupportException; import org.apache.hugegraph.schema.builder.SchemaBuilder; @@ -145,7 +145,7 @@ public String clazz() { return String.format("List<%s>", dataType); default: throw new AssertionError(String.format( - "Unsupported cardinality: '%s'", this.cardinality)); + "Unsupported cardinality: '%s'", this.cardinality)); } } @@ -165,7 +165,7 @@ public Class implementClazz() { break; default: throw new AssertionError(String.format( - "Unsupported cardinality: '%s'", this.cardinality)); + "Unsupported cardinality: '%s'", this.cardinality)); } return cls; } @@ -192,10 +192,11 @@ public T newValue() { /** * Check property value valid + * * @param value the property value to be checked data type and cardinality - * @param the property value class + * @param the property value class * @return true if data type and cardinality satisfy requirements, - * otherwise false + * otherwise false */ public boolean checkValueType(V value) { boolean valid; @@ -214,17 +215,18 @@ public boolean checkValueType(V value) { break; default: throw new AssertionError(String.format( - "Unsupported cardinality: '%s'", this.cardinality)); + "Unsupported cardinality: '%s'", this.cardinality)); } return valid; } /** * Check type of the value valid + * * @param value the property value to be checked data type * @param the property value original data type * @return true if the value is or can convert to the data type, - * otherwise false + * otherwise false */ private boolean checkDataType(V value) { return this.dataType().clazz().isInstance(value); @@ -232,10 +234,11 @@ private boolean checkDataType(V value) { /** * Check type of all the values(maybe some list properties) valid + * * @param values the property values to be checked data type - * @param the property value class + * @param the property value class * @return true if all the values are or can convert to the data type, - * otherwise false + * otherwise false */ private boolean checkDataType(Collection values) { boolean valid = true; @@ -283,8 +286,8 @@ public V validValue(V value) { return this.convValue(value); } catch (RuntimeException e) { throw new IllegalArgumentException(String.format( - "Invalid property value '%s' for key '%s': %s", - value, this.name(), e.getMessage())); + "Invalid property value '%s' for key '%s': %s", + value, this.name(), e.getMessage())); } } @@ -415,7 +418,7 @@ public interface Builder extends SchemaBuilder { @Override public Map asMap() { - Map map = new HashMap<>(); + Map map = new HashMap<>(); if (this.dataType != null) { map.put(P.DATA_TYPE, this.dataType.string()); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java index 844a7d4274..966d3eed8a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java @@ -20,16 +20,16 @@ import java.util.Collections; import java.util.Map; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.tinkerpop.gremlin.structure.Graph; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.type.Typeable; import org.apache.hugegraph.type.define.SchemaStatus; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Graph; + import com.google.common.base.Objects; public abstract class SchemaElement implements Nameable, Typeable, @@ -163,7 +163,7 @@ public boolean equals(Object obj) { @Override public int hashCode() { - return this.type().hashCode() ^ this.id.hashCode(); + return this.type().hashCode() ^ this.id.hashCode(); } @Override diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java index 3a36be69de..e20a3f89dc 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java @@ -22,18 +22,19 @@ import java.util.HashSet; import java.util.Set; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.Indexable; import org.apache.hugegraph.type.Propertiable; import org.apache.hugegraph.util.E; + import com.google.common.base.Objects; public abstract class SchemaLabel extends SchemaElement - implements Indexable, Propertiable { + implements Indexable, Propertiable { private final Set properties; private final Set nullableKeys; @@ -167,13 +168,13 @@ public static Id getLabelId(HugeGraph graph, HugeType type, Object label) { return graph.edgeLabel((String) label).id(); } else { throw new HugeException( - "Not support query from '%s' with label '%s'", - type, label); + "Not support query from '%s' with label '%s'", + type, label); } } else { throw new HugeException( - "The label type must be number or string, but got '%s'", - label.getClass()); + "The label type must be number or string, but got '%s'", + label.getClass()); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java index d3851967a8..7ea46b0d7b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java @@ -20,11 +20,8 @@ import java.util.List; import java.util.stream.Collectors; -import org.apache.hugegraph.backend.tx.ISchemaTransaction; -import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.tinkerpop.gremlin.structure.Graph; - import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.builder.EdgeLabelBuilder; import org.apache.hugegraph.schema.builder.IndexLabelBuilder; @@ -32,6 +29,7 @@ import org.apache.hugegraph.schema.builder.VertexLabelBuilder; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Graph; public class SchemaManager { @@ -98,26 +96,26 @@ public IndexLabel getIndexLabel(String name) { public List getPropertyKeys() { return this.graph.propertyKeys().stream() - .filter(pk -> !Graph.Hidden.isHidden(pk.name())) - .collect(Collectors.toList()); + .filter(pk -> !Graph.Hidden.isHidden(pk.name())) + .collect(Collectors.toList()); } public List getVertexLabels() { return this.graph.vertexLabels().stream() - .filter(vl -> !Graph.Hidden.isHidden(vl.name())) - .collect(Collectors.toList()); + .filter(vl -> !Graph.Hidden.isHidden(vl.name())) + .collect(Collectors.toList()); } public List getEdgeLabels() { return this.graph.edgeLabels().stream() - .filter(el -> !Graph.Hidden.isHidden(el.name())) - .collect(Collectors.toList()); + .filter(el -> !Graph.Hidden.isHidden(el.name())) + .collect(Collectors.toList()); } public List getIndexLabels() { return this.graph.indexLabels().stream() - .filter(il -> !Graph.Hidden.isHidden(il.name())) - .collect(Collectors.toList()); + .filter(il -> !Graph.Hidden.isHidden(il.name())) + .collect(Collectors.toList()); } public void copyFrom(SchemaManager schema) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java index a3d2f6356f..d485e558b8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java @@ -47,8 +47,8 @@ public static void check(Userdata userdata, Action action) { for (Map.Entry e : userdata.entrySet()) { if (e.getValue() == null) { throw new NotAllowException( - "Not allowed to pass null userdata value " + - "when create or append schema"); + "Not allowed to pass null userdata value " + + "when create or append schema"); } } break; @@ -58,7 +58,7 @@ public static void check(Userdata userdata, Action action) { break; default: throw new AssertionError(String.format( - "Unknown schema action '%s'", action)); + "Unknown schema action '%s'", action)); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java index bfdd1439e8..3f62df8631 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java @@ -26,9 +26,9 @@ import java.util.Set; import java.util.stream.Collectors; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.schema.builder.SchemaBuilder; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.IdStrategy; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java index be13ea5283..fc01f0afe6 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java @@ -20,17 +20,17 @@ import java.util.Set; import java.util.function.Function; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; +import org.apache.hugegraph.exception.ExistedException; +import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.SchemaElement; import org.apache.hugegraph.schema.VertexLabel; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.exception.ExistedException; -import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.type.define.SchemaStatus; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java index 7c26f1839a..f7aa460e1e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java @@ -26,28 +26,28 @@ import java.util.Set; import org.apache.commons.collections.CollectionUtils; - +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.Userdata; -import org.apache.hugegraph.schema.VertexLabel; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.exception.ExistedException; import org.apache.hugegraph.exception.NotAllowException; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.EdgeLabel; +import org.apache.hugegraph.schema.PropertyKey; +import org.apache.hugegraph.schema.Userdata; +import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Action; import org.apache.hugegraph.type.define.Frequency; import org.apache.hugegraph.util.CollectionUtil; import org.apache.hugegraph.util.E; + import com.google.common.collect.ImmutableList; public class EdgeLabelBuilder extends AbstractBuilder - implements EdgeLabel.Builder { + implements EdgeLabel.Builder { private Id id; private String name; @@ -115,7 +115,7 @@ public EdgeLabel build() { edgeLabel.ttl(this.ttl); if (this.ttlStartTime != null) { edgeLabel.ttlStartTime(this.graph().propertyKey( - this.ttlStartTime).id()); + this.ttlStartTime).id()); } edgeLabel.enableLabelIndex(this.enableLabelIndex == null || this.enableLabelIndex); @@ -171,6 +171,7 @@ public EdgeLabel create() { * Only sourceId, targetId, frequency, enableLabelIndex, properties, sortKeys, * nullableKeys are checked. * The id, ttl, ttlStartTime, userdata are not checked. + * * @param existedEdgeLabel to be compared with * @return true if this has same properties with existedVertexLabel */ @@ -427,15 +428,15 @@ private void checkProperties(Action action) { case ELIMINATE: if (!this.properties.isEmpty()) { throw new NotAllowException( - "Not support to eliminate properties " + - "for edge label currently"); + "Not support to eliminate properties " + + "for edge label currently"); } break; case DELETE: break; default: throw new AssertionError(String.format( - "Unknown schema action '%s'", action)); + "Unknown schema action '%s'", action)); } } @@ -445,8 +446,8 @@ private void checkNullableKeys(Action action) { if (action == Action.ELIMINATE) { if (!this.nullableKeys.isEmpty()) { throw new NotAllowException( - "Not support to eliminate nullableKeys " + - "for edge label currently"); + "Not support to eliminate nullableKeys " + + "for edge label currently"); } return; } @@ -460,7 +461,7 @@ private void checkNullableKeys(Action action) { Set appendProps = this.properties; E.checkArgument(CollectionUtil.union(originProps, appendProps) - .containsAll(this.nullableKeys), + .containsAll(this.nullableKeys), "The nullableKeys: %s to be created or appended " + "must belong to the origin/new properties: %s/%s ", this.nullableKeys, originProps, appendProps); @@ -477,7 +478,7 @@ private void checkNullableKeys(Action action) { if (action == Action.APPEND) { Collection newAddedProps = CollectionUtils.subtract( - appendProps, originProps); + appendProps, originProps); E.checkArgument(this.nullableKeys.containsAll(newAddedProps), "The new added properties: %s must be nullable", newAddedProps); @@ -535,28 +536,28 @@ private void checkRelation() { private void checkStableVars() { if (this.sourceLabel != null) { throw new NotAllowException( - "Not allowed to update source label " + - "for edge label '%s', it must be null", this.name); + "Not allowed to update source label " + + "for edge label '%s', it must be null", this.name); } if (this.targetLabel != null) { throw new NotAllowException( - "Not allowed to update target label " + - "for edge label '%s', it must be null", this.name); + "Not allowed to update target label " + + "for edge label '%s', it must be null", this.name); } if (this.frequency != Frequency.DEFAULT) { throw new NotAllowException( - "Not allowed to update frequency " + - "for edge label '%s'", this.name); + "Not allowed to update frequency " + + "for edge label '%s'", this.name); } if (!this.sortKeys.isEmpty()) { throw new NotAllowException( - "Not allowed to update sort keys " + - "for edge label '%s'", this.name); + "Not allowed to update sort keys " + + "for edge label '%s'", this.name); } if (this.enableLabelIndex != null) { throw new NotAllowException( - "Not allowed to update enable_label_index " + - "for edge label '%s'", this.name); + "Not allowed to update enable_label_index " + + "for edge label '%s'", this.name); } } @@ -601,8 +602,8 @@ private void checkUserdata(Action action) { for (Map.Entry e : this.userdata.entrySet()) { if (e.getValue() == null) { throw new NotAllowException( - "Not allowed pass null userdata value when " + - "create or append edge label"); + "Not allowed pass null userdata value when " + + "create or append edge label"); } } break; @@ -612,7 +613,7 @@ private void checkUserdata(Action action) { break; default: throw new AssertionError(String.format( - "Unknown schema action '%s'", action)); + "Unknown schema action '%s'", action)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java index db758b10ed..2ca3534a99 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java @@ -25,12 +25,12 @@ import java.util.concurrent.TimeoutException; import java.util.function.BiPredicate; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.exception.ExistedException; import org.apache.hugegraph.exception.NotAllowException; @@ -53,7 +53,7 @@ import org.apache.hugegraph.util.collection.IdSet; public class IndexLabelBuilder extends AbstractBuilder - implements IndexLabel.Builder { + implements IndexLabel.Builder { private Id id; private String name; @@ -125,6 +125,7 @@ public IndexLabel build() { * Check whether this has same properties with existedIndexLabel. * Only baseType, baseValue, indexType, indexFields are checked. * The id, checkExist, userdata are not checked. + * * @param existedIndexLabel to be compared with * @return true if this has same properties with existedIndexLabel */ @@ -269,7 +270,7 @@ public IndexLabel create() { graph.taskScheduler().waitUntilTaskCompleted(task, timeout); } catch (TimeoutException e) { throw new HugeException( - "Failed to wait index-creating task completed", e); + "Failed to wait index-creating task completed", e); } // Return index label without task-info @@ -588,7 +589,7 @@ private void checkRepeatIndex(SchemaLabel schemaLabel) { break; default: throw new AssertionError(String.format( - "Unsupported index type: %s", this.indexType)); + "Unsupported index type: %s", this.indexType)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java index 98be4998d9..6ce6ddd847 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java @@ -20,20 +20,20 @@ import java.util.Map; import java.util.concurrent.TimeoutException; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.schema.Userdata; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.exception.ExistedException; import org.apache.hugegraph.exception.NotAllowException; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.exception.NotSupportException; +import org.apache.hugegraph.schema.PropertyKey; +import org.apache.hugegraph.schema.SchemaElement; +import org.apache.hugegraph.schema.Userdata; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Action; import org.apache.hugegraph.type.define.AggregateType; @@ -43,7 +43,7 @@ import org.apache.hugegraph.util.E; public class PropertyKeyBuilder extends AbstractBuilder - implements PropertyKey.Builder { + implements PropertyKey.Builder { private Id id; private String name; @@ -99,6 +99,7 @@ public PropertyKey build() { * Check whether this has same properties with propertyKey. * Only dataType, cardinality, aggregateType are checked. * The id, checkExist, userdata are not checked. + * * @param propertyKey to be compared with * @return true if this has same properties with propertyKey */ @@ -118,12 +119,9 @@ private boolean hasSameProperties(PropertyKey propertyKey) { return false; } - if (this.writeType != propertyKey.writeType()) { - return false; - } + return this.writeType == propertyKey.writeType(); // all properties are same, return true. - return true; } @Override @@ -157,7 +155,7 @@ public SchemaElement.TaskWithSchema createWithTask() { public PropertyKey create() { // Create index label async SchemaElement.TaskWithSchema propertyKeyWithTask = - this.createWithTask(); + this.createWithTask(); Id task = propertyKeyWithTask.task(); if (task == IdGenerator.ZERO) { @@ -175,7 +173,7 @@ public PropertyKey create() { graph.taskScheduler().waitUntilTaskCompleted(task, timeout); } catch (TimeoutException e) { throw new HugeException( - "Failed to wait property key create task completed", e); + "Failed to wait property key create task completed", e); } // Return property key without task-info @@ -425,17 +423,17 @@ private void checkAggregateType() { if (this.aggregateType.isSum() && this.dataType.isDate()) { throw new NotAllowException( - "Not allowed to set aggregate type '%s' for " + - "property key '%s' with data type '%s'", - this.aggregateType, this.name, this.dataType); + "Not allowed to set aggregate type '%s' for " + + "property key '%s' with data type '%s'", + this.aggregateType, this.name, this.dataType); } if (this.aggregateType.isNumber() && !this.dataType.isNumber() && !this.dataType.isDate()) { throw new NotAllowException( - "Not allowed to set aggregate type '%s' for " + - "property key '%s' with data type '%s'", - this.aggregateType, this.name, this.dataType); + "Not allowed to set aggregate type '%s' for " + + "property key '%s' with data type '%s'", + this.aggregateType, this.name, this.dataType); } } @@ -446,22 +444,22 @@ private void checkOlap() { if (!this.graph().backendStoreFeatures().supportsOlapProperties()) { throw new NotSupportException( - "olap property key '%s' for backend '%s'", - this.name, this.graph().backend()); + "olap property key '%s' for backend '%s'", + this.name, this.graph().backend()); } if (!this.aggregateType.isNone()) { throw new NotAllowException( - "Not allowed to set aggregate type '%s' for olap " + - "property key '%s'", this.aggregateType, this.name); + "Not allowed to set aggregate type '%s' for olap " + + "property key '%s'", this.aggregateType, this.name); } if (this.writeType == WriteType.OLAP_RANGE && !this.dataType.isNumber() && !this.dataType.isDate()) { throw new NotAllowException( - "Not allowed to set write type to OLAP_RANGE for " + - "property key '%s' with data type '%s'", - this.name, this.dataType); + "Not allowed to set write type to OLAP_RANGE for " + + "property key '%s' with data type '%s'", + this.name, this.dataType); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java index 7704756db1..daa460b7a1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java @@ -26,27 +26,27 @@ import java.util.Set; import org.apache.commons.collections.CollectionUtils; - +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.tx.ISchemaTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; -import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.Userdata; -import org.apache.hugegraph.schema.VertexLabel; -import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.exception.ExistedException; import org.apache.hugegraph.exception.NotAllowException; import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.schema.PropertyKey; +import org.apache.hugegraph.schema.Userdata; +import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Action; import org.apache.hugegraph.type.define.IdStrategy; import org.apache.hugegraph.util.CollectionUtil; import org.apache.hugegraph.util.E; + import com.google.common.collect.ImmutableList; public class VertexLabelBuilder extends AbstractBuilder - implements VertexLabel.Builder { + implements VertexLabel.Builder { private Id id; private String name; @@ -106,7 +106,7 @@ public VertexLabel build() { vertexLabel.ttl(this.ttl); if (this.ttlStartTime != null) { vertexLabel.ttlStartTime(this.graph().propertyKey( - this.ttlStartTime).id()); + this.ttlStartTime).id()); } // Assign properties for (String key : this.properties) { @@ -158,6 +158,7 @@ public VertexLabel create() { * Check whether this has same properties with existedVertexLabel. * Only properties, primaryKeys, nullableKeys, enableLabelIndex are checked. * The id, idStrategy, checkExist, userdata are not checked. + * * @param existedVertexLabel to be compared with * @return true if this has same properties with existedVertexLabel */ @@ -417,15 +418,15 @@ private void checkProperties(Action action) { case ELIMINATE: if (!this.properties.isEmpty()) { throw new NotAllowException( - "Not support to eliminate properties " + - "for vertex label currently"); + "Not support to eliminate properties " + + "for vertex label currently"); } break; case DELETE: break; default: throw new AssertionError(String.format( - "Unknown schema action '%s'", action)); + "Unknown schema action '%s'", action)); } } @@ -435,8 +436,8 @@ private void checkNullableKeys(Action action) { if (action == Action.ELIMINATE) { if (!this.nullableKeys.isEmpty()) { throw new NotAllowException( - "Not support to eliminate nullableKeys " + - "for vertex label currently"); + "Not support to eliminate nullableKeys " + + "for vertex label currently"); } return; } @@ -467,7 +468,7 @@ private void checkNullableKeys(Action action) { if (action == Action.APPEND) { Collection newAddedProps = CollectionUtils.subtract( - appendProps, originProps); + appendProps, originProps); E.checkArgument(this.nullableKeys.containsAll(newAddedProps), "The new added properties: %s must be nullable", newAddedProps); @@ -500,7 +501,7 @@ private void checkIdStrategy() { break; default: throw new AssertionError(String.format( - "Unknown id strategy '%s'", strategy)); + "Unknown id strategy '%s'", strategy)); } if (this.idStrategy == IdStrategy.PRIMARY_KEY) { this.checkPrimaryKeys(); @@ -532,18 +533,18 @@ private void checkPrimaryKeys() { private void checkStableVars() { if (!this.primaryKeys.isEmpty()) { throw new NotAllowException( - "Not allowed to update primary keys " + - "for vertex label '%s'", this.name); + "Not allowed to update primary keys " + + "for vertex label '%s'", this.name); } if (this.idStrategy != IdStrategy.DEFAULT) { throw new NotAllowException( - "Not allowed to update id strategy " + - "for vertex label '%s'", this.name); + "Not allowed to update id strategy " + + "for vertex label '%s'", this.name); } if (this.enableLabelIndex != null) { throw new NotAllowException( - "Not allowed to update enable_label_index " + - "for vertex label '%s'", this.name); + "Not allowed to update enable_label_index " + + "for vertex label '%s'", this.name); } } @@ -579,8 +580,8 @@ private void checkUserdata(Action action) { for (Map.Entry e : this.userdata.entrySet()) { if (e.getValue() == null) { throw new NotAllowException( - "Not allowed pass null userdata value when " + - "create or append edge label"); + "Not allowed pass null userdata value when " + + "create or append edge label"); } } break; @@ -590,7 +591,7 @@ private void checkUserdata(Action action) { break; default: throw new AssertionError(String.format( - "Unknown schema action '%s'", action)); + "Unknown schema action '%s'", action)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java index e83959113d..7c4f33c546 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java @@ -24,9 +24,9 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import org.apache.hugegraph.util.Log; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -35,9 +35,9 @@ public class HugeSecurityManager extends SecurityManager { private static final String USER_DIR = System.getProperty("user.dir"); private static final String USER_DIR_IDE = - USER_DIR.endsWith("hugegraph-dist") ? - USER_DIR.substring(0, USER_DIR.length() - 15) : - null; + USER_DIR.endsWith("hugegraph-dist") ? + USER_DIR.substring(0, USER_DIR.length() - 15) : + null; private static final String GREMLIN_SERVER_WORKER = "gremlin-server-exec"; private static final String TASK_WORKER = "task-worker"; @@ -49,7 +49,6 @@ public class HugeSecurityManager extends SecurityManager { private static final Set DENIED_PERMISSIONS = ImmutableSet.of("setSecurityManager"); - private static final Set ACCEPT_CLASS_LOADERS = ImmutableSet.of( "groovy.lang.GroovyClassLoader", "sun.reflect.DelegatingClassLoader", @@ -132,7 +131,7 @@ public class HugeSecurityManager extends SecurityManager { public static void ignoreCheckedClass(String clazz) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to add ignore check via Gremlin"); + "Not allowed to add ignore check via Gremlin"); } IGNORE_CHECKED_CLASSES.add(clazz); @@ -143,7 +142,7 @@ public void checkPermission(Permission permission) { if (DENIED_PERMISSIONS.contains(permission.getName()) && callFromGremlin()) { throw newSecurityException( - "Not allowed to access denied permission via Gremlin"); + "Not allowed to access denied permission via Gremlin"); } } @@ -152,7 +151,7 @@ public void checkPermission(Permission permission, Object context) { if (DENIED_PERMISSIONS.contains(permission.getName()) && callFromGremlin()) { throw newSecurityException( - "Not allowed to access denied permission via Gremlin"); + "Not allowed to access denied permission via Gremlin"); } } @@ -160,7 +159,7 @@ public void checkPermission(Permission permission, Object context) { public void checkCreateClassLoader() { if (!callFromAcceptClassLoaders() && callFromGremlin()) { throw newSecurityException( - "Not allowed to create class loader via Gremlin"); + "Not allowed to create class loader via Gremlin"); } super.checkCreateClassLoader(); } @@ -169,7 +168,7 @@ public void checkCreateClassLoader() { public void checkLink(String lib) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to link library via Gremlin"); + "Not allowed to link library via Gremlin"); } super.checkLink(lib); } @@ -181,7 +180,7 @@ public void checkAccess(Thread thread) { !callFromBackendThread() && !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException( - "Not allowed to access thread via Gremlin"); + "Not allowed to access thread via Gremlin"); } super.checkAccess(thread); } @@ -194,7 +193,7 @@ public void checkAccess(ThreadGroup threadGroup) { !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException( - "Not allowed to access thread group via Gremlin"); + "Not allowed to access thread group via Gremlin"); } super.checkAccess(threadGroup); } @@ -203,7 +202,7 @@ public void checkAccess(ThreadGroup threadGroup) { public void checkExit(int status) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to call System.exit() via Gremlin"); + "Not allowed to call System.exit() via Gremlin"); } super.checkExit(status); } @@ -212,7 +211,7 @@ public void checkExit(int status) { public void checkExec(String cmd) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to execute command via Gremlin"); + "Not allowed to execute command via Gremlin"); } super.checkExec(cmd); } @@ -233,7 +232,7 @@ public void checkRead(String file) { !callFromSnapshot() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException( - "Not allowed to read file via Gremlin: %s", file); + "Not allowed to read file via Gremlin: %s", file); } super.checkRead(file); } @@ -242,7 +241,7 @@ public void checkRead(String file) { public void checkRead(String file, Object context) { if (callFromGremlin() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException( - "Not allowed to read file via Gremlin: %s", file); + "Not allowed to read file via Gremlin: %s", file); } super.checkRead(file, context); } @@ -269,7 +268,7 @@ public void checkWrite(String file) { public void checkDelete(String file) { if (callFromGremlin() && !callFromSnapshot()) { throw newSecurityException( - "Not allowed to delete file via Gremlin"); + "Not allowed to delete file via Gremlin"); } super.checkDelete(file); } @@ -278,7 +277,7 @@ public void checkDelete(String file) { public void checkListen(int port) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to listen socket via Gremlin"); + "Not allowed to listen socket via Gremlin"); } super.checkListen(port); } @@ -287,7 +286,7 @@ public void checkListen(int port) { public void checkAccept(String host, int port) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to accept socket via Gremlin"); + "Not allowed to accept socket via Gremlin"); } super.checkAccept(host, port); } @@ -297,7 +296,7 @@ public void checkConnect(String host, int port) { if (callFromGremlin() && !callFromBackendSocket() && !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException( - "Not allowed to connect socket via Gremlin"); + "Not allowed to connect socket via Gremlin"); } super.checkConnect(host, port); } @@ -306,7 +305,7 @@ public void checkConnect(String host, int port) { public void checkConnect(String host, int port, Object context) { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to connect socket via Gremlin"); + "Not allowed to connect socket via Gremlin"); } super.checkConnect(host, port, context); } @@ -332,7 +331,7 @@ public void checkMulticast(InetAddress maddr, byte ttl) { public void checkSetFactory() { if (callFromGremlin()) { throw newSecurityException( - "Not allowed to set socket factory via Gremlin"); + "Not allowed to set socket factory via Gremlin"); } super.checkSetFactory(); } @@ -342,7 +341,7 @@ public void checkPropertiesAccess() { if (callFromGremlin() && !callFromSofaRpc() && !callFromNewSecurityException()) { throw newSecurityException( - "Not allowed to access system properties via Gremlin"); + "Not allowed to access system properties via Gremlin"); } super.checkPropertiesAccess(); } @@ -354,7 +353,7 @@ public void checkPropertyAccess(String key) { !callFromSnapshot() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException( - "Not allowed to access system property(%s) via Gremlin", key); + "Not allowed to access system property(%s) via Gremlin", key); } super.checkPropertyAccess(key); } @@ -398,12 +397,9 @@ private static SecurityException newSecurityException(String message, } private static boolean readGroovyInCurrentDir(String file) { - if (file != null && (USER_DIR != null && file.startsWith(USER_DIR) || - USER_DIR_IDE != null && file.startsWith(USER_DIR_IDE)) && - (file.endsWith(".class") || file.endsWith(".groovy"))) { - return true; - } - return false; + return file != null && (USER_DIR != null && file.startsWith(USER_DIR) || + USER_DIR_IDE != null && file.startsWith(USER_DIR_IDE)) && + (file.endsWith(".class") || file.endsWith(".groovy")); } private static boolean callFromGremlin() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java index 174c8e7de2..7cf5ee3b4d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java @@ -21,4 +21,5 @@ import org.apache.hugegraph.type.Typeable; public interface GraphType extends Nameable, Typeable { + } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java index b14802be42..53b8a54933 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java @@ -27,7 +27,9 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.QueryResults; +import org.apache.hugegraph.backend.serializer.BytesBuffer; import org.apache.hugegraph.backend.tx.GraphTransaction; +import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; @@ -35,16 +37,13 @@ import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.hugegraph.util.E; import org.apache.logging.log4j.util.Strings; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; - -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.perf.PerfUtil.Watched; -import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyProperty; import com.google.common.collect.ImmutableList; @@ -463,6 +462,7 @@ public HugeVertex otherVertex() { /** * Clear properties of the edge, and set `removed` true + * * @return a new edge */ public HugeEdge prepareRemoved() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java index 6f78c0da7f..f89e4f0cf4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java @@ -47,7 +47,7 @@ public void remove() { assert this.owner instanceof HugeEdge; EdgeLabel edgeLabel = ((HugeEdge) this.owner).schemaLabel(); E.checkArgument(edgeLabel.nullableKeys().contains( - this.propertyKey().id()), + this.propertyKey().id()), "Can't remove non-null edge property '%s'", this); this.owner.graph().removeEdgeProperty(this); } @@ -60,6 +60,7 @@ public boolean equals(Object obj) { return ElementHelper.areEqual(this, obj); } + @Override public int hashCode() { return ElementHelper.hashCode(this); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java index a7c93333fe..f727dc2fcb 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java @@ -46,7 +46,6 @@ import org.apache.hugegraph.util.InsertionOrderUtil; import org.apache.hugegraph.util.collection.CollectionFactory; import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.eclipse.collections.api.iterator.IntIterator; @@ -55,7 +54,7 @@ public abstract class HugeElement implements Element, GraphType, Idfiable, Comparable { private static final MutableIntObjectMap> EMPTY_MAP = - CollectionFactory.newIntObjectMap(); + CollectionFactory.newIntObjectMap(); private static final int MAX_PROPERTIES = BytesBuffer.UINT16_MAX; private final HugeGraph graph; @@ -329,7 +328,7 @@ public HugeProperty addProperty(PropertyKey pkey, V value, } @Watched(prefix = "element") - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) private HugeProperty addProperty(PropertyKey pkey, V value, Supplier> supplier) { assert pkey.cardinality().multiple(); @@ -372,7 +371,7 @@ protected void copyProperties(HugeElement element) { this.properties = EMPTY_MAP; } else { this.properties = CollectionFactory.newIntObjectMap( - element.properties); + element.properties); } this.propLoaded = true; } @@ -414,8 +413,9 @@ public int compareTo(HugeElement o) { /** * Classify parameter list(pairs) from call request + * * @param keyValues The property key-value pair of the vertex or edge - * @return Key-value pairs that are classified and processed + * @return Key-value pairs that are classified and processed */ @Watched(prefix = "element") public static final ElementKeys classifyKeys(Object... keyValues) { @@ -488,8 +488,8 @@ protected static Id getIdValue(Object idValue) { // Throw if error type throw new UnsupportedOperationException(String.format( - "Invalid element id: %s(%s)", - idValue, idValue.getClass().getSimpleName())); + "Invalid element id: %s(%s)", + idValue, idValue.getClass().getSimpleName())); } @Watched(prefix = "element") diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java index ec1c216a19..f8bdb8c75c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java @@ -67,7 +67,7 @@ public String toString() { public class HugeGraphFeatures implements GraphFeatures { private final VariableFeatures variableFeatures = - new HugeVariableFeatures(); + new HugeVariableFeatures(); @Override public boolean supportsConcurrentAccess() { @@ -157,12 +157,12 @@ public boolean willAllowId(Object id) { } public class HugeVariableFeatures extends HugeDataTypeFeatures - implements VariableFeatures { + implements VariableFeatures { } public class HugeVertexPropertyFeatures extends HugeDataTypeFeatures - implements VertexPropertyFeatures { + implements VertexPropertyFeatures { @Override public boolean supportsRemoveProperty() { @@ -206,7 +206,7 @@ public boolean supportsCustomIds() { } public class HugeEdgePropertyFeatures extends HugeDataTypeFeatures - implements EdgePropertyFeatures { + implements EdgePropertyFeatures { @Override public boolean supportsMapValues() { @@ -231,10 +231,10 @@ public boolean supportsUniformListValues() { } public class HugeVertexFeatures extends HugeElementFeatures - implements VertexFeatures { + implements VertexFeatures { private final VertexPropertyFeatures vertexPropertyFeatures = - new HugeVertexPropertyFeatures(); + new HugeVertexPropertyFeatures(); @Override public boolean supportsUserSuppliedIds() { @@ -280,15 +280,15 @@ public boolean supportsDefaultLabel() { public String defaultLabel() { return HugeFeatures.this.graph - .option(CoreOptions.VERTEX_DEFAULT_LABEL); + .option(CoreOptions.VERTEX_DEFAULT_LABEL); } } public class HugeEdgeFeatures extends HugeElementFeatures - implements EdgeFeatures { + implements EdgeFeatures { private final EdgePropertyFeatures edgePropertyFeatures = - new HugeEdgePropertyFeatures(); + new HugeEdgePropertyFeatures(); @Override public EdgePropertyFeatures properties() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java index 05eff56bb1..fa442e1298 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java @@ -28,11 +28,11 @@ import org.apache.hugegraph.backend.id.Id.IdType; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.id.SplicingIdGenerator; +import org.apache.hugegraph.backend.serializer.BytesBuffer; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.SchemaElement; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.DataType; -import org.apache.hugegraph.backend.serializer.BytesBuffer; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.HashUtil; import org.apache.hugegraph.util.InsertionOrderUtil; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java index 85990d2af0..cc96bd27b8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java @@ -22,12 +22,11 @@ import org.apache.hugegraph.backend.id.SplicingIdGenerator; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; -import org.apache.hugegraph.util.E; - public abstract class HugeProperty implements Property, GraphType { protected final HugeElement owner; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java index ad0f4c083b..b5223125df 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java @@ -305,7 +305,7 @@ public HugeEdge constructEdge(String label, HugeVertex vertex, EdgeLabel edgeLabel = this.graph().edgeLabel(label); // Check link E.checkArgument(edgeLabel.checkLinkEqual(this.schemaLabel().id(), - vertex.schemaLabel().id()), + vertex.schemaLabel().id()), "Undefined link of edge label '%s': '%s' -> '%s'", label, this.label(), vertex.label()); // Check sortKeys @@ -317,14 +317,14 @@ public HugeEdge constructEdge(String label, HugeVertex vertex, // Check whether passed all non-null props @SuppressWarnings("unchecked") Collection nonNullKeys = CollectionUtils.subtract( - edgeLabel.properties(), - edgeLabel.nullableKeys()); + edgeLabel.properties(), + edgeLabel.nullableKeys()); if (!new HashSet<>(keys).containsAll(nonNullKeys)) { @SuppressWarnings("unchecked") Collection missed = CollectionUtils.subtract(nonNullKeys, keys); E.checkArgument(false, "All non-null property keys: %s " + - "of edge label '%s' must be set, " + - "but missed keys: %s", + "of edge label '%s' must be set, " + + "but missed keys: %s", this.graph().mapPkId2Name(nonNullKeys), edgeLabel.name(), this.graph().mapPkId2Name(missed)); @@ -341,6 +341,7 @@ public HugeEdge constructEdge(String label, HugeVertex vertex, /** * Add edge with direction OUT + * * @param edge the out edge */ @Watched @@ -356,6 +357,7 @@ public void addOutEdge(HugeEdge edge) { /** * Add edge with direction IN + * * @param edge the in edge */ @Watched @@ -613,6 +615,7 @@ public boolean valid() { /** * Clear edges/properties of the cloned vertex, and set `removed` true + * * @return a new vertex */ public HugeVertex prepareRemoved() { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java index de6c1ee837..4cef519799 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java @@ -19,19 +19,18 @@ import java.util.Iterator; +import org.apache.hugegraph.exception.NotSupportException; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.util.E; - public class HugeVertexProperty extends HugeProperty - implements VertexProperty { + implements VertexProperty { public HugeVertexProperty(HugeElement owner, PropertyKey key, V value) { super(owner, key, value); @@ -59,7 +58,7 @@ public void remove() { assert this.owner instanceof HugeVertex; VertexLabel vertexLabel = ((HugeVertex) this.owner).schemaLabel(); E.checkArgument(vertexLabel.nullableKeys().contains( - this.propertyKey().id()), + this.propertyKey().id()), "Can't remove non-null vertex property '%s'", this); this.owner.graph().removeVertexProperty(this); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java index bfb00bff96..c7c840a882 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java @@ -185,7 +185,8 @@ public Object execute() throws Exception { return result; } - private Object executeBatchJob(List> jobs, Object prevResult) throws Exception { + private Object executeBatchJob(List> jobs, Object prevResult) throws + Exception { GraphTransaction graphTx = this.params().systemTransaction(); GraphTransaction systemTx = this.params().graphTransaction(); Object result = prevResult; @@ -236,6 +237,7 @@ public Object call() throws Exception { } public interface Reduce { - T reduce(T t1, T t2); + + T reduce(T t1, T t2); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java index c3fffecce6..a304b4f75b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.schema.IndexLabel; @@ -35,21 +37,18 @@ import org.apache.hugegraph.type.define.DataType; import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.type.define.SerialEnum; +import org.apache.hugegraph.util.DateUtil; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.util.DateUtil; -import org.apache.hugegraph.util.E; - public class HugeServerInfo { // Unit millisecond private static final long EXPIRED_INTERVAL = - TaskManager.SCHEDULE_PERIOD * 10; + TaskManager.SCHEDULE_PERIOD * 10; private Id id; private NodeRole role; @@ -202,7 +201,7 @@ public Map asMap() { public static HugeServerInfo fromVertex(Vertex vertex) { HugeServerInfo serverInfo = new HugeServerInfo((Id) vertex.id()); for (Iterator> iter = vertex.properties(); - iter.hasNext();) { + iter.hasNext(); ) { VertexProperty prop = iter.next(); serverInfo.property(prop.key(), prop.value()); } @@ -213,11 +212,8 @@ public boolean suitableFor(HugeTask task, long now) { if (task.computer() != this.role.computer()) { return false; } - if (this.updateTime.getTime() + EXPIRED_INTERVAL < now || - this.load() + task.load() > this.maxLoad) { - return false; - } - return true; + return this.updateTime.getTime() + EXPIRED_INTERVAL >= now && + this.load() + task.load() <= this.maxLoad; } public static Schema schema(HugeGraphParams graph) { @@ -288,7 +284,7 @@ private String[] initProperties() { public boolean existVertexLabel(String label) { return this.graph.schemaTransaction() - .getVertexLabel(label) != null; + .getVertexLabel(label) != null; } @SuppressWarnings("unused") diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java index 305c9dc7a9..bfd79f6f22 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java @@ -29,30 +29,31 @@ import java.util.stream.Collector; import java.util.stream.Collectors; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.backend.serializer.BytesBuffer; import org.apache.hugegraph.config.CoreOptions; +import org.apache.hugegraph.exception.LimitExceedException; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.job.ComputerJob; +import org.apache.hugegraph.job.EphemeralJob; import org.apache.hugegraph.job.GremlinJob; import org.apache.hugegraph.job.schema.SchemaJob; import org.apache.hugegraph.type.define.SerialEnum; -import org.apache.hugegraph.util.*; +import org.apache.hugegraph.util.Blob; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.util.StringEncoding; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.apache.hugegraph.util.Blob; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.StringEncoding; import org.slf4j.Logger; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.exception.LimitExceedException; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.job.ComputerJob; -import org.apache.hugegraph.job.EphemeralJob; - public class HugeTask extends FutureTask { private static final Logger LOG = Log.logger(HugeTask.class); @@ -342,9 +343,7 @@ public boolean fail(Throwable e) { LOG.warn("An exception occurred when running task: {}", this.id(), e); // Update status to FAILED if exception occurred(not interrupted) - if (this.result(TaskStatus.FAILED, e.toString())) { - return true; - } + return this.result(TaskStatus.FAILED, e.toString()); } return false; } @@ -408,14 +407,14 @@ protected boolean checkDependenciesSuccess() { return false; } else if (task.status() == TaskStatus.CANCELLED) { this.result(TaskStatus.CANCELLED, String.format( - "Cancelled due to dependent task '%s' cancelled", - dependency)); + "Cancelled due to dependent task '%s' cancelled", + dependency)); this.done(); return false; } else if (task.status() == TaskStatus.FAILED) { this.result(TaskStatus.FAILED, String.format( - "Failed due to dependent task '%s' failed", - dependency)); + "Failed due to dependent task '%s' failed", + dependency)); this.done(); return false; } @@ -437,7 +436,7 @@ protected synchronized boolean status(TaskStatus status) { if (!this.completed()) { assert this.status.code() < status.code() || status == TaskStatus.RESTORING : - this.status + " => " + status + " (task " + this.id + ")"; + this.status + " => " + status + " (task " + this.id + ")"; this.status = status; return true; } @@ -486,7 +485,7 @@ protected void property(String key, Object value) { @SuppressWarnings("unchecked") Set values = (Set) value; this.dependencies = values.stream().map(IdGenerator::of) - .collect(toOrderSet()); + .collect(toOrderSet()); break; case P.INPUT: this.input = StringEncoding.decompress(((Blob) value).bytes(), @@ -555,7 +554,7 @@ protected synchronized Object[] asArray() { if (this.dependencies != null) { list.add(P.DEPENDENCIES); list.add(this.dependencies.stream().map(Id::asLong) - .collect(toOrderSet())); + .collect(toOrderSet())); } if (this.input != null) { @@ -676,7 +675,7 @@ public synchronized Map asMap(boolean withDetails) { } if (this.dependencies != null) { Set value = this.dependencies.stream().map(Id::asLong) - .collect(toOrderSet()); + .collect(toOrderSet()); map.put(Hidden.unHide(P.DEPENDENCIES), value); } @@ -709,7 +708,7 @@ public static HugeTask fromVertex(Vertex vertex) { HugeTask task = new HugeTask<>((Id) vertex.id(), null, callable); for (Iterator> iter = vertex.properties(); - iter.hasNext();) { + iter.hasNext(); ) { VertexProperty prop = iter.next(); task.property(prop.key(), prop.value()); } @@ -736,8 +735,8 @@ private void checkPropertySize(int propertyLength, String propertyName) { if (propertyLength > propertyLimit) { throw new LimitExceedException( - "Task %s size %s exceeded limit %s bytes", - P.unhide(propertyName), propertyLength, propertyLimit); + "Task %s size %s exceeded limit %s bytes", + P.unhide(propertyName), propertyLength, propertyLimit); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java index dee899e0f8..de0d08b03a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java @@ -118,7 +118,7 @@ public synchronized void initServerInfo(GlobalMasterInfo nodeInfo) { while (servers.hasNext()) { existed = servers.next(); E.checkArgument(!existed.role().master() || !existed.alive(), - "Already existed master '%s' in current cluster", + "Already existed master '%s' in current cluster", existed.id()); } if (page != null) { @@ -324,7 +324,7 @@ private int save(Collection serverInfos) { private V call(Callable callable) { assert !Thread.currentThread().getName().startsWith( - "server-info-db-worker") : "can't call by itself"; + "server-info-db-worker") : "can't call by itself"; try { // Pass context for db thread callable = new TaskManager.ContextCallable<>(callable); @@ -391,7 +391,7 @@ protected void updateServerInfos(Collection serverInfos) { protected Collection allServerInfos() { Iterator infos = this.serverInfos(NO_LIMIT, null); try (ListIterator iter = new ListIterator<>( - MAX_SERVERS, infos)) { + MAX_SERVERS, infos)) { return iter.list(); } catch (Exception e) { throw new HugeException("Failed to close server info iterator", e); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java index cc08e2a945..8afe11dff2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java @@ -38,28 +38,22 @@ import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.exception.ConnectionException; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.iterator.ExtendableIterator; import org.apache.hugegraph.iterator.MapperIterator; import org.apache.hugegraph.job.EphemeralJob; -import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.task.HugeTask.P; import org.apache.hugegraph.task.TaskCallable.SysTaskCallable; import org.apache.hugegraph.task.TaskManager.ContextCallable; import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Cardinality; -import org.apache.hugegraph.type.define.DataType; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; -import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; @@ -145,7 +139,7 @@ public void restoreTasks() { do { Iterator> iter; for (iter = this.findTask(status, PAGE_SIZE, page); - iter.hasNext();) { + iter.hasNext(); ) { HugeTask task = iter.next(); if (selfServer.equals(task.server())) { taskList.add(task); @@ -156,7 +150,7 @@ public void restoreTasks() { } } while (page != null); } - for (HugeTask task : taskList){ + for (HugeTask task : taskList) { LOG.info("restore task {}", task); this.restore(task); } @@ -325,7 +319,7 @@ protected synchronized void scheduleTasksOnMaster() { } HugeServerInfo server = this.serverManager().pickWorkerNode( - serverInfos, task); + serverInfos, task); if (server == null) { LOG.info("The master can't find suitable servers to " + "execute task '{}', wait for next schedule", @@ -445,7 +439,7 @@ protected void remove(HugeTask task, boolean force) { HugeTask delTask = this.tasks.remove(task.id()); if (delTask != null && delTask != task) { LOG.warn("Task '{}' may be inconsistent status {}(expect {})", - task.id(), task.status(), delTask.status()); + task.id(), task.status(), delTask.status()); } assert force || delTask == null || delTask.completed() || delTask.cancelling() || delTask.isCancelled() : delTask; @@ -597,13 +591,13 @@ public HugeTask delete(Id id, boolean force) { @Override public HugeTask waitUntilTaskCompleted(Id id, long seconds) - throws TimeoutException { + throws TimeoutException { return this.waitUntilTaskCompleted(id, seconds, QUERY_INTERVAL); } @Override public HugeTask waitUntilTaskCompleted(Id id) - throws TimeoutException { + throws TimeoutException { // This method is just used by tests long timeout = this.graph.configuration() .get(CoreOptions.TASK_WAIT_TIMEOUT); @@ -612,10 +606,10 @@ public HugeTask waitUntilTaskCompleted(Id id) private HugeTask waitUntilTaskCompleted(Id id, long seconds, long intervalMs) - throws TimeoutException { + throws TimeoutException { long passes = seconds * 1000 / intervalMs; HugeTask task = null; - for (long pass = 0;; pass++) { + for (long pass = 0; ; pass++) { try { task = this.task(id); } catch (NotFoundException e) { @@ -637,15 +631,15 @@ private HugeTask waitUntilTaskCompleted(Id id, long seconds, sleep(intervalMs); } throw new TimeoutException(String.format( - "Task '%s' was not completed in %s seconds", id, seconds)); + "Task '%s' was not completed in %s seconds", id, seconds)); } @Override public void waitUntilAllTasksCompleted(long seconds) - throws TimeoutException { + throws TimeoutException { long passes = seconds * 1000 / QUERY_INTERVAL; int taskSize; - for (long pass = 0;; pass++) { + for (long pass = 0; ; pass++) { taskSize = this.pendingTasks(); if (taskSize == 0) { sleep(QUERY_INTERVAL); @@ -657,8 +651,8 @@ public void waitUntilAllTasksCompleted(long seconds) sleep(QUERY_INTERVAL); } throw new TimeoutException(String.format( - "There are still %s incomplete tasks after %s seconds", - taskSize, seconds)); + "There are still %s incomplete tasks after %s seconds", + taskSize, seconds)); } @Override @@ -718,9 +712,9 @@ public V call(Runnable runnable) { } @Override - public V call(Callable callable) { + public V call(Callable callable) { assert !Thread.currentThread().getName().startsWith( - "task-db-worker") : "can't call by itself"; + "task-db-worker") : "can't call by itself"; try { // Pass task context for db thread callable = new ContextCallable<>(callable); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java index b19fb796da..ec066fbc04 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java @@ -21,14 +21,14 @@ import java.util.Set; import java.util.concurrent.Callable; -import org.apache.tinkerpop.gremlin.structure.Transaction; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Transaction; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableSet; public abstract class TaskCallable implements Callable { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java index 14e91d301c..144387949b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java @@ -45,7 +45,7 @@ public final class TaskManager { public static final String TASK_WORKER = TASK_WORKER_PREFIX + "-%d"; public static final String TASK_DB_WORKER = "task-db-worker-%d"; public static final String SERVER_INFO_DB_WORKER = - "server-info-db-worker-%d"; + "server-info-db-worker-%d"; public static final String TASK_SCHEDULER = "task-scheduler-%d"; protected static final long SCHEDULE_PERIOD = 1000L; // unit ms @@ -73,12 +73,12 @@ private TaskManager(int pool) { this.taskExecutor = ExecutorUtil.newFixedThreadPool(pool, TASK_WORKER); // For save/query task state, just one thread is ok this.taskDbExecutor = ExecutorUtil.newFixedThreadPool( - 1, TASK_DB_WORKER); + 1, TASK_DB_WORKER); this.serverInfoDbExecutor = ExecutorUtil.newFixedThreadPool( - 1, SERVER_INFO_DB_WORKER); + 1, SERVER_INFO_DB_WORKER); // For schedule task to run, just one thread is ok this.schedulerExecutor = ExecutorUtil.newPausableScheduledThreadPool( - 1, TASK_SCHEDULER); + 1, TASK_SCHEDULER); // Start after 10x period time waiting for HugeGraphServer startup this.schedulerExecutor.scheduleWithFixedDelay(this::scheduleOrExecuteJob, 10 * SCHEDULE_PERIOD, @@ -90,8 +90,8 @@ public void addScheduler(HugeGraphParams graph) { E.checkArgumentNotNull(graph, "The graph can't be null"); TaskScheduler scheduler = new StandardTaskScheduler(graph, - this.taskExecutor, this.taskDbExecutor, - this.serverInfoDbExecutor); + this.taskExecutor, this.taskDbExecutor, + this.serverInfoDbExecutor); this.schedulers.put(graph, scheduler); } @@ -171,7 +171,7 @@ public TaskScheduler getScheduler(HugeGraphParams graph) { public ServerInfoManager getServerInfoManager(HugeGraphParams graph) { StandardTaskScheduler scheduler = (StandardTaskScheduler) - this.getScheduler(graph); + this.getScheduler(graph); if (scheduler == null) { return null; } @@ -275,7 +275,7 @@ public void onAsRoleWorker() { protected void notifyNewTask(HugeTask task) { Queue queue = ((ThreadPoolExecutor) this.schedulerExecutor) - .getQueue(); + .getQueue(); if (queue.size() <= 1) { /* * Notify to schedule tasks initiatively when have new task diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java index 4a6993b5e2..b72ee91a8d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java @@ -23,8 +23,8 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; -import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; public interface TaskScheduler { @@ -59,13 +59,13 @@ Iterator> tasks(TaskStatus status, boolean close(); HugeTask waitUntilTaskCompleted(Id id, long seconds) - throws TimeoutException; + throws TimeoutException; HugeTask waitUntilTaskCompleted(Id id) - throws TimeoutException; + throws TimeoutException; void waitUntilAllTasksCompleted(long seconds) - throws TimeoutException; + throws TimeoutException; void checkRequirement(String op); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java index db89da6f10..d87a20c0a5 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java @@ -21,6 +21,7 @@ import java.util.Set; import org.apache.hugegraph.type.define.SerialEnum; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -43,10 +44,10 @@ public enum TaskStatus implements SerialEnum { // NOTE: order is important(RESTORING > RUNNING > QUEUED) when restoring public static final List PENDING_STATUSES = ImmutableList.of( - TaskStatus.RESTORING, TaskStatus.RUNNING, TaskStatus.QUEUED); + TaskStatus.RESTORING, TaskStatus.RUNNING, TaskStatus.QUEUED); public static final Set COMPLETED_STATUSES = ImmutableSet.of( - TaskStatus.SUCCESS, TaskStatus.CANCELLED, TaskStatus.FAILED); + TaskStatus.SUCCESS, TaskStatus.CANCELLED, TaskStatus.FAILED); private byte status; private String name; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java index 3ef81e538c..1b9defac46 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java @@ -25,13 +25,12 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.QueryResults; -import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; -import org.apache.tinkerpop.gremlin.structure.Edge; - import org.apache.hugegraph.iterator.FilterIterator; import org.apache.hugegraph.iterator.FlatMapperIterator; import org.apache.hugegraph.structure.HugeEdge; +import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public class CountTraverser extends HugeTraverser { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java index 53ced03c67..e75d016359 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java @@ -947,6 +947,7 @@ public void append(Id current) { } public static class EdgeRecord { + private final Map edgeMap; private final ObjectIntMapping idMapping; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java index e5f99b4037..3e915c7dd9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java @@ -22,17 +22,16 @@ import java.util.Map; import java.util.Set; -import jakarta.ws.rs.core.MultivaluedMap; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.type.define.Directions; -import org.apache.tinkerpop.gremlin.structure.Edge; - -import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.OrderLimitMap; +import org.apache.tinkerpop.gremlin.structure.Edge; + +import jakarta.ws.rs.core.MultivaluedMap; public class NeighborRankTraverser extends HugeTraverser { @@ -162,7 +161,7 @@ private boolean belongToPrevLayers(List ranks, Id target, Ranks prevLayerRanks = ranks.get(i); if (prevLayerRanks.containsKey(target)) { Set nodes = prevLayerNodes.computeIfAbsent( - i, HugeTraverser::newSet); + i, HugeTraverser::newSet); nodes.add(target); return true; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java index 40fe914d49..44f9cf8692 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java @@ -49,7 +49,7 @@ import com.google.common.base.Objects; public abstract class OltpTraverser extends HugeTraverser - implements AutoCloseable { + implements AutoCloseable { private static final String EXECUTOR_NAME = "oltp"; private static Consumers.ExecutorPool executors; @@ -149,7 +149,7 @@ protected void traverseIdsByBfs(Iterator vertices, long capacity, Consumer consumer) { List labels = label == null ? Collections.emptyList() : - Collections.singletonList(label); + Collections.singletonList(label); OneStepEdgeIterConsumer edgeIterConsumer = new OneStepEdgeIterConsumer(consumer, capacity); EdgesIterator edgeIter = edgesOfVertices(vertices, dir, labels, degree); @@ -248,7 +248,7 @@ protected boolean match(Element elem, String key, Object value) { } public static class ConcurrentMultiValuedMap - extends ConcurrentHashMap> { + extends ConcurrentHashMap> { private static final long serialVersionUID = -7249946839643493614L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java index 1a1e82cad9..972eff7c7a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java @@ -27,11 +27,10 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.VertexLabel; -import org.apache.hugegraph.type.define.Directions; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; - import org.apache.hugegraph.structure.HugeVertex; +import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; public class PersonalRankTraverser extends HugeTraverser { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java index 4a3df4d643..4b2cb69e57 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; + import com.google.common.collect.ImmutableList; public class PredictionTraverser extends OltpTraverser { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java index 4e9b88ec1b..a34f87289d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java @@ -198,8 +198,9 @@ public PathSet forward(boolean all) { this.edgeResults.addEdge(source, target, edge); PathSet paths = this.pathResults.findPath(target, - t -> !this.superNode(t, this.direction), - all, false); + t -> !this.superNode(t, + this.direction), + all, false); if (paths.isEmpty()) { continue; @@ -244,8 +245,8 @@ public PathSet backward(boolean all) { this.edgeResults.addEdge(source, target, edge); PathSet paths = this.pathResults.findPath(target, - t -> !this.superNode(t, opposite), - all, false); + t -> !this.superNode(t, opposite), + all, false); if (paths.isEmpty()) { continue; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java index 7b94454cb4..74f3db5ffa 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java @@ -19,12 +19,12 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.util.collection.ObjectIntMapping; -import org.apache.hugegraph.util.collection.ObjectIntMappingFactory; import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.traversal.algorithm.records.record.Record; import org.apache.hugegraph.traversal.algorithm.records.record.RecordFactory; import org.apache.hugegraph.traversal.algorithm.records.record.RecordType; +import org.apache.hugegraph.util.collection.ObjectIntMapping; +import org.apache.hugegraph.util.collection.ObjectIntMappingFactory; public abstract class AbstractRecords implements Records { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java index 4600f0790a..33224dc92c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java @@ -22,14 +22,14 @@ import java.util.Stack; import org.apache.commons.collections.CollectionUtils; - import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.util.collection.IntIterator; import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.traversal.algorithm.HugeTraverser.Path; import org.apache.hugegraph.traversal.algorithm.HugeTraverser.PathSet; import org.apache.hugegraph.traversal.algorithm.records.record.Record; import org.apache.hugegraph.traversal.algorithm.records.record.RecordType; +import org.apache.hugegraph.util.collection.IntIterator; + import com.google.common.collect.Lists; public abstract class DoubleWayMultiPathsRecords extends AbstractRecords { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java index f13bcbce6a..bd637ce1d4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java @@ -97,7 +97,7 @@ public void addFullPath(List edges) { if (this.sourceCode == targetCode) { break; } - + this.addPathToRecord(sourceCode, targetCode, record); sourceCode = targetCode; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java index 4a113fb4ea..c743ed5a49 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java @@ -31,7 +31,7 @@ public SyncRecord(Record record) { public SyncRecord(Record record, Object newLock) { if (record == null) { throw new IllegalArgumentException( - "Cannot create a SyncRecord on a null record"); + "Cannot create a SyncRecord on a null record"); } else { this.record = record; this.lock = newLock == null ? this : newLock; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java index 06cfd66066..caff267b7d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java @@ -28,12 +28,12 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.schema.EdgeLabel; -import org.apache.hugegraph.type.define.Directions; -import org.apache.tinkerpop.gremlin.structure.Edge; - import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.traversal.optimize.TraversalUtil; +import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Edge; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java index 29a3572c18..1ab5fb1e0e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.type.define.Directions; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java index 81b3cffd33..b288420ff2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java @@ -28,6 +28,7 @@ import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java index 2110df8f80..235a3c2d98 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java @@ -29,7 +29,7 @@ import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; public class ConcurrentTraverseStrategy extends OltpTraverser - implements TraverseStrategy { + implements TraverseStrategy { public ConcurrentTraverseStrategy(HugeGraph graph) { super(graph); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java index a3bb7ada50..8516645cdd 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java @@ -22,16 +22,16 @@ import java.util.Set; import java.util.function.BiConsumer; -import jakarta.ws.rs.core.MultivaluedMap; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; import org.apache.hugegraph.traversal.algorithm.OltpTraverser; +import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; + +import jakarta.ws.rs.core.MultivaluedMap; public class SingleTraverseStrategy extends OltpTraverser - implements TraverseStrategy { + implements TraverseStrategy { public SingleTraverseStrategy(HugeGraph graph) { super(graph); @@ -65,7 +65,7 @@ public void addNode(Map> vertices, Id id, Node node) { public void addNewVerticesToAll(Map> newVertices, Map> targets) { MultivaluedMap vertices = - (MultivaluedMap) targets; + (MultivaluedMap) targets; for (Map.Entry> entry : newVertices.entrySet()) { vertices.addAll(entry.getKey(), entry.getValue()); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java index e3c21cfa63..7440133038 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java @@ -24,8 +24,8 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; +import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; public interface TraverseStrategy { @@ -44,6 +44,6 @@ void addNewVerticesToAll(Map> newVertices, static TraverseStrategy create(boolean concurrent, HugeGraph graph) { return concurrent ? new ConcurrentTraverseStrategy(graph) : - new SingleTraverseStrategy(graph); + new SingleTraverseStrategy(graph); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java index 8bf2e84644..403bf5be83 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java @@ -20,6 +20,7 @@ import java.util.NoSuchElementException; import java.util.Objects; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.process.traversal.Step; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.Traverser.Admin; @@ -27,10 +28,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.hugegraph.util.E; - public final class HugeCountStep - extends AbstractStep { + extends AbstractStep { private static final long serialVersionUID = -679873894532085972L; @@ -44,6 +43,7 @@ public HugeCountStep(final Traversal.Admin traversal, this.originGraphStep = originGraphStep; } + @Override public boolean equals(Object obj) { if (!(obj instanceof HugeCountStep)) { return false; @@ -69,7 +69,7 @@ protected Admin processNextStart() throws NoSuchElementException { throw FastNoSuchElementException.instance(); } this.done = true; - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) Step step = (Step) this; return this.getTraversal().getTraverserGenerator() .generate(this.originGraphStep.count(), step, 1L); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java index 4bb3a33c88..ef380d36b2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java @@ -40,8 +40,8 @@ import org.apache.tinkerpop.gremlin.structure.Element; public final class HugeCountStepStrategy - extends AbstractTraversalStrategy - implements ProviderOptimizationStrategy { + extends AbstractTraversalStrategy + implements ProviderOptimizationStrategy { private static final long serialVersionUID = -3910433925919057771L; @@ -56,13 +56,13 @@ private HugeCountStepStrategy() { } @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public void apply(Traversal.Admin traversal) { TraversalUtil.convAllHasSteps(traversal); // Extract CountGlobalStep List steps = TraversalHelper.getStepsOfClass( - CountGlobalStep.class, traversal); + CountGlobalStep.class, traversal); if (steps.isEmpty()) { return; } @@ -78,12 +78,12 @@ public void apply(Traversal.Admin traversal) { step instanceof IdentityStep || step instanceof NoOpBarrierStep || step instanceof CollectingBarrierStep) || - (step instanceof TraversalParent && - TraversalHelper.anyStepRecursively(s -> { - return s instanceof SideEffectStep || - s instanceof AggregateGlobalStep || - s instanceof AggregateLocalStep; - }, (TraversalParent) step))) { + (step instanceof TraversalParent && + TraversalHelper.anyStepRecursively(s -> { + return s instanceof SideEffectStep || + s instanceof AggregateGlobalStep || + s instanceof AggregateLocalStep; + }, (TraversalParent) step))) { return; } originSteps.add(step); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java index 21e624e866..bdfb9e0b66 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java @@ -28,6 +28,7 @@ import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; import org.apache.tinkerpop.gremlin.structure.Element; @@ -35,10 +36,8 @@ import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import org.slf4j.Logger; -import org.apache.hugegraph.util.Log; - public final class HugeGraphStep - extends GraphStep implements QueryHolder { + extends GraphStep implements QueryHolder { private static final long serialVersionUID = -679873894532085972L; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java index af1511e152..cc3ef3f5ff 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java @@ -28,8 +28,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper; public final class HugeGraphStepStrategy - extends AbstractTraversalStrategy - implements ProviderOptimizationStrategy { + extends AbstractTraversalStrategy + implements ProviderOptimizationStrategy { private static final long serialVersionUID = -2952498905649139719L; @@ -44,13 +44,13 @@ private HugeGraphStepStrategy() { } @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public void apply(Traversal.Admin traversal) { TraversalUtil.convAllHasSteps(traversal); // Extract conditions in GraphStep List steps = TraversalHelper.getStepsOfClass( - GraphStep.class, traversal); + GraphStep.class, traversal); for (GraphStep originStep : steps) { TraversalUtil.trySetGraph(originStep, TraversalUtil.tryGetGraph(steps.get(0))); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java index 95dc187b5a..e6fa880837 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java @@ -33,8 +33,8 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality; public class HugePrimaryKeyStrategy - extends AbstractTraversalStrategy - implements ProviderOptimizationStrategy { + extends AbstractTraversalStrategy + implements ProviderOptimizationStrategy { private static final long serialVersionUID = 6307847098226016416L; private static final HugePrimaryKeyStrategy INSTANCE = new HugePrimaryKeyStrategy(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java index 66d40e9b29..0ccb48a54a 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java @@ -36,7 +36,7 @@ /** * ScriptTraversal encapsulates a {@link ScriptEngine} and a script which is * compiled into a {@link Traversal} at {@link Admin#applyStrategies()}. - * + *

* This is useful for serializing traversals as the compilation can happen on * the remote end where the traversal will ultimately be processed. * @@ -101,7 +101,7 @@ public void applyStrategies() throws IllegalStateException { Object result = engine.eval(this.script, bindings); if (result instanceof Admin) { - @SuppressWarnings({ "unchecked"}) + @SuppressWarnings({"unchecked"}) Admin traversal = (Admin) result; traversal.getSideEffects().mergeInto(this.sideEffects); traversal.getSteps().forEach(this::addStep); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java index 1132bc83fa..1a3fc58bea 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java @@ -30,6 +30,7 @@ import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.process.traversal.Traverser; import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer; @@ -39,10 +40,8 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory; import org.slf4j.Logger; -import org.apache.hugegraph.util.Log; - public class HugeVertexStep - extends VertexStep implements QueryHolder { + extends VertexStep implements QueryHolder { private static final long serialVersionUID = -7850636388424382454L; @@ -124,7 +123,7 @@ protected Iterator queryEdges(Query query) { } protected ConditionQuery constructEdgesQuery( - Traverser.Admin traverser) { + Traverser.Admin traverser) { HugeGraph graph = TraversalUtil.getGraph(this); // Query for edge with conditions(else conditions for vertex) @@ -140,7 +139,7 @@ protected ConditionQuery constructEdgesQuery( vertex, direction, edgeLabels, this.hasContainers); ConditionQuery query = GraphTransaction.constructEdgesQuery( - vertex, direction, edgeLabels); + vertex, direction, edgeLabels); // Query by sort-keys if (withEdgeCond && edgeLabels.length == 1) { TraversalUtil.fillConditionQuery(query, this.hasContainers, graph); @@ -173,8 +172,8 @@ protected ConditionQuery constructEdgesQuery( */ if (withEdgeCond || withVertexCond) { org.apache.hugegraph.util.E.checkArgument(!this.queryInfo().paging(), - "Can't query by paging " + - "and filtering"); + "Can't query by paging " + + "and filtering"); this.queryInfo().limit(Query.NO_LIMIT); } @@ -198,11 +197,11 @@ public String toString() { } return StringFactory.stepString( - this, - getDirection(), - Arrays.asList(getEdgeLabels()), - getReturnClass().getSimpleName(), - this.hasContainers); + this, + getDirection(), + Arrays.asList(getEdgeLabels()), + getReturnClass().getSimpleName(), + this.hasContainers); } @Override @@ -229,6 +228,7 @@ public Iterator lastTimeResults() { return this.iterator; } + @Override public boolean equals(Object obj) { if (!(obj instanceof HugeVertexStep)) { return false; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java index a1bc02ca02..9517847331 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java @@ -23,6 +23,7 @@ import org.apache.hugegraph.backend.query.BatchConditionQuery; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.iterator.BatchMapperIterator; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.tinkerpop.gremlin.process.traversal.Traverser; @@ -33,10 +34,8 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; -import org.apache.hugegraph.iterator.BatchMapperIterator; - public class HugeVertexStepByBatch - extends HugeVertexStep { + extends HugeVertexStep { private static final long serialVersionUID = -3609787815053052222L; @@ -57,7 +56,7 @@ protected Traverser.Admin processNextStart() { if (this.batchIterator == null) { int batchSize = (int) Query.QUERY_BATCH; this.batchIterator = new BatchMapperIterator<>( - batchSize, this.starts, this::flatMap); + batchSize, this.starts, this::flatMap); } if (this.batchIterator.hasNext()) { @@ -110,7 +109,7 @@ private Iterator flatMap(List> traversers) { } private Iterator vertices( - List> traversers) { + List> traversers) { assert traversers.size() > 0; Iterator edges = this.edges(traversers); @@ -121,7 +120,7 @@ private Iterator edges(List> traversers) { assert traversers.size() > 0; BatchConditionQuery batchQuery = new BatchConditionQuery( - HugeType.EDGE, traversers.size()); + HugeType.EDGE, traversers.size()); for (Traverser.Admin traverser : traversers) { ConditionQuery query = this.constructEdgesQuery(traverser); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java index a01b1ed238..a7dd687348 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java @@ -31,8 +31,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper; public final class HugeVertexStepStrategy - extends AbstractTraversalStrategy - implements ProviderOptimizationStrategy { + extends AbstractTraversalStrategy + implements ProviderOptimizationStrategy { private static final long serialVersionUID = 491355700217483162L; @@ -47,12 +47,12 @@ private HugeVertexStepStrategy() { } @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public void apply(final Traversal.Admin traversal) { TraversalUtil.convAllHasSteps(traversal); List steps = TraversalHelper.getStepsOfClass( - VertexStep.class, traversal); + VertexStep.class, traversal); boolean batchOptimize = false; if (!steps.isEmpty()) { @@ -92,12 +92,13 @@ public void apply(final Traversal.Admin traversal) { /** * Does a Traversal contain any Path step + * * @param traversal * @return the traversal or its parents contain at least one Path step */ protected static boolean containsPath(Traversal.Admin traversal) { boolean hasPath = TraversalHelper.getStepsOfClass( - PathStep.class, traversal).size() > 0; + PathStep.class, traversal).size() > 0; if (hasPath) { return true; } else if (traversal instanceof EmptyTraversal) { @@ -110,12 +111,13 @@ protected static boolean containsPath(Traversal.Admin traversal) { /** * Does a Traversal contain any Tree step + * * @param traversal * @return the traversal or its parents contain at least one Tree step */ protected static boolean containsTree(Traversal.Admin traversal) { boolean hasTree = TraversalHelper.getStepsOfClass( - TreeStep.class, traversal).size() > 0; + TreeStep.class, traversal).size() > 0; if (hasTree) { return true; } else if (traversal instanceof EmptyTraversal) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java index 322744ac2e..917f777b95 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java @@ -21,11 +21,10 @@ import org.apache.hugegraph.backend.query.Aggregate; import org.apache.hugegraph.backend.query.Query; +import org.apache.hugegraph.iterator.Metadatable; import org.apache.tinkerpop.gremlin.process.traversal.Order; import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder; -import org.apache.hugegraph.iterator.Metadatable; - public interface QueryHolder extends HasContainerHolder, Metadatable { String SYSPROP_PAGE = "~page"; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java index 204c47807a..11a5c0cee4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java @@ -243,7 +243,7 @@ public static void extractRange(Step newStep, long limit = holder.setRange(range.getLowRange(), range.getHighRange()); RangeGlobalStep newRange = new RangeGlobalStep<>( - traversal, 0, limit); + traversal, 0, limit); TraversalHelper.replaceStep(range, newRange, traversal); } } @@ -311,9 +311,9 @@ public static void extractAggregateFunc(Step newStep, } public static ConditionQuery fillConditionQuery( - ConditionQuery query, - List hasContainers, - HugeGraph graph) { + ConditionQuery query, + List hasContainers, + HugeGraph graph) { HugeType resultType = query.resultType(); for (HasContainer has : hasContainers) { @@ -550,7 +550,7 @@ public static Condition convContains2Relation(HugeGraph graph, // Convert contains-key or contains-value BiPredicate bp = has.getPredicate().getBiPredicate(); E.checkArgument(bp == Compare.eq, "CONTAINS query with relation " + - "'%s' is not supported", bp); + "'%s' is not supported", bp); HugeKeys key = token2HugeKey(has.getKey()); E.checkNotNull(key, "token key"); @@ -602,8 +602,8 @@ public static boolean keyForContainsValue(String key) { @SuppressWarnings("unchecked") public static Iterator filterResult( - List hasContainers, - Iterator iterator) { + List hasContainers, + Iterator iterator) { if (hasContainers.isEmpty()) { return (Iterator) iterator; } @@ -626,8 +626,8 @@ public static void convAllHasSteps(Traversal.Admin traversal) { // Extract all has steps in traversal @SuppressWarnings("rawtypes") List steps = - TraversalHelper.getStepsOfAssignableClassRecursively( - HasStep.class, traversal); + TraversalHelper.getStepsOfAssignableClassRecursively( + HasStep.class, traversal); if (steps.isEmpty()) { return; @@ -644,8 +644,8 @@ public static void convAllHasSteps(Traversal.Admin traversal) { } Optional parentGraph = ((Traversal) traversal.getParent()) - .asAdmin() - .getGraph(); + .asAdmin() + .getGraph(); if (parentGraph.filter(g -> !(g instanceof EmptyGraph)).isPresent()) { traversal.setGraph(parentGraph.get()); } @@ -980,7 +980,7 @@ private static Number predicateNumber(String value) { } throw new HugeException( - "Invalid value '%s', expect a number", e, value); + "Invalid value '%s', expect a number", e, value); } } @@ -1005,7 +1005,7 @@ private static Number[] predicateNumbers(String value, int count) { continue; } throw new HugeException( - "Invalid value '%s', expect a list of number", value); + "Invalid value '%s', expect a list of number", value); } return values.toArray(new Number[0]); } @@ -1016,7 +1016,7 @@ private static V predicateArg(String value) { return (V) JsonUtil.fromJson(value, Object.class); } catch (Exception e) { throw new HugeException( - "Invalid value '%s', expect a single value", e, value); + "Invalid value '%s', expect a single value", e, value); } } @@ -1026,7 +1026,7 @@ private static List predicateArgs(String value) { return JsonUtil.fromJson("[" + value + "]", List.class); } catch (Exception e) { throw new HugeException( - "Invalid value '%s', expect a list", e, value); + "Invalid value '%s', expect a list", e, value); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java index f14c19dd25..cf8e71e6d7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java @@ -20,6 +20,7 @@ * @author Matthias Broecheler (me@matthiasb.com) */ public interface Nameable { + /** * Returns the unique name of this entity. * diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java index 52d7a3ba1b..e8a4cd3547 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java @@ -60,7 +60,7 @@ public static CollectionType fromCode(byte code) { return FU; default: throw new AssertionError( - "Unsupported collection code: " + code); + "Unsupported collection code: " + code); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java index 69ebdbb643..2bfa93e7d7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java @@ -22,9 +22,9 @@ import java.util.List; import java.util.UUID; -import org.apache.hugegraph.util.Blob; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.backend.serializer.BytesBuffer; +import org.apache.hugegraph.util.Blob; import org.apache.hugegraph.util.Bytes; import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.JsonUtil; @@ -132,13 +132,13 @@ public Number valueToNumber(V value) { break; default: throw new AssertionError(String.format( - "Number type only contains Byte, Integer, " + - "Long, Float, Double, but got %s", this.clazz())); + "Number type only contains Byte, Integer, " + + "Long, Float, Double, but got %s", this.clazz())); } } catch (NumberFormatException e) { throw new IllegalArgumentException(String.format( - "Can't read '%s' as %s: %s", - value, this.name, e.getMessage())); + "Can't read '%s' as %s: %s", + value, this.name, e.getMessage())); } return number; } @@ -199,7 +199,7 @@ public Blob valueToBlob(V value) { bytes[i] = ((Number) v).byteValue(); } else { throw new IllegalArgumentException(String.format( - "expect byte or int value, but got '%s'", v)); + "expect byte or int value, but got '%s'", v)); } } return Blob.wrap(bytes); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java index b2e18373b5..1309cd89df 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java @@ -60,7 +60,7 @@ public HugeType type() { return HugeType.EDGE_IN; default: throw new IllegalArgumentException(String.format( - "Can't convert direction '%s' to HugeType", this)); + "Can't convert direction '%s' to HugeType", this)); } } @@ -82,7 +82,7 @@ public Direction direction() { return Direction.BOTH; default: throw new AssertionError(String.format( - "Unrecognized direction: '%s'", this)); + "Unrecognized direction: '%s'", this)); } } @@ -96,7 +96,7 @@ public static Directions convert(Direction direction) { return BOTH; default: throw new AssertionError(String.format( - "Unrecognized direction: '%s'", direction)); + "Unrecognized direction: '%s'", direction)); } } @@ -108,7 +108,7 @@ public static Directions convert(HugeType edgeType) { return IN; default: throw new IllegalArgumentException(String.format( - "Can't convert type '%s' to Direction", edgeType)); + "Can't convert type '%s' to Direction", edgeType)); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java index 4019a34787..019ac98df9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java @@ -82,7 +82,7 @@ public HugeType type() { return HugeType.UNIQUE_INDEX; default: throw new AssertionError(String.format( - "Unknown index type '%s'", this)); + "Unknown index type '%s'", this)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java index 8a115bf05b..471c0c2d70 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java @@ -21,6 +21,7 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.util.CollectionUtil; import org.apache.hugegraph.util.E; + import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java index d8ff9e2998..0d41a70959 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java @@ -45,7 +45,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.NullOutputStream; - import org.apache.hugegraph.backend.store.raft.RaftContext; import net.jpountz.lz4.LZ4BlockInputStream; @@ -76,12 +75,12 @@ public static void compressTar(String inputDir, String outputFile, } private static void tarDir(Path source, TarArchiveOutputStream tos) - throws IOException { + throws IOException { Files.walkFileTree(source, new SimpleFileVisitor() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) - throws IOException { + throws IOException { String entryName = buildTarEntryName(source, dir); if (!entryName.isEmpty()) { TarArchiveEntry entry = new TarArchiveEntry(dir.toFile(), @@ -95,7 +94,7 @@ public FileVisitResult preVisitDirectory(Path dir, @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) - throws IOException { + throws IOException { // Only copy files, no symbolic links if (attributes.isSymbolicLink()) { return FileVisitResult.CONTINUE; @@ -127,7 +126,7 @@ public static void decompressTar(String sourceFile, String outputDir, Path target = Paths.get(outputDir); if (Files.notExists(source)) { throw new IOException(String.format( - "The source file %s doesn't exists", source)); + "The source file %s doesn't exists", source)); } LZ4Factory factory = LZ4Factory.fastestInstance(); LZ4FastDecompressor decompressor = factory.fastDecompressor(); @@ -160,7 +159,7 @@ public static void decompressTar(String sourceFile, String outputDir, } private static Path zipSlipProtect(ArchiveEntry entry, Path targetDir) - throws IOException { + throws IOException { Path targetDirResolved = targetDir.resolve(entry.getName()); /* * Make sure normalized file still has targetDir as its prefix, @@ -183,7 +182,7 @@ public static void compressZip(String inputDir, String outputFile, public static void compressZip(String rootDir, String sourceDir, String outputFile, Checksum checksum) - throws IOException { + throws IOException { try (FileOutputStream fos = new FileOutputStream(outputFile); CheckedOutputStream cos = new CheckedOutputStream(fos, checksum); BufferedOutputStream bos = new BufferedOutputStream(cos); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java index b8cb06e243..15d3f63c08 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java @@ -36,11 +36,10 @@ import org.apache.commons.configuration2.tree.NodeModel; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.config.HugeConfig; +import org.slf4j.Logger; public final class ConfigUtil { @@ -55,13 +54,13 @@ public static void checkGremlinConfig(String conf) { try { FileBasedConfigurationBuilder builder = - new FileBasedConfigurationBuilder(YAMLConfiguration.class) - .configure(params.fileBased().setFileName(conf)); + new FileBasedConfigurationBuilder(YAMLConfiguration.class) + .configure(params.fileBased().setFileName(conf)); YAMLConfiguration config = (YAMLConfiguration) builder.getConfiguration(); List> nodes = - config.childConfigurationsAt( - NODE_GRAPHS); + config.childConfigurationsAt( + NODE_GRAPHS); if (nodes == null || nodes.isEmpty()) { return; } @@ -74,9 +73,9 @@ public static void checkGremlinConfig(String conf) { 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); + (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'", diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java index 00c6655a39..daa54ee958 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java @@ -254,7 +254,7 @@ public static void executeOncePerThread(ExecutorService executor, int totalThreads, Runnable callback, long invokeTimeout) - throws InterruptedException { + throws InterruptedException { // Ensure callback execute at least once for every thread final Map threadsTimes = new ConcurrentHashMap<>(); final List> tasks = new ArrayList<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java index 5fff4b4e8b..0163656d5b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java @@ -24,7 +24,7 @@ /** * This class is used for fixed window to limit request per second * The different with stopwatch is to use timer for reducing count times - * + *

* TODO: Move to common module */ public class FixedTimerWindowRateLimiter implements RateLimiter { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java index 8d93abd2da..620571b621 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java @@ -25,10 +25,10 @@ /** * This class is used for fixed watch-window to rate limit request * Now just simplify for performance, don't need lock stop watch - * + *

* Note: This class is not thread safe * TODO: Move to common module - * */ + */ public class FixedWatchWindowRateLimiter implements RateLimiter { private final LongAdder count; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java index 8ffef5d17b..962d4a33a1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java @@ -22,7 +22,6 @@ import java.util.zip.Inflater; import org.apache.commons.codec.digest.DigestUtils; - import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.serializer.BytesBuffer; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java index aa3b491c24..7e634c7781 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.Date; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.io.HugeGraphSONModule; import org.apache.tinkerpop.shaded.jackson.core.JsonGenerator; import org.apache.tinkerpop.shaded.jackson.core.JsonProcessingException; import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference; @@ -30,8 +32,6 @@ import org.apache.tinkerpop.shaded.jackson.databind.module.SimpleModule; import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.io.HugeGraphSONModule; import com.google.common.collect.ImmutableSet; public final class JsonUtil { @@ -91,9 +91,10 @@ public static T fromJson(String json, TypeReference typeRef) { /** * Number collection will be parsed to Double Collection via fromJson, * this method used to cast element in collection to original number type - * @param object original number - * @param clazz target type - * @return target number + * + * @param object original number + * @param clazz target type + * @return target number */ public static Object castNumber(Object object, Class clazz) { if (object instanceof Number) { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java index 87df7c688d..ce789c6d8d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java @@ -74,7 +74,7 @@ public static byte[] toKryoWithType(Object value) { @SuppressWarnings("unchecked") public static T fromKryoWithType(byte[] value) { - E.checkState(value != null, "Kryo value can't be null for object"); + E.checkState(value != null, "Kryo value can't be null for object"); return (T) kryo().readClassAndObject(new Input(value)); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java index 842b590f16..fd4e6814d6 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java @@ -29,14 +29,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; -import org.apache.hugegraph.backend.id.Id; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.concurrent.KeyLock; import org.apache.hugegraph.concurrent.LockManager; import org.apache.hugegraph.concurrent.RowLock; import org.apache.hugegraph.type.HugeType; +import org.slf4j.Logger; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -109,8 +109,8 @@ private static Lock lockRead(String group, String lock) { lock, group); if (!readLock.tryLock()) { throw new HugeException( - "Lock [%s:%s] is locked by other operation", - group, lock); + "Lock [%s:%s] is locked by other operation", + group, lock); } LOG.debug("Got the read lock '{}' of LockGroup '{}'", lock, group); return readLock; @@ -125,8 +125,8 @@ private static Lock lockWrite(String group, String lock, long time) { try { if (!writeLock.tryLock(time, TimeUnit.SECONDS)) { throw new HugeException( - "Lock [%s:%s] is locked by other operation", - group, lock); + "Lock [%s:%s] is locked by other operation", + group, lock); } break; } catch (InterruptedException ignore) { @@ -197,8 +197,8 @@ public static List lock(String... locks) { break; default: throw new IllegalArgumentException(String.format( - "Invalid args '%s' at position '%s', " + - "expect 'write' or 'read'", locks[i], i)); + "Invalid args '%s' at position '%s', " + + "expect 'write' or 'read'", locks[i], i)); } } return lockList; @@ -216,7 +216,7 @@ public static String hugeType2Group(HugeType type) { return INDEX_LABEL_ADD_UPDATE; default: throw new AssertionError(String.format( - "Invalid HugeType '%s'", type)); + "Invalid HugeType '%s'", type)); } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java index 4eb81a8b15..3dbbff6b9d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java @@ -17,8 +17,6 @@ package org.apache.hugegraph.util; -import org.apache.hugegraph.util.E; - import java.util.Map; public class ParameterUtil { diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java index 990a03a7ee..e5a9d47643 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java @@ -34,6 +34,9 @@ public interface RateLimiter { * * @param ratePerSecond the rate of the returned RateLimiter, measured in * how many permits become available per second + *

+ *

+ *

* * TODO: refactor it to make method unchangeable */ diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java index 456ec9a223..150fb2949d 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java @@ -17,14 +17,14 @@ package org.apache.hugegraph.util; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.exception.NotSupportException; -import org.slf4j.Logger; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.exception.NotSupportException; +import org.slf4j.Logger; + public class Reflection { private static final Logger LOG = Log.logger(Reflection.class); @@ -34,9 +34,9 @@ public class Reflection { private static final Method REGISTER_METHODS_TO_FILTER_MOTHOD; public static final String JDK_INTERNAL_REFLECT_REFLECTION = - "jdk.internal.reflect.Reflection"; + "jdk.internal.reflect.Reflection"; public static final String SUN_REFLECT_REFLECTION = - "sun.reflect.Reflection"; + "sun.reflect.Reflection"; static { Method registerFieldsToFilterMethodTemp = null; @@ -44,7 +44,7 @@ public class Reflection { Class reflectionClazzTemp = null; try { reflectionClazzTemp = Class.forName( - JDK_INTERNAL_REFLECT_REFLECTION); + JDK_INTERNAL_REFLECT_REFLECTION); } catch (ClassNotFoundException e) { try { reflectionClazzTemp = Class.forName(SUN_REFLECT_REFLECTION); @@ -80,7 +80,7 @@ public static void registerFieldsToFilter(Class containingClass, String... fieldNames) { if (REGISTER_FILEDS_TO_FILTER_METHOD == null) { throw new NotSupportException( - "Reflection.registerFieldsToFilter()"); + "Reflection.registerFieldsToFilter()"); } try { @@ -89,8 +89,8 @@ public static void registerFieldsToFilter(Class containingClass, containingClass, fieldNames); } catch (IllegalAccessException | InvocationTargetException e) { throw new HugeException( - "Failed to register class '%s' fields to filter: %s", - containingClass, Arrays.toString(fieldNames)); + "Failed to register class '%s' fields to filter: %s", + containingClass, Arrays.toString(fieldNames)); } } @@ -98,7 +98,7 @@ public static void registerMethodsToFilter(Class containingClass, String... methodNames) { if (REGISTER_METHODS_TO_FILTER_MOTHOD == null) { throw new NotSupportException( - "Reflection.registerMethodsToFilterMethod()"); + "Reflection.registerMethodsToFilterMethod()"); } try { @@ -107,8 +107,8 @@ public static void registerMethodsToFilter(Class containingClass, containingClass, methodNames); } catch (IllegalAccessException | InvocationTargetException e) { throw new HugeException( - "Failed to register class '%s' methods to filter: %s", - containingClass, Arrays.toString(methodNames)); + "Failed to register class '%s' methods to filter: %s", + containingClass, Arrays.toString(methodNames)); } } } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java index 16bf3207a3..c8d831c9cc 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java @@ -14,7 +14,6 @@ package org.apache.hugegraph.util; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java index d600145906..eba9d4fa6e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java @@ -26,6 +26,8 @@ import java.util.Set; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.type.define.CollectionType; +import org.apache.hugegraph.util.E; import org.eclipse.collections.api.map.primitive.IntObjectMap; import org.eclipse.collections.api.map.primitive.MutableIntObjectMap; import org.eclipse.collections.impl.list.mutable.FastList; @@ -33,9 +35,6 @@ import org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap; import org.eclipse.collections.impl.set.mutable.UnifiedSet; -import org.apache.hugegraph.type.define.CollectionType; -import org.apache.hugegraph.util.E; - import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -74,7 +73,7 @@ public static List newList(CollectionType type) { return new ObjectArrayList<>(); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -89,7 +88,7 @@ public static List newList(CollectionType type, return new ObjectArrayList<>(initialCapacity); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -104,7 +103,7 @@ public static List newList(CollectionType type, return new ObjectArrayList<>(collection); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -130,7 +129,7 @@ public static Set newSet(CollectionType type) { return new ObjectOpenHashSet<>(); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -145,7 +144,7 @@ public static Set newSet(CollectionType type, return new ObjectOpenHashSet<>(initialCapacity); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -160,7 +159,7 @@ public static Set newSet(CollectionType type, return new ObjectOpenHashSet<>(collection); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -190,7 +189,7 @@ public static Map newMap(CollectionType type) { return new Object2ObjectOpenHashMap<>(); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -205,7 +204,7 @@ public static Map newMap(CollectionType type, return new Object2ObjectOpenHashMap<>(initialCapacity); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -220,7 +219,7 @@ public static Map newMap(CollectionType type, return new Object2ObjectOpenHashMap<>(map); default: throw new AssertionError( - "Unsupported collection type: " + type); + "Unsupported collection type: " + type); } } @@ -229,18 +228,18 @@ public static MutableIntObjectMap newIntObjectMap() { } public static MutableIntObjectMap newIntObjectMap( - int initialCapacity) { + int initialCapacity) { return new IntObjectHashMap<>(initialCapacity); } public static MutableIntObjectMap newIntObjectMap( - IntObjectMap map) { + IntObjectMap map) { return new IntObjectHashMap<>(map); } @SuppressWarnings("unchecked") public static MutableIntObjectMap newIntObjectMap( - Object... objects) { + Object... objects) { IntObjectHashMap map = IntObjectHashMap.newMap(); E.checkArgument(objects.length % 2 == 0, "Must provide even arguments for " + diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java index d3d06c223c..57f3b12021 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java @@ -23,11 +23,10 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; -import org.eclipse.collections.api.iterator.MutableLongIterator; -import org.eclipse.collections.impl.set.mutable.primitive.LongHashSet; - import org.apache.hugegraph.iterator.ExtendableIterator; import org.apache.hugegraph.type.define.CollectionType; +import org.eclipse.collections.api.iterator.MutableLongIterator; +import org.eclipse.collections.impl.set.mutable.primitive.LongHashSet; public class IdSet extends AbstractSet { @@ -65,8 +64,8 @@ public boolean contains(Object object) { @Override public Iterator iterator() { return new ExtendableIterator<>( - this.nonNumberIds.iterator(), - new EcLongIdIterator(this.numberIds.longIterator())); + this.nonNumberIds.iterator(), + new EcLongIdIterator(this.numberIds.longIterator())); } @Override diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java index 654f7bbf50..3786119bb1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java @@ -177,7 +177,7 @@ public String toString() { int capacity = (this.size() + 1) * 64; StringBuilder sb = new StringBuilder(capacity); sb.append("{"); - for (IntIterator iter = this.keys(); iter.hasNext();) { + for (IntIterator iter = this.keys(); iter.hasNext(); ) { if (sb.length() > 1) { sb.append(", "); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java index 9dd50b4c49..96d616a964 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java @@ -47,7 +47,7 @@ public Integer next() { } static IntIterator wrap( - org.eclipse.collections.api.iterator.IntIterator iter) { + org.eclipse.collections.api.iterator.IntIterator iter) { return new EcIntIterator(iter); } @@ -64,7 +64,7 @@ final class EcIntIterator implements IntIterator { private final org.eclipse.collections.api.iterator.IntIterator iterator; public EcIntIterator(org.eclipse.collections.api.iterator.IntIterator - iterator) { + iterator) { this.iterator = iterator; } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java index 2ce53d99c8..fe8f20b78e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java @@ -22,12 +22,11 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; -import org.eclipse.collections.api.map.primitive.MutableIntIntMap; -import org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap; - import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.collection.IntIterator.IntIterators; import org.apache.hugegraph.util.collection.IntIterator.MapperInt2IntIterator; +import org.eclipse.collections.api.map.primitive.MutableIntIntMap; +import org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap; import sun.misc.Unsafe; @@ -70,13 +69,13 @@ final class IntMapBySegments implements IntMap { private static final int DEFAULT_SEGMENTS = (IntSet.CPUS + 8) * 32; private static final Function DEFAULT_CREATOR = - size -> new IntMapByFixedAddr(size); + size -> new IntMapByFixedAddr(size); @SuppressWarnings("static-access") private static final int BASE_OFFSET = UNSAFE.ARRAY_OBJECT_BASE_OFFSET; @SuppressWarnings("static-access") private static final int SHIFT = 31 - Integer.numberOfLeadingZeros( - UNSAFE.ARRAY_OBJECT_INDEX_SCALE); + UNSAFE.ARRAY_OBJECT_INDEX_SCALE); public IntMapBySegments(int capacity) { this(capacity, DEFAULT_SEGMENTS, DEFAULT_CREATOR); @@ -243,7 +242,7 @@ private IntMap segmentAt(int index) { * NOTE: IntMapByFixedAddr is: * - faster 3x than ec IntIntHashMap for single thread; * - faster 8x than ec IntIntHashMap for 4 threads, 4x operations - * with 0.5x cost; + * with 0.5x cost; */ final class IntMapByFixedAddr implements IntMap { @@ -260,7 +259,7 @@ final class IntMapByFixedAddr implements IntMap { private static final int BASE_OFFSET = UNSAFE.ARRAY_INT_BASE_OFFSET; @SuppressWarnings("static-access") private static final int MUL4 = 31 - Integer.numberOfLeadingZeros( - UNSAFE.ARRAY_INT_INDEX_SCALE); + UNSAFE.ARRAY_INT_INDEX_SCALE); public IntMapByFixedAddr(int capacity) { this.capacity = capacity; @@ -280,9 +279,9 @@ public IntMapByFixedAddr(int capacity) { this.indexBlockSize = IntSet.segmentSize(capacity, this.indexBlocksNum); this.indexBlockSizeShift = Integer.numberOfTrailingZeros( - this.indexBlockSize); + this.indexBlockSize); this.indexBlocksSet = new IntSet.IntSetByFixedAddr4Unsigned( - this.indexBlocksNum); + this.indexBlocksNum); this.clear(); } @@ -441,7 +440,7 @@ public boolean hasNext() { } } this.indexOfBlock = indexBlocksSet.nextKey( - this.indexOfBlock + 1); + this.indexOfBlock + 1); this.indexInBlock = 0; } assert !this.fetched; @@ -487,7 +486,7 @@ public boolean hasNext() { } } this.indexOfBlock = indexBlocksSet.nextKey( - this.indexOfBlock + 1); + this.indexOfBlock + 1); this.indexInBlock = 0; } return false; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMapByDynamicHash.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMapByDynamicHash.java index 0e761b9113..52aac88da9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMapByDynamicHash.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMapByDynamicHash.java @@ -49,8 +49,9 @@ public class IntMapByDynamicHash implements IntMap { private static final int NULL_VALUE = Integer.MIN_VALUE; private static final AtomicReferenceFieldUpdater - TABLE_UPDATER = - AtomicReferenceFieldUpdater.newUpdater(IntMapByDynamicHash.class, Entry[].class, "table"); + TABLE_UPDATER = + AtomicReferenceFieldUpdater.newUpdater(IntMapByDynamicHash.class, Entry[].class, + "table"); private volatile Entry[] table; @@ -94,7 +95,7 @@ public IntMapByDynamicHash(int initialCapacity) { // we want 7 extra slots, and 64 bytes for each slot int are 4 bytes, // so 64 bytes are 16 ints. this.partitionedSize = - new int[SIZE_BUCKETS * 16]; + new int[SIZE_BUCKETS * 16]; } // The end index is for resizeContainer this.table = new Entry[cap + 1]; @@ -203,7 +204,7 @@ private int slowPut(int key, int value, Entry[] currentTable) { int oldVal = e.getValue(); // Key found, replace the entry Entry newEntry = - new Entry(key, value, this.createReplacementChainForRemoval(o, e)); + new Entry(key, value, this.createReplacementChainForRemoval(o, e)); if (IntMapByDynamicHash.casTableAt(currentTable, index, o, newEntry)) { return oldVal; } @@ -385,8 +386,8 @@ public void clear() { Entry o = (Entry) IntMapByDynamicHash.tableAt(currentArray, i); if (o == RESIZED || o == RESIZING) { resizeContainer = - (ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, - currentArray.length - 1); + (ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, + currentArray.length - 1); } else if (o != null) { Entry e = o; if (IntMapByDynamicHash.casTableAt(currentArray, i, o, null)) { @@ -645,7 +646,8 @@ private void transfer(Entry[] src, ResizeContainer resizeContainer) { */ private Entry[] helpWithResize(Entry[] currentArray) { ResizeContainer resizeContainer = - (ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, currentArray.length - 1); + (ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, + currentArray.length - 1); Entry[] newTable = resizeContainer.nextArray; if (resizeContainer.getQueuePosition() > ResizeContainer.QUEUE_INCREMENT) { resizeContainer.incrementResizer(); @@ -714,8 +716,8 @@ private void unconditionalCopy(Entry[] dest, Entry toCopyEntry) { Entry o = (Entry) IntMapByDynamicHash.tableAt(currentArray, index); if (o == RESIZED || o == RESIZING) { currentArray = - ((ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, - length - 1)).nextArray; + ((ResizeContainer) IntMapByDynamicHash.tableAt(currentArray, + length - 1)).nextArray; } else { Entry newEntry; if (o == null) { @@ -743,8 +745,8 @@ private void unconditionalCopy(Entry[] dest, Entry toCopyEntry) { private static final class ResizeContainer extends Entry { private static final int QUEUE_INCREMENT = - Math.min(1 << 10, - Integer.highestOneBit(IntSet.CPUS) << 4); + Math.min(1 << 10, + Integer.highestOneBit(IntSet.CPUS) << 4); private final AtomicInteger resizers = new AtomicInteger(1); private final Entry[] nextArray; private final AtomicInteger queuePosition; @@ -868,6 +870,7 @@ public String toString() { /* ---------------- Iterator -------------- */ private static final class IteratorState { + private Entry[] currentTable; private int start; private int end; @@ -913,11 +916,12 @@ protected HashIterator() { private void findNext() { while (this.index < this.currentState.end) { Entry o = - (Entry) IntMapByDynamicHash.tableAt(this.currentState.currentTable, this.index); + (Entry) IntMapByDynamicHash.tableAt(this.currentState.currentTable, + this.index); if (o == RESIZED || o == RESIZING) { Entry[] nextArray = - IntMapByDynamicHash.this.helpWithResizeWhileCurrentIndex( - this.currentState.currentTable, this.index); + IntMapByDynamicHash.this.helpWithResizeWhileCurrentIndex( + this.currentState.currentTable, this.index); int endResized = this.index + 1; while (endResized < this.currentState.end) { if (IntMapByDynamicHash.tableAt(this.currentState.currentTable, @@ -931,7 +935,7 @@ private void findNext() { } if (endResized < this.currentState.end) { this.todo.add(new IteratorState( - this.currentState.currentTable, endResized, this.currentState.end)); + this.currentState.currentTable, endResized, this.currentState.end)); } int powerTwoLength = this.currentState.currentTable.length - 1; this.todo.add(new IteratorState(nextArray, this.index + powerTwoLength, @@ -974,6 +978,7 @@ final Entry nextEntry() { } private final class ValueIterator extends HashIterator { + @Override public int next() { return this.nextEntry().getValue(); @@ -981,6 +986,7 @@ public int next() { } private final class KeyIterator extends HashIterator { + @Override public int next() { return this.nextEntry().getKey(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java index 3431247c40..ce37bda8ef 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java @@ -21,11 +21,10 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; +import org.apache.hugegraph.util.E; import org.eclipse.collections.api.collection.primitive.MutableIntCollection; import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet; -import org.apache.hugegraph.util.E; - import io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess; public interface IntSet { @@ -59,13 +58,13 @@ final class IntSetBySegments implements IntSet { private static final int DEFAULT_SEGMENTS = IntSet.CPUS * 100; private static final Function DEFAULT_CREATOR = - size -> new IntSetByFixedAddr4Unsigned(size); + size -> new IntSetByFixedAddr4Unsigned(size); @SuppressWarnings("static-access") private static final int BASE_OFFSET = UNSAFE.ARRAY_OBJECT_BASE_OFFSET; @SuppressWarnings("static-access") private static final int SHIFT = 31 - Integer.numberOfLeadingZeros( - UNSAFE.ARRAY_OBJECT_INDEX_SCALE); + UNSAFE.ARRAY_OBJECT_INDEX_SCALE); public IntSetBySegments(int capacity) { this(capacity, DEFAULT_SEGMENTS, DEFAULT_CREATOR); @@ -195,7 +194,7 @@ private IntSet segmentAt(int index) { * NOTE: IntSetByFixedAddr is: * - faster 3x than ec IntIntHashSet for single thread; * - faster 6x than ec IntIntHashSet for 4 threads, 4x operations - * with 0.67x cost; + * with 0.67x cost; * - faster 20x than ec IntIntHashSet-segment-lock for 4 threads; * - faster 60x than ec IntIntHashSet-global-lock for 4 threads; */ @@ -302,7 +301,7 @@ final class IntSetByFixedAddr4Unsigned implements IntSet { private static final int BASE_OFFSET = UNSAFE.ARRAY_LONG_BASE_OFFSET; @SuppressWarnings("static-access") private static final int MUL8 = 31 - Integer.numberOfLeadingZeros( - UNSAFE.ARRAY_LONG_INDEX_SCALE); + UNSAFE.ARRAY_LONG_INDEX_SCALE); public IntSetByFixedAddr4Unsigned(int numBits) { this.numBits = numBits; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java index 56e9683097..832ed680bc 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java @@ -17,10 +17,9 @@ package org.apache.hugegraph.util.collection; -import org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.perf.PerfUtil.Watched; +import org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap; public class ObjectIntMappingFactory { @@ -29,13 +28,13 @@ public static ObjectIntMapping newObjectIntMapping() { } public static ObjectIntMapping newObjectIntMapping( - boolean concurrent) { + boolean concurrent) { return concurrent ? new ConcurrentObjectIntMapping<>() : - new SingleThreadObjectIntMapping<>(); + new SingleThreadObjectIntMapping<>(); } public static final class SingleThreadObjectIntMapping - implements ObjectIntMapping { + implements ObjectIntMapping { private static final int MAGIC = 1 << 16; private static final int MAX_OFFSET = 10; @@ -103,7 +102,7 @@ public String toString() { } public static final class ConcurrentObjectIntMapping - implements ObjectIntMapping { + implements ObjectIntMapping { private final SingleThreadObjectIntMapping objectIntMapping; diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java index 9dc8515e33..fa3c733cc5 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java @@ -38,10 +38,12 @@ import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.schema.VertexLabel; +import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.Cardinality; import org.apache.hugegraph.type.define.DataType; import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Graph.Hidden; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -49,9 +51,6 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory; import org.slf4j.Logger; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.util.Log; - public class HugeVariables implements Graph.Variables { private static final Logger LOG = Log.logger(HugeVariables.class); @@ -216,7 +215,7 @@ public Optional get(String key) { String type = vertex.value(Hidden.hide(VARIABLE_TYPE)); if (!Arrays.asList(TYPES).contains(Hidden.hide(type))) { throw Graph.Variables.Exceptions - .dataTypeOfVariableValueNotSupported(type); + .dataTypeOfVariableValueNotSupported(type); } // The value of key VARIABLE_TYPE is the name of variable value return Optional.of(vertex.value(Hidden.hide(type))); @@ -262,7 +261,7 @@ public Map asMap() { String type = vertex.value(Hidden.hide(VARIABLE_TYPE)); if (!Arrays.asList(TYPES).contains(Hidden.hide(type))) { throw Graph.Variables.Exceptions - .dataTypeOfVariableValueNotSupported(type); + .dataTypeOfVariableValueNotSupported(type); } Object value = vertex.value(Hidden.hide(type)); variables.put(key, value); @@ -322,7 +321,7 @@ private void setProperty(HugeVertex vertex, String key, Object value) { vertex.property(Hidden.hide(VARIABLE_TYPE), STRING_VALUE + suffix); } else { throw Graph.Variables.Exceptions - .dataTypeOfVariableValueNotSupported(value); + .dataTypeOfVariableValueNotSupported(value); } } @@ -335,7 +334,7 @@ private void createVariableVertex(String key, Object value) { this.setProperty(vertex, key, value); } catch (IllegalArgumentException e) { throw Graph.Variables.Exceptions - .dataTypeOfVariableValueNotSupported(value, e); + .dataTypeOfVariableValueNotSupported(value, e); } // PrimaryKey id vertex.assignId(null); @@ -367,7 +366,7 @@ private ConditionQuery createVariableQuery(String name) { query.eq(HugeKeys.LABEL, vl.id()); if (name != null) { PropertyKey pkey = this.params.graph().propertyKey( - Hidden.hide(VARIABLE_KEY)); + Hidden.hide(VARIABLE_KEY)); query.query(Condition.eq(pkey.id(), name)); } query.showHidden(true); From 5551ec17f23916124a4c3ac8fcd9ec0a5600a9f1 Mon Sep 17 00:00:00 2001 From: M <87920097+msgui@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:22:54 +0800 Subject: [PATCH 05/37] fix: format and clean code in modules (#2439) Format & clean code in submodels: 1. API 2. Scylladb 3. Postgresql 4. Rocksdb 5. Palo 6. Mysql 7. Hbase 8. Cassandra 9. Test --------- Co-authored-by: imbajin --- .../java/org/apache/hugegraph/api/API.java | 15 +- .../hugegraph/api/arthas/ArthasAPI.java | 1 - .../apache/hugegraph/api/auth/AccessAPI.java | 36 +- .../apache/hugegraph/api/auth/BelongAPI.java | 34 +- .../apache/hugegraph/api/auth/GroupAPI.java | 34 +- .../apache/hugegraph/api/auth/ProjectAPI.java | 36 +- .../apache/hugegraph/api/auth/TargetAPI.java | 32 +- .../apache/hugegraph/api/auth/UserAPI.java | 36 +- .../hugegraph/api/cypher/CypherAPI.java | 1 - .../hugegraph/api/cypher/CypherClient.java | 26 +- .../hugegraph/api/cypher/CypherModel.java | 2 + .../api/filter/AuthenticationFilter.java | 10 +- .../api/filter/CompressInterceptor.java | 19 +- .../api/filter/DecompressInterceptor.java | 3 +- .../hugegraph/api/filter/ExceptionFilter.java | 52 +-- .../api/filter/LoadDetectFilter.java | 35 +- .../api/filter/LoadReleaseFilter.java | 4 +- .../hugegraph/api/filter/RedirectFilter.java | 1 + .../hugegraph/api/filter/StatusFilter.java | 3 +- .../apache/hugegraph/api/graph/BatchAPI.java | 37 +- .../apache/hugegraph/api/graph/EdgeAPI.java | 166 +++---- .../apache/hugegraph/api/graph/VertexAPI.java | 98 ++-- .../api/gremlin/AbstractJerseyRestClient.java | 2 +- .../hugegraph/api/gremlin/GremlinAPI.java | 16 +- .../api/gremlin/GremlinQueryAPI.java | 1 + .../hugegraph/api/job/AlgorithmAPI.java | 1 - .../apache/hugegraph/api/job/GremlinAPI.java | 4 +- .../org/apache/hugegraph/api/job/TaskAPI.java | 12 +- .../hugegraph/api/metrics/MetricsAPI.java | 1 - .../hugegraph/api/profile/GraphsAPI.java | 48 +- .../hugegraph/api/profile/ProfileAPI.java | 31 +- .../hugegraph/api/profile/VersionAPI.java | 19 +- .../hugegraph/api/profile/WhiteIpListAPI.java | 6 +- .../apache/hugegraph/api/raft/RaftAPI.java | 34 +- .../api/traversers/AdamicAdarAPI.java | 21 +- .../hugegraph/api/traversers/CountAPI.java | 22 +- .../api/traversers/EdgeExistenceAPI.java | 1 - .../api/traversers/NeighborRankAPI.java | 22 +- .../api/traversers/PersonalRankAPI.java | 20 +- .../api/traversers/ResourceAllocationAPI.java | 21 +- .../hugegraph/api/traversers/Vertices.java | 10 +- .../hugegraph/api/variables/VariablesAPI.java | 22 +- .../hugegraph/auth/ConfigAuthenticator.java | 5 +- .../hugegraph/auth/ContextGremlinServer.java | 8 +- .../hugegraph/auth/HugeAuthenticator.java | 10 +- .../hugegraph/auth/HugeFactoryAuthProxy.java | 441 ++++++++++++++---- .../hugegraph/auth/HugeGraphAuthProxy.java | 62 +-- .../hugegraph/auth/StandardAuthenticator.java | 7 +- .../auth/WsAndHttpBasicAuthHandler.java | 10 +- .../hugegraph/config/ServerOptions.java | 48 +- .../apache/hugegraph/core/GraphManager.java | 16 +- .../hugegraph/define/UpdateStrategy.java | 9 +- .../hugegraph/metrics/MetricsModule.java | 2 +- .../hugegraph/metrics/ServerReporter.java | 5 +- .../hugegraph/metrics/SystemMetrics.java | 5 +- .../opencypher/CypherOpProcessor.java | 38 +- .../hugegraph/opencypher/CypherPlugin.java | 28 +- .../rpc/RpcClientProviderWithAuth.java | 3 +- .../hugegraph/server/ApplicationConfig.java | 32 +- .../apache/hugegraph/server/RestServer.java | 21 +- .../cassandra/CassandraEntryIterator.java | 2 +- .../store/cassandra/CassandraMetrics.java | 6 +- .../store/cassandra/CassandraSerializer.java | 1 + .../store/cassandra/CassandraSessionPool.java | 1 + .../store/cassandra/CassandraShard.java | 42 +- .../store/cassandra/CassandraStore.java | 48 +- .../store/cassandra/CassandraTable.java | 35 +- .../store/cassandra/CassandraTables.java | 8 +- .../hugegraph-dist/docker/README.md | 2 +- .../backend/store/hbase/HbaseMetrics.java | 10 +- .../backend/store/hbase/HbaseOptions.java | 2 +- .../backend/store/hbase/HbaseSerializer.java | 3 +- .../backend/store/hbase/HbaseSessions.java | 18 +- .../backend/store/hbase/HbaseStore.java | 55 +-- .../backend/store/hbase/HbaseTable.java | 16 +- .../backend/store/hbase/HbaseTables.java | 3 +- .../store/mysql/MysqlEntryIterator.java | 4 +- .../backend/store/mysql/MysqlMetrics.java | 1 + .../backend/store/mysql/MysqlOptions.java | 6 +- .../backend/store/mysql/MysqlSerializer.java | 3 +- .../backend/store/mysql/MysqlSessions.java | 20 +- .../backend/store/mysql/MysqlStore.java | 13 +- .../backend/store/mysql/MysqlTable.java | 24 +- .../backend/store/mysql/MysqlTables.java | 21 +- .../backend/store/mysql/WhereBuilder.java | 34 +- .../backend/store/palo/PaloFile.java | 2 +- .../backend/store/palo/PaloSessions.java | 6 +- .../backend/store/palo/PaloStore.java | 3 +- .../backend/store/palo/PaloStoreProvider.java | 4 +- .../backend/store/palo/PaloTable.java | 5 +- .../backend/store/palo/PaloTables.java | 10 +- .../postgresql/PostgresqlSerializer.java | 5 +- .../store/postgresql/PostgresqlSessions.java | 34 +- .../postgresql/PostgresqlStoreProvider.java | 9 +- .../store/postgresql/PostgresqlTable.java | 6 +- .../store/postgresql/PostgresqlTables.java | 34 +- .../store/rocksdb/RocksDBStdSessions.java | 36 +- .../backend/store/rocksdb/RocksDBStore.java | 4 +- .../backend/store/rocksdb/RocksDBTable.java | 2 +- .../store/rocksdbsst/RocksDBSstSessions.java | 4 +- .../store/rocksdbsst/RocksDBSstStore.java | 2 +- .../store/scylladb/ScyllaDBMetrics.java | 1 - .../store/scylladb/ScyllaDBStoreProvider.java | 9 +- .../store/scylladb/ScyllaDBTablesWithMV.java | 51 +- hugegraph-server/hugegraph-test/pom.xml | 2 +- .../apache/hugegraph/api/ApiTestSuite.java | 32 +- .../org/apache/hugegraph/api/BaseApiTest.java | 274 +++++------ .../apache/hugegraph/api/CypherApiTest.java | 2 +- .../org/apache/hugegraph/api/EdgeApiTest.java | 176 +++---- .../hugegraph/api/EdgeLabelApiTest.java | 96 ++-- .../apache/hugegraph/api/GremlinApiTest.java | 193 ++++---- .../hugegraph/api/IndexLabelApiTest.java | 102 ++-- .../apache/hugegraph/api/LoginApiTest.java | 9 +- .../apache/hugegraph/api/ProjectApiTest.java | 6 +- .../hugegraph/api/PropertyKeyApiTest.java | 40 +- .../org/apache/hugegraph/api/TaskApiTest.java | 10 +- .../org/apache/hugegraph/api/UserApiTest.java | 10 +- .../apache/hugegraph/api/VertexApiTest.java | 48 +- .../hugegraph/api/VertexLabelApiTest.java | 72 +-- .../api/traversers/AdamicAdarAPITest.java | 6 +- .../traversers/AllShortestPathsApiTest.java | 2 +- .../api/traversers/CountApiTest.java | 6 +- .../api/traversers/CrosspointsApiTest.java | 9 +- .../CustomizedCrosspointsApiTest.java | 4 +- .../api/traversers/EdgesApiTest.java | 9 +- .../traversers/FusiformSimilarityApiTest.java | 4 +- .../MultiNodeShortestPathApiTest.java | 4 +- .../api/traversers/NeighborRankApiTest.java | 4 +- .../api/traversers/PathsApiTest.java | 6 +- .../api/traversers/PersonalRankApiTest.java | 4 +- .../traversers/ResourceAllocationAPITest.java | 6 +- .../api/traversers/RingsApiTest.java | 5 +- .../api/traversers/ShortestPathApiTest.java | 5 +- .../api/traversers/TemplatePathsApiTest.java | 5 +- .../traversers/TraversersApiTestSuite.java | 45 +- .../WeightedShortestPathApiTest.java | 5 +- .../org/apache/hugegraph/core/AuthTest.java | 100 ++-- .../apache/hugegraph/core/CoreTestSuite.java | 27 +- .../apache/hugegraph/core/EdgeCoreTest.java | 319 ++++++------- .../hugegraph/core/EdgeLabelCoreTest.java | 48 +- .../hugegraph/core/IndexLabelCoreTest.java | 72 +-- .../hugegraph/core/PropertyCoreTest.java | 22 +- .../hugegraph/core/PropertyKeyCoreTest.java | 12 +- .../apache/hugegraph/core/RamTableTest.java | 31 +- .../hugegraph/core/RestoreCoreTest.java | 127 +++-- .../core/RoleElectionStateMachineTest.java | 2 +- .../apache/hugegraph/core/SchemaCoreTest.java | 5 +- .../apache/hugegraph/core/TaskCoreTest.java | 157 ++++--- .../apache/hugegraph/core/VertexCoreTest.java | 390 ++++++++-------- .../hugegraph/core/VertexLabelCoreTest.java | 40 +- .../hugegraph/testutil/FakeObjects.java | 3 +- .../org/apache/hugegraph/testutil/Utils.java | 7 +- .../tinkerpop/ProcessBasicSuite.java | 286 ++++++------ .../tinkerpop/ProcessStandardTest.java | 1 + .../tinkerpop/StructureBasicSuite.java | 61 +-- .../tinkerpop/StructureStandardTest.java | 1 + .../apache/hugegraph/tinkerpop/TestGraph.java | 5 +- .../hugegraph/tinkerpop/TestGraphFactory.java | 2 +- .../tinkerpop/TestGraphProvider.java | 50 +- .../tinkerpop/tests/HugeGraphWriteTest.java | 11 +- .../apache/hugegraph/unit/BaseUnitTest.java | 7 +- .../apache/hugegraph/unit/FakeObjects.java | 9 +- .../apache/hugegraph/unit/UnitTestSuite.java | 137 +++--- .../unit/cache/CacheManagerTest.java | 20 +- .../hugegraph/unit/cache/CacheTest.java | 16 +- .../cache/CachedGraphTransactionTest.java | 9 +- .../cache/CachedSchemaTransactionTest.java | 8 +- .../hugegraph/unit/cache/RamTableTest.java | 9 +- .../unit/cassandra/CassandraTest.java | 20 +- .../hugegraph/unit/core/AnalyzerTest.java | 11 +- .../unit/core/BackendMutationTest.java | 7 +- .../unit/core/BackendStoreInfoTest.java | 7 +- .../unit/core/ConditionQueryFlattenTest.java | 8 +- .../hugegraph/unit/core/ConditionTest.java | 4 +- .../hugegraph/unit/core/DataTypeTest.java | 5 +- .../hugegraph/unit/core/DirectionsTest.java | 5 +- .../hugegraph/unit/core/ExceptionTest.java | 4 +- .../hugegraph/unit/core/LocksTableTest.java | 10 +- .../hugegraph/unit/core/PageStateTest.java | 3 +- .../apache/hugegraph/unit/core/QueryTest.java | 4 +- .../apache/hugegraph/unit/core/RangeTest.java | 11 +- .../unit/core/RolePermissionTest.java | 46 +- .../hugegraph/unit/core/RowLockTest.java | 11 +- .../unit/core/SecurityManagerTest.java | 14 +- .../hugegraph/unit/core/SerialEnumTest.java | 3 +- .../unit/core/SystemSchemaStoreTest.java | 5 +- .../unit/core/TraversalUtilTest.java | 19 +- .../apache/hugegraph/unit/id/EdgeIdTest.java | 10 +- .../org/apache/hugegraph/unit/id/IdTest.java | 12 +- .../apache/hugegraph/unit/id/IdUtilTest.java | 5 +- .../unit/id/SplicingIdGeneratorTest.java | 16 +- .../hugegraph/unit/mysql/MysqlUtilTest.java | 3 +- .../unit/mysql/WhereBuilderTest.java | 4 +- .../unit/rocksdb/RocksDBPerfTest.java | 4 +- .../unit/rocksdb/RocksDBSessionTest.java | 23 +- .../unit/serializer/BytesBufferTest.java | 10 +- .../serializer/SerializerFactoryTest.java | 5 +- .../unit/serializer/StoreSerializerTest.java | 7 +- .../serializer/TableBackendEntryTest.java | 4 +- .../unit/serializer/TextBackendEntryTest.java | 4 +- .../hugegraph/unit/util/CompressUtilTest.java | 6 +- .../hugegraph/unit/util/JsonUtilTest.java | 33 +- .../hugegraph/unit/util/RateLimiterTest.java | 5 +- .../unit/util/StringEncodingTest.java | 13 +- .../hugegraph/unit/util/VersionTest.java | 5 +- .../collection/CollectionFactoryTest.java | 12 +- .../unit/util/collection/IdSetTest.java | 9 +- .../unit/util/collection/Int2IntsMapTest.java | 47 +- .../unit/util/collection/IntMapTest.java | 18 +- .../unit/util/collection/IntSetTest.java | 11 +- .../util/collection/ObjectIntMappingTest.java | 9 +- .../src/main/resources/log4j2.xml | 26 +- .../map/MapRandomGetPutThroughputTest.java | 8 +- 213 files changed, 3152 insertions(+), 2899 deletions(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java index 444549a805..b7f564e8d8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java @@ -48,22 +48,23 @@ public class API { public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN; public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON; public static final String APPLICATION_JSON_WITH_CHARSET = - APPLICATION_JSON + ";charset=" + CHARSET; - public static final String APPLICATION_TEXT_WITH_CHARSET = MediaType.TEXT_PLAIN + ";charset=" + CHARSET; + APPLICATION_JSON + ";charset=" + CHARSET; + public static final String APPLICATION_TEXT_WITH_CHARSET = + MediaType.TEXT_PLAIN + ";charset=" + CHARSET; public static final String JSON = MediaType.APPLICATION_JSON_TYPE - .getSubtype(); + .getSubtype(); public static final String ACTION_APPEND = "append"; public static final String ACTION_ELIMINATE = "eliminate"; public static final String ACTION_CLEAR = "clear"; protected static final Logger LOG = Log.logger(API.class); private static final Meter SUCCEED_METER = - MetricsUtil.registerMeter(API.class, "commit-succeed"); + MetricsUtil.registerMeter(API.class, "commit-succeed"); private static final Meter ILLEGAL_ARG_ERROR_METER = - MetricsUtil.registerMeter(API.class, "illegal-arg"); + MetricsUtil.registerMeter(API.class, "illegal-arg"); private static final Meter EXPECTED_ERROR_METER = - MetricsUtil.registerMeter(API.class, "expected-error"); + MetricsUtil.registerMeter(API.class, "expected-error"); private static final Meter UNKNOWN_ERROR_METER = - MetricsUtil.registerMeter(API.class, "unknown-error"); + MetricsUtil.registerMeter(API.class, "unknown-error"); public static HugeGraph graph(GraphManager manager, String graph) { HugeGraph g = manager.graph(graph); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index cb819057ca..7cd9a98f8a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -29,7 +29,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java index 75dbad7fb0..5c07681da8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java @@ -19,37 +19,37 @@ import java.util.List; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import jakarta.inject.Singleton; -import jakarta.ws.rs.Path; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.HugeAccess; import org.apache.hugegraph.auth.HugePermission; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/accesses") @Singleton @Tag(name = "AccessAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java index 7880e434eb..da66c0cecc 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java @@ -19,7 +19,24 @@ import java.util.List; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeBelong; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -32,23 +49,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import jakarta.inject.Singleton; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeBelong; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/belongs") @Singleton @Tag(name = "BelongAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java index e70c88d316..f0ac7f6ea2 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java @@ -19,7 +19,24 @@ import java.util.List; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeGroup; +import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -32,23 +49,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import jakarta.inject.Singleton; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeGroup; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/groups") @Singleton @Tag(name = "GroupAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java index 1f048e9a01..c90323ef97 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java @@ -21,39 +21,39 @@ import java.util.List; import java.util.Set; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.AuthManager; import org.apache.hugegraph.auth.HugeProject; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/projects") @Singleton @Tag(name = "ProjectAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java index c13fff1517..eb52e455c1 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java @@ -20,6 +20,22 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter.Status; +import org.apache.hugegraph.auth.HugeTarget; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; @@ -34,22 +50,6 @@ import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.api.filter.StatusFilter.Status; -import org.apache.hugegraph.auth.HugeTarget; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - @Path("graphs/{graph}/auth/targets") @Singleton @Tag(name = "TargetAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java index 25d812104f..ed26573f83 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java @@ -19,39 +19,39 @@ import java.util.List; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.HugeUser; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.StringEncoding; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/auth/users") @Singleton @Tag(name = "UserAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java index c8cc3929fd..b24169aaaf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java @@ -34,7 +34,6 @@ import com.codahale.metrics.annotation.Timed; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java index eb3a86ff65..92ae18c54d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java @@ -17,16 +17,6 @@ package org.apache.hugegraph.api.cypher; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.commons.configuration2.Configuration; -import org.apache.tinkerpop.gremlin.driver.*; -import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; -import org.slf4j.Logger; - -import javax.annotation.Nullable; -import javax.annotation.concurrent.ThreadSafe; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -35,6 +25,20 @@ import java.util.concurrent.ExecutionException; import java.util.function.Supplier; +import javax.annotation.Nullable; +import javax.annotation.concurrent.ThreadSafe; + +import org.apache.commons.configuration2.Configuration; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.driver.Client; +import org.apache.tinkerpop.gremlin.driver.Cluster; +import org.apache.tinkerpop.gremlin.driver.Result; +import org.apache.tinkerpop.gremlin.driver.ResultSet; +import org.apache.tinkerpop.gremlin.driver.Tokens; +import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; +import org.slf4j.Logger; + @ThreadSafe public final class CypherClient { @@ -93,7 +97,7 @@ private RequestMessage createRequest(String cypherQuery) { } private List doQueryList(Client client, RequestMessage request) - throws ExecutionException, InterruptedException { + throws ExecutionException, InterruptedException { ResultSet results = client.submitAsync(request).get(); Iterator iter = results.iterator(); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java index c85a0aff0e..cd5a769237 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java @@ -50,12 +50,14 @@ private CypherModel() { } public static class Status { + public String message = ""; public int code; public Map attributes = Collections.EMPTY_MAP; } private static class Result { + public List data; public Map meta = Collections.EMPTY_MAP; } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java index ba69fd9c00..fffe5ef9e5 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java @@ -143,8 +143,8 @@ protected User authenticate(ContainerRequestContext context) { String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION); if (auth == null) { throw new NotAuthorizedException( - "Authentication credentials are required", - "Missing authentication credentials"); + "Authentication credentials are required", + "Missing authentication credentials"); } if (auth.startsWith(BASIC_AUTH_PREFIX)) { @@ -154,7 +154,7 @@ protected User authenticate(ContainerRequestContext context) { String[] values = auth.split(":"); if (values.length != 2) { throw new BadRequestException( - "Invalid syntax for username and password"); + "Invalid syntax for username and password"); } final String username = values[0]; @@ -163,7 +163,7 @@ protected User authenticate(ContainerRequestContext context) { if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { throw new BadRequestException( - "Invalid syntax for username and password"); + "Invalid syntax for username and password"); } credentials.put(HugeAuthenticator.KEY_USERNAME, username); @@ -173,7 +173,7 @@ protected User authenticate(ContainerRequestContext context) { credentials.put(HugeAuthenticator.KEY_TOKEN, token); } else { throw new BadRequestException( - "Only HTTP Basic or Bearer authentication is supported"); + "Only HTTP Basic or Bearer authentication is supported"); } credentials.put(HugeAuthenticator.KEY_ADDRESS, peer); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java index a5cf78aa4f..f38ffd78f3 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java @@ -24,18 +24,17 @@ import java.lang.annotation.RetentionPolicy; import java.util.zip.GZIPOutputStream; +import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import jakarta.inject.Singleton; import jakarta.ws.rs.NameBinding; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.ext.Provider; import jakarta.ws.rs.ext.WriterInterceptor; import jakarta.ws.rs.ext.WriterInterceptorContext; -import jakarta.inject.Singleton; - -import org.slf4j.Logger; - -import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; -import org.apache.hugegraph.util.Log; @Provider @Singleton @@ -51,7 +50,7 @@ public class CompressInterceptor implements WriterInterceptor { @Override public void aroundWriteTo(WriterInterceptorContext context) - throws IOException, WebApplicationException { + throws IOException, WebApplicationException { // If there is no annotation(like exception), we don't compress it if (context.getAnnotations().length > 0) { try { @@ -70,14 +69,14 @@ public void aroundWriteTo(WriterInterceptorContext context) } private void compress(WriterInterceptorContext context) - throws IOException { + throws IOException { // Get compress info from the @Compress annotation final Compress compression = getCompressAnnotation(context); final String encoding = compression.value(); final int buffer = compression.buffer(); // Update header - MultivaluedMap headers = context.getHeaders(); + MultivaluedMap headers = context.getHeaders(); headers.remove("Content-Length"); headers.add("Content-Encoding", encoding); @@ -104,7 +103,9 @@ private static Compress getCompressAnnotation(WriterInterceptorContext c) { @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Compress { + String value() default GZIP; + int buffer() default BUFFER_SIZE; } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java index d8de560900..af8615a4cb 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java @@ -37,7 +37,7 @@ public class DecompressInterceptor implements ReaderInterceptor { @Override public Object aroundReadFrom(ReaderInterceptorContext context) - throws IOException { + throws IOException { // NOTE: Currently we just support GZIP String encoding = context.getHeaders().getFirst("Content-Encoding"); if (!GZIP.equalsIgnoreCase(encoding)) { @@ -51,6 +51,7 @@ public Object aroundReadFrom(ReaderInterceptorContext context) @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Decompress { + String value() default GZIP; } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java index 894f38c661..ded04b3545 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java @@ -25,6 +25,18 @@ import javax.json.JsonArrayBuilder; import javax.json.JsonObjectBuilder; +import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.exception.HugeGremlinException; +import org.apache.hugegraph.exception.NotFoundException; +import org.glassfish.hk2.api.MultiException; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; @@ -41,18 +53,6 @@ import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.config.ServerOptions; -import org.glassfish.hk2.api.MultiException; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.HugeGremlinException; -import org.apache.hugegraph.exception.NotFoundException; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - public class ExceptionFilter { private static final int BAD_REQUEST_ERROR = @@ -107,8 +107,8 @@ public Object trace(boolean trace) { @Provider public static class HugeExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(HugeException exception) { @@ -121,8 +121,8 @@ public Response toResponse(HugeException exception) { @Provider public static class IllegalArgumentExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(IllegalArgumentException exception) { @@ -135,8 +135,8 @@ public Response toResponse(IllegalArgumentException exception) { @Provider public static class NotFoundExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(NotFoundException exception) { @@ -149,8 +149,8 @@ public Response toResponse(NotFoundException exception) { @Provider public static class NoSuchElementExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(NoSuchElementException exception) { @@ -163,8 +163,8 @@ public Response toResponse(NoSuchElementException exception) { @Provider public static class WebApplicationExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(WebApplicationException exception) { @@ -189,8 +189,8 @@ private boolean trace(int status) { @Provider public static class HugeGremlinExceptionMapper - extends TracedExceptionMapper - implements ExceptionMapper { + extends TracedExceptionMapper + implements ExceptionMapper { @Override public Response toResponse(HugeGremlinException exception) { @@ -204,7 +204,7 @@ public Response toResponse(HugeGremlinException exception) { @Provider public static class AssertionErrorMapper extends TracedExceptionMapper - implements ExceptionMapper { + implements ExceptionMapper { @Override public Response toResponse(AssertionError exception) { @@ -217,7 +217,7 @@ public Response toResponse(AssertionError exception) { @Provider public static class UnknownExceptionMapper extends TracedExceptionMapper - implements ExceptionMapper { + implements ExceptionMapper { @Override public Response toResponse(Throwable exception) { diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java index 42344e613f..7bda2b7562 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java @@ -20,6 +20,15 @@ import java.util.List; import java.util.Set; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.define.WorkLoad; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.E; + +import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.RateLimiter; + import jakarta.inject.Singleton; import jakarta.ws.rs.ServiceUnavailableException; import jakarta.ws.rs.container.ContainerRequestContext; @@ -29,14 +38,6 @@ import jakarta.ws.rs.core.PathSegment; import jakarta.ws.rs.ext.Provider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.define.WorkLoad; -import org.apache.hugegraph.util.Bytes; -import org.apache.hugegraph.util.E; -import com.google.common.collect.ImmutableSet; -import com.google.common.util.concurrent.RateLimiter; - @Provider @Singleton @PreMatching @@ -51,7 +52,7 @@ public class LoadDetectFilter implements ContainerRequestFilter { // Call gc every 30+ seconds if memory is low and request frequently private static final RateLimiter GC_RATE_LIMITER = - RateLimiter.create(1.0 / 30); + RateLimiter.create(1.0 / 30); @Context private jakarta.inject.Provider configProvider; @@ -71,9 +72,9 @@ public void filter(ContainerRequestContext context) { // There will be a thread doesn't work, dedicated to statistics if (load.incrementAndGet() >= maxWorkerThreads) { throw new ServiceUnavailableException(String.format( - "The server is too busy to process the request, " + - "you can config %s to adjust it or try again later", - ServerOptions.MAX_WORKER_THREADS.name())); + "The server is too busy to process the request, " + + "you can config %s to adjust it or try again later", + ServerOptions.MAX_WORKER_THREADS.name())); } long minFreeMemory = config.get(ServerOptions.MIN_FREE_MEMORY); @@ -84,11 +85,11 @@ public void filter(ContainerRequestContext context) { if (presumableFreeMem < minFreeMemory) { gcIfNeeded(); throw new ServiceUnavailableException(String.format( - "The server available memory %s(MB) is below than " + - "threshold %s(MB) and can't process the request, " + - "you can config %s to adjust it or try again later", - presumableFreeMem, minFreeMemory, - ServerOptions.MIN_FREE_MEMORY.name())); + "The server available memory %s(MB) is below than " + + "threshold %s(MB) and can't process the request, " + + "you can config %s to adjust it or try again later", + presumableFreeMem, minFreeMemory, + ServerOptions.MIN_FREE_MEMORY.name())); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java index 04f2fada5d..83a6b0d73a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java @@ -17,6 +17,8 @@ package org.apache.hugegraph.api.filter; +import org.apache.hugegraph.define.WorkLoad; + import jakarta.inject.Singleton; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerResponseContext; @@ -24,8 +26,6 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.ext.Provider; -import org.apache.hugegraph.define.WorkLoad; - @Provider @Singleton public class LoadReleaseFilter implements ContainerResponseFilter { diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java index 35dc3793de..2a2a9142ef 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java @@ -151,5 +151,6 @@ private void initClientIfNeeded() { @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface RedirectMasterRole { + } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java index 70f6cb16de..980c714d31 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java @@ -34,7 +34,7 @@ public class StatusFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { + throws IOException { if (responseContext.getStatus() == 200) { for (Annotation i : responseContext.getEntityAnnotations()) { if (i instanceof Status) { @@ -48,6 +48,7 @@ public void filter(ContainerRequestContext requestContext, @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface Status { + int OK = 200; int CREATED = 201; int ACCEPTED = 202; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java index c533a7d990..2ba95e5bc9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java @@ -21,21 +21,21 @@ import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.metrics.MetricsUtil; import org.apache.hugegraph.server.RestServer; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.structure.HugeElement; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.slf4j.Logger; + import com.codahale.metrics.Meter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -49,14 +49,13 @@ public class BatchAPI extends API { static { MetricsUtil.registerGauge(RestServer.class, "batch-write-threads", - () -> BATCH_WRITE_THREADS.intValue()); + BATCH_WRITE_THREADS::intValue); } private final Meter batchMeter; public BatchAPI() { - this.batchMeter = MetricsUtil.registerMeter(this.getClass(), - "batch-commit"); + this.batchMeter = MetricsUtil.registerMeter(this.getClass(), "batch-commit"); } public R commit(HugeConfig config, HugeGraph g, int size, @@ -99,8 +98,7 @@ protected abstract static class JsonElement implements Checkable { protected abstract Object[] properties(); } - protected void updateExistElement(JsonElement oldElement, - JsonElement newElement, + protected void updateExistElement(JsonElement oldElement, JsonElement newElement, Map strategies) { if (oldElement == null) { return; @@ -113,8 +111,8 @@ protected void updateExistElement(JsonElement oldElement, if (oldElement.properties.get(key) != null && newElement.properties.get(key) != null) { Object value = updateStrategy.checkAndUpdateProperty( - oldElement.properties.get(key), - newElement.properties.get(key)); + oldElement.properties.get(key), + newElement.properties.get(key)); newElement.properties.put(key, value); } else if (oldElement.properties.get(key) != null && newElement.properties.get(key) == null) { @@ -124,9 +122,7 @@ protected void updateExistElement(JsonElement oldElement, } } - protected void updateExistElement(HugeGraph g, - Element oldElement, - JsonElement newElement, + protected void updateExistElement(HugeGraph g, Element oldElement, JsonElement newElement, Map strategies) { if (oldElement == null) { return; @@ -139,8 +135,8 @@ protected void updateExistElement(HugeGraph g, if (oldElement.property(key).isPresent() && newElement.properties.get(key) != null) { Object value = updateStrategy.checkAndUpdateProperty( - oldElement.property(key).value(), - newElement.properties.get(key)); + oldElement.property(key).value(), + newElement.properties.get(key)); value = g.propertyKey(key).validValueOrThrow(value); newElement.properties.put(key, value); } else if (oldElement.property(key).isPresent() && @@ -151,8 +147,7 @@ protected void updateExistElement(HugeGraph g, } } - protected static void updateProperties(HugeElement element, - JsonElement jsonElement, + protected static void updateProperties(HugeElement element, JsonElement jsonElement, boolean append) { for (Map.Entry e : jsonElement.properties.entrySet()) { String key = e.getKey(); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java index c0a8577e55..25e8cacf00 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java @@ -24,31 +24,6 @@ import java.util.Map; import java.util.NoSuchElementException; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.util.function.TriFunction; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.UpdateStrategy; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; @@ -58,6 +33,9 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; @@ -69,9 +47,31 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.util.function.TriFunction; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/graph/edges") @Singleton @Tag(name = "EdgeAPI") @@ -98,18 +98,15 @@ public String create(@Context GraphManager manager, * NOTE: If the vertex id is correct but label not match with id, * we allow to create it here */ - vertexLabel(g, jsonEdge.sourceLabel, - "Invalid source vertex label '%s'"); - vertexLabel(g, jsonEdge.targetLabel, - "Invalid target vertex label '%s'"); + vertexLabel(g, jsonEdge.sourceLabel, "Invalid source vertex label '%s'"); + vertexLabel(g, jsonEdge.targetLabel, "Invalid target vertex label '%s'"); } Vertex srcVertex = getVertex(g, jsonEdge.source, jsonEdge.sourceLabel); Vertex tgtVertex = getVertex(g, jsonEdge.target, jsonEdge.targetLabel); Edge edge = commit(g, () -> { - return srcVertex.addEdge(jsonEdge.label, tgtVertex, - jsonEdge.properties()); + return srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties()); }); return manager.serializer(g).writeEdge(edge); @@ -136,7 +133,7 @@ public String create(@Context HugeConfig config, HugeGraph g = graph(manager, graph); TriFunction getVertex = - checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; + checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; return this.commit(config, g, jsonEdges.size(), () -> { List ids = new ArrayList<>(jsonEdges.size()); @@ -146,12 +143,9 @@ public String create(@Context HugeConfig config, * then the label is correct and not matched id, * it will be allowed currently */ - Vertex srcVertex = getVertex.apply(g, jsonEdge.source, - jsonEdge.sourceLabel); - Vertex tgtVertex = getVertex.apply(g, jsonEdge.target, - jsonEdge.targetLabel); - Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex, - jsonEdge.properties()); + Vertex srcVertex = getVertex.apply(g, jsonEdge.source, jsonEdge.sourceLabel); + Vertex tgtVertex = getVertex.apply(g, jsonEdge.target, jsonEdge.targetLabel); + Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties()); ids.add((Id) edge.id()); } return manager.serializer(g).writeIds(ids); @@ -179,16 +173,16 @@ public String update(@Context HugeConfig config, HugeGraph g = graph(manager, graph); Map map = new HashMap<>(req.jsonEdges.size()); - TriFunction getVertex = - req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex; + TriFunction getVertex = req.checkVertex ? + EdgeAPI::getVertex : + EdgeAPI::newVertex; - return this.commit(config, g, map.size(), () -> { + return this.commit(config, g, 0, () -> { // 1.Put all newEdges' properties into map (combine first) req.jsonEdges.forEach(newEdge -> { Id newEdgeId = getEdgeId(graph(manager, graph), newEdge); JsonEdge oldEdge = map.get(newEdgeId); - this.updateExistElement(oldEdge, newEdge, - req.updateStrategies); + this.updateExistElement(oldEdge, newEdge, req.updateStrategies); map.put(newEdgeId, newEdge); }); @@ -197,19 +191,15 @@ public String update(@Context HugeConfig config, Iterator oldEdges = g.edges(ids); oldEdges.forEachRemaining(oldEdge -> { JsonEdge newEdge = map.get(oldEdge.id()); - this.updateExistElement(g, oldEdge, newEdge, - req.updateStrategies); + this.updateExistElement(g, oldEdge, newEdge, req.updateStrategies); }); // 3.Add all finalEdges List edges = new ArrayList<>(map.size()); map.values().forEach(finalEdge -> { - Vertex srcVertex = getVertex.apply(g, finalEdge.source, - finalEdge.sourceLabel); - Vertex tgtVertex = getVertex.apply(g, finalEdge.target, - finalEdge.targetLabel); - edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex, - finalEdge.properties())); + Vertex srcVertex = getVertex.apply(g, finalEdge.source, finalEdge.sourceLabel); + Vertex tgtVertex = getVertex.apply(g, finalEdge.target, finalEdge.targetLabel); + edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex, finalEdge.properties())); }); // If return ids, the ids.size() maybe different with the origins' @@ -253,7 +243,6 @@ public String update(@Context GraphManager manager, } commit(g, () -> updateProperties(edge, jsonEdge, append)); - return manager.serializer(g).writeEdge(edge); } @@ -281,8 +270,7 @@ public String list(@Context GraphManager manager, Map props = parseProperties(properties); if (page != null) { E.checkArgument(offset == 0, - "Not support querying edges based on paging " + - "and offset together"); + "Not support querying edges based on paging and offset together"); } Id vertex = VertexAPI.checkAndParseVertexId(vertexId); @@ -321,8 +309,7 @@ public String list(@Context GraphManager manager, if (page == null) { traversal = traversal.range(offset, offset + limit); } else { - traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page) - .limit(limit); + traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit); } try { @@ -372,42 +359,38 @@ public void delete(@Context GraphManager manager, g.removeEdge(label, id); } catch (NotFoundException e) { throw new IllegalArgumentException(String.format( - "No such edge with id: '%s', %s", id, e)); + "No such edge with id: '%s', %s", id, e)); } catch (NoSuchElementException e) { throw new IllegalArgumentException(String.format( - "No such edge with id: '%s'", id)); + "No such edge with id: '%s'", id)); } }); } - private static void checkBatchSize(HugeConfig config, - List edges) { + private static void checkBatchSize(HugeConfig config, List edges) { int max = config.get(ServerOptions.MAX_EDGES_PER_BATCH); if (edges.size() > max) { throw new IllegalArgumentException(String.format( - "Too many edges for one time post, " + - "the maximum number is '%s'", max)); + "Too many edges for one time post, " + + "the maximum number is '%s'", max)); } - if (edges.size() == 0) { - throw new IllegalArgumentException( - "The number of edges can't be 0"); + if (edges.isEmpty()) { + throw new IllegalArgumentException("The number of edges can't be 0"); } } - private static Vertex getVertex(HugeGraph graph, - Object id, String label) { + private static Vertex getVertex(HugeGraph graph, Object id, String label) { HugeVertex vertex; try { vertex = (HugeVertex) graph.vertices(id).next(); } catch (NoSuchElementException e) { - throw new IllegalArgumentException(String.format( - "Invalid vertex id '%s'", id)); + throw new IllegalArgumentException(String.format("Invalid vertex id '%s'", id)); } if (label != null && !vertex.label().equals(label)) { throw new IllegalArgumentException(String.format( - "The label of vertex '%s' is unmatched, users expect " + - "label '%s', actual label stored is '%s'", - id, label, vertex.label())); + "The label of vertex '%s' is unmatched, users expect " + + "label '%s', actual label stored is '%s'", + id, label, vertex.label())); } // Clone a new vertex to support multi-thread access return vertex.copy(); @@ -419,8 +402,7 @@ private static Vertex newVertex(HugeGraph g, Object id, String label) { return new HugeVertex(g, idValue, vl); } - private static VertexLabel vertexLabel(HugeGraph graph, String label, - String message) { + private static VertexLabel vertexLabel(HugeGraph graph, String label, String message) { try { // NOTE: don't use SchemaManager because it will throw 404 return graph.vertexLabel(label); @@ -437,8 +419,8 @@ public static Direction parseDirection(String direction) { return Direction.valueOf(direction); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "Direction value must be in [OUT, IN, BOTH], " + - "but got '%s'", direction)); + "Direction value must be in [OUT, IN, BOTH], " + + "but got '%s'", direction)); } } @@ -453,8 +435,7 @@ private Id getEdgeId(HugeGraph g, JsonEdge newEdge) { String sortKey = pk.name(); Object sortKeyValue = newEdge.properties.get(sortKey); E.checkArgument(sortKeyValue != null, - "The value of sort key '%s' can't be null", - sortKey); + "The value of sort key '%s' can't be null", sortKey); sortKeyValue = pk.validValueOrThrow(sortKeyValue); sortKeyValues.add(sortKeyValue); }); @@ -487,14 +468,11 @@ protected static class BatchEdgeRequest { private static void checkUpdate(BatchEdgeRequest req) { E.checkArgumentNotNull(req, "BatchEdgeRequest can't be null"); - E.checkArgumentNotNull(req.jsonEdges, - "Parameter 'edges' can't be null"); - E.checkArgument(req.updateStrategies != null && - !req.updateStrategies.isEmpty(), + E.checkArgumentNotNull(req.jsonEdges, "Parameter 'edges' can't be null"); + E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(), "Parameter 'update_strategies' can't be empty"); - E.checkArgument(req.createIfNotExist == true, - "Parameter 'create_if_not_exist' " + - "dose not support false now"); + E.checkArgument(req.createIfNotExist, + "Parameter 'create_if_not_exist' dose not support false now"); } @Override @@ -524,15 +502,11 @@ public void checkCreate(boolean isBatch) { E.checkArgumentNotNull(this.source, "Expect source vertex id"); E.checkArgumentNotNull(this.target, "Expect target vertex id"); if (isBatch) { - E.checkArgumentNotNull(this.sourceLabel, - "Expect source vertex label"); - E.checkArgumentNotNull(this.targetLabel, - "Expect target vertex label"); + E.checkArgumentNotNull(this.sourceLabel, "Expect source vertex label"); + E.checkArgumentNotNull(this.targetLabel, "Expect target vertex label"); } else { - E.checkArgument(this.sourceLabel == null && - this.targetLabel == null || - this.sourceLabel != null && - this.targetLabel != null, + E.checkArgument(this.sourceLabel == null && this.targetLabel == null || + this.sourceLabel != null && this.targetLabel != null, "The both source and target vertex label " + "are either passed in, or not passed in"); } @@ -541,15 +515,13 @@ public void checkCreate(boolean isBatch) { @Override public void checkUpdate() { - E.checkArgumentNotNull(this.properties, - "The properties of edge can't be null"); + E.checkArgumentNotNull(this.properties, "The properties of edge can't be null"); for (Map.Entry entry : this.properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); E.checkArgumentNotNull(value, "Not allowed to set value of " + - "property '%s' to null for edge '%s'", - key, this.id); + "property '%s' to null for edge '%s'", key, this.id); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java index 98032d2ad7..e25e7888b8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java @@ -25,29 +25,6 @@ import java.util.Map; import java.util.NoSuchElementException; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.hugegraph.config.ServerOptions; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.UpdateStrategy; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; @@ -57,6 +34,9 @@ import org.apache.hugegraph.backend.id.SplicingIdGenerator; import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.UpdateStrategy; import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; @@ -68,9 +48,29 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/graph/vertices") @Singleton @Tag(name = "VertexAPI") @@ -148,7 +148,7 @@ public String update(@Context HugeConfig config, HugeGraph g = graph(manager, graph); Map map = new HashMap<>(req.jsonVertices.size()); - return this.commit(config, g, map.size(), () -> { + return this.commit(config, g, 0, () -> { /* * 1.Put all newVertices' properties into map (combine first) * - Consider primary-key & user-define ID mode first @@ -156,8 +156,7 @@ public String update(@Context HugeConfig config, req.jsonVertices.forEach(newVertex -> { Id newVertexId = getVertexId(g, newVertex); JsonVertex oldVertex = map.get(newVertexId); - this.updateExistElement(oldVertex, newVertex, - req.updateStrategies); + this.updateExistElement(oldVertex, newVertex, req.updateStrategies); map.put(newVertexId, newVertex); }); @@ -166,8 +165,7 @@ public String update(@Context HugeConfig config, Iterator oldVertices = g.vertices(ids); oldVertices.forEachRemaining(oldVertex -> { JsonVertex newVertex = map.get(oldVertex.id()); - this.updateExistElement(g, oldVertex, newVertex, - req.updateStrategies); + this.updateExistElement(g, oldVertex, newVertex, req.updateStrategies); }); // 3.Add finalVertices and return them @@ -177,8 +175,7 @@ public String update(@Context HugeConfig config, }); // If return ids, the ids.size() maybe different with the origins' - return manager.serializer(g) - .writeVertices(vertices.iterator(), false); + return manager.serializer(g).writeVertices(vertices.iterator(), false); }); } @@ -238,8 +235,7 @@ public String list(@Context GraphManager manager, Map props = parseProperties(properties); if (page != null) { E.checkArgument(offset == 0, - "Not support querying vertices based on paging " + - "and offset together"); + "Not support querying vertices based on paging and offset together"); } HugeGraph g = graph(manager, graph); @@ -265,13 +261,11 @@ public String list(@Context GraphManager manager, if (page == null) { traversal = traversal.range(offset, offset + limit); } else { - traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page) - .limit(limit); + traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit); } try { - return manager.serializer(g).writeVertices(traversal, - page != null); + return manager.serializer(g).writeVertices(traversal, page != null); } finally { if (g.tx().isOpen()) { g.tx().close(); @@ -319,10 +313,10 @@ public void delete(@Context GraphManager manager, g.removeVertex(label, id); } catch (NotFoundException e) { throw new IllegalArgumentException(String.format( - "No such vertex with id: '%s', %s", id, e)); + "No such vertex with id: '%s', %s", id, e)); } catch (NoSuchElementException e) { throw new IllegalArgumentException(String.format( - "No such vertex with id: '%s'", id)); + "No such vertex with id: '%s'", id)); } }); } @@ -340,22 +334,19 @@ public static Id checkAndParseVertexId(String idValue) { return uuid ? Text.uuid((String) id) : HugeVertex.getIdValue(id); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "The vertex id must be formatted as Number/String/UUID" + - ", but got '%s'", idValue)); + "The vertex id must be formatted as Number/String/UUID" + + ", but got '%s'", idValue)); } } - private static void checkBatchSize(HugeConfig config, - List vertices) { + private static void checkBatchSize(HugeConfig config, List vertices) { int max = config.get(ServerOptions.MAX_VERTICES_PER_BATCH); if (vertices.size() > max) { throw new IllegalArgumentException(String.format( - "Too many vertices for one time post, " + - "the maximum number is '%s'", max)); + "Too many vertices for one time post, the maximum number is '%s'", max)); } - if (vertices.size() == 0) { - throw new IllegalArgumentException( - "The number of vertices can't be 0"); + if (vertices.isEmpty()) { + throw new IllegalArgumentException("The number of vertices can't be 0"); } } @@ -373,8 +364,7 @@ private static Id getVertexId(HugeGraph g, JsonVertex vertex) { String propertyKey = g.propertyKey(pkId).name(); Object propertyValue = vertex.properties.get(propertyKey); E.checkArgument(propertyValue != null, - "The value of primary key '%s' can't be null", - propertyKey); + "The value of primary key '%s' can't be null", propertyKey); pkValues.add(propertyValue); } @@ -402,8 +392,7 @@ private static void checkUpdate(BatchVertexRequest req) { E.checkArgumentNotNull(req, "BatchVertexRequest can't be null"); E.checkArgumentNotNull(req.jsonVertices, "Parameter 'vertices' can't be null"); - E.checkArgument(req.updateStrategies != null && - !req.updateStrategies.isEmpty(), + E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(), "Parameter 'update_strategies' can't be empty"); E.checkArgument(req.createIfNotExist, "Parameter 'create_if_not_exist' " + @@ -428,14 +417,13 @@ public void checkCreate(boolean isBatch) { @Override public void checkUpdate() { - E.checkArgumentNotNull(this.properties, - "The properties of vertex can't be null"); + E.checkArgumentNotNull(this.properties, "The properties of vertex can't be null"); for (Map.Entry e : this.properties.entrySet()) { String key = e.getKey(); Object value = e.getValue(); E.checkArgumentNotNull(value, "Not allowed to set value of " + - "property '%s' to null for vertex '%s'", + "property '%s' to null for vertex '%s'", key, this.id); } } @@ -462,7 +450,7 @@ public Object[] properties() { } if (this.id != null) { newProps[appendIndex++] = T.id; - // Keep value++ to avoid code trap + // Note: Here we keep value++ to avoid code trap newProps[appendIndex++] = this.id; } return newProps; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java index 37963a371e..810dbc8b45 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java @@ -83,7 +83,7 @@ private static PoolingHttpClientConnectionManager configConnectionManager(Client * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 */ PoolingHttpClientConnectionManager pool = - new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL); Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java index 09459ca4c7..4373b0f006 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java @@ -17,7 +17,15 @@ package org.apache.hugegraph.api.gremlin; +import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.metrics.MetricsUtil; + +import com.codahale.metrics.Histogram; +import com.codahale.metrics.annotation.Timed; + import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; @@ -29,14 +37,6 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.UriInfo; -import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; -import org.apache.hugegraph.api.filter.RedirectFilter; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.metrics.MetricsUtil; -import com.codahale.metrics.Histogram; -import com.codahale.metrics.annotation.Timed; -import jakarta.inject.Singleton; - @Path("gremlin") @Singleton @Tag(name = "GremlinAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java index 009f44dbd7..ad4a6452b5 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; import org.apache.hugegraph.exception.HugeGremlinException; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java index 408d27a39d..8ebf1f6d10 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java @@ -37,7 +37,6 @@ import com.google.common.collect.ImmutableMap; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.NotFoundException; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java index 5bb8274b77..e7def05065 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java @@ -190,11 +190,11 @@ public static GremlinRequest fromJson(String json) { String gremlin = (String) map.get("gremlin"); @SuppressWarnings("unchecked") Map bindings = (Map) - map.get("bindings"); + map.get("bindings"); String language = (String) map.get("language"); @SuppressWarnings("unchecked") Map aliases = (Map) - map.get("aliases"); + map.get("aliases"); GremlinRequest request = new GremlinRequest(); request.gremlin(gremlin); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java index 8daf2954dd..d9b90de103 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java @@ -92,7 +92,7 @@ public Map list(@Context GraphManager manager, // Set limit to NO_LIMIT to ignore limit when query task by ids limit = NO_LIMIT; List idList = ids.stream().map(IdGenerator::of) - .collect(Collectors.toList()); + .collect(Collectors.toList()); iter = scheduler.tasks(idList); } else { if (status == null) { @@ -159,7 +159,7 @@ public Map update(@Context GraphManager manager, if (!ACTION_CANCEL.equals(action)) { throw new NotSupportedException(String.format( - "Not support action '%s'", action)); + "Not support action '%s'", action)); } TaskScheduler scheduler = graph(manager, graph).taskScheduler(); @@ -173,8 +173,8 @@ public Map update(@Context GraphManager manager, assert task.completed() || task.cancelling(); throw new BadRequestException(String.format( - "Can't cancel task '%s' which is completed or cancelling", - id)); + "Can't cancel task '%s' which is completed or cancelling", + id)); } private static TaskStatus parseStatus(String status) { @@ -182,8 +182,8 @@ private static TaskStatus parseStatus(String status) { return TaskStatus.valueOf(status.toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException(String.format( - "Status value must be in %s, but got '%s'", - Arrays.asList(TaskStatus.values()), status)); + "Status value must be in %s, but got '%s'", + Arrays.asList(TaskStatus.values()), status)); } } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java index 605abef1d7..4682c35df7 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java @@ -72,7 +72,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; - import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; import jakarta.ws.rs.GET; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java index 8bcc9311d1..f45c228baf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java @@ -22,6 +22,23 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; +import org.apache.hugegraph.auth.HugePermission; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.type.define.GraphMode; +import org.apache.hugegraph.type.define.GraphReadMode; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Singleton; @@ -30,8 +47,8 @@ import jakarta.ws.rs.ForbiddenException; import jakarta.ws.rs.GET; import jakarta.ws.rs.NotSupportedException; -import jakarta.ws.rs.PUT; import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; @@ -39,23 +56,6 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.SecurityContext; -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; -import org.apache.hugegraph.auth.HugePermission; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.define.GraphMode; -import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("graphs") @Singleton @Tag(name = "GraphsAPI") @@ -154,7 +154,7 @@ public File getConf(@Context GraphManager manager, File file = config.file(); if (file == null) { throw new NotSupportedException("Can't access the api in " + - "a node which started with non local file config."); + "a node which started with non local file config."); } return file; } @@ -255,9 +255,9 @@ public Map mode(@Context GraphManager manager, @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed("admin") public Map graphReadMode( - @Context GraphManager manager, - @PathParam("name") String name, - GraphReadMode readMode) { + @Context GraphManager manager, + @PathParam("name") String name, + GraphReadMode readMode) { LOG.debug("Set graph-read-mode to: '{}' of graph '{}'", readMode, name); @@ -275,8 +275,8 @@ public Map graphReadMode( @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed({"admin", "$owner=$name"}) public Map graphReadMode( - @Context GraphManager manager, - @PathParam("name") String name) { + @Context GraphManager manager, + @PathParam("name") String name) { LOG.debug("Get graph-read-mode of graph '{}'", name); HugeGraph g = graph(manager, name); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java index 26a7873e45..279f095569 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java @@ -24,31 +24,30 @@ import java.util.TreeMap; import java.util.TreeSet; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Application; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.MediaType; - import org.apache.commons.lang3.StringUtils; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.version.CoreVersion; import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty; import org.glassfish.jersey.model.Parameter.Source; import org.glassfish.jersey.server.model.Parameter; import org.glassfish.jersey.server.model.Resource; import org.glassfish.jersey.server.model.ResourceMethod; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.version.CoreVersion; - import com.codahale.metrics.annotation.Timed; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; + @Path("/") @Singleton @Tag(name = "ProfileAPI") @@ -154,8 +153,8 @@ public void put(APICategory category, APIProfile profile) { categories = this.apis.computeIfAbsent(category.dir, k -> new TreeMap<>()); List profiles = categories.computeIfAbsent( - category.category, - k -> new ArrayList<>()); + category.category, + k -> new ArrayList<>()); profiles.add(profile); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java index b6a095c9ec..5f951e7ac7 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java @@ -19,6 +19,13 @@ import java.util.Map; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.version.ApiVersion; +import org.apache.hugegraph.version.CoreVersion; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.security.PermitAll; import jakarta.inject.Singleton; @@ -26,12 +33,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.version.ApiVersion; -import org.apache.hugegraph.version.CoreVersion; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("versions") @Singleton @Tag(name = "VersionAPI") @@ -43,9 +44,9 @@ public class VersionAPI extends API { @PermitAll public Object list() { Map versions = ImmutableMap.of("version", "v1", - "core", CoreVersion.VERSION.toString(), - "gremlin", CoreVersion.GREMLIN_VERSION, - "api", ApiVersion.VERSION.toString()); + "core", CoreVersion.VERSION.toString(), + "gremlin", CoreVersion.GREMLIN_VERSION, + "api", ApiVersion.VERSION.toString()); return ImmutableMap.of("versions", versions); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java index f765ff46ab..e965ed21a9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java @@ -76,7 +76,8 @@ public Map list(@Context GraphManager manager) { @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed("admin") @Operation(summary = "update white ip list") - public Map updateWhiteIPs(@Context GraphManager manager, Map actionMap) { + public Map updateWhiteIPs(@Context GraphManager manager, + Map actionMap) { E.checkArgument(actionMap != null, "Missing argument: actionMap"); Set whiteIpList = manager.authManager().listWhiteIPs(); @@ -137,7 +138,8 @@ public Map updateWhiteIPs(@Context GraphManager manager, Map updateStatus(@Context GraphManager manager, @QueryParam("status") String status) { + public Map updateStatus(@Context GraphManager manager, + @QueryParam("status") String status) { LOG.debug("Enable or disable white ip list"); E.checkArgument("true".equals(status) || "false".equals(status), diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java index 2c2d893b66..76f44a5248 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java @@ -21,38 +21,38 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.api.filter.RedirectFilter; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.RedirectFilter; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob; import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.job.JobBuilder; import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.JsonUtil; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/raft") @Singleton @Tag(name = "RaftAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java index 1154d71447..82ad79e38e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java @@ -20,16 +20,6 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.graph.EdgeAPI; @@ -40,9 +30,20 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + /** * AdamicAdar is one of the prediction algorithms in graph, you can get more * info and definition in: diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java index f2e3f0c9a5..0855c8cb62 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java @@ -25,31 +25,31 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.CountTraverser; import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/count") @Singleton @Tag(name = "CountAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java index 5237fdcdb7..f52c2b57ee 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java @@ -25,7 +25,6 @@ import org.apache.hugegraph.api.graph.VertexAPI; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.EdgeExistenceTraverser; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java index 9c1fda3be2..d5bf74ee20 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java @@ -26,29 +26,29 @@ import java.util.List; import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser; import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/neighborrank") @Singleton @Tag(name = "NeighborRankAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java index 8619fb1711..aefc9daaa0 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java @@ -24,16 +24,6 @@ import java.util.Map; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.backend.id.Id; @@ -43,9 +33,19 @@ import org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + @Path("graphs/{graph}/traversers/personalrank") @Singleton @Tag(name = "PersonalRankAPI") diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java index 881138bbf9..fb4d73e5af 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java @@ -20,16 +20,6 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT; import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; -import jakarta.ws.rs.DefaultValue; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.graph.EdgeAPI; @@ -40,9 +30,20 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.JsonUtil; + import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + /** * ResourceAllocation is one of the prediction algorithms in graph, you can get * more info and definition in: diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java index 183c27d87c..bf231ca90a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java @@ -23,8 +23,6 @@ import java.util.Map; import java.util.Set; -import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.ConditionQuery; @@ -33,6 +31,8 @@ import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.Vertex; + import com.fasterxml.jackson.annotation.JsonProperty; public class Vertices { @@ -47,8 +47,8 @@ public class Vertices { public Iterator vertices(HugeGraph g) { Map props = this.properties; E.checkArgument(!((this.ids == null || this.ids.isEmpty()) && - (props == null || props.isEmpty()) && - this.label == null), "No source vertices provided"); + (props == null || props.isEmpty()) && + this.label == null), "No source vertices provided"); Iterator iterator; if (this.ids != null && !this.ids.isEmpty()) { List sourceIds = new ArrayList<>(this.ids.size()); @@ -72,7 +72,7 @@ public Iterator vertices(HugeGraph g) { assert !query.empty(); iterator = g.vertices(query); E.checkArgument(iterator.hasNext(), "Not exist source vertex " + - "with label '%s' and properties '%s'", + "with label '%s' and properties '%s'", this.label, props); } return iterator; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java index 89272fb8f5..2ea29aaf1d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java @@ -20,6 +20,16 @@ import java.util.Map; import java.util.Optional; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; @@ -32,16 +42,6 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; -import org.apache.hugegraph.core.GraphManager; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.annotation.Timed; -import com.google.common.collect.ImmutableMap; - @Path("graphs/{graph}/variables") @Singleton @Tag(name = "VariablesAPI") @@ -91,7 +91,7 @@ public Map get(@Context GraphManager manager, Optional object = g.variables().get(key); if (!object.isPresent()) { throw new NotFoundException(String.format( - "Variable '%s' does not exist", key)); + "Variable '%s' does not exist", key)); } return ImmutableMap.of(key, object.get()); } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java index 2106d54dc4..21cf39682d 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java @@ -50,8 +50,9 @@ public void setup(HugeConfig config) { /** * Verify if a user is legal - * @param username the username for authentication - * @param password the password for authentication + * + * @param username the username for authentication + * @param password the password for authentication * @return String No permission if return ROLE_NONE else return a role */ @Override diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java index f753fc2ca7..7f8829974e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java @@ -115,8 +115,8 @@ public void injectTraversalSource() { String gName = G_PREFIX + graph; if (manager.getTraversalSource(gName) != null) { throw new HugeException( - "Found existing name '%s' in global bindings, " + - "it may lead to gremlin query error.", gName); + "Found existing name '%s' in global bindings, " + + "it may lead to gremlin query error.", gName); } // Add a traversal source for all graphs with customed rule. manager.putTraversalSource(gName, g); @@ -136,7 +136,7 @@ private void injectGraph(HugeGraph graph) { manager.putTraversalSource(G_PREFIX + name, g); Whitebox.invoke(executor, "globalBindings", - new Class[]{ String.class, Object.class }, + new Class[]{String.class, Object.class}, "put", name, graph); } @@ -149,7 +149,7 @@ private void removeGraph(String name) { manager.removeGraph(name); manager.removeTraversalSource(G_PREFIX + name); Whitebox.invoke(executor, "globalBindings", - new Class[]{ Object.class }, + new Class[]{Object.class}, "remove", name); } catch (Exception e) { throw new HugeException("Failed to remove graph '%s' from " + diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java index e1077d9469..1e67680953 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java @@ -81,7 +81,7 @@ default void setup(final Map config) { @Override default User authenticate(final Map credentials) - throws AuthenticationException { + throws AuthenticationException { HugeGraphAuthProxy.resetContext(); @@ -118,11 +118,7 @@ default boolean requireAuthentication() { } default boolean verifyRole(RolePermission role) { - if (role == ROLE_NONE || role == null) { - return false; - } else { - return true; - } + return role != ROLE_NONE && role != null; } void initAdminUser(String password) throws Exception; @@ -334,7 +330,7 @@ private static Object matchedAction(HugePermission action, return null; } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) public static RolePerm fromJson(Object role) { RolePermission table = RolePermission.fromJson(role); return new RolePerm((Map) table.map()); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java index 0c748445a2..201511fe87 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java @@ -65,7 +65,7 @@ public final class HugeFactoryAuthProxy { public static final String GRAPH_FACTORY = - "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy"; + "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy"; private static final Set PROTECT_METHODS = ImmutableSet.of("instance"); @@ -92,108 +92,385 @@ public static synchronized HugeGraph open(Configuration config) { private static void registerPrivateActions() { // Thread - Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", "eetop", "single_step", "daemon", "stillborn", "target", "group", "contextClassLoader", "inheritedAccessControlContext", "threadInitNumber", "threadLocals", "inheritableThreadLocals", "stackSize", "nativeParkEventPointer", "tid", "threadSeqNumber", "threadStatus", "parkBlocker", "blocker", "blockerLock", "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", "uncaughtExceptionHandler", "defaultUncaughtExceptionHandler", "threadLocalRandomSeed", "threadLocalRandomSecondarySeed"); - Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", "dispatchUncaughtException", "clone", "isInterrupted", "registerNatives", "init", "init", "nextThreadNum", "nextThreadID", "blockedOn", "start0", "isCCLOverridden", "auditSubclass", "dumpThreads", "getThreads", "processQueue", "setPriority0", "stop0", "suspend0", "resume0", "interrupt0", "setNativeName"); - Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", "nextHashCode", "HASH_INCREMENT"); - Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", "createInheritedMap", "nextHashCode", "initialValue", "setInitialValue", "getMap", "createMap", "childValue"); - Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", "createMap", "childValue"); + Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", + "eetop", "single_step", "daemon", "stillborn", "target", + "group", "contextClassLoader", + "inheritedAccessControlContext", "threadInitNumber", + "threadLocals", "inheritableThreadLocals", "stackSize", + "nativeParkEventPointer", "tid", "threadSeqNumber", + "threadStatus", "parkBlocker", "blocker", "blockerLock", + "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", + "uncaughtExceptionHandler", + "defaultUncaughtExceptionHandler", + "threadLocalRandomSeed", + "threadLocalRandomSecondarySeed"); + Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", + "dispatchUncaughtException", "clone", "isInterrupted", + "registerNatives", "init", "init", "nextThreadNum", + "nextThreadID", "blockedOn", "start0", "isCCLOverridden", + "auditSubclass", "dumpThreads", "getThreads", + "processQueue", "setPriority0", "stop0", "suspend0", + "resume0", "interrupt0", "setNativeName"); + Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", + "nextHashCode", "HASH_INCREMENT"); + Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", + "createInheritedMap", "nextHashCode", "initialValue", + "setInitialValue", "getMap", "createMap", "childValue"); + Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", + "createMap", "childValue"); // HugeGraph Reflection.registerFieldsToFilter(StandardAuthenticator.class, "graph"); - Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", "inputPassword", "graph"); + Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", + "inputPassword", "graph"); Reflection.registerFieldsToFilter(ConfigAuthenticator.class, "tokens"); Reflection.registerFieldsToFilter(HugeFactoryAuthProxy.class, "PROTECT_METHODS"); - Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", "registerClass", "registerPrivateActions", "registerPrivateActions", "c"); + Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", + "registerClass", "registerPrivateActions", + "registerPrivateActions", "c"); Reflection.registerFieldsToFilter(HugeAuthenticator.User.class, "role", "client"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", "taskScheduler", "authManager", "contexts", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "resetContext", "logUser", "verifyAdminPermission", "verifyStatusPermission", "verifyPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifyNamePermission", "verifyNameExistsPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyResPermission", "verifyResPermission", "verifyUserPermission", "verifyUserPermission", "verifyUserPermission", "getContextString", "access$6", "access$7", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "lambda$20", "lambda$21", "lambda$22", "lambda$23", "lambda$24", "access$8", "access$9", "access$10", "setContext", "getContext"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "currentUsername", "updateCreator"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "taskScheduler", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", "lambda$1", "lambda$2", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "hasTaskPermission"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, "this$0"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, "connection", "graph", "strategies", "bytecode"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "REST_WOEKER", "serialVersionUID", "strategies", "this$0"); - Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "translate"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", "this$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", + "taskScheduler", "authManager", "contexts", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", + "access$4", "access$2", "access$5", "resetContext", + "logUser", "verifyAdminPermission", + "verifyStatusPermission", "verifyPermission", + "verifySchemaPermission", "verifySchemaPermission", + "verifySchemaPermission", "verifySchemaPermission", + "verifyNamePermission", "verifyNameExistsPermission", + "verifyElemPermission", "verifyElemPermission", + "verifyElemPermission", "verifyElemPermission", + "verifyResPermission", "verifyResPermission", + "verifyUserPermission", "verifyUserPermission", + "verifyUserPermission", "getContextString", "access$6", + "access$7", "lambda$1", "lambda$2", "lambda$3", + "lambda$4", "lambda$5", "lambda$6", "lambda$7", + "lambda$8", "lambda$9", "lambda$10", "lambda$11", + "lambda$12", "lambda$13", "lambda$14", "lambda$15", + "lambda$16", "lambda$17", "lambda$18", "lambda$19", + "lambda$20", "lambda$21", "lambda$22", "lambda$23", + "lambda$24", "access$8", "access$9", "access$10", + "setContext", "getContext"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", + "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, + "currentUsername", "updateCreator"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, + "taskScheduler", "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", + "lambda$1", "lambda$2", "verifyTaskPermission", + "verifyTaskPermission", "verifyTaskPermission", + "verifyTaskPermission", "hasTaskPermission"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, + "this$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, + "connection", "graph", "strategies", "bytecode"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, + "REST_WOEKER", "serialVersionUID", "strategies", + "this$0"); + Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, + "translate"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", + "this$0"); Reflection.registerFieldsToFilter(HugeGraphAuthProxy.Context.class, "ADMIN", "user"); - Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", "context"); - Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "access$18", "serializer", "loadSchemaStore", "loadSystemStore", "loadGraphStore", "closeTx", "analyzer", "serverInfoManager", "reloadRamtable", "reloadRamtable", "access$19", "access$20", "access$21"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners"); - Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0"); - Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g"); - Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite"); - Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0"); - Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); - Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxSize", "checkTxVerticesCapacity", "checkTxEdgesCapacity", "verticesInTxUpdated", "verticesInTxRemoved", "removingEdgeOwner", "prepareDeletions", "prepareDeletions", "prepareUpdates", "prepareAdditions", "checkVertexExistIfCustomizedId", "checkAggregateProperty", "checkAggregateProperty", "checkNonnullProperty", "queryEdgesFromBackend", "commitPartOfEdgeDeletions", "optimizeQueries", "checkVertexLabel", "checkId", "queryVerticesFromBackend", "joinTxVertices", "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", "verifyVerticesConditionQuery", "verifyEdgesConditionQuery", "indexQuery", "joinTxRecords", "propertyUpdated", "parseEntry", "traverseByLabel", "reset", "queryVerticesByIds", "filterUnmatchedRecords", "skipOffsetOrStopLimit", "filterExpiredResultFromFromBackend", "queryEdgesByIds", "matchEdgeSortKeys", "rightResultFromIndexQuery"); + Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", + "context"); + Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", + "mode", "variables", "name", "params", "configuration", + "schemaEventHub", "graphEventHub", "indexEventHub", + "writeRateLimiter", "readRateLimiter", "taskManager", + "authManager", "features", "storeProvider", "tx", + "ramtable", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", + "access$4", "access$2", "access$5", "access$6", + "access$7", "waitUntilAllTasksCompleted", "access$8", + "loadStoreProvider", "graphTransaction", + "schemaTransaction", "openSchemaTransaction", + "checkGraphNotClosed", "openSystemTransaction", + "openGraphTransaction", "systemTransaction", "access$9", + "access$10", "access$11", "access$12", "access$13", + "access$14", "access$15", "access$16", "access$17", + "access$18", "serializer", "loadSchemaStore", + "loadSystemStore", "loadGraphStore", "closeTx", + "analyzer", "serverInfoManager", "reloadRamtable", + "reloadRamtable", "access$19", "access$20", "access$21"); + Reflection.registerFieldsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), + "graph", "this$0"); + Reflection.registerMethodsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), + "access$1", "graph"); + Reflection.registerFieldsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", + "opened", "transactions", "this$0", "$assertionsDisabled"); + Reflection.registerMethodsToFilter( + loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), + "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", + "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", + "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", + "setClosed", "getOrNewTransaction", "access$0", "resetState"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, + "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners"); + Reflection.registerMethodsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, + "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", + "lambda$fireOnRollback$1", "lambda$fireOnCommit$0"); + Reflection.registerFieldsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g"); + Reflection.registerMethodsToFilter( + org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", + "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite"); + Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), + "schemaTx", "systemTx", "graphTx", "openedTime", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), + "access$2", "access$1", "access$0"); + Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", + "removedVertices", "addedEdges", "removedEdges", + "addedProps", "removedProps", "updatedVertices", + "updatedEdges", "updatedOldestProps", "locksTable", + "checkCustomVertexExist", "checkAdjacentVertexExist", + "lazyLoadAdjacentVertex", "ignoreInvalidEntry", + "commitPartOfAdjacentEdges", "batchSize", "pageSize", + "verticesCapacity", "edgesCapacity", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); + Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", + "lambda$2", "lambda$3", "lambda$4", "lambda$5", + "lambda$6", "lambda$7", "lambda$8", "lambda$9", + "lambda$10", "lambda$11", "lambda$12", "lambda$13", + "lambda$14", "lambda$15", "lambda$16", "lambda$17", + "lambda$18", "lambda$19", "access$1", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "indexTransaction", "indexTransaction", "beforeWrite", + "prepareCommit", "verticesInTxSize", "edgesInTxSize", + "checkTxVerticesCapacity", "checkTxEdgesCapacity", + "verticesInTxUpdated", "verticesInTxRemoved", + "removingEdgeOwner", "prepareDeletions", + "prepareDeletions", "prepareUpdates", "prepareAdditions", + "checkVertexExistIfCustomizedId", + "checkAggregateProperty", "checkAggregateProperty", + "checkNonnullProperty", "queryEdgesFromBackend", + "commitPartOfEdgeDeletions", "optimizeQueries", + "checkVertexLabel", "checkId", + "queryVerticesFromBackend", "joinTxVertices", + "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", + "verifyVerticesConditionQuery", + "verifyEdgesConditionQuery", "indexQuery", + "joinTxRecords", "propertyUpdated", "parseEntry", + "traverseByLabel", "reset", "queryVerticesByIds", + "filterUnmatchedRecords", "skipOffsetOrStopLimit", + "filterExpiredResultFromFromBackend", "queryEdgesByIds", + "matchEdgeSortKeys", "rightResultFromIndexQuery"); Reflection.registerFieldsToFilter(IndexableTransaction.class, "$assertionsDisabled"); - Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", "commit2Backend", "reset"); - Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", "autoCommit", "closed", "committing", "committing2Backend", "graph", "store", "mutation", "serializer", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", "prepareCommit", "params", "mutation", "commit2Backend", "autoCommit", "beforeRead", "afterWrite", "afterRead", "commitMutation2Backend", "checkOwnerThread", "doAction", "store", "reset"); + Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", + "commit2Backend", "reset"); + Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", + "autoCommit", "closed", "committing", + "committing2Backend", "graph", "store", "mutation", + "serializer", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", + "prepareCommit", "params", "mutation", "commit2Backend", + "autoCommit", "beforeRead", "afterWrite", "afterRead", + "commitMutation2Backend", "checkOwnerThread", "doAction", + "store", "reset"); Reflection.registerFieldsToFilter(HugeFactory.class, "LOG", "NAME_REGEX", "graphs"); Reflection.registerMethodsToFilter(HugeFactory.class, "lambda$0"); - Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", "status"); - Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys"); - Reflection.registerMethodsToFilter(HugeVertex.class, "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "checkIdLength", "onUpdateProperty", "ensureFilledProperties", "clone", "clone"); - Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", "properties", "expiredTime", "removed", "fresh", "propLoaded", "defaultValueUpdated", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality"); - Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", "newProperty", "tx", "onUpdateProperty", "ensureFilledProperties", "propLoaded", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", "getIdValue", "fresh", "updateToDefaultValueIfNone", "copyProperties"); - Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", "targetVertex", "isOutEdge", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction"); - Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "onUpdateProperty", "ensureFilledProperties", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", "clone", "clone"); + Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", + "status"); + Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys"); + Reflection.registerMethodsToFilter(HugeVertex.class, + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "newProperty", "newProperty", "tx", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "checkIdLength", "onUpdateProperty", + "ensureFilledProperties", "clone", "clone"); + Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", + "properties", "expiredTime", "removed", "fresh", + "propLoaded", "defaultValueUpdated", + "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality"); + Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", + "newProperty", "tx", "onUpdateProperty", + "ensureFilledProperties", "propLoaded", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", + "getIdValue", "fresh", "updateToDefaultValueIfNone", + "copyProperties"); + Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", + "targetVertex", "isOutEdge", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction"); + Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", + "newProperty", "newProperty", "tx", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", + "onUpdateProperty", "ensureFilledProperties", + "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", + "clone", "clone"); Reflection.registerFieldsToFilter(HugeProperty.class, "owner", "pkey", "value"); - Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", "params", "graph"); - Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", "queryAllVariableVertices", "queryVariableVertex", "createVariableVertex", "removeVariableVertex", "extractSingleObject", "setProperty"); + Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", + "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", + "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", + "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", + "params", "graph"); + Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", + "queryAllVariableVertices", "queryVariableVertex", + "createVariableVertex", "removeVariableVertex", + "extractSingleObject", "setProperty"); Reflection.registerFieldsToFilter(SchemaManager.class, "transaction", "graph"); - Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "checkExists"); - Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", "cardinality", "aggregateType", "checkExist", "userdata", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", "checkAggregateType", "hasSameProperties"); + Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", + "lambda$3", "checkExists"); + Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", + "cardinality", "aggregateType", "checkExist", "userdata", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", + "checkAggregateType", "hasSameProperties"); Reflection.registerFieldsToFilter(AbstractBuilder.class, "transaction", "graph"); - Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", "checkSchemaName", "validOrGenerateId", "lockCheckAndCreateSchema", "propertyKeyOrNull", "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", "edgeLabelOrNull", "indexLabelOrNull", "updateSchemaStatus"); - Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", "properties", "primaryKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); - Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkIdStrategy", "checkPrimaryKeys", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name"); - Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", "targetLabel", "frequency", "properties", "sortKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action"); - Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkSortKeys", "checkRelation", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name"); - Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", "baseValue", "indexType", "indexFields", "userdata", "checkExist", "rebuild", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType"); - Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", "checkBaseType", "checkIndexType", "checkFields4Range", "loadElement", "checkFields", "checkRepeatIndex", "checkRepeatIndex", "checkRepeatIndex", "checkPrimaryKeyIndex", "checkRepeatRangeIndex", "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", "checkRepeatShardIndex", "checkRepeatUniqueIndex", "removeSubIndex", "hasSubIndex", "allStringIndex", "oneNumericField", "hasSameProperties"); - Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", "serverInfoDbExecutor", "schedulerExecutor", "contexts", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", "closeTaskTx", "setContext", "instance", "closeSchedulerTx", "notifyNewTask", "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph"); - Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", "serverManager", "taskExecutor", "taskDbExecutor", "eventListener", "tasks", "taskTx", "NO_LIMIT", "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "tx", "listenChanges", "unlistenChanges", "submitTask", "queryTask", "queryTask", "queryTask", "call", "call", "remove", "sleep", "taskDone", "serverManager", "supportsPaging", "restore", "checkOnMasterNode", "waitUntilTaskCompleted", "scheduleTasks", "executeTasksOnWorker", "cancelTasksOnWorker"); - Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", "callable", "type", "name", "id", "parent", "dependencies", "description", "context", "create", "server", "load", "status", "progress", "update", "retries", "input", "result", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", "asArray", "checkPropertySize", "checkPropertySize", "checkDependenciesSuccess", "toOrderSet", "done", "callable", "setException", "set", "result", "status"); - Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", "ERROR_MESSAGES", "task", "graph", "lastSaveTime", "saveInterval"); - Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", "done", "task", "save", "needSaveWithEx"); + Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", + "checkSchemaName", "validOrGenerateId", + "lockCheckAndCreateSchema", "propertyKeyOrNull", + "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", + "edgeLabelOrNull", "indexLabelOrNull", + "updateSchemaStatus"); + Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", + "properties", "primaryKeys", "nullableKeys", "ttl", + "ttlStartTime", "enableLabelIndex", "userdata", + "checkExist", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); + Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", + "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "checkProperties", "checkNullableKeys", + "checkIdStrategy", "checkPrimaryKeys", + "hasSameProperties", "checkTtl", "checkUserdata", + "mapPkId2Name", "mapPkId2Name"); + Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", + "targetLabel", "frequency", "properties", "sortKeys", + "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", + "userdata", "checkExist", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action"); + Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", + "checkProperties", "checkNullableKeys", "checkSortKeys", + "checkRelation", "hasSameProperties", "checkTtl", + "checkUserdata", "mapPkId2Name", "mapPkId2Name"); + Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", + "baseValue", "indexType", "indexFields", "userdata", + "checkExist", "rebuild", "$assertionsDisabled", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType"); + Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", + "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", + "checkBaseType", "checkIndexType", "checkFields4Range", + "loadElement", "checkFields", "checkRepeatIndex", + "checkRepeatIndex", "checkRepeatIndex", + "checkPrimaryKeyIndex", "checkRepeatRangeIndex", + "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", + "checkRepeatShardIndex", "checkRepeatUniqueIndex", + "removeSubIndex", "hasSubIndex", "allStringIndex", + "oneNumericField", "hasSameProperties"); + Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", + "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", + "serverInfoDbExecutor", "schedulerExecutor", "contexts", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", + "closeTaskTx", "setContext", "instance", + "closeSchedulerTx", "notifyNewTask", + "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph"); + Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", + "serverManager", "taskExecutor", "taskDbExecutor", + "eventListener", "tasks", "taskTx", "NO_LIMIT", + "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", + "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", + "lambda$2", "lambda$3", "lambda$4", "lambda$5", + "lambda$6", "lambda$7", "tx", "listenChanges", + "unlistenChanges", "submitTask", "queryTask", + "queryTask", "queryTask", "call", "call", "remove", + "sleep", "taskDone", "serverManager", "supportsPaging", + "restore", "checkOnMasterNode", "waitUntilTaskCompleted", + "scheduleTasks", "executeTasksOnWorker", + "cancelTasksOnWorker"); + Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", + "callable", "type", "name", "id", "parent", + "dependencies", "description", "context", "create", + "server", "load", "status", "progress", "update", + "retries", "input", "result", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", + "asArray", "checkPropertySize", "checkPropertySize", + "checkDependenciesSuccess", "toOrderSet", "done", + "callable", "setException", "set", "result", "status"); + Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", + "ERROR_MESSAGES", "task", "graph", "lastSaveTime", + "saveInterval"); + Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", + "done", "task", "save", "needSaveWithEx"); Reflection.registerFieldsToFilter(TaskCallable.SysTaskCallable.class, "params"); Reflection.registerMethodsToFilter(TaskCallable.SysTaskCallable.class, "params", "params"); - Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", "eventListener", "usersCache", "users", "groups", "targets", "belong", "access", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", "unlistenChanges", "invalidCache", "initSchemaIfNeeded", "rolePermission", "rolePermission", "rolePermission", "cache"); + Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", + "eventListener", "usersCache", "users", "groups", + "targets", "belong", "access", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", + "unlistenChanges", "invalidCache", "initSchemaIfNeeded", + "rolePermission", "rolePermission", "rolePermission", + "cache"); Reflection.registerFieldsToFilter(SchemaDefine.class, "graph", "label"); - Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", "createPropertyKey", "createPropertyKey", "existEdgeLabel", "createRangeIndex", "unhideField", "hideField", "existVertexLabel", "initProperties"); - Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryEntity", "constructVertex", "save", "query"); - Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryRelationship", "newVertex", "save"); - Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", "timer"); - Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", "instance"); - Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "INSTANCE", "lockGroupMap"); - Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "instance"); - Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", "histograms", "meters", "timers"); + Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", + "createPropertyKey", "createPropertyKey", + "existEdgeLabel", "createRangeIndex", "unhideField", + "hideField", "existVertexLabel", "initProperties"); + Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", + "NO_LIMIT", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", + "commitOrRollback", "unhideLabel", "queryById", + "queryEntity", "constructVertex", "save", "query"); + Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", + "NO_LIMIT", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", + "tx", "commitOrRollback", "unhideLabel", "queryById", + "queryRelationship", "newVertex", "save"); + Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", + "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", + "timer"); + Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", + "instance"); + Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, + "INSTANCE", "lockGroupMap"); + Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, + "instance"); + Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", + "histograms", "meters", "timers"); Reflection.registerMethodsToFilter(ServerReporter.class, "instance", "instance"); - Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", "FACTORY_ID", "registry", "executor", "shutdownExecutorOnStop", "disabledMetricAttributes", "scheduledFuture", "filter", "durationFactor", "durationUnit", "rateFactor", "rateUnit"); - Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, "convertDuration", "convertRate", "getRateUnit", "getDurationUnit", "isShutdownExecutorOnStop", "getDisabledMetricAttributes", "calculateRateUnit", "createDefaultExecutor", "lambda$start$0", "start"); + Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", + "FACTORY_ID", "registry", "executor", + "shutdownExecutorOnStop", "disabledMetricAttributes", + "scheduledFuture", "filter", "durationFactor", + "durationUnit", "rateFactor", "rateUnit"); + Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, + "convertDuration", "convertRate", "getRateUnit", + "getDurationUnit", "isShutdownExecutorOnStop", + "getDisabledMetricAttributes", "calculateRateUnit", + "createDefaultExecutor", "lambda$start$0", "start"); Reflection.registerFieldsToFilter(JsonSerializer.class, "LBUF_SIZE", "INSTANCE"); Reflection.registerMethodsToFilter(JsonSerializer.class, "writeIterator", "instance"); - Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeVertexStepStrategy.class, "instance"); - Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeGraphStepStrategy.class, "instance"); - Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", "INSTANCE"); + Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", + "INSTANCE"); Reflection.registerMethodsToFilter(HugeCountStepStrategy.class, "lambda$0", "instance"); // Enable this line to generate registration statement diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java index 389d15b1cd..dcb9db99c7 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java @@ -149,7 +149,7 @@ public HugeGraph hugegraph() { @Override public C compute(Class clazz) - throws IllegalArgumentException { + throws IllegalArgumentException { this.verifyAnyPermission(); return this.hugegraph.compute(clazz); } @@ -166,7 +166,7 @@ public GraphTraversalSource traversal() { return new GraphTraversalSourceProxy(this); } - @SuppressWarnings({ "rawtypes", "deprecation" }) + @SuppressWarnings({"rawtypes", "deprecation"}) @Override public I io(final Io.Builder builder) { this.verifyAnyPermission(); @@ -834,14 +834,14 @@ private void verifyPermission(HugePermission actionPerm, } private V verifyUserPermission( - HugePermission actionPerm, - V elementFetcher) { + HugePermission actionPerm, + V elementFetcher) { return verifyUserPermission(actionPerm, true, () -> elementFetcher); } private List verifyUserPermission( - HugePermission actionPerm, - List elems) { + HugePermission actionPerm, + List elems) { List results = new ArrayList<>(); for (V elem : elems) { V r = verifyUserPermission(actionPerm, false, () -> elem); @@ -853,9 +853,9 @@ private List verifyUserPermission( } private V verifyUserPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier elementFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); V elem = elementFetcher.get(); @@ -871,14 +871,14 @@ private void verifyElemPermission(HugePermission actionPerm, Element elem) { } private V verifyElemPermission( - HugePermission actionPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + Supplier elementFetcher) { return verifyElemPermission(actionPerm, true, elementFetcher); } private Iterator verifyElemPermission( - HugePermission actionPerm, - Iterator elems) { + HugePermission actionPerm, + Iterator elems) { return new FilterIterator<>(elems, elem -> { V r = verifyElemPermission(actionPerm, false, () -> elem); return r != null; @@ -886,9 +886,9 @@ private Iterator verifyElemPermission( } private V verifyElemPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier elementFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier elementFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); HugeElement elem = (HugeElement) elementFetcher.get(); @@ -918,8 +918,8 @@ private void verifySchemaPermission(HugePermission actionPerm, } private Collection verifySchemaPermission( - HugePermission actionPerm, - Collection schemas) { + HugePermission actionPerm, + Collection schemas) { List results = new ArrayList<>(); for (V schema : schemas) { V r = verifySchemaPermission(actionPerm, false, () -> schema); @@ -931,15 +931,15 @@ private Collection verifySchemaPermission( } private V verifySchemaPermission( - HugePermission actionPerm, - Supplier schemaFetcher) { + HugePermission actionPerm, + Supplier schemaFetcher) { return verifySchemaPermission(actionPerm, true, schemaFetcher); } private V verifySchemaPermission( - HugePermission actionPerm, - boolean throwIfNoPerm, - Supplier schemaFetcher) { + HugePermission actionPerm, + boolean throwIfNoPerm, + Supplier schemaFetcher) { return verifyResPermission(actionPerm, throwIfNoPerm, () -> { String graph = this.hugegraph.name(); SchemaElement elem = schemaFetcher.get(); @@ -1101,21 +1101,21 @@ public boolean close() { @Override public HugeTask waitUntilTaskCompleted(Id id, long seconds) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); return this.taskScheduler.waitUntilTaskCompleted(id, seconds); } @Override public HugeTask waitUntilTaskCompleted(Id id) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); return this.taskScheduler.waitUntilTaskCompleted(id); } @Override public void waitUntilAllTasksCompleted(long seconds) - throws TimeoutException { + throws TimeoutException { verifyAnyPermission(); this.taskScheduler.waitUntilAllTasksCompleted(seconds); } @@ -1166,8 +1166,8 @@ private HugeTask verifyTaskPermission(HugePermission actionPerm, } private Iterator> verifyTaskPermission( - HugePermission actionPerm, - Iterator> tasks) { + HugePermission actionPerm, + Iterator> tasks) { return new FilterIterator<>(tasks, task -> { return verifyTaskPermission(actionPerm, false, task) != null; }); @@ -1727,7 +1727,7 @@ public TraversalStrategies addStrategies(TraversalStrategy... strategies) { @SuppressWarnings({"unchecked"}) @Override public TraversalStrategies removeStrategies( - Class... strategyClasses) { + Class... strategyClasses) { return this.strategies.removeStrategies(strategyClasses); } @@ -1756,14 +1756,14 @@ private String translate(Bytecode bytecode) { } private final class TraversalStrategyProxy> - implements TraversalStrategy { + implements TraversalStrategy { private static final long serialVersionUID = 2071829024642435735L; private final TraversalStrategy origin; public TraversalStrategyProxy(TraversalStrategy origin) { - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) TraversalStrategy strategy = (TraversalStrategy) origin; this.origin = strategy; } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java index 4922533760..3e276046f9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java @@ -110,7 +110,7 @@ private String inputPassword() { public void setup(HugeConfig config) { String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE); Map graphConfs = ConfigUtil.scanGraphsDir( - config.get(ServerOptions.GRAPHS)); + config.get(ServerOptions.GRAPHS)); String graphPath = graphConfs.get(graphName); E.checkArgument(graphPath != null, "Can't find graph name '%s' in config '%s' at " + @@ -137,7 +137,7 @@ public void setup(HugeConfig config) { String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL); if (StringUtils.isNotEmpty(remoteUrl)) { RpcClientProviderWithAuth clientProvider = - new RpcClientProviderWithAuth(config); + new RpcClientProviderWithAuth(config); this.graph.switchAuthManager(clientProvider.authManager()); } } @@ -159,9 +159,10 @@ private void transferRoleWorkerConfig(HugeConfig graphConfig, HugeConfig config) /** * Verify if a user is legal + * * @param username the username for authentication * @param password the password for authentication - * @param token the token for authentication + * @param token the token for authentication * @return String No permission if return ROLE_NONE else return a role */ @Override diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java index 205074ae78..1b329e19f9 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java @@ -24,7 +24,7 @@ import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD; import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.HashMap; import java.util.Map; @@ -61,7 +61,7 @@ public WsAndHttpBasicAuthHandler(Authenticator authenticator, @Override public void channelRead(final ChannelHandlerContext ctx, final Object obj) - throws Exception { + throws Exception { if (obj instanceof HttpMessage && !isWebSocket((HttpMessage) obj)) { ChannelPipeline pipeline = ctx.pipeline(); ChannelHandler authHandler = pipeline.get(HTTP_AUTH); @@ -86,7 +86,7 @@ public static boolean isWebSocket(final HttpMessage msg) { @ChannelHandler.Sharable private static class HttpBasicAuthHandler - extends AbstractAuthenticationHandler { + extends AbstractAuthenticationHandler { private final Base64.Decoder decoder = Base64.getUrlDecoder(); @@ -122,7 +122,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { return; } String authorization = new String(userPass, - Charset.forName("UTF-8")); + StandardCharsets.UTF_8); String[] split = authorization.split(":"); if (split.length != 2) { sendError(ctx, msg); @@ -134,7 +134,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { address = address.substring(1); } - final Map credentials = new HashMap<>(); + final Map credentials = new HashMap<>(); credentials.put(PROPERTY_USERNAME, split[0]); credentials.put(PROPERTY_PASSWORD, split[1]); credentials.put(HugeAuthenticator.KEY_ADDRESS, address); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index e18d5139a5..b46735c8f0 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -274,36 +274,36 @@ public static synchronized ServerOptions instance() { ); public static final ConfigOption ARTHAS_TELNET_PORT = - new ConfigOption<>( - "arthas.telnet_port", - "The telnet port provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "8562" - ); + new ConfigOption<>( + "arthas.telnet_port", + "The telnet port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8562" + ); public static final ConfigOption ARTHAS_HTTP_PORT = - new ConfigOption<>( - "arthas.http_port", - "The HTTP port provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "8561" - ); + new ConfigOption<>( + "arthas.http_port", + "The HTTP port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8561" + ); public static final ConfigOption ARTHAS_IP = - new ConfigOption<>( - "arthas.ip", - "The IP provided by Arthas, it can be accessible from the outside.", - disallowEmpty(), - "0.0.0.0" - ); + new ConfigOption<>( + "arthas.ip", + "The IP provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "0.0.0.0" + ); public static final ConfigOption ARTHAS_DISABLED_COMMANDS = - new ConfigOption<>( - "arthas.disabled_commands", - "The disabled Arthas commands due to high risk.", - null, - "jad" - ); + new ConfigOption<>( + "arthas.disabled_commands", + "The disabled Arthas commands due to high risk.", + null, + "jad" + ); public static final ConfigOption SLOW_QUERY_LOG_TIME_THRESHOLD = new ConfigOption<>( diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java index 9b3c3a10ae..1830d81c76 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java @@ -158,7 +158,7 @@ public HugeGraph cloneGraph(String name, String newName, String configText) { HugeConfig cloneConfig = cloneGraph.cloneConfig(newName); if (StringUtils.isNotEmpty(configText)) { PropertiesConfiguration propConfig = ConfigUtil.buildConfig( - configText); + configText); // Use the passed config to overwrite the old one propConfig.getKeys().forEachRemaining(key -> { cloneConfig.setProperty(key, propConfig.getProperty(key)); @@ -259,7 +259,7 @@ public boolean requireAuthentication() { } public HugeAuthenticator.User authenticate(Map credentials) - throws AuthenticationException { + throws AuthenticationException { return this.authenticator().authenticate(credentials); } @@ -436,20 +436,20 @@ private void checkBackendVersionOrExit(HugeConfig config) { this.authenticator().initAdminUser(token); } catch (Exception e) { throw new BackendException( - "The backend store of '%s' can't " + - "initialize admin user", hugegraph.name()); + "The backend store of '%s' can't " + + "initialize admin user", hugegraph.name()); } } } BackendStoreInfo info = hugegraph.backendStoreInfo(); if (!info.exists()) { throw new BackendException( - "The backend store of '%s' has not been initialized", - hugegraph.name()); + "The backend store of '%s' has not been initialized", + hugegraph.name()); } if (!info.checkVersion()) { throw new BackendException( - "The backend store version is inconsistent"); + "The backend store version is inconsistent"); } } } @@ -521,7 +521,7 @@ private void addMetrics(HugeConfig config) { }); // Add metrics for caches - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Map> caches = (Map) CacheManager.instance() .caches(); registerCacheMetrics(caches); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java index c910dc8c26..887bf7d456 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java @@ -26,6 +26,7 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.NumericUtil; + import com.google.common.collect.Sets; public enum UpdateStrategy { @@ -113,7 +114,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) { // Batch update Set should use union because of higher efficiency APPEND { @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Object updatePropertyValue(Object oldProperty, Object newProperty) { ((Collection) oldProperty).addAll((Collection) newProperty); return oldProperty; @@ -127,7 +128,7 @@ void checkPropertyType(Object oldProperty, Object newProperty) { ELIMINATE { @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) Object updatePropertyValue(Object oldProperty, Object newProperty) { ((Collection) oldProperty).removeAll((Collection) newProperty); return oldProperty; @@ -186,7 +187,7 @@ protected static Object compareNumber(Object oldProperty, Number newNum = NumericUtil.convertToNumber(newProperty); int result = NumericUtil.compareNumber(oldNum, newNum); return strategy == BIGGER ? (result > 0 ? oldProperty : newProperty) : - (result < 0 ? oldProperty : newProperty); + (result < 0 ? oldProperty : newProperty); } protected static Set combineSet(Object oldProperty, Object newProperty, @@ -198,6 +199,6 @@ protected static Set combineSet(Object oldProperty, Object newProperty, (Set) newProperty : new HashSet<>((List) newProperty); return strategy == UNION ? Sets.union(oldSet, newSet) : - Sets.intersection(oldSet, newSet); + Sets.intersection(oldSet, newSet); } } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java index 5107b46113..0d42b6369e 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java @@ -227,7 +227,7 @@ public void serialize(Timer timer, JsonGenerator json, } private static class MetricRegistrySerializer - extends StdSerializer { + extends StdSerializer { private static final long serialVersionUID = 3717001164181726933L; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java index d3cd6855b7..b302ddc5d2 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import org.apache.hugegraph.util.E; + import com.codahale.metrics.Counter; import com.codahale.metrics.Gauge; import com.codahale.metrics.Histogram; @@ -47,7 +48,7 @@ public class ServerReporter extends ScheduledReporter { private SortedMap timers; public static synchronized ServerReporter instance( - MetricRegistry registry) { + MetricRegistry registry) { if (instance == null) { synchronized (ServerReporter.class) { if (instance == null) { @@ -97,7 +98,7 @@ public Map meters() { return Collections.unmodifiableMap(this.meters); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void report(SortedMap gauges, SortedMap counters, diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java index 903ac6103d..3aeaca3445 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; - import org.apache.hugegraph.util.Bytes; public class SystemMetrics { @@ -112,7 +111,7 @@ private Map getThreadMetrics() { private Map getClassLoadingMetrics() { Map metrics = new LinkedHashMap<>(); ClassLoadingMXBean classLoadingMxBean = ManagementFactory - .getClassLoadingMXBean(); + .getClassLoadingMXBean(); metrics.put("count", classLoadingMxBean.getLoadedClassCount()); metrics.put("loaded", classLoadingMxBean.getTotalLoadedClassCount()); metrics.put("unloaded", classLoadingMxBean.getUnloadedClassCount()); @@ -122,7 +121,7 @@ private Map getClassLoadingMetrics() { private Map getGarbageCollectionMetrics() { Map metrics = new LinkedHashMap<>(); List gcMxBeans = ManagementFactory - .getGarbageCollectorMXBeans(); + .getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean gcMxBean : gcMxBeans) { String name = formatName(gcMxBean.getName()); metrics.put(name + "_count", gcMxBean.getCollectionCount()); diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java index a4dfff60a4..dfad9b9594 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java @@ -16,7 +16,22 @@ package org.apache.hugegraph.opencypher; -import io.netty.channel.ChannelHandlerContext; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonList; +import static java.util.Optional.empty; +import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR; +import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN; +import static org.slf4j.LoggerFactory.getLogger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; import org.apache.tinkerpop.gremlin.driver.Tokens; import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; @@ -45,20 +60,9 @@ import org.opencypher.gremlin.traversal.ReturnNormalizer; import org.slf4j.Logger; +import io.netty.channel.ChannelHandlerContext; import scala.collection.Seq; -import java.util.*; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; - -import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonList; -import static java.util.Optional.empty; -import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR; -import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN; -import static org.slf4j.LoggerFactory.getLogger; - /** * Description of the modifications: *

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

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

- * + *

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

  * {
@@ -94,7 +98,7 @@
 public class CypherOpProcessor extends AbstractEvalOpProcessor {
 
     private static final String DEFAULT_TRANSLATOR_DEFINITION =
-        "gremlin+cfog_server_extensions+inline_parameters";
+            "gremlin+cfog_server_extensions+inline_parameters";
 
     private static final Logger logger = getLogger(CypherOpProcessor.class);
 
@@ -242,8 +246,8 @@ protected void handleIterator(Context context, Iterator traversal) {
                                                  .getExecutorService().submit(evalFuture);
         if (timeout > 0) {
             context.getScheduledExecutorService().schedule(
-                () -> executionFuture.cancel(true)
-                , timeout, TimeUnit.MILLISECONDS);
+                    () -> executionFuture.cancel(true)
+                    , timeout, TimeUnit.MILLISECONDS);
         }
 
     }
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
index 98cf98eeef..6d7899dd19 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
@@ -28,13 +28,6 @@
 
 package org.apache.hugegraph.opencypher;
 
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.opencypher.gremlin.traversal.CustomFunctions;
-import org.opencypher.gremlin.traversal.CustomPredicate;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.List;
@@ -42,15 +35,24 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.opencypher.gremlin.traversal.CustomFunctions;
+import org.opencypher.gremlin.traversal.CustomPredicate;
+
 public class CypherPlugin implements GremlinPlugin {
 
     private static final ImportCustomizer IMPORTS =
-        DefaultImportCustomizer.build()
-                               .addClassImports(CustomPredicate.class)
-                               .addMethodImports(getDeclaredPublicMethods(CustomPredicate.class))
-                               .addClassImports(CustomFunctions.class)
-                               .addMethodImports(getDeclaredPublicMethods(CustomFunctions.class))
-                               .create();
+            DefaultImportCustomizer.build()
+                                   .addClassImports(CustomPredicate.class)
+                                   .addMethodImports(
+                                           getDeclaredPublicMethods(CustomPredicate.class))
+                                   .addClassImports(CustomFunctions.class)
+                                   .addMethodImports(
+                                           getDeclaredPublicMethods(CustomFunctions.class))
+                                   .create();
 
     private static List getDeclaredPublicMethods(Class klass) {
         Method[] declaredMethods = klass.getDeclaredMethods();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
index 1311e3e32d..80af0ab368 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
@@ -17,12 +17,13 @@
 
 package org.apache.hugegraph.rpc;
 
-import com.alipay.sofa.rpc.common.utils.StringUtils;
 import org.apache.hugegraph.auth.AuthManager;
 import org.apache.hugegraph.config.HugeConfig;
 import org.apache.hugegraph.config.ServerOptions;
 import org.apache.hugegraph.util.E;
 
+import com.alipay.sofa.rpc.common.utils.StringUtils;
+
 public class RpcClientProviderWithAuth extends RpcClientProvider {
 
     private final RpcConsumerConfig authConsumerConfig;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
index e477fce1d0..7784613f53 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
@@ -42,32 +42,32 @@
 
 import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
 import io.swagger.v3.oas.annotations.info.Contact;
 import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import io.swagger.v3.oas.annotations.security.SecurityScheme;
 import jakarta.ws.rs.ApplicationPath;
 
 @SecurityScheme(
-    name = "basic",
-    type = SecuritySchemeType.HTTP,
-    scheme = "basic"
+        name = "basic",
+        type = SecuritySchemeType.HTTP,
+        scheme = "basic"
 )
 @SecurityScheme(
-    name = "bearer",
-    type = SecuritySchemeType.HTTP,
-    scheme = "bearer"
+        name = "bearer",
+        type = SecuritySchemeType.HTTP,
+        scheme = "bearer"
 )
 @ApplicationPath("/")
 @OpenAPIDefinition(
-    info = @Info(
-        title = "HugeGraph RESTful API",
-        version = CoreVersion.DEFAULT_VERSION,
-        description = "All management API for HugeGraph",
-        contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
-    ),
-    security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
+        info = @Info(
+                title = "HugeGraph RESTful API",
+                version = CoreVersion.DEFAULT_VERSION,
+                description = "All management API for HugeGraph",
+                contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
+        ),
+        security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
 )
 public class ApplicationConfig extends ResourceConfig {
 
@@ -131,9 +131,9 @@ private class GraphManagerFactory extends AbstractBinder implements Factory merger) {
+                                  BiFunction merger) {
         super(query);
         this.results = results;
         this.rows = results.iterator();
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
index e3e3eb51a6..400efd024c 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
@@ -108,7 +108,7 @@ protected Map getMetricsByHost(String host) {
             metrics.put(MEM_UNIT, "MB");
 
             long diskSize = UnitUtil.bytesFromReadableString(
-                            probe.getLoadString());
+                    probe.getLoadString());
             metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize));
             metrics.put(DISK_USAGE + READABLE,
                         UnitUtil.bytesToReadableString(diskSize));
@@ -213,7 +213,7 @@ protected static void appendTimerMetrics(Map metrics,
         String name = humpToLine(metric + "_" + suffix);
         // Aggregation of metrics for the whole host if keyspace=null
         JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric(
-                              keyspace, null, metric);
+                keyspace, null, metric);
         Map timerMap = InsertionOrderUtil.newMap();
         timerMap.put("count", value.getCount());
         timerMap.put("min", value.getMin());
@@ -316,7 +316,7 @@ private Map executeAllHosts(Function func) {
     }
 
     private NodeProbe newNodeProbe(String host) throws IOException {
-        LOG.debug("Probe to cassandra node: '{}:{}'", host,  this.port);
+        LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
         return this.username.isEmpty() ?
                new NodeProbe(host, this.port) :
                new NodeProbe(host, this.port, this.username, this.password);
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
index 0901a0231c..fc3c499a81 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
@@ -45,6 +45,7 @@
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.InsertionOrderUtil;
 import org.apache.hugegraph.util.JsonUtil;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
index a50cc3099c..7a9ffa2b91 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
@@ -26,6 +26,7 @@
 import org.apache.hugegraph.backend.store.BackendSessionPool;
 import org.apache.hugegraph.config.HugeConfig;
 import org.apache.hugegraph.util.E;
+
 import com.datastax.driver.core.BatchStatement;
 import com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.Cluster.Builder;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
index 30bd148346..5f37922985 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
@@ -32,7 +32,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
-import org.apache.cassandra.schema.SchemaConstants;
 import org.apache.cassandra.db.SystemKeyspace;
 import org.apache.cassandra.dht.ByteOrderedPartitioner;
 import org.apache.cassandra.dht.IPartitioner;
@@ -41,10 +40,11 @@
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.dht.Token.TokenFactory;
-
+import org.apache.cassandra.schema.SchemaConstants;
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.store.Shard;
 import org.apache.hugegraph.util.Bytes;
+
 import com.datastax.driver.core.Host;
 import com.datastax.driver.core.Metadata;
 import com.datastax.driver.core.ResultSet;
@@ -82,9 +82,10 @@ public CassandraShard(CassandraSessionPool.Session session,
 
     /**
      * Get splits of a table
+     *
      * @param splitPartitions: expected partitions count per split
-     * @param splitSize: expected size(bytes) per split,
-     *        splitPartitions will be ignored if splitSize is passed
+     * @param splitSize:       expected size(bytes) per split,
+     *                         splitPartitions will be ignored if splitSize is passed
      * @return a list of Shard
      */
     public List getSplits(long splitPartitions, long splitSize) {
@@ -105,7 +106,7 @@ public List getSplits(long splitPartitions, long splitSize) {
                  * compute bite-sized splits.
                  */
                 futures.add(executor.submit(new SplitCallable(
-                            range, splitPartitions, splitSize)));
+                        range, splitPartitions, splitSize)));
             }
 
             // Wait until we have all the results back
@@ -128,11 +129,12 @@ public List getSplits(long splitPartitions, long splitSize) {
     /**
      * Get splits of a table in specified range
      * NOTE: maybe we don't need this method
-     * @param start: the start of range
-     * @param end: the end of range
+     *
+     * @param start:           the start of range
+     * @param end:             the end of range
      * @param splitPartitions: expected partitions count per split
-     * @param splitSize: expected size(bytes) per split,
-     *        splitPartitions will be ignored if splitSize is passed
+     * @param splitSize:       expected size(bytes) per split,
+     *                         splitPartitions will be ignored if splitSize is passed
      * @return a list of Shard
      */
     public List getSplits(String start, String end,
@@ -146,8 +148,8 @@ public List getSplits(String start, String end,
             List>> futures = new ArrayList<>();
             TokenFactory tokenFactory = this.partitioner.getTokenFactory();
             TokenRange tokenRange = rangeToTokenRange(new Range<>(
-                                    tokenFactory.fromString(start),
-                                    tokenFactory.fromString(end)));
+                    tokenFactory.fromString(start),
+                    tokenFactory.fromString(end)));
 
             // Canonical ranges and nodes holding replicas
             Map> masterRangeNodes = getRangeMap();
@@ -157,7 +159,7 @@ public List getSplits(String start, String end,
                     // For each tokenRange, pick a live owner and ask it
                     // to compute bite-sized splits
                     futures.add(executor.submit(new SplitCallable(
-                                r, splitPartitions, splitSize)));
+                            r, splitPartitions, splitSize)));
                 }
             }
 
@@ -187,8 +189,8 @@ private TokenRange rangeToTokenRange(Range range) {
         TokenFactory tokenFactory = this.partitioner.getTokenFactory();
         Metadata metadata = this.session.metadata();
         return metadata.newTokenRange(
-                        metadata.newToken(tokenFactory.toString(range.left)),
-                        metadata.newToken(tokenFactory.toString(range.right)));
+                metadata.newToken(tokenFactory.toString(range.left)),
+                metadata.newToken(tokenFactory.toString(range.right)));
     }
 
     private Map getSubSplits(TokenRange tokenRange,
@@ -205,8 +207,8 @@ private Map getSubSplits(TokenRange tokenRange,
     private Map> getRangeMap() {
         Metadata metadata = this.session.metadata();
         return metadata.getTokenRanges().stream().collect(Collectors.toMap(
-            p -> p,
-            p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
+                p -> p,
+                p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
     }
 
     private static Map describeSplits(
@@ -274,15 +276,15 @@ public SplitCallable(TokenRange tokenRange,
                              long splitPartitions, long splitSize) {
             if (splitSize <= 0 && splitPartitions <= 0) {
                 throw new IllegalArgumentException(String.format(
-                          "The split-partitions must be > 0, but got %s",
-                          splitPartitions));
+                        "The split-partitions must be > 0, but got %s",
+                        splitPartitions));
             }
 
             if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) {
                 // splitSize should be at least 1M if passed
                 throw new IllegalArgumentException(String.format(
-                          "The split-size must be >= %s bytes, but got %s",
-                          MIN_SHARD_SIZE, splitSize));
+                        "The split-size must be >= %s bytes, but got %s",
+                        MIN_SHARD_SIZE, splitSize));
             }
 
             this.tokenRange = tokenRange;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
index 31038652b1..838a44078d 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
@@ -26,8 +26,6 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.slf4j.Logger;
-
 import org.apache.hugegraph.HugeException;
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.id.Id;
@@ -45,6 +43,7 @@
 import org.apache.hugegraph.type.HugeType;
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
 
 import com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.KeyspaceMetadata;
@@ -169,13 +168,13 @@ public synchronized void open(HugeConfig config) {
                 this.sessions.session().open();
             } catch (InvalidQueryException e) {
                 // TODO: the error message may be changed in different versions
-                if (!e.getMessage().contains(String.format(
-                    "Keyspace '%s' does not exist", this.keyspace))) {
+                if (!e.getMessage().contains(String.format("Keyspace '%s' does not exist",
+                                                           this.keyspace))) {
                     throw e;
                 }
                 if (this.isSchemaStore()) {
-                    LOG.info("Failed to connect keyspace: {}, " +
-                             "try to init keyspace later", this.keyspace);
+                    LOG.info("Failed to connect keyspace: {}, try to init keyspace later",
+                             this.keyspace);
                 }
             }
         } catch (Throwable e) {
@@ -211,13 +210,12 @@ public void mutate(BackendMutation mutation) {
         this.checkOpened();
         CassandraSessionPool.Session session = this.sessions.session();
 
-        for (Iterator it = mutation.mutation(); it.hasNext();) {
+        for (Iterator it = mutation.mutation(); it.hasNext(); ) {
             this.mutate(session, it.next());
         }
     }
 
-    private void mutate(CassandraSessionPool.Session session,
-                        BackendAction item) {
+    private void mutate(CassandraSessionPool.Session session, BackendAction item) {
         CassandraBackendEntry entry = castBackendEntry(item.entry());
 
         // Check if the entry has no change
@@ -296,7 +294,7 @@ private void mutate(CassandraSessionPool.Session session,
                 break;
             default:
                 throw new AssertionError(String.format(
-                          "Unsupported mutate action: %s", item.action()));
+                        "Unsupported mutate action: %s", item.action()));
         }
     }
 
@@ -305,7 +303,7 @@ public Iterator query(Query query) {
         this.checkOpened();
         HugeType type = CassandraTable.tableType(query);
         String tableName = query.olap() ? this.olapTableName(type) :
-                                          type.string();
+                           type.string();
         CassandraTable table = this.table(tableName);
         Iterator entries = table.query(this.session(null), query);
         // Merge olap results as needed
@@ -443,11 +441,11 @@ public void commitTx() {
         } catch (DriverException e) {
             session.txState(TxState.COMMITT_FAIL);
             LOG.error("Failed to commit statements due to:", e);
-            assert session.statements().size() > 0;
+            assert !session.statements().isEmpty();
             throw new BackendException(
-                      "Failed to commit %s statements: '%s'...", e,
-                      session.statements().size(),
-                      session.statements().iterator().next());
+                    "Failed to commit %s statements: '%s'...", e,
+                    session.statements().size(),
+                    session.statements().iterator().next());
         }
     }
 
@@ -512,7 +510,7 @@ private static Map parseReplica(HugeConfig conf) {
         switch (strategy) {
             case "SimpleStrategy":
                 List replicas =
-                             conf.get(CassandraOptions.CASSANDRA_REPLICATION);
+                        conf.get(CassandraOptions.CASSANDRA_REPLICATION);
                 E.checkArgument(replicas.size() == 1,
                                 "Individual factor value should be provided " +
                                 "with SimpleStrategy for Cassandra");
@@ -522,7 +520,7 @@ private static Map parseReplica(HugeConfig conf) {
             case "NetworkTopologyStrategy":
                 // The replicas format is like 'dc1:2,dc2:1'
                 Map replicaMap =
-                            conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
+                        conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
                 for (Map.Entry e : replicaMap.entrySet()) {
                     E.checkArgument(!e.getKey().isEmpty(),
                                     "The datacenter can't be empty");
@@ -531,9 +529,9 @@ private static Map parseReplica(HugeConfig conf) {
                 break;
             default:
                 throw new AssertionError(String.format(
-                          "Illegal replication strategy '%s', valid strategy " +
-                          "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
-                          strategy));
+                        "Illegal replication strategy '%s', valid strategy " +
+                        "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
+                        strategy));
         }
         return replication;
     }
@@ -543,8 +541,8 @@ private static int convertFactor(String factor) {
             return Integer.valueOf(factor);
         } catch (NumberFormatException e) {
             throw new BackendException(
-                      "Expect int factor value for SimpleStrategy, " +
-                      "but got '%s'", factor);
+                    "Expect int factor value for SimpleStrategy, " +
+                    "but got '%s'", factor);
         }
     }
 
@@ -720,19 +718,19 @@ public CassandraGraphStore(BackendStoreProvider provider,
         @Override
         public Id nextId(HugeType type) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.nextId()");
+                    "CassandraGraphStore.nextId()");
         }
 
         @Override
         public void increaseCounter(HugeType type, long num) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.increaseCounter()");
+                    "CassandraGraphStore.increaseCounter()");
         }
 
         @Override
         public long getCounter(HugeType type) {
             throw new UnsupportedOperationException(
-                      "CassandraGraphStore.getCounter()");
+                    "CassandraGraphStore.getCounter()");
         }
 
         @Override
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
index 633c98bc8e..15ad1a7bd3 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
@@ -27,9 +27,6 @@
 import java.util.function.BiFunction;
 import java.util.function.Function;
 
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.slf4j.Logger;
-
 import org.apache.hugegraph.backend.BackendException;
 import org.apache.hugegraph.backend.id.Id;
 import org.apache.hugegraph.backend.page.PageState;
@@ -51,6 +48,9 @@
 import org.apache.hugegraph.util.CopyUtil;
 import org.apache.hugegraph.util.E;
 import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.slf4j.Logger;
+
 import com.datastax.driver.core.ColumnDefinitions.Definition;
 import com.datastax.driver.core.DataType;
 import com.datastax.driver.core.PagingState;
@@ -74,7 +74,7 @@
 import com.google.common.collect.ImmutableMap;
 
 public abstract class CassandraTable
-                extends BackendTable {
+        extends BackendTable {
 
     private static final Logger LOG = Log.logger(CassandraTable.class);
     private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;
@@ -90,8 +90,8 @@ protected void registerMetaHandlers() {
                             "The args count of %s must be 1", meta);
             long splitSize = (long) args[0];
             CassandraShard splitter = new CassandraShard(session,
-                                                        session.keyspace(),
-                                                        this.table());
+                                                         session.keyspace(),
+                                                         this.table());
             return splitter.getSplits(0, splitSize);
         });
     }
@@ -118,12 +118,12 @@ public Number queryNumber(CassandraSessionPool.Session session,
             statement.setReadTimeoutMillis(timeout * 1000);
             return session.query(statement);
         }, (q, rs) -> {
-                Row row = rs.one();
-                if (row == null) {
-                    return IteratorUtils.of(aggregate.defaultValue());
-                }
-                return IteratorUtils.of(row.getLong(0));
-            });
+            Row row = rs.one();
+            if (row == null) {
+                return IteratorUtils.of(aggregate.defaultValue());
+            }
+            return IteratorUtils.of(row.getLong(0));
+        });
         return aggregate.reduce(results);
     }
 
@@ -135,8 +135,7 @@ public Iterator query(CassandraSessionPool.Session session,
 
     protected  Iterator query(Query query,
                                     Function fetcher,
-                                    BiFunction>
-                                    parser) {
+                                    BiFunction> parser) {
         ExtendableIterator rs = new ExtendableIterator<>();
 
         if (query.limit() == 0L && !query.noLimit()) {
@@ -279,8 +278,8 @@ protected List