org.openorb.notify.impl
Class EventChannelImpl

java.lang.Object
  extended by org.omg.PortableServer.Servant
      extended by org.omg.CosNotifyChannelAdmin.EventChannelPOA
          extended by org.openorb.notify.impl.EventChannelImpl
All Implemented Interfaces:
org.omg.CORBA.portable.InvokeHandler, EventChannelOperations, AdminPropertiesAdminOperations, QoSAdminOperations, ChannelManagement, EventReceiver, PersistenceManagement

public class EventChannelImpl
extends EventChannelPOA
implements EventReceiver, PersistenceManagement, ChannelManagement

The EventChannel interface encapsulates the behaviors supported by a Notification Service event channel. This interface inherits from the EventChannel interface defined within the CosEventChannelAdmin module of the OMG Event Service, making an instance of the Notification Service EventChannel interface fully backward compatible with an OMG Event Service style untyped event channel. Inheritance of the EventChannel interface defined within the CosEventChannelAdmin module enables an instance of the EventChannel interface defined within the CosNotifyChannelAdmin module to create event service style ConsumerAdmin and SupplierAdmin instances. These instances can subsequently be used to create pure event service style proxy interfaces, which support connections to pure event service style suppliers and consumers. Note that while Notification Service style proxies and admin objects have unique identifiers associated with them, enabling their references to be obtained by invoking operations on the Notification Service style admin and event channel interfaces, Event Service style proxies and admin objects do not have associated unique identifiers, and thus cannot be returned by invoking an operation on the Notification Service style admin or event channel interfaces. The EventChannel interface defined within the CosNotifyChannelAdmin module also inherits from the QoSAdmin and the AdminPropertiesAdmin interfaces defined within the CosNotification module. Inheritance of these interfaces enables a Notification Service style event channel to manage lists of associated QoS and administrative properties, respectively. Locally, the EventChannel interface supports a readonly attribute which maintains a reference to the EventChannelFactory instance that created it. In addition, each instance of the EventChannel interface has an associated default ConsumerAdmin and an associated default SupplierAdmin instance, both of which exist upon creation of the channel and which have the unique identifier of zero (note that admin object identifiers only need to be unique among a given type of admin, implying that the identifiers assigned to ConsumerAdmin objects can overlap those assigned to SupplierAdmin objects). The EventChannel interface supports readonly attributes which maintain references to these default admin objects. The EventChannel interface supports operations which create new ConsumerAdmin and SupplierAdmin instances. In addition, the EventChannel interface supports operations which can return references to the ConsumerAdmin and SupplierAdmin instances associated with a given EventChannel instance, given the unique identifier of an admin object as input. Finally, the EventChannel interface supports operations which return the sequence of unique identifiers of all ConsumerAdmin and SupplierAdmin instances associated with a given EventChannel instance.

Author:
Olivier Modica

Constructor Summary
EventChannelImpl(EventChannelFactoryImpl factory, EventChannel pssEventChannel, org.omg.PortableServer.POA poa, Logger logger)
          Constructor -- used for recovery only
EventChannelImpl(EventChannelFactoryImpl factory, org.omg.CORBA.ORB orb, org.omg.PortableServer.POA poa, Property[] qosProperties, Property[] adminProperties, int channelId, Logger logger)
          Default constructor
 
