@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.insert(key, columnParent, column, getThriftCl(OperationType.WRITE)); return null; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.remove(key, columnPath, timestamp, getThriftCl(OperationType.WRITE)); return null; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Map<ByteBuffer, Integer> execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.multiget_count(keys, columnParent, slicePredicate, getThriftCl(OperationType.READ)); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_version(); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { if ( log.isInfoEnabled() ) { log.info("in execute with client {}", cassandra); } return cassandra.describe_partitioner(); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Map<String,List<String>> execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_schema_versions(); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Integer execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.get_count(key, columnParent, predicate, getThriftCl(OperationType.READ)); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_cluster_name(); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public List<TokenRange> execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_ring(keyspace); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.batch_mutate(mutationMap, getThriftCl(OperationType.WRITE)); } catch (Exception e) { throw xtrans.translate(e); } return null; } };
@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.add(key, columnParent, counterColumn, getThriftCl(OperationType.WRITE)); return null; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.remove_counter(key, columnPath, getThriftCl(OperationType.WRITE)); return null; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.truncate(columnFamily); } catch (Exception e) { throw xtrans.translate(e); } return null; } };
@Override public Map<ByteBuffer, List<Column>> execute(Cassandra.Client cassandra) throws HectorException { try { Map<ByteBuffer, List<ColumnOrSuperColumn>> cfmap = cassandra.multiget_slice( keys, columnParent, predicate, getThriftCl(OperationType.READ)); Map<ByteBuffer, List<Column>> result = new HashMap<ByteBuffer, List<Column>>(); for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> entry : cfmap.entrySet()) { result.put(entry.getKey(), getColumnList(entry.getValue())); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Map<ByteBuffer, List<CounterColumn>> execute(Cassandra.Client cassandra) throws HectorException { try { Map<ByteBuffer, List<ColumnOrSuperColumn>> cfmap = cassandra.multiget_slice( keys, columnParent, predicate, getThriftCl(OperationType.READ)); Map<ByteBuffer, List<CounterColumn>> result = new HashMap<ByteBuffer, List<CounterColumn>>(); for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> entry : cfmap.entrySet()) { result.put(entry.getKey(), getCounterColumnList(entry.getValue())); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public CounterColumn execute(Cassandra.Client cassandra) throws HectorException { ColumnOrSuperColumn cosc; try { cosc = cassandra.get(key, columnPath, getThriftCl(OperationType.READ)); } catch (NotFoundException e) { setException(xtrans.translate(e)); return null; } catch (Exception e) { throw xtrans.translate(e); } return cosc.getCounter_column(); }
@Override public Column execute(Cassandra.Client cassandra) throws HectorException { ColumnOrSuperColumn cosc; try { cosc = cassandra.get(key, columnPath, getThriftCl(OperationType.READ)); } catch (NotFoundException e) { setException(xtrans.translate(e)); return null; } catch (Exception e) { throw xtrans.translate(e); } return cosc == null ? null : cosc.getColumn(); }
@Override public KeyspaceDefinition execute(Cassandra.Client cassandra) throws HectorException { try { return new ThriftKsDef(cassandra.describe_keyspace(keyspace)); } catch (org.apache.cassandra.thrift.NotFoundException nfe) { setException(xtrans.translate(nfe)); return null; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public SuperColumn execute(Cassandra.Client cassandra) throws HectorException { ColumnOrSuperColumn cosc; try { cosc = cassandra.get(key, columnPath, getThriftCl(OperationType.READ)); } catch (NotFoundException e) { setException(xtrans.translate(e)); return null; } catch (Exception e) { throw xtrans.translate(e); } return cosc == null ? null : cosc.getSuper_column(); }
@Override public List<SuperColumn> execute(Cassandra.Client cassandra) throws HectorException { try { List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(key, columnParent, predicate, getThriftCl(OperationType.READ)); if (cosclist == null) { return null; } ArrayList<SuperColumn> result = new ArrayList<SuperColumn>(cosclist.size()); for (ColumnOrSuperColumn cosc : cosclist) { result.add(cosc.getSuper_column()); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };