org.apache.accumulo.examples.simple.client
Class RandomBatchWriter

java.lang.Object
  extended by org.apache.accumulo.examples.simple.client.RandomBatchWriter

public class RandomBatchWriter
extends Object

Simple example for writing random data to Accumulo. See docs/examples/README.batch for instructions. The rows of the entries will be randomly generated numbers between a specified min and max (prefixed by "row_"). The column families will be "foo" and column qualifiers will be "1". The values will be random byte arrays of a specified size.


Constructor Summary
RandomBatchWriter()
           
 
Method Summary
static Mutation createMutation(long rowid, int dataSize, ColumnVisibility visibility)
          Creates a mutation on a specified row with column family "foo", column qualifier "1", specified visibility, and a random value of specified size.
static byte[] createValue(long rowid, int dataSize)
          Creates a random byte array of specified size using the specified seed.
static void main(String[] args)
          Writes a specified number of entries to Accumulo using a BatchWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomBatchWriter

public RandomBatchWriter()
Method Detail

createValue

public static byte[] createValue(long rowid,
                                 int dataSize)
Creates a random byte array of specified size using the specified seed.

Parameters:
rowid - the seed to use for the random number generator
dataSize - the size of the array
Returns:
a random byte array

createMutation

public static Mutation createMutation(long rowid,
                                      int dataSize,
                                      ColumnVisibility visibility)
Creates a mutation on a specified row with column family "foo", column qualifier "1", specified visibility, and a random value of specified size.

Parameters:
rowid - the row of the mutation
dataSize - the size of the random value
visibility - the visibility of the entry to insert
Returns:
a mutation

main

public static void main(String[] args)
                 throws AccumuloException,
                        AccumuloSecurityException,
                        TableNotFoundException
Writes a specified number of entries to Accumulo using a BatchWriter.

Throws:
AccumuloException
AccumuloSecurityException
TableNotFoundException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.