Package flumotion :: Package manager :: Module admin :: Class AdminAvatar
[hide private]

Class AdminAvatar

source code

twisted.spread.pb.Avatar --+            
                           |            
     common.log.Loggable --+            
                           |            
           twisted.pb.Avatar --+        
                               |        
       twisted.pb.PingableAvatar --+    
                                   |    
             common.log.Loggable --+    
                                   |    
                  base.ManagerAvatar --+
                                       |
                                      AdminAvatar

I am an avatar created for an administrative client interface. A reference to me is given (for example, to gui.AdminInterface) when logging in and requesting an "admin" avatar. I live in the manager.

Instance Methods [hide private]
 
attached(self, mind)
Tell the avatar that the given mind has been attached.
source code
 
detached(self, mind)
Tell the avatar that the peer's client referenced by the mind has detached.
source code
list of planet.ManagerComponentState
getComponentStates(self)
Return all component states logged in to the manager.
source code
 
sendLog(self, category, type, message)
Send the given log message to the peer.
source code
 
perspectiveMessageReceived(self, broker, message, args, kwargs)
This method is called when a network message is received.
source code
flumotion.common.planet.ManagerPlanetState
perspective_getPlanetState(self)
Get the planet state.
source code
flumotion.common.worker.ManagerWorkerHeavenState
perspective_getWorkerHeavenState(self)
Get the worker heaven state.
source code
 
perspective_shutdown(self)
Shut down the manager.
source code
 
perspective_componentStart(self, componentState)
Start the given component.
source code
 
perspective_componentStop(self, componentState)
Stop the given component.
source code
 
perspective_componentRestart(self, componentState)
Restart the given component.
source code
twisted.internet.defer.Deferred
perspective_componentCallRemote(self, componentState, methodName, *args, **kwargs)
Call a method on the given component on behalf of an admin client.
source code
 
perspective_workerCallRemote(self, workerName, methodName, *args, **kwargs)
Call a remote method on the worker.
source code
 
perspective_getEntryByType(self, componentState, type)
Get the entry point for a piece of bundled code by the type.
source code
 
perspective_reloadComponent(self, componentState)
Reload modules in the given component.
source code
 
perspective_reloadManager(self)
Reload modules in the manager.
source code
str
perspective_getConfiguration(self)
Get the configuration of the manager as an XML string.
source code
 
_saveFlowFile(self, filename)
Opens a file that the flow should be written to.
source code
 
perspective_loadConfiguration(self, xml, saveAs=None)
Load the given XML configuration into the manager.
source code
 
perspective_deleteFlow(self, flowName) source code
 
perspective_deleteComponent(self, componentState)
Delete a component from the manager.
source code
 
perspective_cleanComponents(self) source code
 
_reloaded(self) source code

Inherited from base.ManagerAvatar: __init__, disconnect, getClientAddress, hasRemoteReference, mindCallRemote, perspective_authenticate, perspective_getBundleSums, perspective_getBundleSumsByFile, perspective_getBundleZips, perspective_getKeycardClasses, timeoutDisconnect

Inherited from base.ManagerAvatar (private): _mindCallRemoteErrback

Inherited from twisted.pb.PingableAvatar: perspective_ping, setMind, startPingChecking, stopPingChecking

Inherited from twisted.pb.PingableAvatar (private): _pingCheck

Inherited from twisted.pb.Avatar: mindCallRemoteLogging

Inherited from twisted.spread.pb.Avatar: __providedBy__

Inherited from common.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Class Variables [hide private]
  logCategory = 'admin-avatar'
Implementors can provide a category to log their messages under.

Inherited from base.ManagerAvatar: remoteLogName

Inherited from twisted.pb.PingableAvatar (private): _pingCheckInterval

Inherited from twisted.spread.pb.Avatar: __implemented__, __provides__

Instance Variables [hide private]

Inherited from base.ManagerAvatar: avatarId, heaven, mind, vishnu

Method Details [hide private]

attached(self, mind)

source code 

Tell the avatar that the given mind has been attached. This gives the avatar a way to call remotely to the client that requested this avatar. This is scheduled by the portal after the client has logged in.

Overrides: base.ManagerAvatar.attached
(inherited documentation)

detached(self, mind)

source code 

Tell the avatar that the peer's client referenced by the mind has detached.

Called through the manager's PB logout trigger calling flumotion.manager.manager.Dispatcher.removeAvatar

Overrides: base.ManagerAvatar.detached
(inherited documentation)

getComponentStates(self)

source code 

Return all component states logged in to the manager. The list gets serialized to a list of flumotion.common.planet.AdminComponentState

Returns: list of planet.ManagerComponentState

perspectiveMessageReceived(self, broker, message, args, kwargs)

source code 

This method is called when a network message is received.

I will call:

 |  self.perspective_%(message)s(*broker.unserialize(args),
 |                               **broker.unserialize(kw))

to handle the method; subclasses of Avatar are expected to implement methods of this naming convention.

Overrides: twisted.spread.pb.Avatar.perspectiveMessageReceived
(inherited documentation)

perspective_componentStart(self, componentState)

source code 

Start the given component. The component should be sleeping before this.

Parameters:

perspective_componentStop(self, componentState)

source code 

Stop the given component. If the component was sad, we clear its sad state as well, since the stop was explicitly requested by the admin.

Parameters:

perspective_componentRestart(self, componentState)

source code 

Restart the given component.

Parameters:

perspective_componentCallRemote(self, componentState, methodName, *args, **kwargs)

source code 

Call a method on the given component on behalf of an admin client.

Parameters:
Returns: twisted.internet.defer.Deferred

perspective_workerCallRemote(self, workerName, methodName, *args, **kwargs)

source code 

Call a remote method on the worker. This is used so that admin clients can call methods from the interface to the worker.

Parameters:

perspective_getEntryByType(self, componentState, type)

source code 

Get the entry point for a piece of bundled code by the type.

Returns: a (filename, methodName) tuple, or raises a Failure

perspective_reloadComponent(self, componentState)

source code 

Reload modules in the given component.

Parameters:

_saveFlowFile(self, filename)

source code 

Opens a file that the flow should be written to.

Note that the returned file object might be an existing file, opened in append mode; if the loadConfiguration operation succeeds, the file should first be truncated before writing.

perspective_loadConfiguration(self, xml, saveAs=None)

source code 

Load the given XML configuration into the manager. If the optional saveAs parameter is passed, the XML snippet will be saved to disk in the manager's flows directory.

Parameters:
  • xml (str) - the XML configuration snippet.
  • saveAs (str) - The name of a file to save the XML as.

perspective_deleteComponent(self, componentState)

source code 

Delete a component from the manager.

A component can only be deleted when it is sleeping or sad. It is the caller's job to ensure this is the case; calling this function on a running component will raise a ComponentBusyError.

Returns:
a deferred that will fire when all listeners have been notified of the component removal