當前位置: 首頁>>代碼示例>>Java>>正文


Java Composite類代碼示例

本文整理匯總了Java中me.prettyprint.hector.api.beans.Composite的典型用法代碼示例。如果您正苦於以下問題:Java Composite類的具體用法?Java Composite怎麽用?Java Composite使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Composite類屬於me.prettyprint.hector.api.beans包,在下文中一共展示了Composite類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteInSPOC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Deletes in SPOC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void deleteInSPOC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
	final Composite poc_col = new Composite();

	// predicate
	poc_col.addComponent(ids[1], BYTE_SERIALIZER);
	// object
	poc_col.addComponent(ids[2], BYTE_SERIALIZER);

	if (ids.length == 4) {
		// context
		poc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	_mutators.get().addDeletion(rowKey, S_POC, poc_col, COMPOSITE_SERIALIZER);	
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:23,代碼來源:Cassandra12xTripleIndexDAO.java

示例2: doCheckExistingRole

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Checks if the role is existing the role store.
 */
@Override
protected boolean doCheckExistingRole(String roleNameWithTenantDomain) throws UserStoreException {

    RoleContext roleContext = createRoleContext(roleNameWithTenantDomain);
    boolean isExisting = false;

    String roleName = roleContext.getRoleName();

    Composite key = new Composite();
    key.addComponent(roleName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);

    ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace,
            CompositeSerializer.get(), stringSerializer, stringSerializer);

    getCredentialQuery.setColumnFamily(CFConstants.UM_ROLES).setKey(key).setName(CFConstants.UM_ROLE_NAME);

    HColumn<String, String> result = getCredentialQuery.execute().get();
    if (result != null && result.getValue() != null) {
        isExisting = true;
    }

    return isExisting;
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:28,代碼來源:CassandraUserStoreManager.java

示例3: doCheckExistingUser

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Checks if the user is existing in the user store.
 */
@Override
protected boolean doCheckExistingUser(String userName) throws UserStoreException {

    Boolean isExist = false;

    Composite key = new Composite();
    key.addComponent(userName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);

    ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace,
            CompositeSerializer.get(), stringSerializer, stringSerializer);

    getCredentialQuery.setColumnFamily(CFConstants.UM_USER).setKey(key).setName(CFConstants.UM_USER_NAME);

    HColumn<String, String> result = getCredentialQuery.execute().get();
    if (result != null && result.getValue() != null) {
        isExist = true;
    }

    return isExist;

}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:26,代碼來源:CassandraUserStoreManager.java

示例4: doAddRole

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Adds a role to the role store.
 */
@Override
public void doAddRole(String roleName, String[] userList, boolean shared) throws UserStoreException {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    Composite composite = new Composite();
    composite.addComponent(roleName, stringSerializer);
    composite.addComponent(tenantIdString, stringSerializer);

    mutator.addInsertion(composite, CFConstants.UM_ROLES,
            HFactory.createColumn(CFConstants.UM_ROLE_NAME, roleName, stringSerializer, stringSerializer));
    mutator.addInsertion(composite, CFConstants.UM_ROLES,
            HFactory.createColumn(CFConstants.UM_TENANT_ID, tenantIdString, stringSerializer, stringSerializer));

    if (userList != null && userList.length > 0) {
        addRoleToUsersList(userList, roleName, mutator);
    }

    mutator.execute();
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:23,代碼來源:CassandraUserStoreManager.java

示例5: addUserToRoleList

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Maps the users to a role list. Adds the (username, tenantId) -> roleList
 * and (role, tenantId) -> userName
 *
 * @param userName The username of the user the roles need to be added to.
 * @param roleList The list of roles that needs to be mapped against the user.
 */
private void addUserToRoleList(String userName, String[] roleList) {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());

    if (roleList != null) {
        for (String role : roleList) {
            Composite key = new Composite();
            key.addComponent(userName, stringSerializer);
            key.addComponent(tenantIdString, stringSerializer);

            mutator.addInsertion(key, CFConstants.UM_USER_ROLE, HFactory.createColumn(role, role));

            Composite keyRole = new Composite();
            keyRole.addComponent(role, stringSerializer);
            keyRole.addComponent(tenantIdString, stringSerializer);

            mutator.addInsertion(keyRole, CFConstants.UM_ROLE_USER_INDEX, HFactory.createColumn(userName, userName));

        }
        mutator.execute();
    }
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:30,代碼來源:CassandraUserStoreManager.java

示例6: addRoleToUsersList

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Maps the role to a user list. Adds the (username, tenantId) -> roleList
 * and (role, tenantId) -> userName
 *
 * @param userNames The username list of the user the role need to be added to.
 * @param roleName  The role that needs to be mapped against the user list.
 * @param mutator   Passes the mutator and returns it with the insert statements.
 */
private Mutator<Composite> addRoleToUsersList(String[] userNames, String roleName, Mutator<Composite> mutator) {
    if (userNames != null) {
        for (String userName : userNames) {

            Composite key = new Composite();
            key.addComponent(userName, stringSerializer);
            key.addComponent(tenantIdString, stringSerializer);

            mutator.addInsertion(key, CFConstants.UM_USER_ROLE, HFactory.createColumn(roleName, roleName));

            Composite keyRole = new Composite();
            keyRole.addComponent(roleName, stringSerializer);
            keyRole.addComponent(tenantIdString, stringSerializer);

            mutator.addInsertion(keyRole, CFConstants.UM_ROLE_USER_INDEX, HFactory.createColumn(userName, userName));

        }

    }
    return mutator;
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:30,代碼來源:CassandraUserStoreManager.java

示例7: doGetUserListOfRole

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Get the list of users mapped to a role.
 */
@Override
public String[] doGetUserListOfRole(String roleName, String filter) throws UserStoreException {

    List<String> usersList = new ArrayList<String>();
    Composite key = new Composite();
    key.addComponent(roleName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);
    SliceQuery<Composite, String, String> query = HFactory
            .createSliceQuery(keyspace, CompositeSerializer.get(), StringSerializer.get(), StringSerializer.get())
            .setKey(key).setColumnFamily(CFConstants.UM_ROLE_USER_INDEX);

    ColumnSliceIterator<Composite, String, String> iterator = new ColumnSliceIterator<Composite, String, String>(
            query, null, "\uFFFF", false);

    while (iterator.hasNext()) {
        HColumn<String, String> column = iterator.next();
        usersList.add(column.getValue());
    }
    return usersList.toArray(new String[usersList.size()]);
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:24,代碼來源:CassandraUserStoreManager.java

示例8: doGetExternalRoleListOfUser

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Gets the external role list of a user.
 */
@Override
public String[] doGetExternalRoleListOfUser(String userName, String filter) throws UserStoreException {

    List<String> roles = new ArrayList<String>();
    int arrayLength = 0;
    Composite key = new Composite();
    key.addComponent(userName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);
    SliceQuery<Composite, String, String> query = HFactory
            .createSliceQuery(keyspace, CompositeSerializer.get(), StringSerializer.get(), StringSerializer.get())
            .setKey(key).setColumnFamily(CFConstants.UM_USER_ROLE);

    ColumnSliceIterator<Composite, String, String> iterator = new ColumnSliceIterator<Composite, String, String>(
            query, null, "\uFFFF", false);

    while (iterator.hasNext()) {
        HColumn<String, String> column = iterator.next();
        roles.add(column.getValue());
    }
    return roles.toArray(new String[arrayLength]);
}
 
開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:25,代碼來源:CassandraUserStoreManager.java

示例9: mapRow

import me.prettyprint.hector.api.beans.Composite; //導入依賴的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

示例10: mapRow

import me.prettyprint.hector.api.beans.Composite; //導入依賴的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

示例11: deleteInOSPC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Deletes in OPSC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void deleteInOSPC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
	final Composite spc_col = new Composite();

	spc_col.addComponent(ids[0], BYTE_SERIALIZER);
	spc_col.addComponent(ids[1], BYTE_SERIALIZER);

	if (ids.length == 4) {
		spc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	_mutators.get().addDeletion(rowKey, O_SPC, spc_col, COMPOSITE_SERIALIZER);		
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:20,代碼來源:Cassandra12xTripleIndexDAO.java

示例12: deleteInPOSC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Deletes in POSC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void deleteInPOSC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
	final Composite sc_col = new Composite();
	// subject
	sc_col.addComponent(ids[0], BYTE_SERIALIZER);

	if (ids.length == 4) {
		// context
		sc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	_mutators.get().addDeletion(rowKey, ColumnFamily.PO_SC, sc_col, COMPOSITE_SERIALIZER);
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:20,代碼來源:Cassandra12xTripleIndexDAO.java

示例13: insertInOPSC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Insert a triple in OPSC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void insertInOPSC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {
	final Composite spc_col = new Composite();
	spc_col.addComponent(ids[0], BYTE_SERIALIZER);
	spc_col.addComponent(ids[1], BYTE_SERIALIZER);
	if (ids.length == 4) {
		spc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	_mutators.get().addInsertion(rowKey, O_SPC, HFactory.createColumn(spc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:18,代碼來源:Cassandra12xTripleIndexDAO.java

示例14: insertInPOSC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Insert a triple in POSC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void insertInPOSC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {

	final Composite sc_col = new Composite();
	sc_col.addComponent(ids[0], BYTE_SERIALIZER);

	if (ids.length == 4) {
		sc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	// subject col
	_mutators.get()
		.addInsertion(rowKey, PO_SC, HFactory.createColumn(sc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER))
		.addInsertion(rowKey, PO_SC, HFactory.createColumn(P_COL, ids[1], COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:22,代碼來源:Cassandra12xTripleIndexDAO.java

示例15: insertInSPOC

import me.prettyprint.hector.api.beans.Composite; //導入依賴的package包/類
/**
 * Insert a triple in SPOC index.
 * 
 * @param rowKey the row key.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */
void insertInSPOC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {
	final Composite poc_col = new Composite();
	poc_col.addComponent(ids[1], BYTE_SERIALIZER);
	poc_col.addComponent(ids[2], BYTE_SERIALIZER);
	if (ids.length == 4) {
		poc_col.addComponent(ids[3], BYTE_SERIALIZER);
	}

	_mutators.get().addInsertion(rowKey, S_POC, HFactory.createColumn(poc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
 
開發者ID:cumulusrdf,項目名稱:cumulusrdf,代碼行數:18,代碼來源:Cassandra12xTripleIndexDAO.java


注:本文中的me.prettyprint.hector.api.beans.Composite類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。