Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.ColumnDef$ColumnDefStandardSchemeFactory


        // we'll be adding this one later. make sure it's not already there.
        assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) == null;
        CfDef cfDef = cfm.toThrift();
       
        // add one.
        ColumnDef addIndexDef = new ColumnDef();
        addIndexDef.index_name = "5";
        addIndexDef.index_type = IndexType.KEYS;
        addIndexDef.name = ByteBuffer.wrap(new byte[] { 5 });
        addIndexDef.validation_class = BytesType.class.getName();
        cfDef.column_metadata.add(addIndexDef);
       
        // remove one.
        ColumnDef removeIndexDef = new ColumnDef();
        removeIndexDef.index_name = "0";
        removeIndexDef.index_type = IndexType.KEYS;
        removeIndexDef.name = ByteBuffer.wrap(new byte[] { 0 });
        removeIndexDef.validation_class = BytesType.class.getName();
        assert cfDef.column_metadata.remove(removeIndexDef);
View Full Code Here


        }
    }

    public ColumnDef toThrift()
    {
        ColumnDef cd = new ColumnDef();

        cd.setName(ByteBufferUtil.clone(name));
        cd.setValidation_class(validator.toString());

        cd.setIndex_type(index_type == null
                            ? null
                            : IndexType.valueOf(index_type.name()));
        cd.setIndex_name(index_name == null ? null : index_name);
        cd.setIndex_options(index_options == null ? null : Maps.newHashMap(index_options));

        return cd;
    }
View Full Code Here

            // column name format <cf>:<column name>:<attribute name>
            String[] components = columns.getComparator().getString(column.name()).split(":");
            assert components.length == 3;

            ColumnDef columnDef = contenders.get(components[1]);

            if (columnDef == null)
            {
                columnDef = new ColumnDef();
                contenders.put(components[1], columnDef);
            }

            ColumnDef._Fields field = ColumnDef._Fields.findByName(components[2]);
            columnDef.setFieldValue(field, deserializeValue(column.value(), getValueClass(ColumnDef.class, field.getFieldName())));
        }

        List<ColumnDef> columnDefs = new ArrayList<ColumnDef>();

        for (ColumnDef columnDef : contenders.values())
        {
            if (columnDef.isSetName() && columnDef.isSetValidation_class())
                columnDefs.add(columnDef);
        }

        return columnDefs;
    }
View Full Code Here

                    {
                        case KEY_ALIAS:
                        case COLUMN_ALIAS:
                            throw new InvalidRequestException(String.format("Cannot drop PRIMARY KEY part %s", columnName));
                        case COLUMN_METADATA:
                            ColumnDef toDelete = null;
                            for (ColumnDef columnDef : thriftDef.column_metadata)
                            {
                                if (columnDef.name.equals(columnName.key))
                                    toDelete = columnDef;
                            }
View Full Code Here

        thriftCfDef.default_validation_class = cfDef.default_validation_class;
        thriftCfDef.comment = cfDef.comment;
        thriftCfDef.column_metadata = new ArrayList<ColumnDef>();
        for (ColumnDef columnDef : columnDefs)
        {
            ColumnDef c = new ColumnDef();
            c.name = ByteBufferUtil.clone(columnDef.name);
            c.validation_class = columnDef.getValidation_class();
            c.index_name = columnDef.getIndex_name();
            c.index_type = IndexType.KEYS;
            thriftCfDef.column_metadata.add(c);
View Full Code Here

        return result;
    }

    public ColumnDef toThrift()
    {
        ColumnDef cd = new ColumnDef();

        cd.setName(ByteBufferUtil.clone(name));
        cd.setValidation_class(validator.toString());

        cd.setIndex_type(index_type == null
                            ? null
                            : IndexType.valueOf(index_type.name()));
        cd.setIndex_name(index_name == null ? null : index_name);
        cd.setIndex_options(index_options == null ? null : Maps.newHashMap(index_options));

        return cd;
    }
View Full Code Here

        return result;
    }

    public ColumnDef toThrift()
    {
        ColumnDef cd = new ColumnDef();

        cd.setName(ByteBufferUtil.clone(name));
        cd.setValidation_class(validator.toString());

        cd.setIndex_type(index_type == null
                            ? null
                            : IndexType.valueOf(index_type.name()));
        cd.setIndex_name(index_name == null ? null : index_name);
        cd.setIndex_options(index_options == null ? null : Maps.newHashMap(index_options));

        return cd;
    }
View Full Code Here

            Tuple tuple = TupleFactory.getInstance().newTuple(cfDef.column_metadata.size());
            Iterator<ColumnDef> itera = cfDef.column_metadata.iterator();
            int i = 0;
            while (itera.hasNext())
            {
                ColumnDef cdef = itera.next();
                ByteBuffer columnValue = row.getBytesUnsafe(ByteBufferUtil.string(cdef.name.duplicate()));
                if (columnValue != null)
                {
                    Cell cell = new BufferCell(CellNames.simpleDense(cdef.name), columnValue);
                    AbstractType<?> validator = getValidatorMap(cfDef).get(cdef.name);
View Full Code Here

    }
    return l;
  }

  private ColumnDef toThrift() {
    ColumnDef d = new ColumnDef();
    d.setIndex_name(indexName);
    d.setIndex_type(indexTypeToThrift(indexType));
    d.setName(name);
    d.setValidation_class(validationClass);
    return d;
  }
View Full Code Here

        return thriftDefs;
    }

    public ColumnDef toThrift()
    {
        ColumnDef cd = new ColumnDef();

        cd.setName(ByteBufferUtil.clone(name));
        cd.setValidation_class(validator.toString());
        cd.setIndex_type(indexType == null ? null : IndexType.valueOf(indexType.name()));
        cd.setIndex_name(indexName == null ? null : indexName);
        cd.setIndex_options(indexOptions == null ? null : Maps.newHashMap(indexOptions));

        return cd;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.ColumnDef$ColumnDefStandardSchemeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.