Package CedarBackup2 :: Module cli :: Class _ActionItem
[show private | hide private]
[frames | no frames]

Type _ActionItem

object --+
         |
        _ActionItem


Class representing a single action to be executed.

This class represents a single action to be executed, and understands how to execute those actions.

Standard actions ("built-in" actions like collect, stage, etc.) are instantiated in terms of a direct function reference, i.e. to executeCollect. Extended actions are instantiated in terms of an ExtendedAction object taken from configuration.

The two different actions are executed directly. In the case of standard actions, the function reference is called directly. In the case of extended actions, a function reference is first derived (using getFunctionReference) and then called.

The standard actions will generally use the options and config values. We also pass in the config path so that extensions modules can re-parse configuration if they want to, to add in extra information.

Note: The comparison operators for this class have been implemented to only compare based on the index value, and ignore all other values. This is so that the action set list can be easily sorted by index.

Method Summary
  __init__(self, index, function, extension)
Default constructor.
  __cmp__(self, other)
Definition of equals operator for this class.
  executeAction(self, configPath, options, config)
Executes the action associated with an item.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self, index, function=None, extension=None)
(Constructor)

Default constructor.
Parameters:
index - Index of the item (or None).
function - Reference to function associated with item.
extension - ExtendedAction object associated with item.
Overrides:
__builtin__.object.__init__

__cmp__(self, other)
(Comparison operator)

Definition of equals operator for this class. The only thing we compare is the item's index.
Parameters:
other - Other object to compare to.
Returns:
-1/0/1 depending on whether self is <, = or > other.

executeAction(self, configPath, options, config)

Executes the action associated with an item.

See class notes for more details on how the action is executed.
Parameters:
configPath - Path to configuration file on disk.
options - Command-line options to be passed to action.
config - Parsed configuration to be passed to action.
Raises:
Exception - If there is a problem executing the action.

Generated by Epydoc 2.1 on Sat Apr 23 13:44:35 2005 http://epydoc.sf.net