StructuredProxyPushSupplier.cpp

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

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