Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 74 lines (63 sloc) 2.11 KB
#!/bin/bash
#
# Copyright 2010 The Apache Software Foundation
#
# 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.
#
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
HBASE_HOME=/usr/local/hbase/current
# add sculptor.jar to HBase classpath
for jar in $bin/sculptor-*.jar
do
HBASE_CLASSPATH=$HBASE_CLASSPATH:$jar
done
# add user defined libraries
if [ -z "$SCULPTOR_AUXLIB_PATH" ]; then
auxlib_path=$bin/auxlib
else
auxlib_path=$SCULPTOR_AUXLIB_PATH
fi
for jar in $auxlib_path/*.jar
do
HBASE_CLASSPATH=$HBASE_CLASSPATH:$jar
done
export HBASE_CLASSPATH=$HBASE_CLASSPATH
function init_and_run_sample()
{
# create sample sc_item_data table
echo "Creating sample table in HBase..."
echo "create 'sc_item_data', {NAME => 'data', VERSIONS => '1'}, {NAME => 'meta', VERSIONS => '1'}" | $HBASE_HOME/bin/hbase shell
echo ""
echo "Created sample table: sc_item_data"
# load data into the table
echo "Loading test data into sample table..."
$HBASE_HOME/bin/hbase sculptor.sample.HItemDataTest loaddata $bin/sample/test/data/sc_item_data.tsv
# start sculptor
${HBASE_HOME}/bin/hbase org.jruby.Main ${bin}/framework/ruby/sculptor.rb
}
## main routine
case $1 in
-e )
${HBASE_HOME}/bin/hbase org.jruby.Main ${bin}/framework/ruby/sculptor.rb $2
;;
sample )
init_and_run_sample
;;
* )
${HBASE_HOME}/bin/hbase org.jruby.Main ${bin}/framework/ruby/sculptor.rb
esac