本文整理汇总了Java中me.prettyprint.cassandra.service.template.ColumnFamilyResult类的典型用法代码示例。如果您正苦于以下问题:Java ColumnFamilyResult类的具体用法?Java ColumnFamilyResult怎么用?Java ColumnFamilyResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnFamilyResult类属于me.prettyprint.cassandra.service.template包,在下文中一共展示了ColumnFamilyResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLicenses
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
protected List<License> getLicenses( String projectVersionMetadataKey )
{
List<License> licenses = new ArrayList<>();
QueryResult<OrderedRows<String, String, String>> result =
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) //
.setColumnFamily( cassandraArchivaManager.getLicenseFamilyName() ) //
.setColumnNames( "projectVersionMetadataModel.key" ) //
.setRowCount( Integer.MAX_VALUE ) //
.addEqualsExpression( "projectVersionMetadataModel.key", projectVersionMetadataKey ) //
.execute();
for ( Row<String, String, String> row : result.get() )
{
ColumnFamilyResult<String, String> columnFamilyResult = this.licenseTemplate.queryColumns( row.getKey() );
licenses.add(
new License( columnFamilyResult.getString( NAME.toString() ), columnFamilyResult.getString( URL.toString() ) ) );
}
return licenses;
}
示例2: readAllColumns
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
public CassandraResultSet<K, String> readAllColumns(K key) throws HectorException {
try {
if (maxColumnCount > 0) {
return readColumnSlice(key, null, null, false, maxColumnCount);
} else {
ColumnFamilyResult<K, String> queriedColumns = getColumnFamily().queryColumns(key);
if (isClientAdapterDebugMessagesEnabled) {
log.info("Row retrieved from Cassandra. Exec Time (micro-sec) = " +
queriedColumns.getExecutionTimeMicro() +
", Host used = " + queriedColumns.getHostUsed() + ", Key = " + key);
}
return new HectorResultSet<K, String>(queriedColumns);
}
} catch (HectorException e) {
log.debug("HecubaClientManager error while reading key " + key.toString());
if (log.isDebugEnabled()) {
log.debug("Caught Exception", e);
// lets see whether we have any issues with the downed nodes.
logDownedHosts();
}
throw e;
}
}
示例3: readColumns
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
public CassandraResultSet<K, String> readColumns(K key, List<String> columns) throws HectorException {
ColumnFamilyResult<K, String> queriedColumns;
try {
queriedColumns = getColumnFamily().queryColumns(key, columns);
if (isClientAdapterDebugMessagesEnabled) {
log.info(columns.size() + " columns retrieved from Cassandra. Exec Time = " +
queriedColumns.getExecutionTimeMicro() + ", Host used = " +
queriedColumns.getHostUsed());
}
return new HectorResultSet<K, String>(queriedColumns);
} catch (HectorException e) {
log.error("HecubaClientManager error while retrieving " + columns.size() + " columns for key " +
key.toString());
if (log.isDebugEnabled()) {
log.debug("Caught Exception", e);
}
throw e;
}
}
示例4: mapRow
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
@Override
public List<ActorSystemEventListener> mapRow(final ColumnFamilyResult<Composite, String> results) {
List<ActorSystemEventListener> resultList = new ArrayList<>(1024);
if(results.hasResults()) {
Collection<String> actorIds = results.getColumnNames();
for (String actorId : actorIds) {
try {
resultList.add(ActorSystemEventListenerDeserializer.get().deserialize(results.getByteArray(actorId)));
} catch(IOException e) {
logger.error("IOException while deserializing ActorSystemEventListener",e);
}
}
}
return resultList;
}
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:17,代码来源:CassandraActorSystemEventListenerRepository.java
示例5: mapRow
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
@Override
public List<ScheduledMessage> mapRow(final ColumnFamilyResult<Composite, Composite> results) {
List<ScheduledMessage> resultList = new LinkedList<>();
if(results.hasResults()) {
Collection<Composite> scheduledMessages = results.getColumnNames();
for (Composite columnName : scheduledMessages) {
try {
resultList.add(scheduledMessageDeserializer.deserialize(results.getByteArray(columnName)));
} catch(IOException e) {
logger.error(e);
}
}
}
return resultList;
}
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:17,代码来源:CassandraScheduledMessageRepository.java
示例6: getMailingLists
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
protected List<MailingList> getMailingLists( String projectVersionMetadataKey )
{
List<MailingList> mailingLists = new ArrayList<>();
QueryResult<OrderedRows<String, String, String>> result =
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) //
.setColumnFamily( cassandraArchivaManager.getMailingListFamilyName() ) //
.setColumnNames( NAME.toString() ) //
.setRowCount( Integer.MAX_VALUE ) //
.addEqualsExpression( "projectVersionMetadataModel.key", projectVersionMetadataKey ) //
.execute();
for ( Row<String, String, String> row : result.get() )
{
ColumnFamilyResult<String, String> columnFamilyResult =
this.mailingListTemplate.queryColumns( row.getKey() );
MailingList mailingList = new MailingList();
mailingList.setName( columnFamilyResult.getString( NAME.toString() ) );
mailingList.setMainArchiveUrl( columnFamilyResult.getString( "mainArchiveUrl" ) );
mailingList.setPostAddress( columnFamilyResult.getString( "postAddress" ) );
mailingList.setSubscribeAddress( columnFamilyResult.getString( "subscribeAddress" ) );
mailingList.setUnsubscribeAddress( columnFamilyResult.getString( "unsubscribeAddress" ) );
List<String> otherArchives = new ArrayList<>();
for ( String columnName : columnFamilyResult.getColumnNames() )
{
if ( StringUtils.startsWith( columnName, "otherArchive." ) )
{
otherArchives.add( columnFamilyResult.getString( columnName ) );
}
}
mailingList.setOtherArchives( otherArchives );
mailingLists.add( mailingList );
}
return mailingLists;
}
示例7: getDependencies
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
protected List<Dependency> getDependencies( String projectVersionMetadataKey )
{
List<Dependency> dependencies = new ArrayList<>();
QueryResult<OrderedRows<String, String, String>> result =
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) //
.setColumnFamily( cassandraArchivaManager.getDependencyFamilyName() ) //
.setColumnNames( "projectVersionMetadataModel.key" ) //
.setRowCount( Integer.MAX_VALUE ) //
.addEqualsExpression( "projectVersionMetadataModel.key", projectVersionMetadataKey ) //
.execute();
for ( Row<String, String, String> row : result.get() )
{
ColumnFamilyResult<String, String> columnFamilyResult =
this.dependencyTemplate.queryColumns( row.getKey() );
Dependency dependency = new Dependency();
dependency.setClassifier( columnFamilyResult.getString( "classifier" ) );
dependency.setOptional( Boolean.parseBoolean( columnFamilyResult.getString( "optional" ) ) );
dependency.setScope( columnFamilyResult.getString( "scope" ) );
dependency.setSystemPath( columnFamilyResult.getString( "systemPath" ) );
dependency.setType( columnFamilyResult.getString( "type" ) );
dependency.setArtifactId( columnFamilyResult.getString( ARTIFACT_ID.toString() ) );
dependency.setGroupId( columnFamilyResult.getString( GROUP_ID.toString() ) );
dependency.setVersion( columnFamilyResult.getString( VERSION.toString() ) );
dependencies.add( dependency );
}
return dependencies;
}
示例8: getProjectReferences
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
@Override
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
QueryResult<OrderedRows<String, String, String>> result = HFactory //
.createRangeSlicesQuery( keyspace, ss, ss, ss ) //
.setColumnFamily( cassandraArchivaManager.getDependencyFamilyName() ) //
.setColumnNames( "projectVersionMetadataModel.key" ) //
.addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
.addEqualsExpression( GROUP_ID.toString(), namespace ) //
.addEqualsExpression( ARTIFACT_ID.toString(), projectId ) //
.addEqualsExpression( VERSION.toString(), projectVersion ) //
.execute();
List<String> dependenciesIds = new ArrayList<>( result.get().getCount() );
for ( Row<String, String, String> row : result.get().getList() )
{
dependenciesIds.add( getStringValue( row.getColumnSlice(), "projectVersionMetadataModel.key" ) );
}
List<ProjectVersionReference> references = new ArrayList<>( result.get().getCount() );
for ( String key : dependenciesIds )
{
ColumnFamilyResult<String, String> columnFamilyResult =
this.projectVersionMetadataTemplate.queryColumns( key );
references.add( new ProjectVersionReference( ProjectVersionReference.ReferenceType.DEPENDENCY, //
columnFamilyResult.getString( PROJECT_ID.toString() ), //
columnFamilyResult.getString( NAMESPACE_ID.toString() ), //
columnFamilyResult.getString( PROJECT_VERSION.toString() ) ) );
}
return references;
}
示例9: doAuthenticate
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
/**
* Authenticates a user given the user name and password against the user
* store.
*/
@Override
public boolean doAuthenticate(String userName, Object credential) throws UserStoreException {
String password = (String) credential;
boolean isAuthed = false;
if (!checkUserNameValid(userName)) {
log.error("Invalid Username");
return false;
}
if (!checkUserPasswordValid(credential)) {
log.error("Invalid password");
return false;
}
if (UserCoreUtil.isRegistryAnnonymousUser(userName)) {
log.error("Anonnymous user trying to login");
return false;
}
Composite key = new Composite();
key.addComponent(userName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
keyspace, CFConstants.UM_USER, CompositeSerializer.get(), StringSerializer.get());
ColumnFamilyResult<Composite, String> result = userCFTemplate.queryColumns(key);
String saltVallue = result.getString(CFConstants.UM_SALT_VALUE);
String storedPassword = result.getString(CFConstants.UM_SECRET);
if (TRUE.equalsIgnoreCase(realmConfig.getUserStoreProperty(JDBCRealmConstants.STORE_SALTED_PASSWORDS))) {
password = Util.preparePassword(password, saltVallue);
if ((storedPassword != null) && (storedPassword.equals(password))) {
isAuthed = true;
}
}
return isAuthed;
}
示例10: doGet
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected byte[] doGet(byte[] key) throws StorageException {
try {
ColumnFamilyResult<byte[], String> res = template.queryColumns(key);
return res.getByteArray(CassandraStorageSystem.COLUMN_NAME);
} catch (HectorException e) {
handleHectorException(e);
return null;
}
}
示例11: CassandraBackend
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
/**
* <p>Constructor for RrdMongoDBBackend.</p>
*
* @param path a {@link java.lang.String} object.
* @param ksp a {@link Keyspace} object.
* @param columnFamily name of cassandra column family
*/
protected CassandraBackend(String path, Keyspace ksp, String columnFamily) {
super(path);
template = new ThriftColumnFamilyTemplate<String, String>(ksp,
columnFamily,
StringSerializer.get(),
StringSerializer.get());
ColumnFamilyResult<String,String> columnFamilyResult = template.queryColumns(getPath());
if(columnFamilyResult.hasResults()){
buffer = columnFamilyResult.getByteArray(RRD);
}
}
示例12: exists
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
/**
* Determines if a storage with the given path already exists.
*
* @param path Storage path
* @return True, if such storage exists, false otherwise.
*/
@Override
protected boolean exists(String path) throws IOException {
ColumnFamilyTemplate<String, String> template =
new ThriftColumnFamilyTemplate<String, String>(ksp,
COLUMN_FAMILY_NAME,
StringSerializer.get(),
StringSerializer.get());
ColumnFamilyResult<String, String> res = template.queryColumns(path);
return res.hasResults();
}
示例13: HectorResultSet
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
public HectorResultSet(ColumnFamilyResult<K, N> originalColFamResult) {
this.originalColFamResult = originalColFamResult;
}
示例14: next
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
@Override
public ColumnFamilyResult<K, N> next() {
return originalColFamResult.next();
}
示例15: setup
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() {
resultsSet = mock(ColumnFamilyResult.class);
hectorResultSet = new HectorResultSet<Long, String>(resultsSet);
}