com.isti.openorbutil
Class EvtChConsumer

java.lang.Object
  extended by com.isti.openorbutil.EvtChConsumer

public abstract class EvtChConsumer
extends java.lang.Object

Class EvtChConsumer defines a generic Notification Service event channel consumer object that receives objects as they appear in the event channel. One of the 'push()' methods should be overridden to receive events.


Nested Class Summary
protected  class EvtChConsumer.AnyPushCallBack
          Class AnyPushCallBack receives 'Any' messages from the event channel and passes them back to the parent class.
protected  class EvtChConsumer.StructuredEventPushCallBack
          Class StructuredEventPushCallBack receives structured-event messages from the event channel and passes them back to the parent class.
 
Field Summary
protected static java.lang.String CONSTRUCTOR_ERR_STR
           
protected  org.omg.CosNotifyChannelAdmin.EventChannel evtChObj
           
protected  org.omg.CORBA.ORB orbObj
           
protected  org.omg.CosNotifyChannelAdmin.ProxyPushSupplier pushSupplierObj
           
protected  boolean structuredEventsFlag
           
protected  org.omg.CosNotifyChannelAdmin.StructuredProxyPushSupplier structuredPushSupplierObj
           
 
Constructor Summary
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj)
          Creates a generic Notification Service event channel consumer object, using 'Any' events.
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj, boolean structuredEventsFlag)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj, boolean structuredEventsFlag, EvtChEventType[] evtTypeArr)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj, boolean structuredEventsFlag, org.omg.CosNotifyFilter.Filter filterObj)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj, EvtChEventType[] evtTypeArr)
          Creates a generic Notification Service event channel consumer object, using structured events.
EvtChConsumer(org.omg.CORBA.ORB orbObj, org.omg.CosNotifyChannelAdmin.EventChannel evtChObj, org.omg.CosNotifyFilter.Filter filterObj)
          Creates a generic Notification Service event channel consumer object, using structured events.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName)
          Creates a generic Notification Service event channel consumer object, using 'Any' events.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName, boolean structuredEventsFlag)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName, boolean structuredEventsFlag, EvtChEventType[] evtTypeArr)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName, boolean structuredEventsFlag, org.omg.CosNotifyFilter.Filter filterObj)
          Creates a generic Notification Service event channel consumer object.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName, EvtChEventType[] evtTypeArr)
          Creates a generic Notification Service event channel consumer object, using structured events.
EvtChConsumer(org.omg.CORBA.ORB orbObj, java.lang.String serviceName, org.omg.CosNotifyFilter.Filter filterObj)
          Creates a generic Notification Service event channel consumer object, using structured events.
 
Method Summary
 org.omg.CosNotifyFilter.Filter buildFilterFromTypes(EvtChEventType[] evtTypeArr)
          Builds a Notification Service filter object from an array of event-type objects.
 void disconnectImpl()
          Disconnects this object from the event channel.
 org.omg.CosNotifyChannelAdmin.EventChannel getEvtChObj()
          Returns the event channel object used by this object.
 org.omg.CosNotifyChannelAdmin.ProxySupplier getPushSupplierObj()
          Returns the push-supplier object for this consumer object.
 void push(org.omg.CORBA.Any anyObj)
          This method is called when an object arrives over the event channel.
 void push(java.lang.String str)
          This method is called when a String object arrives over the event channel.
 void push(java.lang.String domainNameStr, java.lang.String typeNameStr, java.lang.String eventNameStr, org.omg.CORBA.Any anyObj)
          This method is called when a structured-event object arrives over the event channel.
 void push(java.lang.String domainNameStr, java.lang.String typeNameStr, java.lang.String eventNameStr, java.lang.String str)
          This method is called when a structured-event object arrives over the event channel.
 void push(org.omg.CosNotification.StructuredEvent structuredEventObj)
          This method is called when a structured-event object arrives over the event channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

orbObj

protected org.omg.CORBA.ORB orbObj

evtChObj

protected org.omg.CosNotifyChannelAdmin.EventChannel evtChObj

pushSupplierObj

protected org.omg.CosNotifyChannelAdmin.ProxyPushSupplier pushSupplierObj

structuredPushSupplierObj

protected org.omg.CosNotifyChannelAdmin.StructuredProxyPushSupplier structuredPushSupplierObj

structuredEventsFlag

protected boolean structuredEventsFlag

CONSTRUCTOR_ERR_STR

protected static final java.lang.String CONSTRUCTOR_ERR_STR
See Also:
Constant Field Values
Constructor Detail

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj,
                     boolean structuredEventsFlag,
                     org.omg.CosNotifyFilter.Filter filterObj)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
filterObj - the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj,
                     org.omg.CosNotifyFilter.Filter filterObj)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
filterObj - the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj,
                     boolean structuredEventsFlag,
                     EvtChEventType[] evtTypeArr)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object. An array of 'EvtChEventType' objects may be given to setup an event filter, where only events that match one or more of the 'EvtChEventType' objects will be received, and a match consists of both the "domain" and "type" strings being the same as those in the event. Event filtering is only used with structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
evtTypeArr - the array of 'EvtChEventType' objects to use to build the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj,
                     EvtChEventType[] evtTypeArr)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using structured events. An array of 'EvtChEventType' objects may be given to setup an event filter, where only events that match one or more of the 'EvtChEventType' objects will be received, and a match consists of both the "domain" and "type" strings being the same as those in the event. Event filtering is only used with structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
evtTypeArr - the array of 'EvtChEventType' objects to use to build the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj,
                     boolean structuredEventsFlag)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     org.omg.CosNotifyChannelAdmin.EventChannel evtChObj)
              throws EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using 'Any' events.

