class UpgradeRestService {

    @POST
    @Path( "/proxy/restart/{upgradeId}" )
    public Response restartProxy( @PathParam( "upgradeId" ) String upgradeId )
        throws HMSRestException
    {

        if ( StringUtils.isNotBlank( upgradeId ) )
        {
            String upgradeBaseDir = HmsConfigHolder.getHMSConfigProperty( Constants.HMS_UPGRADE_DIR );
            String scriptLocation =
                upgradeBaseDir + Constants.FILE_SEPERATOR + upgradeId + Constants.FILE_SEPERATOR + RESTART_PROXY_SCRIPT;
            logger.debug( "starts executing the script: {}", scriptLocation );

            List<String> cmdWithArgs = new ArrayList<String>();
            cmdWithArgs.add( 0, scriptLocation );

            int exitCode = ProcessUtil.executeCommand( cmdWithArgs );
            if ( exitCode != 0 )
            {
                logger.error( "unsuccessful on executing the script, exit value {}", exitCode );
                throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(),
                                            "unsuccessful on executing the script", "exit code: " + exitCode );
            }
            logger.debug( "successfully completed executing the script: {}", scriptLocation );

        }
        else
        {
            logger.error( "upgrade token can't be blank" );
            throw new HMSRestException( Status.BAD_REQUEST.getStatusCode(), "upgrade token is blank",
                                        "Invalid input provided" );
        }

        BaseResponse baseResponse = HmsGenericUtil.getBaseResponse( Status.ACCEPTED, "restart proxy initiated." );
        return Response.accepted().entity( baseResponse ).build();
    }

}