| |
- maci__POA.Client(omniORB.PortableServer.Servant)
-
- BaseClient
- threading.Thread(threading._Verbose)
-
- ManagerAsyncConnector
class BaseClient(maci__POA.Client) |
|
BaseClient class is an implementation of the MACI Client IDL interface in
Python. |
|
- Method resolution order:
- BaseClient
- maci__POA.Client
- omniORB.PortableServer.Servant
Methods defined here:
- __init__(self, name='Python Client')
- Initialize the client.
Parameters:
- name is what manager will refer to this client instance as
Returns: Nothing
Raises: CORBAProblemExImpl
- 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 Components_unavailable (in stringSeq component_names)
- disconnect(self)
- Disconnect notification. The disconnect method is called by the Manager
to notify the client that it will be unavailable and that the client
should log off.
Also, the client developer is required to disconnect all connected clients
before exiting the Python interpreter.
Parameters: None
Returns: None
Raises: Nothing
oneway void disconnect ();
- getCode(self)
- Returns the code to be used when manager tries to authenticate this
object
Parameters: None
Returns: the code to be returned to manager.
Raises: Nothing
- getMyCorbaRef(self)
- Helper method which returns this Python objects underlying CORBA servant
reference.
This implementation implicityly activates the client using the default
POA if it has not been activated before.
Parameters: None
Returns: a CORBA reference to this object
Raises: CORBAProblemExImpl
- isLoggedIn(self)
- Returns True is the client is logged into the manager
and False otherwise
Parameters: None
Raises: Nothing
- managerLogin(self)
- Login into the manager
Parameters: None
Returns: The token received from the manager
Raises: CORBAProblemExImpl If the login failed
- managerLogout(self)
- Logout from manager
Parameters: None
Returns: None
Raises: Nothing
- 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 ();
- setToken(self, newToken)
- This method is called by the thread when it tries to
reconnect to the manager.
This method does not do anything if the connection failed:
it must be overridden to customize (the Container wants to terminate
in that case for example).
Parameters: newToken The newToken returned by the manager
A value of None means that the thread failed to reconnect
Returns None
Raises: Nothing
|
class ManagerAsyncConnector(threading.Thread) |
|
Objects of this class asynchronously login the client passed in the constructor
into the manager.
The ManagerAsyncConnector should be used to log in into the manager in the following way:
1. instantiate the object passing the number of attempts to connect (0 means try forever)
2. start the thread
Before terminating, the thread invokes setToken to the BaseClien: if the token is None, it means
that the it was unable to connect and it is up to the client to decide how to handle
the failure.
terminateThread() force the thread to terminate. It is safer to
start the thread as daemon. |
|
- Method resolution order:
- ManagerAsyncConnector
- threading.Thread
- threading._Verbose
- __builtin__.object
Methods defined here:
- __init__(self, client, logger, attempts=0)
- Initialize the class
Parameters: attempts The number of attempts to get the manager reference
If it is 0 then it keep trying forever
It must be a positive number
client The BaseClient to login into the manager
logger: The logger
Returns: None
Raises: Nothing
- getToken(self)
- Returns the token assigned by the manager after logging in
or None if the object failed to log in into the manager
- run(self)
- The thread that wait until it gets the manager reference
- sleepCheckingTermination(self, nSecs)
- Helper method that returns after nSecs but checking
the termination every 0.5 seconds
- terminateThread(self)
- Tell the thread to terminate at the next iteration
Methods inherited from threading.Thread:
- __repr__(self)
- getName(self)
- isAlive(self)
- isDaemon(self)
- is_alive = isAlive(self)
- join(self, timeout=None)
- setDaemon(self, daemonic)
- setName(self, name)
- start(self)
Data descriptors inherited from threading.Thread:
- daemon
- ident
- name
Data descriptors inherited from threading._Verbose:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |