NoSQL Zone is brought to you in partnership with:

Don Pinto is a Product Marketing Manager with experience in cloud and database technologies. Don is a DZone MVB and is not an employee of DZone and has posted 91 posts at DZone. You can read more from them at their website. View Full User Profile

Couchbase Java SDK 2.0.0 Beta 1

08.26.2014
| 3073 views |
  • submit to reddit

Originally written by Michael Nitschinger

On behalf of the whole SDK team I'm happy to announce the first beta release of the Java/JVM SDK release train nicknamed Armstrong. It contains both the JVM core package "core-io" 1.0.0-beta as well as the Java SDK 2.0.0-beta.

This beta release marks a milestone in that we're now locking down the API, only breaking them if absolutely necessary before the GA release. Also, we are releasing the first batch of documentation, which can be found here and also API docs which you can find here.

This blog covers the new-for-beta highlights.  For a more conversational introduction to what's new in 2.0 in general, have a look at my blogs on the earlier developer preview releases: DP1, DP2, DP3 and the blog on Why Couchbase Chose RxJava.

Here is how you can get it:

<dependencies>
    <dependency>
        <groupId>com.couchbase.client</groupId>
        <artifactId>couchbase-client</artifactId>
        <version>2.0.0-beta</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>couchbase</id>
        <name>couchbase repo</name>
        <url>http://files.couchbase.com/maven2</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
</repositories>

Lots of APIs have been added, bugs have been ironed out and other components have been simplified. Here are the highlights:

Cluster-Level Management APIs

APIs have been added to allow the creation, deletion and retrieval of bucket information:

// Create the cluster reference
Cluster cluster = CouchbaseCluster.create();

// Connect the Cluster Manager
ClusterManager manager = cluster.clusterManager("Administrator", "password").toBlocking().single();

// Lists all configured buckets with their settings.
Observable<BucketSettings> buckets = manager.getBuckets();

// Removes the beer-sample bucket
Observable<Boolean> success = manager.removeBucket("beer-sample");

// Creates a new bucket
Observable<BucketSettings> inserted = manager.insertBucket(DefaultBucketSettings
    .builder()
    .name("mybucket")
    .quota(512)
    .password("password")
    .enableFlush(true)
    .build());

Bucket-Level Management APIs

In additon to cluster-level APIs, also bucket level information can now be retrieved:

// Create the cluster reference
Cluster cluster = CouchbaseCluster.create();
// Open the bucket
Bucket bucket = cluster.openBucket().toBlocking().single();

// Open the bucket manager
BucketManager manager = bucket.bucketManager().toBlocking().single();

// Flush the bucket
Observable<Boolean> flush = manager.flush();

// Grab info
BucketInfo info = manager.info().toBlocking().single();

Simplified Environment

The Environment API has been simplified and the properties, which were exposed in dp3 have been collapsed into the Environment itself. Customizing it now got even simpler:

// No more properties needed
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
    .queryEnabled(true)
    .build();

Cluster cluster = CouchbaseCluster.create(env);

Next Steps

This release brings us very close to a GA release in the next weeks. We are now shifting all focus onto stability and documentation, hopefully making this the best database SDK on the JVM out there. Please kick the tires on this beta release as much as you can, report any issues so we can resolve them in a timely manner.

Published at DZone with permission of Don Pinto, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)