Method Summary
 boolean canConnectConsumer()
          Method invoked to check if the MaxConsumers admin property applies
 boolean canConnectSupplier()
          Method invoked to check if the MaxSuppliers admin property applies
 boolean canDispatchNewEvent()
          Method invoked to check if the MaxQueueLength admin property applies
 void consumerAdminRecovered(int id, ConsumerAdminImpl consumerAdmin)
          This method is invoked when a ConsumerAdmin was recovered
 ConsumerAdmin default_consumer_admin()
          The default_consumer_admin attribute is a readonly attribute which maintains a reference to the default ConsumerAdmin instance associated with the target EventChannel instance.
 FilterFactory default_filter_factory()
          The default_filter_factory attribute is a readonly attribute which maintains an object reference to the default factory to be used by the EventChannel instance with which it's associated for creating filter objects.
 SupplierAdmin default_supplier_admin()
          The default_supplier_admin attribute is a readonly attribute which maintains a reference to the default SupplierAdmin instance associated with the target EventChannel instance.
 void destroy()
          Operation destroy
 ConsumerAdmin for_consumers()
          Operation for_consumers
 SupplierAdmin for_suppliers()
          Operation for_suppliers
 Property[] get_admin()
          The get_admin operation takes no input parameters, and returns a sequence of name-value pairs which encapsulates the current administrative settings for the target channel.
 int[] get_all_consumeradmins()
          The get_all_consumeradmins operation takes no input parameters and returns a sequence of the unique identifiers assigned to all Notification Service style ConsumerAdmin instances which have been created by the target EventChannel instance.
 int[] get_all_supplieradmins()
          The get_all_supplieradmins operation takes no input parameters and returns a sequence of the unique identifiers assigned to all Notification Service style SupplierAdmin instances which have been created by the target EventChannel instance.
 ConsumerAdmin get_consumeradmin(int id)
          The get_consumeradmin operation returns a reference to one of the ConsumerAdmin instances associated with the target EventChannel instance.
 Property[] get_qos()
          The get_qos operation takes no input parameters, and returns a sequence of name-value pairs which encapsulates the current quality of service settings for the target object (which could be an Event Channel, Admin, or Proxy object).
 SupplierAdmin get_supplieradmin(int id)
          The get_supplieradmin operation returns a reference to one of the SupplierAdmin instances associated with the target EventChannel instance.
 java.lang.String getId()
          Get the ID of the channel
 java.lang.Object getNotifyProperty(java.lang.String key)
          Method invoked to get the value of a property defined in the notification module
 byte[] getPid()
          Returns the pid of the persistent/transient object
 boolean isConsumerAdminMaxPerformance()
          The methods returns true if the consumer admin threads should be configured as MaxPerformance
 boolean isConsumerProxyMaxPerformance()
          The methods returns true if the supplier proxy threads should be configured as MaxPerformance
 boolean isEventQueueLogged()
          TODO
 boolean isFilterEvaluationLogged()
          TODO
 boolean isQueueMaxPerformance()
          The methods returns true if the event queue should be configured as MaxPerformance
 boolean isSupplierAdminMaxPerformance()
          The methods returns true if the supplier admin threads should be configured as MaxPerformance
 boolean isSupplierProxyMaxPerformance()
          The methods returns true if the consumer proxy threads should be configured as MaxPerformance
 EventChannelFactory MyFactory()
          The MyFactory attribute is a readonly attribute which maintains the object reference of the event channel factory that created a given Notification Service EventChannel instance.
 ConsumerAdmin new_for_consumers(InterFilterGroupOperator op, org.omg.CORBA.IntHolder id)
          The new_for_consumers operation is invoked to create a new Notification Service style ConsumerAdmin instance.
 SupplierAdmin new_for_suppliers(InterFilterGroupOperator op, org.omg.CORBA.IntHolder id)
          The new_for_suppliers operation is invoked to create a new Notification Service style SupplierAdmin instance.
 void receiveEvent(java.lang.Object event)
          New event available
 void reportConsumerAdminDestruction(byte[] adminPid)
          A consumer admin has been destroyed
 void reportConsumerConnection()
          A proxy consumer has been created
 void reportConsumerDisconnection()
          A proxy consumer has been destroyed
 void reportEventDelivery(int consumerAdminId, int eventPid)
          An event has been delivered or discarded
 void reportEventTypesPublished(EventType[] published, EventType[] unpublished, org.omg.CORBA.Object source)
          Method invoked when an EventType is being subscribed by a consumer.
 void reportEventTypesSubscribed(EventType[] subscribed, EventType[] unsubscribed, org.omg.CORBA.Object source)
          Method invoked when an EventType is being subscribed by a consumer
 void reportSupplierAdminDestruction(byte[] adminPid)
          A supplier admin has been destroyed
 void reportSupplierConnection()
          A proxy supplier has been created
 void reportSupplierDisconnection()
          A proxy supplier has been destroyed
 void set_admin(Property[] admin)
          The set_admin operation takes as an input parameter a sequence of name-value pairs which encapsulates administrative property settings that a client is requesting that the target channel support.
 void set_qos(Property[] qos)
          The set_qos operation takes as an input parameter a sequence of name-value pairs which encapsulates quality of service property settings that a client is requesting that the target object (which could be an Event Channel, Admin, or Proxy object) support as its default quality of service.
 void supplierAdminRecovered(int id, SupplierAdminImpl supplierAdmin)
          This method is invoked when a SupplierAdmin was recovered
 void validate_qos(Property[] required_qos, NamedPropertyRangeSeqHolder available_qos)
          The validate_qos operation accepts as input a sequence of QoS property name-value pairs which specify a set of QoS settings that a client would like to know if the target object is capable of supporting.
 
