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


Java StringSerializer.get方法代码示例

本文整理汇总了Java中com.netflix.astyanax.serializers.StringSerializer.get方法的典型用法代码示例。如果您正苦于以下问题:Java StringSerializer.get方法的具体用法?Java StringSerializer.get怎么用?Java StringSerializer.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.astyanax.serializers.StringSerializer的用法示例。


在下文中一共展示了StringSerializer.get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AstyanaxBasedHecubaClientManager

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
public AstyanaxBasedHecubaClientManager(CassandraParamsBean parameters, Serializer<K> keySerializer) {
	super(parameters);
	initialize(getClusterName(), getLocationURL(), getPort(), getKeyspace());
	this.columnFamily = new ColumnFamily<K, String>(getColumnFamilyName(), keySerializer, StringSerializer.get());
	this.keySerializer = keySerializer;

	if (columnsToIndexOnColumnNameAndValue != null && columnsToIndexOnColumnNameAndValue.size() > 0) {
		String secondaryIndexedColumnFamily = ConfigUtils.getInstance().getConfiguration().getString(
				HecubaConstants.GLOBAL_PROP_NAME_PREFIX + "." + columnFamily + ".secondaryIndexCF",
				columnFamily.getName() + HecubaConstants.SECONDARY_INDEX_CF_NAME_SUFFIX);
		this.secondaryIndexColumnFamily = new ColumnFamily<String, K>(secondaryIndexedColumnFamily,
				StringSerializer.get(), keySerializer);


	}
}
 
开发者ID:WizeCommerce,项目名称:hecuba,代码行数:17,代码来源:AstyanaxBasedHecubaClientManager.java

示例2: addEventsByUUIDAndRetrieveTimePeriod

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
@Test
public void addEventsByUUIDAndRetrieveTimePeriod() throws Exception {

    TimeSeries<String> timeSeries = new TimeSeries<>(keyspace, new ColumnFamily<>("timeSeriesColumnFamily", StringSerializer.get(), UUIDSerializer.get()));

    String key = "key";

    timeSeries.add(key, UUID.randomUUID(), new Date(10), "Data1");
    timeSeries.add(key, UUID.randomUUID(), new Date(20), "Data21");
    timeSeries.add(key, UUID.randomUUID(), new Date(20), "Data22");
    timeSeries.add(key, UUID.randomUUID(), new Date(30), "Data3");
    timeSeries.add(key, UUID.randomUUID(), new Date(40), "Data4");

    List<String> result = timeSeries.get(key, new Date(20), new Date(31), false, 100);

    assertThat(result.size()).isEqualTo(3);
}
 
开发者ID:iZettle,项目名称:izettle-toolbox,代码行数:18,代码来源:TimeSeriesIT.java

示例3: addEventsByStringAndRetrieveTimePeriod

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
@Test
public void addEventsByStringAndRetrieveTimePeriod() throws Exception {

    TimeSeries<String> timeSeries = new TimeSeries<>(keyspace, new ColumnFamily<>("timeSeriesColumnFamily", StringSerializer.get(), UUIDSerializer.get()));

    String key = "key";

    timeSeries.add(key, "Event 1", new Date(10), "Data1");
    timeSeries.add(key, "Event 2", new Date(20), "Data21");
    timeSeries.add(key, "Event 3", new Date(20), "Data22");
    timeSeries.add(key, "Event 3", new Date(20), "Data22 (duplicate will overwrite)");
    timeSeries.add(key, "Event 4", new Date(30), "Data3");
    timeSeries.add(key, "Event 5", new Date(40), "Data4");

    List<String> result = timeSeries.get(key, new Date(20), new Date(31), false, 100);

    assertThat(result.size()).isEqualTo(3);
}
 
开发者ID:iZettle,项目名称:izettle-toolbox,代码行数:19,代码来源:TimeSeriesIT.java

