ProxyPushSupplier.cpp

Go to the documentation of this file.
00001 // ProxyPushSupplier.cpp,v 1.14 2006/03/15 21:29:09 jtc Exp
00002 
00003 #include "orbsvcs/Notify/Any/ProxyPushSupplier.h"
00004 
00005 ACE_RCSID (Notify, TAO_Notify_ProxyPushSupplier, "ProxyPushSupplier.cpp,v 1.14 2006/03/15 21:29:09 jtc Exp")
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                                                      ACE_ENV_ARG_DECL)
00031   ACE_THROW_SPEC ((
00032                    CORBA::SystemException,
00033                    CosEventChannelAdmin::AlreadyConnected,
00034                    CosEventChannelAdmin::TypeError
00035                    ))
00036 {
00037   // Convert Consumer to Base Type
00038   TAO_Notify_PushConsumer* consumer;
00039   ACE_NEW_THROW_EX (consumer,
00040                     TAO_Notify_PushConsumer (this),
00041                     CORBA::NO_MEMORY ());
00042 
00043   consumer->init (push_consumer ACE_ENV_ARG_PARAMETER);
00044   ACE_CHECK;
00045 
00046   this->connect (consumer ACE_ENV_ARG_PARAMETER);
00047   ACE_CHECK;
00048   this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00049 }
00050 
00051 void
00052 TAO_Notify_ProxyPushSupplier::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
00053   ACE_THROW_SPEC ((
00054                    CORBA::SystemException
00055                    ))
00056 {
00057   TAO_Notify_ProxyPushSupplier::Ptr guard( this );
00058   this->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00059   ACE_CHECK;
00060   this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00061 }
00062 
00063 CosNotifyChannelAdmin::ProxyType
00064 TAO_Notify_ProxyPushSupplier::MyType (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00065   ACE_THROW_SPEC ((
00066                    CORBA::SystemException
00067                    ))
00068 {
00069   return CosNotifyChannelAdmin::PUSH_ANY;
00070 }
00071 
00072 const char *
00073 TAO_Notify_ProxyPushSupplier::get_proxy_type_name (void) const
00074 {
00075   return "proxy_push_supplier";
00076 }
00077 
00078 void
00079 TAO_Notify_ProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs)
00080 {
00081   SuperClass::load_attrs(attrs);
00082   ACE_CString ior;
00083   if (attrs.load("PeerIOR", ior))
00084     {
00085       CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00086       ACE_DECLARE_NEW_CORBA_ENV;
00087       ACE_TRY
00088         {
00089           CosNotifyComm::PushConsumer_var pc =
00090             CosNotifyComm::PushConsumer::_nil();
00091           if (ior.length() > 0)
00092             {
00093               CORBA::Object_var obj =
00094                 orb->string_to_object(ior.c_str() ACE_ENV_ARG_PARAMETER);
00095               ACE_TRY_CHECK;
00096               pc = CosNotifyComm::PushConsumer::_unchecked_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
00097               ACE_TRY_CHECK;
00098             }
00099           this->connect_any_push_consumer(pc.in() ACE_ENV_ARG_PARAMETER);
00100           ACE_TRY_CHECK;
00101         }
00102       ACE_CATCHANY
00103         {
00104           // if we can't reconnect, tough...
00105         }
00106       ACE_ENDTRY;
00107     }
00108 }
00109 
00110 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:24:14 2006 for TAO_CosNotification by doxygen 1.3.6