当前位置: 首页>>代码示例>>Java>>正文


Java LexicalUUIDType类代码示例

本文整理汇总了Java中org.apache.cassandra.db.marshal.LexicalUUIDType的典型用法代码示例。如果您正苦于以下问题:Java LexicalUUIDType类的具体用法?Java LexicalUUIDType怎么用?Java LexicalUUIDType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LexicalUUIDType类属于org.apache.cassandra.db.marshal包,在下文中一共展示了LexicalUUIDType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getByteBuffer

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
/**
 * Returns the typed value, serialized to a ByteBuffer.
 *
 * @return a ByteBuffer of the value.
 * @throws InvalidRequestException if unable to coerce the string to its type.
 */
public ByteBuffer getByteBuffer() throws InvalidRequestException
{
    switch (type)
    {
        case STRING:
            return AsciiType.instance.fromString(text);
        case INTEGER:
            return IntegerType.instance.fromString(text);
        case UUID:
            // we specifically want the Lexical class here, not "UUIDType," because we're supposed to have
            // a uuid-shaped string here, and UUIDType also accepts integer or date strings (and turns them into version 1 uuids).
            return LexicalUUIDType.instance.fromString(text);
        case FLOAT:
          return FloatType.instance.fromString(text);
    }

    // FIXME: handle scenario that should never happen
    return null;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:Term.java

示例2: getByteBuffer

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
/**
 * Returns the typed value, serialized to a ByteBuffer.
 * 
 * @return a ByteBuffer of the value.
 * @throws InvalidRequestException if unable to coerce the string to its type.
 */
public ByteBuffer getByteBuffer() throws InvalidRequestException
{
    switch (type)
    {
        case STRING:
            return AsciiType.instance.fromString(text);
        case INTEGER: 
            return IntegerType.instance.fromString(text);
        case UUID:
            // we specifically want the Lexical class here, not "UUIDType," because we're supposed to have
            // a uuid-shaped string here, and UUIDType also accepts integer or date strings (and turns them into version 1 uuids).
            return LexicalUUIDType.instance.fromString(text);
        case FLOAT: 
          return FloatType.instance.fromString(text);
    }
    
    // FIXME: handle scenario that should never happen
    return null;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:26,代码来源:Term.java

示例3: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String keyspaceName = "Keyspace1";
    String cfName = "Super6";
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Keyspace keyspace = Keyspace.open(keyspaceName);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new BufferCell(cellname("a"), ByteBufferUtil.bytes("A"), 1),
                                         new BufferCell(cellname("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    ColumnFamily cfGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
    assertEquals(ByteBufferUtil.bytes("A"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    SortedSet<CellName> sliceColNames = new TreeSet<CellName>(cfs.metadata.comparator);
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a")));
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b")));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(keyspaceName, key.getKey(), cfName, System.currentTimeMillis(), new NamesQueryFilter(sliceColNames));
    ColumnFamily cfSliced = cmd.getRow(keyspace).cf;

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:ColumnFamilyStoreTest.java

示例4: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String keyspaceName = "Keyspace1";
    String cfName = "Super6";
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Keyspace keyspace = Keyspace.open(keyspaceName);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new Column(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("A"), 1),
                                         new Column(ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    ColumnFamily cfGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
    assertEquals(ByteBufferUtil.bytes("A"), cfGet.getColumn(CompositeType.build(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfGet.getColumn(CompositeType.build(superColName, ByteBufferUtil.bytes("b"))).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    SortedSet<ByteBuffer> sliceColNames = new TreeSet<ByteBuffer>(cfs.metadata.comparator);
    sliceColNames.add(CompositeType.build(superColName, ByteBufferUtil.bytes("a")));
    sliceColNames.add(CompositeType.build(superColName, ByteBufferUtil.bytes("b")));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(keyspaceName, key.key, cfName, System.currentTimeMillis(), new NamesQueryFilter(sliceColNames));
    ColumnFamily cfSliced = cmd.getRow(keyspace).cf;

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), cfSliced.getColumn(CompositeType.build(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfSliced.getColumn(CompositeType.build(superColName, ByteBufferUtil.bytes("b"))).value());
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:31,代码来源:ColumnFamilyStoreTest.java

示例5: defineSchema

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@BeforeClass
public static void defineSchema() throws ConfigurationException, IOException, TException
{
    SchemaLoader.prepareServer();
    SchemaLoader.createKeyspace(KEYSPACE1,
                                SimpleStrategy.class,
                                KSMetaData.optsWithRF(1),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD1),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD2),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD3),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD4),
                                SchemaLoader.indexCFMD(KEYSPACE1, CF_INDEX1, true),
                                SchemaLoader.indexCFMD(KEYSPACE1, CF_INDEX2, false),
                                SchemaLoader.superCFMD(KEYSPACE1, CF_SUPER1, LongType.instance),
                                SchemaLoader.superCFMD(KEYSPACE1, CF_SUPER6, LexicalUUIDType.instance, UTF8Type.instance),
                                CFMetaData.denseCFMetaData(KEYSPACE1, CF_STANDARDINT, IntegerType.instance));
    SchemaLoader.createKeyspace(KEYSPACE2,
                                SimpleStrategy.class,
                                KSMetaData.optsWithRF(1),
                                SchemaLoader.standardCFMD(KEYSPACE2, CF_STANDARD1),
                                SchemaLoader.indexCFMD(KEYSPACE2, CF_INDEX1, true),
                                SchemaLoader.compositeIndexCFMD(KEYSPACE2, CF_INDEX2, true),
                                SchemaLoader.compositeIndexCFMD(KEYSPACE2, CF_INDEX3, true).gcGraceSeconds(0));
    SchemaLoader.createKeyspace(KEYSPACE3,
                                SimpleStrategy.class,
                                KSMetaData.optsWithRF(5),
                                SchemaLoader.indexCFMD(KEYSPACE3, CF_INDEX1, true));
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:29,代码来源:ColumnFamilyStoreTest.java

示例6: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String keyspaceName = KEYSPACE1;
    String cfName = CF_SUPER6;
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Keyspace keyspace = Keyspace.open(keyspaceName);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new BufferCell(cellname("a"), ByteBufferUtil.bytes("A"), 1),
                                         new BufferCell(cellname("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    ColumnFamily cfGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
    assertEquals(ByteBufferUtil.bytes("A"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    SortedSet<CellName> sliceColNames = new TreeSet<CellName>(cfs.metadata.comparator);
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a")));
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b")));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(keyspaceName, key.getKey(), cfName, System.currentTimeMillis(), new NamesQueryFilter(sliceColNames));
    ColumnFamily cfSliced = cmd.getRow(keyspace).cf;

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:31,代码来源:ColumnFamilyStoreTest.java

示例7: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String tableName = "Keyspace1";
    String cfName = "Super6";
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Table table = Table.open(tableName);
    ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new Column(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("A"), 1),
                                         new Column(ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    IColumn columnGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName, superColName))).getColumn(superColName);
    assertEquals(ByteBufferUtil.bytes("A"), columnGet.getSubColumn(ByteBufferUtil.bytes("a")).value());
    assertEquals(ByteBufferUtil.bytes("B"), columnGet.getSubColumn(ByteBufferUtil.bytes("b")).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    ArrayList<ByteBuffer> sliceColNames = new ArrayList<ByteBuffer>();
    sliceColNames.add(ByteBufferUtil.bytes("a"));
    sliceColNames.add(ByteBufferUtil.bytes("b"));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(tableName, key.key, new QueryPath(cfName, superColName), sliceColNames);
    IColumn columnSliced = cmd.getRow(table).cf.getColumn(superColName);

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), columnSliced.getSubColumn(ByteBufferUtil.bytes("a")).value());
    assertEquals(ByteBufferUtil.bytes("B"), columnSliced.getSubColumn(ByteBufferUtil.bytes("b")).value());
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:31,代码来源:ColumnFamilyStoreTest.java

示例8: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.marshal.LexicalUUIDType; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String keyspaceName = "Keyspace1";
    String cfName = "Super6";
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Keyspace keyspace = Keyspace.open(keyspaceName);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new Cell(cellname("a"), ByteBufferUtil.bytes("A"), 1),
                                         new Cell(cellname("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    ColumnFamily cfGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
    assertEquals(ByteBufferUtil.bytes("A"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    SortedSet<CellName> sliceColNames = new TreeSet<CellName>(cfs.metadata.comparator);
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a")));
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b")));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(keyspaceName, key.key, cfName, System.currentTimeMillis(), new NamesQueryFilter(sliceColNames));
    ColumnFamily cfSliced = cmd.getRow(keyspace).cf;

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:31,代码来源:ColumnFamilyStoreTest.java


注:本文中的org.apache.cassandra.db.marshal.LexicalUUIDType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。