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


Java ColumnFamilyTemplate类代码示例

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


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

示例1: deleteColumn

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
/**
 * Deletes a given column value of a row identified by the key.
 *
 * @param key        - key of the row.
 * @param columnName - name of the column to be deleted.
 */
public void deleteColumn(K key, String columnName) {
	final ColumnFamilyTemplate<K, String> columnFamily1 = getColumnFamily();
	final HColumn<String, String> oldValue = readColumn(key, columnName);

	// is this insertion involves a change to secondary indexes
	if (isSecondaryIndexByColumnNameAndValueEnabled && Collections.binarySearch(columnsToIndexOnColumnNameAndValue,
			columnName) >= 0 &&
			oldValue != null) {
		secondaryIndexedColumnFamilyTemplate.deleteColumn(getSecondaryIndexKey(columnName, oldValue.getValue()),
				key);
	}

	if (isSecondaryIndexesByColumnNamesEnabled && columnName.matches(secondaryIdxByColumnPattern)) {
		secondaryIndexedColumnFamilyTemplate.deleteColumn(getSecondaryIndexKey(columnName, ""), key);
	}

	columnFamily1.deleteColumn(key, columnName);
}
 
开发者ID:WizeCommerce,项目名称:hecuba,代码行数:25,代码来源:HectorBasedHecubaClientManager.java

示例2: doDeleteUser

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
/**
 * Deletes a user by userName.
 */
@Override
public void doDeleteUser(String userName) throws UserStoreException {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    String[] roles = doGetExternalRoleListOfUser(userName, "");
    for (String role : roles) {
        Composite key = new Composite();
        key.addComponent(role, stringSerializer);
        key.addComponent(tenantIdString, stringSerializer);
        ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                keyspace, CFConstants.UM_ROLE_USER_INDEX, CompositeSerializer.get(), StringSerializer.get());
        try {
            userCFTemplate.deleteColumn(key, userName);
        } catch (HectorException e) {
            log.error("Error during deletion ", e);
        }
    }

    Composite userKey = new Composite();
    userKey.addComponent(userName, stringSerializer);
    userKey.addComponent(tenantIdString, stringSerializer);
    mutator.addDeletion(userKey, CFConstants.UM_USER_ROLE, null, CompositeSerializer.get());
    mutator.addDeletion(userKey, CFConstants.UM_USER, null, CompositeSerializer.get());
    mutator.execute();

    if (log.isDebugEnabled()) {
        log.debug("Deleted user " + userName + " successfully");
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:33,代码来源:CassandraUserStoreManager.java

示例3: doAuthenticate

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的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;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:44,代码来源:CassandraUserStoreManager.java

示例4: CassandraStore

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
/** Constructor. */
public CassandraStore(String name, Keyspace keyspace,
		ColumnFamilyTemplate<byte[], String> template) {
	super(name);
	this.keyspace = keyspace;
	this.template = template;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:8,代码来源:CassandraStore.java

示例5: exists

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的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();
}
 
开发者ID:ChaosXu,项目名称:rrd4j-cassandra,代码行数:17,代码来源:CassandraBackendFactory.java

示例6: update

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
private void update(ColumnFamilyTemplate<String, String> template) {
    ColumnFamilyUpdater<String, String> updater = template.createUpdater("a key");
    updater.setString("domain", "www.chaosxu.com");
    updater.setLong("time", System.currentTimeMillis());

    template.update(updater);
}
 
开发者ID:ChaosXu,项目名称:rrd4j-cassandra,代码行数:8,代码来源:HectorTest.java

示例7: doUpdateUserListOfRole

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
/**
 * Update the user list mapped to a role.
 */
@Override
public void doUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers)
        throws UserStoreException {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    RoleContext ctx = createRoleContext(roleName);
    roleName = ctx.getRoleName();
    boolean isShared = ctx.isShared();
    if (!isShared) {
        //TODO TO BE Implemented
    }
    if (deletedUsers != null && deletedUsers.length > 0) {
        if (isShared) {
            //TODO TO BE Implemented
        } else {
            if (deletedUsers.length > 0) {
                Composite key = new Composite();
                key.addComponent(roleName, stringSerializer);
                key.addComponent(tenantIdString, stringSerializer);

                for (String user : deletedUsers) {

                    Composite userKey = new Composite();
                    userKey.addComponent(user, stringSerializer);
                    userKey.addComponent(tenantIdString, stringSerializer);

                    ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                            keyspace, CFConstants.UM_USER_ROLE, CompositeSerializer.get(), StringSerializer.get());
                    ColumnFamilyTemplate<Composite, String> roleCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                            keyspace, CFConstants.UM_ROLE_USER_INDEX, CompositeSerializer.get(),
                            StringSerializer.get());
                    try {
                        roleCFTemplate.deleteColumn(mutator, key, user);
                        userCFTemplate.deleteColumn(mutator, userKey, roleName);
                    } catch (HectorException e) {
                        log.error(e.getMessage(), e);
                        throw new UserStoreException("Error during the updating of a user's role list");
                    }
                }
            }

        }
    }
    // need to clear user roles cache upon roles update
    clearUserRolesCacheByTenant(this.tenantId);

    if (newUsers != null && newUsers.length > 0) {
        if (isShared) {
            //TODO TO BE Implemented
        } else {
            addRoleToUsersList(newUsers, roleName, mutator);
        }
    }
    mutator.execute();

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:60,代码来源:CassandraUserStoreManager.java

