Example #1
0
 def encode(self):
   if self.name is None:
     return None
   else:
     impl = ErrorCondition()
     impl.setCondition(Symbol.valueOf(self.name))
     impl.setDescription(self.description)
     impl.setInfo(dat2obj(self.info))
     return impl
Example #2
0
 def close(self):
     if self.condition is not None:
         if self.condition.impl is None:
             self.condition.impl = self.impl.getCondition()
         self.condition.impl.setCondition(
             Symbol.getSymbol(self.condition.name))
         self.condition.impl.setDescription(self.condition.description)
         self.condition.impl.setInfo(self.condition.info)
     self.impl.close()
Example #3
0
 def encode(self):
   if self.name is None:
     return None
   else:
     impl = ErrorCondition()
     impl.setCondition(Symbol.valueOf(self.name))
     impl.setDescription(self.description)
     impl.setInfo(dat2obj(self.info))
     return impl
Example #4
0
def pn_data_put_symbol(data, s):
    data.putSymbol(Symbol.valueOf(s))
    return 0
Example #5
0
  PN_LINK_CLOSE: TerminusExpiryPolicy.LINK_DETACH,
  PN_SESSION_CLOSE: TerminusExpiryPolicy.SESSION_END,
  PN_CONNECTION_CLOSE: TerminusExpiryPolicy.CONNECTION_CLOSE,
  PN_NEVER: TerminusExpiryPolicy.NEVER
}

EXPIRY_POLICY_J2P = {
  TerminusExpiryPolicy.LINK_DETACH: PN_LINK_CLOSE,
  TerminusExpiryPolicy.SESSION_END: PN_SESSION_CLOSE,
  TerminusExpiryPolicy.CONNECTION_CLOSE: PN_CONNECTION_CLOSE,
  TerminusExpiryPolicy.NEVER: PN_NEVER
}

DISTRIBUTION_MODE_P2J = {
  PN_DIST_MODE_UNSPECIFIED: None,
  PN_DIST_MODE_COPY: Symbol.valueOf("copy"),
  PN_DIST_MODE_MOVE: Symbol.valueOf("move")
}

DISTRIBUTION_MODE_J2P = {
  None: PN_DIST_MODE_UNSPECIFIED,
  Symbol.valueOf("copy"): PN_DIST_MODE_COPY,
  Symbol.valueOf("move"): PN_DIST_MODE_MOVE
}

class pn_terminus:

  def __init__(self, type):
    self.type = type
    self.address = None
    self.durability = PN_NONDURABLE
Example #6
0
def pn_data_put_symbol(data, s):
  data.putSymbol(Symbol.valueOf(s))
  return 0
Example #7
0
 def _set_distribution_mode(self, mode):
   if isinstance(self.impl, Source):
     if mode in [None, "copy", "move"]:
       self.impl.setDistributionMode(Symbol.valueOf(mode))
     else:
       self.impl.setDistributionMode(None)
Example #8
0
 def _set_name(self, n):
   self.impl.setCondition(Symbol.valueOf(n))
Example #9
0
 def _set_name(self, n):
     self.impl.setCondition(Symbol.valueOf(n))
Example #10
0
 def put_symbol(self, s):
   self._data.putSymbol(Symbol.valueOf(s))
Example #11
0
  def __init__(self, *args, **kwargs):
    raise ProtonUnsupportedOperationException("Connector")
class Listener(object):
  """ Proton-c platform abstraction - not needed."""
  def __init__(self, *args, **kwargs):
    raise ProtonUnsupportedOperationException("Listener")

def convertToPyArray(t,a,f):
    if a == None or len(a) == 0:
        return None

    return Array(UNDESCRIBED, t, *map(f,a))


arrayElementMappings = {
    JData.DataType.SYMBOL: lambda s: Symbol.valueOf(s)
    }

arrayTypeMappings = {
    JData.DataType.SYMBOL: Symbol
    }

conversions_J2PY = {
  dict: lambda d: dict([(J2PY(k), J2PY(v)) for k, v in d.items()]),
  HashMap: lambda m: dict([(J2PY(e.getKey()), J2PY(e.getValue())) for e in m.entrySet()]),
  list: lambda l: [J2PY(x) for x in l],
  Symbol: lambda s: symbol(s.toString()),
  UnsignedInteger: lambda n: n.longValue(),
  UnsignedLong: lambda n: n.longValue()
  }
Example #12
0
 def put_symbol(self, s):
     self._data.putSymbol(Symbol.valueOf(s))
Example #13
0
    def __eq__(self, o):
        if not isinstance(o, Condition): return False
        return (self.impl is not None and o.impl is not None and self.impl.equals(o.impl)) or \
            (self.name == o.name and \
            self.description == o.description and \
            self.info == o.info)


def convertToPyArray(t, a, f):
    if a == None or len(a) == 0:
        return None

    return Array(UNDESCRIBED, t, *map(f, a))


arrayElementMappings = {JData.DataType.SYMBOL: lambda s: Symbol.valueOf(s)}

arrayTypeMappings = {JData.DataType.SYMBOL: Symbol}


def convertFromPyArray(a):
    if a == None:
        return None

    return array(map(arrayElementMappings[a.type], a.elements),
                 arrayTypeMappings[a.type])


def wrap_connection(impl):
    if impl: return Connection(_impl=impl)
Example #14
0
 def _set_distribution_mode(self, mode):
     if isinstance(self.impl, Source):
         if mode in [None, "copy", "move"]:
             self.impl.setDistributionMode(Symbol.valueOf(mode))
         else:
             self.impl.setDistributionMode(None)
Example #15
0
  PN_EXPIRE_WITH_LINK: TerminusExpiryPolicy.LINK_DETACH,
  PN_EXPIRE_WITH_SESSION: TerminusExpiryPolicy.SESSION_END,
  PN_EXPIRE_WITH_CONNECTION: TerminusExpiryPolicy.CONNECTION_CLOSE,
  PN_EXPIRE_NEVER: TerminusExpiryPolicy.NEVER
}

EXPIRY_POLICY_J2P = {
  TerminusExpiryPolicy.LINK_DETACH: PN_EXPIRE_WITH_LINK,
  TerminusExpiryPolicy.SESSION_END: PN_EXPIRE_WITH_SESSION,
  TerminusExpiryPolicy.CONNECTION_CLOSE: PN_EXPIRE_WITH_CONNECTION,
  TerminusExpiryPolicy.NEVER: PN_EXPIRE_NEVER
}

DISTRIBUTION_MODE_P2J = {
  PN_DIST_MODE_UNSPECIFIED: None,
  PN_DIST_MODE_COPY: Symbol.valueOf("copy"),
  PN_DIST_MODE_MOVE: Symbol.valueOf("move")
}

DISTRIBUTION_MODE_J2P = {
  None: PN_DIST_MODE_UNSPECIFIED,
  Symbol.valueOf("copy"): PN_DIST_MODE_COPY,
  Symbol.valueOf("move"): PN_DIST_MODE_MOVE
}

class pn_terminus:

  def __init__(self, type):
    self.type = type
    self.address = None
    self.durability = PN_NONDURABLE
Example #16
0
 def __init__(self, name=None, description=None, info=None, impl=None):
   if impl is None:
     impl = ErrorCondition(Symbol.valueOf(name), description)
     if info is not None:
       impl.setInfo(info)
   self.impl = impl
Example #17
0
 def __init__(self, name=None, description=None, info=None, impl=None):
     if impl is None:
         impl = ErrorCondition(Symbol.valueOf(name), description)
         if info is not None:
             impl.setInfo(info)
     self.impl = impl