Acspy.Container
index
/diska/alma_tmp/ACS/LGPL/CommonSoftware/acspy/src/Acspy/Container.py

This module includes the implementation of a Python Container for the
maci::Container IDL interface.
 
TODO LIST:
- integrate with the new ACS Error System
- mutex lock methods (if needed)
- fix the interfaces param to ComponentInfo in activate_component(...)
- a ComponentLifecycleException has been defined in IDL now...

 
Modules
       
ACS
Acspy.Util.ACSCorba
Acspy.Common.Log
Acspy.Util.LoggingConfig_xsd
omniORB.PortableServer
maci
maci__POA
sys

 
Classes
       
Acspy.Clients.BaseClient.BaseClient(maci__POA.Client)
Container(maci__POA.Container, maci__POA.LoggingConfigurable, Acspy.Clients.BaseClient.BaseClient)
maci__POA.Container(maci__POA.Client, maci__POA.LoggingConfigurable)
Container(maci__POA.Container, maci__POA.LoggingConfigurable, Acspy.Clients.BaseClient.BaseClient)
maci__POA.LoggingConfigurable(omniORB.PortableServer.Servant)
Container(maci__POA.Container, maci__POA.LoggingConfigurable, Acspy.Clients.BaseClient.BaseClient)

 
class Container(maci__POA.Container, maci__POA.LoggingConfigurable, Acspy.Clients.BaseClient.BaseClient)
    The Python implementation of a MACI Container.
 
This implies it implements both the Container and Client interfaces. It is
multi-threaded and currently supports components derived from
ACSComponent, ContainerServices, and the LifeCycle classes.
 
 
Method resolution order:
Container
maci__POA.Container
maci__POA.Client
omniORB.PortableServer.Servant
maci__POA.LoggingConfigurable
Acspy.Clients.BaseClient.BaseClient

Methods defined here:
__init__(self, name)
Constructor.
 
Initializes member variables and CORBA
 
Parameters: name is the stringified name of this container.
 
Raises: ???
activateOffShoot(self, comp_name, os_corba_ref)
Activates an OffShoot derived object.
 
Actually this will work on any CORBA object because its Python.
 
Parameters:
- comp_name is the components name.
- os_corba_ref is a reference to the Python object to become a CORBA object.
 
Return: a reference to the CORBA object that almost definitely needs to
be narrowed to the correct type.  If anything goes wrong though, returns
None.
 
Raises: ???
activate_component(self, h, exeid, name, exe, idl_type)
Activates a component (or returns a reference to it if already exists).
 
Parameters:
- h is the handle the component will be given
- name is simply the components name
- exe is the name of the Python module that has to be imported for the
components implementation
- idl_type is the the IR Location for the component
 
Raises: CannotActivateComponentExImpl exception when invalid
 
Returns: a ComponentInfo structure for manager to use.
 
activate_component(in Handle h,in string name,in string exe,in string idl_type)
configCORBA(self)
configCORBA is a helper method responsible for initializing the ORB,
POAs, etc.
 
Parameters: None
 
Return: None
 
Raises: ???
configureComponentLogger(self, name)
Configure the logger for the given component name from the values in the CDB.
 
Parameters:
name is the name of the component
createPOAForComponent(self, comp_name)
Creates a new POA that is responsible for exactly one component and
the new POA is created as a child of the ComponentPOA.
 
Parameters: comp_name is the components stringified name.
 
Return: a new POA.
 
Raises: ???
deactivate_components(self, handle_list)
Deactivate all components whose handles are given.
 
Deactivation is the inverse process of activation: component is detached from
the POA, and thus made unavailable through CORBA, and its resources are
freed. If its code-base is no longer used, it is unloaded from memory.
 
Parameters: handle_list is a list of integers specifies component handles
 
void deactivate_components (in HandleSeq h)
destroyCORBA(self)
Helper function designed to shutdown/destroy all CORBA associated with
this specific container.
 
Raises: ???
disconnect(self)
Disconnect from manager.
 
oneway void disconnect ();
failedActivation(self, comp_entry)
Helper method used to destroy various things if the component cannot
be created.
 
Parameters:
comp_entry - dictionary describing the component
getCDBInfo(self)
getCDBInfo is a helper method which is responsible for retrieving info
from the CDB associated with this container.
 
Parameters: None
 
Return: None
 
Raises: ???
getCode(self)
Overriden from BaseClient
getExistingComponent(self, name)
Searches to see if the component "name" has already been activated by
this container.
 
Parameters: name of the component.
 
Return: component record if found; else None.
getManagerHost(self)
Helper function returns a string consisting of managers host.
 
Return: hostname where manager is running.
 
Raises: ???
getMyCorbaRef(self)
Overriden from BaseClient
get_component_info(self, handles)
Returns information about a subset of components that are currently hosted by
the Container.
 
Note:  If the list of handles is empty, information about all components hosted
by the activator is returned!
 
Parmaters: handles is a sequence of integers specifiying component handles.
Return: Information about the selected components.
 
ComponentInfoSeq get_component_info (in HandleSeq h);
get_default_logLevels(self)
Retrieve the default log levels used in this container.
 
Returns: maci.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: Nothing
get_logLevels(self, logger_name)
Retrieve the log levels for a given component.
 
