Acspy.Servants.ContainerServices
index
/alma/ACS-2016.6/ACSSW/lib/python/site-packages/Acspy/Servants/ContainerServices.py

This module provides access to any ACS/CORBA services a component/client wants
to use. Essentially all it contains are references to the managers methods,
components, etc. It does not provide direct access to the container in any way,
shape, or form.
 
TODO:
- getComponent does NOT return the nasty IDL struct for dynamic/default
components but instead returns the narrowed component reference. The side
effect here is that nameless components cannot be released properly by the
developer. For now, we can depend on Manager to keep track of whats going on
but this solution is less than ideal.

 
Modules
       
ACSErr
omniORB.CORBA
maci
maciErrType
threading

 
Classes
       
ACS__POA.CBlong(ACS__POA.Callback)
MyCBlongImpl
__builtin__.object
ComponentReleaseCallback
ContainerServices

 
class ComponentReleaseCallback(__builtin__.object)
     Methods defined here:
__init__(self)
awaitComponentRelease(self, timeout)
This method must be called by the same thread who created the instance of this object
Parameters:
- timeout in msecs
callOver(self)
componentReleased(self, deactivationUncleanEx=None)
errorComponentReleaseFailed(self, deactivationFailureEx)
errorNoPermission(self, message)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ContainerServices(__builtin__.object)
    Class ContainerServices provides components and PySimpleClients
with ACS and CORBA services. Developers should never instantiate this class
directly. That is, ContainerServices is a baseclass and is functionally
useless until its setAll method has been invoked properly.
 
  Methods defined here:
__init__(self)
Components derived from ContainerServices must invoke this constructor!
Automatically taken care of in PySimpleClient objects.
 
Parameters: None
 
Raises: Nothing
activateOffShoot(self, py_obj)
Activates an OffShoot derived object as a CORBA object.
 
Parameters:
- py_obj is (non-CORBA) Python 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: ???
availableComponents(self, name_wildcard='*', type_wildcard='*', activated=0)
Returns a list of ComponentInfos consisting of all Components known 
to manager.
 
Parameters:
- name_wildcard is a wildcard that the components name must match in 
order for its information to be returned
- type_wildcard is a wildcard that the components type must match in
order for its information to be returned.
- activated is a boolean value which specifies whether the search 
should be limited to components which have already been activated.
 
Returns: a list consisting of ComponentInfo structures for every
component manager knows of
 
Raises: ???
corbaObjectFromString(self, obj_uri)
Converts a string to a CORBA object reference.
 
Parameters:
- obj_uri is the address to the CORBA object
 
Return: a CORBA reference to obj_uri
 
Raises: ???
corbaObjectToString(self, comp_ref)
Converts a CORBA object its string representation.
 
Parameters: comp_ref is a reference to the CORBA object.
 
Return: the string representation (an IOR)
 
Raises: ???
findComponents(self, curl_wildcard='*', type_wildcard='*', activated=False)
Finds components by their instance name and/or by their type.
 
    Wildcards can be used for the curl and type.
    This method returns a possibly empty array of component curls; 
    for each curl, you may use getComponent to obtain the reference.
 
Parameters:
- name_wildcard (None is understood as "*")
- type_wildcard (None is understood as "*")
- activated is a boolean value which specifies whether the search 
should be limited to components which have already been activated.
 
Return: the curls of the component(s) that match the search.
 
Raises: ???
forceReleaseComponent(self, comp_name)
Forcefully releases the component defined by comp_name.
 
Parameter: comp_name is the name of the component to be released.
 
Returns: The number of objects still attached to the released component
 
Raises: Nothing
getCDBElement(self, record_name, ele_name)
This method returns all of the attributes in the form of a dictionary
for a given XML element within an XML file.
 
Parameters:
- record_name is the name of the XML file (e.g., "alma/MOUNT1")
- ele_name is the name of the element (e.g, "MOUNT/actAz")
- element_name is the name of the element (e.g, "MOUNT/actAz",
  where acsAz is an XML element contianing all attributes
  representing the characteristics of a BACI property).
 
Return: a dictionary
 
Raises: ???
getCDBRecord(self, record_name)
Returns the stringified version of an XML record in the ACS
configuration database defined by record_name.
 
Parameters:
- record_name is the full name of an XML record in the CDB.  An
example would be "alma/MOUNT1".
 
Return: the stringified XML record 
 
Raises: ???
getCollocatedComp(self, comp_spec, mark_as_default, target_comp)
Activation of a component so that it runs in the same process as
another given component.
 
Parameters:
- comp_spec (maci.ComponentSpec) Component to be obtained.
- mark_as_default (bool) Mark component as default component of its type
- target_comp Name of the target component (where to activate component)
 
Returns: a narrowed reference to the component or None if
that reference cannot be obtained.
 
Raises:
- IncompleteComponentSpec
- InvalidComponentSpec
- ComponentSpecIncompatibleWithActiveComponent
getComponent(self, comp_name=None, activate=True, comp_idl_type=None, comp_code=None, container_name=None, is_dynamic=0)
NOTE: all keyword parameters with the exception of comp_name are
deprecated!
 
Get a component reference from the Manager.
 
