Spring Data Key-Value

org.springframework.data.keyvalue.riak.groovy
Class RiakBuilder

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.util.BuilderSupport
          extended by org.springframework.data.keyvalue.riak.groovy.RiakBuilder
All Implemented Interfaces:
groovy.lang.GroovyObject

public class RiakBuilder
extends groovy.util.BuilderSupport

A Groovy Builder that implements a powerful and syntactically succinct DSL for Riak datastore access using SDKV for Riak's AsyncRiakTemplate.

The DSL responds to most of the important methods from the AsyncRiakTemplate:

An example of DSL usage (to delete all entries in a bucket):

riak.foreach(bucket: "test") {
   completed { v, meta ->
     delete(bucket: "test", key: meta.key)
   }
 }
 

Author:
J. Brisbin <[email protected]>

Field Summary
protected  String defaultBucketName
           
protected  org.apache.commons.logging.Log log
           
protected  List<Object> results
           
protected  AsyncRiakTemplate riak
           
protected  ExecutorService workerPool
           
 
Constructor Summary
RiakBuilder()
           
RiakBuilder(AsyncRiakTemplate riak)
           
RiakBuilder(AsyncRiakTemplate riak, ExecutorService workerPool)
           
RiakBuilder(groovy.util.BuilderSupport proxyBuilder, AsyncRiakTemplate riak)
           
RiakBuilder(groovy.lang.Closure nameMappingClosure, groovy.util.BuilderSupport proxyBuilder, AsyncRiakTemplate riak)
           
 
Method Summary
protected  RiakMapReduceOperation createMapReduceJob()
           
protected  Object createNode(Object name)
           
protected  Object createNode(Object name, Map attributes)
           
protected  Object createNode(Object name, Map attributes, Object value)
           
protected  Object createNode(Object name, Object value)
           
 AsyncRiakTemplate getAsyncTemplate()
           
 ExecutorService getWorkerPool()
           
 Object invokeMethod(String methodName, Object arg)
           
protected  void nodeCompleted(Object parent, Object node)
           
protected  Object postNodeCompletion(Object parent, Object node)
           
 void setAsyncTemplate(AsyncRiakTemplate riak)
           
protected  void setParent(Object parent, Object child)
           
 void setWorkerPool(ExecutorService workerPool)
           
 
Methods inherited from class groovy.util.BuilderSupport
doInvokeMethod, getCurrent, getName, invokeMethod, setClosureDelegate, setCurrent
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

riak

protected AsyncRiakTemplate riak

workerPool

protected ExecutorService workerPool

defaultBucketName

protected String defaultBucketName

results

protected List<Object> results
Constructor Detail

RiakBuilder

public RiakBuilder()

RiakBuilder

public RiakBuilder(AsyncRiakTemplate riak)

RiakBuilder

public RiakBuilder(AsyncRiakTemplate riak,
                   ExecutorService workerPool)

RiakBuilder

public RiakBuilder(groovy.util.BuilderSupport proxyBuilder,
                   AsyncRiakTemplate riak)

RiakBuilder

public RiakBuilder(groovy.lang.Closure nameMappingClosure,
                   groovy.util.BuilderSupport proxyBuilder,
                   AsyncRiakTemplate riak)
Method Detail

getAsyncTemplate

public AsyncRiakTemplate getAsyncTemplate()

setAsyncTemplate

public void setAsyncTemplate(AsyncRiakTemplate riak)

getWorkerPool

public ExecutorService getWorkerPool()

setWorkerPool

public void setWorkerPool(ExecutorService workerPool)

setParent

protected void setParent(Object parent,
                         Object child)
Specified by:
setParent in class groovy.util.BuilderSupport

createNode

protected Object createNode(Object name)
Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected Object createNode(Object name,
                            Object value)
Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected Object createNode(Object name,
                            Map attributes)
Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected Object createNode(Object name,
                            Map attributes,
                            Object value)
Specified by:
createNode in class groovy.util.BuilderSupport

invokeMethod

public Object invokeMethod(String methodName,
                           Object arg)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class groovy.util.BuilderSupport

nodeCompleted

protected void nodeCompleted(Object parent,
                             Object node)
Overrides:
nodeCompleted in class groovy.util.BuilderSupport

postNodeCompletion

protected Object postNodeCompletion(Object parent,
                                    Object node)
Overrides:
postNodeCompletion in class groovy.util.BuilderSupport

createMapReduceJob

protected RiakMapReduceOperation createMapReduceJob()

Spring Data Key-Value

Copyright © 2010-2011 SpringSource. All Rights Reserved.