@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. :: :: $Id$ :: ----------------------------------------------------------------------------- :: Xindice @VERSION@ Command Line Tool Win32/Win16 Script :: ----------------------------------------------------------------------------- if not "%OS%"=="Windows_NT" goto start @setlocal :start :: ----- Verify and Set Required Environment Variables ------------------------- if not "%JAVA_HOME%" == "" goto gotJavaHome echo ERROR: You must set JAVA_HOME to point at your Java echo Development Kit installation. goto end :gotJavaHome set _XINDICE_HOME=%XINDICE_HOME% if not "%_XINDICE_HOME%" == "" goto gotXindiceHome :: ----- Use the location of this script set _XINDICE_HOME=%~dp0.. if not exist "%_XINDICE_HOME%\xindice-1*.jar" goto noXindiceHome goto gotXindiceHome :noXindiceHome echo ERROR: You must set XINDICE_HOME to point at your echo Xindice installation directory. goto end :gotXindiceHome set _XINDICE_DB_HOME=%XINDICE_DB_HOME% if "%_XINDICE_DB_HOME%" == "" set _XINDICE_DB_HOME=%_XINDICE_HOME% set _XINDICE_CONFIG=%XINDICE_CONFIG% if "%_XINDICE_CONFIG%" == "" set _XINDICE_CONFIG=%_XINDICE_HOME%\config\system.xml set _LOGGER=%LOGGER% if "%_LOGGER%" == "" set _LOGGER=org.apache.commons.logging.impl.SimpleLog set _LOGLEVEL=%LOGLEVEL% if "%_LOGLEVEL%" == "" set _LOGLEVEL=INFO set _JAVACMD=%JAVACMD% if "%_JAVACMD%" == "" set _JAVACMD="%JAVA_HOME%\bin\java" :: ----- Set Up The Classpath -------------------------------------------------- set LOCALCLASSPATH= for %%i in ("%_XINDICE_HOME%\lib\endorsed\*.jar") do call "%_XINDICE_HOME%\bin\lcp.bat" %%i for %%i in ("%_XINDICE_HOME%\lib\*.jar") do call "%_XINDICE_HOME%\bin\lcp.bat" %%i for %%i in ("%_XINDICE_HOME%\xindice*.jar") do call "%_XINDICE_HOME%\bin\lcp.bat" %%i :: ----- Check Command Line Arguments ------------------------------------------ :runXindice echo %LOCALCLASSPATH% set _LOCAL_BACKUP="%2.backup" :: ----- Check for backup command line switch ---------------------------------- if "%3" == "-backup" ( goto checkdir ) else ( goto setcommandline ) :checkdir echo Checking local backup %_LOCAL_BACKUP% if exist %_LOCAL_BACKUP% goto backup-error xcopy /E %2 %LOCAL_BACKUP% :setcommandline set _CL= :LOOP if .%1.==.. goto DONE set _CL=%_CL% %1 shift goto LOOP :DONE if not exist %_XINDICE_HOME%\logs mkdir %_XINDICE_HOME%\logs :: ----- Start Command Line Tool ----------------------------------------------- %_JAVACMD% -Xms16m -Xmx128m -Dorg.apache.commons.logging.Log=%_LOGGER% -Dorg.apache.commons.logging.simplelog.defaultlog=%_LOGLEVEL% -cp %LOCALCLASSPATH% org.apache.xindice.tools.DatabaseRebuild %_CL% 2>>"%_XINDICE_HOME%"\logs\rebuild.log goto end ::------ BACKUP ALREADY EXISTS ------------------------------------------------- :backup-error echo "Cannot back up a database. %_LOCAL_BACKUP% already exists" :: ----- End ------------------------------------------------------------------- :end if not "%OS%"=="Windows_NT" goto win16 @endlocal goto mainEnd :win16 set _LOCAL_BACKUP= set _XINDICE_HOME= set _XINDICE_DB_HOME= set _XINDICE_CONFIG= set _LOGGER= set _LOGLEVEL= set _JAVACMD= set _CL= set LOCALCLASSPATH= :mainEnd