diff --git a/.travis-oss-settings.xml b/.travis-oss-settings.xml deleted file mode 100644 index 3c424e3..0000000 --- a/.travis-oss-settings.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - sonatype-nexus-snapshots - ${env.OSS_USERNAME} - ${env.OSS_PASSWORD} - - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c3c0829..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: java -script: mvn deploy --settings .travis-oss-settings.xml -jdk: -- oraclejdk8 -env: - global: - - OSS_USERNAME=3Lzxrh8k - - secure: U8xjxbMSNTEhJZLQMRiGT4LP1wsUqczlPRO68J5Yo9VG15SKGIDV6xfAcnhNEVUUL47Ubwkmzk2JO+tKgqsXM9O9KgXEAmEV4mdoBP48OFw85u+nUrbbKGDHd2sA9tBjvu0meqxffdIge7f3nNLEmzJHke5ru+yo2204EvSZYHc= diff --git a/README.md b/README.md index ad29db1..25f9eda 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -# helenus -Fast and easy, functional style cutting edge Java 8 and Scala 2.11 Cassandra client +# Helenus +Fast and easy, functional style cutting edge Java 8 and Scala 2.11 Cassandra client for C* 3.x -Current status: First application in production (may be more) ### Features @@ -14,11 +13,11 @@ Current status: First application in production (may be more) ### Requirements -* Latest JVM 8 -* Latest Datastax Driver 2.1.5 -* Latest Cassandra 2.1.4 -* Latest Scala 2.11 -* Latest Maven as well +* JVM 8 +* Datastax Driver 3.x +* Cassandra 3.x +* Scala 2.11+ +* Maven ### Maven @@ -59,7 +58,7 @@ Active development dependency for Scala 2.11: Model definition: ``` -@Table("timelines") +@Table public interface Timeline { @PartitionKey @@ -77,14 +76,14 @@ public interface Timeline { Session initialization: ``` -Timeline timeline = Helenus.dsl(Timeline.class); HelenusSession session = Helenus.init(getSession()).showCql().add(Timeline.class).autoCreateDrop().get(); +Timeline timeline = Helenus.dsl(Timeline.class, session.getMetadata()); ``` Select example: ``` session.select(timeline::userId, timeline::timestamp, timeline::text) - .where(timeline::userId, Query.eq(userId)) + .where(timeline::userId, eq(userId)) .orderBy(Query.desc(timeline::timestamp)).limit(5).sync() .forEach(System.out::println); ``` @@ -104,18 +103,12 @@ Account model: ``` @Table public interface Account { - @PartitionKey String accountId(); - Date createdAt(); - String organization(); - String team(); - String timezone(); - Map users(); } ``` @@ -124,22 +117,16 @@ AccountUser model: ``` @UDT public interface AccountUser { - String email(); - String firstName(); - String lastName(); - } ``` Abstract repository: ``` public interface AbstractRepository { - HelenusSession session(); - } ``` @@ -150,32 +137,29 @@ import scala.concurrent.Future; public interface AccountRepository extends AbstractRepository { static final Account account = Helenus.dsl(Account.class); - static final String DEFAULT_TIMEZONE = "America/Los_Angeles"; - default Future> findAccount(String accountId) { - + return session() .select(Account.class) .where(account::accountId, eq(accountId)) .single() .future(); - } - + default Future> createAccount( String email, AccountUser user, String organization, String team, String timezone) { - + String accountId = AccountId.next(); if (timezone == null || timezone.isEmpty()) { timezone = DEFAULT_TIMEZONE; } - + return session() .insert() .value(account::accountId, accountId) @@ -185,36 +169,36 @@ public interface AccountRepository extends AbstractRepository { .value(account::timezone, timezone) .value(account::users, ImmutableMap.of(email, user)) .future(accountId); - + } - + default Future putAccountUser(String accountId, String email, AccountUser user) { - + return session() .update() .put(account::users, email.toLowerCase(), user) .where(account::accountId, eq(accountId)) .future(); - + } - + default Future removeAccountUser(String accountId, String email) { - + return session() .update() .put(account::users, email.toLowerCase(), null) .where(account::accountId, eq(accountId)) .future(); - + } - + default Future dropAccount(String accountId) { - + return session() .delete() .where(account::accountId, eq(accountId)) .future(); - + } } diff --git a/pom.xml b/pom.xml index 0566104..c3b1361 100644 --- a/pom.xml +++ b/pom.xml @@ -22,13 +22,13 @@ https://github.net.helenus - scm:git:git@github.com:gburd/helenus.git - scm:git:git@github.com:gburd/helenus.git + scm:git:git@github.com:onshape/helenus.git + scm:git:git@github.com:onshape/helenus.git GitHub - https://github.com/gburd/helenus/issues + https://github.com/onshape/helenus/issues