summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h')
-rw-r--r--trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h209
1 files changed, 209 insertions, 0 deletions
diff --git a/trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h b/trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h
new file mode 100644
index 00000000000..f429cf7892c
--- /dev/null
+++ b/trunk/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.h
@@ -0,0 +1,209 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Supplier.h
+//
+// = DESCRIPTION
+// Test Supplier reconnect to existing channel/admin/proxy Notification Service
+//
+// = AUTHOR
+// Dale Wilson <wilson_d@ociweb.com>
+//
+// ==========================================================================
+
+#ifndef RECONNECTNG_SUPPLIER_H
+#define RECONNECTNG_SUPPLIER_H
+
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/NotifyExtS.h"
+#include <ace/SString.h>
+
+class Supplier_Main;
+
+class StructuredPushSupplier_i : public virtual POA_CosNotifyComm::StructuredPushSupplier
+{
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType));
+
+ virtual void disconnect_structured_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+class SequencePushSupplier_i : public virtual POA_CosNotifyComm::SequencePushSupplier
+{
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType));
+
+ virtual void disconnect_sequence_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+class AnyPushSupplier_i : public virtual POA_CosNotifyComm::PushSupplier
+{
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType));
+
+ virtual void disconnect_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+class ReconnectionCallback_i : public virtual POA_NotifyExt::ReconnectionCallback
+{
+public:
+ ReconnectionCallback_i (Supplier_Main & supplier_main);
+
+ virtual ~ReconnectionCallback_i ();
+
+ void init (
+ PortableServer::POA_ptr poa,
+ CosNotifyChannelAdmin::EventChannelFactory_ptr ecf_
+ ACE_ENV_ARG_DECL);
+
+ void fini (ACE_ENV_SINGLE_ARG_DECL);
+
+ size_t reconnect_count () const;
+
+ virtual void reconnect (
+ CORBA::Object_ptr reconnection
+ ACE_ENV_ARG_DECL
+ ) ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Boolean is_alive (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ Supplier_Main & supplier_main_;
+ bool id_is_valid_;
+ NotifyExt::ReconnectionRegistry::ReconnectionID callback_id_;
+ CosNotifyChannelAdmin::EventChannelFactory_var ecf_;
+ size_t reconnect_count_;
+};
+
+class Supplier_Main
+{
+ public:
+ Supplier_Main ();
+ ~Supplier_Main ();
+
+ int parse_args (int argc, char *argv[]);
+ int parse_single_arg (int argc, char *argv[]);
+
+ int init (int argc, char *argv[] ACE_ENV_ARG_DECL);
+ int run (ACE_ENV_SINGLE_ARG_DECL);
+ int fini (ACE_ENV_SINGLE_ARG_DECL);
+ void usage (FILE * log) const;
+
+ void reconnect (
+ CosNotifyChannelAdmin::EventChannelFactory_ptr dest_factory
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+ /// Find naming service.
+ int resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the Notify factory from the Naming service.
+ int find_notify_factory (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the Notify factory using resolve_initial_reference ("NotifyEventChannelFactory")
+ int resolve_notify_factory (ACE_ENV_SINGLE_ARG_DECL);
+
+ void init_event_channel (ACE_ENV_SINGLE_ARG_DECL);
+ void init_supplier_admin (ACE_ENV_SINGLE_ARG_DECL);
+ void init_structured_proxy_consumer (ACE_ENV_SINGLE_ARG_DECL);
+ void init_sequence_proxy_consumer (ACE_ENV_SINGLE_ARG_DECL);
+ void init_any_proxy_consumer (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// send events.
+ void send_structured_event (ACE_ENV_SINGLE_ARG_DECL);
+ void send_sequence_event (ACE_ENV_SINGLE_ARG_DECL);
+ void send_any_event (ACE_ENV_SINGLE_ARG_DECL);
+
+ void save_ids();
+ bool load_ids();
+
+ ////////////////////
+ // forbidden methods
+ private:
+ Supplier_Main (const Supplier_Main & rhs);
+ Supplier_Main & operator = (const Supplier_Main & rhs);
+
+ ////////////////
+ // Data members
+ private:
+
+ // set by command line parameters
+ bool verbose_; // -v make a glorious noise
+ enum Mode_T {
+ MODE_ANY,
+ MODE_STRUCTURED,
+ MODE_SEQUENCE} mode_; // -any, -structured, or -sequence
+ ACE_CString channel_file_; // -channel filename
+ size_t send_; // -send n
+ bool use_naming_service_; // -nonamesvc
+ size_t serial_number_; // -serial_number
+ bool disconnect_on_exit_; // -disconnect
+ ACE_CString id_file_; // -ids
+ size_t pause_; // -pause n (pause after sending n messages)
+ CORBA::ORB_var orb_;
+ PortableServer::POA_var root_poa_;
+ CosNaming::NamingContext_var naming_context_;
+ CosNotifyChannelAdmin::EventChannelFactory_var ecf_;
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ CosNotifyChannelAdmin::ChannelID ec_id_;
+
+ CosNotifyChannelAdmin::SupplierAdmin_var sa_;
+ CosNotifyChannelAdmin::AdminID sa_id_;
+
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer_var structured_proxy_push_consumer_;
+ CosNotifyChannelAdmin::ProxyID structured_proxy_id_;
+ StructuredPushSupplier_i structured_push_supplier_;
+ CosNotifyComm::StructuredPushSupplier_var structured_push_supplier_ref_;
+
+
+ CosNotifyChannelAdmin::SequenceProxyPushConsumer_var sequence_proxy_push_consumer_;
+ CosNotifyChannelAdmin::ProxyID sequence_proxy_id_;
+ SequencePushSupplier_i sequence_push_supplier_;
+ CosNotifyComm::SequencePushSupplier_var sequence_push_supplier_ref_;
+
+ CosNotifyChannelAdmin::ProxyPushConsumer_var any_proxy_push_consumer_;
+ CosNotifyChannelAdmin::ProxyID any_proxy_id_;
+ AnyPushSupplier_i any_push_supplier_;
+ CosNotifyComm::PushSupplier_var any_push_supplier_ref_;
+
+ ReconnectionCallback_i reconnection_callback_;
+
+ bool reconnecting_;
+};
+
+
+
+#endif /* RECONNECTNG_SUPPLIER_H */