Bric::Dist::Action

Name

Bric::Dist::Action - Interface to actions that can be performed on resources for given server types.

Synopsis

use Bric::Dist::Action;

# Constructors.
# Create a new object.
my $action = Bric::Dist::Action->new;
# Look up an existing object. May return a subclass of Bric::Dist::Action.
$action = Bric::Dist::Action->lookup({ id => 1 });
# Get a list of action objects.
my @servers = Bric::Dist::Action->list({ type => 'Akamaize' });

# Class methods.
# Get a list of object IDs.
my @st_ids = Bric::Dist::Action->list_ids({ type => 'Akamaize' });
# Get an introspection hashref.
my $int = Bric::Dist::Action->my_meths;
my $bool = Bric::Dist::Action->has_more;

# Instance Methods.
my $id = $action->get_id;
my $type = $action->get_type;
# Changing the type will likely change the $action to a different subclass,
# and will delete any attributes associated with the previous type.
$action = $action->set_type($type);

# Description is only available for types that have been looked up in the
# database.
my $description = $action->get_description;

# The server type designation may be changed at will.
my $st_id = $action->get_server_type_id;
my $action = $action->set_server_type_id($st_id);

# The list of MEDIA types can only be fetched on existing actions. The list
# of MEDIA types is dependent on the type of action.
my @medias = $action->get_media_types;
my $medias = $action->get_media_href;

# Perform the action.
$action->do_it($job, $server_type);

# Delete the action.
$action->del

# Save the action.
$action->save;

Description

This class manages the actions that are applied for a given server type to the files associated with a given job. The idea is that for any given server type, an ordered list of actions will be performed whenever a job is executed for that server type. For example, if there is a server type "Production Server", the list of actions (represented as Bric::Dist::Action objects) for that server type might be "Akamaize", "Ultraseek", "Gzip", and "Put". When a job (represented by a Bric::Util::Job object) is executed for that server group, then each of those actions will be instantiated in turn, and their do_it() methods called on the job's resources.

The types of actions available to customers are created at development time, and are represented both in the database and by subclasses of Bric::Dist::Action. They can be changed and reordered for a given server type via the Bric::Dist::ServerType interface. So Bric::Dist::Action will frequently not be accessed directly, but via Bric::Dist::ServerType accessors.

Interface

Constructors

Destructors

Public Class Methods

Public Instance Methods

Private

Private Class Methods

Private Instance Methods

Private Functions

Adding a New Action

Notes

NONE.

Author

David Wheeler

See Also

Bric