accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1438564 - in /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift: ThriftInstanceTokenWrapper.java ThriftKerberosToken.java ThriftUserPassToken.java
Date Fri, 25 Jan 2013 15:54:35 GMT
Author: ecn
Date: Fri Jan 25 15:54:35 2013
New Revision: 1438564

URL: http://svn.apache.org/viewvc?rev=1438564&view=rev
Log:
ACCUMULO-259: adding generated sources for those who do not have thrift installed

Added:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java   (with props)

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java?rev=1438564&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java Fri Jan 25 15:54:35 2013
@@ -0,0 +1,613 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.core.security.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class ThriftInstanceTokenWrapper implements org.apache.thrift.TBase<ThriftInstanceTokenWrapper, ThriftInstanceTokenWrapper._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftInstanceTokenWrapper");
+
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField TOKEN_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenClass", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField INSTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("instance", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new ThriftInstanceTokenWrapperStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new ThriftInstanceTokenWrapperTupleSchemeFactory());
+  }
+
+  public ByteBuffer token; // required
+  public String tokenClass; // required
+  public String instance; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    TOKEN((short)1, "token"),
+    TOKEN_CLASS((short)2, "tokenClass"),
+    INSTANCE((short)3, "instance");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    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: // TOKEN
+          return TOKEN;
+        case 2: // TOKEN_CLASS
+          return TOKEN_CLASS;
+        case 3: // INSTANCE
+          return INSTANCE;
+        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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
+    tmpMap.put(_Fields.TOKEN_CLASS, new org.apache.thrift.meta_data.FieldMetaData("tokenClass", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.INSTANCE, new org.apache.thrift.meta_data.FieldMetaData("instance", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftInstanceTokenWrapper.class, metaDataMap);
+  }
+
+  public ThriftInstanceTokenWrapper() {
+  }
+
+  public ThriftInstanceTokenWrapper(
+    ByteBuffer token,
+    String tokenClass,
+    String instance)
+  {
+    this();
+    this.token = token;
+    this.tokenClass = tokenClass;
+    this.instance = instance;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ThriftInstanceTokenWrapper(ThriftInstanceTokenWrapper other) {
+    if (other.isSetToken()) {
+      this.token = org.apache.thrift.TBaseHelper.copyBinary(other.token);
+;
+    }
+    if (other.isSetTokenClass()) {
+      this.tokenClass = other.tokenClass;
+    }
+    if (other.isSetInstance()) {
+      this.instance = other.instance;
+    }
+  }
+
+  public ThriftInstanceTokenWrapper deepCopy() {
+    return new ThriftInstanceTokenWrapper(this);
+  }
+
+  @Override
+  public void clear() {
+    this.token = null;
+    this.tokenClass = null;
+    this.instance = null;
+  }
+
+  public byte[] getToken() {
+    setToken(org.apache.thrift.TBaseHelper.rightSize(token));
+    return token == null ? null : token.array();
+  }
+
+  public ByteBuffer bufferForToken() {
+    return token;
+  }
+
+  public ThriftInstanceTokenWrapper setToken(byte[] token) {
+    setToken(token == null ? (ByteBuffer)null : ByteBuffer.wrap(token));
+    return this;
+  }
+
+  public ThriftInstanceTokenWrapper setToken(ByteBuffer token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public String getTokenClass() {
+    return this.tokenClass;
+  }
+
+  public ThriftInstanceTokenWrapper setTokenClass(String tokenClass) {
+    this.tokenClass = tokenClass;
+    return this;
+  }
+
+  public void unsetTokenClass() {
+    this.tokenClass = null;
+  }
+
+  /** Returns true if field tokenClass is set (has been assigned a value) and false otherwise */
+  public boolean isSetTokenClass() {
+    return this.tokenClass != null;
+  }
+
+  public void setTokenClassIsSet(boolean value) {
+    if (!value) {
+      this.tokenClass = null;
+    }
+  }
+
+  public String getInstance() {
+    return this.instance;
+  }
+
+  public ThriftInstanceTokenWrapper setInstance(String instance) {
+    this.instance = instance;
+    return this;
+  }
+
+  public void unsetInstance() {
+    this.instance = null;
+  }
+
+  /** Returns true if field instance is set (has been assigned a value) and false otherwise */
+  public boolean isSetInstance() {
+    return this.instance != null;
+  }
+
+  public void setInstanceIsSet(boolean value) {
+    if (!value) {
+      this.instance = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((ByteBuffer)value);
+      }
+      break;
+
+    case TOKEN_CLASS:
+      if (value == null) {
+        unsetTokenClass();
+      } else {
+        setTokenClass((String)value);
+      }
+      break;
+
+    case INSTANCE:
+      if (value == null) {
+        unsetInstance();
+      } else {
+        setInstance((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case TOKEN:
+      return getToken();
+
+    case TOKEN_CLASS:
+      return getTokenClass();
+
+    case INSTANCE:
+      return getInstance();
+
+    }
+    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 TOKEN:
+      return isSetToken();
+    case TOKEN_CLASS:
+      return isSetTokenClass();
+    case INSTANCE:
+      return isSetInstance();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ThriftInstanceTokenWrapper)
+      return this.equals((ThriftInstanceTokenWrapper)that);
+    return false;
+  }
+
+  public boolean equals(ThriftInstanceTokenWrapper that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    boolean this_present_tokenClass = true && this.isSetTokenClass();
+    boolean that_present_tokenClass = true && that.isSetTokenClass();
+    if (this_present_tokenClass || that_present_tokenClass) {
+      if (!(this_present_tokenClass && that_present_tokenClass))
+        return false;
+      if (!this.tokenClass.equals(that.tokenClass))
+        return false;
+    }
+
+    boolean this_present_instance = true && this.isSetInstance();
+    boolean that_present_instance = true && that.isSetInstance();
+    if (this_present_instance || that_present_instance) {
+      if (!(this_present_instance && that_present_instance))
+        return false;
+      if (!this.instance.equals(that.instance))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(ThriftInstanceTokenWrapper other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    ThriftInstanceTokenWrapper typedOther = (ThriftInstanceTokenWrapper)other;
+
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(typedOther.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, typedOther.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetTokenClass()).compareTo(typedOther.isSetTokenClass());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTokenClass()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokenClass, typedOther.tokenClass);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetInstance()).compareTo(typedOther.isSetInstance());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetInstance()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instance, typedOther.instance);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("ThriftInstanceTokenWrapper(");
+    boolean first = true;
+
+    sb.append("token:");
+    if (this.token == null) {
+      sb.append("null");
+    } else {
+      org.apache.thrift.TBaseHelper.toString(this.token, sb);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("tokenClass:");
+    if (this.tokenClass == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.tokenClass);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("instance:");
+    if (this.instance == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.instance);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class ThriftInstanceTokenWrapperStandardSchemeFactory implements SchemeFactory {
+    public ThriftInstanceTokenWrapperStandardScheme getScheme() {
+      return new ThriftInstanceTokenWrapperStandardScheme();
+    }
+  }
+
+  private static class ThriftInstanceTokenWrapperStandardScheme extends StandardScheme<ThriftInstanceTokenWrapper> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftInstanceTokenWrapper struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readBinary();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // TOKEN_CLASS
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.tokenClass = iprot.readString();
+              struct.setTokenClassIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // INSTANCE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.instance = iprot.readString();
+              struct.setInstanceIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftInstanceTokenWrapper struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.token != null) {
+        oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+        oprot.writeBinary(struct.token);
+        oprot.writeFieldEnd();
+      }
+      if (struct.tokenClass != null) {
+        oprot.writeFieldBegin(TOKEN_CLASS_FIELD_DESC);
+        oprot.writeString(struct.tokenClass);
+        oprot.writeFieldEnd();
+      }
+      if (struct.instance != null) {
+        oprot.writeFieldBegin(INSTANCE_FIELD_DESC);
+        oprot.writeString(struct.instance);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ThriftInstanceTokenWrapperTupleSchemeFactory implements SchemeFactory {
+    public ThriftInstanceTokenWrapperTupleScheme getScheme() {
+      return new ThriftInstanceTokenWrapperTupleScheme();
+    }
+  }
+
+  private static class ThriftInstanceTokenWrapperTupleScheme extends TupleScheme<ThriftInstanceTokenWrapper> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftInstanceTokenWrapper struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetToken()) {
+        optionals.set(0);
+      }
+      if (struct.isSetTokenClass()) {
+        optionals.set(1);
+      }
+      if (struct.isSetInstance()) {
+        optionals.set(2);
+      }
+      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetToken()) {
+        oprot.writeBinary(struct.token);
+      }
+      if (struct.isSetTokenClass()) {
+        oprot.writeString(struct.tokenClass);
+      }
+      if (struct.isSetInstance()) {
+        oprot.writeString(struct.instance);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftInstanceTokenWrapper struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(3);
+      if (incoming.get(0)) {
+        struct.token = iprot.readBinary();
+        struct.setTokenIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.tokenClass = iprot.readString();
+        struct.setTokenClassIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.instance = iprot.readString();
+        struct.setInstanceIsSet(true);
+      }
+    }
+  }
+
+}
+

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java?rev=1438564&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java Fri Jan 25 15:54:35 2013
@@ -0,0 +1,513 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.core.security.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class ThriftKerberosToken implements org.apache.thrift.TBase<ThriftKerberosToken, ThriftKerberosToken._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftKerberosToken");
+
+  private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField TICKET_FIELD_DESC = new org.apache.thrift.protocol.TField("ticket", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new ThriftKerberosTokenStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new ThriftKerberosTokenTupleSchemeFactory());
+  }
+
+  public String user; // required
+  public ByteBuffer ticket; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    USER((short)1, "user"),
+    TICKET((short)2, "ticket");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    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: // USER
+          return USER;
+        case 2: // TICKET
+          return TICKET;
+        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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.TICKET, new org.apache.thrift.meta_data.FieldMetaData("ticket", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftKerberosToken.class, metaDataMap);
+  }
+
+  public ThriftKerberosToken() {
+  }
+
+  public ThriftKerberosToken(
+    String user,
+    ByteBuffer ticket)
+  {
+    this();
+    this.user = user;
+    this.ticket = ticket;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ThriftKerberosToken(ThriftKerberosToken other) {
+    if (other.isSetUser()) {
+      this.user = other.user;
+    }
+    if (other.isSetTicket()) {
+      this.ticket = org.apache.thrift.TBaseHelper.copyBinary(other.ticket);
+;
+    }
+  }
+
+  public ThriftKerberosToken deepCopy() {
+    return new ThriftKerberosToken(this);
+  }
+
+  @Override
+  public void clear() {
+    this.user = null;
+    this.ticket = null;
+  }
+
+  public String getUser() {
+    return this.user;
+  }
+
+  public ThriftKerberosToken setUser(String user) {
+    this.user = user;
+    return this;
+  }
+
+  public void unsetUser() {
+    this.user = null;
+  }
+
+  /** Returns true if field user is set (has been assigned a value) and false otherwise */
+  public boolean isSetUser() {
+    return this.user != null;
+  }
+
+  public void setUserIsSet(boolean value) {
+    if (!value) {
+      this.user = null;
+    }
+  }
+
+  public byte[] getTicket() {
+    setTicket(org.apache.thrift.TBaseHelper.rightSize(ticket));
+    return ticket == null ? null : ticket.array();
+  }
+
+  public ByteBuffer bufferForTicket() {
+    return ticket;
+  }
+
+  public ThriftKerberosToken setTicket(byte[] ticket) {
+    setTicket(ticket == null ? (ByteBuffer)null : ByteBuffer.wrap(ticket));
+    return this;
+  }
+
+  public ThriftKerberosToken setTicket(ByteBuffer ticket) {
+    this.ticket = ticket;
+    return this;
+  }
+
+  public void unsetTicket() {
+    this.ticket = null;
+  }
+
+  /** Returns true if field ticket is set (has been assigned a value) and false otherwise */
+  public boolean isSetTicket() {
+    return this.ticket != null;
+  }
+
+  public void setTicketIsSet(boolean value) {
+    if (!value) {
+      this.ticket = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case USER:
+      if (value == null) {
+        unsetUser();
+      } else {
+        setUser((String)value);
+      }
+      break;
+
+    case TICKET:
+      if (value == null) {
+        unsetTicket();
+      } else {
+        setTicket((ByteBuffer)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case USER:
+      return getUser();
+
+    case TICKET:
+      return getTicket();
+
+    }
+    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 USER:
+      return isSetUser();
+    case TICKET:
+      return isSetTicket();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ThriftKerberosToken)
+      return this.equals((ThriftKerberosToken)that);
+    return false;
+  }
+
+  public boolean equals(ThriftKerberosToken that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_user = true && this.isSetUser();
+    boolean that_present_user = true && that.isSetUser();
+    if (this_present_user || that_present_user) {
+      if (!(this_present_user && that_present_user))
+        return false;
+      if (!this.user.equals(that.user))
+        return false;
+    }
+
+    boolean this_present_ticket = true && this.isSetTicket();
+    boolean that_present_ticket = true && that.isSetTicket();
+    if (this_present_ticket || that_present_ticket) {
+      if (!(this_present_ticket && that_present_ticket))
+        return false;
+      if (!this.ticket.equals(that.ticket))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(ThriftKerberosToken other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    ThriftKerberosToken typedOther = (ThriftKerberosToken)other;
+
+    lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUser()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetTicket()).compareTo(typedOther.isSetTicket());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTicket()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ticket, typedOther.ticket);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("ThriftKerberosToken(");
+    boolean first = true;
+
+    sb.append("user:");
+    if (this.user == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.user);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("ticket:");
+    if (this.ticket == null) {
+      sb.append("null");
+    } else {
+      org.apache.thrift.TBaseHelper.toString(this.ticket, sb);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class ThriftKerberosTokenStandardSchemeFactory implements SchemeFactory {
+    public ThriftKerberosTokenStandardScheme getScheme() {
+      return new ThriftKerberosTokenStandardScheme();
+    }
+  }
+
+  private static class ThriftKerberosTokenStandardScheme extends StandardScheme<ThriftKerberosToken> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftKerberosToken struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // USER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.user = iprot.readString();
+              struct.setUserIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // TICKET
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.ticket = iprot.readBinary();
+              struct.setTicketIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftKerberosToken struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.user != null) {
+        oprot.writeFieldBegin(USER_FIELD_DESC);
+        oprot.writeString(struct.user);
+        oprot.writeFieldEnd();
+      }
+      if (struct.ticket != null) {
+        oprot.writeFieldBegin(TICKET_FIELD_DESC);
+        oprot.writeBinary(struct.ticket);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ThriftKerberosTokenTupleSchemeFactory implements SchemeFactory {
+    public ThriftKerberosTokenTupleScheme getScheme() {
+      return new ThriftKerberosTokenTupleScheme();
+    }
+  }
+
+  private static class ThriftKerberosTokenTupleScheme extends TupleScheme<ThriftKerberosToken> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftKerberosToken struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetUser()) {
+        optionals.set(0);
+      }
+      if (struct.isSetTicket()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetUser()) {
+        oprot.writeString(struct.user);
+      }
+      if (struct.isSetTicket()) {
+        oprot.writeBinary(struct.ticket);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftKerberosToken struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.user = iprot.readString();
+        struct.setUserIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.ticket = iprot.readBinary();
+        struct.setTicketIsSet(true);
+      }
+    }
+  }
+
+}
+

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java?rev=1438564&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java Fri Jan 25 15:54:35 2013
@@ -0,0 +1,513 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.core.security.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class ThriftUserPassToken implements org.apache.thrift.TBase<ThriftUserPassToken, ThriftUserPassToken._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftUserPassToken");
+
+  private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new ThriftUserPassTokenStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new ThriftUserPassTokenTupleSchemeFactory());
+  }
+
+  public String user; // required
+  public ByteBuffer password; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    USER((short)1, "user"),
+    PASSWORD((short)2, "password");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    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: // USER
+          return USER;
+        case 2: // PASSWORD
+          return PASSWORD;
+        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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftUserPassToken.class, metaDataMap);
+  }
+
+  public ThriftUserPassToken() {
+  }
+
+  public ThriftUserPassToken(
+    String user,
+    ByteBuffer password)
+  {
+    this();
+    this.user = user;
+    this.password = password;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ThriftUserPassToken(ThriftUserPassToken other) {
+    if (other.isSetUser()) {
+      this.user = other.user;
+    }
+    if (other.isSetPassword()) {
+      this.password = org.apache.thrift.TBaseHelper.copyBinary(other.password);
+;
+    }
+  }
+
+  public ThriftUserPassToken deepCopy() {
+    return new ThriftUserPassToken(this);
+  }
+
+  @Override
+  public void clear() {
+    this.user = null;
+    this.password = null;
+  }
+
+  public String getUser() {
+    return this.user;
+  }
+
+  public ThriftUserPassToken setUser(String user) {
+    this.user = user;
+    return this;
+  }
+
+  public void unsetUser() {
+    this.user = null;
+  }
+
+  /** Returns true if field user is set (has been assigned a value) and false otherwise */
+  public boolean isSetUser() {
+    return this.user != null;
+  }
+
+  public void setUserIsSet(boolean value) {
+    if (!value) {
+      this.user = null;
+    }
+  }
+
+  public byte[] getPassword() {
+    setPassword(org.apache.thrift.TBaseHelper.rightSize(password));
+    return password == null ? null : password.array();
+  }
+
+  public ByteBuffer bufferForPassword() {
+    return password;
+  }
+
+  public ThriftUserPassToken setPassword(byte[] password) {
+    setPassword(password == null ? (ByteBuffer)null : ByteBuffer.wrap(password));
+    return this;
+  }
+
+  public ThriftUserPassToken setPassword(ByteBuffer password) {
+    this.password = password;
+    return this;
+  }
+
+  public void unsetPassword() {
+    this.password = null;
+  }
+
+  /** Returns true if field password is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassword() {
+    return this.password != null;
+  }
+
+  public void setPasswordIsSet(boolean value) {
+    if (!value) {
+      this.password = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case USER:
+      if (value == null) {
+        unsetUser();
+      } else {
+        setUser((String)value);
+      }
+      break;
+
+    case PASSWORD:
+      if (value == null) {
+        unsetPassword();
+      } else {
+        setPassword((ByteBuffer)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case USER:
+      return getUser();
+
+    case PASSWORD:
+      return getPassword();
+
+    }
+    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 USER:
+      return isSetUser();
+    case PASSWORD:
+      return isSetPassword();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ThriftUserPassToken)
+      return this.equals((ThriftUserPassToken)that);
+    return false;
+  }
+
+  public boolean equals(ThriftUserPassToken that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_user = true && this.isSetUser();
+    boolean that_present_user = true && that.isSetUser();
+    if (this_present_user || that_present_user) {
+      if (!(this_present_user && that_present_user))
+        return false;
+      if (!this.user.equals(that.user))
+        return false;
+    }
+
+    boolean this_present_password = true && this.isSetPassword();
+    boolean that_present_password = true && that.isSetPassword();
+    if (this_present_password || that_present_password) {
+      if (!(this_present_password && that_present_password))
+        return false;
+      if (!this.password.equals(that.password))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(ThriftUserPassToken other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    ThriftUserPassToken typedOther = (ThriftUserPassToken)other;
+
+    lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUser()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(typedOther.isSetPassword());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassword()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, typedOther.password);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("ThriftUserPassToken(");
+    boolean first = true;
+
+    sb.append("user:");
+    if (this.user == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.user);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("password:");
+    if (this.password == null) {
+      sb.append("null");
+    } else {
+      org.apache.thrift.TBaseHelper.toString(this.password, sb);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class ThriftUserPassTokenStandardSchemeFactory implements SchemeFactory {
+    public ThriftUserPassTokenStandardScheme getScheme() {
+      return new ThriftUserPassTokenStandardScheme();
+    }
+  }
+
+  private static class ThriftUserPassTokenStandardScheme extends StandardScheme<ThriftUserPassToken> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftUserPassToken struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // USER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.user = iprot.readString();
+              struct.setUserIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // PASSWORD
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.password = iprot.readBinary();
+              struct.setPasswordIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftUserPassToken struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.user != null) {
+        oprot.writeFieldBegin(USER_FIELD_DESC);
+        oprot.writeString(struct.user);
+        oprot.writeFieldEnd();
+      }
+      if (struct.password != null) {
+        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
+        oprot.writeBinary(struct.password);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ThriftUserPassTokenTupleSchemeFactory implements SchemeFactory {
+    public ThriftUserPassTokenTupleScheme getScheme() {
+      return new ThriftUserPassTokenTupleScheme();
+    }
+  }
+
+  private static class ThriftUserPassTokenTupleScheme extends TupleScheme<ThriftUserPassToken> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftUserPassToken struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetUser()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPassword()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetUser()) {
+        oprot.writeString(struct.user);
+      }
+      if (struct.isSetPassword()) {
+        oprot.writeBinary(struct.password);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftUserPassToken struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.user = iprot.readString();
+        struct.setUserIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.password = iprot.readBinary();
+        struct.setPasswordIsSet(true);
+      }
+    }
+  }
+
+}
+

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message