Code Monkey home page Code Monkey logo

incubator-hugegraph-commons's Introduction

hugegraph-commons

License codecov Maven Central CodeQL hugegraph-commons ci

hugegraph-commons is a common module for HugeGraph and its peripheral components. hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some numeric or collection util classes to simplify the development of HugeGraph and its components.

Components

  • Lock: atomic lock, key lock, lock group and lock manger
  • Config: register and load config option with security check
  • Event: listening and notification, do something asynchronously
  • Iterator: some iterators with extra functions, map, filter, extend, etc.
  • Rest: RESTful client implemented on OkHttp, POST, PUT, GET and DELETE
  • Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils, etc.
  • Rpc: rpc component for inner module communication, currently it's based on Sofa-RPC

You could use import the dependencies in maven like this:

  <dependency>
       <groupId>org.apache.hugegraph</groupId>
       <artifactId>hugegraph-common</artifactId>
       <version>1.2.0</version>
  </dependency>

Learn More

The doc page contains more information about hugegraph modules.

And here are links of other repositories:

  1. hugegraph-server (graph's core component - OLTP server)
  2. hugegraph-toolchain (include loader/dashboard/tool/client)
  3. hugegraph-computer (graph processing system - OLAP)
  4. hugegraph-website/doc (include doc & website code)

Contributing

  • Welcome to contribute to HugeGraph, please see How to Contribute & Guidelines for more information.
  • Note: It's recommended to use GitHub Desktop to greatly simplify the PR and commit process.
  • Thank you to all the people who already contributed to HugeGraph!

contributors graph

Licence

Same as HugeGraph, hugegraph-commons are also licensed under Apache 2.0 License.

Contact Us


  • GitHub Issues: Feedback on usage issues and functional requirements (quick response)
  • Feedback Email: [email protected] (subscriber only)
  • WeChat public account: Apache HugeGraph, welcome to scan this QR code to follow us.

QR png

incubator-hugegraph-commons's People

Contributors

chengxin1374 avatar coderzc avatar corgiboygsj avatar damonxue avatar dependabot[bot] avatar freehackofjeff avatar guoygang avatar houzhizhen avatar imbajin avatar javeme avatar linary avatar msgui avatar seagle-yuan avatar shzcore avatar simon824 avatar z7658329 avatar zhenyut avatar zhoney avatar zyxxoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

incubator-hugegraph-commons's Issues

optimize CollectionUtils.intersection()

hugegraph-issue-83
Since the apache CollectionUtils.intersection() is based on copy and element count statistics,
most of the time, we can change the original set without having to reconstruct the set and copy.
So we provide an optimized method based on retainAll().
Also add hasIntersection(set1, set2) for CollectionUtils.intersection(set1, set2).isEmpty()

Dependency conflict cause "InjectionManagerFactory not found"

Exception in thread "main" com.baidu.hugegraph.rest.ClientException: Failed to do request
	at com.baidu.hugegraph.rest.RestClient.request(RestClient.java:69)
	at com.baidu.hugegraph.rest.RestClient.get(RestClient.java:147)
	at com.baidu.hugegraph.api.version.VersionAPI.get(VersionAPI.java:41)
	at com.baidu.hugegraph.driver.VersionManager.getApiVersion(VersionManager.java:45)
	at com.baidu.hugegraph.driver.HugeClient.checkServerApiVersion(HugeClient.java:98)
	at com.baidu.hugegraph.driver.HugeClient.initManagers(HugeClient.java:84)
	at com.baidu.hugegraph.driver.HugeClient.<init>(HugeClient.java:59)
	at com.baidu.hugegraph.driver.HugeClient.<init>(HugeClient.java:48)
	at com.ikang.cc.grape.GrapeMain.main(GrapeMain.java:21)
Caused by: java.lang.IllegalStateException: InjectionManagerFactory not found.
	at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98)
	at java.util.Optional.orElseThrow(Optional.java:290)
	at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98)
	at org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:68)
	at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:432)
	at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:341)
	at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:826)
	at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:285)
	at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:143)
	at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:112)
	at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:108)
	at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:99)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:419)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:319)
	at com.baidu.hugegraph.rest.RestClient.lambda$get$2(RestClient.java:148)
	at com.baidu.hugegraph.rest.RestClient.request(RestClient.java:67)
	... 8 more

