00001 // $Id: SequenceProxyPushSupplier.cpp 77001 2007-02-12 07:54:49Z johnnyw $ 00002 00003 #include "orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h" 00004 00005 ACE_RCSID (Notify, TAO_Notify_SequenceProxyPushSupplier, "$Id: SequenceProxyPushSupplier.cpp 77001 2007-02-12 07:54:49Z johnnyw $") 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::load_attrs (const TAO_Notify::NVPList& attrs) 00066 { 00067 SuperClass::load_attrs(attrs); 00068 ACE_CString ior; 00069 if (attrs.load("PeerIOR", ior)) 00070 { 00071 CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb(); 00072 try 00073 { 00074 CosNotifyComm::SequencePushConsumer_var pc = CosNotifyComm::SequencePushConsumer::_nil(); 00075 if (ior.length() > 0) 00076 { 00077 CORBA::Object_var obj = orb->string_to_object(ior.c_str()); 00078 pc = CosNotifyComm::SequencePushConsumer::_unchecked_narrow(obj.in()); 00079 } 00080 this->connect_sequence_push_consumer(pc.in()); 00081 } 00082 catch (const CORBA::Exception&) 00083 { 00084 // if we can't reconnect, tough 00085 } 00086 } 00087 } 00088 00089 TAO_END_VERSIONED_NAMESPACE_DECL