cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r980554 [1/2] - in /cassandra/trunk: conf/ 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/config/ src/java/org/apache/c...
Date Thu, 29 Jul 2010 19:53:37 GMT
Author: gdusbabek
Date: Thu Jul 29 19:53:36 2010
New Revision: 980554

URL: http://svn.apache.org/viewvc?rev=980554&view=rev
Log:
revert 980215, 980217, 980220, 980222, 980225, 980226. CASSANDRA-1237

Added:
    cassandra/trunk/conf/access.properties
      - copied unchanged from r980214, cassandra/trunk/conf/access.properties
Removed:
    cassandra/trunk/src/java/org/apache/cassandra/auth/AuthenticatedUser.java
    cassandra/trunk/src/java/org/apache/cassandra/service/ClientState.java
Modified:
    cassandra/trunk/interface/cassandra.genavro
    cassandra/trunk/interface/cassandra.thrift
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
    cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
    cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java
    cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java
    cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java
    cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
    cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java

Modified: cassandra/trunk/interface/cassandra.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.genavro?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.genavro (original)
+++ cassandra/trunk/interface/cassandra.genavro Thu Jul 29 19:53:36 2010
@@ -23,7 +23,7 @@
 
 protocol Cassandra {
     enum AccessLevel {
-        NONE, READONLY, READWRITE, FULL
+        NONE, READONLY, READWRITE, FALL
     }
 
     record ColumnPath {
@@ -122,8 +122,6 @@ protocol Cassandra {
         string strategy_class;
         int replication_factor;
         array<CfDef> cf_defs;
-        union { map<AccessLevel>, null } users_access;
-        union { map<AccessLevel>, null } groups_access;
     }
     
     record MutationsMapEntry {

Modified: cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.thrift (original)
+++ cassandra/trunk/interface/cassandra.thrift Thu Jul 29 19:53:36 2010
@@ -377,13 +377,11 @@ struct KsDef {
     2: required string strategy_class,
     3: required i32 replication_factor,
     5: required list<CfDef> cf_defs,    
-    6: optional map<string,AccessLevel> users_access,
-    7: optional map<string,AccessLevel> groups_access,
 }
 
 service Cassandra {
   # auth methods
-  void login(1: required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx),
+  AccessLevel login(1: required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx),
  
   # set keyspace
   void set_keyspace(1: required string keyspace) throws (1:InvalidRequestException ire),

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java Thu Jul 29 19:53:36 2010
@@ -50,7 +50,7 @@ public class Cassandra {
 
   public interface Iface {
 
-    public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException;
+    public AccessLevel login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException;
 
     public void set_keyspace(String keyspace) throws InvalidRequestException, TException;
 
@@ -390,10 +390,10 @@ public class Cassandra {
       return this.oprot_;
     }
 
-    public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException
+    public AccessLevel login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException
     {
       send_login(auth_request);
-      recv_login();
+      return recv_login();
     }
 
     public void send_login(AuthenticationRequest auth_request) throws TException
@@ -406,7 +406,7 @@ public class Cassandra {
       oprot_.getTransport().flush();
     }
 
-    public void recv_login() throws AuthenticationException, AuthorizationException, TException
+    public AccessLevel recv_login() throws AuthenticationException, AuthorizationException, TException
     {
       TMessage msg = iprot_.readMessageBegin();
       if (msg.type == TMessageType.EXCEPTION) {
@@ -420,13 +420,16 @@ public class Cassandra {
       login_result result = new login_result();
       result.read(iprot_);
       iprot_.readMessageEnd();
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
       if (result.authnx != null) {
         throw result.authnx;
       }
       if (result.authzx != null) {
         throw result.authzx;
       }
-      return;
+      throw new TApplicationException(TApplicationException.MISSING_RESULT, "login failed: unknown result");
     }
 
     public void set_keyspace(String keyspace) throws InvalidRequestException, TException
@@ -1595,13 +1598,13 @@ public class Cassandra {
         prot.writeMessageEnd();
       }
 
-      public void getResult() throws AuthenticationException, AuthorizationException, TException {
+      public AccessLevel getResult() throws AuthenticationException, AuthorizationException, TException {
         if (getState() != State.RESPONSE_READ) {
           throw new IllegalStateException("Method call not finished!");
         }
         TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array());
         TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        (new Client(prot)).recv_login();
+        return (new Client(prot)).recv_login();
       }
     }
 
@@ -2618,7 +2621,7 @@ public class Cassandra {
         iprot.readMessageEnd();
         login_result result = new login_result();
         try {
-          iface_.login(args.auth_request);
+          result.success = iface_.login(args.auth_request);
         } catch (AuthenticationException authnx) {
           result.authnx = authnx;
         } catch (AuthorizationException authzx) {
@@ -3948,14 +3951,25 @@ public class Cassandra {
   public static class login_result implements TBase<login_result, login_result._Fields>, java.io.Serializable, Cloneable   {
     private static final TStruct STRUCT_DESC = new TStruct("login_result");
 
+    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I32, (short)0);
     private static final TField AUTHNX_FIELD_DESC = new TField("authnx", TType.STRUCT, (short)1);
     private static final TField AUTHZX_FIELD_DESC = new TField("authzx", TType.STRUCT, (short)2);
 
+    /**
+     * 
+     * @see AccessLevel
+     */
+    public AccessLevel success;
     public AuthenticationException authnx;
     public AuthorizationException authzx;
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements TFieldIdEnum {
+      /**
+       * 
+       * @see AccessLevel
+       */
+      SUCCESS((short)0, "success"),
       AUTHNX((short)1, "authnx"),
       AUTHZX((short)2, "authzx");
 
@@ -3972,6 +3986,8 @@ public class Cassandra {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
           case 1: // AUTHNX
             return AUTHNX;
           case 2: // AUTHZX
@@ -4020,6 +4036,8 @@ public class Cassandra {
     public static final Map<_Fields, FieldMetaData> metaDataMap;
     static {
       Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
+          new EnumMetaData(TType.ENUM, AccessLevel.class)));
       tmpMap.put(_Fields.AUTHNX, new FieldMetaData("authnx", TFieldRequirementType.DEFAULT, 
           new FieldValueMetaData(TType.STRUCT)));
       tmpMap.put(_Fields.AUTHZX, new FieldMetaData("authzx", TFieldRequirementType.DEFAULT, 
@@ -4032,10 +4050,12 @@ public class Cassandra {
     }
 
     public login_result(
+      AccessLevel success,
       AuthenticationException authnx,
       AuthorizationException authzx)
     {
       this();
+      this.success = success;
       this.authnx = authnx;
       this.authzx = authzx;
     }
@@ -4044,6 +4064,9 @@ public class Cassandra {
      * Performs a deep copy on <i>other</i>.
      */
     public login_result(login_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
       if (other.isSetAuthnx()) {
         this.authnx = new AuthenticationException(other.authnx);
       }
@@ -4061,6 +4084,38 @@ public class Cassandra {
       return new login_result(this);
     }
 
+    /**
+     * 
+     * @see AccessLevel
+     */
+    public AccessLevel getSuccess() {
+      return this.success;
+    }
+
+    /**
+     * 
+     * @see AccessLevel
+     */
+    public login_result setSuccess(AccessLevel success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been asigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
     public AuthenticationException getAuthnx() {
       return this.authnx;
     }
@@ -4111,6 +4166,14 @@ public class Cassandra {
 
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((AccessLevel)value);
+        }
+        break;
+
       case AUTHNX:
         if (value == null) {
           unsetAuthnx();
@@ -4136,6 +4199,9 @@ public class Cassandra {
 
     public Object getFieldValue(_Fields field) {
       switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
       case AUTHNX:
         return getAuthnx();
 
@@ -4153,6 +4219,8 @@ public class Cassandra {
     /** 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 SUCCESS:
+        return isSetSuccess();
       case AUTHNX:
         return isSetAuthnx();
       case AUTHZX:
@@ -4178,6 +4246,15 @@ public class Cassandra {
       if (that == null)
         return false;
 
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
       boolean this_present_authnx = true && this.isSetAuthnx();
       boolean that_present_authnx = true && that.isSetAuthnx();
       if (this_present_authnx || that_present_authnx) {
@@ -4212,6 +4289,15 @@ public class Cassandra {
       int lastComparison = 0;
       login_result typedOther = (login_result)other;
 
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {        lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
       lastComparison = Boolean.valueOf(isSetAuthnx()).compareTo(typedOther.isSetAuthnx());
       if (lastComparison != 0) {
         return lastComparison;
@@ -4243,6 +4329,13 @@ public class Cassandra {
           break;
         }
         switch (field.id) {
+          case 0: // SUCCESS
+            if (field.type == TType.I32) {
+              this.success = AccessLevel.findByValue(iprot.readI32());
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
           case 1: // AUTHNX
             if (field.type == TType.STRUCT) {
               this.authnx = new AuthenticationException();
@@ -4273,7 +4366,11 @@ public class Cassandra {
     public void write(TProtocol oprot) throws TException {
       oprot.writeStructBegin(STRUCT_DESC);
 
-      if (this.isSetAuthnx()) {
+      if (this.isSetSuccess()) {
+        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+        oprot.writeI32(this.success.getValue());
+        oprot.writeFieldEnd();
+      } else if (this.isSetAuthnx()) {
         oprot.writeFieldBegin(AUTHNX_FIELD_DESC);
         this.authnx.write(oprot);
         oprot.writeFieldEnd();
@@ -4291,6 +4388,14 @@ public class Cassandra {
       StringBuilder sb = new StringBuilder("login_result(");
       boolean first = true;
 
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
       sb.append("authnx:");
       if (this.authnx == null) {
         sb.append("null");
@@ -7049,14 +7154,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list47 = iprot.readListBegin();
-                this.success = new ArrayList<ColumnOrSuperColumn>(_list47.size);
-                for (int _i48 = 0; _i48 < _list47.size; ++_i48)
+                TList _list37 = iprot.readListBegin();
+                this.success = new ArrayList<ColumnOrSuperColumn>(_list37.size);
+                for (int _i38 = 0; _i38 < _list37.size; ++_i38)
                 {
-                  ColumnOrSuperColumn _elem49;
-                  _elem49 = new ColumnOrSuperColumn();
-                  _elem49.read(iprot);
-                  this.success.add(_elem49);
+                  ColumnOrSuperColumn _elem39;
+                  _elem39 = new ColumnOrSuperColumn();
+                  _elem39.read(iprot);
+                  this.success.add(_elem39);
                 }
                 iprot.readListEnd();
               }
@@ -7106,9 +7211,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
-          for (ColumnOrSuperColumn _iter50 : this.success)
+          for (ColumnOrSuperColumn _iter40 : this.success)
           {
-            _iter50.write(oprot);
+            _iter40.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -7651,13 +7756,13 @@ public class Cassandra {
           case 1: // KEYS
             if (field.type == TType.LIST) {
               {
-                TList _list51 = iprot.readListBegin();
-                this.keys = new ArrayList<byte[]>(_list51.size);
-                for (int _i52 = 0; _i52 < _list51.size; ++_i52)
+                TList _list41 = iprot.readListBegin();
+                this.keys = new ArrayList<byte[]>(_list41.size);
+                for (int _i42 = 0; _i42 < _list41.size; ++_i42)
                 {
-                  byte[] _elem53;
-                  _elem53 = iprot.readBinary();
-                  this.keys.add(_elem53);
+                  byte[] _elem43;
+                  _elem43 = iprot.readBinary();
+                  this.keys.add(_elem43);
                 }
                 iprot.readListEnd();
               }
@@ -7707,9 +7812,9 @@ public class Cassandra {
         oprot.writeFieldBegin(KEYS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRING, this.keys.size()));
-          for (byte[] _iter54 : this.keys)
+          for (byte[] _iter44 : this.keys)
           {
-            oprot.writeBinary(_iter54);
+            oprot.writeBinary(_iter44);
           }
           oprot.writeListEnd();
         }
@@ -8257,26 +8362,26 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.MAP) {
               {
-                TMap _map55 = iprot.readMapBegin();
-                this.success = new HashMap<byte[],List<ColumnOrSuperColumn>>(2*_map55.size);
-                for (int _i56 = 0; _i56 < _map55.size; ++_i56)
+                TMap _map45 = iprot.readMapBegin();
+                this.success = new HashMap<byte[],List<ColumnOrSuperColumn>>(2*_map45.size);
+                for (int _i46 = 0; _i46 < _map45.size; ++_i46)
                 {
-                  byte[] _key57;
-                  List<ColumnOrSuperColumn> _val58;
-                  _key57 = iprot.readBinary();
+                  byte[] _key47;
+                  List<ColumnOrSuperColumn> _val48;
+                  _key47 = iprot.readBinary();
                   {
-                    TList _list59 = iprot.readListBegin();
-                    _val58 = new ArrayList<ColumnOrSuperColumn>(_list59.size);
-                    for (int _i60 = 0; _i60 < _list59.size; ++_i60)
+                    TList _list49 = iprot.readListBegin();
+                    _val48 = new ArrayList<ColumnOrSuperColumn>(_list49.size);
+                    for (int _i50 = 0; _i50 < _list49.size; ++_i50)
                     {
-                      ColumnOrSuperColumn _elem61;
-                      _elem61 = new ColumnOrSuperColumn();
-                      _elem61.read(iprot);
-                      _val58.add(_elem61);
+                      ColumnOrSuperColumn _elem51;
+                      _elem51 = new ColumnOrSuperColumn();
+                      _elem51.read(iprot);
+                      _val48.add(_elem51);
                     }
                     iprot.readListEnd();
                   }
-                  this.success.put(_key57, _val58);
+                  this.success.put(_key47, _val48);
                 }
                 iprot.readMapEnd();
               }
@@ -8326,14 +8431,14 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.success.size()));
-          for (Map.Entry<byte[], List<ColumnOrSuperColumn>> _iter62 : this.success.entrySet())
+          for (Map.Entry<byte[], List<ColumnOrSuperColumn>> _iter52 : this.success.entrySet())
           {
-            oprot.writeBinary(_iter62.getKey());
+            oprot.writeBinary(_iter52.getKey());
             {
-              oprot.writeListBegin(new TList(TType.STRUCT, _iter62.getValue().size()));
-              for (ColumnOrSuperColumn _iter63 : _iter62.getValue())
+              oprot.writeListBegin(new TList(TType.STRUCT, _iter52.getValue().size()));
+              for (ColumnOrSuperColumn _iter53 : _iter52.getValue())
               {
-                _iter63.write(oprot);
+                _iter53.write(oprot);
               }
               oprot.writeListEnd();
             }
@@ -10079,13 +10184,13 @@ public class Cassandra {
           case 2: // KEYS
             if (field.type == TType.LIST) {
               {
-                TList _list64 = iprot.readListBegin();
-                this.keys = new ArrayList<byte[]>(_list64.size);
-                for (int _i65 = 0; _i65 < _list64.size; ++_i65)
+                TList _list54 = iprot.readListBegin();
+                this.keys = new ArrayList<byte[]>(_list54.size);
+                for (int _i55 = 0; _i55 < _list54.size; ++_i55)
                 {
-                  byte[] _elem66;
-                  _elem66 = iprot.readBinary();
-                  this.keys.add(_elem66);
+                  byte[] _elem56;
+                  _elem56 = iprot.readBinary();
+                  this.keys.add(_elem56);
                 }
                 iprot.readListEnd();
               }
@@ -10140,9 +10245,9 @@ public class Cassandra {
         oprot.writeFieldBegin(KEYS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRING, this.keys.size()));
-          for (byte[] _iter67 : this.keys)
+          for (byte[] _iter57 : this.keys)
           {
-            oprot.writeBinary(_iter67);
+            oprot.writeBinary(_iter57);
           }
           oprot.writeListEnd();
         }
@@ -10697,15 +10802,15 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.MAP) {
               {
-                TMap _map68 = iprot.readMapBegin();
-                this.success = new HashMap<byte[],Integer>(2*_map68.size);
-                for (int _i69 = 0; _i69 < _map68.size; ++_i69)
+                TMap _map58 = iprot.readMapBegin();
+                this.success = new HashMap<byte[],Integer>(2*_map58.size);
+                for (int _i59 = 0; _i59 < _map58.size; ++_i59)
                 {
-                  byte[] _key70;
-                  int _val71;
-                  _key70 = iprot.readBinary();
-                  _val71 = iprot.readI32();
-                  this.success.put(_key70, _val71);
+                  byte[] _key60;
+                  int _val61;
+                  _key60 = iprot.readBinary();
+                  _val61 = iprot.readI32();
+                  this.success.put(_key60, _val61);
                 }
                 iprot.readMapEnd();
               }
@@ -10755,10 +10860,10 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new TMap(TType.STRING, TType.I32, this.success.size()));
-          for (Map.Entry<byte[], Integer> _iter72 : this.success.entrySet())
+          for (Map.Entry<byte[], Integer> _iter62 : this.success.entrySet())
           {
-            oprot.writeBinary(_iter72.getKey());
-            oprot.writeI32(_iter72.getValue());
+            oprot.writeBinary(_iter62.getKey());
+            oprot.writeI32(_iter62.getValue());
           }
           oprot.writeMapEnd();
         }
@@ -11859,14 +11964,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list73 = iprot.readListBegin();
-                this.success = new ArrayList<KeySlice>(_list73.size);
-                for (int _i74 = 0; _i74 < _list73.size; ++_i74)
+                TList _list63 = iprot.readListBegin();
+                this.success = new ArrayList<KeySlice>(_list63.size);
+                for (int _i64 = 0; _i64 < _list63.size; ++_i64)
                 {
-                  KeySlice _elem75;
-                  _elem75 = new KeySlice();
-                  _elem75.read(iprot);
-                  this.success.add(_elem75);
+                  KeySlice _elem65;
+                  _elem65 = new KeySlice();
+                  _elem65.read(iprot);
+                  this.success.add(_elem65);
                 }
                 iprot.readListEnd();
               }
@@ -11916,9 +12021,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
-          for (KeySlice _iter76 : this.success)
+          for (KeySlice _iter66 : this.success)
           {
-            _iter76.write(oprot);
+            _iter66.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -13019,14 +13124,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list77 = iprot.readListBegin();
-                this.success = new ArrayList<KeySlice>(_list77.size);
-                for (int _i78 = 0; _i78 < _list77.size; ++_i78)
+                TList _list67 = iprot.readListBegin();
+                this.success = new ArrayList<KeySlice>(_list67.size);
+                for (int _i68 = 0; _i68 < _list67.size; ++_i68)
                 {
-                  KeySlice _elem79;
-                  _elem79 = new KeySlice();
-                  _elem79.read(iprot);
-                  this.success.add(_elem79);
+                  KeySlice _elem69;
+                  _elem69 = new KeySlice();
+                  _elem69.read(iprot);
+                  this.success.add(_elem69);
                 }
                 iprot.readListEnd();
               }
@@ -13076,9 +13181,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
-          for (KeySlice _iter80 : this.success)
+          for (KeySlice _iter70 : this.success)
           {
-            _iter80.write(oprot);
+            _iter70.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -14179,14 +14284,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list81 = iprot.readListBegin();
-                this.success = new ArrayList<KeyCount>(_list81.size);
-                for (int _i82 = 0; _i82 < _list81.size; ++_i82)
+                TList _list71 = iprot.readListBegin();
+                this.success = new ArrayList<KeyCount>(_list71.size);
+                for (int _i72 = 0; _i72 < _list71.size; ++_i72)
                 {
-                  KeyCount _elem83;
-                  _elem83 = new KeyCount();
-                  _elem83.read(iprot);
-                  this.success.add(_elem83);
+                  KeyCount _elem73;
+                  _elem73 = new KeyCount();
+                  _elem73.read(iprot);
+                  this.success.add(_elem73);
                 }
                 iprot.readListEnd();
               }
@@ -14236,9 +14341,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
-          for (KeyCount _iter84 : this.success)
+          for (KeyCount _iter74 : this.success)
           {
-            _iter84.write(oprot);
+            _iter74.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -16747,38 +16852,38 @@ public class Cassandra {
           case 1: // MUTATION_MAP
             if (field.type == TType.MAP) {
               {
-                TMap _map85 = iprot.readMapBegin();
-                this.mutation_map = new HashMap<byte[],Map<String,List<Mutation>>>(2*_map85.size);
-                for (int _i86 = 0; _i86 < _map85.size; ++_i86)
+                TMap _map75 = iprot.readMapBegin();
+                this.mutation_map = new HashMap<byte[],Map<String,List<Mutation>>>(2*_map75.size);
+                for (int _i76 = 0; _i76 < _map75.size; ++_i76)
                 {
-                  byte[] _key87;
-                  Map<String,List<Mutation>> _val88;
-                  _key87 = iprot.readBinary();
+                  byte[] _key77;
+                  Map<String,List<Mutation>> _val78;
+                  _key77 = iprot.readBinary();
                   {
-                    TMap _map89 = iprot.readMapBegin();
-                    _val88 = new HashMap<String,List<Mutation>>(2*_map89.size);
-                    for (int _i90 = 0; _i90 < _map89.size; ++_i90)
+                    TMap _map79 = iprot.readMapBegin();
+                    _val78 = new HashMap<String,List<Mutation>>(2*_map79.size);
+                    for (int _i80 = 0; _i80 < _map79.size; ++_i80)
                     {
-                      String _key91;
-                      List<Mutation> _val92;
-                      _key91 = iprot.readString();
+                      String _key81;
+                      List<Mutation> _val82;
+                      _key81 = iprot.readString();
                       {
-                        TList _list93 = iprot.readListBegin();
-                        _val92 = new ArrayList<Mutation>(_list93.size);
-                        for (int _i94 = 0; _i94 < _list93.size; ++_i94)
+                        TList _list83 = iprot.readListBegin();
+                        _val82 = new ArrayList<Mutation>(_list83.size);
+                        for (int _i84 = 0; _i84 < _list83.size; ++_i84)
                         {
-                          Mutation _elem95;
-                          _elem95 = new Mutation();
-                          _elem95.read(iprot);
-                          _val92.add(_elem95);
+                          Mutation _elem85;
+                          _elem85 = new Mutation();
+                          _elem85.read(iprot);
+                          _val82.add(_elem85);
                         }
                         iprot.readListEnd();
                       }
-                      _val88.put(_key91, _val92);
+                      _val78.put(_key81, _val82);
                     }
                     iprot.readMapEnd();
                   }
-                  this.mutation_map.put(_key87, _val88);
+                  this.mutation_map.put(_key77, _val78);
                 }
                 iprot.readMapEnd();
               }
@@ -16812,19 +16917,19 @@ public class Cassandra {
         oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC);
         {
           oprot.writeMapBegin(new TMap(TType.STRING, TType.MAP, this.mutation_map.size()));
-          for (Map.Entry<byte[], Map<String,List<Mutation>>> _iter96 : this.mutation_map.entrySet())
+          for (Map.Entry<byte[], Map<String,List<Mutation>>> _iter86 : this.mutation_map.entrySet())
           {
-            oprot.writeBinary(_iter96.getKey());
+            oprot.writeBinary(_iter86.getKey());
             {
-              oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, _iter96.getValue().size()));
-              for (Map.Entry<String, List<Mutation>> _iter97 : _iter96.getValue().entrySet())
+              oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, _iter86.getValue().size()));
+              for (Map.Entry<String, List<Mutation>> _iter87 : _iter86.getValue().entrySet())
               {
-                oprot.writeString(_iter97.getKey());
+                oprot.writeString(_iter87.getKey());
                 {
-                  oprot.writeListBegin(new TList(TType.STRUCT, _iter97.getValue().size()));
-                  for (Mutation _iter98 : _iter97.getValue())
+                  oprot.writeListBegin(new TList(TType.STRUCT, _iter87.getValue().size()));
+                  for (Mutation _iter88 : _iter87.getValue())
                   {
-                    _iter98.write(oprot);
+                    _iter88.write(oprot);
                   }
                   oprot.writeListEnd();
                 }
@@ -18518,25 +18623,25 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.MAP) {
               {
-                TMap _map99 = iprot.readMapBegin();
-                this.success = new HashMap<String,List<String>>(2*_map99.size);
-                for (int _i100 = 0; _i100 < _map99.size; ++_i100)
+                TMap _map89 = iprot.readMapBegin();
+                this.success = new HashMap<String,List<String>>(2*_map89.size);
+                for (int _i90 = 0; _i90 < _map89.size; ++_i90)
                 {
-                  String _key101;
-                  List<String> _val102;
-                  _key101 = iprot.readString();
+                  String _key91;
+                  List<String> _val92;
+                  _key91 = iprot.readString();
                   {
-                    TList _list103 = iprot.readListBegin();
-                    _val102 = new ArrayList<String>(_list103.size);
-                    for (int _i104 = 0; _i104 < _list103.size; ++_i104)
+                    TList _list93 = iprot.readListBegin();
+                    _val92 = new ArrayList<String>(_list93.size);
+                    for (int _i94 = 0; _i94 < _list93.size; ++_i94)
                     {
-                      String _elem105;
-                      _elem105 = iprot.readString();
-                      _val102.add(_elem105);
+                      String _elem95;
+                      _elem95 = iprot.readString();
+                      _val92.add(_elem95);
                     }
                     iprot.readListEnd();
                   }
-                  this.success.put(_key101, _val102);
+                  this.success.put(_key91, _val92);
                 }
                 iprot.readMapEnd();
               }
@@ -18570,14 +18675,14 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.success.size()));
-          for (Map.Entry<String, List<String>> _iter106 : this.success.entrySet())
+          for (Map.Entry<String, List<String>> _iter96 : this.success.entrySet())
           {
-            oprot.writeString(_iter106.getKey());
+            oprot.writeString(_iter96.getKey());
             {
-              oprot.writeListBegin(new TList(TType.STRING, _iter106.getValue().size()));
-              for (String _iter107 : _iter106.getValue())
+              oprot.writeListBegin(new TList(TType.STRING, _iter96.getValue().size()));
+              for (String _iter97 : _iter96.getValue())
               {
-                oprot.writeString(_iter107);
+                oprot.writeString(_iter97);
               }
               oprot.writeListEnd();
             }
@@ -19069,13 +19174,13 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.SET) {
               {
-                TSet _set108 = iprot.readSetBegin();
-                this.success = new HashSet<String>(2*_set108.size);
-                for (int _i109 = 0; _i109 < _set108.size; ++_i109)
+                TSet _set98 = iprot.readSetBegin();
+                this.success = new HashSet<String>(2*_set98.size);
+                for (int _i99 = 0; _i99 < _set98.size; ++_i99)
                 {
-                  String _elem110;
-                  _elem110 = iprot.readString();
-                  this.success.add(_elem110);
+                  String _elem100;
+                  _elem100 = iprot.readString();
+                  this.success.add(_elem100);
                 }
                 iprot.readSetEnd();
               }
@@ -19101,9 +19206,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeSetBegin(new TSet(TType.STRING, this.success.size()));
-          for (String _iter111 : this.success)
+          for (String _iter101 : this.success)
           {
-            oprot.writeString(_iter111);
+            oprot.writeString(_iter101);
           }
           oprot.writeSetEnd();
         }
@@ -20691,14 +20796,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list112 = iprot.readListBegin();
-                this.success = new ArrayList<TokenRange>(_list112.size);
-                for (int _i113 = 0; _i113 < _list112.size; ++_i113)
+                TList _list102 = iprot.readListBegin();
+                this.success = new ArrayList<TokenRange>(_list102.size);
+                for (int _i103 = 0; _i103 < _list102.size; ++_i103)
                 {
-                  TokenRange _elem114;
-                  _elem114 = new TokenRange();
-                  _elem114.read(iprot);
-                  this.success.add(_elem114);
+                  TokenRange _elem104;
+                  _elem104 = new TokenRange();
+                  _elem104.read(iprot);
+                  this.success.add(_elem104);
                 }
                 iprot.readListEnd();
               }
@@ -20732,9 +20837,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
-          for (TokenRange _iter115 : this.success)
+          for (TokenRange _iter105 : this.success)
           {
-            _iter115.write(oprot);
+            _iter105.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -21878,27 +21983,27 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.MAP) {
               {
-                TMap _map116 = iprot.readMapBegin();
-                this.success = new HashMap<String,Map<String,String>>(2*_map116.size);
-                for (int _i117 = 0; _i117 < _map116.size; ++_i117)
+                TMap _map106 = iprot.readMapBegin();
+                this.success = new HashMap<String,Map<String,String>>(2*_map106.size);
+                for (int _i107 = 0; _i107 < _map106.size; ++_i107)
                 {
-                  String _key118;
-                  Map<String,String> _val119;
-                  _key118 = iprot.readString();
+                  String _key108;
+                  Map<String,String> _val109;
+                  _key108 = iprot.readString();
                   {
-                    TMap _map120 = iprot.readMapBegin();
-                    _val119 = new HashMap<String,String>(2*_map120.size);
-                    for (int _i121 = 0; _i121 < _map120.size; ++_i121)
+                    TMap _map110 = iprot.readMapBegin();
+                    _val109 = new HashMap<String,String>(2*_map110.size);
+                    for (int _i111 = 0; _i111 < _map110.size; ++_i111)
                     {
-                      String _key122;
-                      String _val123;
-                      _key122 = iprot.readString();
-                      _val123 = iprot.readString();
-                      _val119.put(_key122, _val123);
+                      String _key112;
+                      String _val113;
+                      _key112 = iprot.readString();
+                      _val113 = iprot.readString();
+                      _val109.put(_key112, _val113);
                     }
                     iprot.readMapEnd();
                   }
-                  this.success.put(_key118, _val119);
+                  this.success.put(_key108, _val109);
                 }
                 iprot.readMapEnd();
               }
@@ -21932,15 +22037,15 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new TMap(TType.STRING, TType.MAP, this.success.size()));
-          for (Map.Entry<String, Map<String,String>> _iter124 : this.success.entrySet())
+          for (Map.Entry<String, Map<String,String>> _iter114 : this.success.entrySet())
           {
-            oprot.writeString(_iter124.getKey());
+            oprot.writeString(_iter114.getKey());
             {
-              oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter124.getValue().size()));
-              for (Map.Entry<String, String> _iter125 : _iter124.getValue().entrySet())
+              oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter114.getValue().size()));
+              for (Map.Entry<String, String> _iter115 : _iter114.getValue().entrySet())
               {
-                oprot.writeString(_iter125.getKey());
-                oprot.writeString(_iter125.getValue());
+                oprot.writeString(_iter115.getKey());
+                oprot.writeString(_iter115.getValue());
               }
               oprot.writeMapEnd();
             }
@@ -22886,13 +22991,13 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == TType.LIST) {
               {
-                TList _list126 = iprot.readListBegin();
-                this.success = new ArrayList<String>(_list126.size);
-                for (int _i127 = 0; _i127 < _list126.size; ++_i127)
+                TList _list116 = iprot.readListBegin();
+                this.success = new ArrayList<String>(_list116.size);
+                for (int _i117 = 0; _i117 < _list116.size; ++_i117)
                 {
-                  String _elem128;
-                  _elem128 = iprot.readString();
-                  this.success.add(_elem128);
+                  String _elem118;
+                  _elem118 = iprot.readString();
+                  this.success.add(_elem118);
                 }
                 iprot.readListEnd();
               }
@@ -22918,9 +23023,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new TList(TType.STRING, this.success.size()));
-          for (String _iter129 : this.success)
+          for (String _iter119 : this.success)
           {
-            oprot.writeString(_iter129);
+            oprot.writeString(_iter119);
           }
           oprot.writeListEnd();
         }

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=980554&r1=980553&r2=980554&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 Thu Jul 29 19:53:36 2010
@@ -53,24 +53,18 @@ public class KsDef implements TBase<KsDe
   private static final TField STRATEGY_CLASS_FIELD_DESC = new TField("strategy_class", TType.STRING, (short)2);
   private static final TField REPLICATION_FACTOR_FIELD_DESC = new TField("replication_factor", TType.I32, (short)3);
   private static final TField CF_DEFS_FIELD_DESC = new TField("cf_defs", TType.LIST, (short)5);
-  private static final TField USERS_ACCESS_FIELD_DESC = new TField("users_access", TType.MAP, (short)6);
-  private static final TField GROUPS_ACCESS_FIELD_DESC = new TField("groups_access", TType.MAP, (short)7);
 
   public String name;
   public String strategy_class;
   public int replication_factor;
   public List<CfDef> cf_defs;
-  public Map<String,AccessLevel> users_access;
-  public Map<String,AccessLevel> groups_access;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements TFieldIdEnum {
     NAME((short)1, "name"),
     STRATEGY_CLASS((short)2, "strategy_class"),
     REPLICATION_FACTOR((short)3, "replication_factor"),
-    CF_DEFS((short)5, "cf_defs"),
-    USERS_ACCESS((short)6, "users_access"),
-    GROUPS_ACCESS((short)7, "groups_access");
+    CF_DEFS((short)5, "cf_defs");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -93,10 +87,6 @@ public class KsDef implements TBase<KsDe
           return REPLICATION_FACTOR;
         case 5: // CF_DEFS
           return CF_DEFS;
-        case 6: // USERS_ACCESS
-          return USERS_ACCESS;
-        case 7: // GROUPS_ACCESS
-          return GROUPS_ACCESS;
         default:
           return null;
       }
@@ -152,14 +142,6 @@ public class KsDef implements TBase<KsDe
     tmpMap.put(_Fields.CF_DEFS, new FieldMetaData("cf_defs", TFieldRequirementType.REQUIRED, 
         new ListMetaData(TType.LIST, 
             new StructMetaData(TType.STRUCT, CfDef.class))));
-    tmpMap.put(_Fields.USERS_ACCESS, new FieldMetaData("users_access", TFieldRequirementType.OPTIONAL, 
-        new MapMetaData(TType.MAP, 
-            new FieldValueMetaData(TType.STRING), 
-            new EnumMetaData(TType.ENUM, AccessLevel.class))));
-    tmpMap.put(_Fields.GROUPS_ACCESS, new FieldMetaData("groups_access", TFieldRequirementType.OPTIONAL, 
-        new MapMetaData(TType.MAP, 
-            new FieldValueMetaData(TType.STRING), 
-            new EnumMetaData(TType.ENUM, AccessLevel.class))));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     FieldMetaData.addStructMetaDataMap(KsDef.class, metaDataMap);
   }
@@ -201,36 +183,6 @@ public class KsDef implements TBase<KsDe
       }
       this.cf_defs = __this__cf_defs;
     }
-    if (other.isSetUsers_access()) {
-      Map<String,AccessLevel> __this__users_access = new HashMap<String,AccessLevel>();
-      for (Map.Entry<String, AccessLevel> other_element : other.users_access.entrySet()) {
-
-        String other_element_key = other_element.getKey();
-        AccessLevel other_element_value = other_element.getValue();
-
-        String __this__users_access_copy_key = other_element_key;
-
-        AccessLevel __this__users_access_copy_value = other_element_value;
-
-        __this__users_access.put(__this__users_access_copy_key, __this__users_access_copy_value);
-      }
-      this.users_access = __this__users_access;
-    }
-    if (other.isSetGroups_access()) {
-      Map<String,AccessLevel> __this__groups_access = new HashMap<String,AccessLevel>();
-      for (Map.Entry<String, AccessLevel> other_element : other.groups_access.entrySet()) {
-
-        String other_element_key = other_element.getKey();
-        AccessLevel other_element_value = other_element.getValue();
-
-        String __this__groups_access_copy_key = other_element_key;
-
-        AccessLevel __this__groups_access_copy_value = other_element_value;
-
-        __this__groups_access.put(__this__groups_access_copy_key, __this__groups_access_copy_value);
-      }
-      this.groups_access = __this__groups_access;
-    }
   }
 
   public KsDef deepCopy() {
@@ -352,76 +304,6 @@ public class KsDef implements TBase<KsDe
     }
   }
 
-  public int getUsers_accessSize() {
-    return (this.users_access == null) ? 0 : this.users_access.size();
-  }
-
-  public void putToUsers_access(String key, AccessLevel val) {
-    if (this.users_access == null) {
-      this.users_access = new HashMap<String,AccessLevel>();
-    }
-    this.users_access.put(key, val);
-  }
-
-  public Map<String,AccessLevel> getUsers_access() {
-    return this.users_access;
-  }
-
-  public KsDef setUsers_access(Map<String,AccessLevel> users_access) {
-    this.users_access = users_access;
-    return this;
-  }
-
-  public void unsetUsers_access() {
-    this.users_access = null;
-  }
-
-  /** Returns true if field users_access is set (has been asigned a value) and false otherwise */
-  public boolean isSetUsers_access() {
-    return this.users_access != null;
-  }
-
-  public void setUsers_accessIsSet(boolean value) {
-    if (!value) {
-      this.users_access = null;
-    }
-  }
-
-  public int getGroups_accessSize() {
-    return (this.groups_access == null) ? 0 : this.groups_access.size();
-  }
-
-  public void putToGroups_access(String key, AccessLevel val) {
-    if (this.groups_access == null) {
-      this.groups_access = new HashMap<String,AccessLevel>();
-    }
-    this.groups_access.put(key, val);
-  }
-
-  public Map<String,AccessLevel> getGroups_access() {
-    return this.groups_access;
-  }
-
-  public KsDef setGroups_access(Map<String,AccessLevel> groups_access) {
-    this.groups_access = groups_access;
-    return this;
-  }
-
-  public void unsetGroups_access() {
-    this.groups_access = null;
-  }
-
-  /** Returns true if field groups_access is set (has been asigned a value) and false otherwise */
-  public boolean isSetGroups_access() {
-    return this.groups_access != null;
-  }
-
-  public void setGroups_accessIsSet(boolean value) {
-    if (!value) {
-      this.groups_access = null;
-    }
-  }
-
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case NAME:
@@ -456,22 +338,6 @@ public class KsDef implements TBase<KsDe
       }
       break;
 
-    case USERS_ACCESS:
-      if (value == null) {
-        unsetUsers_access();
-      } else {
-        setUsers_access((Map<String,AccessLevel>)value);
-      }
-      break;
-
-    case GROUPS_ACCESS:
-      if (value == null) {
-        unsetGroups_access();
-      } else {
-        setGroups_access((Map<String,AccessLevel>)value);
-      }
-      break;
-
     }
   }
 
@@ -493,12 +359,6 @@ public class KsDef implements TBase<KsDe
     case CF_DEFS:
       return getCf_defs();
 
-    case USERS_ACCESS:
-      return getUsers_access();
-
-    case GROUPS_ACCESS:
-      return getGroups_access();
-
     }
     throw new IllegalStateException();
   }
@@ -518,10 +378,6 @@ public class KsDef implements TBase<KsDe
       return isSetReplication_factor();
     case CF_DEFS:
       return isSetCf_defs();
-    case USERS_ACCESS:
-      return isSetUsers_access();
-    case GROUPS_ACCESS:
-      return isSetGroups_access();
     }
     throw new IllegalStateException();
   }
@@ -579,24 +435,6 @@ public class KsDef implements TBase<KsDe
         return false;
     }
 
-    boolean this_present_users_access = true && this.isSetUsers_access();
-    boolean that_present_users_access = true && that.isSetUsers_access();
-    if (this_present_users_access || that_present_users_access) {
-      if (!(this_present_users_access && that_present_users_access))
-        return false;
-      if (!this.users_access.equals(that.users_access))
-        return false;
-    }
-
-    boolean this_present_groups_access = true && this.isSetGroups_access();
-    boolean that_present_groups_access = true && that.isSetGroups_access();
-    if (this_present_groups_access || that_present_groups_access) {
-      if (!(this_present_groups_access && that_present_groups_access))
-        return false;
-      if (!this.groups_access.equals(that.groups_access))
-        return false;
-    }
-
     return true;
   }
 
@@ -649,24 +487,6 @@ public class KsDef implements TBase<KsDe
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetUsers_access()).compareTo(typedOther.isSetUsers_access());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUsers_access()) {      lastComparison = TBaseHelper.compareTo(this.users_access, typedOther.users_access);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetGroups_access()).compareTo(typedOther.isSetGroups_access());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGroups_access()) {      lastComparison = TBaseHelper.compareTo(this.groups_access, typedOther.groups_access);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
     return 0;
   }
 
@@ -720,44 +540,6 @@ public class KsDef implements TBase<KsDe
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
-        case 6: // USERS_ACCESS
-          if (field.type == TType.MAP) {
-            {
-              TMap _map36 = iprot.readMapBegin();
-              this.users_access = new HashMap<String,AccessLevel>(2*_map36.size);
-              for (int _i37 = 0; _i37 < _map36.size; ++_i37)
-              {
-                String _key38;
-                AccessLevel _val39;
-                _key38 = iprot.readString();
-                _val39 = AccessLevel.findByValue(iprot.readI32());
-                this.users_access.put(_key38, _val39);
-              }
-              iprot.readMapEnd();
-            }
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 7: // GROUPS_ACCESS
-          if (field.type == TType.MAP) {
-            {
-              TMap _map40 = iprot.readMapBegin();
-              this.groups_access = new HashMap<String,AccessLevel>(2*_map40.size);
-              for (int _i41 = 0; _i41 < _map40.size; ++_i41)
-              {
-                String _key42;
-                AccessLevel _val43;
-                _key42 = iprot.readString();
-                _val43 = AccessLevel.findByValue(iprot.readI32());
-                this.groups_access.put(_key42, _val43);
-              }
-              iprot.readMapEnd();
-            }
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
         default:
           TProtocolUtil.skip(iprot, field.type);
       }
@@ -793,44 +575,14 @@ public class KsDef implements TBase<KsDe
       oprot.writeFieldBegin(CF_DEFS_FIELD_DESC);
       {
         oprot.writeListBegin(new TList(TType.STRUCT, this.cf_defs.size()));
-        for (CfDef _iter44 : this.cf_defs)
+        for (CfDef _iter36 : this.cf_defs)
         {
-          _iter44.write(oprot);
+          _iter36.write(oprot);
         }
         oprot.writeListEnd();
       }
       oprot.writeFieldEnd();
     }
-    if (this.users_access != null) {
-      if (isSetUsers_access()) {
-        oprot.writeFieldBegin(USERS_ACCESS_FIELD_DESC);
-        {
-          oprot.writeMapBegin(new TMap(TType.STRING, TType.I32, this.users_access.size()));
-          for (Map.Entry<String, AccessLevel> _iter45 : this.users_access.entrySet())
-          {
-            oprot.writeString(_iter45.getKey());
-            oprot.writeI32(_iter45.getValue().getValue());
-          }
-          oprot.writeMapEnd();
-        }
-        oprot.writeFieldEnd();
-      }
-    }
-    if (this.groups_access != null) {
-      if (isSetGroups_access()) {
-        oprot.writeFieldBegin(GROUPS_ACCESS_FIELD_DESC);
-        {
-          oprot.writeMapBegin(new TMap(TType.STRING, TType.I32, this.groups_access.size()));
-          for (Map.Entry<String, AccessLevel> _iter46 : this.groups_access.entrySet())
-          {
-            oprot.writeString(_iter46.getKey());
-            oprot.writeI32(_iter46.getValue().getValue());
-          }
-          oprot.writeMapEnd();
-        }
-        oprot.writeFieldEnd();
-      }
-    }
     oprot.writeFieldStop();
     oprot.writeStructEnd();
   }
@@ -867,26 +619,6 @@ public class KsDef implements TBase<KsDe
       sb.append(this.cf_defs);
     }
     first = false;
-    if (isSetUsers_access()) {
-      if (!first) sb.append(", ");
-      sb.append("users_access:");
-      if (this.users_access == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.users_access);
-      }
-      first = false;
-    }
-    if (isSetGroups_access()) {
-      if (!first) sb.append(", ");
-      sb.append("groups_access:");
-      if (this.groups_access == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.groups_access);
-      }
-      first = false;
-    }
     sb.append(")");
     return sb.toString();
   }

Modified: cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java Thu Jul 29 19:53:36 2010
@@ -20,31 +20,25 @@ package org.apache.cassandra.auth;
  * 
  */
 
-import java.util.Map;
 
 import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.thrift.AccessLevel;
 import org.apache.cassandra.thrift.AuthenticationException;
+import org.apache.cassandra.thrift.AuthenticationRequest;
 import org.apache.cassandra.thrift.AuthorizationException;
 
 public class AllowAllAuthenticator implements IAuthenticator
 {
-    private final static AuthenticatedUser USER = new AuthenticatedUser("allow_all", true);
-
-    @Override
-    public AuthenticatedUser defaultUser()
-    {
-        return USER;
-    }
-
     @Override
-    public AuthenticatedUser login(Map<String,String> credentials) throws AuthenticationException, AuthorizationException
+    public AccessLevel login(String keyspace, AuthenticationRequest authRequest) throws AuthenticationException, AuthorizationException
     {
-        return USER;
+        // do nothing, allow anything
+        return AccessLevel.FULL;
     }
     
-    @Override    
+   @Override    
     public void validateConfiguration() throws ConfigurationException
-    {
+   {
         // do nothing, no configuration to validate
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java Thu Jul 29 19:53:36 2010
@@ -20,20 +20,16 @@ package org.apache.cassandra.auth;
  * 
  */
 
-import java.util.Map;
 
 import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.thrift.AccessLevel;
 import org.apache.cassandra.thrift.AuthenticationException;
+import org.apache.cassandra.thrift.AuthenticationRequest;
 import org.apache.cassandra.thrift.AuthorizationException;
 
 public interface IAuthenticator
 {
-    /**
-     * @return The user that a connection is initialized with, or 'null' if a user must call login().
-     */
-    public AuthenticatedUser defaultUser();
-
-    public AuthenticatedUser login(Map<String,String> credentials) throws AuthenticationException, AuthorizationException;
+    public AccessLevel login(String keyspace, AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException;
 
     public void validateConfiguration() throws ConfigurationException;
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java Thu Jul 29 19:53:36 2010
@@ -25,17 +25,17 @@ import java.io.*;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Properties;
-import java.util.Map;
-import java.util.HashMap;
 
-import org.apache.cassandra.avro.AccessLevel;
 import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.thrift.AccessLevel;
 import org.apache.cassandra.thrift.AuthenticationException;
+import org.apache.cassandra.thrift.AuthenticationRequest;
 import org.apache.cassandra.thrift.AuthorizationException;
 
 public class SimpleAuthenticator implements IAuthenticator
 {
     public final static String PASSWD_FILENAME_PROPERTY        = "passwd.properties";
+    public final static String ACCESS_FILENAME_PROPERTY        = "access.properties";
     public final static String PMODE_PROPERTY                  = "passwd.mode";
     public static final String USERNAME_KEY                    = "username";
     public static final String PASSWORD_KEY                    = "password";
@@ -46,14 +46,7 @@ public class SimpleAuthenticator impleme
     };
 
     @Override
-    public AuthenticatedUser defaultUser()
-    {
-        // users must log in
-        return null;
-    }
-
-    @Override
-    public AuthenticatedUser login(Map<String,String> credentials) throws AuthenticationException, AuthorizationException
+    public AccessLevel login(String keyspace, AuthenticationRequest authRequest) throws AuthenticationException, AuthorizationException
     {
         String pmode_plain = System.getProperty(PMODE_PROPERTY);
         PasswordMode mode = PasswordMode.PLAIN;
@@ -78,10 +71,10 @@ public class SimpleAuthenticator impleme
 
         String pfilename = System.getProperty(PASSWD_FILENAME_PROPERTY);
 
-        String username = credentials.get(USERNAME_KEY);
+        String username = authRequest.getCredentials().get(USERNAME_KEY);
         if (null == username) throw new AuthenticationException("Authentication request was missing the required key '" + USERNAME_KEY + "'");
 
-        String password = credentials.get(PASSWORD_KEY);
+        String password = authRequest.getCredentials().get(PASSWORD_KEY);
         if (null == password) throw new AuthenticationException("Authentication request was missing the required key '" + PASSWORD_KEY + "'");
 
         boolean authenticated = false;
@@ -103,13 +96,15 @@ public class SimpleAuthenticator impleme
                 case MD5:
                     authenticated = MessageDigest.isEqual(password.getBytes(), MessageDigest.getInstance("MD5").digest(props.getProperty(username).getBytes()));
                     break;
-                default:
-                    throw new RuntimeException("Unknown PasswordMode " + mode);
             }
         }
         catch (NoSuchAlgorithmException e)
         {
-            throw new RuntimeException("You requested MD5 checking but the MD5 digest algorithm is not available: " + e.getMessage());
+            throw new AuthenticationException("You requested MD5 checking but the MD5 digest algorithm is not available: " + e.getMessage());
+        }
+        catch (FileNotFoundException e)
+        {
+            throw new RuntimeException("Authentication table file given by property " + PASSWD_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
         }
         catch (IOException e)
         {
@@ -122,52 +117,61 @@ public class SimpleAuthenticator impleme
 
         if (!authenticated) throw new AuthenticationException(authenticationErrorMessage(mode, username));
 
-        // TODO: Should allow/require a user to configure a 'super' username.
-        return new AuthenticatedUser(username, false);
+        // if we're here, the authentication succeeded. Now let's see if the user is authorized for this keyspace.
+
+        String afilename = System.getProperty(ACCESS_FILENAME_PROPERTY);
+        AccessLevel authorized = AccessLevel.NONE;
+        try
+        {
+            FileInputStream in = new FileInputStream(afilename);
+            Properties props = new Properties();
+            props.load(in);
+            in.close();
+
+            // structure:
+            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
+            // X = A B C
+            
+            // note we keep the message here and for other authorization problems exactly the same to prevent attackers
+            // from guessing what keyspaces are valid
+            if (null == props.getProperty(keyspace))
+                throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
+
+            for (String allow : props.getProperty(keyspace).split(","))
+            {
+                if (allow.equals(username)) authorized = AccessLevel.FULL;
+            }
+        }
+        catch (FileNotFoundException e)
+        {
+            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
+        }
+
+        if (authorized == AccessLevel.NONE) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
+        
+        return authorized;
     }
 
-    @Override
+   @Override
     public void validateConfiguration() throws ConfigurationException 
     {
+        String aFileName = System.getProperty(SimpleAuthenticator.ACCESS_FILENAME_PROPERTY);
         String pfilename = System.getProperty(SimpleAuthenticator.PASSWD_FILENAME_PROPERTY);
-        if (pfilename == null)
+        if (aFileName == null || pfilename == null)
         {
             throw new ConfigurationException("When using " + this.getClass().getCanonicalName() + " " + 
+                    SimpleAuthenticator.ACCESS_FILENAME_PROPERTY + " and " + 
                     SimpleAuthenticator.PASSWD_FILENAME_PROPERTY + " properties must be defined.");	
         }
     }
 
-    /**
-     * Loads the user access map for each keyspace from the deprecated access.properties file.
-     */
-    @Deprecated
-    public Map<String,Map<String,AccessLevel>> loadAccessFile() throws ConfigurationException 
+    static String authorizationErrorMessage(String keyspace, String username)
     {
-        Map<String,Map<String,AccessLevel>> keyspacesAccess = new HashMap();
-        final String accessFilenameProperty = "access.properties";
-        String afilename = System.getProperty(accessFilenameProperty);
-        Properties props = new Properties();
-        try
-        {
-            FileInputStream in = new FileInputStream(afilename);
-            props.load(in);
-            in.close();
-        }
-        catch (Exception e)
-        {
-            throw new ConfigurationException("Authorization table file given by property " + accessFilenameProperty + " could not be loaded: " + e.getMessage());
-        }
-        for (String keyspace : props.stringPropertyNames())
-        {
-            // structure:
-            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
-            // X = A B C
-            Map<String,AccessLevel> usersAccess = new HashMap();
-            for (String user : props.getProperty(keyspace).split(","))
-                usersAccess.put(user, AccessLevel.FULL);
-            keyspacesAccess.put(keyspace, usersAccess);
-        }
-        return keyspacesAccess;
+        return String.format("User %s could not be authorized to use keyspace %s", username, keyspace);
     }
 
     static String authenticationErrorMessage(PasswordMode mode, String username)

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=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Thu Jul 29 19:53:36 2010
@@ -56,7 +56,6 @@ import org.apache.cassandra.db.marshal.M
 import org.apache.cassandra.db.migration.AddKeyspace;
 import org.apache.cassandra.locator.AbstractReplicationStrategy;
 import org.apache.cassandra.scheduler.IRequestScheduler;
-import org.apache.cassandra.service.ClientState;
 import org.apache.cassandra.service.StorageProxy;
 import org.apache.cassandra.service.StorageService;
 
@@ -76,8 +75,22 @@ public class CassandraServer implements 
     private final static String D_CF_COMPTYPE = "BytesType";
     private final static String D_CF_SUBCOMPTYPE = "";
     
-    // thread local state containing session information
-    private final ClientState clientState = new ClientState();
+    private ThreadLocal<AccessLevel> loginDone = new ThreadLocal<AccessLevel>()
+    {
+        @Override
+        protected AccessLevel initialValue()
+        {
+            return AccessLevel.NONE;
+        }
+    };
+    
+    // Session keyspace.
+    private ThreadLocal<String> curKeyspace = new ThreadLocal<String>();
+
+    /*
+     * An associated Id for scheduling the requests
+     */
+    private ThreadLocal<String> requestSchedulerId = new ThreadLocal<String>();
 
     /*
      * RequestScheduler to perform the scheduling of incoming requests
@@ -95,7 +108,7 @@ public class CassandraServer implements 
         if (logger.isDebugEnabled())
             logger.debug("get");
 
-        AvroValidation.validateColumnPath(clientState.getKeyspace(), columnPath);
+        AvroValidation.validateColumnPath(curKeyspace.get(), columnPath);
         
         // FIXME: This is repetitive.
         byte[] column, super_column;
@@ -105,7 +118,7 @@ public class CassandraServer implements 
         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(clientState.getKeyspace(), key.array(), path, nameAsList);
+        ReadCommand command = new SliceByNamesReadCommand(curKeyspace.get(), key.array(), path, nameAsList);
         
         Map<DecoratedKey<?>, ColumnFamily> cfamilies = readColumnFamily(Arrays.asList(command), consistencyLevel);
         ColumnFamily cf = cfamilies.get(StorageService.getPartitioner().decorateKey(command.key));
@@ -276,7 +289,7 @@ public class CassandraServer implements 
         GenericArray<ByteBuffer> keys = new GenericData.Array<ByteBuffer>(1, bytesArray);
         keys.add(key);
         
-        return multigetSliceInternal(clientState.getKeyspace(), keys, columnParent, predicate, consistencyLevel).iterator().next().columns;
+        return multigetSliceInternal(curKeyspace.get(), keys, columnParent, predicate, consistencyLevel).iterator().next().columns;
     }
     
     private GenericArray<CoscsMapEntry> multigetSliceInternal(String keyspace, GenericArray<ByteBuffer> keys,
@@ -353,7 +366,7 @@ public class CassandraServer implements 
         if (logger.isDebugEnabled())
             logger.debug("multiget_slice");
         
-        return multigetSliceInternal(clientState.getKeyspace(), keys, columnParent, predicate, consistencyLevel);
+        return multigetSliceInternal(curKeyspace.get(), keys, columnParent, predicate, consistencyLevel);
     }
 
     @Override
@@ -364,10 +377,10 @@ public class CassandraServer implements 
             logger.debug("insert");
 
         AvroValidation.validateKey(key.array());
-        AvroValidation.validateColumnParent(clientState.getKeyspace(), parent);
-        AvroValidation.validateColumn(clientState.getKeyspace(), parent, column);
+        AvroValidation.validateColumnParent(curKeyspace.get(), parent);
+        AvroValidation.validateColumn(curKeyspace.get(), parent, column);
 
-        RowMutation rm = new RowMutation(clientState.getKeyspace(), key.array());
+        RowMutation rm = new RowMutation(curKeyspace.get(), key.array());
         try
         {
             rm.add(new QueryPath(parent.column_family.toString(),
@@ -394,10 +407,10 @@ public class CassandraServer implements 
             logger.debug("remove");
         
         AvroValidation.validateKey(key.array());
-        AvroValidation.validateColumnPath(clientState.getKeyspace(), columnPath);
+        AvroValidation.validateColumnPath(curKeyspace.get(), columnPath);
         IClock dbClock = AvroValidation.validateClock(clock);
         
-        RowMutation rm = new RowMutation(clientState.getKeyspace(), key.array());
+        RowMutation rm = new RowMutation(curKeyspace.get(), key.array());
         byte[] superName = columnPath.super_column == null ? null : columnPath.super_column.array();
         rm.delete(new QueryPath(columnPath.column_family.toString(), superName), dbClock);
         
@@ -461,9 +474,9 @@ public class CassandraServer implements 
                 String cfName = cfMutations.getKey().toString();
                 
                 for (Mutation mutation : cfMutations.getValue())
-                    AvroValidation.validateMutation(clientState.getKeyspace(), cfName, mutation);
+                    AvroValidation.validateMutation(curKeyspace.get(), cfName, mutation);
             }
-            rowMutations.add(getRowMutationFromMutations(clientState.getKeyspace(), pair.key.array(), cfToMutations));
+            rowMutations.add(getRowMutationFromMutations(curKeyspace.get(), pair.key.array(), cfToMutations));
         }
         
         if (consistencyLevel == ConsistencyLevel.ZERO)
@@ -508,16 +521,6 @@ public class CassandraServer implements 
         return new org.apache.cassandra.db.TimestampClock(clock.timestamp);
     }
     
-    private static Map<String,AccessLevel> unavronateAccessMap(Map<Utf8,AccessLevel> map)
-    {
-        Map<String,AccessLevel> out = new HashMap<String,AccessLevel>();
-        if (map == null)
-            return out;
-        for (Map.Entry<Utf8, AccessLevel> entry : map.entrySet())
-            out.put(entry.getKey().toString(), entry.getValue());
-        return out;
-    }
-
     // 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<Utf8, GenericArray<Mutation>> cfMap)
     {
@@ -598,7 +601,16 @@ public class CassandraServer implements 
             throw newInvalidRequestException("Keyspace does not exist");
         }
         
-        clientState.setKeyspace(keyspaceStr);
+        // If switching, invalidate previous access level; force a new login.
+        if (this.curKeyspace.get() != null && !this.curKeyspace.get().equals(keyspaceStr))
+            loginDone.set(AccessLevel.NONE);
+        
+        this.curKeyspace.set(keyspaceStr);
+
+        if (DatabaseDescriptor.getRequestSchedulerId().equals(Config.RequestSchedulerId.keyspace)) {
+            requestSchedulerId.set(curKeyspace.get());
+        }
+
         return null;
     }
 
@@ -654,8 +666,6 @@ public class CassandraServer implements 
                     ksDef.name.toString(),
                     (Class<? extends AbstractReplicationStrategy>)Class.forName(ksDef.strategy_class.toString()),
                     (int)ksDef.replication_factor,
-                    unavronateAccessMap(ksDef.users_access),
-                    unavronateAccessMap(ksDef.groups_access),
                     cfDefs.toArray(new CFMetaData[cfDefs.size()]));
             AddKeyspace add = new AddKeyspace(ksmeta);
             add.apply();
@@ -720,7 +730,7 @@ public class CassandraServer implements 
      */
     private void schedule()
     {
-        requestScheduler.queue(Thread.currentThread(), clientState.getSchedulingId());
+        requestScheduler.queue(Thread.currentThread(), requestSchedulerId.get());
     }
 
     /**

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Thu Jul 29 19:53:36 2010
@@ -32,9 +32,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.auth.AllowAllAuthenticator;
-import org.apache.cassandra.auth.SimpleAuthenticator;
 import org.apache.cassandra.auth.IAuthenticator;
-import org.apache.cassandra.avro.AccessLevel;
 import org.apache.cassandra.config.Config.RequestSchedulerId;
 import org.apache.cassandra.db.ClockType;
 import org.apache.cassandra.db.ColumnFamilyType;
@@ -345,16 +343,11 @@ public class DatabaseDescriptor
                 CommitLog.setSegmentSize(conf.commitlog_rotation_threshold_in_mb * 1024 * 1024);
 
             // Hardcoded system tables
-            KSMetaData systemMeta = new KSMetaData(Table.SYSTEM_TABLE,
-                                                   LocalStrategy.class,
-                                                   1,
-                                                   null,
-                                                   null,
-                                                   new CFMetaData[]{CFMetaData.StatusCf,
-                                                                    CFMetaData.HintsCf,
-                                                                    CFMetaData.MigrationsCf,
-                                                                    CFMetaData.SchemaCf,
-                                                                    CFMetaData.StatisticsCf
+            KSMetaData systemMeta = new KSMetaData(Table.SYSTEM_TABLE, LocalStrategy.class, 1, new CFMetaData[]{CFMetaData.StatusCf,
+                                                                                                  CFMetaData.HintsCf,
+                                                                                                  CFMetaData.MigrationsCf,
+                                                                                                  CFMetaData.SchemaCf,
+                                                                                                  CFMetaData.StatisticsCf
             });
             CFMetaData.map(CFMetaData.StatusCf);
             CFMetaData.map(CFMetaData.HintsCf);
@@ -511,18 +504,11 @@ public class DatabaseDescriptor
         CFMetaData.fixMaxId();
     }
 
-    /**
-     * Reads keyspaces from yaml: doesn't populate any internal structures.
-     * @Deprecated
-     */
+    /** reads xml. doesn't populate any internal structures. */
     public static Collection<KSMetaData> readTablesFromYaml() throws ConfigurationException
     {
         List<KSMetaData> defs = new ArrayList<KSMetaData>();
         
-        /* If SimpleAuthenticator is in use, load the (deprecated) access.properties file, to apply it to keyspaces. */
-        Map<String,Map<String,AccessLevel>> keyspacesAccess = new HashMap();
-        if (DatabaseDescriptor.getAuthenticator() instanceof SimpleAuthenticator)
-            keyspacesAccess = ((SimpleAuthenticator)DatabaseDescriptor.getAuthenticator()).loadAccessFile();
         
         /* Read the table related stuff from config */
         for (RawKeyspace keyspace : conf.keyspaces)
@@ -631,12 +617,8 @@ public class DatabaseDescriptor
                                              cf.gc_grace_seconds,
                                              metadata);
             }
-            defs.add(new KSMetaData(keyspace.name,
-                                    strategyClass,
-                                    keyspace.replication_factor,
-                                    keyspacesAccess.get(keyspace.name),
-                                    null,
-                                    cfDefs));
+            defs.add(new KSMetaData(keyspace.name, strategyClass, keyspace.replication_factor, cfDefs));
+            
         }
 
         return defs;

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Thu Jul 29 19:53:36 2010
@@ -32,18 +32,14 @@ import java.util.Map;
 import org.apache.avro.util.Utf8;
 import org.apache.commons.lang.ObjectUtils;
 
-import org.apache.cassandra.avro.AccessLevel;
-
 public final class KSMetaData
 {
     public final String name;
     public final Class<? extends AbstractReplicationStrategy> strategyClass;
     public final int replicationFactor;
-    public final Map<String, CFMetaData> cfMetaData;
-    public final Map<String, AccessLevel> usersAccess;
-    public final Map<String, AccessLevel> groupsAccess;
+    private final Map<String, CFMetaData> cfMetaData;
 
-    public KSMetaData(String name, Class<? extends AbstractReplicationStrategy> strategyClass, int replicationFactor, Map<String,AccessLevel> usersAccess, Map<String,AccessLevel> groupsAccess, CFMetaData... cfDefs)
+    public KSMetaData(String name, Class<? extends AbstractReplicationStrategy> strategyClass, int replicationFactor, CFMetaData... cfDefs)
     {
         this.name = name;
         this.strategyClass = strategyClass == null ? RackUnawareStrategy.class : strategyClass;
@@ -52,46 +48,8 @@ public final class KSMetaData
         for (CFMetaData cfm : cfDefs)
             cfmap.put(cfm.cfName, cfm);
         this.cfMetaData = Collections.unmodifiableMap(cfmap);
-        this.usersAccess = usersAccess == null ?
-            Collections.<String, AccessLevel>emptyMap() : Collections.unmodifiableMap(usersAccess);
-        this.groupsAccess = groupsAccess == null ?
-            Collections.<String, AccessLevel>emptyMap() : Collections.unmodifiableMap(groupsAccess);
-    }
-
-    /**
-     * Copies this KSMetaData, adding an additional ColumnFamily.
-     */
-    public KSMetaData withColumnFamily(CFMetaData cfm)
-    {
-        List<CFMetaData> newCfs = new ArrayList<CFMetaData>(cfMetaData().values());
-        newCfs.add(cfm);
-        return new KSMetaData(name, strategyClass, replicationFactor, usersAccess, groupsAccess, newCfs.toArray(new CFMetaData[newCfs.size()]));
-    }
-
-    /**
-     * Copies this KSMetaData, removing the ColumnFamily with the given name (which must exist).
-     */
-    public KSMetaData withoutColumnFamily(String cfName)
-    {
-        CFMetaData cfm = cfMetaData().get(cfName);
-        List<CFMetaData> newCfs = new ArrayList<CFMetaData>(cfMetaData().values());
-        newCfs.remove(cfm);
-        assert newCfs.size() == cfMetaData().size() - 1;
-        return new KSMetaData(name, strategyClass, replicationFactor, usersAccess, groupsAccess, newCfs.toArray(new CFMetaData[newCfs.size()]));
-    }
-
-    /**
-     * Copies this KSMetaData, returning a renamed copy.
-     */
-    public KSMetaData withName(String ksName)
-    {
-        // cfs will need to have their tablenames reset, but their ids will not change
-        List<CFMetaData> newCfs = new ArrayList<CFMetaData>(cfMetaData().size());
-        for (CFMetaData oldCf : cfMetaData().values())
-            newCfs.add(CFMetaData.renameTable(oldCf, ksName));
-        return new KSMetaData(ksName, strategyClass, replicationFactor, usersAccess, groupsAccess, newCfs.toArray(new CFMetaData[newCfs.size()]));
     }
-
+    
     public boolean equals(Object obj)
     {
         if (obj == null)
@@ -110,15 +68,13 @@ public final class KSMetaData
     {
         return cfMetaData;
     }
-
+        
     public org.apache.cassandra.avro.KsDef deflate()
     {
         org.apache.cassandra.avro.KsDef ks = new org.apache.cassandra.avro.KsDef();
         ks.name = new Utf8(name);
         ks.strategy_class = new Utf8(strategyClass.getName());
         ks.replication_factor = replicationFactor;
-        ks.users_access = SerDeUtils.toAvroMap(usersAccess);
-        ks.groups_access = SerDeUtils.toAvroMap(groupsAccess);
         ks.cf_defs = SerDeUtils.createArray(cfMetaData.size(), org.apache.cassandra.avro.CfDef.SCHEMA$);
         for (CFMetaData cfm : cfMetaData.values())
             ks.cf_defs.add(cfm.deflate());
@@ -136,14 +92,12 @@ public final class KSMetaData
         {
             throw new ConfigurationException("Could not create ReplicationStrategy of type " + ks.strategy_class, ex);
         }
-        Map<String,AccessLevel> usersAccess = SerDeUtils.fromAvroMap(ks.users_access);
-        Map<String,AccessLevel> groupsAccess = SerDeUtils.fromAvroMap(ks.groups_access);
         int cfsz = (int)ks.cf_defs.size();
         CFMetaData[] cfMetaData = new CFMetaData[cfsz];
         Iterator<org.apache.cassandra.avro.CfDef> cfiter = ks.cf_defs.iterator();
         for (int i = 0; i < cfsz; i++)
             cfMetaData[i] = CFMetaData.inflate(cfiter.next());
 
-        return new KSMetaData(ks.name.toString(), repStratClass, ks.replication_factor, usersAccess, groupsAccess, cfMetaData);
+        return new KSMetaData(ks.name.toString(), repStratClass, ks.replication_factor, cfMetaData);
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java Thu Jul 29 19:53:36 2010
@@ -73,16 +73,23 @@ public class AddColumnFamily extends Mig
             throw new ConfigurationException("CF is already defined in that keyspace.");
         
         // clone ksm but include the new cf def.
-        KSMetaData newKsm = ksm.withColumnFamily(cfm);
+        KSMetaData newKsm = makeNewKeyspaceDefinition(ksm);
         
         rm = Migration.makeDefinitionMutation(newKsm, null, newVersion);
     }
     
+    private KSMetaData makeNewKeyspaceDefinition(KSMetaData ksm)
+    {
+        List<CFMetaData> newCfs = new ArrayList<CFMetaData>(ksm.cfMetaData().values());
+        newCfs.add(cfm);
+        return new KSMetaData(ksm.name, ksm.strategyClass, ksm.replicationFactor, newCfs.toArray(new CFMetaData[newCfs.size()]));
+    }
+    
     public void applyModels() throws IOException
     {
         // reinitialize the table.
         KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName);
-        ksm = ksm.withColumnFamily(cfm);
+        ksm = makeNewKeyspaceDefinition(ksm);
         try
         {
             CFMetaData.map(cfm);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java?rev=980554&r1=980553&r2=980554&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java Thu Jul 29 19:53:36 2010
@@ -70,10 +70,20 @@ public class DropColumnFamily extends Mi
         else if (!ksm.cfMetaData().containsKey(cfName))
             throw new ConfigurationException("CF is not defined in that keyspace.");
         
-        KSMetaData newKsm = ksm.withoutColumnFamily(cfName);
+        KSMetaData newKsm = makeNewKeyspaceDefinition(ksm);
         rm = Migration.makeDefinitionMutation(newKsm, null, newVersion);
     }
 
+    private KSMetaData makeNewKeyspaceDefinition(KSMetaData ksm)
+    {
+        // clone ksm but do not include the new def
+        CFMetaData cfm = ksm.cfMetaData().get(cfName);
+        List<CFMetaData> newCfs = new ArrayList<CFMetaData>(ksm.cfMetaData().values());
+        newCfs.remove(cfm);
+        assert newCfs.size() == ksm.cfMetaData().size() - 1;
+        return new KSMetaData(ksm.name, ksm.strategyClass, ksm.replicationFactor, newCfs.toArray(new CFMetaData[newCfs.size()]));
+    }
+
     @Override
     public void beforeApplyModels()
     {
@@ -95,7 +105,7 @@ public class DropColumnFamily extends Mi
         // reinitialize the table.
         KSMetaData existing = DatabaseDescriptor.getTableDefinition(tableName);
         CFMetaData cfm = existing.cfMetaData().get(cfName);
-        KSMetaData ksm = existing.withoutColumnFamily(cfName);
+        KSMetaData ksm = makeNewKeyspaceDefinition(existing);
         CFMetaData.purge(cfm);
         DatabaseDescriptor.setTableDefinition(ksm, newVersion);
         



Mime
View raw message