Bric::Dist::Server - Interface for managing servers to which content will be distributed.
use Bric::Dist::Server;
# Constructors.
# Create a new object.
my $server = Bric::Dist::Server->new;
# Look up an existing object.
$server = Bric::Dist::Server->lookup({ id => 1 });
# Get a list of server objects.
my @servers = Bric::Dist::Server->list({ server_type_id => 2 });
# Get an anonymous hash of server objects.
my $servers_href = Bric::Dist::Server->href({ home_path => '/home/www' });
# Class methods.
# Get a list of object IDs.
my @server_ids = Bric::Dist::Server->list_ids({ server_type_id => 2 });
# Get an introspection hashref.
my $int = Bric::Dist::Server->my_meths;
# Instance Methods.
my $id = $server->get_id;
my $server_type_id = $server->get_server_type_id;
$server = $server->set_server_type_id($server_type_id);
my $host_name = $server->get_host_name;
$server = $server->set_host_name($host_name);
my $doc_root = $server->get_doc_root;
$server = $server->set_doc_root($doc_root);
my $login = $server->get_login;
$server = $server->set_login($login);
my $password = $server->get_password;
$server = $server->set_password($password);
my $cookie = $server->get_cookie;
$server = $server->set_cookie($cookie);
# Save it.
$server->save;
# Delete it.
$server->del;
$server->save;
This class manages server objects. Servers are individual instances of a type defined by Bric::Dist::ServerType. They are provide accessors to values that are unique to each server, such as host name, login, password, cookie, etc. Thus, when a job is scheduled to move files to the servers of a given server type, they can be successfully moved using the unique properties of each server.
Instantiates a Bric::Dist::Server object. An anonymous hash of initial values may be passed. The supported initial value keys are:
The active property will be set to true by default. Call $server->save() to save the new object.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Looks up and instantiates a new Bric::Dist::Server object based on the Bric::Dist::Server 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::Server object with data from the database before returning it.
Notes: NONE.
Returns a list or anonymous array of Bric::Dist::Server objects based on the search parameters passed via an anonymous hash. The supported lookup keys are:
Server ID. May use ANY for a list of possible values.
The server host name. May use ANY for a list of possible values.
The server operating system. May use ANY for a list of possible values.
The document root to distribute to. May use ANY for a list of possible values.
The login username for the server. May use ANY for a list of possible values.
The login password for the server. May use ANY for a list of possible values.
The cookie to use to connect to the server. May use ANY for a list of possible values.
The destination (Bric::Dist::ServerType) ID with which a server may be associated. May use ANY for a list of possible values.
Boolean value indicating whether the server object is active.
Throws:
Side Effects: Populates each Bric::Dist::Server object with data from the database before returning them all.
Notes: NONE.
Returns an anonymous hash of Bric::Dist::Server objects, where the keys are the object IDs and the values are the objects themselves, based on the search parameters passed via an anonymous hash. The supported lookup keys are the same as for list().
Throws:
Side Effects: Populates each Bric::Dist::Server object with data from the database before returning them all.
Notes: NONE.
Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Returns a list or anonymous array of Bric::Dist::Server 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.
Returns an anonymous hash of introspection data for this object. If called with a true argument, it will return an ordered list or anonymous array of introspection data. If a second true argument is passed instead of a first, then a list or anonymous array of introspection data will be returned for properties that uniquely identify an object (excluding id, which is assumed).
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:
The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.
The display name of the property or attribute.
A reference to the method that will retrieve the value of the property or attribute.
An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.
A reference to the method that will set the value of the property or attribute.
An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.
The type of value the property or attribute contains. There are only three types:
If the value is a 'short' value, this hash key contains the length of the field.
The property is searchable via the list() and list_ids() methods.
The property or attribute is required.
An anonymous hash of properties used to display the property or attribute. Possible keys include:
The display field type. Possible values are
The Length, in letters, to display a text or password field.
The maximum length of the property or value - usually defined by the SQL DDL.
The number of rows to format in a textarea field.
The number of columns to format in a textarea field.
An anonymous hash of key/value pairs reprsenting the values and display names to use in a select list.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Returns a list of supported server operating systems.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Returns the ID of the Bric::Dist::Server object.
Throws:
Side Effects: NONE.
Notes: If the Bric::Dist::Server 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.
Returns the ID of the Bric::Dist::ServerType object with which this server is associated.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the ID of the Bric::Dist::ServerType object with which this server is associated.
Throws:
Side Effects: NONE.
Notes: NONE.
Returns the server's host name.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the server's host name. The host name will be converted to lower case.
Throws:
Side Effects: NONE.
Notes: NONE.
Returns the server's operating system.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the server's operating system. Retreive a list of supported OSes from list_oses().
Throws:
Side Effects: NONE.
Notes: NONE.
Returns the server's home path. This is the path that will serve as the root directory for all PUTs to the server.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the server's home path. This is the path that will serve as the root directory for all PUTs to the server.
Throws:
Side Effects: NONE.
Notes: In the future, we may want to add platform-independent methods of handling paths.
Returns the server's login name, which will be used with the password property to interact with the server via FTP and other protocols that require a login and password.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the server's login name, which will be used with the password property to interact with the server via FTP and other protocols that require a login and password.
Throws:
Side Effects: NONE.
Notes: NONE.
Returns the server's password, which will be used with the login to interact with the server via FTP and other protocols that require a login and password.
Throws:
Side Effects: NONE.
Notes: The password is stored in clear text in the database.
Sets the server's password, which will be used with the login to interact with the server via FTP and other protocols that require a login and password.
Throws:
Side Effects: NONE.
Notes: The password is stored in clear text in the database.
Returns the cookie that can be used by transfer protocols that require a cookie for authentication, such as WebDAV.
Throws:
Side Effects: NONE.
Notes: NONE.
Sets the cookie that can be used by transfer protocols that require a cookie for authentication, such as WebDAV. Converts non-Unix line endings.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Marks the Bric::Dist::Server object to be deleted from the database. Call $server->save to actually finish it off.
Throws:
Side Effects: NONE.
Notes: NONE.
Activates the Bric::Dist::Server object. Call $server->save to make the change persistent. Bric::Dist::Server objects instantiated by new() are active by default.
Throws:
Side Effects: NONE.
Notes: NONE.
Deactivates (deletes) the Bric::Dist::Server object. Call $server->save to make the change persistent.
Throws:
Side Effects: NONE.
Notes: NONE.
Returns $self if the Bric::Dist::Server object is active, and undef if it is not.
Throws:
Side Effects: NONE.
Notes: NONE.
Saves any changes to the Bric::Dist::Server object. Returns $self on success and undef on failure.
Throws:
Side Effects: NONE.
Notes: NONE.
NONE.
NONE.
Function used by lookup() and list() to return a list of Bric::Dist::Server objects or, if called with an optional third argument, returns a listof Bric::Dist::Server object IDs (used by list_ids()). If called with an optional fourth argument, returns an anonymous hash where the keys are the object IDs and the values are the objects themselves.
Throws:
Side Effects: NONE.
Notes: NONE.
NONE.
David Wheeler