def subscription_change(self, added, deled): "handles notification of a change in event type subscriptions by consumers" self.__oplock.acquire() if (self.__cleaning_up == 1): self.__oplock.release() return self.num_changes += 1 if (self.__change_fn != None): self.__change_fn(added, deled, self.obj_name, self.num_changes, self.__verbose) elif (self.__verbose > 0): print self.obj_name, ": subscription_change received [#", self.num_changes, "]: ", CliUtils.describe_change(added, deled) print " " self.__oplock.release()
def L_add_filter(self, where, constraints): """add filter using constraints where is either 'proxy' or 'admin' """ self.__oplock.acquire() w = self.__my_proxy flist = self.__my_proxy_filters if (where == "admin"): w = self.__my_admin flist = self.__my_admin_filters b, f = CliUtils.add_filter(self.obj_name, self.__channel, w, constraints, self.__verbose) if (f != None): flist.append(f) self.__oplock.release() return b
def Create(chan, maxevs, bsize, objnm, idx, efn, tfn, constraints, mil, opr, vb): "stand-alone constructor" admin, proxy = CliUtils.get_proxy_for_con(CosNotifyChannelAdmin.SEQUENCE_EVENT, "push", opr, CosNotifyChannelAdmin.SequenceProxyPushSupplier, chan, objnm, vb) if (proxy == None): return None client = C(chan, admin, proxy, maxevs, bsize, objnm, idx, efn, tfn, mil, vb) b = client.L_add_filter("proxy", constraints) if (b == 1): try: admin.destroy() except: pass return None return client
def L_add_constraints(self, where, constraints): """add constraints to existing filter where is either 'proxy' or 'admin' """ self.__oplock.acquire() w = self.__my_proxy flist = self.__my_proxy_filters if (where == "admin"): w = self.__my_admin flist = self.__my_admin_filters if (len(flist) < 1): print self.obj_name, ": ERROR add_constraints target has no filter" return 1 # error # just use first filter in list f = flist[0] b = CliUtils.add_constraints(self.obj_name, f, constraints, self.__verbose) self.__oplock.release() return b
def Create(chan, maxevs, bsize, objnm, idx, efn, tfn, ofs, constraints, mil, opr, vb): "stand-alone constructor" if (bsize != 1): print "For StructPullSup, batch size must be 1" bsize = 1 admin, proxy = CliUtils.get_proxy_for_sup(CosNotifyChannelAdmin.STRUCTURED_EVENT, "pull", opr, CosNotifyChannelAdmin.StructuredProxyPullConsumer, chan, objnm, ofs, vb) if (proxy == None): return None client = C(chan, admin, proxy, maxevs, bsize, objnm, idx, efn, tfn, mil, vb) b = client.L_add_filter("proxy", constraints) if (b == 1): try: admin.destroy() except: pass return None return client
def Create(chan, maxevs, bsize, objnm, idx, efn, tfn, ofs, constraints, mil, opr, vb): "stand-alone constructor" admin, proxy = CliUtils.get_proxy_for_sup( CosNotifyChannelAdmin.SEQUENCE_EVENT, "pull", opr, CosNotifyChannelAdmin.SequenceProxyPullConsumer, chan, objnm, ofs, vb) if (proxy == None): return None client = C(chan, admin, proxy, maxevs, bsize, objnm, idx, efn, tfn, mil, vb) client.num_batches = 1 # tracks the NEXT batch number b = client.L_add_filter("proxy", constraints) if (b == 1): try: admin.destroy() except: pass return None return client
def Create(chan, maxevs, bsize, objnm, idx, efn, tfn, constraints, mil, opr, vb): "stand-alone constructor" if (bsize != 1): print "For AnyPushCon, batch size must be 1" bsize = 1 admin, proxy = CliUtils.get_proxy_for_con(CosNotifyChannelAdmin.ANY_EVENT, "push", opr, CosNotifyChannelAdmin.ProxyPushSupplier, chan, objnm, vb) if (proxy == None): return None client = C(chan, admin, proxy, maxevs, bsize, objnm, idx, efn, tfn, mil, vb) b = client.L_add_filter("proxy", constraints) if (b == 1): try: admin.destroy() except: pass return None return client
nqos = [prop] chan = ChanUtils.get_channel_qos(fact, nqos, [], verbose) # get new channel if (chan != None): if (verbose > 0): print "FooTests: get_channel_qos OK" print_chan_properties(chan) else: print "FooTests: chan not created -- unexpected!!" num_failed += 1 if (chan != None): if (verbose > 0): print "FooTests: chan was created -- getting admin, proxy" admin, proxy = CliUtils.get_proxy_for_con( CosNotifyChannelAdmin.STRUCTURED_EVENT, "push", "AND", CosNotifyChannelAdmin.StructuredProxyPushSupplier, chan, "FooTest", verbose) if (admin != None): if (verbose > 0): print "Trying set_qos on admin" num_tests += 1 try: admin.set_qos(nqos) if (verbose > 0): print "Setting on admin worked, as expected" except CosNotification.UnsupportedQoS, eseqlist: if (verbose > 0): print "UnsupportedQoS exception -- unexpected!!" num_failed += 1 for eseq in eseqlist: PropUtils.print_propseq(eseq)