StructuredProxyPushSupplier.cpp

Go to the documentation of this file.
00001 // $Id: StructuredProxyPushSupplier.cpp 78925 2007-07-17 18:51:14Z zhangw $
00002 
00003 #include "orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h"
00004 
00005 #include "tao/PortableServer/Servant_Base.h"
00006 #include "tao/debug.h"
00007 
00008 #include "orbsvcs/Notify/Structured/StructuredPushConsumer.h"
00009 #include "orbsvcs/Notify/Properties.h"
00010 
00011 
00012 ACE_RCSID(RT_Notify, TAO_Notify_StructuredProxyPushSupplier, "$Id: StructuredProxyPushSupplier.cpp 78925 2007-07-17 18:51:14Z zhangw $")
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 TAO_Notify_StructuredProxyPushSupplier::TAO_Notify_StructuredProxyPushSupplier (void)
00017 {
00018 }
00019 
00020 TAO_Notify_StructuredProxyPushSupplier::~TAO_Notify_StructuredProxyPushSupplier ()
00021 {
00022 }
00023 
00024 void
00025 TAO_Notify_StructuredProxyPushSupplier::release (void)
00026 {
00027   delete this;
00028   //@@ inform factory
00029 }
00030 
00031 CosNotifyChannelAdmin::ProxyType
00032 TAO_Notify_StructuredProxyPushSupplier::MyType (void)
00033 {
00034   return CosNotifyChannelAdmin::PUSH_STRUCTURED;
00035 }
00036 
00037 void
00038 TAO_Notify_StructuredProxyPushSupplier::connect_structured_push_consumer (CosNotifyComm::StructuredPushConsumer_ptr push_consumer)
00039 {
00040   // Convert Consumer to Base Type
00041   TAO_Notify_StructuredPushConsumer* consumer;
00042   ACE_NEW_THROW_EX (consumer,
00043                     TAO_Notify_StructuredPushConsumer (this),
00044                     CORBA::NO_MEMORY ());
00045 
00046   consumer->init (push_consumer);
00047 
00048   this->connect (consumer);
00049   this->self_change ();
00050 }
00051 
00052 void
00053 TAO_Notify_StructuredProxyPushSupplier::disconnect_structured_push_supplier (void)
00054 
00055 {
00056   TAO_Notify_StructuredProxyPushSupplier::Ptr guard( this );
00057   this->destroy ();
00058   this->send_deletion_change ();
00059 }
00060 
00061 const char *
00062 TAO_Notify_StructuredProxyPushSupplier::get_proxy_type_name (void) const
00063 {
00064   return "structured_proxy_push_supplier";
00065 }
00066 
00067 void
00068 TAO_Notify_StructuredProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs)
00069 {
00070   SuperClass::load_attrs(attrs);
00071   ACE_CString ior;
00072   if (attrs.load("PeerIOR", ior))
00073   {
00074     CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00075     try
00076     {
00077       CosNotifyComm::StructuredPushConsumer_var pc = CosNotifyComm::StructuredPushConsumer::_nil();
00078       if (ior.length() > 0)
00079       {
00080         CORBA::Object_var obj = orb->string_to_object(ior.c_str());
00081         pc = CosNotifyComm::StructuredPushConsumer::_unchecked_narrow(obj.in());
00082       }
00083       this->connect_structured_push_consumer(pc.in());
00084     }
00085     catch (const CORBA::Exception&)
00086     {
00087       // if we can't connect... tough
00088     }
00089   }
00090 }
00091 
00092 TAO_END_VERSIONED_NAMESPACE_DECL

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