#!/bin/bash
source $(cd `dirname $0`; pwd)/common
parameterSize=1

if [ $# = 0 ]
then
	echo "指定数据库元数据降级（由 MMF 版本降级为 json 版本）工具需要参数："
	echo "1. 数据库目录，一般是跟 cube 同名的目录。"
else
    needStopServer   #需要停止服务才能使用该工具
    if [ $? = 1 ]
    then
	    if [ $# != $parameterSize ]
	    then
	    	echo "参数个数不对。"
	    else
	        java -classpath "$basePath/$version/lib/*:." kd.bos.olap.repairTools.OlapServerToolsMain -allowRunWithDatabase:true -function:singleDatabaseDowngradeMetadata -functionParameters:$(getAbsolutePath $1)
		fi
	fi
fi