Parameter:
logger_name - name of the component's logger
 
Returns: maci.LoggingConfigurable.LogLevels instance containing the logger's log level values
 
Raises: LoggerDoesNotExistExImpl if the logger is not active.
get_logger_names(self)
Retrieve the names of the currently active loggers
 
Returns: list of logger name strings
handler(self, signum, frame)
Catches SIGINTs and shuts down the container.
 
Used only by the run method.
 
Parameters: signum is the signal being caught
frame is the execution frame.
 
Return: None
 
Raises: ???
refresh_logging_config(self)
Reset the logging configuration to the original CDB settings.
 
Returns:  Nothing
 
Raises:  Nothing
run(self)
Runs the container until a sig-int is caught.
 
This is a blocking call!
 
Raises: ???
set_component_shutdown_order(self, handles)
Set component shutdown order.
 
void set_component_shutdown_order(in HandleSeq h);
set_default_logLevels(self, levels)
Set the default log level for this container.
 
Parameter:
levels - maci.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: Nothing
set_logLevels(self, logger_name, levels)
Set the default log level for this component.
 
Parameter:
logger_name - name of the component's logger
levels - maci.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: LoggerDoesNotExistExImpl if the logger is not active.
shutdown(self, action)
Shutdown the Container.
 
Normally invoked via CORBA but can also "self terminate" so to speak.
 
Parameters:
- action is an encrypted value that tells the container what action to take
 
oneway void shutdown (in unsigned long action)
taggedmessage(self, message_type, message_id, message)
The Manager and administrators use this method for sending textual messages
to the client.
 
This implementation first attempts to use the ACS logging mechanism to
display the message and if that fails for any reason, it is only sent
to standard out.
 
Parameters:
- message_type is an integer defined as a constant in the Client interface
- message is a string
 
Returns: Nothing
 
Raises: Nothing
 
oneway void message (in short message_type, in string message)

Methods inherited from Acspy.Clients.BaseClient.BaseClient:
authenticate(self, execution_id, question)
Authentication method. Method authenticate is the challenge issued to
the client after it tries to login. The login will be successful if the
clients authenticate() produces the expected result. Only in this case
will the Managers login method return a valid handle, which the client
will later use as the id parameter with all calls to the Manager.
 
Parameters: question this string does not currently matter
 
Return Answer - first character of the answer identifies the type of
the client, and can be one of:
- C = a regular client (implements just the Client interface).
- A = a container (implements the Container interface).
- AR = a container with recovery capability (implements the Container interface).
- S = Supervisor (implements the Administrator interface).
 
Raises: Nothing
 
string authenticate (in string question);
components_available(self, components)
Notify client about the change (availability) of the components currently
in use by this client. For administrative clients, notification is issued
for the change of availability of any component in the domain.
 
Parameters:
- components is a sequence of ComponentInfo structures
 
Returns: None
 
Raises: Nothing
 
oneway void components_available(in ComponentInfoSeq components)
components_unavailable(self, component_names)
Notify client that some of the Components currently in use by client
have become unavailable.
 
Parameters:
- component_names names of various unavailable components
 
Returns: None
 
Raises: Nothing
 
oneway void Compoents_unavailable (in stringSeq component_names)
message(self, message_type, message)
The Manager and administrators use this method for sending textual messages
to the client.
 
This implementation first attempts to use the ACS logging mechanism to
display the message and if that fails for any reason, it is only sent
to standard out.
 
Parameters:
- message_type is an integer defined as a constant in the Client interface
- message is a string
 
Returns: Nothing
 
Raises: Nothing
 
oneway void message (in short message_type, in string message)
ping(self)
Manager pings its clients to verify they still exist.
 
Parameters: None
 
Returns: CORBA.TRUE (i.e., 1)
 
Raises: Nothing
 
boolean ping ();

 
Functions
       
signal(...)
signal(sig, action) -> action
 
Set the action for the given signal.  The action can be SIG_DFL,
SIG_IGN, or a callable Python object.  The previous action is
returned.  See getsignal() for possible return values.
 
*** IMPORTANT NOTICE ***
A signal handler function is called with two arguments:
the first is the signal number, the second is the interrupted stack frame.
sleep(...)
sleep(seconds)
 
Delay execution for a given number of seconds.  The argument may be
a floating point number for subsecond precision.

 
Data
        ACTIVATOR_EXIT = 2
ACTIVATOR_REBOOT = 1
ACTIVATOR_RELOAD = 0
COMPMODULE = 'COMPMODULE'
COMPONENTINFO = 'COMPONENTINFO'
CORBAREF = 'CORBAREF'
EXE = 'EXE'
EXEID = 'EXEID'
FALSE = 0
HANDLE = 'HANDLE'
NAME = 'NAME'
POA = 'POA'
POAOFFSHOOT = 'POAOFFSHOOT'
PYCLASS = 'PYCLASS'
PYREF = 'PYREF'
SIGINT = 2
TYPE = 'TYPE'
__revision__ = '$Id: Container.py,v 1.40 2008/11/04 10:48:14 agrimstrup Exp $'
environ = {'VLTINC': '-I/alma/ACS-8.0/TAO/ACE_wrappers/bui...ean_python', 'VLTTOP_LOG': '/alma/ACS-8.0/ACSSW'}