36 PortableServer::Servant
38 const PortableServer::ObjectId& oid,
39 PortableServer::POA_ptr poa
42 DB(20,
"ProxyPullConsumerManager::incarnate()")
49 PortableServer::POA_ptr parentPoa,
60 DB(20,
"~ProxyPullConsumerManager()")
65 CosEventChannelAdmin::ProxyPullConsumer_ptr
68 return createNarrowedReference<CosEventChannelAdmin::ProxyPullConsumer>(
70 CosEventChannelAdmin::_tc_ProxyPullConsumer->id()
102 CosEventChannelAdmin::ProxyPullConsumer_var ppcv =ppc->_this();
115 CosEventComm::PullSupplier_ptr pullSupplier
118 if(CORBA::is_nil(pullSupplier))
119 throw CORBA::BAD_PARAM();
120 if(!CORBA::is_nil(_target) || !CORBA::is_nil(_req))
121 throw CosEventChannelAdmin::AlreadyConnected();
122 _target=CosEventComm::PullSupplier::_duplicate(pullSupplier);
133 DB(5,
"ProxyPullConsumer_i::disconnect_pull_consumer()");
134 eraseKey(
"SupplierAdmin/ProxyPullConsumer");
136 if(CORBA::is_nil(_target))
138 throw CORBA::OBJECT_NOT_EXIST(
145 CORBA::Request_var req=_target->_request(
"disconnect_pull_supplier");
146 _target=CosEventComm::PullSupplier::_nil();
147 req->send_deferred();
155 PortableServer::POA_ptr poa,
159 _target(CosEventComm::PullSupplier::_nil()),
167 DB(20,
"~ProxyPullConsumer_i()")
172 if(!CORBA::is_nil(
_req) &&
_req->poll_response())
174 const char* opname =
_req->operation();
176 CORBA::Environment_ptr env =
_req->env();
178 if(!CORBA::is_nil(env) && env->exception())
180 CORBA::Exception* ex =env->exception();
181 DB(10,
"ProxyPullConsumer got exception" 182 IF_OMNIORB4(<<
": "<<ex->_name())<<
", op:"<<opname);
183 if(0==strcmp(
"pull",opname) || 0==strcmp(
"try_pull",opname))
189 DB(2,
"Ignoring unrecognised response. operation:"<<opname);
195 CORBA::Request_var req=
_target->_request(
"disconnect_pull_supplier");
196 req->send_deferred();
199 _target=CosEventComm::PullSupplier::_nil();
200 eraseKey(
"SupplierAdmin/ProxyPullConsumer");
208 if(0==strcmp(
"pull",opname))
212 else if(0==strcmp(
"try_pull",opname))
214 CORBA::NVList_ptr args=
_req->arguments();
217 CORBA::NamedValue_var hasEventArg=args->item(0);
218 if(0==strcmp(hasEventArg->name(),
"has_event"))
220 CORBA::Any* a =hasEventArg->value();
222 CORBA::Any::to_boolean tb(b);
223 hasEvent=(((*a)>>=tb) && b);
230 CORBA::Any*
event =
new CORBA::Any();
231 _req->return_value() >>= (*event);
237 _req=CORBA::Request::_nil();
252 _req->add_out_arg(
"has_event")<<=CORBA::Any::from_boolean(1);
257 _req->set_return_type(CORBA::_tc_any);
258 _req->send_deferred();
267 CosEventComm::PullSupplier_var pullSupplier =
268 string_to_<CosEventComm::PullSupplier>(node.
attrString(
"IOR").c_str());
Implementation of the ProxyPullConsumer interface.
void reincarnate(const string &oid, const PersistNode &node)
Re-create a servant from information saved in the log file.
Base class for three of the four Proxy servants.
PortableServer::POA_var _managedPoa
The POA owned & managed by this object.
void collect()
Collects events that have arrived at connected proxies.
void triggerRequest()
When _req is NIL, sends out a new pull() or try_pull() call.
PortableServer::Servant incarnate(const PortableServer::ObjectId &oid, PortableServer::POA_ptr poa)
void activate(const char *name)
Creates the Proxy-type's POA, and registers this object as its ServantManager.
Base class for ServantActivator classes that manage Proxy servants.
#define IF_OMNIORB4(omniORB4_code)
int _exceptionCount
Only when two consecutive exceptions have been received from each mode, do we consider the connection...
void disconnect()
Send disconnect_pull_supplier() to all connected PullSuppliers.
string attrString(const string &key, const string &fallback="") const
void deferredRequest(CORBA::Request_ptr req, Callback *callback=NULL)
Adopts the request and then stores it in _deferredRequests.
void deactivateObject()
Calls deactivate_object() to deactivate this servant in its POA.
void basicOutput(ostream &os, const char *name, CORBA::Object_ptr target=CORBA::Object::_nil(), const char *extraAttributes=NULL)
Helper method for constructing persistency output.
void output(ostream &os)
Save this object's state to a stream.
static bool exists()
Library code may create Event Service objects without the need for persistency.
void connect_pull_supplier(CosEventComm::PullSupplier_ptr pullSupplier)
list< CORBA::Any * > & _queue
CosEventComm::PullSupplier_var _target
void disconnect_pull_consumer()
~ProxyPullConsumerManager()
void eraseKey(const char *name)
Helper method for constructing persistency output.
void output(ostream &os)
Save this object's state to a stream.
void activateObjectWithId(const char *oidStr)
Calls activate_object_with_id() to activate this servant in its POA.
set< Proxy * > _servants
The set of all active Proxies in this object's _managedPoa.
ProxyPullConsumer_i(PortableServer::POA_ptr poa, list< CORBA::Any * > &q)
OMNIEVENTS__DEBUG_REF_COUNTS__DECL CosEventChannelAdmin::ProxyPullConsumer_ptr createObject()
#define OMNIEVENTS__DEBUG_REF_COUNTS__DEFN(C)
Defines debug versions of _add/remove_ref() for class C.
Obtains an output stream to the active persistancy logfile, and locks it for exclusive access...
#define IFELSE_OMNIORB4(omniORB4_code, default_code)
list< CORBA::Any * > & _queue
ProxyPullConsumerManager(PortableServer::POA_ptr parentPoa, list< CORBA::Any * > &q)
void triggerRequest()
For each connected proxy, if there is no request in progress, send a new request to the current opera...
#define HERE
Generates a string literal that describes the filename and line number.
void reportObjectFailure(const char *here, CORBA::Object_ptr obj, CORBA::Exception *ex)
Called by omniEvents when an object has failed (fatal exception).
void collect()
Collects responses since the last trigger.