Acssim.EventRecorder
index
/alma/ACS-2016.6/ACSSW/lib/python/site-packages/Acssim/EventRecorder.py

#*******************************************************************************
# ALMA - Atacama Large Millimiter Array
# (c) Associated Universities Inc., 2005
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
#
# "@(#) $Id: EventRecorder.py,v 1.1 2010/10/01 17:20:48 javarias Exp $"
#
# who       when        what
# --------  ----------  ----------------------------------------------
# rhiriart  2008-01-14  created
#

 
Modules
       
pickle
sys
time

 
Classes
       
Acspy.Nc.Consumer.Consumer(CosNotifyComm__POA.StructuredPushConsumer, Acspy.Nc.CommonNC.CommonNC)
EventRecorder
Event
Player

 
class Event
     Methods defined here:
__init__(self, publisher, name, evst)
getEventStruct(self)
getName(self)
publish(self)

 
class EventRecorder(Acspy.Nc.Consumer.Consumer)
    
Method resolution order:
EventRecorder
Acspy.Nc.Consumer.Consumer
CosNotifyComm__POA.StructuredPushConsumer
CosNotifyComm__POA.NotifyPublish
omniORB.PortableServer.Servant
Acspy.Nc.CommonNC.CommonNC
__builtin__.object

Methods defined here:
__init__(self, channel_name)
Constructor.
 
Parameters:
 
channel_name Channel name.
begin(self)
Begin the event recording session.
end(self)
End the event recording session.
processEvent(self, type_name=None, event_name=None, corba_any=None, se=None)
This method gets called when an event is received.
It is overriding Consumer.processEvent().
replaceXMLEntities(self, s)
Replaces special characters of its corresponding XML entities.
 
& -> &
' -> '
< -> &lt;
> -> &gt;
" -> &quot;

Methods inherited from Acspy.Nc.Consumer.Consumer:
addFilter(self, type_of_event, filter_exp)
add a filter.
 
Parameters:
- type_of_event is the actual Python class for the IDL struct.
- filter_exp is an EXTENDED_TCL string.
 
Returns: The ID of the newly created filter (positive integer?)
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
addSubscription(self, name, handler_function=None)
add a subscription to a given type.
 
Parameters
- name is the actual Python class for the IDL struct.
- handler_function If a structured event is received and the
registerHandler method has been defined on that SEs type_name, the
handler_function must be able to process filterable_data[0].value.value().
In other words every time an event of this nature is received, the
Consumer object will first try to invoke the handler_function
using the REAL object extracted from the CORBA Any in the structured
event located at the the first position of the filterable_data list.
IF THIS FAILS, the Consumer simply passes the event to the
processEvent(...) method which will have hopefully been overriden by
the developer.
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
consumerReady(self)
Consumer can now begin receiving events after invoking consumerReady.
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
disconnect(self)
Consumer client must call this to disconnect from notification channel.
Once disconnect has been called, the Consumer object should be treated
as if it has been deleted.
 
Parameters: None
 
Returns: Nothing
 
Raises: Nothing
disconnect_structured_push_consumer(self)
Called by a supplier to inform this consumer it is disconnecting from
the channel. Developer code must never call this.
 
Parameters: None
 
Returns: Nothing
 
Raises: Nothing
getFilterLanguage(self)
This method returns a constant character pointer to the type of filter
constraint language to be used for filtering events which is normally
equivalent to acsnc::FILTER_LANGUAGE_NAME. Override to change this
behavior.
 
Parameters: None
 
Returns: string
 
Raises: nothing
initCORBA(self)
Handles all the CORBA involved in creating a Consumer.
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
offer_change(self, added, removed)
Called by a supplier to inform this consumer its offering a change in the
events in publishing. Developer code must never call this.
 
Parameters:
- added is a list of domain/type pairs a supplier will begin publishing
- removed is a list of domain/type pairs a supplier will stop
publishing
 
Returns: Nothing
 
Raises: Nothing
push_structured_event(self, event)
CORBA method that is invoked by suppliers. If a correct handler function
has been provided via the addSubscription method, this is used to do
something useful with the event. Furthermore, if the user-defined handler
function raises an exception, this is caught and the processEvent
method is also invoked. Otherwise, its up to the developer to subclass
Consumer and override the processEvent method.
 