示例4: getHealth

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
@Override
public Health getHealth() {

    try {
        ColumnFamily<String, String> CF_SYSTEM_LOCAL =
            new ColumnFamily<String, String>( "system.local", StringSerializer.get(), StringSerializer.get(),
                StringSerializer.get() );

        OperationResult<CqlResult<String, String>> result =
            keyspace.prepareQuery( CF_SYSTEM_LOCAL )
                .setConsistencyLevel(ConsistencyLevel.CL_ONE)
                .withCql( "SELECT now() FROM system.local;" )
                .execute();

        if ( result.getResult().getRows().size() > 0 ) {
            return Health.GREEN;
        }
    }
    catch ( ConnectionException ex ) {
        logger.error( "Error connecting to Cassandra", ex );
    }

    return Health.RED;
}
 
开发者ID:apache,项目名称:usergrid,代码行数:25,代码来源:EntityCollectionManagerImpl.java

示例5: TimedEventStore

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
/**
 * @param max_event_age in ms
 */
public TimedEventStore(Keyspace keyspace, String cf_name, long max_event_age) throws ConnectionException {
	this.keyspace = keyspace;
	if (keyspace == null) {
		throw new NullPointerException("\"keyspace\" can't to be null");
	}
	if (cf_name == null) {
		throw new NullPointerException("\"cf_name\" can't to be null");
	}
	
	cf = new ColumnFamily<String, String>(cf_name, StringSerializer.get(), StringSerializer.get());
	if (CassandraDb.isColumnFamilyExists(keyspace, cf_name) == false) {
		Loggers.Cassandra.info("Create Cassandra CF " + cf_name);
		CassandraDb.createColumnFamilyString(keyspace.getKeyspaceName(), cf_name, false);
	}
	
	if (max_event_age > 0) {
		default_ttl = max_event_age;
	}
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:23,代码来源:TimedEventStore.java

示例6: AstyanaxDao

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
public AstyanaxDao(Keyspace keyspace, Class<T> entityType) {
    this.keyspace     = keyspace;
    this.entityName   = entityNameFromClass(entityType);
    this.columnFamily = new ColumnFamily<String, String>(this.entityName, StringSerializer.get(), StringSerializer.get());
    this.prefix       = "";
    
    manager = new DefaultEntityManager.Builder<T, String>()
            .withKeyspace(keyspace)
            .withColumnFamily(columnFamily)
            .withEntityType(entityType)
            .build();
}
 
开发者ID:Netflix,项目名称:staash,代码行数:13,代码来源:AstyanaxDao.java

示例7: endsOperation

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
void endsOperation() throws ConnectionException {
	if (t_event != null) {
		t_event.close();
	}
	
	if (actual_event_list.isEmpty() == false) {
		Loggers.BroadcastAutomation.debug("Start purge obsolete " + actual_event_list.size() + " event(s)");
		
		MutationBatch mutator = CassandraDb.prepareMutationBatch(CassandraDb.getDefaultKeyspacename());
		ColumnFamily<String, String> cf = new ColumnFamily<String, String>(cf_name, StringSerializer.get(), StringSerializer.get());
		
		actual_event_list.forEach((event_key) -> {
			Loggers.BroadcastAutomation.trace("Process event: clean obsolete event [" + event_key + "] from database");
			mutator.withRow(cf, event_key).delete();
		});
		
		/**
		 * Destroy all pause auto events if the playlist resumed the time
		 */
		actual_event_pause_automation_list.forEach((event_key) -> {
			Loggers.BroadcastAutomation.trace("Process event: clean obsolete pause-automation event [" + event_key + "] from database");
			mutator.withRow(cf, event_key).delete();
		});
		
		mutator.execute();
	}
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:28,代码来源:BCAAutomationEventProcessor.java

示例8: getColumnFamilyViaColumnName

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
/**
 * returns a ColumnFamily given a columnFamilyName
 * @param columnFamilyName
 * @param rowKeyClass
 * @return a constructed ColumnFamily
 */
@SuppressWarnings({"unchecked", "rawtypes"})
protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Class rowKeyClass) {
    if (rowKeyClass == String.class) {
        return new ColumnFamily(columnFamilyName, StringSerializer.get(), StringSerializer.get());
    } else if (rowKeyClass == Integer.class) {
        return new ColumnFamily(columnFamilyName, IntegerSerializer.get(), StringSerializer.get());
    } else if (rowKeyClass == Long.class) {
        return new ColumnFamily(columnFamilyName, LongSerializer.get(), StringSerializer.get());
    } else {
        throw new IllegalArgumentException("RowKeyType is not supported: " + rowKeyClass.getSimpleName() + ". String/Integer/Long are supported, or you can define the ColumnFamily yourself and use the other constructor.");
    }
}
 
开发者ID:Netflix,项目名称:Nicobar,代码行数:19,代码来源:AbstractCassandraHystrixCommand.java

示例9: SchemaVersionUpdater

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
public SchemaVersionUpdater(Keyspace keyspace) {
    this.keyspace = keyspace;
    this.columnFamily = new ColumnFamily<>(COLUMN_FAMILY_NAME, StringSerializer.get(), StringSerializer.get());
}
 
开发者ID:iZettle,项目名称:izettle-toolbox,代码行数:5,代码来源:SchemaVersionUpdater.java

示例10: SimpleReverseIndexer

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
private SimpleReverseIndexer(Builder builder) {
    indexCf = new ColumnFamily<String, IndexEntry>(builder.columnFamily + "_idx",  StringSerializer.get(), EntrySerializer);
    dataCf  = new ColumnFamily<String, String>    (builder.columnFamily + "_data", StringSerializer.get(), StringSerializer.get());
    keyspace     = builder.keyspace;
}
 
开发者ID:Netflix,项目名称:staash,代码行数:6,代码来源:SimpleReverseIndexer.java

示例11: backupCF

import com.netflix.astyanax.serializers.StringSerializer; //导入方法依赖的package包/类
public void backupCF(String basepath, String cf_name) {
	try {
		File file_basepath = new File(basepath);
		if (file_basepath.exists()) {
			CopyMove.checkExistsCanRead(file_basepath);
			CopyMove.checkIsDirectory(file_basepath);
			CopyMove.checkIsWritable(file_basepath);
		} else {
			FileUtils.forceMkdir(file_basepath);
		}
		
		Keyspace keyspace = CassandraDb.getkeyspace();
		List<ColumnFamilyDefinition> l_cdf = keyspace.describeKeyspace().getColumnFamilyList();
		
		ColumnFamilyDefinition cfd = null;
		for (int pos = 0; pos < l_cdf.size(); pos++) {
			cfd = l_cdf.get(pos);
			if (cf_name.equals(cfd.getName())) {
				break;
			}
		}
		if (cfd == null) {
			Loggers.Cassandra.debug("Backup CF " + cf_name + " canceled: CF don't exists");
			return;
		}
		
		ColumnFamily<String, String> cf = new ColumnFamily<String, String>(cf_name, StringSerializer.get(), StringSerializer.get());
		File outfile = new File(file_basepath.getAbsolutePath() + File.separator + "backup_cs_" + cf_name + ".xml");
		Loggers.Cassandra.info("Start backup Cassandra Column Family, name: " + cf_name + ", outfile: " + outfile);
		BackupDbCassandra exportcassandra = new BackupDbCassandra(keyspace, cfd, outfile);
		
		boolean result = CassandraDb.allRowsReader(cf, exportcassandra);
		exportcassandra.closeDocument();
		
		if (result == false) {
			Loggers.Cassandra.error("Backup failed...");
			return;
		}
		
		Loggers.Cassandra.debug("Start compress backup CF file: " + outfile.getPath());
		GZIPOutputStream gzos = null;
		FileInputStream fis = null;
		try {
			fis = new FileInputStream(outfile);
			gzos = new GZIPOutputStream(
					new FileOutputStream(new File(file_basepath.getAbsolutePath() + File.separator + "backup_cs_" + cf_name + "_" + Loggers.dateFilename(System.currentTimeMillis()) + ".xml.gz")));
			IOUtils.copy(fis, gzos);
			fis.close();
			gzos.close();
			FileUtils.forceDelete(outfile);
		} catch (IOException e) {
			Loggers.Cassandra.error("Can't compress backup file during backup", e);
		} finally {
			IOUtils.closeQuietly(fis);
			IOUtils.closeQuietly(gzos);
		}
		
		Loggers.Cassandra.debug("End backup, keys " + exportcassandra.getCount());
	} catch (Exception ce) {
		Loggers.Cassandra.error("Can't backup Cassandra CF " + cf_name + " in " + basepath);
	}
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:63,代码来源:BackupDb.java


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