def pn_connection_open(conn):
  props = dat2obj(conn.properties)
  offered = dat2obj(conn.offered_capabilities)
  desired = dat2obj(conn.desired_capabilities)
  if props:
    conn.impl.setProperties(props)
  if offered:
    conn.impl.setOfferedCapabilities(array(list(offered), Symbol))
  if desired:
    conn.impl.setDesiredCapabilities(array(list(desired), Symbol))
  conn.impl.open()
Exemple #2
0
def pn_connection_open(conn):
  props = dat2obj(conn.properties)
  offered = dat2obj(conn.offered_capabilities)
  desired = dat2obj(conn.desired_capabilities)
  if props:
    conn.impl.setProperties(props)
  if offered:
    conn.impl.setOfferedCapabilities(array(list(offered), Symbol))
  if desired:
    conn.impl.setDesiredCapabilities(array(list(desired), Symbol))
  conn.impl.open()
Exemple #3
0
def pn_transport_push(trans, input):
  result = 0
  while input:
    cap = pn_transport_capacity(trans)
    if cap < 0:
      return cap
    elif len(input) > cap:
      trimmed = input[:cap]
    else:
      trimmed = input

    bb = trans.impl.tail()
    bb.put(array(trimmed, 'b'))
    trans.impl.process()
    input = input[cap:]
    result += len(trimmed)
  return result
def pn_transport_push(trans, input):
  result = 0
  while input:
    cap = pn_transport_capacity(trans)
    if cap < 0:
      return cap
    elif len(input) > cap:
      trimmed = input[:cap]
    else:
      trimmed = input

    bb = trans.impl.tail()
    bb.put(array(trimmed, 'b'))
    trans.impl.process()
    input = input[cap:]
    result += len(trimmed)
  return result
 def encode(self):
   impl = TERMINUS_TYPES_P2J[self.type]()
   if self.type in (PN_SOURCE, PN_TARGET):
     impl.setAddress(self.address)
     impl.setDurable(DURABILITY_P2J[self.durability])
     impl.setExpiryPolicy(EXPIRY_POLICY_P2J[self.expiry_policy])
     impl.setTimeout(UnsignedInteger.valueOf(self.timeout))
     impl.setDynamic(self.dynamic)
     props = dat2obj(self.properties)
     caps = dat2obj(self.capabilities)
     if props: impl.setDynamicNodeProperties(props)
     if caps:
       impl.setCapabilities(*array(list(caps), Symbol))
     if self.type == PN_SOURCE:
       impl.setDistributionMode(DISTRIBUTION_MODE_P2J[self.distribution_mode])
       outcomes = dat2obj(self.outcomes)
       filter = dat2obj(self.filter)
       if outcomes: impl.setOutcomes(outcomes)
       if filter: impl.setFilter(filter)
   return impl
Exemple #6
0
 def encode(self):
   impl = TERMINUS_TYPES_P2J[self.type]()
   if self.type in (PN_SOURCE, PN_TARGET):
     impl.setAddress(self.address)
     impl.setDurable(DURABILITY_P2J[self.durability])
     impl.setExpiryPolicy(EXPIRY_POLICY_P2J[self.expiry_policy])
     impl.setTimeout(UnsignedInteger.valueOf(self.timeout))
     impl.setDynamic(self.dynamic)
     props = dat2obj(self.properties)
     caps = dat2obj(self.capabilities)
     if props: impl.setDynamicNodeProperties(props)
     if caps:
       impl.setCapabilities(*array(list(caps), Symbol))
     if self.type == PN_SOURCE:
       impl.setDistributionMode(DISTRIBUTION_MODE_P2J[self.distribution_mode])
       outcomes = dat2obj(self.outcomes)
       filter = dat2obj(self.filter)
       if outcomes: impl.setOutcomes(outcomes)
       if filter: impl.setFilter(filter)
   return impl
def pn_link_send(link, bytes):
  return link.impl.send(array(bytes, 'b'), 0, len(bytes))
def pn_data_decode(data, encoded):
    return data.decode(ByteBuffer.wrap(array(encoded, 'b')))
def pn_data_put_uuid(data, u):
    bb = ByteBuffer.wrap(array(u, 'b'))
    first = bb.getLong()
    second = bb.getLong()
    data.putUUID(JUUID(first, second))
    return 0
Exemple #10
0
def pn_data_put_binary(data, b):
    data.putBinary(array(b, 'b'))
    return 0
Exemple #11
0
def pn_data_put_binary(data, b):
  data.putBinary(array(b, 'b'))
  return 0
Exemple #12
0
def pn_delivery(link, tag):
  return wrap(link.impl.delivery(array(tag, 'b')), pn_delivery_wrapper)
Exemple #13
0
def pn_link_send(link, bytes):
  return link.impl.send(array(bytes, 'b'), 0, len(bytes))
Exemple #14
0
def pn_data_decode(data, encoded):
  return data.decode(ByteBuffer.wrap(array(encoded, 'b')))
Exemple #15
0
def pn_data_put_uuid(data, u):
  bb = ByteBuffer.wrap(array(u, 'b'))
  first = bb.getLong()
  second = bb.getLong()
  data.putUUID(JUUID(first, second))
  return 0
def pn_delivery(link, tag):
  return wrap(link.impl.delivery(array(tag, 'b')), pn_delivery_wrapper)
Exemple #17
0
def pn_data_put_decimal128(data, d):
    data.putDecimal128(Decimal128(array(d, 'b')))
    return 0
Exemple #18
0
def pn_data_put_decimal128(data, d):
  data.putDecimal128(Decimal128(array(d, 'b')))
  return 0