Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / Fault_Notifier / FT_Notifier_i.h
blobecc69f45a195efb7cc252ffd49f90409a5aeb237
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4 * @file FT_Notifier_i.h
6 * This file is part of Fault Tolerant CORBA.
7 * This file declares the Fault_Notifier_i class.
8 * A FaultNotifer is a subset of a notification channel. It allows interested
9 * parties to subscribe to fault notifications. The most likely interested party
10 * is the ReplicationManager.
12 * @author Dale Wilson <wilson_d@ociweb.com>
14 //=============================================================================
16 #ifndef TAO_FT_NOTIFIER_I_H_
17 #define TAO_FT_NOTIFIER_I_H_
18 #include /**/ "ace/pre.h"
19 #include "ace/ACE.h"
20 #include "ace/SString.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #pragma once
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include <orbsvcs/FT_NotifierS.h>
27 #include <orbsvcs/FT_ReplicationManagerC.h>
28 #include <orbsvcs/Notify/Notify_EventChannelFactory_i.h>
29 #include <ace/Vector_T.h>
31 /////////////////////
32 // Forward references
34 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 namespace TAO
37 class FT_FaultNotifier_i : public virtual POA_FT::FaultNotifier
39 //////////////////////
40 // non-CORBA interface
41 public:
42 /**
43 * Default constructor.
45 FT_FaultNotifier_i ();
47 /**
48 * Virtual destructor.
50 virtual ~FT_FaultNotifier_i ();
53 /**
54 * Parse command line arguments.
55 * @param argc traditional C argc
56 * @param argv traditional C argv
57 * @return zero for success; nonzero is process return code for failure.
59 int parse_args (int argc, ACE_TCHAR * argv[]);
61 /**
62 * Initialize this object.
63 * @param orbManager our ORB -- we keep var to it.
64 * @return zero for success; nonzero is process return code for failure.
66 int init (CORBA::ORB_ptr orb);
68 /**
69 * Prepare to exit
70 * @return zero for success; nonzero is process return code for failure.
72 int fini (void);
74 /**
75 * Identify this fault notifier.
76 * @return a string to identify this object for logging/console message purposes.
78 const char * identity () const;
80 /**
81 * idle time activity.
82 * @param result [out] status code to return from process
83 * @returns 0 to continue; nonzero to quit
85 int idle(int &result);
87 //////////////////
88 // CORBA interface
89 // See IDL for documentation
91 virtual void push_structured_fault (
92 const CosNotification::StructuredEvent & event);
94 virtual void push_sequence_fault (
95 const CosNotification::EventBatch & events);
97 virtual ::CosNotifyFilter::Filter_ptr create_subscription_filter (
98 const char * constraint_grammar);
100 virtual FT::FaultNotifier::ConsumerId connect_structured_fault_consumer (
101 CosNotifyComm::StructuredPushConsumer_ptr push_consumer,
102 CosNotifyFilter::Filter_ptr filter);
104 virtual FT::FaultNotifier::ConsumerId connect_sequence_fault_consumer (
105 CosNotifyComm::SequencePushConsumer_ptr push_consumer,
106 CosNotifyFilter::Filter_ptr filter);
108 virtual void disconnect_consumer (
109 FT::FaultNotifier::ConsumerId connection);
111 //////////////////////////////////////////
112 // CORBA interface PullMonitorable methods
113 virtual CORBA::Boolean is_alive (void);
115 /////////////////////////////////////////
116 // Override CORBA servant virtual methods
117 virtual PortableServer::POA_ptr _default_POA (void);
119 virtual void _remove_ref (void);
121 /////////////////////////
122 // Implementation methods
123 private:
125 * Write this notifier's IOR to a file
127 int write_ior ();
129 ///////////////
130 // Data Members
131 private:
133 * The orb
135 CORBA::ORB_var orb_;
138 * The POA used to activate this object.
140 PortableServer::POA_var poa_;
143 * The CORBA object id assigned to this object.
145 PortableServer::ObjectId_var object_id_;
149 * IOR of this object as assigned by orb.
151 CORBA::String_var ior_;
154 * A file to which the notifier's IOR should be written.
156 const ACE_TCHAR * ior_output_file_;
159 * A name to be used to register the notifier with the name service.
161 const char * ns_name_;
163 CosNaming::NamingContext_var naming_context_;
165 CosNaming::Name this_name_;
168 * bool: if true, register with ReplicationManager.
169 * default is true. -r turns it off.
171 int rm_register_;
174 * the replication manager
176 ::FT::ReplicationManager_var replication_manager_;
179 * bool: if true the registration with ReplicationManager was successful.
181 int registered_;
184 * A human-readable string to distinguish this from other Notifiers.
186 ACE_CString identity_;
188 /////////////////////////////
190 struct ProxyInfo
192 ::CosNotifyChannelAdmin::ProxyID proxyId_;
193 ::CosNotifyChannelAdmin::ProxySupplier_var proxyVar_;
195 ProxyInfo ();
196 ProxyInfo (const ProxyInfo & rhs);
199 typedef ACE_Vector <ProxyInfo> ProxyInfoVec;
201 ProxyInfoVec proxy_infos_;
203 size_t consumer_connects_;
204 size_t consumer_disconnects_;
206 ::CosNotifyChannelAdmin::ChannelID channel_id_;
207 ::CosNotifyChannelAdmin::EventChannel_var notify_channel_;
208 ::CosNotifyFilter::FilterFactory_var filter_factory_;
209 ::CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
210 ::CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
212 ::CosNotifyChannelAdmin::StructuredProxyPushConsumer_var structured_proxy_push_consumer_;
213 ::CosNotifyChannelAdmin::SequenceProxyPushConsumer_var sequence_proxy_push_consumer_;
216 * boolean quit when all consumers disconnect
218 int quit_on_idle_;
221 * boolean: set true we've asked CORBA to deactivate
223 int quitting_;
226 * boolean: set true when CORBA is done with this object.
228 int gone_;
231 } // namespace TAO
232 TAO_END_VERSIONED_NAMESPACE_DECL
234 #include /**/ "ace/post.h"
236 #endif /* TAO_FT_NOTIFIER_I_H_ */