Title: Apache Accumulo Classpath Example
Notice:    Licensed to the Apache Software Foundation (ASF) under one
           or more contributor license agreements.  See the NOTICE file
           distributed with this work for additional information
           regarding copyright ownership.  The ASF licenses this file
           to you under the Apache License, Version 2.0 (the
           "License"); you may not use this file except in compliance
           with the License.  You may obtain a copy of the License at
           .
             http://www.apache.org/licenses/LICENSE-2.0
           .
           Unless required by applicable law or agreed to in writing,
           software distributed under the License is distributed on an
           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
           KIND, either express or implied.  See the License for the
           specific language governing permissions and limitations
           under the License.


This example shows how to use per table classpaths. The example leverages a
test jar which contains a Filter that supresses rows containing "foo". The
example shows copying the FooFilter.jar into HDFS and then making an Accumulo
table reference that jar.


Execute the following command in the shell.

    $ hadoop fs -copyFromLocal $ACCUMULO_HOME/test/src/test/resources/FooFilter.jar /user1/lib

Execute following in Accumulo shell to setup classpath context

    root@test15> config -s general.vfs.context.classpath.cx1=hdfs://<namenode host>:<namenode port>/user1/lib/[^.].*.jar

Create a table

    root@test15> createtable nofoo

The following command makes this table use the configured classpath context

    root@test15 nofoo> config -t nofoo -s table.classpath.context=cx1

The following command configures an iterator thats in FooFilter.jar

    root@test15 nofoo> setiter -n foofilter -p 10 -scan -minc -majc -class org.apache.accumulo.test.FooFilter
    Filter accepts or rejects each Key/Value pair
    ----------> set FooFilter parameter negate, default false keeps k/v that pass accept method, true rejects k/v that pass accept method: false

The commands below show the filter is working.

    root@test15 nofoo> insert foo1 f1 q1 v1
    root@test15 nofoo> insert noo1 f1 q1 v2
    root@test15 nofoo> scan
    noo1 f1:q1 []    v2
    root@test15 nofoo>

Below, an attempt is made to add the FooFilter to a table thats not configured
to use the clasppath context cx1. This fails util the table is configured to
use cx1.

    root@test15 nofoo> createtable nofootwo
    root@test15 nofootwo> setiter -n foofilter -p 10 -scan -minc -majc -class org.apache.accumulo.test.FooFilter
    2013-05-03 12:49:35,943 [shell.Shell] ERROR: java.lang.IllegalArgumentException: org.apache.accumulo.test.FooFilter
    root@test15 nofootwo> config -t nofootwo -s table.classpath.context=cx1
    root@test15 nofootwo> setiter -n foofilter -p 10 -scan -minc -majc -class org.apache.accumulo.test.FooFilter
    Filter accepts or rejects each Key/Value pair
    ----------> set FooFilter parameter negate, default false keeps k/v that pass accept method, true rejects k/v that pass accept method: false


