Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / orbsvcs / tests / FT_App / StubBatchConsumer.cpp
blob066d40b3fa30e00964347229fff8b3123075d80a
1 // -*- C++ -*-
2 #include "StubBatchConsumer.h"
3 #include "ace/Get_Opt.h"
4 #include "orbsvcs/PortableGroup/PG_Properties_Encoder.h"
6 StubBatchConsumer::StubBatchConsumer ()
7 : quit_(0)
12 StubBatchConsumer::~StubBatchConsumer ()
17 int StubBatchConsumer::parse_args (int argc, ACE_TCHAR * argv[])
19 ACE_UNUSED_ARG (argc);
20 ACE_UNUSED_ARG (argv);
21 int optionError = 0;
22 // No options for now
23 return optionError;
27 ::PortableServer::POA_ptr StubBatchConsumer::_default_POA ()
29 return ::PortableServer::POA::_duplicate(this->poa_.in ());
32 PortableServer::ObjectId StubBatchConsumer::objectId()const
34 return this->object_id_.in();
38 /**
39 * register this object
41 int StubBatchConsumer::init (CORBA::ORB_ptr orb, ::FT::FaultNotifier_var & notifier)
43 int result = 0;
44 this->orb_ = CORBA::ORB::_duplicate (orb);
45 this->notifier_ = notifier;
46 this->identity_ = "StubBatchConsumer";
49 // Use the ROOT POA for now
50 CORBA::Object_var poa_object =
51 this->orb_->resolve_initial_references (TAO_OBJID_ROOTPOA);
53 if (CORBA::is_nil (poa_object.in ()))
54 ACE_ERROR_RETURN ((LM_ERROR,
55 ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")),
56 -1);
58 // Get the POA .
59 this->poa_ = PortableServer::POA::_narrow (poa_object.in ());
62 if (CORBA::is_nil(this->poa_.in ()))
64 ACE_ERROR_RETURN ((LM_ERROR,
65 ACE_TEXT (" (%P|%t) Unable to narrow the POA.\n")),
66 -1);
69 PortableServer::POAManager_var poa_manager =
70 this->poa_->the_POAManager ();
72 poa_manager->activate ();
74 // Register with the POA.
76 this->object_id_ = this->poa_->activate_object (this);
78 // find my identity as an object
80 CORBA::Object_var this_obj =
81 this->poa_->id_to_reference (object_id_.in ());
83 CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_nil();
85 this->consumer_id_ = notifier->connect_sequence_fault_consumer(
86 CosNotifyComm::SequencePushConsumer::_narrow(this_obj.in ()),
87 filter.in ());
89 return result;
92 /**
93 * Return a string to identify this object for logging/console message purposes.
95 const char * StubBatchConsumer::identity () const
97 return this->identity_.c_str();
101 * Clean house for process shut down.
103 void StubBatchConsumer::fini ()
105 this->notifier_->disconnect_consumer(this->consumer_id_);
109 int StubBatchConsumer::idle(int & result)
111 ACE_UNUSED_ARG(result);
112 return this->quit_;
115 ////////////////
116 // CORBA methods
119 //virtual
120 void StubBatchConsumer::push_structured_events (
121 const CosNotification::EventBatch & notifications
124 ACE_UNUSED_ARG (notifications);
125 //@@ sequence of structured event handling not written yet
128 void StubBatchConsumer::offer_change (
129 const CosNotification::EventTypeSeq & added,
130 const CosNotification::EventTypeSeq & removed
133 ACE_UNUSED_ARG (added);
134 ACE_UNUSED_ARG (removed);
135 ACE_ERROR ((LM_ERROR,
136 "StubBatchConsumer: offer_change call ignored.\n"
138 // @@ not implemented (not likely to be needed)
141 //virtual
142 void StubBatchConsumer::disconnect_sequence_push_consumer (
145 ACE_ERROR ((LM_ERROR,
146 "StubBatchConsumer:disconnect_sequence_push_consumer interpreted as quit request.\n"
148 this->quit_ = 1;