|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.basho.riak.pbc.mapreduce.MapReduceBuilder
public class MapReduceBuilder
Builds a map/reduce job description and submits it Uses the same chained method metaphor as StringBuilder or StringBuffer
Constructor Summary | |
---|---|
MapReduceBuilder()
|
|
MapReduceBuilder(RiakClient riak)
|
Method Summary | |
---|---|
void |
addRiakObject(String bucket,
String key)
Adds a Riak object (bucket name/key pair) to the map/reduce job as inputs |
void |
clearRiakObjects()
Remove all Riak objects from the input list |
String |
getBucket()
Gets the name of the Riak bucket the map/reduce job will process |
RiakClient |
getRiakClient()
The RiakClient to which this map reduce job will be submitted to
when submit() is called. |
Map<String,Set<String>> |
getRiakObjects()
Returns a copy of the Riak objects on the input list for a map/reduce job |
String |
getSearch()
Gets the search query the map/reduce job will process |
int |
getTimeout()
Gets the currently assigned timeout |
MapReduceBuilder |
link(String bucket,
boolean keep)
Adds a link phase to the job |
MapReduceBuilder |
link(String bucket,
String tag,
boolean keep)
Adds a link phase to the job |
MapReduceBuilder |
map(MapReduceFunction function,
boolean keep)
Adds a map phase to the job |
MapReduceBuilder |
map(MapReduceFunction function,
Object arg,
boolean keep)
Adds a map phase to the job |
MapReduceBuilder |
reduce(MapReduceFunction function,
boolean keep)
Adds a reduce phase to the job |
MapReduceBuilder |
reduce(MapReduceFunction function,
Object arg,
boolean keep)
Adds a reduce phase to the job |
void |
removeRiakObject(String bucket,
String key)
Removes a Riak object (bucket name/key pair) for the job's input list |
MapReduceBuilder |
setBucket(String newBucket)
Sets the name of the Riak bucket the map/reduce job will process |
MapReduceBuilder |
setRiakClient(RiakClient client)
|
MapReduceBuilder |
setRiakObjects(Collection<RiakObject> objects)
|
MapReduceBuilder |
setRiakObjects(Map<String,Set<String>> objects)
Sets a collection of Riak object (bucket name/key pair) as the map/reduce job as inputs |
MapReduceBuilder |
setSearch(String search)
Sets the name of the Riak bucket that will be searched and the query that will be executed |
void |
setTimeout(int timeout)
How long the map/reduce job is allowed to execute Time is in milliseconds |
MapReduceResponseSource |
submit()
|
MapReduceResponseSource |
submit(IRequestMeta meta)
Submits the job to the Riak server |
JSONObject |
toJSON()
Builds the JSON representation of a map/reduce job |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapReduceBuilder(RiakClient riak)
riak
- RiakClient instance which is pointing to the map/reduce URLpublic MapReduceBuilder()
Method Detail |
---|
public RiakClient getRiakClient()
RiakClient
to which this map reduce job will be submitted to
when submit()
is called.
public MapReduceBuilder setRiakClient(RiakClient client)
public String getBucket()
public MapReduceBuilder setBucket(String newBucket)
IllegalStateException
- - If objects have already been added to the jobpublic String getSearch()
public MapReduceBuilder setSearch(String search)
IllegalStateException
- - If objects or bucket has already been addedpublic void addRiakObject(String bucket, String key)
IllegalStateException
- - If a bucket name has already been set on the jobpublic void removeRiakObject(String bucket, String key)
public Map<String,Set<String>> getRiakObjects()
public MapReduceBuilder setRiakObjects(Map<String,Set<String>> objects)
IllegalStateException
- - If a bucket name has already been set on the jobpublic MapReduceBuilder setRiakObjects(Collection<RiakObject> objects)
public void clearRiakObjects()
public void setTimeout(int timeout)
public int getTimeout()
public MapReduceBuilder map(MapReduceFunction function, boolean keep)
function
- function to run for the phasekeep
- should the server keep and return the results
public MapReduceBuilder map(MapReduceFunction function, Object arg, boolean keep)
function
- function to run for the phasearg
- Static argument to pass to the function. Should be an
object easily converted to JSONkeep
- should the server keep and return the results
public MapReduceBuilder reduce(MapReduceFunction function, boolean keep)
function
- function to run for the phasekeep
- should the server keep and return the results
public MapReduceBuilder reduce(MapReduceFunction function, Object arg, boolean keep)
function
- function to run for the phasearg
- Static argument to pass to the function. Should be an
object easily converted to JSONkeep
- should the server keep and return the results
public MapReduceBuilder link(String bucket, boolean keep)
bucket
- bucket to link walkkeep
- should the server keep and return the results
public MapReduceBuilder link(String bucket, String tag, boolean keep)
bucket
- bucket to link walktag
- link tag to matchkeep
- should the server keep and return the results
public MapReduceResponseSource submit(IRequestMeta meta) throws IOException
meta
- Extra metadata to attach to the request such as HTTP headers
or query parameters.
MapReduceResponse
containing job results
IOException
IllegalStateException
- If this job has not been associated with a Riak instance by
calling setRiakClient(RiakClient)
RiakIORuntimeException
- If an error occurs during communication with the Riak server.
RiakResponseRuntimeException
- If the Riak server returns a malformed response.public MapReduceResponseSource submit() throws JSONException, IOException
JSONException
IOException
public JSONObject toJSON()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |