-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create bin scripts for Linux, Windows and Mac
- Loading branch information
Showing
10 changed files
with
409 additions
and
22 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2011 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. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# This is sourced in by bin/replicadb to set environment variables prior to | ||
# invoking ReplicaDB.jar. | ||
# ----------------------------------------------------------------------------- | ||
|
||
bin="$1" | ||
|
||
if [ -z "${bin}" ]; then | ||
bin=`dirname $0` | ||
bin=`cd ${bin} && pwd` | ||
fi | ||
|
||
if [ -z "$REPLICADB_HOME" ]; then | ||
export REPLICADB_HOME=${bin}/.. | ||
fi | ||
|
||
REPLICADB_CONF_DIR=${REPLICADB_CONF_DIR:-${REPLICADB_HOME}/conf} | ||
|
||
# Where to find the main ReplicaDB jar | ||
REPLICADB_JAR_DIR=${REPLICADB_HOME} | ||
|
||
function add_to_classpath() { | ||
dir=$1 | ||
for f in ${dir}/*.jar; do | ||
REPLICADB_CLASSPATH=${REPLICADB_CLASSPATH}:${f}; | ||
done | ||
|
||
export REPLICADB_CLASSPATH | ||
} | ||
|
||
# Add replicadb dependencies to classpath. | ||
REPLICADB_CLASSPATH="" | ||
if [ -d "$REPLICADB_HOME/lib" ]; then | ||
add_to_classpath ${REPLICADB_HOME}/lib | ||
fi | ||
|
||
|
||
REPLICADB_CLASSPATH=${REPLICADB_CONF_DIR}:${REPLICADB_CLASSPATH} | ||
|
||
add_to_classpath ${REPLICADB_JAR_DIR} | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Set JAVA_HOME or JRE_HOME if not already set | ||
# ----------------------------------------------------------------------------- | ||
|
||
|
||
# Make sure prerequisite environment variables are set | ||
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then | ||
if $darwin; then | ||
# Bugzilla 54390 | ||
if [ -x '/usr/libexec/java_home' ] ; then | ||
JAVA_HOME=`/usr/libexec/java_home` | ||
# Bugzilla 37284 (reviewed). | ||
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | ||
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" | ||
fi | ||
else | ||
JAVA_PATH=`which java 2>/dev/null` | ||
if [ "x$JAVA_PATH" != "x" ]; then | ||
JAVA_PATH=`dirname ${JAVA_PATH} 2>/dev/null` | ||
JRE_HOME=`dirname ${JAVA_PATH} 2>/dev/null` | ||
fi | ||
if [ "x$JRE_HOME" = "x" ]; then | ||
# XXX: Should we try other locations? | ||
if [ -x /usr/bin/java ]; then | ||
JRE_HOME=/usr | ||
fi | ||
fi | ||
fi | ||
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then | ||
echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined" | ||
echo "At least one of these environment variable is needed to run this program" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [ -z "$JRE_HOME" ]; then | ||
JRE_HOME="$JAVA_HOME" | ||
fi | ||
|
||
# Set standard commands for invoking Java, if not already set. | ||
if [ -z "$_RUNJAVA" ]; then | ||
_RUNJAVA="$JRE_HOME"/bin/java | ||
fi | ||
|
||
export JAVA_HOME | ||
export JAVA_PATH | ||
export JRE_HOME | ||
export _RUNJAVA | ||
|
||
export REPLICADB_CLASSPATH | ||
export REPLICADB_CONF_DIR | ||
export REPLICADB_JAR_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
:: 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. | ||
|
||
if not exist %bin% ( | ||
echo Error: Environment variable bin not defined. | ||
echo This is generally because this script should not be invoked directly. Use replicadb instead. | ||
exit /b 1 | ||
) | ||
|
||
if not defined REPLICADB_HOME ( | ||
set REPLICADB_HOME=%bin%\.. | ||
) | ||
|
||
if not defined REPLICADB_CONF_DIR ( | ||
set REPLICADB_CONF_DIR=%REPLICADB_HOME%\conf | ||
) | ||
|
||
:: Add replicadb dependencies to classpath | ||
set REPLICADB_CLASSPATH= | ||
|
||
:: Where to find the main Sqoop jar | ||
set REPLICADB_JAR_DIR=%REPLICADB_HOME% | ||
call :add_dir_to_classpath %REPLICADB_JAR_DIR% | ||
|
||
if exist "%REPLICADB_HOME%\lib" ( | ||
call :add_dir_to_classpath %REPLICADB_HOME%\lib | ||
) | ||
|
||
call :add_dir_to_classpath %REPLICADB_CONF_DIR% | ||
|
||
:: ----------------------------------------------------------------------------- | ||
:: Set JAVA_HOME or JRE_HOME if not already set | ||
:: ----------------------------------------------------------------------------- | ||
|
||
:: Make sure prerequisite environment variables are set | ||
if not "%JRE_HOME%" == "" goto gotJreHome | ||
if not "%JAVA_HOME%" == "" goto gotJavaHome | ||
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined | ||
echo At least one of these environment variable is needed to run this program | ||
goto exit | ||
|
||
:gotJavaHome | ||
:: No JRE given, use JAVA_HOME as JRE_HOME | ||
set "JRE_HOME=%JAVA_HOME%" | ||
|
||
:gotJreHome | ||
:: Check if we have a usable JRE | ||
if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome | ||
goto okJava | ||
|
||
:noJreHome | ||
rem Needed at least a JRE | ||
echo The JRE_HOME environment variable is not defined correctly | ||
echo This environment variable is needed to run this program | ||
goto exit | ||
|
||
:okJava | ||
:: Don't override _RUNJAVA if the user has set it previously | ||
if not "%_RUNJAVA%" == "" goto gotRunJava | ||
:: Set standard command for invoking Java. | ||
:: Also note the quoting as JRE_HOME may contain spaces. | ||
set _RUNJAVA="%JRE_HOME%\bin\java.exe" | ||
:gotRunJava | ||
|
||
goto :eof | ||
|
||
|
||
:: ----------------------------------------------------------------------------- | ||
:: Function to add the given directory to the list of classpath directories | ||
:: All jars under the given directory are added to the classpath | ||
:: ----------------------------------------------------------------------------- | ||
:add_dir_to_classpath | ||
if not "%1"=="" ( | ||
set REPLICADB_CLASSPATH=!REPLICADB_CLASSPATH!;%1\* | ||
) | ||
goto :eof | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2011 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. | ||
|
||
|
||
follow_one() { | ||
# Resolve symlinks and relative path components along a path. This requires | ||
# its argument to be an absolute path. This does not recursively re-resolve | ||
# symlinks; if that is required, use the 'follow' method. | ||
|
||
target=$1 | ||
OIFS=$IFS | ||
IFS='/' | ||
|
||
# Taking each dir component along the way, build up a new target directory, | ||
# resolving '.', '..', and symlinks. | ||
newtarget='' | ||
for part in ${target}; do | ||
if [ -z "${part}" ]; then | ||
continue # Empty dir part. 'foo//bar' | ||
elif [ "." == "${part}" ]; then | ||
continue # Nothing special to do for '.' | ||
elif [ ".." == "${part}" ]; then | ||
IFS=$OIFS | ||
newtarget=`dirname ${newtarget}` # pop a component. | ||
elif [ -h "${newtarget}/${part}" ]; then | ||
IFS=$OIFS | ||
link=`readlink ${newtarget}/${part}` | ||
# links can be relative or absolute. Relative ones get appended to | ||
# newtarget; absolute ones replace it. | ||
if [ "${link:0:1}" != "/" ]; then | ||
newtarget="${newtarget}/${link}" # relative | ||
else | ||
newtarget="${link}" # absolute | ||
fi | ||
else # Regular file component. | ||
newtarget="${newtarget}/${part}" | ||
fi | ||
IFS='/' | ||
done | ||
|
||
IFS=$OIFS | ||
echo $newtarget | ||
} | ||
|
||
follow() { | ||
# Portable 'readlink -f' function to follow a file's links to the final | ||
# target. Calls follow_one recursively til we're finished tracing symlinks. | ||
|
||
target=$1 | ||
depth=$2 | ||
|
||
if [ -z "$depth" ]; then | ||
depth=0 | ||
elif [ "$depth" == "1000" ]; then | ||
# Don't recurse indefinitely; we've probably hit a symlink cycle. | ||
# Just bail out here. | ||
echo $target | ||
return 1 | ||
fi | ||
|
||
# Canonicalize the target to be an absolute path. | ||
targetdir=`dirname ${target}` | ||
targetdir=`cd ${targetdir} && pwd` | ||
target=${targetdir}/`basename ${target}` | ||
|
||
# Use follow_one to resolve links. Test that we get the same result twice, | ||
# to terminate iteration. | ||
first=`follow_one ${target}` | ||
second=`follow_one ${first}` | ||
if [ "${first}" == "${second}" ]; then | ||
# We're done. | ||
echo "${second}" | ||
else | ||
# Need to continue resolving links. | ||
echo `follow ${second} $(( $depth + 1 ))` | ||
fi | ||
} | ||
|
||
prgm=`follow $0` | ||
bin=`dirname ${prgm}` | ||
bin=`cd ${bin} && pwd` | ||
|
||
source ${bin}/configure-replicadb "${bin}" | ||
exec ${_RUNJAVA} -cp ${REPLICADB_CLASSPATH} org.replicadb.ReplicaDB "$@" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@echo off | ||
:: 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. | ||
|
||
setlocal enabledelayedexpansion | ||
|
||
set prgm=%~f0 | ||
set bin=%~dp0 | ||
if "%bin:~-1%" == "\" ( | ||
set bin=%bin:~0,-1% | ||
) | ||
|
||
call "%bin%\configure-replicadb.cmd" "%bin%" | ||
|
||
:: echo _RUNJAVA "%_RUNJAVA%" | ||
:: echo REPLICADB_CLASSPATH "%REPLICADB_CLASSPATH%" | ||
|
||
call %_RUNJAVA% -cp %REPLICADB_CLASSPATH% -Dfile.encoding=UTF-8 org.replicadb.ReplicaDB %* | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
############################# ReplicadB Basics ############################# | ||
# Always complete; incremental is not yet supported | ||
mode=complete | ||
|
||
# integer greater than 0 | ||
jobs=1 | ||
############################# Soruce Options ############################# | ||
|
||
source.connect= | ||
source.user= | ||
source.password= | ||
source.table= | ||
source.where= | ||
# or | ||
source.query= | ||
|
||
# Not jet available | ||
#source.check-column= | ||
#source.last-value= | ||
|
||
############################# Sink Options ############################# | ||
|
||
sink.connect= | ||
sink.user= | ||
sink.password= | ||
sink.table= | ||
sink.columns= | ||
|
||
# Booleans; default are false | ||
#sink.disable.escape=false | ||
|
||
# Not jet available | ||
#sink.disable.index=false | ||
#sink.analyze=false | ||
|
||
############################# Other ############################# | ||
|
||
# Boolean; default is false | ||
verbose=false |
Oops, something went wrong.