summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp133
1 files changed, 133 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp
new file mode 100644
index 00000000000..dd1cd160f13
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp
@@ -0,0 +1,133 @@
+// $Id$
+
+#include "Proxy.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Proxy.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(RT_Notify, TAO_NS_Proxy, "$Id$")
+
+#include "Peer.h"
+#include "Proxy.h"
+#include "Method_Request_Updates.h"
+#include "Worker_Task.h"
+#include "Properties.h"
+
+TAO_NS_Proxy::TAO_NS_Proxy (void)
+ :updates_off_ (0)
+{
+}
+
+TAO_NS_Proxy::~TAO_NS_Proxy ()
+{
+}
+
+void
+TAO_NS_Proxy::init (TAO_NS_Admin *admin ACE_ENV_ARG_DECL_NOT_USED)
+{
+ TAO_NS_Object::init (admin);
+
+ // For Proxy's the object should be activated in the proxy poa.
+ // so we override the default initialization in TAO_NS_Object
+
+ this->poa_ = this->proxy_poa_;
+}
+
+void
+TAO_NS_Proxy::subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL)
+{
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
+ CORBA::INTERNAL ());
+ ACE_CHECK;
+
+ // copy
+ subscribed_types = this->subscribed_types_;
+}
+
+void
+TAO_NS_Proxy::types_changed (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL_NOT_USED)
+{
+ TAO_NS_Method_Request_Updates request (added, removed, this);
+
+ if (TAO_NS_PROPERTIES::instance()->asynch_updates () == 1) // if we should send the updates synchronously.
+ {
+ this->worker_task ()->exec (request);
+ }
+ else // execute in the current thread context.
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ request.execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+}
+
+CORBA::Boolean
+TAO_NS_Proxy::check_filters (const TAO_NS_Event_var &event
+ , TAO_NS_FilterAdmin& parent_filter_admin
+ , CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator
+ ACE_ENV_ARG_DECL)
+{
+ // check if it passes the parent filter.
+ CORBA::Boolean parent_val =
+ parent_filter_admin.match (event ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean val = 0;
+
+ if (filter_operator == CosNotifyChannelAdmin::AND_OP)
+ {
+ val = parent_val && this->filter_admin_.match (event ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ else
+ {
+ val = parent_val || this->filter_admin_.match (event ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return val;
+}
+
+CosNotification::EventTypeSeq*
+TAO_NS_Proxy::obtain_types (CosNotifyChannelAdmin::ObtainInfoMode mode, const TAO_NS_EventTypeSeq& types ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ CosNotification::EventTypeSeq_var event_type_seq;
+
+ ACE_NEW_THROW_EX (event_type_seq,
+ CosNotification::EventTypeSeq (),
+ CORBA::NO_MEMORY ());
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
+ ACE_CHECK_RETURN (event_type_seq._retn ());
+
+ if (mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_OFF ||
+ mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON)
+ {
+ types.populate (event_type_seq);
+ }
+
+ if (mode == CosNotifyChannelAdmin::NONE_NOW_UPDATES_ON ||
+ mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON)
+ {
+ this->updates_off_ = 0;
+ }
+ else
+ {
+ this->updates_off_ = 1;
+ }
+
+ return event_type_seq._retn ();
+}
+
+void
+TAO_NS_Proxy::qos_changed (const TAO_NS_QoSProperties& qos_properties)
+{
+ //Inform Peers of qos changes.
+ TAO_NS_Peer* peer = this->peer ();
+
+ if (peer != 0)
+ peer->qos_changed (qos_properties);
+}