Package me.prettyprint.hector.api.beans

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


   * @param mailbox
   * @return
   */
  public static Map<Integer, LabelCounters> getAll(final String mailbox)
  {
    Composite startRange = new Composite();
    startRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.EQUAL);

    Composite endRange = new Composite();
    endRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.GREATER_THAN_EQUAL);

    SliceCounterQuery<String, Composite> sliceQuery =
        createCounterSliceQuery(CassandraDAOFactory.getKeyspace(), strSe, new CompositeSerializer());
    sliceQuery.setColumnFamily(CF_COUNTERS);
    sliceQuery.setKey(mailbox);
View Full Code Here


   * @param labelId
   * @return
   */
  public static LabelCounters get(final String mailbox, final Integer labelId)
  {
    Composite startRange = new Composite();
    startRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.EQUAL);
    startRange.addComponent(1, labelId.toString(), Composite.ComponentEquality.EQUAL);

    Composite endRange = new Composite();
    endRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.EQUAL);
    endRange.addComponent(1, labelId.toString(), Composite.ComponentEquality.GREATER_THAN_EQUAL);

    SliceCounterQuery<String, Composite> sliceQuery =
        createCounterSliceQuery(CassandraDAOFactory.getKeyspace(), strSe, new CompositeSerializer());
    sliceQuery.setColumnFamily(CF_COUNTERS);
    sliceQuery.setKey(mailbox);
View Full Code Here

   * @return
   */
  private static HCounterColumn<Composite> countersToCompositeColumn(
      final Integer labelId, final char subtype, final Long count)
  {
    Composite composite = new Composite();
    composite.addComponent(CN_TYPE_LABEL, strSe);
    composite.addComponent(labelId.toString(), strSe);
    composite.addComponent(Character.toString(subtype), strSe);
    return createCounterColumn(composite, count, new CompositeSerializer());
  }
View Full Code Here

    }

    Mutator<Composite> mutator = HFactory.createMutator(
        CassandraDAOFactory.getKeyspace(), CompositeSerializer.get());
   
    Composite key = new Composite();
    key.addComponent(objectId, uuidSe);
    key.addComponent(blockId, intSe);

    mutator.insert(key, CF_BLOB,
        createColumn(DEFAULT_SUB_BLOCK_ID, data, intSe, byteSe));
  }
