private static SapoBrokerClient.Encoding.Thrift.Messages.Authentication getAuthMessage(NetMessage message)
        {
            NetAuthentication netAuth = message.Action.AuthenticationMessage;

            SapoBrokerClient.Encoding.Thrift.Messages.Authentication auth = new SapoBrokerClient.Encoding.Thrift.Messages.Authentication();
            auth.Action_id           = netAuth.ActionId;
            auth.Authentication_type = netAuth.AuthenticationType;
            if (netAuth.Roles != null)
            {
                List <string> roles = netAuth.Roles as List <string>;
                if (roles == null)
                {
                    roles = new List <string>(netAuth.Roles);
                }
                auth.Roles = roles;
            }
            auth.Token   = netAuth.Token;
            auth.User_id = netAuth.UserId;

            return(auth);
        }
Example #2
0
 public void Read(TProtocol iprot)
 {
     TField field;
       iprot.ReadStructBegin();
       while (true)
       {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) {
       break;
     }
     switch (field.ID)
     {
       case 1:
     if (field.Type == TType.Struct) {
       this.publish = new Publish();
       this.publish.Read(iprot);
       this.__isset.publish = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 2:
     if (field.Type == TType.Struct) {
       this.poll = new Poll();
       this.poll.Read(iprot);
       this.__isset.poll = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 3:
     if (field.Type == TType.Struct) {
       this.accepted = new Accepted();
       this.accepted.Read(iprot);
       this.__isset.accepted = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 4:
     if (field.Type == TType.Struct) {
       this.ack_message = new Acknowledge();
       this.ack_message.Read(iprot);
       this.__isset.ack_message = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 5:
     if (field.Type == TType.Struct) {
       this.subscribe = new Subscribe();
       this.subscribe.Read(iprot);
       this.__isset.subscribe = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 6:
     if (field.Type == TType.Struct) {
       this.unsubscribe = new Unsubscribe();
       this.unsubscribe.Read(iprot);
       this.__isset.unsubscribe = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 7:
     if (field.Type == TType.Struct) {
       this.notification = new Notification();
       this.notification.Read(iprot);
       this.__isset.notification = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 8:
     if (field.Type == TType.Struct) {
       this.fault = new Fault();
       this.fault.Read(iprot);
       this.__isset.fault = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 9:
     if (field.Type == TType.Struct) {
       this.ping = new Ping();
       this.ping.Read(iprot);
       this.__isset.ping = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 10:
     if (field.Type == TType.Struct) {
       this.pong = new Pong();
       this.pong.Read(iprot);
       this.__isset.pong = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 11:
     if (field.Type == TType.Struct) {
       this.auth = new Authentication();
       this.auth.Read(iprot);
       this.__isset.auth = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 12:
     if (field.Type == TType.I32) {
       this.action_type = (ActionType)iprot.ReadI32();
       this.__isset.action_type = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       default:
     TProtocolUtil.Skip(iprot, field.Type);
     break;
     }
     iprot.ReadFieldEnd();
       }
       iprot.ReadStructEnd();
 }
        private static SapoBrokerClient.Encoding.Thrift.Messages.Authentication getAuthMessage(NetMessage message)
        {
            NetAuthentication  netAuth = message.Action.AuthenticationMessage;

            SapoBrokerClient.Encoding.Thrift.Messages.Authentication auth = new SapoBrokerClient.Encoding.Thrift.Messages.Authentication();
            auth.Action_id = netAuth.ActionId;
            auth.Authentication_type = netAuth.AuthenticationType;
            if (netAuth.Roles != null)
            {
                List<string> roles = netAuth.Roles as List<string>;
                if (roles == null)
                {
                    roles = new List<string>(netAuth.Roles);
                }
                auth.Roles = roles;
            }
            auth.Token = netAuth.Token;
            auth.User_id = netAuth.UserId;

            return auth;
        }