org.jacorb.events
Class ProxyPullSupplierImpl

java.lang.Object
  extended byorg.omg.PortableServer.Servant
      extended byorg.omg.CosEventChannelAdmin.ProxyPullSupplierPOA
          extended byorg.jacorb.events.ProxyPullSupplierImpl
All Implemented Interfaces:
InvokeHandler, ProxyPullSupplierOperations, PullSupplierOperations

public class ProxyPullSupplierImpl
extends ProxyPullSupplierPOA

Implementation of COSEventChannelAdmin interface; ProxyPullSupplier. This defines connect_pull_consumer(), disconnect_pull_supplier() and the all important pull() and try_pull() methods that the Consumer can call to actuall deliver a message. 2002/23/08 JFC OMG EventService Specification 1.1 page 2-7 states: "Registration is a two step process. An event-generating application first obtains a proxy consumer from a channel, then 'connects' to the proxy consumer by providing it with a supplier. ... The reason for the two step registration process..." Modifications to support the above have been made as well as to support section 2.1.5 "Disconnection Behavior" on page 2-4.

Version:
$Id: ProxyPullSupplierImpl.java,v 1.11 2004/05/06 12:39:58 nicolas Exp $
Author:
Jeff Carlson, Joerg v. Frantzius, Rainer Lischetzki, Gerald Brose

Constructor Summary
protected ProxyPullSupplierImpl(EventChannelImpl ec, ORB orb, POA poa)
          Constructor - to be called by EventChannel
 
Method Summary
 POA _default_POA()
          Override this method from the Servant baseclass.
 void connect_pull_consumer(PullConsumer pullConsumer)
          ProxyPullSupplier Interface: As stated by the EventService specification 1.1 section 2.3.5: "If a ProxyPullSupplier is already connected to a PullConsumer, then the AlreadyConnected exception is raised."
 void disconnect_pull_supplier()
          See EventService v 1.1 specification section 2.1.3.
 Any pull()
          PullSupplier Interface.
 void push_to_supplier(Any event)
          Have to be able to get to the internal list of events.
 Any try_pull(BooleanHolder hasEvent)
          PullSupplier Interface.
 
Methods inherited from class org.omg.CosEventChannelAdmin.ProxyPullSupplierPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_get_delegate, _get_interface_def, _get_interface, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyPullSupplierImpl

protected ProxyPullSupplierImpl(EventChannelImpl ec,
                                ORB orb,
                                POA poa)
Constructor - to be called by EventChannel

Method Detail

connect_pull_consumer

public void connect_pull_consumer(PullConsumer pullConsumer)
                           throws AlreadyConnected
ProxyPullSupplier Interface: As stated by the EventService specification 1.1 section 2.3.5: "If a ProxyPullSupplier is already connected to a PullConsumer, then the AlreadyConnected exception is raised." and "If a non-nil reference is passed to connect_push_supplier..." implying that a null reference is acceptable.

Throws:
AlreadyConnected

disconnect_pull_supplier

public void disconnect_pull_supplier()
See EventService v 1.1 specification section 2.1.3. 'disconnect_pull_supplier terminates the event communication; it releases resources used at the consumer to support event communication. Calling this causes the implementation to call disconnect_pull_consumer operation on the corresponding PullConsumer interface (if that iterface is known).' See EventService v 1.1 specification section 2.1.5. This method should adhere to the spec as it a) causes a call to the corresponding disconnect on the connected supplier, b) 'If a consumer or supplier has received a disconnect call and subsequently receives another disconnect call, it shall raise a CORBA::OBJECT_NOT_EXIST exception. See EventService v 1.1 specification section 2.3.5. If [a nil object reference is passed to connect_pull_consumer] a channel cannot invoke a disconnect_pull_consumer operation on the consumer.


pull

public Any pull()
         throws Disconnected
PullSupplier Interface. section 2.1.3 states that "The pull operation blocks until the event data is available or an exception is raised. It returns data to the consumer."

Throws:
Disconnected

try_pull

public Any try_pull(BooleanHolder hasEvent)
             throws Disconnected
PullSupplier Interface. section 2.1.3 states that "The try_pull operation does not block: if the event data is available, it returns the event data and sets the has_event parameter to true; if the event is not available, it sets the has_event parameter to false and the event data is returned as long with an undefined value. It seems that the event queue should be defined as a LIFO queue. Finton Bolton in his book Pure CORBA states that this is the "norm". I think that is really stupid. Who wants events in reverse order with a possibility of never getting the first messge? I will therefore implement this as a FIFO queue and wait for someone to convince me otherwise.

Throws:
Disconnected

push_to_supplier

public void push_to_supplier(Any event)
Have to be able to get to the internal list of events. This is how to add stuff to this list. I have to decide whether to a) just ignore the event, b) add the event to the queue and remove the oldest event, c) throw an runtime exception. Right now, I'm going with option b.


_default_POA

public POA _default_POA()
Override this method from the Servant baseclass. Fintan Bolton in his book "Pure CORBA" suggests that you override this method to avoid the risk that a servant object (like this one) could be activated by the wrong POA object.

Overrides:
_default_POA in class Servant