Create static colums definition

11 views
Skip to first unread message

kat

unread,
Sep 27, 2012, 4:09:25 AM9/27/12
to hector...@googlegroups.com
Hello,
My goal is to create a column family with static column definition.When I define columns in CLI everything is fine, but when I'm trying to use Hector for that purpose I get an exception. More details below.

My ColumnDefinition implementation:

public class MetaColumnDefinition implements ColumnDefinition {
   
    private ByteBuffer name;
    private String validationClass;
    private ColumnIndexType indexType;
    private String indexName;
     
    @Override
    public ByteBuffer getName() {
      return name;
    }
   
    @Override
    public String getValidationClass() {
      return validationClass;
    }
   
    @Override
    public ColumnIndexType getIndexType() {
      return indexType;
    }
   
    @Override
    public String getIndexName() {
      return indexName;
    }
   
    public void setName(ByteBuffer name) {
      this.name = name;
    }
   
    public void setValidationClass(String validationClass) {
      this.validationClass = validationClass;
    }
   
    public void setIndexType(ColumnIndexType indexType) {
      this.indexType = indexType;
    }
   
    public void setIndexName(String indexName) {
      this.indexName = indexName;
    }
}


Creating ColumnDefinition:
MetaColumnDefinition def = new MetaColumnDefinition();
def.setName("Name");
def.setValidationClass("org.apache.cassandra.db.marshal.UTF8Type");

I alredy have an ColumnFamilyDefinition columnFamilyDef created and I'm calling addColumnDefinition method.
columnFamilyDef.addColumnDefinition(def);

And I'm getting exception:
java.lang.UnsupportedOperationException
    at java.util.AbstractList.add(Unknown Source)
    at java.util.AbstractList.add(Unknown Source)
    at me.prettyprint.cassandra.service.ThriftCfDef.addColumnDefinition(ThriftCfDef.java:359)

I think my ColumnFamilyDefinition is ok if I can create column definition by CLI and insert data there. But I have no idea what my problem is in here..
Reply all
Reply to author
Forward
0 new messages