This seemingly simple method is actually quite complicated. First, its
important to note that this method narrows the reference for the
developer and even imports the proper IDL Python stub. Under certain
circumstances though, the IDL Python stub may NOT exist in the correct
place which has led some developers to believe this method was broken
in the past. So if you see an error message beginning with
"Unable to import...", please check that you really CAN import the
CORBA stubs for the component you are trying to access using the
infamous "python -i" command.
 
The next important thing to realize is this method does not just
retrieve named components as its own name implies - based on the
parameters passed it could return default and dynamic components
also.
 
Parameters:
- name is the components name. If not None and the rest of the
default parameters are left as-is, this is assumed to be a static
component.
- activate tells manager whether the component should be activated
if it has not already been instantiated. Not too useful.
- comp_idl_type is the interface repository IDL location of the
component. If not None and the rest of the default parameters are
left as-is, it is assumed the developer wants a default component.
- comp_code is a shared library implementing component. If not
None, it is assumed the developer wants a dynamic component.
- container_name is the name of the container to activate component.
If not None, it is assumed the developer wants a dynamic component.
- is_dynamic states whether a component should be retrieved as
default or dynamic. In simple terms, when this parameter and
comp_idl_type are the only params that have been changed from their
original values, this is the difference between retrieving a reference
to a dynamic component or a default component.
 
Returns: a narrowed reference to the component or None if
that reference cannot be obtained.
 
Raises: CannotGetComponentExImpl if the component stubs cannot be loaded
        or found
getComponentNonSticky(self, comp_name)
Gets the component in a non stick way.
The comp_name is a name of the component.
 
Parameters:
- comp_name is the name of the component.
 
Returns: a narrowed reference to the component or None if
that reference cannot be obtained.
 
Raises: CannotGetComponentExImpl if the component stubs cannot be loaded
        or found
getContName(self)
Returns our container name.
 
Parameters: None
 
Return: name of the container the component was started by.
 
Raises: Nothing
getDefaultComponent(self, comp_type)
Gets the default component specified by the component type.
The type is the IDL type, such as "IDL:alma/PS/PowerSupply:1.0"
 
Parameters:
- comp_type is the interface repository IDL location of the
component.
 
Returns: a narrowed reference to the component or None if
that reference cannot be obtained.
 
Raises: CannotGetComponentExImpl if the component stubs cannot be loaded
        or found
getDynamicComponent(self, name, comp_type, code, container)
Gets a component whose instance is not registered in the CDB 
at deployment time.
 
Parameters:
- name is the components name in string format
- comp_type is the interface repository IDL location of the component
- code is a shared library implementing component
- container is the name of the container to activate component.
 
Returns: a narrowed reference to the component or None if
that reference cannot be obtained.
 
Raises: CannotGetComponentExImpl if the component stubs cannot be loaded
        or found
getLogger(self)
Returns the component/client logger.
 
Parameters: None
 
Return: a logger
 
Raises: Nothing
getName(self)
Returns our name.
 
Parameters: None
 
Return: name of the component or client derived from ContainerServices.
 
Raises: Nothing
getThread(self, target, name, args=None, kwargs=None)
This method returns a Python threading.Thread object.
 
Parameters:
- target callable object to be invoked by the run() method
- name the thread name. Must be unique
- args is the argument tuple for the target invocation. Defaults to ()
- kwargs is a dictionary of keyword arguments for the target
invocation. Defaults to {}
 
Return: a threading.Thread object
 
Raises: ???
makeCompImmortal(self, comp_name, state)
Change mortality state of a component.
Compnent must be already active.
The caller must be owner of the component or have administator rights.
 
Parameters:
- comp_name name of the component
- state new mortality state
 
Returns: None
 
Raises: ???
releaseComponent(self, comp_name)
Release the component defined by comp_name.
 
Parameter: comp_name is the name of the component to be released.
 
Returns: The number of objects still attached to the released component
 
Raises: Nothing
releaseComponentAsync(self, comp_name, callback=None)
Release the component defined by comp_name in asynchronous way.
 
Parameters: 
 - comp_name is the name of the component to be released.
 - callback by default is None or it must be a subclass of relaseCallback
 
Returns: The number of objects still attached to the released component
 
Raises: TypeError if callback is not instance of ComponentReleaseCallback
restartComp(self, comp_name)
Restarts a component.
 
Parameters:
- comp_name name of the component
 
Returns: Reference to the restarted component.
 
Raises: ???
setAll(self, name, token, handle, activate_offshoot_method, contname=None)
This method should only be invoked by the container and provides the
component with all container services. DO NOT INVOKE FROM YOUR CODE!!!

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MyCBlongImpl(ACS__POA.CBlong)
    
Method resolution order:
MyCBlongImpl
ACS__POA.CBlong
ACS__POA.Callback
ACS__POA.OffShoot
omniORB.PortableServer.Servant
__builtin__.object

Methods defined here:
__init__(self, callback)
done(self, value, c, desc)
negotiate(self, time_to_transmit, desc)
working(self, value, c, desc)

Data descriptors inherited from omniORB.PortableServer.Servant:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        __revision__ = '$Id: ContainerServices.py,v 1.32 2012/10/13 18:06:06 tstaig Exp $'