#!/bin/bash

# IBM Confidential
# OCO Source Materials
# 5724-V51
#
# © Copyright IBM Corp. 2000, 2008 All Rights Reserved.
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.

# This shell script is to print messages in user locale for wpcprof.sh
# Since there are many env variables exported by wpcprof.sh to the parent shell script, the entire shell script cannot be run through LocalizedShellScriptRunner
# Hence, we have this piece of code which would pick messages from the user locale message bundle
# Note: Known problem: The parameters passed to the message is not recognized. Need to find a fix.
# However, as an interim solution, I've rephrased the messages to a generic form such that we dont need to pass any parameters!


COMMAND="$1"
TMP_PARAMS="$2 $3 $4 $5 $6"
PARAMS=`echo $TMP_PARAMS | sed 's/--locale.*//g'`

function printProfilerInfoProfilingEnabledForServicesh()
{
   ${ECHO} PROFILER_INFO_PROFILING_ENABLED_FOR_SERVICE_SH "$PARAMS"
}

function printProfilingAlreadyEnabledForServicesh()
{
   ${ECHO} PROFILER_INFO_PROFILING_ALREADY_ENABLED_FOR_SERVICE_SH "$PARAMS"
}

function printProfilerInfoProfilingAlreadyDisabledForServicesh()
{
   ${ECHO} PROFILER_INFO_PROFILING_ALREADY_DISABLED_FOR_SERVICE_SH $PARAMS
}

function printProfilerInfoRestartTheServiceToTakeAffectsh()
{
   ${ECHO} PROFILER_INFO_RESTART_THE_SERVICE_TO_TAKE_AFFECT_SH "$PARAMS"
}
function printProfilerInfoDoYouWantToRestartNowsh()
{
   ${ECHO} -n PROFILER_INFO_DO_YOU_WANT_TO_RESTART_NOW_SH "$PARAMS"
}

function printProfilerErrorServicetypeParameterIsMissingsh()
{
   ${ECHO} PROFILER_ERROR_SERVICETYPE_PARAMETER_IS_MISSING_SH "$PARAMS"
}

function printProfilerInfoProfilerNotSupportedsh()
{
   ${ECHO} PROFILER_INFO_PROFILER_NOT_SUPPORTED_SH "$PARAMS"
}

function printProfilerInfoProfilerLibrariesMissingNextStepssh()
{
   ${ECHO} PROFILER_INFO_PROFILER_LIBRARIES_MISSING_NEXT_STEPS_SH
}
	
function printProfilerInfoInvalidServiceTypesh()
{
   ${ECHO} PROFILER_INFO_INVALID_SERVICE_TYPE_SH
}
	
case "$COMMAND" in
    "PROFILER_INFO_PROFILING_ENABLED_FOR_SERVICE_SH")
    printProfilerInfoProfilingEnabledForServicesh
    ;;
    "PROFILINGDISABLED")
    printProfilingDisabled
    ;;
    "PROFILER_INFO_PROFILING_ALREADY_ENABLED_FOR_SERVICE_SH")
    printProfilingAlreadyEnabledForServicesh
    ;;
    "PROFILER_INFO_PROFILING_ALREADY_DISABLED_FOR_SERVICE_SH")
    printProfilerInfoProfilingAlreadyDisabledForServicesh
    ;;
    "PROFILER_INFO_RESTART_THE_SERVICE_TO_TAKE_AFFECT_SH")
    printProfilerInfoRestartTheServiceToTakeAffectsh
    ;;
    "PROFILER_INFO_DO_YOU_WANT_TO_RESTART_NOW_SH")
    printProfilerInfoDoYouWantToRestartNowsh
    ;;
    "PROFILER_ERROR_SERVICETYPE_PARAMETER_IS_MISSING_SH")
    printProfilerErrorServicetypeParameterIsMissingsh
    ;;
    "PROFILER_INFO_PROFILER_NOT_SUPPORTED_SH")
    printProfilerInfoProfilerNotSupportedsh
    ;;
    "PROFILER_INFO_PROFILER_LIBRARIES_MISSING_NEXT_STEPS_SH")
    printProfilerInfoProfilerLibrariesMissingNextStepssh
    ;;
    "PROFILER_INFO_INVALID_SERVICE_TYPE_SH")
    printProfilerInfoInvalidServiceTypesh
    ;;
esac
