public KahaTransactionInfo createTransactionInfo(TransactionId txid) {
    if (txid == null) {
      return null;
    }
    KahaTransactionInfo rc = new KahaTransactionInfo();

    if (txid.isLocalTransaction()) {
      LocalTransactionId t = (LocalTransactionId) txid;
      KahaLocalTransactionId kahaTxId = new KahaLocalTransactionId();
      kahaTxId.setConnectionId(t.getConnectionId().getValue());
      kahaTxId.setTransactionId(t.getValue());
      rc.setLocalTransactionId(kahaTxId);
    } else {
      XATransactionId t = (XATransactionId) txid;
      KahaXATransactionId kahaTxId = new KahaXATransactionId();
      kahaTxId.setBranchQualifier(new Buffer(t.getBranchQualifier()));
      kahaTxId.setGlobalTransactionId(new Buffer(t.getGlobalTransactionId()));
      kahaTxId.setFormatId(t.getFormatId());
      rc.setXaTransactionId(kahaTxId);
    }
    return rc;
  }
 public static XidImpl toXID(XATransactionId xaXid) {
   return new XidImpl(
       xaXid.getBranchQualifier(), xaXid.getFormatId(), xaXid.getGlobalTransactionId());
 }