View Full Code Here

   * @param blockId Block ID
   * @return
   */
  public static byte[] readBlock(final UUID objectId, final int blockId)
  {
    Composite key = new Composite();
    key.addComponent(objectId, uuidSe);
    key.addComponent(blockId, intSe);

    ColumnQuery<Composite, Integer, byte[]> q = HFactory.createColumnQuery(
        CassandraDAOFactory.getKeyspace(), CompositeSerializer.get(), intSe, byteSe);
   
    QueryResult<HColumn<Integer, byte[]>> result = q.setColumnFamily(CF_BLOB)
View Full Code Here

   * @param objectId Blob ID
   * @param blockId Block ID
   */
  public static void deleteBlock(final UUID objectId, final int blockId)
  {
    Composite key = new Composite();
    key.addComponent(objectId, uuidSe);
    key.addComponent(blockId, intSe);

    Mutator<Composite> mutator = HFactory.createMutator(
        CassandraDAOFactory.getKeyspace(), CompositeSerializer.get());

    mutator.delete(key, CF_BLOB, null, intSe);
View Full Code Here

     * and a value of ['timezone']
     * @return
     */
    HColumn<Composite,String> staticColumnFrom() {

      Composite composite = new Composite();
      composite.addComponent(getCountryCode(), StringSerializer.get());
      composite.addComponent(getAdmin1Code(), StringSerializer.get());
      // extra un-escape to handle the case of "Washington, D.C."
      composite.addComponent(StringEscapeUtils.unescapeCsv(getAsciiName()), StringSerializer.get());
      HColumn<Composite,String> col =
        HFactory.createColumn(composite, getTimezone(), new CompositeSerializer(), StringSerializer.get());
      return col;
    }
View Full Code Here

    CompositeQuery compositeQuery = new CompositeQuery();

    // Note the use of 'equal' and 'greater-than-equal' for the start and end.
    // this has to be the case when we want all
    Composite start = compositeFrom(startArg, Composite.ComponentEquality.EQUAL);
    Composite end = compositeFrom(startArg, Composite.ComponentEquality.GREATER_THAN_EQUAL);

    compositeQuery.printColumnsFor(start,end);

  }
View Full Code Here

   * @param componentName
   * @param equalityOp
   * @return
   */
  public static Composite compositeFrom(String componentName, Composite.ComponentEquality equalityOp) {
    Composite composite = new Composite();
    composite.addComponent(0, componentName, equalityOp);
    return composite;
  }
View Full Code Here

  public ResultStatus execute() {
    Mutator<String> mutator = HFactory.createMutator(keyspace, stringSerializer);
   
    HColumnImpl<Composite, String> column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    Composite dc = new Composite();
    dc.add(0, "Austin");
    dc.add(1, 7516L);
    dc.add(2, 225L);
    column.setName(dc);      
    column.setValue("TIME WARNER COMMUNICATIONS AXS OF AUSTIN, TX");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);
   
    column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    dc = new Composite();
    dc.add(0, "Austin");
    dc.add(1, 7516L);
    dc.add(2, 334L);
    column.setName(dc);      
    column.setValue("TIME WARNER COMMUNICATIONS AXS OF AUSTIN, TX");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);
  
    column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    dc = new Composite();
    dc.add(0, "Austin");
    dc.add(1, 7516L);
    dc.add(2, 439L);
    column.setName(dc);      
    column.setValue("TIME WARNER COMMUNICATIONS AXS OF AUSTIN, TX");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);
  
    column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    dc = new Composite();
    dc.add(0, "Austin");
    dc.add(1, 5830L);
    dc.add(2, 215L);
    column.setName(dc);      
    column.setValue("TIME WARNER COMMUNICATIONS AXS OF AUSTIN, TX");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);

        column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    dc = new Composite();
    dc.add(0, "Aardvark");
    dc.add(1, 5830L);
    dc.add(2, 215L);
    column.setName(dc);
    column.setValue("Aardvark telco");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);
   
    column = new HColumnImpl<Composite, String>(cs, stringSerializer);
    column.setClock(keyspace.createClock());
    dc = new Composite();
    dc.add(0, "Lockhart");
    dc.add(1, 9533L);
    dc.add(2, 227L);
    column.setName(dc);      
    column.setValue("SOUTHWESTERN BELL");
    mutator.addInsertion("TX:512", "StateNpaIndexStatic", column);
       
    mutator.execute();
   
    SliceQuery<String, Composite, String> sliceQuery =
      HFactory.createSliceQuery(keyspace, stringSerializer, cs, stringSerializer);
    sliceQuery.setColumnFamily("StateNpaIndexStatic");
    sliceQuery.setKey("TX:512");

    Composite startRange = new Composite();
    startRange.add(0, "A");
    //startRange.add(1, 7516L);
    //startRange.addComponent(new Long(0), LongSerializer.get(), "LongType", AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL);
    //startRange.addComponent(439L, LongSerializer.get(), "LongType", AbstractComposite.ComponentEquality.EQUAL);
    //startRange.add(1, Long.MIN_VALUE);
    //startRange.add(2, 439L);
   
   
    Composite endRange = new Composite();
    //endRange.add(0, "Austin" + Character.MAX_VALUE);
    endRange.add(0, "B");
    // the following statement is effectively identical for the purposes of restricting to 'Austin'
    //endRange.addComponent("Austin", StringSerializer.get(), "UTF8Type", AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL);
   
    sliceQuery.setRange(startRange, endRange, false, 10);
View Full Code Here

TOP

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

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.