Package me.prettyprint.hector.api.beans

Examples of me.prettyprint.hector.api.beans.DynamicComposite


      String timeDimension, long time, int value) {

    try {
 

      DynamicComposite dcolKey = new DynamicComposite();
      dcolKey.addComponent(timeDimension, StringSerializer.get());
      dcolKey.addComponent(time, LongSerializer.get());
      m.addCounter(rowKey + ":" + columnKey + ":COUNTS",
          CountandraUtils.countandraCF, HFactory
              .createCounterColumn(dcolKey, (long) 1,
                  new DynamicCompositeSerializer()));
View Full Code Here


          List<HCounterColumn<DynamicComposite>> lCols = ((CounterSlice) qr
              .get()).getColumns();
          for (int i = 0; i < lCols.size(); i++) {
            me.prettyprint.cassandra.model.HCounterColumnImpl hcc = (me.prettyprint.cassandra.model.HCounterColumnImpl) lCols
                .get(i);
            DynamicComposite nameHcc = (DynamicComposite) hcc
                .getName();
            dataMap.put(hcc.getName(), hcc.getValue());
          }
        }
        classificationMap.put("Data", dataMap);
View Full Code Here

        .createCounterSliceQuery(
            CassandraStorage.getCountandraKeySpace(),
            stringSerializer, dcs);
    sliceCounterQuery.setColumnFamily(countandraCF);
    sliceCounterQuery.setKey(getKey(category, subtree, countType));
    DynamicComposite startRange = getStartRange(timeDimension, startTime,
        endTime);
    DynamicComposite endRange = getEndRange(timeDimension, startTime,
        endTime);
    sliceCounterQuery.setColumnNames(startRange);
    sliceCounterQuery.setRange(startRange, endRange, false, 100);
    QueryResult result = sliceCounterQuery.execute();
    return result;
View Full Code Here

    return result;
  }

  private DynamicComposite getStartRange(String timeDimension,
      long startRange, long endRange) {
    DynamicComposite range = new DynamicComposite();
    range.add(0, timeDimension);
    range.addComponent(new Long(startRange), longSerializer, "LongType",
        AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL);
    return range;
  }
View Full Code Here

    return range;
  }

  private DynamicComposite getEndRange(String timeDimension, long startRange,
      long endRange) {
    DynamicComposite range = new DynamicComposite();
    range.add(0, timeDimension);
    range.addComponent(new Long(endRange), longSerializer, "LongType",
        AbstractComposite.ComponentEquality.LESS_THAN_EQUAL);
    return range;
  }
View Full Code Here

    @Override
    public List<HColumn<DynamicComposite, ?>> toColumns(V object) {
        List<AssemblyStep> steps = disassemblerService.disassemble(object);
        List<HColumn<DynamicComposite, ?>> columns = new ArrayList<>(steps.size());
        for (AssemblyStep step : steps) {
            final DynamicComposite name = new DynamicComposite(columns.size(), step.getClass().getName());
            ColumnValueDefinition<?> valueDefinition = step.toColumnDefinition();
            final HColumn<DynamicComposite, ?> column = createColumn(name, valueDefinition);
            LOGGER.debug("Adding column {} with value {}...", name, column.getValue());
            columns.add(column);
        }
View Full Code Here

    }

    @Override
    @SuppressWarnings("unchecked")
    public void initializeFromColumn(byte[] columnValue, ClassResolver classResolver) {
        DynamicComposite dynamicComposite = DynamicCompositeSerializer.get().fromBytes(columnValue);
        Serializer<Object> serializer = (Serializer<Object>)CassidyUtils.instantiate(classResolver.resolveClass(String.valueOf(dynamicComposite.get(0))));
        this.value = serializer.fromByteBuffer((ByteBuffer) dynamicComposite.get(1));
    }
View Full Code Here

    @Override
    public ColumnValueDefinition<?> toColumnDefinition() {
        Serializer<Object> serializer = CassidyUtils.inferSerializer(value);

        final DynamicComposite dynamicComposite = new DynamicComposite(serializer.getClass().getName(), serializer.toByteBuffer(value));

        return new ColumnValueDefinition<>(dynamicComposite, DynamicCompositeSerializer.get());
    }
View Full Code Here

        entryMutator.execute();
    }

    @Override
    public List<K> find(Object... values) {
        DynamicComposite start = new DynamicComposite();
        DynamicComposite end = new DynamicComposite();
        for (int i = 0; i < values.length; i++) {
            Object value = values[i];
            start.addComponent(i, value, AbstractComposite.ComponentEquality.EQUAL);
            end.addComponent(i, value, i == values.length - 1 ? AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL : AbstractComposite.ComponentEquality.EQUAL);
        }
        final SliceQuery<String, DynamicComposite, K> query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), DynamicCompositeSerializer.get(), keySerializer);
        query.setKey(indexName);
        query.setColumnFamily(indexColumnFamily);
        query.setRange(start, end, false, Integer.MAX_VALUE);
View Full Code Here

    private Mutator<String> indexMutator() {
        return HFactory.createMutator(keyspace, STRING_SERIALIZER);
    }

    private void insertEntryColumn(K itemKey, long timestamp, List<IndexValue<?>> indexValues, Mutator<DynamicComposite> entryMutator) {
        DynamicComposite entryValue = new DynamicComposite();
        IndexValue.addAll(indexValues, entryValue);
        final HColumn<Long, DynamicComposite> entryColumn = HFactory.createColumn(timestamp, entryValue, LONG_SERIALIZER, DYNAMIC_COMPOSITE_SERIALIZER);
        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }
View Full Code Here

TOP

Related Classes of me.prettyprint.hector.api.beans.DynamicComposite

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.