Previous Next JavaScript must be enabled to correctly display this content

## Building `CountTableRows` When the Store is Secure

This section explains how to compile all of the Java classes that should be included in the build. If you will be running `CountTableRows` against a secure store like that deployed in the Deploying a Secure Store appendix, in addition to including the `CountTableRows` program, the build also needs to include security credential files as well as the `KVSecurityCreation` program and `KVSecurityUtil` class used to perform various security related functions when executing `CountTableRows`.

To compile the `KVSecurityCreation` and `KVSecurityUtil` classes needed to run the secure version of `CountTableRows`, type the following at the command line:

    cd /opt/oracle/nosql/apps/kv

    javac -classpath \
        /opt/oracle/kv-ee/lib/kvstore.jar:examples \
        examples/hadoop/table/KVSecurityCreation.java

    javac -classpath \
        /opt/oracle/kv-ee/lib/kvstore.jar:examples \
        examples/hadoop/table/KVSecurityUtil.java

Once `KVSecurityCreation` and `KVSecurityUtil` have been compiled, `CountTableRows` itself can be compiled in the same way as that shown in the previous section; that is,

    javac -classpath \
        /opt/cloudera/parcels/CDH/jars/commons-logging-1.1.3.jar: \
        /opt/cloudera/parcels/CDH/jars/
            hadoop-common-3.0.0-cdh6.3.0.jar: \
        /opt/cloudera/parcels/CDH/jars/ \
            hadoop-mapreduce-client-core-3.0.0-cdh6.3.0.jar: \
        /opt/cloudera/parcels/CDH/jars/ \
            hadoop-annotations-3.0.0-cdh6.3.0.jar: \
        /opt/cloudera/parcels/CDH/jars/ \
            hadoop-yarn-api-3.0.0-cdh6.3.0.jar: \
        /opt/oracle/kv-ee/lib/kvclient.jar:examples \
            examples/hadoop/table/CountTableRows.java

The command lines above will produce the following class files:

    /opt/oracle/nosql/apps/kv/examples/hadoop/table/
        CountTableRows.class
        CountTableRows$Map.class
        CountTableRows$Reduce.class
        KVSecurityUtil.class
        KVSecurityCreation.class

Unlike the non-secure case, the build artifacts needed to deploy `CountTableRows` in a secure environment include more than just a single JAR file containing the generated class files. For the secure case, it is necessary to package some artifacts for deployment to the client side of the application that communicates with the store, whereas other artifacts will need to be packaged for deployment to the server side of the application.

Although there are different ways to achieve this "separation of concerns" when deploying a given application, the Model For Building & Packaging Secure Clients appendix of this document presents one particular model you can use to package and deploy the artifacts for applications that will interact with a secure store. With this in mind, the sections in this document related to executing `CountTableRows` against a secure store each assume that the application has been built and packaged according to the instructions presented in the Model For Building & Packaging Secure Clients appendix.