Parameters: event is a CosNotification.StructuredEvent
 
Returns: Nothing
 
Raises: Nothing
reconnect(self, ecf)
reinitConnection(self)
Consumer reinitializes the connection to the Channel.
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
removeFilter(self, filter_id)
remove a filter defined by filter_id.
 
Parameters: filter_id should be what is returned by the addFilter
method
 
Returns: 1 on success and 0 on failure.
 
Raises: Nothing
removeSubscription(self, name)
remove a subscription type.
 
Parameters: name is the actual Python class for the IDL struct.
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
resume(self)
Resume receiving structured events.  All events queued by the Supplier
will be forwarded to this Consumer instance.
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
suspend(self)
Stop receiving structured events.  All events published on this
channel will not be processed by this Consumer instance, but will
be queued for later delivery by the Supplier.  
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures

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

Methods inherited from Acspy.Nc.CommonNC.CommonNC:
combineChannelAndDomainName(self)
#------------------------------------------------------------------------------
configAdminProps(self)
Configures the administrative properties for this channel.
 
Only useful if the channel has not been created yet and this particular
method is being overriden.
 
Parameters: None
 
Returns: A sequence of Administrative properties.
 
Raises: Nothing
configQofS(self)
Configures the quality of service properties for this channel.
 
Only useful if the channel has not been created yet and this particular
method is being overriden.
 
Parameters: None
 
Returns: A sequence of Quality of Service properties.
 
Raises: Nothing
createNotificationChannel(self)
Creates the notification channel.  Only to be called if it does not already
exist.
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
destroyNotificationChannel(self)
Destroys the channel and unregisters it from the naming service. ONLY 
USE THIS METHOD IF YOU KNOW FOR CERTAIN THERE IS ONLY ONE SUPPLIER FOR 
THE CHANNEL!!!  To be used with extreme caution. Likely to be removed with
future versions of ACS.
 
Parameters: None
 
Returns: 1 on success and 0 on failure
 
Raises: Nothing
getChannelDomain(self)
This method returns a constant character pointer to the notification channel
domain which is normally equivalent to acscommon::ALMADOMAIN. The sole
reason this method is provided is to accomodate subclasses which
subscribe/publish non-ICD style events (ACS archiving channel for example).
In that case, the developer would override this method.
 
Parameters: None
 
Returns: a constant string.
 
Raises: Nothing
getChannelKind(self)
This method returns a constant character pointer to the "kind" of
notification channel as registered with the naming service (i.e., the kind
field of a CosNaming.Name) which is normally equivalent to
acscommon::NC_KIND. The sole reason this method is provided is to accomodate
subclasses which subscribe/publish non-ICD style events (ACS archiving
channel for example).In that case, the developer would override this method.
 
Parameters: None
 
Returns:a constant string.
 
Raises: Nothing
getChannelTimestamp(self)
getChannelTimestampKind(self)
Naming context Kind value used to bind the channel with its creation time
Parameters: None
 
Returns:a constant string.
 
Raises: Nothing
getNotificationFactoryName(self)
This method returns the name of the notification service as registered
with the CORBA Naming Service.
 
Parameters: None
 
Returns: pointer to a constant string. Normally
acscommon::NOTIFICATION_FACTORY_NAME
 
Raises: Nothing
getNotificationFactoryNameForChannel(self, channel, domain=None)
This method returns the name of the notification service for the channel
or domain from the configuration information given in the CDB.
 
Parameters:
- channel is the channel name of the desired factory
- domain is the domain of the desired factory
 
Returns: string containing the factory name or None
 
Raises: Nothing
iniChannelTimestamp(self)
setChannelTimestamp(self)
set_autoreconnect(self, autoreconnect)
Set autoreconnection on/off in case the Notify Service restarted.
 
Params: Nothing
 
Returns: Nothing
 
Raises: Nothing

 
class Player
     Methods defined here:
__getitem__(self, i)
Overriden indexing operation.
__init__(self, file_name)
Constructor.
 
Parameters:
file_name - The name of a previously recorded event consumer session. 
            This file should have been created with the EventRecorder
            class.
__len__(self)
Overriden length operation.
restoreXMLEntities(self, s)
Utilitiy function. Replaces XML entities for its respective characters.
 
&amp   -> &
&apos  -> '
&lt;   -> <
&gt;   -> >
&quot; -> "