示例8: getColumnFamilyTemplates

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
public List<ColumnFamilyTemplate<K, String>> getColumnFamilyTemplates() {
	return columnFamilyTemplates;
}
 
开发者ID:WizeCommerce,项目名称:hecuba,代码行数:4,代码来源:HectorBasedHecubaClientManager.java

示例9: getColumnFamily

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
ColumnFamilyTemplate<K, String> getColumnFamily() {
	return columnFamilyTemplates.get(0);
}
 
开发者ID:WizeCommerce,项目名称:hecuba,代码行数:4,代码来源:HectorBasedHecubaClientManager.java

示例10: test

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
@Test
public void test() {
    Cluster cluster = HFactory.getOrCreateCluster("test-cluster","localhost:9160");

    KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(KEYSPACE);

    if (keyspaceDef == null)
        createSchema(cluster, KEYSPACE);

    Keyspace ksp = HFactory.createKeyspace(KEYSPACE, cluster);

    ColumnFamilyTemplate<String, String> template =
            new ThriftColumnFamilyTemplate<String, String>(ksp,
                    COLUMN_FAMILY_NAME,
                    StringSerializer.get(),
                    StringSerializer.get());

    update(template);

    query(ksp);

    //delete(template);

}
 
开发者ID:ChaosXu,项目名称:rrd4j-cassandra,代码行数:25,代码来源:HectorTest.java

示例11: delete

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
private void delete(ColumnFamilyTemplate<String, String> template) {
    ColumnFamilyResult<String, String> res = template.queryColumns("a key");
    String value = res.getString("domain");
    template.deleteColumn("key", "column name");
}
 
开发者ID:ChaosXu,项目名称:rrd4j-cassandra,代码行数:6,代码来源:HectorTest.java

示例12: setColumnFamilyTemplate

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
public void setColumnFamilyTemplate(ColumnFamilyTemplate<Composite, String> columnFamilyTemplate) {
    this.columnFamilyTemplate = columnFamilyTemplate;
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:4,代码来源:CassandraPersistentActorRepository.java

示例13: PersistentActorUpdateEventProcessor

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
public PersistentActorUpdateEventProcessor(ColumnFamilyTemplate<Composite, String> columnFamilyTemplate) {
    this.columnFamilyTemplate = columnFamilyTemplate;
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:4,代码来源:PersistentActorUpdateEventProcessor.java

示例14: CassandraActorSystemEventListenerRepository

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
public CassandraActorSystemEventListenerRepository(String clusterName, ColumnFamilyTemplate<Composite, String> columnFamilyTemplate) {
    this.clusterName = clusterName;
    this.columnFamilyTemplate = columnFamilyTemplate;
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:5,代码来源:CassandraActorSystemEventListenerRepository.java

示例15: CassandraScheduledMessageRepository

import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate; //导入依赖的package包/类
public CassandraScheduledMessageRepository(String clusterName, ColumnFamilyTemplate<Composite, Composite> columnFamilyTemplate, ScheduledMessageDeserializer scheduledMessageDeserializer) {
    this.clusterName = clusterName;
    this.columnFamilyTemplate = columnFamilyTemplate;
    this.scheduledMessageDeserializer = scheduledMessageDeserializer;
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:6,代码来源:CassandraScheduledMessageRepository.java


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