NAME

Bric::Dist::Job - Manages Bricolage distribution jobs.

VERSION

$Revision: 1.1.1.1.2.2 $

DATE

$Date: 2001/11/06 23:18:34 $

SYNOPSIS

use Bric::Dist::Job;

my $id = 1;
my $format = "%D %T";

# Constructors.
my $job = Bric::Dist::Job->new($init);
$job = Bric::Dist::Job->lookup({ id => $id });
my @jobs = Bric::Dist::Job->list($params);

# Class Methods.
my @job_ids = Bric::Dist::Job->list_ids($params);

# Instance Methods
my $id = $job->get_id;

my $type = $job->get_type;
$job = $job->set_type($type);

my $sched_time = $job->get_sched_time($format);
$job = $job->set_sched_time($sched_time);
my $comp_time = $job->get_comp_timeget_comp_time($format);

my @resources = $job->get_resources;
my @resource_ids = $job->get_resource_ids;
$job = $job->set_resource_ids(@resource_ids);

my @server_types = $job->get_server_types;
my @server_type_ids = $job->get_server_type_ids;
$job = $job->set_server_type_ids(@server_type_ids);

# Save the job.
$job = $job->save;

# Cancel the job.
$job = $job->cancel;

# Execute the job.
$job = $job->execute_me;

DESCRIPTION

This class manages distribution jobs. A job is a list of things to be transformed by actions and moved out, all at a scheduled time. The idea is that Bricolage will schedule a job and then it will be executed at its scheduled times. There are two types of jobs, "Deliver" and "Expire".

INTERFACE

Constructors

my $job = Bric::Dist::Job->new($init)

Instantiates a Bric::Dist::Job object. An anonymous hash of initial values may be passed. The supported initial value keys are:

Either the resources, resource_names, or resource_ids anonymous array is must be passed in, as must either sever_types, server_type_names, or server_type_ids.

Throws:

Side Effects: NONE.

Notes: NONE.

my $job = Bric::Dist::Job->lookup({ id => $id })

Looks up and instantiates a new Bric::Dist::Job object based on the Bric::Dist::Job object ID passed. If $id is not found in the database, lookup() returns undef.

Throws:

Side Effects: If $id is found, populates the new Bric::Dist::Job object with data from the database before returning it.

Notes: NONE.

my (@jobs || $jobs_aref) = Bric::Dist::Job->list($params)

Returns a list or anonymous array of Bric::Dist::Job objects based on the search parameters passed via an anonymous hash. The supported lookup keys are:

Throws:

Side Effects: Populates each Bric::Dist::Job object with data from the database before returning them all.

Notes: NONE.

Destructors

$job->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Class Methods

my (@job_ids || $job_ids_aref) = Bric::Dist::Job->list_ids($params)

Returns a list or anonymous array of Bric::Dist::Job object IDs based on the search criteria passed via an anonymous hash. The supported lookup keys are the same as those for list().

Throws:

Side Effects: NONE.

Notes: NONE.

$meths = Bric::Dist::ServerType >my_meths
(@meths || $meths_aref) = Bric::Dist::ServerType->my_meths(TRUE)

Returns an anonymous hash of instrospection data for this object. If called with a true argument, it will return an ordered list or anonymous array of intrspection data. The format for each introspection item introspection is as follows:

Each hash key is the name of a property or attribute of the object. The value for a hash key is another anonymous hash containing the following keys:

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Instance Methods

my $id = $job->get_id

Returns the ID of the Bric::Dist::Job object.

Throws:

*

Bad AUTOLOAD method format.

*

Cannot AUTOLOAD private methods.

*

Access denied: READ access for field 'id' required.

*

No AUTOLOAD method.

Side Effects: NONE.

Notes: If the Bric::Dist::Job object has been instantiated via the new() constructor and has not yet been saved, the object will not yet have an ID, so this method call will return undef.

my $name = $job->get_name

Returns the name of the Bric::Dist::Job object.

Throws:

*

Bad AUTOLOAD method format.

*

Cannot AUTOLOAD private methods.

*

Access denied: READ access for field 'name' required.

*

No AUTOLOAD method.

Side Effects: NONE.

Notes: NONE.

$self = $st->set_name($name)

Sets the server type name.

Throws:

Side Effects: NONE.

Notes: NONE.

my $user_id = $job->get_user_id

