Integration
Minimal project structure
You can reuse the sample projects from the OSS manual. Just substitute the driver artifact coordinates with:
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
<version>${driver.version}</version>
</dependency>
Driver dependencies
The DSE driver has a dependency to the OSS driver, and therefore pulls all of its dependencies transitively. Refer to the OSS manual for full details, but as a quick reminder:
- Netty is mandatory, but you can use the shaded driver to avoid classpath conflicts (the shaded DSE driver depends on the shaded OSS driver);
- Typesafe config can be excluded if you write your own configuration implementation;
- JNR-FFI and JNR-POSIX are used to perform native calls for a couple of features. They may be excluded, but the driver will fall back to pure-Java (and possibly less optimal) workarounds;
- LZ4 and Snappy are optional, if you enable compression you redeclare the corresponding dependency in your application;
- Dropwizard metrics can be excluded if metrics are disabled. HdrHistogram can be excluded if all “timer” metrics are disabled;
- the JCiP concurrency annotations and SpotBugs nullability annotations are for documentation purposes only, the dependencies are optional and you don’t need to redeclare them.
In addition, the DSE driver has the following dependencies:
Esri
Our geospatial types implementation is based on the Esri Geometry API.
If you don’t use geospatial types anywhere in your application, you can exclude the dependency:
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
<version>${driver.version}</version>
<exclusions>
<exclusion>
<groupId>com.esri.geometry</groupId>
<artifactId>esri-geometry-api</artifactId>
</exclusion>
</exclusions>
</dependency>
TinkerPop
Apache TinkerPop™ is used in our graph API.
If you don’t use DSE graph at all, you can exclude the dependencies:
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
<version>${driver.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkergraph-gremlin</artifactId>
</exclusion>
</exclusions>
</dependency>
Mandatory dependencies
If all the exclusion conditions listed above are met, the driver can run with the following minimal set of dependencies:
-
java-driver-core
: the core OSS driver, and transitivelynative-protocol
, the native protocol layer; -
dse-native-protocol
: DSE-specific native protocol extensions; -
java-driver-shaded-guava
: a shaded version of Google Guava; -
slf4j-api
: logging facade.