1 package org.jacorb.notification.servant; 2 3 23 24 import org.apache.avalon.framework.configuration.Configuration; 25 import org.jacorb.notification.MessageFactory; 26 import org.jacorb.notification.OfferManager; 27 import org.jacorb.notification.SubscriptionManager; 28 import org.jacorb.notification.engine.TaskProcessor; 29 import org.jacorb.notification.interfaces.Message; 30 import org.omg.CORBA.ORB ; 31 import org.omg.CosEventChannelAdmin.AlreadyConnected; 32 import org.omg.CosEventComm.Disconnected; 33 import org.omg.CosNotification.StructuredEvent; 34 import org.omg.CosNotifyChannelAdmin.ProxyConsumerHelper; 35 import org.omg.CosNotifyChannelAdmin.ProxyType; 36 import org.omg.CosNotifyChannelAdmin.StructuredProxyPushConsumerOperations; 37 import org.omg.CosNotifyChannelAdmin.StructuredProxyPushConsumerPOATie; 38 import org.omg.CosNotifyChannelAdmin.SupplierAdmin; 39 import org.omg.CosNotifyComm.StructuredPushSupplier; 40 import org.omg.PortableServer.POA ; 41 import org.omg.PortableServer.Servant ; 42 43 47 48 public class StructuredProxyPushConsumerImpl extends AbstractProxyConsumer implements 49 StructuredProxyPushConsumerOperations 50 { 51 private StructuredPushSupplier pushSupplier_; 52 53 55 public StructuredProxyPushConsumerImpl(IAdmin admin, ORB orb, POA poa, Configuration conf, 56 TaskProcessor taskProcessor, MessageFactory mf, SupplierAdmin supplierAdmin, 57 OfferManager offerManager, SubscriptionManager subscriptionManager) 58 { 59 super(admin, orb, poa, conf, taskProcessor, mf, supplierAdmin, offerManager, subscriptionManager); 60 } 61 62 public ProxyType MyType() 63 { 64 return ProxyType.PUSH_STRUCTURED; 65 } 66 67 public void push_structured_event(StructuredEvent structuredEvent) throws Disconnected 68 { 69 checkStillConnected(); 70 Message _mesg = getMessageFactory().newMessage(structuredEvent, this); 71 72 checkMessageProperties(_mesg); 73 processMessage(_mesg); 74 } 75 76 public void disconnect_structured_push_consumer() 77 { 78 destroy(); 79 } 80 81 protected void disconnectClient() 82 { 83 logger_.info("disconnect structured_push_supplier"); 84 85 pushSupplier_.disconnect_structured_push_supplier(); 86 87 pushSupplier_ = null; 88 } 89 90 public void connect_structured_push_supplier(StructuredPushSupplier supplier) 91 throws AlreadyConnected 92 { 93 checkIsNotConnected(); 94 95 connectClient(supplier); 96 97 pushSupplier_ = supplier; 98 99 logger_.info("connect structured_push_supplier"); 100 } 101 102 public synchronized Servant getServant() 103 { 104 if (thisServant_ == null) 105 { 106 thisServant_ = new StructuredProxyPushConsumerPOATie(this); 107 } 108 return thisServant_; 109 } 110 111 public org.omg.CORBA.Object activate() 112 { 113 return ProxyConsumerHelper.narrow(getServant()._this_object(getORB())); 114 } 115 } | Popular Tags |