ProxyPushSupplier.cpp

Go to the documentation of this file.
00001 // $Id: ProxyPushSupplier.cpp 77001 2007-02-12 07:54:49Z johnnyw $
00002 
00003 #include "orbsvcs/Notify/Any/ProxyPushSupplier.h"
00004 
00005 ACE_RCSID (Notify, TAO_Notify_ProxyPushSupplier, "$Id: ProxyPushSupplier.cpp 77001 2007-02-12 07:54:49Z johnnyw $")
00006 
00007 #include "tao/debug.h"
00008 #include "orbsvcs/Notify/Any/PushConsumer.h"
00009 #include "orbsvcs/Notify/Properties.h"
00010 
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012 
00013 TAO_Notify_ProxyPushSupplier::TAO_Notify_ProxyPushSupplier (void)
00014 {
00015 }
00016 
00017 TAO_Notify_ProxyPushSupplier::~TAO_Notify_ProxyPushSupplier ()
00018 {
00019 }
00020 
00021 void
00022 TAO_Notify_ProxyPushSupplier::release (void)
00023 {
00024   delete this;
00025   //@@ inform factory
00026 }
00027 
00028 void
00029 TAO_Notify_ProxyPushSupplier::connect_any_push_consumer (CosEventComm::PushConsumer_ptr push_consumer)
00030 {
00031   // Convert Consumer to Base Type
00032   TAO_Notify_PushConsumer* consumer;
00033   ACE_NEW_THROW_EX (consumer,
00034                     TAO_Notify_PushConsumer (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_ProxyPushSupplier::disconnect_push_supplier (void)
00045 {
00046   TAO_Notify_ProxyPushSupplier::Ptr guard( this );
00047   this->destroy ();
00048   this->self_change ();
00049 }
00050 
00051 CosNotifyChannelAdmin::ProxyType
00052 TAO_Notify_ProxyPushSupplier::MyType (void)
00053 {
00054   return CosNotifyChannelAdmin::PUSH_ANY;
00055 }
00056 
00057 const char *
00058 TAO_Notify_ProxyPushSupplier::get_proxy_type_name (void) const
00059 {
00060   return "proxy_push_supplier";
00061 }
00062 
00063 void
00064 TAO_Notify_ProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs)
00065 {
00066   SuperClass::load_attrs(attrs);
00067   ACE_CString ior;
00068   if (attrs.load("PeerIOR", ior))
00069     {
00070       CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00071       try
00072         {
00073           CosNotifyComm::PushConsumer_var pc =
00074             CosNotifyComm::PushConsumer::_nil();
00075           if (ior.length() > 0)
00076             {
00077               CORBA::Object_var obj =
00078                 orb->string_to_object(ior.c_str());
00079               pc = CosNotifyComm::PushConsumer::_unchecked_narrow(obj.in());
00080             }
00081           this->connect_any_push_consumer(pc.in());
00082         }
00083       catch (const CORBA::Exception&)
00084         {
00085           // if we can't reconnect, tough...
00086         }
00087     }
00088 }
00089 
00090 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:45:29 2010 for TAO_CosNotification by  doxygen 1.4.7