com.xiaomi.infra.galaxy.sds.thrift.AuthService Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.sds.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-8-10")
public class AuthService {
/**
* 结构化存储授权相关接口(目前尚未开放)
*/
public interface Iface extends com.xiaomi.infra.galaxy.sds.thrift.BaseService.Iface {
/**
* 通过第三方认证系统换发Storage Access Token,采用App Secret登录无需此过程
*
* @param oauthInfo
*/
public Credential createCredential(OAuthInfo oauthInfo) throws com.xiaomi.infra.galaxy.sds.thrift.ServiceException, libthrift091.TException;
}
public interface AsyncIface extends com.xiaomi.infra.galaxy.sds.thrift.BaseService .AsyncIface {
public void createCredential(OAuthInfo oauthInfo, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException;
}
public static class Client extends com.xiaomi.infra.galaxy.sds.thrift.BaseService.Client implements Iface {
public static class Factory implements libthrift091.TServiceClientFactory {
public Factory() {}
public Client getClient(libthrift091.protocol.TProtocol prot) {
return new Client(prot);
}
public Client getClient(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(libthrift091.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
super(iprot, oprot);
}
public Credential createCredential(OAuthInfo oauthInfo) throws com.xiaomi.infra.galaxy.sds.thrift.ServiceException, libthrift091.TException
{
send_createCredential(oauthInfo);
return recv_createCredential();
}
public void send_createCredential(OAuthInfo oauthInfo) throws libthrift091.TException
{
createCredential_args args = new createCredential_args();
args.setOauthInfo(oauthInfo);
sendBase("createCredential", args);
}
public Credential recv_createCredential() throws com.xiaomi.infra.galaxy.sds.thrift.ServiceException, libthrift091.TException
{
createCredential_result result = new createCredential_result();
receiveBase(result, "createCredential");
if (result.isSetSuccess()) {
return result.success;
}
if (result.se != null) {
throw result.se;
}
throw new libthrift091.TApplicationException(libthrift091.TApplicationException.MISSING_RESULT, "createCredential failed: unknown result");
}
}
public static class AsyncClient extends com.xiaomi.infra.galaxy.sds.thrift.BaseService.AsyncClient implements AsyncIface {
public static class Factory implements libthrift091.async.TAsyncClientFactory {
private libthrift091.async.TAsyncClientManager clientManager;
private libthrift091.protocol.TProtocolFactory protocolFactory;
public Factory(libthrift091.async.TAsyncClientManager clientManager, libthrift091.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(libthrift091.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.async.TAsyncClientManager clientManager, libthrift091.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void createCredential(OAuthInfo oauthInfo, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException {
checkReady();
createCredential_call method_call = new createCredential_call(oauthInfo, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class createCredential_call extends libthrift091.async.TAsyncMethodCall {
private OAuthInfo oauthInfo;
public createCredential_call(OAuthInfo oauthInfo, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.oauthInfo = oauthInfo;
}
public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException {
prot.writeMessageBegin(new libthrift091.protocol.TMessage("createCredential", libthrift091.protocol.TMessageType.CALL, 0));
createCredential_args args = new createCredential_args();
args.setOauthInfo(oauthInfo);
args.write(prot);
prot.writeMessageEnd();
}
public Credential getResult() throws com.xiaomi.infra.galaxy.sds.thrift.ServiceException, libthrift091.TException {
if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array());
libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_createCredential();
}
}
}
public static class Processor extends com.xiaomi.infra.galaxy.sds.thrift.BaseService.Processor implements libthrift091.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected Processor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.ProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
protected boolean isOneway() {
return false;
}
public createCredential_result getResult(I iface, createCredential_args args) throws libthrift091.TException {
createCredential_result result = new createCredential_result();
try {
result.success = iface.createCredential(args.oauthInfo);
} catch (com.xiaomi.infra.galaxy.sds.thrift.ServiceException se) {
result.se = se;
}
return result;
}
}
}
public static class AsyncProcessor extends com.xiaomi.infra.galaxy.sds.thrift.BaseService.AsyncProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected AsyncProcessor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.AsyncProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final libthrift091.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback() {
public void onComplete(Credential o) {
createCredential_result result = new createCredential_result();
result.success = o;
try {
fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = libthrift091.protocol.TMessageType.REPLY;
libthrift091.TBase msg;
createCredential_result result = new createCredential_result();
if (e instanceof com.xiaomi.infra.galaxy.sds.thrift.ServiceException) {
result.se = (com.xiaomi.infra.galaxy.sds.thrift.ServiceException) e;
result.setSeIsSet(true);
msg = result;
}
else
{
msgType = libthrift091.protocol.TMessageType.EXCEPTION;
msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, createCredential_args args, libthrift091.async.AsyncMethodCallback resultHandler) throws TException {
iface.createCredential(args.oauthInfo,resultHandler);
}
}
}
public static class createCredential_args implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("createCredential_args");
private static final libthrift091.protocol.TField OAUTH_INFO_FIELD_DESC = new libthrift091.protocol.TField("oauthInfo", libthrift091.protocol.TType.STRUCT, (short)1);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createCredential_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new createCredential_argsTupleSchemeFactory());
}
public OAuthInfo oauthInfo; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
OAUTH_INFO((short)1, "oauthInfo");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // OAUTH_INFO
return OAUTH_INFO;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.OAUTH_INFO, new libthrift091.meta_data.FieldMetaData("oauthInfo", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, OAuthInfo.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(createCredential_args.class, metaDataMap);
}
public createCredential_args() {
}
public createCredential_args(
OAuthInfo oauthInfo)
{
this();
this.oauthInfo = oauthInfo;
}
/**
* Performs a deep copy on other.
*/
public createCredential_args(createCredential_args other) {
if (other.isSetOauthInfo()) {
this.oauthInfo = new OAuthInfo(other.oauthInfo);
}
}
public createCredential_args deepCopy() {
return new createCredential_args(this);
}
@Override
public void clear() {
this.oauthInfo = null;
}
public OAuthInfo getOauthInfo() {
return this.oauthInfo;
}
public createCredential_args setOauthInfo(OAuthInfo oauthInfo) {
this.oauthInfo = oauthInfo;
return this;
}
public void unsetOauthInfo() {
this.oauthInfo = null;
}
/** Returns true if field oauthInfo is set (has been assigned a value) and false otherwise */
public boolean isSetOauthInfo() {
return this.oauthInfo != null;
}
public void setOauthInfoIsSet(boolean value) {
if (!value) {
this.oauthInfo = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case OAUTH_INFO:
if (value == null) {
unsetOauthInfo();
} else {
setOauthInfo((OAuthInfo)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case OAUTH_INFO:
return getOauthInfo();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case OAUTH_INFO:
return isSetOauthInfo();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof createCredential_args)
return this.equals((createCredential_args)that);
return false;
}
public boolean equals(createCredential_args that) {
if (that == null)
return false;
boolean this_present_oauthInfo = true && this.isSetOauthInfo();
boolean that_present_oauthInfo = true && that.isSetOauthInfo();
if (this_present_oauthInfo || that_present_oauthInfo) {
if (!(this_present_oauthInfo && that_present_oauthInfo))
return false;
if (!this.oauthInfo.equals(that.oauthInfo))
return false;
}
return true;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy