1 package org.jacorb.notification.servant; 2 3 22 23 import org.apache.avalon.framework.configuration.Configuration; 24 import org.jacorb.notification.MessageFactory; 25 import org.jacorb.notification.OfferManager; 26 import org.jacorb.notification.SubscriptionManager; 27 import org.jacorb.notification.engine.TaskProcessor; 28 import org.jacorb.notification.interfaces.Message; 29 import org.omg.CORBA.Any ; 30 import org.omg.CORBA.ORB ; 31 import org.omg.CosEventChannelAdmin.AlreadyConnected; 32 import org.omg.CosEventComm.Disconnected; 33 import org.omg.CosEventComm.PushSupplier; 34 import org.omg.CosNotifyChannelAdmin.ProxyConsumerHelper; 35 import org.omg.CosNotifyChannelAdmin.ProxyPushConsumerOperations; 36 import org.omg.CosNotifyChannelAdmin.ProxyPushConsumerPOATie; 37 import org.omg.CosNotifyChannelAdmin.ProxyType; 38 import org.omg.CosNotifyChannelAdmin.SupplierAdmin; 39 import org.omg.PortableServer.POA ; 40 import org.omg.PortableServer.Servant ; 41 42 46 47 public class ProxyPushConsumerImpl extends AbstractProxyConsumer implements 48 ProxyPushConsumerOperations 49 { 50 private PushSupplier pushSupplier_; 51 52 54 public ProxyPushConsumerImpl(IAdmin admin, ORB orb, POA poa, Configuration conf, 55 TaskProcessor taskProcessor, MessageFactory messageFactory, 56 SupplierAdmin supplierAdmin, OfferManager offerManager, 57 SubscriptionManager subscriptionManager) 58 { 59 super(admin, orb, poa, conf, taskProcessor, messageFactory, supplierAdmin, offerManager, 60 subscriptionManager); 61 } 62 63 public ProxyType MyType() 64 { 65 return ProxyType.PUSH_ANY; 66 } 67 68 public void disconnect_push_consumer() 69 { 70 destroy(); 71 } 72 73 protected void disconnectClient() 74 { 75 if (pushSupplier_ != null) 76 { 77 pushSupplier_.disconnect_push_supplier(); 78 pushSupplier_ = null; 79 } 80 } 81 82 85 public void push(Any event) throws Disconnected 86 { 87 checkStillConnected(); 88 89 logger_.debug("push Any into the Channel"); 90 91 Message _mesg = getMessageFactory().newMessage(event, this); 92 93 checkMessageProperties(_mesg); 94 95 processMessage(_mesg); 96 } 97 98 public void connect_any_push_supplier(org.omg.CosEventComm.PushSupplier pushSupplier) 99 throws AlreadyConnected 100 { 101 logger_.info("connect any_push_supplier"); 102 103 checkIsNotConnected(); 104 105 pushSupplier_ = pushSupplier; 106 107 connectClient(pushSupplier); 108 } 109 110 public synchronized Servant getServant() 111 { 112 if (thisServant_ == null) 113 { 114 thisServant_ = new ProxyPushConsumerPOATie(this); 115 } 116 117 return thisServant_; 118 } 119 120 public org.omg.CORBA.Object activate() 121 { 122 return ProxyConsumerHelper.narrow(getServant()._this_object(getORB())); 123 } 124 } | Popular Tags |