Methods inherited from class org.omg.CosNotifyChannelAdmin.EventChannelPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventChannelImpl

public EventChannelImpl(EventChannelFactoryImpl factory,
                        org.omg.CORBA.ORB orb,
                        org.omg.PortableServer.POA poa,
                        Property[] qosProperties,
                        Property[] adminProperties,
                        int channelId,
                        Logger logger)
Default constructor


EventChannelImpl

public EventChannelImpl(EventChannelFactoryImpl factory,
                        EventChannel pssEventChannel,
                        org.omg.PortableServer.POA poa,
                        Logger logger)
Constructor -- used for recovery only

Method Detail

MyFactory

public EventChannelFactory MyFactory()
The MyFactory attribute is a readonly attribute which maintains the object reference of the event channel factory that created a given Notification Service EventChannel instance.

Returns:
Channel's factory

default_consumer_admin

public ConsumerAdmin default_consumer_admin()
The default_consumer_admin attribute is a readonly attribute which maintains a reference to the default ConsumerAdmin instance associated with the target EventChannel instance. Each EventChannel instance has an associated default ConsumerAdmin instance, which exists upon creation of the channel and is assigned the unique identifier of zero. Subsequently, clients can create additional Event Service style ConsumerAdmin instances by invoking the inherited for_consumers operation, and additional Notification Service style ConsumerAdmin instances by invoking the new_for_consumers operation defined by the EventChannel interface.

Returns:
the default consumer admin

default_supplier_admin

public SupplierAdmin default_supplier_admin()
The default_supplier_admin attribute is a readonly attribute which maintains a reference to the default SupplierAdmin instance associated with the target EventChannel instance. Each EventChannel instance has an associated default SupplierAdmin instance, which exists upon creation of the channel and is assigned the unique identifier of zero. Subsequently, clients can create additional Event Service style SupplierAdmin instances by invoking the inherited for_suppliers operation, and additional Notification Service style SupplierAdmin instances by invoking the new_for_suppliers operation defined by the EventChannel interface.

Returns:
the default supplier admin

default_filter_factory

public FilterFactory default_filter_factory()
The default_filter_factory attribute is a readonly attribute which maintains an object reference to the default factory to be used by the EventChannel instance with which it's associated for creating filter objects. If the target channel does not support a default filter factory, the attribute will maintain the value of OBJECT_NIL.

Returns:
the default filter factory

new_for_consumers

public ConsumerAdmin new_for_consumers(InterFilterGroupOperator op,
                                       org.omg.CORBA.IntHolder id)
The new_for_consumers operation is invoked to create a new Notification Service style ConsumerAdmin instance. The operation accepts as an input parameter a boolean flag which indicates whether AND or OR semantics will be used when combining the filter objects associated with the newly created ConsumerAdmin instance with those associated with a supplier proxy which was created by the ConsumerAdmin during the evaluation of each event against a set of filter objects. The new instance is assigned a unique identifier by the target EventChannel instance that is unique among all ConsumerAdmin instances currently associated with the channel. Upon completion, the operation returns the reference to the new ConsumerAdmin instance as the result of the operation, and the unique identifier assigned to the new ConsumerAdmin instance as the output parameter.