[Bug] PerfUtilTest fail using mvn clean package

Bug Type (问题类型)

exception / error (异常报错)

Before submit

Environment (环境信息)

  • Server Version: v1.3.0
  • Common Version: v1.3,0

Expected & Actual behavior (期望与实际表现)

mvn test -Dtest=UnitTestSuite pass all tests, however PerfUtilTest fail using mvn clean package.

[INFO] Running org.apache.hugegraph.unit.perf.PerfUtilTest
[ERROR] Tests run: 9, Failures: 0, Errors: 6, Skipped: 0, Time elapsed: 0.148 s <<< FAILURE! - in org.apache.hugegraph.unit.perf.PerfUtilTest
[ERROR] testPerfUtilPerf4LightStopwatch(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.081 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf4LightStopwatch(PerfUtilTest.java:395)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf4LightStopwatch(PerfUtilTest.java:395)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass.TestPerfLightClass. (org.apache.hugegraph.unit.perf.testclass.TestPerfLightClass is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf4LightStopwatch(PerfUtilTest.java:395)

[ERROR] testPerfUtilWithProfileParentClass(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.001 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfileParentClass(PerfUtilTest.java:288)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfileParentClass(PerfUtilTest.java:288)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass.TestClass$Base. (org.apache.hugegraph.unit.perf.testclass.TestClass$Base is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfileParentClass(PerfUtilTest.java:288)

[ERROR] testPerfUtil(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.001 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtil(PerfUtilTest.java:49)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtil(PerfUtilTest.java:49)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass.TestClass$Foo. (org.apache.hugegraph.unit.perf.testclass.TestClass$Foo is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtil(PerfUtilTest.java:49)

[ERROR] testPerfUtilWithSingleThread(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.002 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithSingleThread(PerfUtilTest.java:215)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithSingleThread(PerfUtilTest.java:215)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass.TestClass$Bar. (org.apache.hugegraph.unit.perf.testclass.TestClass$Bar is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithSingleThread(PerfUtilTest.java:215)

[ERROR] testPerfUtilPerf(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.003 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf(PerfUtilTest.java:352)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf(PerfUtilTest.java:352)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass.TestPerfClass. (org.apache.hugegraph.unit.perf.testclass.TestPerfClass is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilPerf(PerfUtilTest.java:352)

[ERROR] testPerfUtilWithProfilePackage(org.apache.hugegraph.unit.perf.PerfUtilTest)  Time elapsed: 0.029 s  <<< ERROR!
javassist.CannotCompileException: by java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfilePackage(PerfUtilTest.java:253)
Caused by: java.lang.reflect.InvocationTargetException
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfilePackage(PerfUtilTest.java:253)
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.apache.hugegraph.unit.perf.testclass2.TestClass4Package. (org.apache.hugegraph.unit.perf.testclass2.TestClass4Package is in unnamed module of loader 'app')
        at org.apache.hugegraph.unit.perf.PerfUtilTest.testPerfUtilWithProfilePackage(PerfUtilTest.java:253)

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

NullPointerException in EventHub.destroy()

exception when running PerfExample2 with error args:

Exception in thread "main" java.lang.NullPointerException
	at com.baidu.hugegraph.event.EventHub.destroy(EventHub.java:80)
	at com.baidu.hugegraph.HugeGraph.shutdown(HugeGraph.java:570)
	at com.baidu.hugegraph.example.PerfExample2.main(PerfExample2.java:44)

[Bug] Dependency junit:junit, leading to CVE problem

Bug Type (问题类型)

No response

Before submit

Environment (环境信息)

  • Server Version: v0.11.x
  • Common Version: v1.x

Expected & Actual behavior (期望与实际表现)

Hi, In /incubator-hugegraph-commons,there is a dependency junit:junit:4.12 that calls the risk method.

CVE-2020-15250

The scope of this CVE affected version is [4.7,4.13.1)

After further analysis, in this project, the main Api called is org.junit.rules.TemporaryFolder: createTemporaryFolderIn(java.io.File)Ljava.io.File

Risk method repair link : GitHub

CVE Bug Invocation Path--

Path Length : 7

org.apache.hugegraph.rest.AbstractRestClient: request(java.util.concurrent.Callable)Ljakarta.ws.rs.core.Response; /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement: call()Ljava.lang.Object; /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement: call()Ljava.lang.Throwable; /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.rules.ExternalResource$1: evaluate()V /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.rules.TemporaryFolder: before()V /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.rules.TemporaryFolder: create()V /.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar
org.junit.rules.TemporaryFolder: createTemporaryFolderIn(java.io.File)Ljava.io.File;

Dependency tree--

[INFO] org.apache.hugegraph:hugegraph-common:jar:1.0.0
[INFO] +- junit:junit:jar:4.12:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.mockito:mockito-core:jar:4.1.0:test
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.12.1:test
[INFO] |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.1:test
[INFO] |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.17.0:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.17.0:compile
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.17.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.glassfish:javax.json:jar:1.0:compile
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.apache.commons:commons-configuration2:jar:2.3:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] +- commons-io:commons-io:jar:2.7:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- commons-codec:commons-codec:jar:1.11:compile
[INFO] +- com.google.guava:guava:jar:25.1-jre:compile
[INFO] |  +- org.checkerframework:checker-qual:jar:2.0.0:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- com.google.code.findbugs:jsr305:jar:3.0.1:compile
[INFO] +- joda-time:joda-time:jar:2.10.8:compile
[INFO] +- org.javassist:javassist:jar:3.28.0-GA:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.12.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.1:compile
[INFO] +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.12.1:compile
[INFO] |  \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.12.1:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.12.1:compile
[INFO] +- org.glassfish.jersey.core:jersey-client:jar:3.0.3:compile
[INFO] |  +- jakarta.ws.rs:jakarta.ws.rs-api:jar:3.0.0:compile
[INFO] |  +- org.glassfish.jersey.core:jersey-common:jar:3.0.3:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:2.0.0:compile
[INFO] |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] |  \- jakarta.inject:jakarta.inject-api:jar:2.0.0:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-json-jackson:jar:3.0.3:compile
[INFO] |  +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:3.0.3:compile
[INFO] |  \- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] |     \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- org.glassfish.jersey.connectors:jersey-apache-connector:jar:3.0.3:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |     \- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] +- org.glassfish.jersey.inject:jersey-hk2:jar:3.0.3:compile
[INFO] |  \- org.glassfish.hk2:hk2-locator:jar:3.0.1:compile
[INFO] |     +- org.glassfish.hk2.external:aopalliance-repackaged:jar:3.0.1:compile
[INFO] |     +- org.glassfish.hk2:hk2-api:jar:3.0.1:compile
[INFO] |     \- org.glassfish.hk2:hk2-utils:jar:3.0.1:compile
[INFO] +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.0-RC2:compile
[INFO] \- com.sun.xml.bind:jaxb-impl:jar:3.0.2:runtime
[INFO]    \- com.sun.xml.bind:jaxb-core:jar:3.0.2:runtime
[INFO]       \- com.sun.activation:jakarta.activation:jar:2.0.1:runtime

Suggested solutions:

Update dependency version

Thank you very much.

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

HugeConfig save to file is empty

reproduce steps

// file origin.properties is not empty
HugeConfig config = new HugeConfig("origin.properties");
config.save("copied.propties");

open file copied.propties, it's empty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.