cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r768382 [3/3] - in /incubator/cassandra/trunk: interface/ lib/ src/org/apache/cassandra/cli/ src/org/apache/cassandra/cql/driver/ src/org/apache/cassandra/service/
Date Fri, 24 Apr 2009 17:52:25 GMT
Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/CassandraServer.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/CassandraServer.java Fri Apr 24 17:52:25 2009
@@ -26,6 +26,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Arrays;
 import java.util.concurrent.TimeoutException;
 
 import org.apache.log4j.Logger;
@@ -51,9 +52,11 @@
 
 public class CassandraServer implements Cassandra.Iface
 {
-
 	private static Logger logger_ = Logger.getLogger(CassandraServer.class);
 
+    private final static List<column_t> EMPTY_COLUMNS = Arrays.asList();
+    private final static List<superColumn_t> EMPTY_SUPERCOLUMNS = Arrays.asList();
+
     /*
       * Handle to the storage service to interact with the other machines in the
       * cluster.
@@ -97,7 +100,7 @@
         }
 	}
     
-	protected ColumnFamily readColumnFamily(ReadCommand command) throws CassandraException, TException, IOException, InvalidRequestException, TimeoutException
+	protected ColumnFamily readColumnFamily(ReadCommand command) throws InvalidRequestException
     {
         String[] values = RowMutation.getColumnAndColumnFamily(command.columnFamilyColumn);
         if( values.length < 1 )
@@ -105,7 +108,21 @@
             throw new ColumnFamilyNotDefinedException("Empty column Family is invalid.");
         }
         validateCommand(command.key, command.table, values[0]);
-        Row row = StorageProxy.readProtocol(command, StorageService.ConsistencyLevel.WEAK);
+
+        Row row;
+        try
+        {
+            row = StorageProxy.readProtocol(command, StorageService.ConsistencyLevel.WEAK);
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException(e);
+        }
+        catch (TimeoutException e)
+        {
+            throw new RuntimeException(e);
+        }
+
         if (row == null)
         {
             return null;
@@ -115,6 +132,11 @@
 
     public List<column_t> thriftifyColumns(Collection<IColumn> columns)
     {
+        if (columns == null || columns.isEmpty())
+        {
+            return EMPTY_COLUMNS;
+        }
+
         ArrayList<column_t> thriftColumns = new ArrayList<column_t>(columns.size());
         for (IColumn column : columns)
         {
@@ -125,47 +147,35 @@
             column_t thrift_column = new column_t(column.name(), column.value(), column.timestamp());
             thriftColumns.add(thrift_column);
         }
+
         return thriftColumns;
     }
 
-    public List<column_t> get_columns_since(String tablename, String key, String columnFamily_column, long timeStamp) throws CassandraException, TException
-	{
+    public List<column_t> get_columns_since(String tablename, String key, String columnFamily_column, long timeStamp) throws InvalidRequestException
+    {
         long startTime = System.currentTimeMillis();
-		try
-		{
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, timeStamp));
+        try
+        {
+            ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, timeStamp));
             String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
-			if (cfamily == null)
-			{
-				logger_.info("ERROR ColumnFamily " + columnFamily_column + " is missing.....: "+"   key:" + key	+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_column + "are not present.");
-			}
-			Collection<IColumn> columns = null;
-			if( values.length > 1 )
-			{
-				// this is the super column case 
-				IColumn column = cfamily.getColumn(values[1]);
-				if(column != null)
-					columns = column.getSubColumns();
-			}
-			else
-			{
-				columns = cfamily.getAllColumns();
-			}
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
-
+            if (cfamily == null)
+            {
+                return EMPTY_COLUMNS;
+            }
+            Collection<IColumn> columns = null;
+            if( values.length > 1 )
+            {
+                // this is the super column case
+                IColumn column = cfamily.getColumn(values[1]);
+                if(column != null)
+                    columns = column.getSubColumns();
+            }
+            else
+            {
+                columns = cfamily.getAllColumns();
+            }
             return thriftifyColumns(columns);
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
+        }
         finally
         {
             logger_.debug("get_slice2: " + (System.currentTimeMillis() - startTime) + " ms.");
@@ -173,54 +183,36 @@
 	}
 	
 
-    public List<column_t> get_slice_by_names(String tablename, String key, String columnFamily, List<String> columnNames) throws CassandraException, TException
+    public List<column_t> get_slice_by_names(String tablename, String key, String columnFamily, List<String> columnNames) throws InvalidRequestException
     {
         long startTime = System.currentTimeMillis();
-		try
-		{
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily, columnNames));
-			if (cfamily == null)
-			{
-				logger_.info("ERROR ColumnFamily " + columnFamily + " is missing.....: "
-							+"   key:" + key
-							+ "  ColumnFamily:" + columnFamily);
-				throw new CassandraException("Either the key " + key + " is not present or the columnFamily requested" + columnFamily + "is not present.");
-			}
-			Collection<IColumn> columns = null;
-			columns = cfamily.getAllColumns();
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: "
-							   + "   key:" + key
-								+ "  ColumnFamily:" + columnFamily);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + columnFamily);
-			}
-
+        try
+        {
+            ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily, columnNames));
+            if (cfamily == null)
+            {
+                return EMPTY_COLUMNS;
+            }
+            Collection<IColumn> columns = null;
+            columns = cfamily.getAllColumns();
             return thriftifyColumns(columns);
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
-		finally
+        }
+        finally
         {
             logger_.debug("get_slice2: " + (System.currentTimeMillis() - startTime) + " ms.");
         }
     }
     
-    public List<column_t> get_slice(String tablename, String key, String columnFamily_column, int start, int count) throws CassandraException,TException
-	{
+    public List<column_t> get_slice(String tablename, String key, String columnFamily_column, int start, int count) throws InvalidRequestException
+    {
         long startTime = System.currentTimeMillis();
 		try
 		{
 	        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, start, count));
-			if (cfamily == null)
+            ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, start, count));
+            if (cfamily == null)
 			{
-				logger_.info("ERROR ColumnFamily " + columnFamily_column + " is missing.....: "	+ "   key:" + key + "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_column + "are not present.");
+                return EMPTY_COLUMNS;
 			}
 			Collection<IColumn> columns = null;
 			if( values.length > 1 )
@@ -234,136 +226,104 @@
 			{
 				columns = cfamily.getAllColumns();
 			}
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
-
             return thriftifyColumns(columns);
 		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
         finally
         {
             logger_.debug("get_slice2: " + (System.currentTimeMillis() - startTime) + " ms.");
         }
 	}
     
-    public column_t get_column(String tablename, String key, String columnFamily_column) throws CassandraException,TException
+    public column_t get_column(String tablename, String key, String columnFamily_column) throws NotFoundException, InvalidRequestException
     {
-		try
-		{
-	        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
-			if (cfamily == null || values.length < 2)
-			{
-				logger_.info("ERROR ColumnFamily  is missing.....: "
-							+"   key:" + key
-							+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_column + "are not present.");
-			}
-			Collection<IColumn> columns = null;
-			if( values.length > 2 )
-			{
-				// this is the super column case 
-				IColumn column = cfamily.getColumn(values[1]);
-				if(column != null)
-					columns = column.getSubColumns();
-			}
-			else
-			{
-				columns = cfamily.getAllColumns();
-			}
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: "
-							   + "   key:" + key
-								+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
+        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
+        if (values.length < 2)
+        {
+            throw new InvalidRequestException("get_column requires both parts of columnfamily:column");
+        }
+        ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
+        if (cfamily == null)
+        {
+            throw new NotFoundException();
+        }
+        Collection<IColumn> columns = null;
+        if( values.length > 2 )
+        {
+            // this is the super column case
+            IColumn column = cfamily.getColumn(values[1]);
+            if(column != null)
+                columns = column.getSubColumns();
+        }
+        else
+        {
+            columns = cfamily.getAllColumns();
+        }
+        if (columns == null || columns.size() == 0)
+        {
+            throw new NotFoundException();
+        }
 
-            assert columns.size() == 1;
-            IColumn column = columns.iterator().next();
-            if (column.isMarkedForDelete())
-            {
-                return null;
-            }
-            return new column_t(column.name(), column.value(), column.timestamp());
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
+        assert columns.size() == 1;
+        IColumn column = columns.iterator().next();
+        if (column.isMarkedForDelete())
+        {
+            throw new NotFoundException();
+        }
+
+        return new column_t(column.name(), column.value(), column.timestamp());
     }
     
 
-    public int get_column_count(String tablename, String key, String columnFamily_column) throws CassandraException
-	{
-    	int count = -1;
-		try
-		{
-	        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
-			if (cfamily == null)
-			{
-				logger_.info("ERROR ColumnFamily  is missing.....: "
-							+"   key:" + key
-							+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_column + "are not present.");
-			}
-			Collection<IColumn> columns = null;
-			if( values.length > 1 )
-			{
-				// this is the super column case 
-				IColumn column = cfamily.getColumn(values[1]);
-				if(column != null)
-					columns = column.getSubColumns();
-			}
-			else
-			{
-				columns = cfamily.getAllColumns();
-			}
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: "
-							   + "   key:" + key
-								+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
-			count = columns.size();
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
-		return count;
+    public int get_column_count(String tablename, String key, String columnFamily_column) throws InvalidRequestException
+    {
+        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
+        ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
+        if (cfamily == null)
+        {
+            return 0;
+        }
+        Collection<IColumn> columns = null;
+        if( values.length > 1 )
+        {
+            // this is the super column case
+            IColumn column = cfamily.getColumn(values[1]);
+            if(column != null)
+                columns = column.getSubColumns();
+        }
+        else
+        {
+            columns = cfamily.getAllColumns();
+        }
+        if (columns == null || columns.size() == 0)
+        {
+            return 0;
+        }
+        return columns.size();
 	}
 
     public void insert(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp)
 	{
-		try
-		{
-			RowMutation rm = new RowMutation(tablename, key.trim());
-			rm.add(columnFamily_column, cellData, timestamp);
+        RowMutation rm = new RowMutation(tablename, key.trim());
+        rm.add(columnFamily_column, cellData, timestamp);
+        try
+        {
             validateCommand(rm.key(), rm.table(), rm.columnFamilyNames().toArray(new String[0]));
-			StorageProxy.insert(rm);
-		}
-		catch (Exception e)
-		{
-			logger_.debug( LogUtil.throwableToString(e) );
-		}
-		return;
+        }
+        catch (InvalidRequestException e)
+        {
+            throw new RuntimeException(e);
+        }
+        StorageProxy.insert(rm);
 	}
     
+    public boolean insert_blocking(String tablename, String key, String columnFamily_column, byte[] cellData, long timestamp) throws InvalidRequestException
+    {
+        RowMutation rm = new RowMutation(tablename, key.trim());
+        rm.add(columnFamily_column, cellData, timestamp);
+        validateCommand(rm.key(), rm.table(), rm.columnFamilyNames().toArray(new String[0]));
+        return StorageProxy.insertBlocking(rm);
+    }
+
     public boolean batch_insert_blocking(batch_mutation_t batchMutation) throws InvalidRequestException
     {
         logger_.debug("batch_insert_blocking");
@@ -402,35 +362,20 @@
         }
 	}
 
-    public List<superColumn_t> get_slice_super_by_names(String tablename, String key, String columnFamily, List<String> superColumnNames) throws CassandraException, TException
+    public List<superColumn_t> get_slice_super_by_names(String tablename, String key, String columnFamily, List<String> superColumnNames) throws InvalidRequestException
     {
         long startTime = System.currentTimeMillis();
-		
 		try
 		{
 			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily, superColumnNames));
 			if (cfamily == null)
 			{
-				logger_.info("ERROR ColumnFamily " + columnFamily + " is missing.....: "+"   key:" + key
-							+ "  ColumnFamily:" + columnFamily);
-				throw new CassandraException("Either the key " + key + " is not present or the column family requested" + columnFamily + "is not present.");
+                return EMPTY_SUPERCOLUMNS;
 			}
 			Collection<IColumn> columns = null;
 			columns = cfamily.getAllColumns();
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + columnFamily);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + columnFamily);
-			}
-
             return thriftifySuperColumns(columns);
 		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
         finally
         {
             logger_.debug("get_slice2: " + (System.currentTimeMillis() - startTime) + " ms.");
@@ -439,91 +384,57 @@
 
     private List<superColumn_t> thriftifySuperColumns(Collection<IColumn> columns)
     {
+        if (columns == null || columns.isEmpty())
+        {
+            return EMPTY_SUPERCOLUMNS;
+        }
+
         ArrayList<superColumn_t> thriftSuperColumns = new ArrayList<superColumn_t>(columns.size());
         for (IColumn column : columns)
         {
-            if (column.getSubColumns().size() == 0)
+            List<column_t> subcolumns = thriftifyColumns(column.getSubColumns());
+            if (subcolumns.isEmpty())
             {
                 continue;
             }
-            thriftSuperColumns.add(new superColumn_t(column.name(), thriftifyColumns(column.getSubColumns())));
+            thriftSuperColumns.add(new superColumn_t(column.name(), subcolumns));
         }
+
         return thriftSuperColumns;
     }
 
-
-    public List<superColumn_t> get_slice_super(String tablename, String key, String columnFamily_superColumnName, int start, int count) throws CassandraException
+    public List<superColumn_t> get_slice_super(String tablename, String key, String columnFamily_superColumnName, int start, int count) throws InvalidRequestException
     {
-		try
-		{
-	        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_superColumnName);
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_superColumnName, start, count));
-			if (cfamily == null)
-			{
-				logger_.info("ERROR ColumnFamily  is missing.....: "
-							+"   key:" + key
-							+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_superColumnName + "are not present.");
-			}
-			Collection<IColumn> columns = cfamily.getAllColumns();
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: "
-							   + "   key:" + key
-								+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
-
-            return thriftifySuperColumns(columns);
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
+        ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_superColumnName, start, count));
+        if (cfamily == null)
+        {
+            return EMPTY_SUPERCOLUMNS;
+        }
+        Collection<IColumn> columns = cfamily.getAllColumns();
+        return thriftifySuperColumns(columns);
     }
     
-    public superColumn_t get_superColumn(String tablename, String key, String columnFamily_column) throws CassandraException
+    public superColumn_t get_superColumn(String tablename, String key, String columnFamily_column) throws InvalidRequestException, NotFoundException
     {
-		try
-		{
-	        String[] values = RowMutation.getColumnAndColumnFamily(columnFamily_column);
-			ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
-			if (cfamily == null)
-			{
-				logger_.info("ERROR ColumnFamily  is missing.....: "
-							+"   key:" + key
-							+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("Either the key " + key + " is not present or the columns requested" + columnFamily_column + "are not present.");
-			}
-			Collection<IColumn> columns = cfamily.getAllColumns();
-			if (columns == null || columns.size() == 0)
-			{
-				logger_	.info("ERROR Columns are missing.....: "
-							   + "   key:" + key
-								+ "  ColumnFamily:" + values[0]);
-				throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-			}
+        ColumnFamily cfamily = readColumnFamily(new ReadCommand(tablename, key, columnFamily_column, -1, Integer.MAX_VALUE));
+        if (cfamily == null)
+        {
+            throw new NotFoundException();
+        }
+        Collection<IColumn> columns = cfamily.getAllColumns();
+        if (columns == null || columns.size() == 0)
+        {
+            throw new NotFoundException();
+        }
 
-            assert columns.size() == 1;
-            IColumn column = columns.iterator().next();
-            if (column.getSubColumns().size() == 0)
-            {
-                logger_	.info("ERROR Columns are missing.....: "
-                               + "   key:" + key
-                                + "  ColumnFamily:" + values[0]);
-                throw new CassandraException("ERROR Columns are missing.....: " + "   key:" + key + "  ColumnFamily:" + values[0]);
-            }
+        assert columns.size() == 1;
+        IColumn column = columns.iterator().next();
+        if (column.getSubColumns().size() == 0)
+        {
+            throw new NotFoundException();
+        }
 
-            return new superColumn_t(column.name(), thriftifyColumns(column.getSubColumns()));
-		}
-		catch (Exception ex)
-		{
-			String exception = LogUtil.throwableToString(ex);
-			logger_.info( exception );
-			throw new CassandraException(exception);
-		}
+        return new superColumn_t(column.name(), thriftifyColumns(column.getSubColumns()));
     }
     
     public boolean batch_insert_superColumn_blocking(batch_mutation_super_t batchMutationSuper) throws InvalidRequestException
@@ -550,7 +461,7 @@
         StorageProxy.insert(rm);
     }
 
-    public String getStringProperty(String propertyName) throws TException
+    public String getStringProperty(String propertyName)
     {
         if (propertyName.equals("cluster name"))
         {
@@ -588,7 +499,7 @@
         }
     }
 
-    public List<String> getStringListProperty(String propertyName) throws TException
+    public List<String> getStringListProperty(String propertyName)
     {
         if (propertyName.equals("tables"))
         {
@@ -600,7 +511,7 @@
         }
     }
 
-    public String describeTable(String tableName) throws TException
+    public String describeTable(String tableName)
     {
         String desc = "";
         Map<String, CFMetaData> tableMetaData = DatabaseDescriptor.getTableMetaData(tableName);

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/CqlResult_t.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/CqlResult_t.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/CqlResult_t.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/CqlResult_t.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class CqlResult_t implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("CqlResult_t");
@@ -34,8 +33,6 @@
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
     public boolean errorCode = false;
-    public boolean errorTxt = false;
-    public boolean resultSet = false;
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -63,9 +60,7 @@
     this.errorCode = errorCode;
     this.__isset.errorCode = true;
     this.errorTxt = errorTxt;
-    this.__isset.errorTxt = (errorTxt != null);
     this.resultSet = resultSet;
-    this.__isset.resultSet = (resultSet != null);
   }
 
   /**
@@ -74,12 +69,10 @@
   public CqlResult_t(CqlResult_t other) {
     __isset.errorCode = other.__isset.errorCode;
     this.errorCode = other.errorCode;
-    __isset.errorTxt = other.__isset.errorTxt;
-    if (other.errorTxt != null) {
+    if (other.isSetErrorTxt()) {
       this.errorTxt = other.errorTxt;
     }
-    __isset.resultSet = other.__isset.resultSet;
-    if (other.resultSet != null) {
+    if (other.isSetResultSet()) {
       this.resultSet = other.resultSet;
     }
   }
@@ -117,20 +110,21 @@
 
   public void setErrorTxt(String errorTxt) {
     this.errorTxt = errorTxt;
-    this.__isset.errorTxt = (errorTxt != null);
   }
 
   public void unsetErrorTxt() {
-    this.__isset.errorTxt = false;
+    this.errorTxt = null;
   }
 
   // Returns true if field errorTxt is set (has been asigned a value) and false otherwise
   public boolean isSetErrorTxt() {
-    return this.__isset.errorTxt;
+    return this.errorTxt != null;
   }
 
   public void setErrorTxtIsSet(boolean value) {
-    this.__isset.errorTxt = value;
+    if (!value) {
+      this.errorTxt = null;
+    }
   }
 
   public int getResultSetSize() {
@@ -146,7 +140,6 @@
       this.resultSet = new ArrayList<Map<String,String>>();
     }
     this.resultSet.add(elem);
-    this.__isset.resultSet = true;
   }
 
   public List<Map<String,String>> getResultSet() {
@@ -155,35 +148,47 @@
 
   public void setResultSet(List<Map<String,String>> resultSet) {
     this.resultSet = resultSet;
-    this.__isset.resultSet = (resultSet != null);
   }
 
   public void unsetResultSet() {
     this.resultSet = null;
-    this.__isset.resultSet = false;
   }
 
   // Returns true if field resultSet is set (has been asigned a value) and false otherwise
   public boolean isSetResultSet() {
-    return this.__isset.resultSet;
+    return this.resultSet != null;
   }
 
   public void setResultSetIsSet(boolean value) {
-    this.__isset.resultSet = value;
+    if (!value) {
+      this.resultSet = null;
+    }
   }
 
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case ERRORCODE:
-      setErrorCode((Integer)value);
+      if (value == null) {
+        unsetErrorCode();
+      } else {
+        setErrorCode((Integer)value);
+      }
       break;
 
     case ERRORTXT:
-      setErrorTxt((String)value);
+      if (value == null) {
+        unsetErrorTxt();
+      } else {
+        setErrorTxt((String)value);
+      }
       break;
 
     case RESULTSET:
-      setResultSet((List<Map<String,String>>)value);
+      if (value == null) {
+        unsetResultSet();
+      } else {
+        setResultSet((List<Map<String,String>>)value);
+      }
       break;
 
     default:
@@ -211,11 +216,11 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case ERRORCODE:
-      return this.__isset.errorCode;
+      return isSetErrorCode();
     case ERRORTXT:
-      return this.__isset.errorTxt;
+      return isSetErrorTxt();
     case RESULTSET:
-      return this.__isset.resultSet;
+      return isSetResultSet();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -243,8 +248,8 @@
         return false;
     }
 
-    boolean this_present_errorTxt = true && (this.errorTxt != null);
-    boolean that_present_errorTxt = true && (that.errorTxt != null);
+    boolean this_present_errorTxt = true && this.isSetErrorTxt();
+    boolean that_present_errorTxt = true && that.isSetErrorTxt();
     if (this_present_errorTxt || that_present_errorTxt) {
       if (!(this_present_errorTxt && that_present_errorTxt))
         return false;
@@ -252,8 +257,8 @@
         return false;
     }
 
-    boolean this_present_resultSet = true && (this.resultSet != null);
-    boolean that_present_resultSet = true && (that.resultSet != null);
+    boolean this_present_resultSet = true && this.isSetResultSet();
+    boolean that_present_resultSet = true && that.isSetResultSet();
     if (this_present_resultSet || that_present_resultSet) {
       if (!(this_present_resultSet && that_present_resultSet))
         return false;
@@ -291,7 +296,6 @@
         case ERRORTXT:
           if (field.type == TType.STRING) {
             this.errorTxt = iprot.readString();
-            this.__isset.errorTxt = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -321,7 +325,6 @@
               }
               iprot.readListEnd();
             }
-            this.__isset.resultSet = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -378,17 +381,24 @@
     StringBuilder sb = new StringBuilder("CqlResult_t(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("errorCode:");
     sb.append(this.errorCode);
     first = false;
     if (!first) sb.append(", ");
     sb.append("errorTxt:");
-    sb.append(this.errorTxt);
+    if (this.errorTxt == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.errorTxt);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("resultSet:");
-    sb.append(this.resultSet);
+    if (this.resultSet == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.resultSet);
+    }
     first = false;
     sb.append(")");
     return sb.toString();

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/InvalidRequestException.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/InvalidRequestException.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/InvalidRequestException.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/InvalidRequestException.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class InvalidRequestException extends Exception implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("InvalidRequestException");
@@ -27,7 +26,6 @@
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
-    public boolean why = false;
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -47,15 +45,13 @@
   {
     this();
     this.why = why;
-    this.__isset.why = (why != null);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public InvalidRequestException(InvalidRequestException other) {
-    __isset.why = other.__isset.why;
-    if (other.why != null) {
+    if (other.isSetWhy()) {
       this.why = other.why;
     }
   }
@@ -71,26 +67,31 @@
 
   public void setWhy(String why) {
     this.why = why;
-    this.__isset.why = (why != null);
   }
 
   public void unsetWhy() {
-    this.__isset.why = false;
+    this.why = null;
   }
 
   // Returns true if field why is set (has been asigned a value) and false otherwise
   public boolean isSetWhy() {
-    return this.__isset.why;
+    return this.why != null;
   }
 
   public void setWhyIsSet(boolean value) {
-    this.__isset.why = value;
+    if (!value) {
+      this.why = null;
+    }
   }
 
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case WHY:
-      setWhy((String)value);
+      if (value == null) {
+        unsetWhy();
+      } else {
+        setWhy((String)value);
+      }
       break;
 
     default:
@@ -112,7 +113,7 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case WHY:
-      return this.__isset.why;
+      return isSetWhy();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -131,8 +132,8 @@
     if (that == null)
       return false;
 
-    boolean this_present_why = true && (this.why != null);
-    boolean that_present_why = true && (that.why != null);
+    boolean this_present_why = true && this.isSetWhy();
+    boolean that_present_why = true && that.isSetWhy();
     if (this_present_why || that_present_why) {
       if (!(this_present_why && that_present_why))
         return false;
@@ -162,7 +163,6 @@
         case WHY:
           if (field.type == TType.STRING) {
             this.why = iprot.readString();
-            this.__isset.why = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -198,9 +198,12 @@
     StringBuilder sb = new StringBuilder("InvalidRequestException(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("why:");
-    sb.append(this.why);
+    if (this.why == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.why);
+    }
     first = false;
     sb.append(")");
     return sb.toString();

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/NotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/NotFoundException.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/NotFoundException.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/NotFoundException.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class NotFoundException extends Exception implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("NotFoundException");

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_super_t.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_super_t.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_super_t.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_super_t.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class batch_mutation_super_t implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("batch_mutation_super_t");
@@ -33,9 +32,6 @@
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
-    public boolean table = false;
-    public boolean key = false;
-    public boolean cfmap = false;
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -61,27 +57,21 @@
   {
     this();
     this.table = table;
-    this.__isset.table = (table != null);
     this.key = key;
-    this.__isset.key = (key != null);
     this.cfmap = cfmap;
-    this.__isset.cfmap = (cfmap != null);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public batch_mutation_super_t(batch_mutation_super_t other) {
-    __isset.table = other.__isset.table;
-    if (other.table != null) {
+    if (other.isSetTable()) {
       this.table = other.table;
     }
-    __isset.key = other.__isset.key;
-    if (other.key != null) {
+    if (other.isSetKey()) {
       this.key = other.key;
     }
-    __isset.cfmap = other.__isset.cfmap;
-    if (other.cfmap != null) {
+    if (other.isSetCfmap()) {
       this.cfmap = other.cfmap;
     }
   }
@@ -97,20 +87,21 @@
 
   public void setTable(String table) {
     this.table = table;
-    this.__isset.table = (table != null);
   }
 
   public void unsetTable() {
-    this.__isset.table = false;
+    this.table = null;
   }
 
   // Returns true if field table is set (has been asigned a value) and false otherwise
   public boolean isSetTable() {
-    return this.__isset.table;
+    return this.table != null;
   }
 
   public void setTableIsSet(boolean value) {
-    this.__isset.table = value;
+    if (!value) {
+      this.table = null;
+    }
   }
 
   public String getKey() {
@@ -119,20 +110,21 @@
 
   public void setKey(String key) {
     this.key = key;
-    this.__isset.key = (key != null);
   }
 
   public void unsetKey() {
-    this.__isset.key = false;
+    this.key = null;
   }
 
   // Returns true if field key is set (has been asigned a value) and false otherwise
   public boolean isSetKey() {
-    return this.__isset.key;
+    return this.key != null;
   }
 
   public void setKeyIsSet(boolean value) {
-    this.__isset.key = value;
+    if (!value) {
+      this.key = null;
+    }
   }
 
   public int getCfmapSize() {
@@ -144,7 +136,6 @@
       this.cfmap = new HashMap<String,List<superColumn_t>>();
     }
     this.cfmap.put(key, val);
-    this.__isset.cfmap = true;
   }
 
   public Map<String,List<superColumn_t>> getCfmap() {
@@ -153,35 +144,47 @@
 
   public void setCfmap(Map<String,List<superColumn_t>> cfmap) {
     this.cfmap = cfmap;
-    this.__isset.cfmap = (cfmap != null);
   }
 
   public void unsetCfmap() {
     this.cfmap = null;
-    this.__isset.cfmap = false;
   }
 
   // Returns true if field cfmap is set (has been asigned a value) and false otherwise
   public boolean isSetCfmap() {
-    return this.__isset.cfmap;
+    return this.cfmap != null;
   }
 
   public void setCfmapIsSet(boolean value) {
-    this.__isset.cfmap = value;
+    if (!value) {
+      this.cfmap = null;
+    }
   }
 
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case TABLE:
-      setTable((String)value);
+      if (value == null) {
+        unsetTable();
+      } else {
+        setTable((String)value);
+      }
       break;
 
     case KEY:
-      setKey((String)value);
+      if (value == null) {
+        unsetKey();
+      } else {
+        setKey((String)value);
+      }
       break;
 
     case CFMAP:
-      setCfmap((Map<String,List<superColumn_t>>)value);
+      if (value == null) {
+        unsetCfmap();
+      } else {
+        setCfmap((Map<String,List<superColumn_t>>)value);
+      }
       break;
 
     default:
@@ -209,11 +212,11 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case TABLE:
-      return this.__isset.table;
+      return isSetTable();
     case KEY:
-      return this.__isset.key;
+      return isSetKey();
     case CFMAP:
-      return this.__isset.cfmap;
+      return isSetCfmap();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -232,8 +235,8 @@
     if (that == null)
       return false;
 
-    boolean this_present_table = true && (this.table != null);
-    boolean that_present_table = true && (that.table != null);
+    boolean this_present_table = true && this.isSetTable();
+    boolean that_present_table = true && that.isSetTable();
     if (this_present_table || that_present_table) {
       if (!(this_present_table && that_present_table))
         return false;
@@ -241,8 +244,8 @@
         return false;
     }
 
-    boolean this_present_key = true && (this.key != null);
-    boolean that_present_key = true && (that.key != null);
+    boolean this_present_key = true && this.isSetKey();
+    boolean that_present_key = true && that.isSetKey();
     if (this_present_key || that_present_key) {
       if (!(this_present_key && that_present_key))
         return false;
@@ -250,8 +253,8 @@
         return false;
     }
 
-    boolean this_present_cfmap = true && (this.cfmap != null);
-    boolean that_present_cfmap = true && (that.cfmap != null);
+    boolean this_present_cfmap = true && this.isSetCfmap();
+    boolean that_present_cfmap = true && that.isSetCfmap();
     if (this_present_cfmap || that_present_cfmap) {
       if (!(this_present_cfmap && that_present_cfmap))
         return false;
@@ -281,7 +284,6 @@
         case TABLE:
           if (field.type == TType.STRING) {
             this.table = iprot.readString();
-            this.__isset.table = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -289,7 +291,6 @@
         case KEY:
           if (field.type == TType.STRING) {
             this.key = iprot.readString();
-            this.__isset.key = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -320,7 +321,6 @@
               }
               iprot.readMapEnd();
             }
-            this.__isset.cfmap = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -379,17 +379,28 @@
     StringBuilder sb = new StringBuilder("batch_mutation_super_t(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("table:");
-    sb.append(this.table);
+    if (this.table == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.table);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("key:");
-    sb.append(this.key);
+    if (this.key == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.key);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("cfmap:");
-    sb.append(this.cfmap);
+    if (this.cfmap == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.cfmap);
+    }
     first = false;
     sb.append(")");
     return sb.toString();

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_t.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_t.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_t.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/batch_mutation_t.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class batch_mutation_t implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("batch_mutation_t");
@@ -33,9 +32,6 @@
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
-    public boolean table = false;
-    public boolean key = false;
-    public boolean cfmap = false;
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -61,27 +57,21 @@
   {
     this();
     this.table = table;
-    this.__isset.table = (table != null);
     this.key = key;
-    this.__isset.key = (key != null);
     this.cfmap = cfmap;
-    this.__isset.cfmap = (cfmap != null);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public batch_mutation_t(batch_mutation_t other) {
-    __isset.table = other.__isset.table;
-    if (other.table != null) {
+    if (other.isSetTable()) {
       this.table = other.table;
     }
-    __isset.key = other.__isset.key;
-    if (other.key != null) {
+    if (other.isSetKey()) {
       this.key = other.key;
     }
-    __isset.cfmap = other.__isset.cfmap;
-    if (other.cfmap != null) {
+    if (other.isSetCfmap()) {
       this.cfmap = other.cfmap;
     }
   }
@@ -97,20 +87,21 @@
 
   public void setTable(String table) {
     this.table = table;
-    this.__isset.table = (table != null);
   }
 
   public void unsetTable() {
-    this.__isset.table = false;
+    this.table = null;
   }
 
   // Returns true if field table is set (has been asigned a value) and false otherwise
   public boolean isSetTable() {
-    return this.__isset.table;
+    return this.table != null;
   }
 
   public void setTableIsSet(boolean value) {
-    this.__isset.table = value;
+    if (!value) {
+      this.table = null;
+    }
   }
 
   public String getKey() {
@@ -119,20 +110,21 @@
 
   public void setKey(String key) {
     this.key = key;
-    this.__isset.key = (key != null);
   }
 
   public void unsetKey() {
-    this.__isset.key = false;
+    this.key = null;
   }
 
   // Returns true if field key is set (has been asigned a value) and false otherwise
   public boolean isSetKey() {
-    return this.__isset.key;
+    return this.key != null;
   }
 
   public void setKeyIsSet(boolean value) {
-    this.__isset.key = value;
+    if (!value) {
+      this.key = null;
+    }
   }
 
   public int getCfmapSize() {
@@ -144,7 +136,6 @@
       this.cfmap = new HashMap<String,List<column_t>>();
     }
     this.cfmap.put(key, val);
-    this.__isset.cfmap = true;
   }
 
   public Map<String,List<column_t>> getCfmap() {
@@ -153,35 +144,47 @@
 
   public void setCfmap(Map<String,List<column_t>> cfmap) {
     this.cfmap = cfmap;
-    this.__isset.cfmap = (cfmap != null);
   }
 
   public void unsetCfmap() {
     this.cfmap = null;
-    this.__isset.cfmap = false;
   }
 
   // Returns true if field cfmap is set (has been asigned a value) and false otherwise
   public boolean isSetCfmap() {
-    return this.__isset.cfmap;
+    return this.cfmap != null;
   }
 
   public void setCfmapIsSet(boolean value) {
-    this.__isset.cfmap = value;
+    if (!value) {
+      this.cfmap = null;
+    }
   }
 
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case TABLE:
-      setTable((String)value);
+      if (value == null) {
+        unsetTable();
+      } else {
+        setTable((String)value);
+      }
       break;
 
     case KEY:
-      setKey((String)value);
+      if (value == null) {
+        unsetKey();
+      } else {
+        setKey((String)value);
+      }
       break;
 
     case CFMAP:
-      setCfmap((Map<String,List<column_t>>)value);
+      if (value == null) {
+        unsetCfmap();
+      } else {
+        setCfmap((Map<String,List<column_t>>)value);
+      }
       break;
 
     default:
@@ -209,11 +212,11 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case TABLE:
-      return this.__isset.table;
+      return isSetTable();
     case KEY:
-      return this.__isset.key;
+      return isSetKey();
     case CFMAP:
-      return this.__isset.cfmap;
+      return isSetCfmap();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -232,8 +235,8 @@
     if (that == null)
       return false;
 
-    boolean this_present_table = true && (this.table != null);
-    boolean that_present_table = true && (that.table != null);
+    boolean this_present_table = true && this.isSetTable();
+    boolean that_present_table = true && that.isSetTable();
     if (this_present_table || that_present_table) {
       if (!(this_present_table && that_present_table))
         return false;
@@ -241,8 +244,8 @@
         return false;
     }
 
-    boolean this_present_key = true && (this.key != null);
-    boolean that_present_key = true && (that.key != null);
+    boolean this_present_key = true && this.isSetKey();
+    boolean that_present_key = true && that.isSetKey();
     if (this_present_key || that_present_key) {
       if (!(this_present_key && that_present_key))
         return false;
@@ -250,8 +253,8 @@
         return false;
     }
 
-    boolean this_present_cfmap = true && (this.cfmap != null);
-    boolean that_present_cfmap = true && (that.cfmap != null);
+    boolean this_present_cfmap = true && this.isSetCfmap();
+    boolean that_present_cfmap = true && that.isSetCfmap();
     if (this_present_cfmap || that_present_cfmap) {
       if (!(this_present_cfmap && that_present_cfmap))
         return false;
@@ -281,7 +284,6 @@
         case TABLE:
           if (field.type == TType.STRING) {
             this.table = iprot.readString();
-            this.__isset.table = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -289,7 +291,6 @@
         case KEY:
           if (field.type == TType.STRING) {
             this.key = iprot.readString();
-            this.__isset.key = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -320,7 +321,6 @@
               }
               iprot.readMapEnd();
             }
-            this.__isset.cfmap = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -379,17 +379,28 @@
     StringBuilder sb = new StringBuilder("batch_mutation_t(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("table:");
-    sb.append(this.table);
+    if (this.table == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.table);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("key:");
-    sb.append(this.key);
+    if (this.key == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.key);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("cfmap:");
-    sb.append(this.cfmap);
+    if (this.cfmap == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.cfmap);
+    }
     first = false;
     sb.append(")");
     return sb.toString();

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/column_t.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/column_t.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/column_t.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/column_t.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class column_t implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("column_t");
@@ -33,8 +32,6 @@
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
-    public boolean columnName = false;
-    public boolean value = false;
     public boolean timestamp = false;
   }
 
@@ -61,9 +58,7 @@
   {
     this();
     this.columnName = columnName;
-    this.__isset.columnName = (columnName != null);
     this.value = value;
-    this.__isset.value = (value != null);
     this.timestamp = timestamp;
     this.__isset.timestamp = true;
   }
@@ -72,12 +67,10 @@
    * Performs a deep copy on <i>other</i>.
    */
   public column_t(column_t other) {
-    __isset.columnName = other.__isset.columnName;
-    if (other.columnName != null) {
+    if (other.isSetColumnName()) {
       this.columnName = other.columnName;
     }
-    __isset.value = other.__isset.value;
-    if (other.value != null) {
+    if (other.isSetValue()) {
       this.value = new byte[other.value.length];
       System.arraycopy(other.value, 0, value, 0, other.value.length);
     }
@@ -96,20 +89,21 @@
 
   public void setColumnName(String columnName) {
     this.columnName = columnName;
-    this.__isset.columnName = (columnName != null);
   }
 
   public void unsetColumnName() {
-    this.__isset.columnName = false;
+    this.columnName = null;
   }
 
   // Returns true if field columnName is set (has been asigned a value) and false otherwise
   public boolean isSetColumnName() {
-    return this.__isset.columnName;
+    return this.columnName != null;
   }
 
   public void setColumnNameIsSet(boolean value) {
-    this.__isset.columnName = value;
+    if (!value) {
+      this.columnName = null;
+    }
   }
 
   public byte[] getValue() {
@@ -118,20 +112,21 @@
 
   public void setValue(byte[] value) {
     this.value = value;
-    this.__isset.value = (value != null);
   }
 
   public void unsetValue() {
-    this.__isset.value = false;
+    this.value = null;
   }
 
   // Returns true if field value is set (has been asigned a value) and false otherwise
   public boolean isSetValue() {
-    return this.__isset.value;
+    return this.value != null;
   }
 
   public void setValueIsSet(boolean value) {
-    this.__isset.value = value;
+    if (!value) {
+      this.value = null;
+    }
   }
 
   public long getTimestamp() {
@@ -159,15 +154,27 @@
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case COLUMNNAME:
-      setColumnName((String)value);
+      if (value == null) {
+        unsetColumnName();
+      } else {
+        setColumnName((String)value);
+      }
       break;
 
     case VALUE:
-      setValue((byte[])value);
+      if (value == null) {
+        unsetValue();
+      } else {
+        setValue((byte[])value);
+      }
       break;
 
     case TIMESTAMP:
-      setTimestamp((Long)value);
+      if (value == null) {
+        unsetTimestamp();
+      } else {
+        setTimestamp((Long)value);
+      }
       break;
 
     default:
@@ -195,11 +202,11 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case COLUMNNAME:
-      return this.__isset.columnName;
+      return isSetColumnName();
     case VALUE:
-      return this.__isset.value;
+      return isSetValue();
     case TIMESTAMP:
-      return this.__isset.timestamp;
+      return isSetTimestamp();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -218,8 +225,8 @@
     if (that == null)
       return false;
 
-    boolean this_present_columnName = true && (this.columnName != null);
-    boolean that_present_columnName = true && (that.columnName != null);
+    boolean this_present_columnName = true && this.isSetColumnName();
+    boolean that_present_columnName = true && that.isSetColumnName();
     if (this_present_columnName || that_present_columnName) {
       if (!(this_present_columnName && that_present_columnName))
         return false;
@@ -227,8 +234,8 @@
         return false;
     }
 
-    boolean this_present_value = true && (this.value != null);
-    boolean that_present_value = true && (that.value != null);
+    boolean this_present_value = true && this.isSetValue();
+    boolean that_present_value = true && that.isSetValue();
     if (this_present_value || that_present_value) {
       if (!(this_present_value && that_present_value))
         return false;
@@ -267,7 +274,6 @@
         case COLUMNNAME:
           if (field.type == TType.STRING) {
             this.columnName = iprot.readString();
-            this.__isset.columnName = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -275,7 +281,6 @@
         case VALUE:
           if (field.type == TType.STRING) {
             this.value = iprot.readBinary();
-            this.__isset.value = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -327,21 +332,24 @@
     StringBuilder sb = new StringBuilder("column_t(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("columnName:");
-    sb.append(this.columnName);
+    if (this.columnName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.columnName);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("value:");
-    if (value == null) { 
+    if (this.value == null) {
       sb.append("null");
     } else {
-      int __value_size = Math.min(this.value.length, 128);
-      for (int i = 0; i < __value_size; i++) {
-        if (i != 0) sb.append(" ");
-        sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
-      }
-      if (this.value.length > 128) sb.append(" ...");
+        int __value_size = Math.min(this.value.length, 128);
+        for (int i = 0; i < __value_size; i++) {
+          if (i != 0) sb.append(" ");
+          sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
+        }
+        if (this.value.length > 128) sb.append(" ...");
     }
     first = false;
     if (!first) sb.append(", ");

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/superColumn_t.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/superColumn_t.java?rev=768382&r1=768381&r2=768382&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/superColumn_t.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/superColumn_t.java Fri Apr 24 17:52:25 2009
@@ -12,11 +12,10 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
-
 import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
 
 public class superColumn_t implements TBase, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("superColumn_t");
@@ -30,8 +29,6 @@
 
   private final Isset __isset = new Isset();
   private static final class Isset implements java.io.Serializable {
-    public boolean name = false;
-    public boolean columns = false;
   }
 
   public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
@@ -55,21 +52,17 @@
   {
     this();
     this.name = name;
-    this.__isset.name = (name != null);
     this.columns = columns;
-    this.__isset.columns = (columns != null);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public superColumn_t(superColumn_t other) {
-    __isset.name = other.__isset.name;
-    if (other.name != null) {
+    if (other.isSetName()) {
       this.name = other.name;
     }
-    __isset.columns = other.__isset.columns;
-    if (other.columns != null) {
+    if (other.isSetColumns()) {
       List<column_t> __this__columns = new ArrayList<column_t>();
       for (column_t other_element : other.columns) {
         __this__columns.add(new column_t(other_element));
@@ -89,20 +82,21 @@
 
   public void setName(String name) {
     this.name = name;
-    this.__isset.name = (name != null);
   }
 
   public void unsetName() {
-    this.__isset.name = false;
+    this.name = null;
   }
 
   // Returns true if field name is set (has been asigned a value) and false otherwise
   public boolean isSetName() {
-    return this.__isset.name;
+    return this.name != null;
   }
 
   public void setNameIsSet(boolean value) {
-    this.__isset.name = value;
+    if (!value) {
+      this.name = null;
+    }
   }
 
   public int getColumnsSize() {
@@ -118,7 +112,6 @@
       this.columns = new ArrayList<column_t>();
     }
     this.columns.add(elem);
-    this.__isset.columns = true;
   }
 
   public List<column_t> getColumns() {
@@ -127,31 +120,39 @@
 
   public void setColumns(List<column_t> columns) {
     this.columns = columns;
-    this.__isset.columns = (columns != null);
   }
 
   public void unsetColumns() {
     this.columns = null;
-    this.__isset.columns = false;
   }
 
   // Returns true if field columns is set (has been asigned a value) and false otherwise
   public boolean isSetColumns() {
-    return this.__isset.columns;
+    return this.columns != null;
   }
 
   public void setColumnsIsSet(boolean value) {
-    this.__isset.columns = value;
+    if (!value) {
+      this.columns = null;
+    }
   }
 
   public void setFieldValue(int fieldID, Object value) {
     switch (fieldID) {
     case NAME:
-      setName((String)value);
+      if (value == null) {
+        unsetName();
+      } else {
+        setName((String)value);
+      }
       break;
 
     case COLUMNS:
-      setColumns((List<column_t>)value);
+      if (value == null) {
+        unsetColumns();
+      } else {
+        setColumns((List<column_t>)value);
+      }
       break;
 
     default:
@@ -176,9 +177,9 @@
   public boolean isSet(int fieldID) {
     switch (fieldID) {
     case NAME:
-      return this.__isset.name;
+      return isSetName();
     case COLUMNS:
-      return this.__isset.columns;
+      return isSetColumns();
     default:
       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
@@ -197,8 +198,8 @@
     if (that == null)
       return false;
 
-    boolean this_present_name = true && (this.name != null);
-    boolean that_present_name = true && (that.name != null);
+    boolean this_present_name = true && this.isSetName();
+    boolean that_present_name = true && that.isSetName();
     if (this_present_name || that_present_name) {
       if (!(this_present_name && that_present_name))
         return false;
@@ -206,8 +207,8 @@
         return false;
     }
 
-    boolean this_present_columns = true && (this.columns != null);
-    boolean that_present_columns = true && (that.columns != null);
+    boolean this_present_columns = true && this.isSetColumns();
+    boolean that_present_columns = true && that.isSetColumns();
     if (this_present_columns || that_present_columns) {
       if (!(this_present_columns && that_present_columns))
         return false;
@@ -237,7 +238,6 @@
         case NAME:
           if (field.type == TType.STRING) {
             this.name = iprot.readString();
-            this.__isset.name = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -256,7 +256,6 @@
               }
               iprot.readListEnd();
             }
-            this.__isset.columns = true;
           } else { 
             TProtocolUtil.skip(iprot, field.type);
           }
@@ -303,13 +302,20 @@
     StringBuilder sb = new StringBuilder("superColumn_t(");
     boolean first = true;
 
-    if (!first) sb.append(", ");
     sb.append("name:");
-    sb.append(this.name);
+    if (this.name == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.name);
+    }
     first = false;
     if (!first) sb.append(", ");
     sb.append("columns:");
-    sb.append(this.columns);
+    if (this.columns == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.columns);
+    }
     first = false;
     sb.append(")");
     return sb.toString();



Mime
View raw message