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


Java TypeParser类代码示例

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


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

示例1: parseValidatorType

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
/**
 * Parses the cassandra columns mapping to identify the column name.
 * One of the Hive table columns maps to the cassandra row key, by default the
 * first column.
 *
 * @param columnList a list of column validator type in String format
 * @return a list of cassandra validator type
 */
private List<AbstractType> parseValidatorType(List<String> columnList)
  throws SerDeException {
  List<AbstractType> types = new ArrayList<AbstractType>();

  for (String str : columnList) {
    if (StringUtils.isBlank(str)) {
      types.add(DEFAULT_VALIDATOR_TYPE);
    } else {
      try {
        types.add(TypeParser.parse(str));
      } catch (Exception e) {
        throw new SerDeException("Invalid Cassandra validator type ' " + str + "'");
      }
    }
  }

  return types;
}
 
开发者ID:dvasilen,项目名称:Hive-Cassandra,代码行数:27,代码来源:CassandraColumnSerDe.java

示例2: setup

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
@Override protected void setup(
        Context context)
        throws IOException, InterruptedException {
    super.setup(context);

    maxRowSize = context.getConfiguration().getLong(Aegisthus.Feature.CONF_MAXCOLSIZE, Long.MAX_VALUE);

    String columnType = context.getConfiguration().get(Aegisthus.Feature.CONF_COLUMNTYPE, "BytesType");
    String rowKeyType = context.getConfiguration().get(Aegisthus.Feature.CONF_KEYTYPE, "BytesType");

    try {
        columnComparator = TypeParser.parse(columnType);
        rowKeyComparator = TypeParser.parse(rowKeyType);
    } catch (SyntaxException | ConfigurationException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Netflix,项目名称:aegisthus,代码行数:18,代码来源:CassSSTableReducer.java

示例3: getColumns

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private Map<ByteBuffer, ColumnDefinition> getColumns(AbstractType<?> comparator) throws InvalidRequestException
{
    Map<ByteBuffer, ColumnDefinition> columnDefs = new HashMap<ByteBuffer, ColumnDefinition>();
    
    for (Map.Entry<Term, String> col : columns.entrySet())
    {
        try
        {
            ByteBuffer columnName = comparator.fromString(col.getKey().getText());
            String validatorClassName = comparators.containsKey(col.getValue()) ? comparators.get(col.getValue()) : col.getValue();
            AbstractType<?> validator = TypeParser.parse(validatorClassName);
            columnDefs.put(columnName, new ColumnDefinition(columnName, validator, null, null));
        }
        catch (ConfigurationException e)
        {
            InvalidRequestException ex = new InvalidRequestException(e.toString());
            ex.initCause(e);
            throw ex;
        }
    }
    
    return columnDefs;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:24,代码来源:CreateColumnFamilyStatement.java

示例4: getDefaultMarshallers

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private List<AbstractType> getDefaultMarshallers(CfDef cfDef) throws IOException
{
    ArrayList<AbstractType> marshallers = new ArrayList<AbstractType>();
    AbstractType comparator = null;
    AbstractType default_validator = null;
    try
    {
        comparator = TypeParser.parse(cfDef.comparator_type);
        default_validator = TypeParser.parse(cfDef.default_validation_class);
    }
    catch (ConfigurationException e)
    {
        throw new IOException(e);
    }

    marshallers.add(comparator);
    marshallers.add(default_validator);
    return marshallers;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:20,代码来源:CassandraStorage.java

示例5: getValidatorMap

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private Map<ByteBuffer,AbstractType> getValidatorMap(CfDef cfDef) throws  IOException
{
    Map<ByteBuffer, AbstractType> validators = new HashMap<ByteBuffer, AbstractType>();
    for (ColumnDef cd : cfDef.column_metadata)
    {
        if (cd.getValidation_class() != null && !cd.getValidation_class().isEmpty())
        {
            AbstractType validator = null;
            try
            {
                validator = TypeParser.parse(cd.getValidation_class());
                validators.put(cd.name, validator);
            }
            catch (ConfigurationException e)
            {
                throw new IOException(e);
            }
        }
    }
    return validators;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:22,代码来源:CassandraStorage.java

示例6: maybeCreateColumnFamily

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private void maybeCreateColumnFamily(RequiresColumnFamily rcf) {
  try {
    CFMetaData cfMetaData;
    if ( rcf.isCounter() ) {
      cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(),
                    ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null)
              .replicateOnWrite(false).defaultValidator(CounterColumnType.instance);
    } else {
      cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(),
                    ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null);
    }
    MigrationManager.announceNewColumnFamily(cfMetaData);
  } catch(AlreadyExistsException aee) {
    logger.info("CF already exists for " + rcf.cfName());
    maybeTruncateSafely(rcf);
  } catch (Exception ex) {
    throw new RuntimeException("Could not create CF for: " + rcf.cfName(), ex);
  }
}
 
开发者ID:Netflix,项目名称:staash,代码行数:20,代码来源:CassandraRunner.java

示例7: ColumnFamilyMetadata

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
public ColumnFamilyMetadata(String keyspace, String columnFamily, String keyAliasesString, String columnAliasesString, String keyValidatorString,
		String comparatorString) {
	// @formatter:off
	if (keyspace == null)            throw new IllegalArgumentException("keyspace cannot be null");
	if (columnFamily == null)        throw new IllegalArgumentException("columnFamily cannot be null");
	if (keyAliasesString == null)    throw new IllegalArgumentException("keyAliasesString cannot be null");
	if (columnAliasesString == null) throw new IllegalArgumentException("columnAliasesString cannot be null");
	if (keyValidatorString == null)  throw new IllegalArgumentException("keyValidatorString cannot be null");
	if (comparatorString == null)    throw new IllegalArgumentException("comparatorString cannot be null");
	// @formatter:on

	this.keyspace = keyspace;
	this.columnFamily = columnFamily;
	this.keyAliasesString = keyAliasesString;
	this.keyAliases = FBUtilities.fromJsonList(keyAliasesString);
	this.columnAliasesString = columnAliasesString;
	this.columnAliases = FBUtilities.fromJsonList(columnAliasesString);
	this.keyValidatorString = keyValidatorString;
	this.comparatorString = comparatorString;
	try {
		this.keyValidator = TypeParser.parse(keyValidatorString);
		this.comparator = TypeParser.parse(comparatorString);
	} catch (Exception e) {
		throw new IllegalArgumentException("Can't parse type string", e);
	}
}
 
开发者ID:richardalow,项目名称:cassowary,代码行数:27,代码来源:ColumnFamilyMetadata.java

示例8: parseType

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private AbstractType<?> parseType(String type) throws ConfigurationException
{
    try
    {
        // always treat counters like longs, specifically CCT.serialize is not what we need
        if (type != null && type.equals("org.apache.cassandra.db.marshal.CounterColumnType"))
            return LongType.instance;
        return TypeParser.parse(type);
    }
    catch (SyntaxException e)
    {
        throw new ConfigurationException(e.getMessage(), e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:CqlRecordWriter.java

示例9: argsListFromString

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private static List<AbstractType<?>> argsListFromString(String s)
{
    List<AbstractType<?>> argTypes = new ArrayList<>();
    for(String type : Splitter.on("^").omitEmptyStrings().trimResults().split(s))
        argTypes.add(TypeParser.parse(type));
    return argTypes;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:FunctionResource.java

示例10: parseType

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private static AbstractType<?> parseType(String str)
{
    // We only use this when reading the schema where we shouldn't get an error
    try
    {
        return TypeParser.parse(str);
    }
    catch (SyntaxException | ConfigurationException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:13,代码来源:UDFunction.java

示例11: parseType

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private AbstractType<?> parseType(String type) throws ConfigurationException
{
    try
    {
        // always treat counters like longs, specifically CCT.compose is not what we need
        if (type != null && type.equals("org.apache.cassandra.db.marshal.CounterColumnType"))
            return LongType.instance;
        return TypeParser.parse(type);
    }
    catch (SyntaxException e)
    {
        throw new ConfigurationException(e.getMessage(), e);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:15,代码来源:CqlRecordWriter.java

示例12: columnFromAvro

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
@Deprecated
public static ColumnDefinition columnFromAvro(org.apache.cassandra.db.migration.avro.ColumnDef cd)
{
    IndexType index_type = cd.index_type == null ? null : Enum.valueOf(IndexType.class, cd.index_type.name());
    String index_name = cd.index_name == null ? null : cd.index_name.toString();
    try
    {
        AbstractType<?> validatorType = TypeParser.parse(cd.validation_class);
        return new ColumnDefinition(ByteBufferUtil.clone(cd.name), validatorType, index_type, ColumnDefinition.getStringMap(cd.index_options), index_name, null);
    }
    catch (RequestValidationException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:16,代码来源:Avro.java

示例13: parseType

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
private AbstractType<?> parseType(String type) throws ConfigurationException {
    try {
        // always treat counters like longs, specifically CCT.serialize is not what we need
        if (type != null && type.equals("org.apache.cassandra.db.marshal.CounterColumnType")) {
            return LongType.instance;
        }
        return TypeParser.parse(type);
    } catch (SyntaxException e) {
        throw new ConfigurationException(e.getMessage(), e);
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:12,代码来源:CqlRecordWriter.java

示例14: getConverter

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private AbstractType<ByteBuffer> getConverter(Configuration conf, String key) {
    String converterType = conf.get(key);
    if (Strings.isNullOrEmpty(key)) {
        return BytesType.instance;
    }

    try {
        return (AbstractType<ByteBuffer>) TypeParser.parse(converterType);
    } catch (SyntaxException | ConfigurationException e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:Netflix,项目名称:aegisthus,代码行数:14,代码来源:JsonOutputFormat.java

示例15: setConf

import org.apache.cassandra.db.marshal.TypeParser; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
    this.conf = conf;
    String columnType = conf.get(Aegisthus.Feature.CONF_COLUMNTYPE, "BytesType");
    legacyColumnNameFormatting = conf.getBoolean(Aegisthus.Feature.CONF_LEGACY_COLUMN_NAME_FORMATTING, false);
    sortColumnsByName = conf.getBoolean(Aegisthus.Feature.CONF_SORT_COLUMNS_BY_NAME, false);
    try {
        //noinspection unchecked
        columnNameConverter = (AbstractType<ByteBuffer>) TypeParser.parse(columnType);
    } catch (SyntaxException | ConfigurationException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Netflix,项目名称:aegisthus,代码行数:14,代码来源:AegisthusKeySortingComparator.java


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