cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1026200 [4/11] - in /cassandra/trunk: ./ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/auth/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassa...
Date Fri, 22 Oct 2010 03:23:31 GMT
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeySlice.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeySlice.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeySlice.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeySlice.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -60,7 +61,7 @@ public class KeySlice implements TBase<K
   private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1);
   private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
 
-  public byte[] key;
+  public ByteBuffer key;
   public List<ColumnOrSuperColumn> columns;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -142,7 +143,7 @@ public class KeySlice implements TBase<K
   }
 
   public KeySlice(
-    byte[] key,
+    ByteBuffer key,
     List<ColumnOrSuperColumn> columns)
   {
     this();
@@ -155,8 +156,8 @@ public class KeySlice implements TBase<K
    */
   public KeySlice(KeySlice other) {
     if (other.isSetKey()) {
-      this.key = new byte[other.key.length];
-      System.arraycopy(other.key, 0, key, 0, other.key.length);
+      this.key = TBaseHelper.copyBinary(other.key);
+;
     }
     if (other.isSetColumns()) {
       List<ColumnOrSuperColumn> __this__columns = new ArrayList<ColumnOrSuperColumn>();
@@ -171,16 +172,27 @@ public class KeySlice implements TBase<K
     return new KeySlice(this);
   }
 
-  @Deprecated
-  public KeySlice clone() {
-    return new KeySlice(this);
+  @Override
+  public void clear() {
+    this.key = null;
+    this.columns = null;
   }
 
   public byte[] getKey() {
-    return this.key;
+    setKey(TBaseHelper.rightSize(key));
+    return key.array();
+  }
+
+  public ByteBuffer BufferForKey() {
+    return key;
   }
 
   public KeySlice setKey(byte[] key) {
+    setKey(ByteBuffer.wrap(key));
+    return this;
+  }
+
+  public KeySlice setKey(ByteBuffer key) {
     this.key = key;
     return this;
   }
@@ -245,7 +257,7 @@ public class KeySlice implements TBase<K
       if (value == null) {
         unsetKey();
       } else {
-        setKey((byte[])value);
+        setKey((ByteBuffer)value);
       }
       break;
 
@@ -260,10 +272,6 @@ public class KeySlice implements TBase<K
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case KEY:
@@ -276,12 +284,12 @@ public class KeySlice implements TBase<K
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case KEY:
       return isSetKey();
@@ -291,10 +299,6 @@ public class KeySlice implements TBase<K
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -313,7 +317,7 @@ public class KeySlice implements TBase<K
     if (this_present_key || that_present_key) {
       if (!(this_present_key && that_present_key))
         return false;
-      if (!java.util.Arrays.equals(this.key, that.key))
+      if (!this.key.equals(that.key))
         return false;
     }
 
@@ -358,7 +362,8 @@ public class KeySlice implements TBase<K
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetKey()) {      lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
+    if (isSetKey()) {
+      lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -367,7 +372,8 @@ public class KeySlice implements TBase<K
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetColumns()) {      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
+    if (isSetColumns()) {
+      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -375,6 +381,10 @@ public class KeySlice implements TBase<K
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -455,12 +465,7 @@ public class KeySlice implements TBase<K
     if (this.key == null) {
       sb.append("null");
     } else {
-        int __key_size = Math.min(this.key.length, 128);
-        for (int i = 0; i < __key_size; i++) {
-          if (i != 0) sb.append(" ");
-          sb.append(Integer.toHexString(this.key[i]).length() > 1 ? Integer.toHexString(this.key[i]).substring(Integer.toHexString(this.key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.key[i]).toUpperCase());
-        }
-        if (this.key.length > 128) sb.append(" ...");
+      TBaseHelper.toString(this.key, sb);
     }
     first = false;
     if (!first) sb.append(", ");

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -214,9 +215,14 @@ public class KsDef implements TBase<KsDe
     return new KsDef(this);
   }
 
-  @Deprecated
-  public KsDef clone() {
-    return new KsDef(this);
+  @Override
+  public void clear() {
+    this.name = null;
+    this.strategy_class = null;
+    this.strategy_options = null;
+    setReplication_factorIsSet(false);
+    this.replication_factor = 0;
+    this.cf_defs = null;
   }
 
   public String getName() {
@@ -409,10 +415,6 @@ public class KsDef implements TBase<KsDe
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case NAME:
@@ -434,12 +436,12 @@ public class KsDef implements TBase<KsDe
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case NAME:
       return isSetName();
@@ -455,10 +457,6 @@ public class KsDef implements TBase<KsDe
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -564,7 +562,8 @@ public class KsDef implements TBase<KsDe
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetName()) {      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
+    if (isSetName()) {
+      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -573,7 +572,8 @@ public class KsDef implements TBase<KsDe
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetStrategy_class()) {      lastComparison = TBaseHelper.compareTo(this.strategy_class, typedOther.strategy_class);
+    if (isSetStrategy_class()) {
+      lastComparison = TBaseHelper.compareTo(this.strategy_class, typedOther.strategy_class);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -582,7 +582,8 @@ public class KsDef implements TBase<KsDe
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetStrategy_options()) {      lastComparison = TBaseHelper.compareTo(this.strategy_options, typedOther.strategy_options);
+    if (isSetStrategy_options()) {
+      lastComparison = TBaseHelper.compareTo(this.strategy_options, typedOther.strategy_options);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -591,7 +592,8 @@ public class KsDef implements TBase<KsDe
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetReplication_factor()) {      lastComparison = TBaseHelper.compareTo(this.replication_factor, typedOther.replication_factor);
+    if (isSetReplication_factor()) {
+      lastComparison = TBaseHelper.compareTo(this.replication_factor, typedOther.replication_factor);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -600,7 +602,8 @@ public class KsDef implements TBase<KsDe
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetCf_defs()) {      lastComparison = TBaseHelper.compareTo(this.cf_defs, typedOther.cf_defs);
+    if (isSetCf_defs()) {
+      lastComparison = TBaseHelper.compareTo(this.cf_defs, typedOther.cf_defs);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -608,6 +611,10 @@ public class KsDef implements TBase<KsDe
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -154,9 +155,10 @@ public class Mutation implements TBase<M
     return new Mutation(this);
   }
 
-  @Deprecated
-  public Mutation clone() {
-    return new Mutation(this);
+  @Override
+  public void clear() {
+    this.column_or_supercolumn = null;
+    this.deletion = null;
   }
 
   public ColumnOrSuperColumn getColumn_or_supercolumn() {
@@ -228,10 +230,6 @@ public class Mutation implements TBase<M
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case COLUMN_OR_SUPERCOLUMN:
@@ -244,12 +242,12 @@ public class Mutation implements TBase<M
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case COLUMN_OR_SUPERCOLUMN:
       return isSetColumn_or_supercolumn();
@@ -259,10 +257,6 @@ public class Mutation implements TBase<M
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -326,7 +320,8 @@ public class Mutation implements TBase<M
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetColumn_or_supercolumn()) {      lastComparison = TBaseHelper.compareTo(this.column_or_supercolumn, typedOther.column_or_supercolumn);
+    if (isSetColumn_or_supercolumn()) {
+      lastComparison = TBaseHelper.compareTo(this.column_or_supercolumn, typedOther.column_or_supercolumn);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -335,7 +330,8 @@ public class Mutation implements TBase<M
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetDeletion()) {      lastComparison = TBaseHelper.compareTo(this.deletion, typedOther.deletion);
+    if (isSetDeletion()) {
+      lastComparison = TBaseHelper.compareTo(this.deletion, typedOther.deletion);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -343,6 +339,10 @@ public class Mutation implements TBase<M
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -130,9 +131,8 @@ public class NotFoundException extends E
     return new NotFoundException(this);
   }
 
-  @Deprecated
-  public NotFoundException clone() {
-    return new NotFoundException(this);
+  @Override
+  public void clear() {
   }
 
   public void setFieldValue(_Fields field, Object value) {
@@ -140,31 +140,23 @@ public class NotFoundException extends E
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -199,6 +191,10 @@ public class NotFoundException extends E
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/RowPredicate.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/RowPredicate.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/RowPredicate.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/RowPredicate.java Fri Oct 22 03:23:26 2010
@@ -1,548 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.cassandra.thrift;
-/*
- * 
- * 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.
- * 
- */
-
-
-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.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.thrift.*;
-import org.apache.thrift.async.*;
-import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
-import org.apache.thrift.protocol.*;
-
-public class RowPredicate implements TBase<RowPredicate, RowPredicate._Fields>, java.io.Serializable, Cloneable {
-  private static final TStruct STRUCT_DESC = new TStruct("RowPredicate");
-
-  private static final TField KEYS_FIELD_DESC = new TField("keys", TType.LIST, (short)1);
-  private static final TField KEY_RANGE_FIELD_DESC = new TField("key_range", TType.STRUCT, (short)2);
-  private static final TField INDEX_CLAUSE_FIELD_DESC = new TField("index_clause", TType.STRUCT, (short)3);
-
-  public List<byte[]> keys;
-  public KeyRange key_range;
-  public IndexClause index_clause;
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  public enum _Fields implements TFieldIdEnum {
-    KEYS((short)1, "keys"),
-    KEY_RANGE((short)2, "key_range"),
-    INDEX_CLAUSE((short)3, "index_clause");
-
-    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: // KEYS
-          return KEYS;
-        case 2: // KEY_RANGE
-          return KEY_RANGE;
-        case 3: // INDEX_CLAUSE
-          return INDEX_CLAUSE;
-        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, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.KEYS, new FieldMetaData("keys", TFieldRequirementType.OPTIONAL, 
-        new ListMetaData(TType.LIST, 
-            new FieldValueMetaData(TType.STRING))));
-    tmpMap.put(_Fields.KEY_RANGE, new FieldMetaData("key_range", TFieldRequirementType.OPTIONAL, 
-        new StructMetaData(TType.STRUCT, KeyRange.class)));
-    tmpMap.put(_Fields.INDEX_CLAUSE, new FieldMetaData("index_clause", TFieldRequirementType.OPTIONAL, 
-        new StructMetaData(TType.STRUCT, IndexClause.class)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    FieldMetaData.addStructMetaDataMap(RowPredicate.class, metaDataMap);
-  }
-
-  public RowPredicate() {
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public RowPredicate(RowPredicate other) {
-    if (other.isSetKeys()) {
-      List<byte[]> __this__keys = new ArrayList<byte[]>();
-      for (byte[] other_element : other.keys) {
-        byte[] temp_binary_element = new byte[other_element.length];
-        System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
-        __this__keys.add(temp_binary_element);
-      }
-      this.keys = __this__keys;
-    }
-    if (other.isSetKey_range()) {
-      this.key_range = new KeyRange(other.key_range);
-    }
-    if (other.isSetIndex_clause()) {
-      this.index_clause = new IndexClause(other.index_clause);
-    }
-  }
-
-  public RowPredicate deepCopy() {
-    return new RowPredicate(this);
-  }
-
-  @Deprecated
-  public RowPredicate clone() {
-    return new RowPredicate(this);
-  }
-
-  public int getKeysSize() {
-    return (this.keys == null) ? 0 : this.keys.size();
-  }
-
-  public java.util.Iterator<byte[]> getKeysIterator() {
-    return (this.keys == null) ? null : this.keys.iterator();
-  }
-
-  public void addToKeys(byte[] elem) {
-    if (this.keys == null) {
-      this.keys = new ArrayList<byte[]>();
-    }
-    this.keys.add(elem);
-  }
-
-  public List<byte[]> getKeys() {
-    return this.keys;
-  }
-
-  public RowPredicate setKeys(List<byte[]> keys) {
-    this.keys = keys;
-    return this;
-  }
-
-  public void unsetKeys() {
-    this.keys = null;
-  }
-
-  /** Returns true if field keys is set (has been asigned a value) and false otherwise */
-  public boolean isSetKeys() {
-    return this.keys != null;
-  }
-
-  public void setKeysIsSet(boolean value) {
-    if (!value) {
-      this.keys = null;
-    }
-  }
-
-  public KeyRange getKey_range() {
-    return this.key_range;
-  }
-
-  public RowPredicate setKey_range(KeyRange key_range) {
-    this.key_range = key_range;
-    return this;
-  }
-
-  public void unsetKey_range() {
-    this.key_range = null;
-  }
-
-  /** Returns true if field key_range is set (has been asigned a value) and false otherwise */
-  public boolean isSetKey_range() {
-    return this.key_range != null;
-  }
-
-  public void setKey_rangeIsSet(boolean value) {
-    if (!value) {
-      this.key_range = null;
-    }
-  }
-
-  public IndexClause getIndex_clause() {
-    return this.index_clause;
-  }
-
-  public RowPredicate setIndex_clause(IndexClause index_clause) {
-    this.index_clause = index_clause;
-    return this;
-  }
-
-  public void unsetIndex_clause() {
-    this.index_clause = null;
-  }
-
-  /** Returns true if field index_clause is set (has been asigned a value) and false otherwise */
-  public boolean isSetIndex_clause() {
-    return this.index_clause != null;
-  }
-
-  public void setIndex_clauseIsSet(boolean value) {
-    if (!value) {
-      this.index_clause = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case KEYS:
-      if (value == null) {
-        unsetKeys();
-      } else {
-        setKeys((List<byte[]>)value);
-      }
-      break;
-
-    case KEY_RANGE:
-      if (value == null) {
-        unsetKey_range();
-      } else {
-        setKey_range((KeyRange)value);
-      }
-      break;
-
-    case INDEX_CLAUSE:
-      if (value == null) {
-        unsetIndex_clause();
-      } else {
-        setIndex_clause((IndexClause)value);
-      }
-      break;
-
-    }
-  }
-
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case KEYS:
-      return getKeys();
-
-    case KEY_RANGE:
-      return getKey_range();
-
-    case INDEX_CLAUSE:
-      return getIndex_clause();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    switch (field) {
-    case KEYS:
-      return isSetKeys();
-    case KEY_RANGE:
-      return isSetKey_range();
-    case INDEX_CLAUSE:
-      return isSetIndex_clause();
-    }
-    throw new IllegalStateException();
-  }
-
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof RowPredicate)
-      return this.equals((RowPredicate)that);
-    return false;
-  }
-
-  public boolean equals(RowPredicate that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_keys = true && this.isSetKeys();
-    boolean that_present_keys = true && that.isSetKeys();
-    if (this_present_keys || that_present_keys) {
-      if (!(this_present_keys && that_present_keys))
-        return false;
-      if (!this.keys.equals(that.keys))
-        return false;
-    }
-
-    boolean this_present_key_range = true && this.isSetKey_range();
-    boolean that_present_key_range = true && that.isSetKey_range();
-    if (this_present_key_range || that_present_key_range) {
-      if (!(this_present_key_range && that_present_key_range))
-        return false;
-      if (!this.key_range.equals(that.key_range))
-        return false;
-    }
-
-    boolean this_present_index_clause = true && this.isSetIndex_clause();
-    boolean that_present_index_clause = true && that.isSetIndex_clause();
-    if (this_present_index_clause || that_present_index_clause) {
-      if (!(this_present_index_clause && that_present_index_clause))
-        return false;
-      if (!this.index_clause.equals(that.index_clause))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  public int compareTo(RowPredicate other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-    RowPredicate typedOther = (RowPredicate)other;
-
-    lastComparison = Boolean.valueOf(isSetKeys()).compareTo(typedOther.isSetKeys());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetKeys()) {      lastComparison = TBaseHelper.compareTo(this.keys, typedOther.keys);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetKey_range()).compareTo(typedOther.isSetKey_range());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetKey_range()) {      lastComparison = TBaseHelper.compareTo(this.key_range, typedOther.key_range);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetIndex_clause()).compareTo(typedOther.isSetIndex_clause());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetIndex_clause()) {      lastComparison = TBaseHelper.compareTo(this.index_clause, typedOther.index_clause);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
-        break;
-      }
-      switch (field.id) {
-        case 1: // KEYS
-          if (field.type == TType.LIST) {
-            {
-              TList _list12 = iprot.readListBegin();
-              this.keys = new ArrayList<byte[]>(_list12.size);
-              for (int _i13 = 0; _i13 < _list12.size; ++_i13)
-              {
-                byte[] _elem14;
-                _elem14 = iprot.readBinary();
-                this.keys.add(_elem14);
-              }
-              iprot.readListEnd();
-            }
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2: // KEY_RANGE
-          if (field.type == TType.STRUCT) {
-            this.key_range = new KeyRange();
-            this.key_range.read(iprot);
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3: // INDEX_CLAUSE
-          if (field.type == TType.STRUCT) {
-            this.index_clause = new IndexClause();
-            this.index_clause.read(iprot);
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-
-    // check for required fields of primitive type, which can't be checked in the validate method
-    validate();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    validate();
-
-    oprot.writeStructBegin(STRUCT_DESC);
-    if (this.keys != null) {
-      if (isSetKeys()) {
-        oprot.writeFieldBegin(KEYS_FIELD_DESC);
-        {
-          oprot.writeListBegin(new TList(TType.STRING, this.keys.size()));
-          for (byte[] _iter15 : this.keys)
-          {
-            oprot.writeBinary(_iter15);
-          }
-          oprot.writeListEnd();
-        }
-        oprot.writeFieldEnd();
-      }
-    }
-    if (this.key_range != null) {
-      if (isSetKey_range()) {
-        oprot.writeFieldBegin(KEY_RANGE_FIELD_DESC);
-        this.key_range.write(oprot);
-        oprot.writeFieldEnd();
-      }
-    }
-    if (this.index_clause != null) {
-      if (isSetIndex_clause()) {
-        oprot.writeFieldBegin(INDEX_CLAUSE_FIELD_DESC);
-        this.index_clause.write(oprot);
-        oprot.writeFieldEnd();
-      }
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("RowPredicate(");
-    boolean first = true;
-
-    if (isSetKeys()) {
-      sb.append("keys:");
-      if (this.keys == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.keys);
-      }
-      first = false;
-    }
-    if (isSetKey_range()) {
-      if (!first) sb.append(", ");
-      sb.append("key_range:");
-      if (this.key_range == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.key_range);
-      }
-      first = false;
-    }
-    if (isSetIndex_clause()) {
-      if (!first) sb.append(", ");
-      sb.append("index_clause:");
-      if (this.index_clause == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.index_clause);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws TException {
-    // check for required fields
-  }
-
-}
-

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SlicePredicate.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SlicePredicate.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SlicePredicate.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SlicePredicate.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -65,7 +66,7 @@ public class SlicePredicate implements T
   private static final TField COLUMN_NAMES_FIELD_DESC = new TField("column_names", TType.LIST, (short)1);
   private static final TField SLICE_RANGE_FIELD_DESC = new TField("slice_range", TType.STRUCT, (short)2);
 
-  public List<byte[]> column_names;
+  public List<ByteBuffer> column_names;
   public SliceRange slice_range;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -151,10 +152,10 @@ public class SlicePredicate implements T
    */
   public SlicePredicate(SlicePredicate other) {
     if (other.isSetColumn_names()) {
-      List<byte[]> __this__column_names = new ArrayList<byte[]>();
-      for (byte[] other_element : other.column_names) {
-        byte[] temp_binary_element = new byte[other_element.length];
-        System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
+      List<ByteBuffer> __this__column_names = new ArrayList<ByteBuffer>();
+      for (ByteBuffer other_element : other.column_names) {
+        ByteBuffer temp_binary_element = TBaseHelper.copyBinary(other_element);
+;
         __this__column_names.add(temp_binary_element);
       }
       this.column_names = __this__column_names;
@@ -168,31 +169,32 @@ public class SlicePredicate implements T
     return new SlicePredicate(this);
   }
 
-  @Deprecated
-  public SlicePredicate clone() {
-    return new SlicePredicate(this);
+  @Override
+  public void clear() {
+    this.column_names = null;
+    this.slice_range = null;
   }
 
   public int getColumn_namesSize() {
     return (this.column_names == null) ? 0 : this.column_names.size();
   }
 
-  public java.util.Iterator<byte[]> getColumn_namesIterator() {
+  public java.util.Iterator<ByteBuffer> getColumn_namesIterator() {
     return (this.column_names == null) ? null : this.column_names.iterator();
   }
 
-  public void addToColumn_names(byte[] elem) {
+  public void addToColumn_names(ByteBuffer elem) {
     if (this.column_names == null) {
-      this.column_names = new ArrayList<byte[]>();
+      this.column_names = new ArrayList<ByteBuffer>();
     }
     this.column_names.add(elem);
   }
 
-  public List<byte[]> getColumn_names() {
+  public List<ByteBuffer> getColumn_names() {
     return this.column_names;
   }
 
-  public SlicePredicate setColumn_names(List<byte[]> column_names) {
+  public SlicePredicate setColumn_names(List<ByteBuffer> column_names) {
     this.column_names = column_names;
     return this;
   }
@@ -242,7 +244,7 @@ public class SlicePredicate implements T
       if (value == null) {
         unsetColumn_names();
       } else {
-        setColumn_names((List<byte[]>)value);
+        setColumn_names((List<ByteBuffer>)value);
       }
       break;
 
@@ -257,10 +259,6 @@ public class SlicePredicate implements T
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case COLUMN_NAMES:
@@ -273,12 +271,12 @@ public class SlicePredicate implements T
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case COLUMN_NAMES:
       return isSetColumn_names();
@@ -288,10 +286,6 @@ public class SlicePredicate implements T
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -355,7 +349,8 @@ public class SlicePredicate implements T
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetColumn_names()) {      lastComparison = TBaseHelper.compareTo(this.column_names, typedOther.column_names);
+    if (isSetColumn_names()) {
+      lastComparison = TBaseHelper.compareTo(this.column_names, typedOther.column_names);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -364,7 +359,8 @@ public class SlicePredicate implements T
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetSlice_range()) {      lastComparison = TBaseHelper.compareTo(this.slice_range, typedOther.slice_range);
+    if (isSetSlice_range()) {
+      lastComparison = TBaseHelper.compareTo(this.slice_range, typedOther.slice_range);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -372,6 +368,10 @@ public class SlicePredicate implements T
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -386,10 +386,10 @@ public class SlicePredicate implements T
           if (field.type == TType.LIST) {
             {
               TList _list4 = iprot.readListBegin();
-              this.column_names = new ArrayList<byte[]>(_list4.size);
+              this.column_names = new ArrayList<ByteBuffer>(_list4.size);
               for (int _i5 = 0; _i5 < _list4.size; ++_i5)
               {
-                byte[] _elem6;
+                ByteBuffer _elem6;
                 _elem6 = iprot.readBinary();
                 this.column_names.add(_elem6);
               }
@@ -427,7 +427,7 @@ public class SlicePredicate implements T
         oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRING, this.column_names.size()));
-          for (byte[] _iter7 : this.column_names)
+          for (ByteBuffer _iter7 : this.column_names)
           {
             oprot.writeBinary(_iter7);
           }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SliceRange.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SliceRange.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SliceRange.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SliceRange.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -71,8 +72,8 @@ public class SliceRange implements TBase
   private static final TField REVERSED_FIELD_DESC = new TField("reversed", TType.BOOL, (short)3);
   private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)4);
 
-  public byte[] start;
-  public byte[] finish;
+  public ByteBuffer start;
+  public ByteBuffer finish;
   public boolean reversed;
   public int count;
 
@@ -171,8 +172,8 @@ public class SliceRange implements TBase
   }
 
   public SliceRange(
-    byte[] start,
-    byte[] finish,
+    ByteBuffer start,
+    ByteBuffer finish,
     boolean reversed,
     int count)
   {
@@ -192,12 +193,12 @@ public class SliceRange implements TBase
     __isset_bit_vector.clear();
     __isset_bit_vector.or(other.__isset_bit_vector);
     if (other.isSetStart()) {
-      this.start = new byte[other.start.length];
-      System.arraycopy(other.start, 0, start, 0, other.start.length);
+      this.start = TBaseHelper.copyBinary(other.start);
+;
     }
     if (other.isSetFinish()) {
-      this.finish = new byte[other.finish.length];
-      System.arraycopy(other.finish, 0, finish, 0, other.finish.length);
+      this.finish = TBaseHelper.copyBinary(other.finish);
+;
     }
     this.reversed = other.reversed;
     this.count = other.count;
@@ -207,16 +208,31 @@ public class SliceRange implements TBase
     return new SliceRange(this);
   }
 
-  @Deprecated
-  public SliceRange clone() {
-    return new SliceRange(this);
+  @Override
+  public void clear() {
+    this.start = null;
+    this.finish = null;
+    this.reversed = false;
+
+    this.count = 100;
+
   }
 
   public byte[] getStart() {
-    return this.start;
+    setStart(TBaseHelper.rightSize(start));
+    return start.array();
+  }
+
+  public ByteBuffer BufferForStart() {
+    return start;
   }
 
   public SliceRange setStart(byte[] start) {
+    setStart(ByteBuffer.wrap(start));
+    return this;
+  }
+
+  public SliceRange setStart(ByteBuffer start) {
     this.start = start;
     return this;
   }
@@ -237,10 +253,20 @@ public class SliceRange implements TBase
   }
 
   public byte[] getFinish() {
-    return this.finish;
+    setFinish(TBaseHelper.rightSize(finish));
+    return finish.array();
+  }
+
+  public ByteBuffer BufferForFinish() {
+    return finish;
   }
 
   public SliceRange setFinish(byte[] finish) {
+    setFinish(ByteBuffer.wrap(finish));
+    return this;
+  }
+
+  public SliceRange setFinish(ByteBuffer finish) {
     this.finish = finish;
     return this;
   }
@@ -312,7 +338,7 @@ public class SliceRange implements TBase
       if (value == null) {
         unsetStart();
       } else {
-        setStart((byte[])value);
+        setStart((ByteBuffer)value);
       }
       break;
 
@@ -320,7 +346,7 @@ public class SliceRange implements TBase
       if (value == null) {
         unsetFinish();
       } else {
-        setFinish((byte[])value);
+        setFinish((ByteBuffer)value);
       }
       break;
 
@@ -343,10 +369,6 @@ public class SliceRange implements TBase
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case START:
@@ -365,12 +387,12 @@ public class SliceRange implements TBase
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case START:
       return isSetStart();
@@ -384,10 +406,6 @@ public class SliceRange implements TBase
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -406,7 +424,7 @@ public class SliceRange implements TBase
     if (this_present_start || that_present_start) {
       if (!(this_present_start && that_present_start))
         return false;
-      if (!java.util.Arrays.equals(this.start, that.start))
+      if (!this.start.equals(that.start))
         return false;
     }
 
@@ -415,7 +433,7 @@ public class SliceRange implements TBase
     if (this_present_finish || that_present_finish) {
       if (!(this_present_finish && that_present_finish))
         return false;
-      if (!java.util.Arrays.equals(this.finish, that.finish))
+      if (!this.finish.equals(that.finish))
         return false;
     }
 
@@ -479,7 +497,8 @@ public class SliceRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetStart()) {      lastComparison = TBaseHelper.compareTo(this.start, typedOther.start);
+    if (isSetStart()) {
+      lastComparison = TBaseHelper.compareTo(this.start, typedOther.start);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -488,7 +507,8 @@ public class SliceRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetFinish()) {      lastComparison = TBaseHelper.compareTo(this.finish, typedOther.finish);
+    if (isSetFinish()) {
+      lastComparison = TBaseHelper.compareTo(this.finish, typedOther.finish);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -497,7 +517,8 @@ public class SliceRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetReversed()) {      lastComparison = TBaseHelper.compareTo(this.reversed, typedOther.reversed);
+    if (isSetReversed()) {
+      lastComparison = TBaseHelper.compareTo(this.reversed, typedOther.reversed);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -506,7 +527,8 @@ public class SliceRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetCount()) {      lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
+    if (isSetCount()) {
+      lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -514,6 +536,10 @@ public class SliceRange implements TBase
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -604,12 +630,7 @@ public class SliceRange implements TBase
     if (this.start == null) {
       sb.append("null");
     } else {
-        int __start_size = Math.min(this.start.length, 128);
-        for (int i = 0; i < __start_size; i++) {
-          if (i != 0) sb.append(" ");
-          sb.append(Integer.toHexString(this.start[i]).length() > 1 ? Integer.toHexString(this.start[i]).substring(Integer.toHexString(this.start[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start[i]).toUpperCase());
-        }
-        if (this.start.length > 128) sb.append(" ...");
+      TBaseHelper.toString(this.start, sb);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -617,12 +638,7 @@ public class SliceRange implements TBase
     if (this.finish == null) {
       sb.append("null");
     } else {
-        int __finish_size = Math.min(this.finish.length, 128);
-        for (int i = 0; i < __finish_size; i++) {
-          if (i != 0) sb.append(" ");
-          sb.append(Integer.toHexString(this.finish[i]).length() > 1 ? Integer.toHexString(this.finish[i]).substring(Integer.toHexString(this.finish[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.finish[i]).toUpperCase());
-        }
-        if (this.finish.length > 128) sb.append(" ...");
+      TBaseHelper.toString(this.finish, sb);
     }
     first = false;
     if (!first) sb.append(", ");

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -59,7 +60,7 @@ public class SuperColumn implements TBas
   private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
   private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
 
-  public byte[] name;
+  public ByteBuffer name;
   public List<Column> columns;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -141,7 +142,7 @@ public class SuperColumn implements TBas
   }
 
   public SuperColumn(
-    byte[] name,
+    ByteBuffer name,
     List<Column> columns)
   {
     this();
@@ -154,8 +155,8 @@ public class SuperColumn implements TBas
    */
   public SuperColumn(SuperColumn other) {
     if (other.isSetName()) {
-      this.name = new byte[other.name.length];
-      System.arraycopy(other.name, 0, name, 0, other.name.length);
+      this.name = TBaseHelper.copyBinary(other.name);
+;
     }
     if (other.isSetColumns()) {
       List<Column> __this__columns = new ArrayList<Column>();
@@ -170,16 +171,27 @@ public class SuperColumn implements TBas
     return new SuperColumn(this);
   }
 
-  @Deprecated
-  public SuperColumn clone() {
-    return new SuperColumn(this);
+  @Override
+  public void clear() {
+    this.name = null;
+    this.columns = null;
   }
 
   public byte[] getName() {
-    return this.name;
+    setName(TBaseHelper.rightSize(name));
+    return name.array();
+  }
+
+  public ByteBuffer BufferForName() {
+    return name;
   }
 
   public SuperColumn setName(byte[] name) {
+    setName(ByteBuffer.wrap(name));
+    return this;
+  }
+
+  public SuperColumn setName(ByteBuffer name) {
     this.name = name;
     return this;
   }
@@ -244,7 +256,7 @@ public class SuperColumn implements TBas
       if (value == null) {
         unsetName();
       } else {
-        setName((byte[])value);
+        setName((ByteBuffer)value);
       }
       break;
 
@@ -259,10 +271,6 @@ public class SuperColumn implements TBas
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case NAME:
@@ -275,12 +283,12 @@ public class SuperColumn implements TBas
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case NAME:
       return isSetName();
@@ -290,10 +298,6 @@ public class SuperColumn implements TBas
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -312,7 +316,7 @@ public class SuperColumn implements TBas
     if (this_present_name || that_present_name) {
       if (!(this_present_name && that_present_name))
         return false;
-      if (!java.util.Arrays.equals(this.name, that.name))
+      if (!this.name.equals(that.name))
         return false;
     }
 
@@ -357,7 +361,8 @@ public class SuperColumn implements TBas
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetName()) {      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
+    if (isSetName()) {
+      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -366,7 +371,8 @@ public class SuperColumn implements TBas
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetColumns()) {      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
+    if (isSetColumns()) {
+      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -374,6 +380,10 @@ public class SuperColumn implements TBas
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -454,12 +464,7 @@ public class SuperColumn implements TBas
     if (this.name == null) {
       sb.append("null");
     } else {
-        int __name_size = Math.min(this.name.length, 128);
-        for (int i = 0; i < __name_size; i++) {
-          if (i != 0) sb.append(" ");
-          sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
-        }
-        if (this.name.length > 128) sb.append(" ...");
+      TBaseHelper.toString(this.name, sb);
     }
     first = false;
     if (!first) sb.append(", ");

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TimedOutException.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TimedOutException.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TimedOutException.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TimedOutException.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -130,9 +131,8 @@ public class TimedOutException extends E
     return new TimedOutException(this);
   }
 
-  @Deprecated
-  public TimedOutException clone() {
-    return new TimedOutException(this);
+  @Override
+  public void clear() {
   }
 
   public void setFieldValue(_Fields field, Object value) {
@@ -140,31 +140,23 @@ public class TimedOutException extends E
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -199,6 +191,10 @@ public class TimedOutException extends E
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -175,9 +176,11 @@ public class TokenRange implements TBase
     return new TokenRange(this);
   }
 
-  @Deprecated
-  public TokenRange clone() {
-    return new TokenRange(this);
+  @Override
+  public void clear() {
+    this.start_token = null;
+    this.end_token = null;
+    this.endpoints = null;
   }
 
   public String getStart_token() {
@@ -296,10 +299,6 @@ public class TokenRange implements TBase
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case START_TOKEN:
@@ -315,12 +314,12 @@ public class TokenRange implements TBase
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     case START_TOKEN:
       return isSetStart_token();
@@ -332,10 +331,6 @@ public class TokenRange implements TBase
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -413,7 +408,8 @@ public class TokenRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetStart_token()) {      lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
+    if (isSetStart_token()) {
+      lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -422,7 +418,8 @@ public class TokenRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetEnd_token()) {      lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
+    if (isSetEnd_token()) {
+      lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -431,7 +428,8 @@ public class TokenRange implements TBase
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetEndpoints()) {      lastComparison = TBaseHelper.compareTo(this.endpoints, typedOther.endpoints);
+    if (isSetEndpoints()) {
+      lastComparison = TBaseHelper.compareTo(this.endpoints, typedOther.endpoints);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -439,6 +437,10 @@ public class TokenRange implements TBase
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/UnavailableException.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/UnavailableException.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/UnavailableException.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/UnavailableException.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ 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;
@@ -130,9 +131,8 @@ public class UnavailableException extend
     return new UnavailableException(this);
   }
 
-  @Deprecated
-  public UnavailableException clone() {
-    return new UnavailableException(this);
+  @Override
+  public void clear() {
   }
 
   public void setFieldValue(_Fields field, Object value) {
@@ -140,31 +140,23 @@ public class UnavailableException extend
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-  }
-
   public Object getFieldValue(_Fields field) {
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public Object getFieldValue(int fieldId) {
-    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-  }
-
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
     switch (field) {
     }
     throw new IllegalStateException();
   }
 
-  public boolean isSet(int fieldID) {
-    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-  }
-
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -199,6 +191,10 @@ public class UnavailableException extend
     return 0;
   }
 
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: cassandra/trunk/src/java/org/apache/cassandra/auth/Resources.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/auth/Resources.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/auth/Resources.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/auth/Resources.java Fri Oct 22 03:23:26 2010
@@ -21,6 +21,7 @@
 
 package org.apache.cassandra.auth;
 
+import java.nio.ByteBuffer;
 import java.util.List;
 
 import org.apache.cassandra.utils.FBUtilities;
@@ -42,7 +43,7 @@ public final class Resources
         {
             buff.append("/");
             if (component instanceof byte[])
-                buff.append(FBUtilities.bytesToHex((byte[])component));
+                buff.append(FBUtilities.bytesToHex(ByteBuffer.wrap((byte[])component)));
             else
                 buff.append(component.toString());
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/AvroRecordFactory.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroRecordFactory.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/AvroRecordFactory.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/AvroRecordFactory.java Fri Oct 22 03:23:26 2010
@@ -104,10 +104,9 @@ public class AvroRecordFactory
         return entry;
     }
 
-    public static KeySlice newKeySlice(byte[] key, List<ColumnOrSuperColumn> columns) {
+    public static KeySlice newKeySlice(ByteBuffer key, List<ColumnOrSuperColumn> columns) {
         KeySlice slice = new KeySlice();
-        ByteBuffer wrappedKey = (key != null) ? ByteBuffer.wrap(key) : null;
-        slice.key = wrappedKey;
+        slice.key = key;
         slice.columns = columns;
         return slice;
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java Fri Oct 22 03:23:26 2010
@@ -48,21 +48,17 @@ import static org.apache.cassandra.avro.
  */
 public class AvroValidation
 {    
-    static void validateKey(byte[] key) throws InvalidRequestException
+    static void validateKey(ByteBuffer key) throws InvalidRequestException
     {
-        if (key == null || key.length == 0)
+        if (key == null || key.remaining() == 0)
             throw newInvalidRequestException("Key may not be empty");
         
         // check that key can be handled by FBUtilities.writeShortByteArray
-        if (key.length > FBUtilities.MAX_UNSIGNED_SHORT)
-            throw newInvalidRequestException("Key length of " + key.length +
+        if (key.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
+            throw newInvalidRequestException("Key length of " + key.remaining() +
                     " is longer than maximum of " + FBUtilities.MAX_UNSIGNED_SHORT);
     }
     
-    static void validateKey(ByteBuffer key) throws InvalidRequestException
-    {
-        validateKey(key.array());
-    }
     
     // FIXME: could use method in ThriftValidation
     static void validateKeyspace(String keyspace) throws KeyspaceNotDefinedException
@@ -90,27 +86,24 @@ public class AvroValidation
         String column_family = cp.column_family.toString();
         ColumnFamilyType cfType = validateColumnFamily(keyspace, column_family);
         
-        byte[] column = null, super_column = null;
-        if (cp.super_column != null) super_column = cp.super_column.array();
-        if (cp.column != null) column = cp.column.array();
-        
+       
         if (cfType == ColumnFamilyType.Standard)
         {
-            if (super_column != null)
+            if (cp.super_column != null)
                 throw newInvalidRequestException("supercolumn parameter is invalid for standard CF " + column_family);
             
-            if (column == null)
+            if (cp.column == null)
                 throw newInvalidRequestException("column parameter is not optional for standard CF " + column_family);
         }
         else
         {
-            if (super_column == null)
+            if (cp.super_column == null)
                 throw newInvalidRequestException("supercolumn parameter is not optional for super CF " + column_family);
         }
          
-        if (column != null)
-            validateColumns(keyspace, column_family, super_column, Arrays.asList(cp.column));
-        if (super_column != null)
+        if (cp.column != null)
+            validateColumns(keyspace, column_family, cp.super_column, Arrays.asList(cp.column));
+        if (cp.super_column != null)
             validateColumns(keyspace, column_family, null, Arrays.asList(cp.super_column));
     }
     
@@ -128,14 +121,14 @@ public class AvroValidation
     }
     
     // FIXME: could use method in ThriftValidation
-    static void validateColumns(String keyspace, String cfName, byte[] superColumnName, Iterable<ByteBuffer> columnNames)
+    static void validateColumns(String keyspace, String cfName, ByteBuffer superColumnName, Iterable<ByteBuffer> columnNames)
     throws InvalidRequestException
     {
         if (superColumnName != null)
         {
-            if (superColumnName.length > IColumn.MAX_NAME_LENGTH)
+            if (superColumnName.remaining() > IColumn.MAX_NAME_LENGTH)
                 throw newInvalidRequestException("supercolumn name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
-            if (superColumnName.length == 0)
+            if (superColumnName.remaining() == 0)
                 throw newInvalidRequestException("supercolumn name must not be empty");
             if (DatabaseDescriptor.getColumnFamilyType(keyspace, cfName) == ColumnFamilyType.Standard)
                 throw newInvalidRequestException("supercolumn specified to ColumnFamily " + cfName + " containing normal columns");
@@ -144,16 +137,15 @@ public class AvroValidation
         AbstractType comparator = ColumnFamily.getComparatorFor(keyspace, cfName, superColumnName);
         for (ByteBuffer buff : columnNames)
         {
-            byte[] name = buff.array();
-
-            if (name.length > IColumn.MAX_NAME_LENGTH)
+           
+            if (buff.remaining() > IColumn.MAX_NAME_LENGTH)
                 throw newInvalidRequestException("column name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
-            if (name.length == 0)
+            if (buff.remaining() == 0)
                 throw newInvalidRequestException("column name must not be empty");
             
             try
             {
-                comparator.validate(name);
+                comparator.validate(buff);
             }
             catch (MarshalException e)
             {
@@ -167,7 +159,7 @@ public class AvroValidation
     {
         validateColumns(keyspace,
                         parent.column_family.toString(),
-                        parent.super_column == null ? null : parent.super_column.array(),
+                        parent.super_column,
                         columnNames);
     }
     
@@ -192,17 +184,16 @@ public class AvroValidation
             throw newInvalidRequestException("ColumnOrSuperColumn must have one or both of Column or SuperColumn");
     }
 
-    static void validateRange(String keyspace, String cfName, byte[] superName, SliceRange range)
+    static void validateRange(String keyspace, String cfName, ByteBuffer superName, SliceRange range)
     throws InvalidRequestException
     {
         AbstractType comparator = ColumnFamily.getComparatorFor(keyspace, cfName, superName);
-        byte[] start = range.start.array();
-        byte[] finish = range.finish.array();
+        
 
         try
         {
-            comparator.validate(start);
-            comparator.validate(finish);
+            comparator.validate(range.start);
+            comparator.validate(range.finish);
         }
         catch (MarshalException me)
         {
@@ -212,18 +203,17 @@ public class AvroValidation
         if (range.count < 0)
             throw newInvalidRequestException("Ranges require a non-negative count.");
 
-        Comparator<byte[]> orderedComparator = range.reversed ? comparator.getReverseComparator() : comparator;
-        if (start.length > 0 && finish.length > 0 && orderedComparator.compare(start, finish) > 0)
+        Comparator<ByteBuffer> orderedComparator = range.reversed ? comparator.getReverseComparator() : comparator;
+        if (range.start.remaining() > 0 && range.finish.remaining() > 0 && orderedComparator.compare(range.start, range.finish) > 0)
             throw newInvalidRequestException("range finish must come after start in the order of traversal");
     }
     
     static void validateRange(String keyspace, ColumnParent cp, SliceRange range) throws InvalidRequestException
     {
-        byte[] superName = cp.super_column == null ? null : cp.super_column.array();
-        validateRange(keyspace, cp.column_family.toString(), superName, range);
+        validateRange(keyspace, cp.column_family.toString(), cp.super_column, range);
     }
 
-    static void validateSlicePredicate(String keyspace, String cfName, byte[] superName, SlicePredicate predicate)
+    static void validateSlicePredicate(String keyspace, String cfName, ByteBuffer superName, SlicePredicate predicate)
     throws InvalidRequestException
     {
         if (predicate.column_names == null && predicate.slice_range == null)
@@ -244,8 +234,7 @@ public class AvroValidation
 
         if (del.predicate != null)
         {
-            byte[] superName = del.super_column == null ? null : del.super_column.array();
-            validateSlicePredicate(keyspace, cfName, superName, del.predicate);
+            validateSlicePredicate(keyspace, cfName, del.super_column, del.predicate);
             if (del.predicate.slice_range != null)
                 throw newInvalidRequestException("Deletion does not yet support SliceRange predicates.");
         }
@@ -313,8 +302,8 @@ public class AvroValidation
         if (range.start_key != null)
         {
             IPartitioner p = StorageService.getPartitioner();
-            Token startToken = p.getToken(range.start_key.array());
-            Token endToken = p.getToken(range.end_key.array());
+            Token startToken = p.getToken(range.start_key);
+            Token endToken = p.getToken(range.end_key);
             if (startToken.compareTo(endToken) > 0 && !endToken.equals(p.getMinimumToken()))
             {
                 if (p instanceof RandomPartitioner)
@@ -335,7 +324,7 @@ public class AvroValidation
     {
         if (index_clause.expressions.isEmpty())
             throw newInvalidRequestException("index clause list may not be empty");
-        Set<byte[]> indexedColumns = Table.open(keyspace).getColumnFamilyStore(columnFamily).getIndexedColumns();
+        Set<ByteBuffer> indexedColumns = Table.open(keyspace).getColumnFamilyStore(columnFamily).getIndexedColumns();
         for (IndexExpression expression : index_clause.expressions)
         {
             if (expression.op.equals(IndexOperator.EQ) && indexedColumns.contains(expression.column_name.array()))

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Fri Oct 22 03:23:26 2010
@@ -141,14 +141,14 @@ public class CassandraServer implements 
         AvroValidation.validateColumnPath(state().getKeyspace(), columnPath);
         
         // FIXME: This is repetitive.
-        byte[] column, super_column;
-        column = columnPath.column == null ? null : columnPath.column.array();
-        super_column = columnPath.super_column == null ? null : columnPath.super_column.array();
+        ByteBuffer column, super_column;
+        column = columnPath.column == null ? null : columnPath.column;
+        super_column = columnPath.super_column == null ? null : columnPath.super_column;
         
         QueryPath path = new QueryPath(columnPath.column_family.toString(), column == null ? null : super_column);
-        List<byte[]> nameAsList = Arrays.asList(column == null ? super_column : column);
-        AvroValidation.validateKey(key.array());
-        ReadCommand command = new SliceByNamesReadCommand(state().getKeyspace(), key.array(), path, nameAsList);
+        List<ByteBuffer> nameAsList = Arrays.asList(column == null ? super_column : column);
+        AvroValidation.validateKey(key);
+        ReadCommand command = new SliceByNamesReadCommand(state().getKeyspace(), key, path, nameAsList);
         
         Map<DecoratedKey<?>, ColumnFamily> cfamilies = readColumnFamily(Arrays.asList(command), consistencyLevel);
         ColumnFamily cf = cfamilies.get(StorageService.getPartitioner().decorateKey(command.key));
@@ -320,8 +320,7 @@ public class CassandraServer implements 
         AvroValidation.validateColumnParent(keyspace, columnParent);
         AvroValidation.validatePredicate(keyspace, columnParent, predicate);
         
-        byte[] superName = columnParent.super_column == null ? null : columnParent.super_column.array();
-        QueryPath queryPath = new QueryPath(columnParent.column_family.toString(), superName);
+        QueryPath queryPath = new QueryPath(columnParent.column_family.toString(), columnParent.super_column);
 
         List<ReadCommand> commands = new ArrayList<ReadCommand>();
         if (predicate.column_names != null)
@@ -329,13 +328,8 @@ public class CassandraServer implements 
             for (ByteBuffer key : keys)
             {
                 AvroValidation.validateKey(key);
-                
-                // FIXME: Copying the collection for the sake of SliceByNamesReadCommands
-                Collection<byte[]> column_names = new ArrayList<byte[]>();
-                for (ByteBuffer name : predicate.column_names)
-                    column_names.add(name.array());
-                
-                commands.add(new SliceByNamesReadCommand(keyspace, key.array(), queryPath, column_names));
+                    
+                commands.add(new SliceByNamesReadCommand(keyspace, key, queryPath, predicate.column_names));
             }
         }
         else
@@ -344,7 +338,7 @@ public class CassandraServer implements 
             for (ByteBuffer key : keys)
             {
                 AvroValidation.validateKey(key);
-                commands.add(new SliceFromReadCommand(keyspace, key.array(), queryPath, range.start.array(), range.finish.array(), range.reversed, range.count));
+                commands.add(new SliceFromReadCommand(keyspace, key, queryPath, range.start, range.finish, range.reversed, range.count));
             }
         }
         
@@ -363,7 +357,7 @@ public class CassandraServer implements 
             ColumnFamily cf = columnFamilies.get(StorageService.getPartitioner().decorateKey(cmd.key));
             boolean reverseOrder = cmd instanceof SliceFromReadCommand && ((SliceFromReadCommand)cmd).reversed;
             GenericArray<ColumnOrSuperColumn> avroColumns = avronateColumnFamily(cf, cmd.queryPath.superColumnName != null, reverseOrder);
-            columnFamiliesList.add(newCoscsMapEntry(ByteBuffer.wrap(cmd.key), avroColumns));
+            columnFamiliesList.add(newCoscsMapEntry(cmd.key, avroColumns));
         }
         
         return columnFamiliesList;
@@ -394,17 +388,17 @@ public class CassandraServer implements 
         if (logger.isDebugEnabled())
             logger.debug("insert");
 
-        AvroValidation.validateKey(key.array());
+        AvroValidation.validateKey(key);
         AvroValidation.validateColumnParent(state().getKeyspace(), parent);
         AvroValidation.validateColumn(state().getKeyspace(), parent, column);
 
-        RowMutation rm = new RowMutation(state().getKeyspace(), key.array());
+        RowMutation rm = new RowMutation(state().getKeyspace(), key);
         try
         {
             rm.add(new QueryPath(parent.column_family.toString(),
-                   parent.super_column == null ? null : parent.super_column.array(),
-                   column.name.array()),
-                   column.value.array(),
+                   parent.super_column,
+                   column.name),
+                   column.value,
                    column.timestamp,
                    column.ttl == null ? 0 : column.ttl);
         }
@@ -423,12 +417,11 @@ public class CassandraServer implements 
         if (logger.isDebugEnabled())
             logger.debug("remove");
         
-        AvroValidation.validateKey(key.array());
+        AvroValidation.validateKey(key);
         AvroValidation.validateColumnPath(state().getKeyspace(), columnPath);
 
-        RowMutation rm = new RowMutation(state().getKeyspace(), key.array());
-        byte[] superName = columnPath.super_column == null ? null : columnPath.super_column.array();
-        rm.delete(new QueryPath(columnPath.column_family.toString(), superName), timestamp);
+        RowMutation rm = new RowMutation(state().getKeyspace(), key);
+        rm.delete(new QueryPath(columnPath.column_family.toString(), columnPath.super_column), timestamp);
         
         doInsert(consistencyLevel, rm);
         
@@ -466,7 +459,7 @@ public class CassandraServer implements 
         
         for (MutationsMapEntry pair: mutationMap)
         {
-            AvroValidation.validateKey(pair.key.array());
+            AvroValidation.validateKey(pair.key);
             Map<CharSequence, List<Mutation>> cfToMutations = pair.mutations;
             
             for (Map.Entry<CharSequence, List<Mutation>> cfMutations : cfToMutations.entrySet())
@@ -476,7 +469,7 @@ public class CassandraServer implements 
                 for (Mutation mutation : cfMutations.getValue())
                     AvroValidation.validateMutation(state().getKeyspace(), cfName, mutation);
             }
-            rowMutations.add(getRowMutationFromMutations(state().getKeyspace(), pair.key.array(), cfToMutations));
+            rowMutations.add(getRowMutationFromMutations(state().getKeyspace(), pair.key, cfToMutations));
         }
         
         try
@@ -502,7 +495,7 @@ public class CassandraServer implements 
     }
 
     // FIXME: This is copypasta from o.a.c.db.RowMutation, (RowMutation.getRowMutation uses Thrift types directly).
-    private static RowMutation getRowMutationFromMutations(String keyspace, byte[] key, Map<CharSequence, List<Mutation>> cfMap)
+    private static RowMutation getRowMutationFromMutations(String keyspace, ByteBuffer key, Map<CharSequence, List<Mutation>> cfMap)
     {
         RowMutation rm = new RowMutation(keyspace, key);
         
@@ -528,32 +521,31 @@ public class CassandraServer implements 
         if (cosc.column == null)
         {
             for (Column column : cosc.super_column.columns)
-                rm.add(new QueryPath(cfName, cosc.super_column.name.array(), column.name.array()), column.value.array(), column.timestamp);
+                rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp);
         }
         else
         {
-            rm.add(new QueryPath(cfName, null, cosc.column.name.array()), cosc.column.value.array(), cosc.column.timestamp);
+            rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp);
         }
     }
     
     // FIXME: This is copypasta from o.a.c.db.RowMutation, (RowMutation.getRowMutation uses Thrift types directly).
     private static void deleteColumnOrSuperColumnToRowMutation(RowMutation rm, String cfName, Deletion del)
     {
-        byte[] superName = del.super_column == null ? null : del.super_column.array();
         
         if (del.predicate != null && del.predicate.column_names != null)
         {
             for (ByteBuffer col : del.predicate.column_names)
             {
                 if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.getTable(), cfName) == ColumnFamilyType.Super)
-                    rm.delete(new QueryPath(cfName, col.array()), del.timestamp);
+                    rm.delete(new QueryPath(cfName, col), del.timestamp);
                 else
-                    rm.delete(new QueryPath(cfName, superName, col.array()), del.timestamp);
+                    rm.delete(new QueryPath(cfName, del.super_column, col), del.timestamp);
             }
         }
         else
         {
-            rm.delete(new QueryPath(cfName, superName), del.timestamp);
+            rm.delete(new QueryPath(cfName, del.super_column), del.timestamp);
         }
     }
     
@@ -1039,7 +1031,7 @@ public class CassandraServer implements 
             }
             else
             {
-                bounds = new Bounds(p.getToken(range.start_key.array()), p.getToken(range.end_key.array()));
+                bounds = new Bounds(p.getToken(range.start_key), p.getToken(range.end_key));
             }
             try
             {
@@ -1129,31 +1121,22 @@ public class CassandraServer implements 
     {
         org.apache.cassandra.thrift.ColumnParent cp = new org.apache.cassandra.thrift.ColumnParent(avro_column_parent.column_family.toString());
         if (avro_column_parent.super_column != null)
-            cp.super_column = avro_column_parent.super_column.array();
+            cp.super_column = avro_column_parent.super_column;
 
         return cp;
     }
 
     private org.apache.cassandra.thrift.SlicePredicate thriftSlicePredicate(SlicePredicate avro_pred) {
         // One or the other are set, so check for nulls of either
-
-        List<byte[]> bufs = null;
-        if (avro_pred.column_names != null)
-        {
-            bufs = new ArrayList<byte[]>();
-            for(ByteBuffer buf : avro_pred.column_names)
-                bufs.add(buf.array());
-        }
-
         org.apache.cassandra.thrift.SliceRange slice_range = (avro_pred.slice_range != null)
                                                                 ? thriftSliceRange(avro_pred.slice_range)
                                                                 : null;
 
-        return new org.apache.cassandra.thrift.SlicePredicate().setColumn_names(bufs).setSlice_range(slice_range);
+        return new org.apache.cassandra.thrift.SlicePredicate().setColumn_names(avro_pred.column_names).setSlice_range(slice_range);
     }
 
     private org.apache.cassandra.thrift.SliceRange thriftSliceRange(SliceRange avro_range) {
-        return new org.apache.cassandra.thrift.SliceRange(avro_range.start.array(), avro_range.finish.array(), avro_range.reversed, avro_range.count);
+        return new org.apache.cassandra.thrift.SliceRange(avro_range.start, avro_range.finish, avro_range.reversed, avro_range.count);
     }
 
     private org.apache.cassandra.thrift.IndexClause thriftIndexClause(IndexClause avro_clause) {
@@ -1161,11 +1144,11 @@ public class CassandraServer implements 
         for(IndexExpression exp : avro_clause.expressions)
             expressions.add(thriftIndexExpression(exp));
 
-        return new org.apache.cassandra.thrift.IndexClause(expressions, avro_clause.start_key.array(), avro_clause.count);
+        return new org.apache.cassandra.thrift.IndexClause(expressions, avro_clause.start_key, avro_clause.count);
     }
 
     private org.apache.cassandra.thrift.IndexExpression thriftIndexExpression(IndexExpression avro_exp) {
-        return new org.apache.cassandra.thrift.IndexExpression(avro_exp.column_name.array(), thriftIndexOperator(avro_exp.op), avro_exp.value.array());
+        return new org.apache.cassandra.thrift.IndexExpression(avro_exp.column_name, thriftIndexOperator(avro_exp.op), avro_exp.value);
     }
 
     private org.apache.cassandra.thrift.IndexOperator thriftIndexOperator(IndexOperator avro_op) {



Mime
View raw message