#!/bin/ksh93
#
# $Id$
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2006-2010 Sun Microsystems, Inc.
# Portions Copyright 2011 ForgeRock AS
# Portions Copyright 2013 Jens Elkner
# This script is used to invoke various server-side processes. It should not
# be invoked directly by end users.
[[ ${FNTRACE} == 'ALL' || ${FNTRACE} == 'main' ]] && set -x
INSTALL_ROOT="${.sh.file%/*/*}"
CHECK=''
typeset -a MISC_ARGS=( )
if [[ -z ${OPENDJ_INVOKE_CLASS} || -z ${SCRIPT_NAME} ]]; then
OIC=''
SCRIPT_NAME=${.sh.file##*/}
case "$SCRIPT_NAME" in
dbtest) #link
# debug JE backends in the Directory Server
OIC='org.opends.server.tools.DBTest'
CHECK='-i'
;;
dsreplication) #link
# perform some replication specific operations
OIC='org.opends.server.tools.dsreplication.ReplicationCliMain'
if [[ ${RECURSIVE_LOCAL_CALL} != 'true' ]]; then
SCRIPT_ARGS+=' -Dorg.opends.server.dsreplicationcallstatus=firstcall'
else
SCRIPT_NAME='dsreplication.offline'
SCRIPT_ARGS=${SCRIPT_ARGS//-Dorg.opends.server.dsreplicationcallstatus=firstcall}
fi
;;
encode-password) #link
# encode clear-text passwords or verify whether a given clear-text
# password matches a provided encoded password
OIC='org.opends.server.tools.EncodePassword'
;;
ldif-diff) #link
# compare the contents of two LDIF files
OIC='org.opends.server.tools.LDIFDiff'
;;
ldifmodify) #link
# alter the contents of an LDIF file
OIC='org.opends.server.tools.LDIFModify'
;;
ldifsearch) #link
# perform searches in an LDIF file
OIC='org.opends.server.tools.LDIFSearch'
;;
list-backends) #link
# perform a restore of a Directory Server backend
OIC='org.opends.server.tools.ListBackends'
CHECK='-i'
;;
make-ldif) #link
# generate LDIF data based on a provided template
#NO_CHECK=1
MISC_ARGS+=( '--resourcePath' "${INSTANCE_ROOT}/config/MakeLDIF" )
OIC='org.opends.server.tools.makeldif.MakeLDIF'
;;
rebuild-index) #link
# rebuild the contents of a Directory Server backend storing its
# data in the Berkeley DB Java Edition
OIC='org.opends.server.tools.RebuildIndex'
;;
upgrade)
OIC='org.opends.server.tools.upgrade.UpgradeCli'
INSTALL_ROOT="${.sh.file%/*}"
CHECK='-i'
;;
verify-index) #link
# perform validation on the contents of a Directory Server backend
# storing its data in the Berkeley DB Java Edition
OIC='org.opends.server.tools.VerifyIndex'
CHECK='-i'
;;
esac
OPENDJ_INVOKE_CLASS=${OIC}
fi
if [[ -z ${OPENDJ_INVOKE_CLASS} ]]; then
print -u2 'ERROR: OPENDJ_INVOKE_CLASS environment variable is not set.'
exit 1
fi
# Set environment variables
. "${INSTALL_ROOT}/lib/_script-util.sh"
checkEnv ${CHECK} 'set-full-environment' "$@"
# Launch the appropriate server utility.
"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} \
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
${OPENDJ_INVOKE_CLASS} \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${INSTANCE_ROOT}"/config/config.ldif "${MISC_ARGS[@]}" "$@"