Package flumotion :: Package component :: Module component :: Class BaseComponent
[show private | hide private]
[frames | no frames]

Type BaseComponent

object --+    
         |    
   GObject --+
             |
object --+   |
         |   |
 InitMixin --+
             |
  Loggable --+
             |
            BaseComponent

Known Subclasses:
Bouncer, FeedComponent

I am the base class for all Flumotion components.
Method Summary
  __init__(self)
Subclasses should not override __init__ at all.
  addMessage(self, message)
Add a message to the component.
  adminCallRemote(self, methodName, *args, **kwargs)
Call a remote method on all admin client views on this component.
  do_check(self)
Subclasses can implement me to run any checks before the component performs setup.
  do_setup(self)
Subclasses can implement me to set up the component before it is started.
  do_start(self, *args, **kwargs)
BaseComponent vmethod for starting up.
  do_stop(self)
BaseComponent vmethod for stopping.
  emit(self, name, *args)
  fixRenamedProperties(self, properties, list)
Fix properties that have been renamed from a previous version, and add a warning for them.
int getMood(self)
Gets the mood on the component.
  getName(self)
  getWorkerName(self)
  init(self)
A subclass should do as little as possible in its init method.
  setMedium(self, medium)
  setMood(self, mood)
Set the given mood on the component if it's different from the current one.
  setShutdownHook(self, shutdownHook)
Set the shutdown hook for this component (replacing any previous hook).
  setup(self, config, *args, **kwargs)
Sets up the component with the given config.
  setWorkerName(self, workerName)
  start(self, *args, **kwargs)
Tell the component to start.
  stop(self)
Tell the component to stop.
    Inherited from Loggable
  debug(self, *args)
Log a debug message.
dict doLog(self, level, where, format, *args, **kwargs)
Log a message at the given level, with the possibility of going higher up in the stack.
  error(self, *args)
Log an error.
  info(self, *args)
Log an informational message.
  log(self, *args)
Log a log message.
  logFunction(self, *args)
Overridable log function.
  logObjectName(self)
Overridable object name function.
  warning(self, *args)
Log a warning.
  warningFailure(self, failure, swallow)
Log a warning about a Failure.
    Inherited from GObject
  __cmp__(x, y)
x.__cmp__(y) <==> cmp(x,y)
  __gobject_init__(...)
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __repr__(x)
x.__repr__() <==> repr(x)
  chain(...)
  connect(...)
  connect_after(...)
  connect_object(...)
  connect_object_after(...)
  disconnect(...)
  disconnect_by_func(...)
  emit_stop_by_name(...)
  freeze_notify(...)
  get_data(...)
  get_property(...)
  handler_block(...)
  handler_block_by_func(...)
  handler_disconnect(...)
  handler_is_connected(...)
  handler_unblock(...)
  handler_unblock_by_func(...)
  notify(...)
  set_data(...)
  set_property(...)
  stop_emission(...)
  thaw_notify(...)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Instance Variable Summary
BaseComponentMedium medium: the component's medium
string name: the name of the component

Class Variable Summary
GType __gtype__ = <GType flumotion+component+component+BaseCom...
child class of BaseComponentMedium componentMediumClass = flumotion.component.component.BaseComponentMedium
str logCategory: Implementors can provide a category to log their messages under.
    Inherited from Loggable
Implements __implemented__ = <implementedBy flumotion.common.log.Lo...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
    Inherited from GObject
str __gdoc__ = 'Object GObject\n\nSignals from GObject:\n  n...
getset_descriptor __grefcount__ = <attribute '__grefcount__' of 'gobject.G...
GProps props = <gobject.GProps object at 0x15ae72d0>

Method Details

__init__(self)
(Constructor)

Subclasses should not override __init__ at all.

Instead, they should implement init(), which will be called by this implementation automatically.

See flumotion.common.common.InitMixin for more details.
Overrides:
flumotion.common.common.InitMixin.__init__

addMessage(self, message)

Add a message to the component. If any of the messages is an error, the component will turn sad.
Parameters:
message
           (type=flumotion.common.messages.Message)

adminCallRemote(self, methodName, *args, **kwargs)

Call a remote method on all admin client views on this component.

This gets serialized through the manager and multiplexed to all admin clients, and from there on to all views connected to each admin client model.

Because there can be any number of admin clients that this call will go out do, it does not make sense to have one return value. This function will return None always.

do_check(self)

Subclasses can implement me to run any checks before the component performs setup.

Messages can be added to the component state's 'messages' list key. Any error messages added will trigger the component going to sad an flumotion.common.errors.ComponentSetupError being raised; do_setup() will not be called.

In the event of a fatal problem that can't be expressed through an error message, this method should set the mood to sad and raise the error on its own.

self.config will be set before this is called.
Returns:
twisted.internet.defer.Deferred

do_setup(self)

Subclasses can implement me to set up the component before it is started. It should set up the component, possibly opening files and resources. Non-programming errors should not be raised, but returned as a failing deferred.

self.config will be set before this is called.
Returns:
twisted.internet.defer.Deferred

do_start(self, *args, **kwargs)

BaseComponent vmethod for starting up. If you override this method, you are responsible for arranging that the component becomes happy.
Returns:
twisted.internet.defer.Deferred

do_stop(self)

BaseComponent vmethod for stopping. The component should do any cleanup it needs, but must not set the component's mood to sleeping.
Returns:
twisted.internet.defer.Deferred

fixRenamedProperties(self, properties, list)

Fix properties that have been renamed from a previous version, and add a warning for them.
Parameters:
properties - properties; will be modified as a result.
           (type=dict)
list - list of (old, new) tuples of property names.
           (type=list of tuple of (str, str))

getMood(self)

Gets the mood on the component.
Returns:
int

init(self)

A subclass should do as little as possible in its init method. In particular, it should not try to access resources.

Failures during init are marshalled back to the manager through the worker's remote_create method, since there is no component state proxied to the manager yet at the time of init.

setMood(self, mood)

Set the given mood on the component if it's different from the current one.

setShutdownHook(self, shutdownHook)

Set the shutdown hook for this component (replacing any previous hook). When a component is stopped, then this hook will be fired.

setup(self, config, *args, **kwargs)

Sets up the component with the given config. Called by the manager through the medium.
Returns:
twisted.internet.defer.Deferred
Raises:
flumotion.common.errors.ComponentSetupError - when an error happened during setup of the component

start(self, *args, **kwargs)

Tell the component to start. This is called when all its dependencies are already started.

To hook onto this method, implement your own do_start method. See BaseComponent.do_start() for what your do_start method is responsible for doing.

Again, don't override this method. Thanks.

stop(self)

Tell the component to stop. The connection to the manager will be closed. The job process will also finish.

Instance Variable Details

medium

the component's medium
Type:
BaseComponentMedium

name

the name of the component
Type:
string

Class Variable Details

__gtype__

Type:
GType
Value:
<GType flumotion+component+component+BaseComponent (360976384)>        

logCategory

Implementors can provide a category to log their messages under.
Type:
str
Value:
'basecomp'                                                             

Generated by Epydoc 2.1 on Sun Oct 26 16:39:16 2008 http://epydoc.sf.net