2 //=============================================================================
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"
20 #include "ace/SString.h"
22 #if !defined (ACE_LACKS_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>
34 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
37 class FT_FaultNotifier_i
: public virtual POA_FT::FaultNotifier
39 //////////////////////
40 // non-CORBA interface
43 * Default constructor.
45 FT_FaultNotifier_i ();
50 virtual ~FT_FaultNotifier_i ();
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
[]);
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
);
70 * @return zero for success; nonzero is process return code for failure.
75 * Identify this fault notifier.
76 * @return a string to identify this object for logging/console message purposes.
78 const char * identity () const;
82 * @param result [out] status code to return from process
83 * @returns 0 to continue; nonzero to quit
85 int idle(int &result
);
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 ();
115 /////////////////////////////////////////
116 // Override CORBA servant virtual methods
117 virtual PortableServer::POA_ptr
_default_POA ();
119 virtual void _remove_ref ();
121 /////////////////////////
122 // Implementation methods
125 * Write this notifier's IOR to a file
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.
174 * the replication manager
176 ::FT::ReplicationManager_var replication_manager_
;
179 * bool: if true the registration with ReplicationManager was successful.
184 * A human-readable string to distinguish this from other Notifiers.
186 ACE_CString identity_
;
188 /////////////////////////////
192 ::CosNotifyChannelAdmin::ProxyID proxyId_
;
193 ::CosNotifyChannelAdmin::ProxySupplier_var proxyVar_
;
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
221 * boolean: set true we've asked CORBA to deactivate
226 * boolean: set true when CORBA is done with this object.
231 TAO_END_VERSIONED_NAMESPACE_DECL
233 #include /**/ "ace/post.h"
235 #endif /* TAO_FT_NOTIFIER_I_H_ */