00001 // $Id: SequenceProxyPushSupplier.cpp 87253 2009-10-28 23:29:32Z dai_y $ 00002 00003 #include "orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h" 00004 00005 ACE_RCSID (Notify, TAO_Notify_SequenceProxyPushSupplier, "$Id: SequenceProxyPushSupplier.cpp 87253 2009-10-28 23:29:32Z dai_y $") 00006 00007 #include "tao/debug.h" 00008 #include "orbsvcs/Notify/Sequence/SequencePushConsumer.h" 00009 #include "orbsvcs/Notify/Properties.h" 00010 00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00012 00013 TAO_Notify_SequenceProxyPushSupplier::TAO_Notify_SequenceProxyPushSupplier (void) 00014 { 00015 } 00016 00017 TAO_Notify_SequenceProxyPushSupplier::~TAO_Notify_SequenceProxyPushSupplier () 00018 { 00019 } 00020 00021 void 00022 TAO_Notify_SequenceProxyPushSupplier::release (void) 00023 { 00024 delete this; 00025 //@@ inform factory 00026 } 00027 00028 void 00029 TAO_Notify_SequenceProxyPushSupplier::connect_sequence_push_consumer (CosNotifyComm::SequencePushConsumer_ptr push_consumer) 00030 { 00031 // Convert Consumer to Base Type 00032 TAO_Notify_SequencePushConsumer* consumer; 00033 ACE_NEW_THROW_EX (consumer, 00034 TAO_Notify_SequencePushConsumer (this), 00035 CORBA::NO_MEMORY ()); 00036 00037 consumer->init (push_consumer); 00038 00039 this->connect (consumer); 00040 this->self_change (); 00041 } 00042 00043 void 00044 TAO_Notify_SequenceProxyPushSupplier::disconnect_sequence_push_supplier (void) 00045 00046 { 00047 TAO_Notify_SequenceProxyPushSupplier::Ptr guard( this ); 00048 this->destroy (); 00049 this->self_change (); 00050 } 00051 00052 CosNotifyChannelAdmin::ProxyType 00053 TAO_Notify_SequenceProxyPushSupplier::MyType (void) 00054 { 00055 return CosNotifyChannelAdmin::PUSH_SEQUENCE; 00056 } 00057 00058 const char * 00059 TAO_Notify_SequenceProxyPushSupplier::get_proxy_type_name (void) const 00060 { 00061 return "sequence_proxy_push_supplier"; 00062 } 00063 00064 void 00065 TAO_Notify_SequenceProxyPushSupplier::validate () 00066 { 00067 TAO_Notify_Consumer* con = this->consumer (); 00068 if (con != 0 && ! con->is_alive (true)) 00069 { 00070 if (TAO_debug_level > 0) 00071 { 00072 ACE_DEBUG ((LM_DEBUG, 00073 ACE_TEXT ("(%P|%t) TAO_Notify_SequenceProxyPushSupplier::validate(%d)") 00074 ACE_TEXT ("disconnecting \n"), this->id ())); 00075 } 00076 00077 this->disconnect_sequence_push_supplier (); 00078 } 00079 } 00080 00081 00082 void 00083 TAO_Notify_SequenceProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) 00084 { 00085 SuperClass::load_attrs(attrs); 00086 ACE_CString ior; 00087 if (attrs.load("PeerIOR", ior)) 00088 { 00089 CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb(); 00090 try 00091 { 00092 CosNotifyComm::SequencePushConsumer_var pc = CosNotifyComm::SequencePushConsumer::_nil(); 00093 if (ior.length() > 0) 00094 { 00095 CORBA::Object_var obj = orb->string_to_object(ior.c_str()); 00096 pc = CosNotifyComm::SequencePushConsumer::_unchecked_narrow(obj.in()); 00097 } 00098 this->connect_sequence_push_consumer(pc.in()); 00099 } 00100 catch (const CORBA::Exception&) 00101 { 00102 // if we can't reconnect, tough 00103 } 00104 } 00105 } 00106 00107 void 00108 TAO_Notify_SequenceProxyPushSupplier::configure( 00109 TAO_Notify_ConsumerAdmin & /*admin*/, 00110 CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) 00111 { 00112 // Nothing to do. 00113 // This virtual method was added to support Notification MC 00114 } 00115 00116 TAO_END_VERSIONED_NAMESPACE_DECL