Parameters:
op - Operator of Filters' composition (between consumer filters and proxies filters)
id - Id of the new consumer admin
Returns:
The new consumer Admin

new_for_suppliers

public SupplierAdmin new_for_suppliers(InterFilterGroupOperator op,
                                       org.omg.CORBA.IntHolder id)
The new_for_suppliers operation is invoked to create a new Notification Service style SupplierAdmin instance. The operation accepts as an input parameter a boolean flag which indicates whether AND or OR semantics will be used when combining the filter objects associated with the newly created SupplierAdmin instance with those associated with a consumer proxy which was created by the SupplierAdmin during the evaluation of each event against a set of filter objects. The new instance is assigned a unique identifier by the target EventChannel instance that is unique among all SupplierAdmin instances currently associated with the channel. Upon completion, the operation returns the reference to the new SupplierAdmin instance as the result of the operation, and the unique identifier assigned to the new SupplierAdmin instance as the output parameter.

Parameters:
op - Operator of Filters' composition (between supplier filters and proxies filters)
id - Id of the new consumer admin
Returns:
The new supplier Admin

get_consumeradmin

public ConsumerAdmin get_consumeradmin(int id)
                                throws AdminNotFound
The get_consumeradmin operation returns a reference to one of the ConsumerAdmin instances associated with the target EventChannel instance. The operation accepts as an input parameter a numeric value which is intended to be the unique identifier of one of the ConsumerAdmin instances associated with the target EventChannel instance. If this turns out to be the case, the object reference of the associated ConsumerAdmin instance is returned as the operation result. Otherwise, the AdminNotFound exception is raised. Note that while a Notification Service style event channel can support both Event Service and Notification Service style ConsumerAdmin instances, only Notification Service style ConsumerAdmin instances have associated unique identifiers.

Parameters:
id - Id of consumer admin to retreive
Returns:
The requested consumer admin
Throws:
AdminNotFound - Id doesn't correspond to any consumer admin

get_supplieradmin

public SupplierAdmin get_supplieradmin(int id)
                                throws AdminNotFound
The get_supplieradmin operation returns a reference to one of the SupplierAdmin instances associated with the target EventChannel instance. The operation accepts as an input parameter a numeric value which is intended to be the unique identifier of one of the SupplierAdmin instances associated with the target EventChannel instance. If this turns out to be the case, the object reference of the associated SupplierAdmin instance is returned as the operation result. Otherwise, the AdminNotFound exception is raised. Note that while a Notification Service style event channel can support both Event Service and Notification Service style SupplierAdmin instances, only Notification Service style SupplierAdmin instances have associated unique identifiers.

Parameters:
id - Id of supplier admin to retreive
Returns:
The requested supplier admin
Throws:
AdminNotFound - Id doesn't correspond to any supplier admin

get_all_consumeradmins

public int[] get_all_consumeradmins()
The get_all_consumeradmins operation takes no input parameters and returns a sequence of the unique identifiers assigned to all Notification Service style ConsumerAdmin instances which have been created by the target EventChannel instance.

Returns:
Array of all consumer admin ID

get_all_supplieradmins

public int[] get_all_supplieradmins()
The get_all_supplieradmins operation takes no input parameters and returns a sequence of the unique identifiers assigned to all Notification Service style SupplierAdmin instances which have been created by the target EventChannel instance.

Returns:
Array of all supplier admin ID

get_qos

public Property[] get_qos()
The get_qos operation takes no input parameters, and returns a sequence of name-value pairs which encapsulates the current quality of service settings for the target object (which could be an Event Channel, Admin, or Proxy object).

Specified by:
get_qos in interface QoSAdminOperations
Returns:
Object QosProperties

set_qos

public void set_qos(Property[] qos)
             throws UnsupportedQoS
