示例#1
0
    Type = Thrift.Type,
    exports = module.exports;

var UNKNOWN = 0,
    INVALID_DATA = 1,
    NEGATIVE_SIZE = 2,
    SIZE_LIMIT = 3,
    BAD_VERSION = 4,
    NOT_IMPLEMENTED = 5,
    DEPTH_LIMIT = 6;

var TProtocolException = function(type, message) {
  Thrift.TException.call(this, message);
  this.type = type;
};
util.inherits(TProtocolException, Thrift.TException, 'TProtocolException');


//
// PROTOCOL SUPPORT
//
///////////////////////////////////////////////////////////

var TProtocolSupport = function(trans, javaClass) {
  this.__jsupport = new javaClass(trans._get_java_input_buffer(), trans._get_java_output_buffer());
};

function __catch(e) {
  if (!e.javaException)
    throw e;
  e = e.javaException;
示例#2
0
  INVALID_MESSAGE_TYPE: 2,
  WRONG_METHOD_NAME: 3,
  BAD_SEQUENCE_ID: 4,
  MISSING_RESULT: 5,
  INTERNAL_ERROR: 6,
  PROTOCOL_ERROR: 7,
  INVALID_TRANSFORM: 8,
  INVALID_PROTOCOL: 9,
  UNSUPPORTED_CLIENT_TYPE: 10
};

var TApplicationException = exports.TApplicationException = function(type, message) {
  TException.call(this, message);
  this.type = type || TApplicationExceptionType.UNKNOWN;
};
util.inherits(TApplicationException, TException, 'TApplicationException');

TApplicationException.prototype.read = function(input) {
  var ftype;
  var ret = input.readStructBegin('TApplicationException');

  while (1) {
    ret = input.readFieldBegin();
    if (ret.ftype === Type.STOP)
      break;

    switch (ret.fid) {
      case 1:
        if (ret.ftype === Type.STRING) {
          ret = input.readString();
          this.message = ret;
示例#3
0
exports.inherits = function(constructor, superConstructor) {
  util.inherits(constructor, superConstructor);
};
示例#4
0
  else
    return this.inputBuffer._to_java_buffer();
};
TTransport.prototype._get_java_output_buffer = function() {
  return this.outputBuffer;
};


// ----------------------------------------------------------------------
// Transport based on vertx Event Bus
// ----------------------------------------------------------------------

var TEventBusServerTransport = exports.TEventBusServerTransport = function(inputBuffer, onFlush) {
  TTransport.call(this, inputBuffer, onFlush);
};
util.inherits(TEventBusServerTransport, TTransport, 'TEventBusServerTransport');

TEventBusServerTransport.receiver = function(callback) {
  return function(message, replier) {
    var transport = new TEventBusServerTransport(message);
    transport.setReplier(replier);
    callback(transport);
  };
};

TEventBusServerTransport.prototype.setReplier = function(replier) {
  this.replier = replier;
};

TEventBusServerTransport.prototype.flush = function() {
  this.replier(this._get_java_output_buffer());