NAME

Bric::Dist::ServerType - Interface for managing types of servers to which to distribute content.

VERSION

$Revision: 1.6.2.1 $

DATE

$Date: 2002/03/01 03:49:53 $

SYNOPSIS

use Bric::Dist::ServerType;

# Constructors.
# Create a new object.
my $st = Bric::Dist::ServerType->new;
# Look up an existing object.
$st = Bric::Dist::ServerType->lookup({ id => 1 });
# Get a list of server type objects.
my @servers = Bric::Dist::ServerType->list(
  { move_method => 'FTP Transport' });
# Get an anonymous hash of server type objects.
my $sts_href = Bric::Dist::ServerType->href({ description => 'Preview%' });

# Class methods.
# Get a list of object IDs.
my @st_ids = Bric::Dist::ServerType->list_ids({ description => 'Preview%' });
# Get an introspection hashref.
my $int = Bric::Dist::ServerType->my_meths;
# Get a list of mover types.
my @move_methods = Bric::Dist::ServerType->list_move_methods;

# Instance Methods.
my $id = $st->get_id;
my $name = $st->get_name;
$st = $st->set_name($name);
my $description = $st->get_description;
$st = $st->set_description($description);
my $move_method = $st->get_move_method;
$st = $st->set_move_method($move_method);

print "ST is ", $st->can_copy ? '' : 'not ', "copyable.\n";
$st->copy;
$st->no_copy;

print "ST ", $st->can_publish ? 'publishes' : 'does not publish.\n";
$st = $st->on_publish; # Used for publish event.
$st = $st->no_publish; # Not used for publish event.

print "ST ", $st->can_preview ? 'previews' : 'does not preview.\n";
$st = $st->on_preview; # Used for preview event.
$st = $st->no_preview; # Not used for preview event.

print "ST is ", $st->is_active ? '' : 'not ', "active.\n";
$st->deactivate;
$st->activate;

# Accessors to servers of this type.
my @servers = $st->get_servers;
my $server = $st->new_server;
$st->del_servers;

# Accessors to output channels associated with this server type.
my @ocs = $job->get_output_channels;
$st = $st->add_output_channels(@ocs);
$st = $st->del_output_channels(@ocs);

# Accessors to actions associated with this type.
my @actions = $st->get_actions;
my $action = $st->new_action;
$st->del_actions;

# Save it.
$st->save;

DESCRIPTION

This class manages types of servers. A server type represents a class of servers on which a list of actions should be performed upon the execution of a job. A server type, therefore, simply describes a list of servers for which the actions will be performed and a list of actions to be executed on the files associated with a given job. The last action should be a move statement, to move each file to each of the servers.

So use this class a the central management point for figuring out what happens to files, and in what order, and what servers they are sent to, in the event of a publish or preview event.

INTERFACE

Constructors

my $st = Bric::Dist::ServerType->new($init)

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

The active property will be set to true and the copy property to false by default. Call $st->save() to save the new object.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

my $st = Bric::Dist::ServerType->lookup({ id => $id })
my $st = Bric::Dist::ServerType->lookup({ name => $name })

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

Throws:

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

Notes: NONE.

my (@sts || $sts_aref) = Bric::Dist::ServerType->list($params)

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

Throws:

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

Notes: NONE.

my $sts_href = Bric::Dist::ServerType->href($params)

Returns an anonymous hash of Bric::Dist::ServerType objects, where the keys are object IDs and the values or the objects themselves, based on the search parameters passed via an anonymous hash. The supported lookup keys are are the same as for list().

Throws:

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

Notes: NONE.

Destructors

$st->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Class Methods

my (@st_ids || $st_ids_aref) = Bric::Dist::ServerType->list_ids($params)

Returns a list or anonymous array of Bric::Dist::ServerType 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.

my (@types || $types_aref) = Bric::Dist::ServerType->list_move_methods

Returns a list or anonymous array of the names of classes that feature a method to move resources.

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 = $st->get_id

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

Throws:

Side Effects: NONE.

Notes: If the Bric::Dist::ServerType 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 = $st->get_name

Returns the server type name.

Throws:

Side Effects: NONE.

Notes: NONE.

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

Sets the server type name. The name must be unique.

Throws:

Side Effects: NONE.

Notes: NONE.

my $description = $st->get_description

Returns the server type description.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $st->set_description($description)

Sets the server type description.

Throws:

Side Effects: NONE.

Notes: NONE.

my $move_method = $st->get_move_method

Returns the display name of the Bricolage class responible for moving resources to servers of this type.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $st->set_move_method($move_method)

Sets the name of the class responible for moving resources to servers of this type. Get a list of supporte mover types from list_move_methods().

Throws:

Side Effects: NONE.

Notes: NONE.

my (@ocs || $ocs_aref) = $job->get_output_channels
my (@ocs || $ocs_aref) = $job->get_output_channels(@oc_ids)

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

Throws:

PRIVATE

Private Class Methods

NONE.

Private Instance Methods

my $mover_class = $st->_get_mover_class()

Returns the Class (package) name of the class used to move resources. Used by Bric::Dist::Action::Mover so that it knows who to tell to do the moving.

Throws:

Side Effects: If the move method has been changed via set_move_method() since the current object was instantiated, this method will return the old package name rather than the new one. To get the new one, instantiate the object but don't change its method. If you really want to change it, do so, save it, and then re-instantiate it via Bric::Dist::ServerType->lookup().

Notes: NONE>

Private Functions

my $st_aref = &$get_em( $pkg, $params )
my $st_ids_aref = &$get_em( $pkg, $params, 1 )

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

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

Throws:

Side Effects: NONE.

Notes:

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

Returns the collection of objects stored under $key in $self. The collection is a subclass Bric::Util::Coll object, identified by $class. 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.

NOTES

NONE.

AUTHOR

David Wheeler <david@wheeler.net>

SEE ALSO

Bric

POD ERRORS

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

Around line 425:

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

Around line 621:

Expected '=item *'

Around line 623:

Expected '=item *'

Around line 625:

Expected '=item *'

Around line 627:

Expected '=item *'

Around line 629:

Expected '=item *'

Around line 631:

Expected '=item *'

Around line 633:

Expected '=item *'

Around line 1062:

Expected '=item *'

Around line 1101:

Expected '=item *'

Around line 1163:

Expected '=item *'

Around line 1221:

Expected '=item *'

Around line 1281:

Expected '=item *'

Around line 1338:

Expected '=item *'

Around line 1396:

Expected '=item *'

Around line 1456:

Expected '=item *'

Around line 1513:

Expected '=item *'

Around line 1541:

Expected '=item *'

Around line 1569:

Expected '=item *'

Around line 1595:

Expected '=item *'

Around line 1622:

Expected '=item *'

Around line 1649:

Expected '=item *'

Around line 1673:

Expected '=item *'

Around line 1700:

Expected '=item *'

Around line 1727:

Expected '=item *'

Around line 1751:

Expected '=item *'

Around line 1782:

Expected '=item *'

Around line 1812:

Expected '=item *'

Around line 1839:

Expected '=item *'

Around line 1926:

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

Around line 1928:

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

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

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

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

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

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

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

Around line 1936:

'=item' outside of any '=over'

Around line 1963:

You forgot a '=back' before '=head2'

Around line 2138:

=back without =over