public class TableAPIExample extends Object
See the package documentation
for instructions on
how to build and run these examples. They require a running store that
has had some required tables and indexes created. The usage for this
program is as follows:
java table.TableAPIExample [-store <instance name>] \ [-host <host name>] \ [-port <port number>] \ [-example <all | example_to_run>]By default all examples are run. Multiple examples can be run using the -example flag multiple times.
All examples use the default store, host, and port of kvstore, localhost, and 5000. These are the defaults for KVLite as well.
Constructor and Description |
---|
TableAPIExample(String[] argv)
Parses command line args and opens the KVStore.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Runs the TableAPIExample command line program.
|
(package private) void |
runExample1()
Example 1: Hello World!
This example shows a simple use of tables, it uses a simple table
holding an id field as a primary key and 2 fields -- name and surname --
as Strings.
|
(package private) void |
runExample2()
Example 2: Secondary Index
This example uses 2 indexes on the table "simpleUsers." One is a
simple, single-field index on "firstName" and the other is a
composite index on "lastName, firstName".
|
(package private) void |
runExample3()
Example 3: Shard keys
This example uses a table that has a composite primary key and
a defined shard key.
|
(package private) void |
runExample4()
Example 4: Parent and Child tables
This example demonstrates use of parent and child tables.
|
(package private) void |
runExample5()
Example 5: Complex fields
This example demonstrates how to create, populate and read complex
fields (Array, Map, Record) in a table.
|
(package private) void |
runExample6()
Example 6: Secondary index on array
This example demonstrates use of a secondary index on an array.
|
(package private) void |
runExample7()
Example 7: Evolve Table
This example requires use of the evolve_table.kvs script to help
demonstrate how to handle schema evolution of a table.
|
(package private) void |
runExample8()
Example 8: R2 compatibility example
This example uses a table created using an avro schema and a table
with r2 compatibility enabled.
|
(package private) void |
runExample9()
Example 9: Primary key table
This example shows how all the fields in a table can be assigned
as part of the primary key as a key-only table.
|
TableAPIExample(String[] argv)
public static void main(String[] args)
void runExample1()
void runExample2()
void runExample3()
void runExample4()
void runExample5()
void runExample6()
void runExample7()
void runExample8()
void runExample9()
Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.