Returns the user_id of the Bric::Dist::Job object.

Throws:

*

Bad AUTOLOAD method format.

*

Cannot AUTOLOAD private methods.

*

Access denied: READ access for field 'user_id' required.

*

No AUTOLOAD method.

Side Effects: NONE.

Notes: NONE.

$self = $st->set_user_id($user_id)

Sets the server type user_id.

Throws:

Side Effects: NONE.

Notes: NONE.

my $sched_time = $job->get_sched_time($format)

Returns the time at which the job is scheduled to execute. Pass in a strftime format string to get the time back in that format.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $job->set_sched_time($sched_time)

Sets the time at which the job is to be executed. This method will not set the scheduled time and will return undef if the job has already been completed.

Throws:

Side Effects: NONE.

Notes: NONE.

my $comp_time = $job->get_comp_time($format)

Returns the time at which the job was completed. Returns undef if the job has not yet been completed. Pass in a strftime format string to get the time back in that format.

Throws:

Side Effects: NONE.

Notes: NONE.

my $tries = $foo->get_tries

Returns the number of times the job attempted to be executed.

Throws:

Side Effects: NONE.

Notes: NONE.

my (@resources || $resources_aref) = $job->get_resources
my (@resources || $resources_aref) = $job->get_resources(@resource_ids)

Returns a list or anonymous array of the Bric::Dist::Resource objects that represent the directories and/or files on which this job acts.

Throws:

PRIVATE

Private Class Methods

NONE.

Private Instance Methods

NONE.

Private Functions

my $_aref = &$get_em( $pkg, $params )
my $_ids_aref = &$get_em( $pkg, $params, 1 )

Function used by lookup() and list() to return a list of Bric::Dist::Job objects or, if called with an optional third argument, returns a listof Bric::Dist::Job object IDs (used by list_ids()).

Throws:

Side Effects: NONE.

Notes: NONE.

my $coll = &$get_coll($self, $class, $key)

Returns the collection for this job. Pass in the $job object itself, the property key for storing the collection, and the name of the collection class. The collection is a Bric::Util::Coll object. See Bric::Util::Coll for interface details.

Throws:

*

Bric::_get() - Problems retrieving fields.

*

Unable to prepare SQL statement.

*

Unable to connect to database.

*

Unable to select column into arrayref.

*

Unable to execute SQL statement.

*

Unable to bind to columns to statement handle.

*

Unable to fetch row from statement handle.

*

Incorrect number of args to Bric::_set().

*

Bric::set() - Problems setting fields.

Side Effects: NONE.

Notes: NONE.

my $bool = &$set_pend($self, $value)

Sets the pending column in the database, as well as the pending property in the job object. Used by execute().

Throws:

*

Unable to connect to database.

*

Unable to prepare SQL statement.

*

Unable to execute SQL statement.

*

Incorrect number of args to Bric::_set().

*

Bric::set() - Problems setting fields.

Side Effects: NONE.

Notes: NONE.

NOTES

NONE.

AUTHOR

David Wheeler <david@wheeler.net>

SEE ALSO

perl(1), Bric (2), Bric::Dist::Resource(3), Bric::Dist::ServerType(4)

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 391:

=back doesn't take any parameters, but you said =back 4

Around line 547:

Expected '=item *'

Around line 549:

Expected '=item *'

Around line 551:

Expected '=item *'

Around line 553:

Expected '=item *'

Around line 555:

Expected '=item *'

Around line 557:

Expected '=item *'

Around line 559:

Expected '=item *'

Around line 718:

'=item' outside of any '=over'

Around line 747:

'=item' outside of any '=over'

Around line 806:

'=item' outside of any '=over'

Around line 1049:

Expected '=item *'

Around line 1100:

Expected '=item *'

Around line 1174:

Expected '=item *'

Around line 1176:

Expected '=item *'

Around line 1235:

Expected '=item *'

Around line 1286:

Expected '=item *'

Around line 1360:

Expected '=item *'

Around line 1385:

Expected '=item *'

Around line 1436:

Expected '=item *'

Around line 1538:

Expected '=item *'

Around line 1675:

=back doesn't take any parameters, but you said =back 4

Around line 1677:

You forgot a '=back' before '=head1'

Around line 1868:

'=item' outside of any '=over'

Around line 1923:

=back without =over