Parameters:
orbObj - the CORBA ORB object to be used.
evtChObj - event channel object to use.
Throws:
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName,
                     boolean structuredEventsFlag,
                     org.omg.CosNotifyFilter.Filter filterObj)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
filterObj - the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName,
                     org.omg.CosNotifyFilter.Filter filterObj)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
filterObj - the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName,
                     boolean structuredEventsFlag,
                     EvtChEventType[] evtTypeArr)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object. An array of 'EvtChEventType' objects may be given to setup an event filter, where only events that match one or more of the 'EvtChEventType' objects will be received, and a match consists of both the "domain" and "type" strings being the same as those in the event. Event filtering is only used with structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
evtTypeArr - the array of 'EvtChEventType' objects to use to build the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName,
                     EvtChEventType[] evtTypeArr)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using structured events. An array of 'EvtChEventType' objects may be given to setup an event filter, where only events that match one or more of the 'EvtChEventType' objects will be received, and a match consists of both the "domain" and "type" strings being the same as those in the event. Event filtering is only used with structured events.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
evtTypeArr - the array of 'EvtChEventType' objects to use to build the Notification Service filter object to use for the filtering of structured events to be received by this consumer, or null for none.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName,
                     boolean structuredEventsFlag)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
structuredEventsFlag - true to use structured events, false to use 'Any' events.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.

EvtChConsumer

public EvtChConsumer(org.omg.CORBA.ORB orbObj,
                     java.lang.String serviceName)
              throws org.omg.CORBA.ORBPackage.InvalidName,
                     EvtChSetupException,
                     org.omg.CosEventChannelAdmin.AlreadyConnected,
                     org.omg.CosEventChannelAdmin.TypeError,
                     org.omg.CosNotifyChannelAdmin.AdminLimitExceeded
Creates a generic Notification Service event channel consumer object, using 'Any' events.

Parameters:
orbObj - the CORBA ORB object to be used.
serviceName - the name bound to the event channel to be used.
Throws:
org.omg.CORBA.ORBPackage.InvalidName - if the event channel name could not resolved.
EvtChSetupException - if the event channel could not be setup.
org.omg.CosEventChannelAdmin.AlreadyConnected - if the event channel is already connected.
org.omg.CosEventChannelAdmin.TypeError - if an error occurred when connecting to channel.
org.omg.CosNotifyChannelAdmin.AdminLimitExceeded - if the consumer admin could not be referenced.
Method Detail

disconnectImpl

public void disconnectImpl()
Disconnects this object from the event channel.


push

public void push(org.omg.CORBA.Any anyObj)
This method is called when an object arrives over the event channel. This method, or the "push(String)" method will want to be overridden in a subclass of this class. If not overridden, this method will attempt to convert the received object to a String and send it to the "push(String)" method.

Parameters:
anyObj - the received object.

push

public void push(java.lang.String str)
This method is called when a String object arrives over the event channel. This method, or the "push(Any)" method will want to be overridden in a subclass of this class.

Parameters:
str - the string to be sent.

push

public void push(org.omg.CosNotification.StructuredEvent structuredEventObj)
This method is called when a structured-event object arrives over the event channel. This method may be overridden to receive the event, or, if not then the event will passed along to the "push(String,String,String,Any)' method.

Parameters:
structuredEventObj - the received structured-event object.

push

public void push(java.lang.String domainNameStr,
                 java.lang.String typeNameStr,
                 java.lang.String eventNameStr,
                 org.omg.CORBA.Any anyObj)
This method is called when a structured-event object arrives over the event channel. This method may be overridden to receive the event, or, if not then the event will passed along to the "push(Any)' method.

Parameters:
domainNameStr - the domain name to use, or null for none.
typeNameStr - the type name to use, or null for none.
eventNameStr - the event name to use, or null for none.
anyObj - the 'Any' data object to use.

push

public void push(java.lang.String domainNameStr,
                 java.lang.String typeNameStr,
                 java.lang.String eventNameStr,
                 java.lang.String str)
This method is called when a structured-event object arrives over the event channel. This method may be overridden to receive the event, or, if not then this method will attempt to convert the received 'Any' object to a String and send it to the "push(String)" method.

Parameters:
domainNameStr - the domain name to use, or null for none.
typeNameStr - the type name to use, or null for none.
eventNameStr - the event name to use, or null for none.
str - the string to be sent.

getEvtChObj

public org.omg.CosNotifyChannelAdmin.EventChannel getEvtChObj()
Returns the event channel object used by this object.

Returns:
the event channel object used by this object.

getPushSupplierObj

public org.omg.CosNotifyChannelAdmin.ProxySupplier getPushSupplierObj()
Returns the push-supplier object for this consumer object.

Returns:
if structured are in use then a 'StructuredProxyPushSupplier' object; otherwise a 'ProxyPushSupplier' object.

buildFilterFromTypes

public final org.omg.CosNotifyFilter.Filter buildFilterFromTypes(EvtChEventType[] evtTypeArr)
                                                          throws EvtChSetupException
Builds a Notification Service filter object from an array of event-type objects. Event filtering is implemented such that only events that match one or more of the 'EvtChEventType' objects will be received, and a match consists of both the "domain" and "type" strings being the same as those in the event. Event filtering is only used with structured events.

Parameters:
evtTypeArr - the array of 'EvtChEventType' objects to use.
Returns:
A new 'Filter' object, or null if the given parameter is null.
Throws:
EvtChSetupException - if an error occurred while building the filter object.