UpdateJSON.run()

The UpdateJSON.run() method parses our command line arguments, sets up and opens our KVStore handle, and then calls each of the methods that provide individual steps in this example.

Notice that there are three different updateTable... methods. Each provides the same functionality as the next, but reads are performed in different ways. Once data is loaded into the table, they can be run independently of the others. The only other dependency is that UpdateJSON.createIndex() must be run before UpdateJSON.updateTableWithIndex() is run.

    private void run(String args[]) {
        parseArgs(args);

        KVStoreConfig kconfig = 
            new KVStoreConfig(storeName, 
                              helperhosts);
        KVStore kvstore = KVStoreFactory.getStore(kconfig);

        defineTable(kvstore);
        loadTable(kvstore, dataFile);
        displayTable(kvstore);
        updateTableWithoutQuery(kvstore);
        createIndex(kvstore);
        updateTableWithIndex(kvstore);
        updateTableUsingSQLQuery(kvstore);
        displayTable(kvstore);
    }