Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.CounterColumn$CounterColumnStandardSchemeFactory


        ByteBuffer name = colser.toByteBuffer(colName);
        try
        {
            if (isCounter)
            {
                new Counter(client, wConsistecy, cfName).add(rKey, Lists.newArrayList(new CounterColumn(name, (Long) value)));
            }
            else
            {
                ByteBuffer val = valser.toByteBuffer(value);
                new Writer(client, wConsistecy, cfName).insert(rKey, name, val);
View Full Code Here


                Counter counter = new Counter(client, wConsistecy, cfName);
                List<CounterColumn> columns = Lists.newArrayList();
                for (Map.Entry<?, ?> entity : nv.entrySet())
                {
                    ByteBuffer name = colser.toByteBuffer(entity.getKey());
                    columns.add(new CounterColumn(name, (Long) entity.getValue()));
                }
                counter.add(rKey, columns);
            }
            else
            {
View Full Code Here

                Object linkValue = rh.getRelationValue();

                if (linkName != null && linkValue != null) {
                    if (metaModel.getEmbeddables(metadata.getEntityClazz()).isEmpty()) {
                        if (metadata.isCounterColumnType()) {
                            CounterColumn col = populateCounterFkey(linkName, linkValue);
                            tf.addCounterColumn(col);
                        } else {
                            Column col = populateFkey(linkName, linkValue, timestamp);
                            tf.addColumn(col);
                        }

                    } else {
                        if (metadata.isCounterColumnType()) {
                            CounterSuperColumn counterSuperColumn = new CounterSuperColumn();
                            counterSuperColumn.setName(linkName.getBytes());
                            CounterColumn column = populateCounterFkey(linkName, linkValue);
                            counterSuperColumn.addToColumns(column);
                            tf.addCounterSuperColumn(counterSuperColumn);
                        } else {
                            SuperColumn superColumn = new SuperColumn();
                            superColumn.setName(linkName.getBytes());
View Full Code Here

     * @param rlValue
     *            the rl value
     * @return the counter column
     */
    private CounterColumn populateCounterFkey(String rlName, Object rlValue) {
        CounterColumn counterCol = new CounterColumn();
        counterCol.setName(PropertyAccessorFactory.STRING.toBytes(rlName));
        counterCol.setValue((Long) rlValue);
        return counterCol;
    }
View Full Code Here

                    log.warn("Counter value not found for {}, resetting it to zero.", descriptor.getPkColumnName());
                    latestCount = 0;
                }
                ColumnParent columnParent = new ColumnParent(descriptor.getTable());

                CounterColumn counterColumn =
                    new CounterColumn(ByteBuffer.wrap(descriptor.getValueColumnName().getBytes()), 1);

                conn.add(ByteBuffer.wrap(descriptor.getPkColumnValue().getBytes()), columnParent, counterColumn,
                    getConsistencyLevel());
            }
            if (latestCount == 0) {
View Full Code Here

    {
        if (value != null)
        {
            if (m.isCounterColumnType())
            {
                CounterColumn counterColumn = prepareCounterColumn((String) value, name);
                tr.addCounterColumn(counterColumn);
            }
            else
            {
                Column column = prepareColumn((byte[]) value, name, timestamp, ttl);
View Full Code Here

        {
            if (m.isCounterColumnType())
            {
                CounterSuperColumn counterSuper = new CounterSuperColumn();
                counterSuper.setName(name);
                CounterColumn counterColumn = prepareCounterColumn((String) value, name);
                List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>();
                subCounterColumn.add(counterColumn);
                counterSuper.setColumns(subCounterColumn);
                tr.addCounterSuperColumn(counterSuper);
            }
View Full Code Here

     *            the name
     * @return the counter column
     */
    private CounterColumn prepareCounterColumn(String value, byte[] name)
    {
        CounterColumn counterColumn = new CounterColumn();
        counterColumn.setName(name);
        LongAccessor accessor = new LongAccessor();
        counterColumn.setValue(accessor.fromString(LongAccessor.class, value));
        return counterColumn;
    }
View Full Code Here

            }
            if (null != value)
            {
                try
                {
                    CounterColumn thriftColumn = new CounterColumn();
                    thriftColumn.setName(PropertyAccessorFactory.STRING.toBytes(name));
                    thriftColumn.setValue(Long.parseLong(value));
                    thriftColumns.add(thriftColumn);

                    tableName = ((AbstractAttribute) column).getTableName() != null ? ((AbstractAttribute) column)
                            .getTableName() : tableName;
                    CounterSuperColumn thriftSuperColumn = (CounterSuperColumn) thriftCounterSuperColumns
View Full Code Here

    }
    return columnPath;
  }
 
  public static CounterColumn createCounterColumn(String name, long value) {
    CounterColumn cc = new CounterColumn();
    cc.setName(StringSerializer.get().toByteBuffer(name));
    cc.setValue(value);
    return cc;
  }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.CounterColumn$CounterColumnStandardSchemeFactory

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.