Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package me.prettyprint.cassandra.service.spring;
  
  import java.util.List;
  
 
Implementation of the HectorTemplate

Author(s):
Bozhidar Bozhanov
 
 public class HectorTemplateImpl implements HectorTemplate {
 
   private String keyspaceName;
   private Cluster cluster;
   private Keyspace keyspace;
 
   private int replicationFactor;
 
 
   public HectorTemplateImpl() {
   }
 
   public HectorTemplateImpl(Cluster clusterString keyspaceint replicationFactorString replicationStrategyClassConfigurableConsistencyLevel configurableConsistencyLevelPolicy) {
     this. = cluster;
     this. = keyspace;
     this. = replicationFactor;
     this. = replicationStrategyClass;
     this. = configurableConsistencyLevelPolicy;
   }
 
   public void init() {
   }
 
   private void initKeyspaceOperator() {
     ConsistencyLevelPolicy clPolicy;
     if ( == null) {
       clPolicy = HFactory.createDefaultConsistencyLevelPolicy();
     } else {
       clPolicy = ;
     }
      = HFactory.createKeyspace(clPolicy);
   }
 
   @Override
   public <K, N, V> Mutator<K> createMutator(Serializer<K> keySerializer) {
     return HFactory.createMutator(keySerializer);
   }
 
   @Override
   public <K, N, V> ColumnQuery<K, N, V> createColumnQuery() {
     return new ThriftColumnQuery<K, N, V>();
   }
 
   @Override
   public <K, N, V> ColumnQuery<K, N, V> createColumnQuery(Serializer<V> valueSerializer) {
     return new ThriftColumnQuery<K, N, V>(valueSerializer);
   }
 
   @Override
  public <K, N> CountQuery<K, N> createCountQuery(Serializer<K> keySerializer,
      Serializer<N> nameSerializer) {
    return HFactory.createCountQuery(keySerializernameSerializer);
  }
  public <K, SN> SuperCountQuery<K, SN> createSuperCountQuery(Serializer<K> keySerializer,
      Serializer<SN> superNameSerializer) {
    return HFactory.createSuperCountQuery(keySerializersuperNameSerializer);
  }
  public <K, SN, N> SubCountQuery<K, SN, N> createSubCountQuery(Serializer<K> keySerializer,
      Serializer<SN> superNameSerializerSerializer<N> nameSerializer) {
    return HFactory.createSubCountQuery(keySerializersuperNameSerializer,
        nameSerializer);
  }
  public <K, SN, N, V> SuperColumnQuery<K, SN, N, V> createSuperColumnQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createSuperColumnQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, N, V> MultigetSliceQuery<K, N, V> createMultigetSliceQuery(
      Serializer<K> keySerializerSerializer<N> nameSerializerSerializer<V> valueSerializer) {
    return HFactory.createMultigetSliceQuery(keySerializernameSerializer,
        valueSerializer);
  }
  public <K, SN, N, V> MultigetSuperSliceQuery<K, SN, N, V> createMultigetSuperSliceQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createMultigetSuperSliceQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, SN, N, V> MultigetSubSliceQuery<K, SN, N, V> createMultigetSubSliceQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createMultigetSubSliceQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, N, V> RangeSlicesQuery<K, N, V> createRangeSlicesQuery(Serializer<K> keySerializer,
      Serializer<N> nameSerializerSerializer<V> valueSerializer) {
    return HFactory.createRangeSlicesQuery(keySerializernameSerializer,
        valueSerializer);
  }
  public <K, SN, N, V> RangeSuperSlicesQuery<K, SN, N, V> createRangeSuperSlicesQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createRangeSuperSlicesQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, SN, N, V> RangeSubSlicesQuery<K, SN, N, V> createRangeSubSlicesQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createRangeSubSlicesQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, N, V> SliceQuery<K, N, V> createSliceQuery(Serializer<K> keySerializer,
      Serializer<N> nameSerializerSerializer<V> valueSerializer) {
    return HFactory.createSliceQuery(keySerializernameSerializer,
        valueSerializer);
  }
  public <K, SN, N, V> SubSliceQuery<K, SN, N, V> createSubSliceQuery(Serializer<K> keySerializer,
      Serializer<SN> sNameSerializerSerializer<N> nameSerializerSerializer<V> valueSerializer) {
    return HFactory.createSubSliceQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <K, SN, N, V> SuperSliceQuery<K, SN, N, V> createSuperSliceQuery(
      Serializer<K> keySerializerSerializer<SN> sNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createSuperSliceQuery(keySerializersNameSerializer,
        nameSerializervalueSerializer);
  }
  public <SN, N, V> HSuperColumn<SN, N, V> createSuperColumn(SN nameList<HColumn<N, V>> columns,
      Serializer<SN> superNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createSuperColumn(namecolumnscreateClock(), superNameSerializer,
        nameSerializervalueSerializer);
  }
  public <SN, N, V> HSuperColumn<SN, N, V> createSuperColumn(SN nameList<HColumn<N, V>> columns,
      long clockSerializer<SN> superNameSerializerSerializer<N> nameSerializer,
      Serializer<V> valueSerializer) {
    return HFactory.createSuperColumn(namecolumnsclocksuperNameSerializernameSerializer,
        valueSerializer);
  }
  public <N, V> HColumn<N, V> createColumn(N name, V valuelong clock,
      Serializer<N> nameSerializerSerializer<V> valueSerializer) {
    return HFactory.createColumn(namevalueclocknameSerializervalueSerializer);
  }
  public <N, V> HColumn<N, V> createColumn(N name, V value) {
    return new HColumnImpl<N, V>(namevaluecreateClock());
  }
  
  public <N, V> HColumn<N, V> createColumn(N name, V valuelong clock) {
    return new HColumnImpl<N, V>(namevalueclock);
  }
  public long createClock() {
  }
  // probably should be typed for thrift vs. avro
  <N> ColumnPath createColumnPath(String columnFamilyName, N columnName,
      Serializer<N> nameSerializer) {
    return createColumnPath(columnFamilyNamenameSerializer.toByteBuffer(columnName));
  }
  private <N> ColumnPath createColumnPath(String columnFamilyNameByteBuffer columnName) {
    Validate.notNull(columnFamilyName"columnFamilyName cannot be null");
    ColumnPath columnPath = new ColumnPath(columnFamilyName);
    if (columnName != null) {
      columnPath.setColumn(columnName);
    }
    return columnPath;
  }
  <N> ColumnPath createColumnPath(String columnFamilyName) {
    return createColumnPath(columnFamilyNamenull);
  }
  <SN, N> ColumnPath createSuperColumnPath(String columnFamilyName, SN superColumnName,
      N columnNameSerializer<SN> superNameSerializerSerializer<N> nameSerializer) {
    noNullElements(columnFamilyNamesuperColumnNamesuperNameSerializernameSerializer);
    ColumnPath columnPath = createColumnPath(columnFamilyNamenameSerializer.toByteBuffer(columnName));
    columnPath.setSuper_column(superNameSerializer.toByteBuffer(superColumnName));
    return columnPath;
  }
  <SN> ColumnPath createSuperColumnPath(String columnFamilyName, SN superColumnName,
      Serializer<SN> superNameSerializer) {
    noNullElements(columnFamilyNamesuperNameSerializer);
    ColumnPath columnPath = createColumnPath(columnFamilyNamenull);
    if (superColumnName != null) {
      columnPath.setSuper_column(superNameSerializer.toByteBuffer(superColumnName));
    }
    return columnPath;
  }
  private void noNullElements(Object... elements) {
    Validate.noNullElements(elements);
  }
  public <K, N, V> Mutator<K> createMutator() {
    return new MutatorImpl<K>();
  }
  public <K, N, V> IndexedSlicesQuery<K, N, V> createIndexSlicesQuery(Serializer<K> keySerializer,
      Serializer<N> nameSerializerSerializer<V> valueSerializer) {
    return new IndexedSlicesQuery<K, N, V>(keySerializernameSerializer,
        valueSerializer);
  }
  public <SN, N, V> HSuperColumn<SN, N, V> createSuperColumn(SN name,
      List<HColumn<N, V>> columns) {
    return createSuperColumn(namecolumns, TypeInferringSerializer.<SN>get(), TypeInferringSerializer.<N>get(), TypeInferringSerializer.<V>get());
  }
  public <K> SliceQuery<K, ByteBufferByteBuffercreateSliceQuery() {
    return createSliceQuery(TypeInferringSerializer.<K>get(), ByteBufferSerializer.get(), ByteBufferSerializer.get());
  }
    return createSuperSliceQuery(TypeInferringSerializer.<K>get(), ByteBufferSerializer.get(), ByteBufferSerializer.get(), ByteBufferSerializer.get());
  }
  public String getKeyspaceName() {
    return ;
  }
  public void setKeyspaceName(String keyspace) {
    this. = keyspace;
  }
  public Keyspace getKeyspace() {
    return ;
  }
  public void setKeyspace(Keyspace keyspace) {
    this. = keyspace;
  }
  }
      ConfigurableConsistencyLevel configurableConsistencyLevelPolicy) {
    this. = configurableConsistencyLevelPolicy;
  }
  }
  public void setReplicationStrategyClass(String replicationStrategyClass) {
    this. = replicationStrategyClass;
  }
  public int getReplicationFactor() {
    return ;
  }
  public void setReplicationFactor(int replicationFactor) {
    this. = replicationFactor;
  }
  public Cluster getCluster() {
    return ;
  }
  public void setCluster(Cluster cluster) {
    this. = cluster;
  }
New to GrepCode? Check out our FAQ X