The set_qos operation takes as an input parameter a sequence of name-value pairs which encapsulates quality of service property settings that a client is requesting that the target object (which could be an Event Channel, Admin, or Proxy object) support as its default quality of service. If the implementation of the target object is not capable of supporting any of the requested quality of service settings, or if any of the requested settings would be in conflict with a QoS property defined at a higher level of the object hierarchy with respect to QoS , the UnsupportedQoS exception is raised. This exception contains as data a sequence of data structures, each of which identifies the name of a QoS property in the input list whose requested setting could not be satisfied, along with an error code and a range of settings for the property which could be satisfied. The meanings of the error codes which might be returned are described in Table 2-5 of CosNotification Service specification

Specified by:
set_qos in interface QoSAdminOperations
Parameters:
qos - QosProperties to assign to object
Throws:
UnsupportedQoS

validate_qos

public void validate_qos(Property[] required_qos,
                         NamedPropertyRangeSeqHolder available_qos)
                  throws UnsupportedQoS
The validate_qos operation accepts as input a sequence of QoS property name-value pairs which specify a set of QoS settings that a client would like to know if the target object is capable of supporting. If the any of the requested settings could not be satisfied by the target object, the operation raises the UnsupportedQoS exception. This exception contains as data a sequence of data structures, each of which identifies the name of a QoS property in the input list whose requested setting could not be satisfied, along with an error code and a range of settings for the property which could be satisfied. The meanings of the error codes which might be returned are described in Table 2-5. If all requested QoS property value settings could be satisfied by the target object, the operation returns successfully (without actually setting the QoS properties on the target object) with an output parameter that contains a sequence of PropertyRange data structures. Each element in this sequence includes the name of a an additional QoS property supported by the target object which could have been included on the input list and resulted in a successful return from the operation., along with the range of values that would have been acceptable for each such property.

Specified by:
validate_qos in interface QoSAdminOperations
Parameters:
required_qos -
available_qos -
Throws:
UnsupportedQoS

get_admin

public Property[] get_admin()
The get_admin operation takes no input parameters, and returns a sequence of name-value pairs which encapsulates the current administrative settings for the target channel.

Specified by:
get_admin in interface AdminPropertiesAdminOperations
Returns:
All Admin Properties

set_admin

public void set_admin(Property[] admin)
               throws UnsupportedAdmin
The set_admin operation takes as an input parameter a sequence of name-value pairs which encapsulates administrative property settings that a client is requesting that the target channel support. If the implementation of the target object is not capable of supporting any of the requested administrative property settings, the UnsupportedAdmin exception is raised. This exception has associated with it a list of name-value pairs of which each name identifies an administrative property whose requested setting could not be satisfied, and each associated value the closest setting for that property which could be satisfied.

Specified by:
set_admin in interface AdminPropertiesAdminOperations
Parameters:
admin - Array of admin property
Throws:
UnsupportedAdmin - If implementation doesn't support a property

for_consumers

public ConsumerAdmin for_consumers()
Operation for_consumers

Specified by:
for_consumers in interface EventChannelOperations

for_suppliers

public SupplierAdmin for_suppliers()
Operation for_suppliers

Specified by:
for_suppliers in interface EventChannelOperations

destroy

public void destroy()
Operation destroy

Specified by:
destroy in interface EventChannelOperations

receiveEvent

public void receiveEvent(java.lang.Object event)
New event available

Specified by:
receiveEvent in interface EventReceiver

getId

public java.lang.String getId()
Get the ID of the channel

Specified by:
getId in interface ChannelManagement

consumerAdminRecovered

public void consumerAdminRecovered(int id,
                                   ConsumerAdminImpl consumerAdmin)
This method is invoked when a ConsumerAdmin was recovered

Specified by:
consumerAdminRecovered in interface ChannelManagement

supplierAdminRecovered

public void supplierAdminRecovered(int id,
                                   SupplierAdminImpl supplierAdmin)
This method is invoked when a SupplierAdmin was recovered

Specified by:
supplierAdminRecovered in interface ChannelManagement

reportConsumerAdminDestruction

public void reportConsumerAdminDestruction(byte[] adminPid)
A consumer admin has been destroyed

Specified by:
reportConsumerAdminDestruction in interface ChannelManagement

