#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Mechanical::UK::Job::RunMechanicals;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use Common::RSApp;

use lib '/app/tools/rps/lib';
use RPS::Config;

use lib '/app/tools/job/lib';
use Job::Job;

use base 'RPS::Mechanical::UK::Job::Base';

sub _generateCommandLine {
    my ($self) = @_;

    my $runID = $self->getCommandLineArg('runID');
    assert($runID);

    my $clientID = $self->clientID();
    assert($clientID);

    my $logLevel = $self->getCommandLineArg('logLevel');
    $logLevel = 1 unless $logLevel;

    # !!! Use the 'config' system to get the path to the royalty scripts.
    #
    my $rpsConfig  = RPS::Config->new();
    my $scriptPath = $rpsConfig->get('royalty_script_dir');

    # !!! Note that this is a linux-only command line.
    # !!! If we end up wanting to run these on windows <shudder>, we'd have
    # !!! to create a 'Win32' subclass and override this method.
    # !!! Actually, we'd need to create a 'linux' subclass as well.
    #
    my $commandLine = "nice $scriptPath/run_uk_mechanicals.pl -c $clientID -r $runID -V $logLevel";

    return $commandLine;
}

sub _defaultClass { return 'RunController'; }

sub _defaultSubclass {
    return 'UKMechanicals';
}

sub _defaultLogFile {
    my ($self) = @_;

    return 'run_controller';
}

###
1;    #
###

