Skip to content

Commit 34db712

Browse files
committed
[fixup] Add missing changelog, overridable methods on options builder
1 parent a52d33e commit 34db712

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 4.0.0-beta2 (in progress)
66

7+
- [new feature] JAVA-1932: Send Driver Name and Version in Startup message
78
- [new feature] JAVA-1917: Add ability to set node on statement
89
- [improvement] JAVA-1916: Base TimestampCodec.parse on java.util.Date.
910
- [improvement] JAVA-1940: Clean up test resources when CCM integration tests finish

core/src/main/java/com/datastax/oss/driver/internal/core/context/StartupOptionsBuilder.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,34 @@ public Map<String, String> build() {
9191
builder.put(Startup.COMPRESSION_KEY, compressionAlgorithm.trim());
9292
}
9393
// add driver name and version
94-
builder
95-
.put(DRIVER_NAME_KEY, MAVEN_COORDINATES.getName())
96-
.put(DRIVER_VERSION_KEY, MAVEN_COORDINATES.getVersion().toString());
94+
builder.put(DRIVER_NAME_KEY, getDriverName()).put(DRIVER_VERSION_KEY, getDriverVersion());
9795
// add any additonal options
9896
return builder.putAll(additionalOptions).build();
9997
}
98+
99+
/**
100+
* Returns this driver's name.
101+
*
102+
* <p>By default, this method will pull from the bundled Driver.properties file. Subclasses should
103+
* override this method if they need to report a different Driver name on Startup.
104+
*
105+
* <p><b>NOTE:</b> The Driver name can not be set via {@link
106+
* #withAdditionalOptions(java.util.Map)}
107+
*/
108+
protected String getDriverName() {
109+
return MAVEN_COORDINATES.getName();
110+
}
111+
112+
/**
113+
* Returns this driver's version.
114+
*
115+
* <p>By default, this method will pull from the bundled Driver.properties file. Subclasses should
116+
* override this method if they need to report a different Driver version on Startup.
117+
*
118+
* <p><b>NOTE:</b> The Driver version can not be set via {@link
119+
* #withAdditionalOptions(java.util.Map)}
120+
*/
121+
protected String getDriverVersion() {
122+
return MAVEN_COORDINATES.getVersion().toString();
123+
}
100124
}

integration-tests/src/test/java/com/datastax/oss/driver/example/guava/internal/GuavaDriverContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public GuavaDriverContext(
5252
RequestTracker requestTracker,
5353
Map<String, Predicate<Node>> nodeFilters,
5454
ClassLoader classLoader,
55-
Map<String, String> startupOptions) {
55+
Map<String, String> additionalStartupOptions) {
5656
super(
5757
configLoader,
5858
typeCodecs,
@@ -61,7 +61,7 @@ public GuavaDriverContext(
6161
requestTracker,
6262
nodeFilters,
6363
classLoader,
64-
startupOptions);
64+
additionalStartupOptions);
6565
}
6666

6767
@Override

0 commit comments

Comments
 (0)