reportSupplierAdminDestruction

public void reportSupplierAdminDestruction(byte[] adminPid)
A supplier admin has been destroyed

Specified by:
reportSupplierAdminDestruction in interface ChannelManagement

reportSupplierConnection

public void reportSupplierConnection()
A proxy supplier has been created

Specified by:
reportSupplierConnection in interface ChannelManagement

canConnectConsumer

public boolean canConnectConsumer()
Method invoked to check if the MaxConsumers admin property applies

Specified by:
canConnectConsumer in interface ChannelManagement

reportConsumerConnection

public void reportConsumerConnection()
A proxy consumer has been created

Specified by:
reportConsumerConnection in interface ChannelManagement

canConnectSupplier

public boolean canConnectSupplier()
Method invoked to check if the MaxSuppliers admin property applies

Specified by:
canConnectSupplier in interface ChannelManagement

reportSupplierDisconnection

public void reportSupplierDisconnection()
A proxy supplier has been destroyed

Specified by:
reportSupplierDisconnection in interface ChannelManagement

reportConsumerDisconnection

public void reportConsumerDisconnection()
A proxy consumer has been destroyed

Specified by:
reportConsumerDisconnection in interface ChannelManagement

reportEventDelivery

public void reportEventDelivery(int consumerAdminId,
                                int eventPid)
An event has been delivered or discarded

Specified by:
reportEventDelivery in interface ChannelManagement

canDispatchNewEvent

public boolean canDispatchNewEvent()
Method invoked to check if the MaxQueueLength admin property applies

Specified by:
canDispatchNewEvent in interface ChannelManagement

reportEventTypesPublished

public void reportEventTypesPublished(EventType[] published,
                                      EventType[] unpublished,
                                      org.omg.CORBA.Object source)
Method invoked when an EventType is being subscribed by a consumer. At this point, published and unpublished lists should not have the same event types.

Specified by:
reportEventTypesPublished in interface ChannelManagement

reportEventTypesSubscribed

public void reportEventTypesSubscribed(EventType[] subscribed,
                                       EventType[] unsubscribed,
                                       org.omg.CORBA.Object source)
Method invoked when an EventType is being subscribed by a consumer

Specified by:
reportEventTypesSubscribed in interface ChannelManagement

getNotifyProperty

public java.lang.Object getNotifyProperty(java.lang.String key)
Method invoked to get the value of a property defined in the notification module

Specified by:
getNotifyProperty in interface ChannelManagement

isQueueMaxPerformance

public boolean isQueueMaxPerformance()
The methods returns true if the event queue should be configured as MaxPerformance

Specified by:
isQueueMaxPerformance in interface ChannelManagement

isSupplierAdminMaxPerformance

public boolean isSupplierAdminMaxPerformance()
The methods returns true if the supplier admin threads should be configured as MaxPerformance

Specified by:
isSupplierAdminMaxPerformance in interface ChannelManagement

isConsumerAdminMaxPerformance

public boolean isConsumerAdminMaxPerformance()
The methods returns true if the consumer admin threads should be configured as MaxPerformance

Specified by:
isConsumerAdminMaxPerformance in interface ChannelManagement

isSupplierProxyMaxPerformance

public boolean isSupplierProxyMaxPerformance()
The methods returns true if the consumer proxy threads should be configured as MaxPerformance

Specified by:
isSupplierProxyMaxPerformance in interface ChannelManagement

isConsumerProxyMaxPerformance

public boolean isConsumerProxyMaxPerformance()
The methods returns true if the supplier proxy threads should be configured as MaxPerformance

Specified by:
isConsumerProxyMaxPerformance in interface ChannelManagement

isEventQueueLogged

public boolean isEventQueueLogged()
TODO

Specified by:
isEventQueueLogged in interface ChannelManagement

isFilterEvaluationLogged

public boolean isFilterEvaluationLogged()
TODO

Specified by:
isFilterEvaluationLogged in interface ChannelManagement

getPid

public byte[] getPid()
Returns the pid of the persistent/transient object

Specified by:
getPid in interface PersistenceManagement