public void read(org.apache.thrift7.protocol.TProtocol iprot)
     throws org.apache.thrift7.TException {
   org.apache.thrift7.protocol.TField field;
   iprot.readStructBegin();
   while (true) {
     field = iprot.readFieldBegin();
     if (field.type == org.apache.thrift7.protocol.TType.STOP) {
       break;
     }
     switch (field.id) {
       case 1: // MSG
         if (field.type == org.apache.thrift7.protocol.TType.STRING) {
           this.msg = iprot.readString();
         } else {
           org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
         }
         break;
       default:
         org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
     }
     iprot.readFieldEnd();
   }
   iprot.readStructEnd();
   validate();
 }
  public void write(org.apache.thrift7.protocol.TProtocol oprot)
      throws org.apache.thrift7.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.msg != null) {
      oprot.writeFieldBegin(MSG_FIELD_DESC);
      oprot.writeString(this.msg);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
Example #3
0
    public boolean process(final TProtocol inProt, final TProtocol outProt) throws TException {
      // populating request context
      ReqContext req_context = ReqContext.context();

      TTransport trans = inProt.getTransport();
      // Sasl transport
      TSaslServerTransport saslTrans = (TSaslServerTransport) trans;

      // remote address
      TSocket tsocket = (TSocket) saslTrans.getUnderlyingTransport();
      Socket socket = tsocket.getSocket();
      req_context.setRemoteAddress(socket.getInetAddress());

      // remote subject
      SaslServer saslServer = saslTrans.getSaslServer();
      String authId = saslServer.getAuthorizationID();
      Subject remoteUser = new Subject();
      remoteUser.getPrincipals().add(new User(authId));
      req_context.setSubject(remoteUser);

      // invoke service handler
      return wrapped.process(inProt, outProt);
    }
Example #4
0
  public void write(org.apache.thrift7.protocol.TProtocol oprot)
      throws org.apache.thrift7.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.supervisors != null) {
      oprot.writeFieldBegin(SUPERVISORS_FIELD_DESC);
      {
        oprot.writeListBegin(
            new org.apache.thrift7.protocol.TList(
                org.apache.thrift7.protocol.TType.STRUCT, this.supervisors.size()));
        for (SupervisorSummary _iter43 : this.supervisors) {
          _iter43.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(NIMBUS_UPTIME_SECS_FIELD_DESC);
    oprot.writeI32(this.nimbus_uptime_secs);
    oprot.writeFieldEnd();
    if (this.topologies != null) {
      oprot.writeFieldBegin(TOPOLOGIES_FIELD_DESC);
      {
        oprot.writeListBegin(
            new org.apache.thrift7.protocol.TList(
                org.apache.thrift7.protocol.TType.STRUCT, this.topologies.size()));
        for (TopologySummary _iter44 : this.topologies) {
          _iter44.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.version != null) {
      if (is_set_version()) {
        oprot.writeFieldBegin(VERSION_FIELD_DESC);
        oprot.writeString(this.version);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
Example #5
0
 public void read(org.apache.thrift7.protocol.TProtocol iprot)
     throws org.apache.thrift7.TException {
   org.apache.thrift7.protocol.TField field;
   iprot.readStructBegin();
   while (true) {
     field = iprot.readFieldBegin();
     if (field.type == org.apache.thrift7.protocol.TType.STOP) {
       break;
     }
     switch (field.id) {
       case 1: // SUPERVISORS
         if (field.type == org.apache.thrift7.protocol.TType.LIST) {
           {
             org.apache.thrift7.protocol.TList _list37 = iprot.readListBegin();
             this.supervisors = new ArrayList<SupervisorSummary>(_list37.size);
             for (int _i38 = 0; _i38 < _list37.size; ++_i38) {
               SupervisorSummary _elem39; // required
               _elem39 = new SupervisorSummary();
               _elem39.read(iprot);
               this.supervisors.add(_elem39);
             }
             iprot.readListEnd();
           }
         } else {
           org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 2: // NIMBUS_UPTIME_SECS
         if (field.type == org.apache.thrift7.protocol.TType.I32) {
           this.nimbus_uptime_secs = iprot.readI32();
           set_nimbus_uptime_secs_isSet(true);
         } else {
           org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 3: // TOPOLOGIES
         if (field.type == org.apache.thrift7.protocol.TType.LIST) {
           {
             org.apache.thrift7.protocol.TList _list40 = iprot.readListBegin();
             this.topologies = new ArrayList<TopologySummary>(_list40.size);
             for (int _i41 = 0; _i41 < _list40.size; ++_i41) {
               TopologySummary _elem42; // required
               _elem42 = new TopologySummary();
               _elem42.read(iprot);
               this.topologies.add(_elem42);
             }
             iprot.readListEnd();
           }
         } else {
           org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 4: // VERSION
         if (field.type == org.apache.thrift7.protocol.TType.STRING) {
           this.version = iprot.readString();
         } else {
           org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
         }
         break;
       default:
         org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
     }
     iprot.readFieldEnd();
   }
   iprot.readStructEnd();
   validate();
 }