diff --git a/NOTES b/NOTES
index 65017da..a2cb1f2 100644
--- a/NOTES
+++ b/NOTES
@@ -14,7 +14,7 @@ Operation/
| | `-- BoundOptionalOperation
| `-- AbstractStreamOperation
| |-- AbstractFilterStreamOperation
-| | |-- SelectOperation
+ | | |-- SelectOperation
| | `-- SelectTransformingOperation
| `-- BoundStreamOperation
|-- PreparedOperation
@@ -22,6 +22,14 @@ Operation/
`-- PreparedStreamOperation
+----
+@CompoundIndex()
+create a new col in the same table called __idx_a_b_c that the hash of the concatenated values in that order is stored, create a normal index for that (CREATE INDEX ...)
+if a query matches that set of columns then use that indexed col to fetch the desired results from that table
+could also work with .in() query if materialized view exists
+----
+
+
// TODO(gburd): create a statement that matches one that wasn't prepared
//String key =
// "use " + preparedStatement.getQueryKeyspace() + "; " + preparedStatement.getQueryString();
@@ -183,3 +191,12 @@ InsertOperation
if (resultType == iface) {
if (values.size() > 0 && includesNonIdentityValues) {
boolean immutable = iface.isAssignableFrom(Drafted.class);
+-------------------
+
+ final Object value;
+ if (method.getParameterCount() == 1 && args[0] instanceof Boolean && src instanceof ValueProviderMap) {
+ value = ((ValueProviderMap)src).get(methodName, (Boolean)args[0]);
+ } else {
+ value = src.get(methodName);
+ }
+--------------------
diff --git a/bin/deploy.sh b/bin/deploy.sh
index a54aa01..271fb4c 100755
--- a/bin/deploy.sh
+++ b/bin/deploy.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
-mvn clean jar:jar javadoc:jar source:jar deploy -Prelease
+mvn clean jar:jar javadoc:jar source:jar deploy -Prelease
diff --git a/bin/format.sh b/bin/format.sh
index 10b2bf0..031b9f3 100755
--- a/bin/format.sh
+++ b/bin/format.sh
@@ -1,7 +1,14 @@
-#!/bin/bash
+#!/usr/bin/env bash
-for f in $(find ./src -name \*.java); do
- echo Formatting $f
- java -jar ./lib/google-java-format-1.3-all-deps.jar --replace $f
-done
+if [ "X$1" == "Xall" ]; then
+ for f in $(find ./src -name \*.java); do
+ echo Formatting $f
+ java -jar ./lib/google-java-format-1.3-all-deps.jar --replace $f
+ done
+else
+ for file in $(git status --short | awk '{print $2}'); do
+ echo $file
+ java -jar ./lib/google-java-format-1.3-all-deps.jar --replace $file
+ done
+fi
diff --git a/bin/sign.sh b/bin/sign.sh
index ca6b8e5..143db80 100755
--- a/bin/sign.sh
+++ b/bin/sign.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
mvn clean jar:jar javadoc:jar source:jar install -Prelease
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 50b24e8..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,90 +0,0 @@
-// gradle wrapper
-// ./gradlew clean generateLock saveLock
-// ./gradlew compileJava
-// ./gradlew run
-// ./gradlew run --debug-jvm
-// ./gradlew publishToMavenLocal
-
-
-buildscript {
- ext {}
- repositories {
- jcenter()
- mavenLocal()
- mavenCentral()
- maven { url "https://clojars.org/repo" }
- maven { url "https://plugins.gradle.org/m2/" }
- }
- dependencies {
- classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:4.+'
- classpath 'com.uber:okbuck:0.19.0'
- }
-}
-
-apply plugin: 'java'
-apply plugin: 'idea'
-apply plugin: 'eclipse'
-apply plugin: 'java-library'
-apply plugin: 'maven-publish'
-apply plugin: 'com.uber.okbuck'
-apply plugin: 'nebula.dependency-lock'
-
-task wrapper(type: Wrapper) {
- gradleVersion = '4.0.2'
-}
-
-jar {
- baseName = 'helenus'
- group = 'net.helenus'
- version = '2.0.17-SNAPSHOT'
-}
-
-description = """helenus"""
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
-}
-
-configurations.all {
-}
-
-repositories {
- jcenter()
- mavenLocal()
- mavenCentral()
- maven { url "file:///Users/gburd/ws/helenus/lib" }
- maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
- maven { url "http://repo.maven.apache.org/maven2" }
-}
-dependencies {
- compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.3.0'
- compile group: 'org.aspectj', name: 'aspectjrt', version: '1.8.10'
- compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.10'
- compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
- compile group: 'org.springframework', name: 'spring-core', version: '4.3.10.RELEASE'
- compile group: 'com.google.guava', name: 'guava', version: '20.0'
- compile group: 'com.diffplug.durian', name: 'durian', version: '3.+'
- compile group: 'io.zipkin.java', name: 'zipkin', version: '1.29.2'
- compile group: 'io.zipkin.brave', name: 'brave', version: '4.0.6'
- compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.2.2'
- compile group: 'javax.validation', name: 'validation-api', version: '2.0.0.CR3'
- compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.1'
-
- runtime group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.1'
-
- testCompile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.13'
- testCompile group: 'com.anthemengineering.mojo', name: 'infer-maven-plugin', version: '0.1.0'
- testCompile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.13'
- testCompile(group: 'org.cassandraunit', name: 'cassandra-unit', version: '3.1.4.0-SNAPSHOT') {
- exclude(module: 'cassandra-driver-core')
- }
- testCompile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.11.0'
- testCompile group: 'commons-io', name: 'commons-io', version: '2.5'
- testCompile group: 'junit', name: 'junit', version: '4.12'
- testCompile group: 'com.github.stephenc', name: 'jamm', version: '0.2.5'
- testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
- testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
- testCompile group: 'org.mockito', name: 'mockito-core', version: '2.8.47'
-}
diff --git a/dependencies.lock b/dependencies.lock
deleted file mode 100644
index 8222106..0000000
--- a/dependencies.lock
+++ /dev/null
@@ -1,648 +0,0 @@
-{
- "compile": {
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.google.guava:guava": {
- "locked": "20.0",
- "requested": "20.0"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "compileClasspath": {
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.google.guava:guava": {
- "locked": "20.0",
- "requested": "20.0"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "default": {
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.google.guava:guava": {
- "locked": "20.0",
- "requested": "20.0"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.slf4j:jcl-over-slf4j": {
- "locked": "1.7.1",
- "requested": "1.7.1"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "runtime": {
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.google.guava:guava": {
- "locked": "20.0",
- "requested": "20.0"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.slf4j:jcl-over-slf4j": {
- "locked": "1.7.1",
- "requested": "1.7.1"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "runtimeClasspath": {
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.google.guava:guava": {
- "locked": "20.0",
- "requested": "20.0"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.slf4j:jcl-over-slf4j": {
- "locked": "1.7.1",
- "requested": "1.7.1"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "testCompile": {
- "com.anthemengineering.mojo:infer-maven-plugin": {
- "locked": "0.1.0",
- "requested": "0.1.0"
- },
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.github.stephenc:jamm": {
- "locked": "0.2.5",
- "requested": "0.2.5"
- },
- "com.google.guava:guava": {
- "locked": "21.0",
- "requested": "20.0"
- },
- "commons-io:commons-io": {
- "locked": "2.5",
- "requested": "2.5"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "junit:junit": {
- "locked": "4.12",
- "requested": "4.12"
- },
- "org.apache.cassandra:cassandra-all": {
- "locked": "3.11.0",
- "requested": "3.11.0"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.cassandraunit:cassandra-unit": {
- "locked": "3.1.4.0-SNAPSHOT",
- "requested": "3.1.4.0-SNAPSHOT"
- },
- "org.codehaus.jackson:jackson-core-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.codehaus.jackson:jackson-mapper-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.hamcrest:hamcrest-core": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.hamcrest:hamcrest-library": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.mockito:mockito-core": {
- "locked": "2.8.47",
- "requested": "2.8.47"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "testCompileClasspath": {
- "com.anthemengineering.mojo:infer-maven-plugin": {
- "locked": "0.1.0",
- "requested": "0.1.0"
- },
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.github.stephenc:jamm": {
- "locked": "0.2.5",
- "requested": "0.2.5"
- },
- "com.google.guava:guava": {
- "locked": "21.0",
- "requested": "20.0"
- },
- "commons-io:commons-io": {
- "locked": "2.5",
- "requested": "2.5"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "junit:junit": {
- "locked": "4.12",
- "requested": "4.12"
- },
- "org.apache.cassandra:cassandra-all": {
- "locked": "3.11.0",
- "requested": "3.11.0"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.cassandraunit:cassandra-unit": {
- "locked": "3.1.4.0-SNAPSHOT",
- "requested": "3.1.4.0-SNAPSHOT"
- },
- "org.codehaus.jackson:jackson-core-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.codehaus.jackson:jackson-mapper-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.hamcrest:hamcrest-core": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.hamcrest:hamcrest-library": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.mockito:mockito-core": {
- "locked": "2.8.47",
- "requested": "2.8.47"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "testRuntime": {
- "com.anthemengineering.mojo:infer-maven-plugin": {
- "locked": "0.1.0",
- "requested": "0.1.0"
- },
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.github.stephenc:jamm": {
- "locked": "0.2.5",
- "requested": "0.2.5"
- },
- "com.google.guava:guava": {
- "locked": "21.0",
- "requested": "20.0"
- },
- "commons-io:commons-io": {
- "locked": "2.5",
- "requested": "2.5"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "junit:junit": {
- "locked": "4.12",
- "requested": "4.12"
- },
- "org.apache.cassandra:cassandra-all": {
- "locked": "3.11.0",
- "requested": "3.11.0"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.cassandraunit:cassandra-unit": {
- "locked": "3.1.4.0-SNAPSHOT",
- "requested": "3.1.4.0-SNAPSHOT"
- },
- "org.codehaus.jackson:jackson-core-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.codehaus.jackson:jackson-mapper-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.hamcrest:hamcrest-core": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.hamcrest:hamcrest-library": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.mockito:mockito-core": {
- "locked": "2.8.47",
- "requested": "2.8.47"
- },
- "org.slf4j:jcl-over-slf4j": {
- "locked": "1.7.7",
- "requested": "1.7.1"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- },
- "testRuntimeClasspath": {
- "com.anthemengineering.mojo:infer-maven-plugin": {
- "locked": "0.1.0",
- "requested": "0.1.0"
- },
- "com.datastax.cassandra:cassandra-driver-core": {
- "locked": "3.3.0",
- "requested": "3.3.0"
- },
- "com.diffplug.durian:durian": {
- "locked": "3.5.0-SNAPSHOT",
- "requested": "3.+"
- },
- "com.github.stephenc:jamm": {
- "locked": "0.2.5",
- "requested": "0.2.5"
- },
- "com.google.guava:guava": {
- "locked": "21.0",
- "requested": "20.0"
- },
- "commons-io:commons-io": {
- "locked": "2.5",
- "requested": "2.5"
- },
- "io.dropwizard.metrics:metrics-core": {
- "locked": "3.2.2",
- "requested": "3.2.2"
- },
- "io.zipkin.brave:brave": {
- "locked": "4.0.6",
- "requested": "4.0.6"
- },
- "io.zipkin.java:zipkin": {
- "locked": "1.29.2",
- "requested": "1.29.2"
- },
- "javax.validation:validation-api": {
- "locked": "2.0.0.CR3",
- "requested": "2.0.0.CR3"
- },
- "junit:junit": {
- "locked": "4.12",
- "requested": "4.12"
- },
- "org.apache.cassandra:cassandra-all": {
- "locked": "3.11.0",
- "requested": "3.11.0"
- },
- "org.apache.commons:commons-lang3": {
- "locked": "3.6",
- "requested": "3.6"
- },
- "org.aspectj:aspectjrt": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.aspectj:aspectjweaver": {
- "locked": "1.8.10",
- "requested": "1.8.10"
- },
- "org.cassandraunit:cassandra-unit": {
- "locked": "3.1.4.0-SNAPSHOT",
- "requested": "3.1.4.0-SNAPSHOT"
- },
- "org.codehaus.jackson:jackson-core-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.codehaus.jackson:jackson-mapper-asl": {
- "locked": "1.9.13",
- "requested": "1.9.13"
- },
- "org.hamcrest:hamcrest-core": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.hamcrest:hamcrest-library": {
- "locked": "1.3",
- "requested": "1.3"
- },
- "org.mockito:mockito-core": {
- "locked": "2.8.47",
- "requested": "2.8.47"
- },
- "org.slf4j:jcl-over-slf4j": {
- "locked": "1.7.7",
- "requested": "1.7.1"
- },
- "org.slf4j:slf4j-api": {
- "locked": "1.7.25",
- "requested": "1.7.1"
- },
- "org.springframework:spring-core": {
- "locked": "4.3.10.RELEASE",
- "requested": "4.3.10.RELEASE"
- }
- }
-}
\ No newline at end of file
diff --git a/helenus-core.iml b/helenus-core.iml
index be96637..d38133a 100644
--- a/helenus-core.iml
+++ b/helenus-core.iml
@@ -11,7 +11,7 @@
-
+
@@ -28,16 +28,14 @@
+
-
+
-
-
-
@@ -116,9 +114,9 @@
+
-
diff --git a/pom.xml b/pom.xml
index 71feca8..8b502a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,7 +109,13 @@
com.datastax.cassandra
cassandra-driver-core
- 3.3.0
+ 3.3.2
+
+
+
+ com.datastax.cassandra
+ cassandra-driver-extras
+ 3.3.2
@@ -118,12 +124,6 @@
3.4.0
-
- org.aspectj
- aspectjrt
- 1.8.10
-
-
org.aspectj
aspectjweaver
@@ -142,25 +142,19 @@
4.3.10.RELEASE
+
+ javax.cache
+ cache-api
+ 1.1.0
+
+
com.google.guava
guava
20.0
-
-
- io.zipkin.java
- zipkin
- 1.29.2
-
-
-
- io.zipkin.brave
- brave
- 4.0.6
-
-
+
io.dropwizard.metrics
metrics-core
@@ -217,6 +211,24 @@
test
+
+
+ ca.exprofesso
+ guava-jcache
+ 1.0.4
+
+
+ com.google.guava
+ guava
+
+
+ javax.cache
+ cache-api
+
+
+ test
+
+
commons-io
commons-io
@@ -231,13 +243,6 @@
test
-
- com.github.stephenc
- jamm
- 0.2.5
- test
-
-
org.hamcrest
hamcrest-library
@@ -272,7 +277,6 @@
1.7.1
runtime
-
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index bad81ae..0000000
--- a/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'helenus-core'
diff --git a/src/main/java/com/datastax/driver/core/schemabuilder/CreateMaterializedView.java b/src/main/java/com/datastax/driver/core/schemabuilder/CreateMaterializedView.java
index d6ba093..70e0ae6 100644
--- a/src/main/java/com/datastax/driver/core/schemabuilder/CreateMaterializedView.java
+++ b/src/main/java/com/datastax/driver/core/schemabuilder/CreateMaterializedView.java
@@ -5,7 +5,7 @@ import com.datastax.driver.core.querybuilder.Select;
public class CreateMaterializedView extends Create {
- private String viewName;
+ private final String viewName;
private Select.Where selection;
private String primaryKey;
private String clustering;
diff --git a/src/main/java/net/helenus/core/AbstractAuditedEntityDraft.java b/src/main/java/net/helenus/core/AbstractAuditedEntityDraft.java
index a9a09e2..d0b76e8 100644
--- a/src/main/java/net/helenus/core/AbstractAuditedEntityDraft.java
+++ b/src/main/java/net/helenus/core/AbstractAuditedEntityDraft.java
@@ -33,6 +33,6 @@ public abstract class AbstractAuditedEntityDraft extends AbstractEntityDraft<
}
public Date createdAt() {
- return (Date) get("createdAt", Date.class);
+ return get("createdAt", Date.class);
}
}
diff --git a/src/main/java/net/helenus/core/AbstractEntityDraft.java b/src/main/java/net/helenus/core/AbstractEntityDraft.java
index 0101351..448d852 100644
--- a/src/main/java/net/helenus/core/AbstractEntityDraft.java
+++ b/src/main/java/net/helenus/core/AbstractEntityDraft.java
@@ -2,22 +2,36 @@ package net.helenus.core;
import com.google.common.primitives.Primitives;
import java.io.Serializable;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import net.helenus.core.reflect.DefaultPrimitiveTypes;
import net.helenus.core.reflect.Drafted;
import net.helenus.core.reflect.MapExportable;
+import net.helenus.mapping.HelenusProperty;
import net.helenus.mapping.MappingUtil;
import org.apache.commons.lang3.SerializationUtils;
public abstract class AbstractEntityDraft implements Drafted {
- private final Map backingMap = new HashMap();
private final MapExportable entity;
- private final Map entityMap;
+ private final Map valuesMap;
+ private final Set readSet;
+ private final Map mutationsMap = new HashMap();
public AbstractEntityDraft(MapExportable entity) {
this.entity = entity;
- this.entityMap = entity != null ? entity.toMap() : new HashMap();
+ // Entities can mutate their map.
+ if (entity != null) {
+ this.valuesMap = entity.toMap(true);
+ this.readSet = entity.toReadSet();
+ } else {
+ this.valuesMap = new HashMap();
+ this.readSet = new HashSet();
+ }
}
public abstract Class getEntityClass();
@@ -33,10 +47,11 @@ public abstract class AbstractEntityDraft implements Drafted {
@SuppressWarnings("unchecked")
public T get(String key, Class> returnType) {
- T value = (T) backingMap.get(key);
+ readSet.add(key);
+ T value = (T) mutationsMap.get(key);
if (value == null) {
- value = (T) entityMap.get(key);
+ value = (T) valuesMap.get(key);
if (value == null) {
if (Primitives.allPrimitiveTypes().contains(returnType)) {
@@ -49,14 +64,9 @@ public abstract class AbstractEntityDraft implements Drafted {
return (T) type.getDefaultValue();
}
} else {
- // Collections fetched from the entityMap
+ // Collections fetched from the valuesMap
if (value instanceof Collection) {
- try {
- value = MappingUtil.clone(value);
- } catch (CloneNotSupportedException e) {
- // TODO(gburd): deep?shallow? copy of List, Map, Set to a mutable collection.
- value = (T) SerializationUtils.clone((Serializable) value);
- }
+ value = (T) SerializationUtils.clone((Serializable) value);
}
}
}
@@ -65,7 +75,17 @@ public abstract class AbstractEntityDraft implements Drafted {
}
public Object set(Getter getter, Object value) {
- return set(this.methodNameFor(getter), value);
+ HelenusProperty prop = MappingUtil.resolveMappingProperty(getter).getProperty();
+ String key = prop.getPropertyName();
+
+ HelenusValidator.INSTANCE.validate(prop, value);
+
+ if (key == null || value == null) {
+ return null;
+ }
+
+ mutationsMap.put(key, value);
+ return value;
}
public Object set(String key, Object value) {
@@ -73,36 +93,34 @@ public abstract class AbstractEntityDraft implements Drafted {
return null;
}
- backingMap.put(key, value);
+ mutationsMap.put(key, value);
return value;
}
+ public void put(String key, Object value) {
+ mutationsMap.put(key, value);
+ }
+
@SuppressWarnings("unchecked")
public T mutate(Getter getter, T value) {
return (T) mutate(this.methodNameFor(getter), value);
}
- public Object mutate(String key, Object value) {
+ public T mutate(String key, T value) {
Objects.requireNonNull(key);
- if (value == null) {
- return null;
- }
-
- if (entity != null) {
- Map map = entity.toMap();
-
- if (map.containsKey(key) && !value.equals(map.get(key))) {
- backingMap.put(key, value);
- return value;
+ if (value != null) {
+ if (entity != null) {
+ T currentValue = this.fetch(key);
+ if (!value.equals(currentValue)) {
+ mutationsMap.put(key, value);
+ return value;
+ }
+ } else {
+ mutationsMap.put(key, value);
}
-
- return map.get(key);
- } else {
- backingMap.put(key, value);
-
- return null;
}
+ return null;
}
private String methodNameFor(Getter getter) {
@@ -115,8 +133,8 @@ public abstract class AbstractEntityDraft implements Drafted {
public Object unset(String key) {
if (key != null) {
- Object value = backingMap.get(key);
- backingMap.put(key, null);
+ Object value = mutationsMap.get(key);
+ mutationsMap.put(key, null);
return value;
}
return null;
@@ -126,10 +144,18 @@ public abstract class AbstractEntityDraft implements Drafted {
return this.reset(this.methodNameFor(getter), desiredValue);
}
+ private T fetch(String key) {
+ T value = (T) mutationsMap.get(key);
+ if (value == null) {
+ value = (T) valuesMap.get(key);
+ }
+ return value;
+ }
+
public boolean reset(String key, T desiredValue) {
if (key != null && desiredValue != null) {
@SuppressWarnings("unchecked")
- T currentValue = (T) backingMap.get(key);
+ T currentValue = (T) this.fetch(key);
if (currentValue == null || !currentValue.equals(desiredValue)) {
set(key, desiredValue);
return true;
@@ -140,7 +166,7 @@ public abstract class AbstractEntityDraft implements Drafted {
@Override
public Map toMap() {
- return toMap(entityMap);
+ return toMap(valuesMap);
}
public Map toMap(Map entityMap) {
@@ -151,21 +177,26 @@ public abstract class AbstractEntityDraft implements Drafted {
combined.put(e.getKey(), e.getValue());
}
} else {
- combined = new HashMap(backingMap.size());
+ combined = new HashMap(mutationsMap.size());
}
for (String key : mutated()) {
- combined.put(key, backingMap.get(key));
+ combined.put(key, mutationsMap.get(key));
}
return combined;
}
@Override
public Set mutated() {
- return backingMap.keySet();
+ return mutationsMap.keySet();
+ }
+
+ @Override
+ public Set read() {
+ return readSet;
}
@Override
public String toString() {
- return backingMap.toString();
+ return mutationsMap.toString();
}
}
diff --git a/src/main/java/net/helenus/core/AbstractSessionOperations.java b/src/main/java/net/helenus/core/AbstractSessionOperations.java
index ba92e44..a5603e6 100644
--- a/src/main/java/net/helenus/core/AbstractSessionOperations.java
+++ b/src/main/java/net/helenus/core/AbstractSessionOperations.java
@@ -15,7 +15,6 @@
*/
package net.helenus.core;
-import brave.Tracer;
import com.codahale.metrics.MetricRegistry;
import com.datastax.driver.core.*;
import com.google.common.base.Stopwatch;
@@ -25,7 +24,6 @@ import java.io.PrintStream;
import java.util.List;
import java.util.concurrent.Executor;
import net.helenus.core.cache.Facet;
-import net.helenus.core.operation.Operation;
import net.helenus.mapping.value.ColumnValuePreparer;
import net.helenus.mapping.value.ColumnValueProvider;
import net.helenus.support.Either;
@@ -43,6 +41,8 @@ public abstract class AbstractSessionOperations {
public abstract boolean isShowCql();
+ public abstract boolean showValues();
+
public abstract PrintStream getPrintStream();
public abstract Executor getExecutor();
@@ -59,7 +59,6 @@ public abstract class AbstractSessionOperations {
public PreparedStatement prepare(RegularStatement statement) {
try {
- logStatement(statement, false);
return currentSession().prepare(statement);
} catch (RuntimeException e) {
throw translateException(e);
@@ -68,64 +67,48 @@ public abstract class AbstractSessionOperations {
public ListenableFuture prepareAsync(RegularStatement statement) {
try {
- logStatement(statement, false);
return currentSession().prepareAsync(statement);
} catch (RuntimeException e) {
throw translateException(e);
}
}
- public ResultSet execute(Statement statement, boolean showValues) {
- return execute(statement, null, null, showValues);
+ public ResultSet execute(Statement statement) {
+ return execute(statement, null, null);
}
- public ResultSet execute(Statement statement, Stopwatch timer, boolean showValues) {
- return execute(statement, null, timer, showValues);
+ public ResultSet execute(Statement statement, Stopwatch timer) {
+ return execute(statement, null, timer);
}
- public ResultSet execute(Statement statement, UnitOfWork uow, boolean showValues) {
- return execute(statement, uow, null, showValues);
+ public ResultSet execute(Statement statement, UnitOfWork uow) {
+ return execute(statement, uow, null);
}
- public ResultSet execute(
- Statement statement, UnitOfWork uow, Stopwatch timer, boolean showValues) {
- return executeAsync(statement, uow, timer, showValues).getUninterruptibly();
+ public ResultSet execute(Statement statement, UnitOfWork uow, Stopwatch timer) {
+ return executeAsync(statement, uow, timer).getUninterruptibly();
}
- public ResultSetFuture executeAsync(Statement statement, boolean showValues) {
- return executeAsync(statement, null, null, showValues);
+ public ResultSetFuture executeAsync(Statement statement) {
+ return executeAsync(statement, null, null);
}
- public ResultSetFuture executeAsync(Statement statement, Stopwatch timer, boolean showValues) {
- return executeAsync(statement, null, timer, showValues);
+ public ResultSetFuture executeAsync(Statement statement, Stopwatch timer) {
+ return executeAsync(statement, null, timer);
}
- public ResultSetFuture executeAsync(Statement statement, UnitOfWork uow, boolean showValues) {
- return executeAsync(statement, uow, null, showValues);
+ public ResultSetFuture executeAsync(Statement statement, UnitOfWork uow) {
+ return executeAsync(statement, uow, null);
}
- public ResultSetFuture executeAsync(
- Statement statement, UnitOfWork uow, Stopwatch timer, boolean showValues) {
+ public ResultSetFuture executeAsync(Statement statement, UnitOfWork uow, Stopwatch timer) {
try {
- logStatement(statement, showValues);
return currentSession().executeAsync(statement);
} catch (RuntimeException e) {
throw translateException(e);
}
}
- private void logStatement(Statement statement, boolean showValues) {
- if (isShowCql()) {
- printCql(Operation.queryString(statement, showValues));
- } else if (LOG.isDebugEnabled()) {
- LOG.info("CQL> " + Operation.queryString(statement, showValues));
- }
- }
-
- public Tracer getZipkinTracer() {
- return null;
- }
-
public MetricRegistry getMetricRegistry() {
return null;
}
@@ -145,9 +128,5 @@ public abstract class AbstractSessionOperations {
public void updateCache(Object pojo, List facets) {}
- void printCql(String cql) {
- getPrintStream().println(cql);
- }
-
public void cacheEvict(List facets) {}
}
diff --git a/src/main/java/net/helenus/core/AbstractUnitOfWork.java b/src/main/java/net/helenus/core/AbstractUnitOfWork.java
deleted file mode 100644
index f658956..0000000
--- a/src/main/java/net/helenus/core/AbstractUnitOfWork.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright (C) 2015 The Helenus Authors
- *
- * 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.helenus.core;
-
-import static net.helenus.core.HelenusSession.deleted;
-
-import com.diffplug.common.base.Errors;
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.HashBasedTable;
-import com.google.common.collect.Table;
-import com.google.common.collect.TreeTraverser;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import net.helenus.core.cache.CacheUtil;
-import net.helenus.core.cache.Facet;
-import net.helenus.support.Either;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** Encapsulates the concept of a "transaction" as a unit-of-work. */
-public abstract class AbstractUnitOfWork
- implements UnitOfWork, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractUnitOfWork.class);
-
- private final List> nested = new ArrayList<>();
- private final HelenusSession session;
- private final AbstractUnitOfWork parent;
- private final Table>> cache = HashBasedTable.create();
- protected String purpose;
- protected List nestedPurposes = new ArrayList();
- protected String info;
- protected int cacheHits = 0;
- protected int cacheMisses = 0;
- protected int databaseLookups = 0;
- protected Stopwatch elapsedTime;
- protected Map databaseTime = new HashMap<>();
- protected double cacheLookupTime = 0.0;
- private List postCommit = new ArrayList();
- private boolean aborted = false;
- private boolean committed = false;
-
- protected AbstractUnitOfWork(HelenusSession session, AbstractUnitOfWork parent) {
- Objects.requireNonNull(session, "containing session cannot be null");
-
- this.session = session;
- this.parent = parent;
- }
-
- @Override
- public void addDatabaseTime(String name, Stopwatch amount) {
- Double time = databaseTime.get(name);
- if (time == null) {
- databaseTime.put(name, (double) amount.elapsed(TimeUnit.MICROSECONDS));
- } else {
- databaseTime.put(name, time + amount.elapsed(TimeUnit.MICROSECONDS));
- }
- }
-
- @Override
- public void addCacheLookupTime(Stopwatch amount) {
- cacheLookupTime += amount.elapsed(TimeUnit.MICROSECONDS);
- }
-
- @Override
- public void addNestedUnitOfWork(UnitOfWork uow) {
- synchronized (nested) {
- nested.add((AbstractUnitOfWork) uow);
- }
- }
-
- @Override
- public synchronized UnitOfWork begin() {
- if (LOG.isInfoEnabled()) {
- elapsedTime = Stopwatch.createStarted();
- }
- // log.record(txn::start)
- return this;
- }
-
- @Override
- public String getPurpose() {
- return purpose;
- }
-
- @Override
- public UnitOfWork setPurpose(String purpose) {
- this.purpose = purpose;
- return this;
- }
-
- @Override
- public void setInfo(String info) {
- this.info = info;
- }
-
- @Override
- public void recordCacheAndDatabaseOperationCount(int cache, int ops) {
- if (cache > 0) {
- cacheHits += cache;
- } else {
- cacheMisses += Math.abs(cache);
- }
- if (ops > 0) {
- databaseLookups += ops;
- }
- }
-
- public String logTimers(String what) {
- double e = (double) elapsedTime.elapsed(TimeUnit.MICROSECONDS) / 1000.0;
- double d = 0.0;
- double c = cacheLookupTime / 1000.0;
- double fc = (c / e) * 100.0;
- String database = "";
- if (databaseTime.size() > 0) {
- List dbt = new ArrayList<>(databaseTime.size());
- for (Map.Entry dt : databaseTime.entrySet()) {
- double t = dt.getValue() / 1000.0;
- d += t;
- dbt.add(String.format("%s took %,.3fms %,2.2f%%", dt.getKey(), t, (t / e) * 100.0));
- }
- double fd = (d / e) * 100.0;
- database =
- String.format(
- ", %d quer%s (%,.3fms %,2.2f%% - %s)",
- databaseLookups, (databaseLookups > 1) ? "ies" : "y", d, fd, String.join(", ", dbt));
- }
- String cache = "";
- if (cacheLookupTime > 0) {
- int cacheLookups = cacheHits + cacheMisses;
- cache =
- String.format(
- " with %d cache lookup%s (%,.3fms %,2.2f%% - %,d hit, %,d miss)",
- cacheLookups, cacheLookups > 1 ? "s" : "", c, fc, cacheHits, cacheMisses);
- }
- String da = "";
- if (databaseTime.size() > 0 || cacheLookupTime > 0) {
- double dat = d + c;
- double daf = (dat / e) * 100;
- da =
- String.format(
- " consuming %,.3fms for data access, or %,2.2f%% of total UOW time.", dat, daf);
- }
- String x = nestedPurposes.stream().distinct().collect(Collectors.joining(", "));
- String n =
- nested
- .stream()
- .map(uow -> String.valueOf(uow.hashCode()))
- .collect(Collectors.joining(", "));
- String s =
- String.format(
- Locale.US,
- "UOW(%s%s) %s in %,.3fms%s%s%s%s%s%s",
- hashCode(),
- (nested.size() > 0 ? ", [" + n + "]" : ""),
- what,
- e,
- cache,
- database,
- da,
- (purpose == null ? "" : " " + purpose),
- (nestedPurposes.isEmpty()) ? "" : ", " + x,
- (info == null) ? "" : " " + info);
- return s;
- }
-
- private void applyPostCommitFunctions() {
- if (!postCommit.isEmpty()) {
- for (CommitThunk f : postCommit) {
- f.apply();
- }
- }
- if (LOG.isInfoEnabled()) {
- LOG.info(logTimers("committed"));
- }
- }
-
- @Override
- public Optional