Bric::Dist::Action::Mover(3)

NAME
Bric::Dist::Action::Mover - Actions that actually move resources.

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2004-09-13 17:48:55 -0700 (Mon, 13 Sep 2004) $

SYNOPSIS
  use Bric::Dist::Action::Mover;

DESCRIPTION
This subclass of Bric::Dist::Action handles distribution. All ServerTypes must have a mover_class selected, and a "Move" action specified. When Bricolage triggers the Move action, this class determines what the mover method is, and invokes the put_res() (or del_res()) method of the appropriate mover class. See below for information on how to create your own mover.

INTERFACE

  Constructors
Inherited from Bric::Dist::Action.

  Destructors

$mover->DESTROY
    Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Class Methods
NONE.

  Public Instance Methods
The methods documented here are in addition to those inherited from Bric::Dist::Action.

$act->do_it($job, $resources, $server_type)
    Executes $action via the method specified for the Bric::Dist::ServerType of which this action is a part.

    Throws:

    *   Unable to load mover class.

    Side Effects: NONE.

    Notes: NONE.

$act->undo_it($job, $resources, $server_type)
    Undoes $action via the method specified for the Bric::Dist::ServerType of which this action is a part.

    Throws:

    *   Unable to load mover class.

    Side Effects: NONE.

    Notes: NONE.

PRIVATE

  Private Class Methods
NONE.

  Private Instance Methods
NONE.

  Private Functions
NONE.

NOTES

  How to Add New Distribution Movers.
If you're interested in adding new methods of distribution, or movers, to Bricolage, here's how to do it.

•   Create a mover class in Bric::Util::Trans, e.g., Bric::Util::Trans::MyMover. Use Bric::Util::Trans::FS and Bric::Util::Trans::FTP as examples.

•   In your new mover class, implement a put_res() method and a del_res() method. These methods take an array ref of Bric::Dist::Resource objects to be moved and a Bric::Dist::ServerType object as arguments. Use the Bric::Dist::Server objects in the Brci::Dist::ServerType object to put (or delete, in the case of del_res) the files represented by each of the resource objects. Again, see Use Bric::Util::Trans::FS and Bric::Util::Trans::FTP for examples.

•   Add an INSERT statement to lib/Bric/Util/Class.val to create a new representation for your mover class. Be sure to set the value of the "distributor" column to 1. Use the records for Bric::Util::Trans::FS and Bric::Util::Trans::FTP as examples.

•   Add an upgrade script to inst/upgrade/<version>, where the "version" is the version number of the Bricolage release in which your transport will first be included. This script is necessary for users who are upgrading existing versions of Bricolage. Use inst/upgrade/1.3.1/mover.pl as an example.

•   Add "use Bric::Util::Trans::MyMover;" to Bric::Dist::Action::Mover, so that your mover loads on startup.

•   Update the class table of your Bricolage database, and then restart your Bricolage server. Look at a Destination, and make sure that your mover is listed in the "Move Method" select list.

•   Test your mover thoroughly. Make sure that it successfully distributes files and deletes files.

And that's all there is to it! Good luck!

AUTHOR
David Wheeler <david@wheeler.net>

SEE ALSO
Bric, Bric::Dist::Action