本文整理汇总了Java中me.prettyprint.hector.api.beans.Composite类的典型用法代码示例。如果您正苦于以下问题:Java Composite类的具体用法?Java Composite怎么用?Java Composite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Composite类属于me.prettyprint.hector.api.beans包,在下文中一共展示了Composite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: POSSlicesQueryIterator
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Builds a new iterator with the given data.
*
* @param dictionary the store dictionary.
* @param isq the indexed slice query.
* @param limit the result limit.
* @param cf the column family name.
* @param keyspace the keyspace.
*/
POSSlicesQueryIterator(
final ITopLevelDictionary dictionary,
final IndexedSlicesQuery<byte[], Composite, byte[]> isq,
final int limit,
final String cf,
final Keyspace keyspace) {
_dictionary = dictionary;
_limit = limit;
_cf = cf;
_keyspace = keyspace;
_rows = new IndexedSlicesIterator<byte[], Composite, byte[]>(isq, new byte[0]);
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:22,代码来源:POSSlicesQueryIterator.java
示例17: CAndPCSlicesQueryIterator
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Creates a new iterator iterating over the results of the given query.
*
* @param query The query.
* @param limit The maximum amount of results to return.
* @param cf The column family to query.
* @param keyspace The keyspace to use.
* @param dictionary the CumulusRDF dictionary.
* @param isPC True, if this is a PC query, false, if this is a C query.
*/
CAndPCSlicesQueryIterator(
final RangeSlicesQuery<byte[], Composite, byte[]> query,
final int limit,
final String cf,
final Keyspace keyspace,
final ITopLevelDictionary dictionary,
final boolean isPC) {
_rows = new RangeSlicesIterator<byte[], Composite, byte[]>(query, new byte[0], new byte[0]);
_limit = limit;
_cf = cf;
_keyspace = keyspace;
_dictionary = dictionary;
_isPC = isPC;
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:25,代码来源:CAndPCSlicesQueryIterator.java
示例18: insertTriple
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
@Override
public void insertTriple(final byte[][] ids) throws DataAccessLayerException {
super.insertTriple(ids);
// Insert in OC_PS
// Key: O + C
byte[] oc_row = _dictionary.compose(ids[2], ids[3]);
final Composite sp_col = new Composite();
sp_col.addComponent(ids[1], BYTE_SERIALIZER);
sp_col.addComponent(ids[0], BYTE_SERIALIZER);
// subject + predicate col
_mutators.get().addInsertion(oc_row, OC_PS, HFactory.createColumn(sp_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
// context col
_mutators.get().addInsertion(oc_row, OC_PS, HFactory.createColumn(C_COL, ids[3], COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
// Insert in SC_OP
// Key: S + C
final byte[] sc_row = _dictionary.compose(ids[0], ids[3]);
final Composite op_col = new Composite();
op_col.addComponent(ids[2], BYTE_SERIALIZER);
op_col.addComponent(ids[1], BYTE_SERIALIZER);
_mutators.get().addInsertion(sc_row, SC_OP, HFactory.createColumn(op_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
// Insert in SPC_O
// Key: S + P + C
byte[] spc_row = _dictionary.compose(ids[0], ids[1], ids[3]);
byte[] pc_val = _dictionary.compose(ids[1], ids[3]);
final Composite o_col = new Composite();
o_col.addComponent(ids[2], BYTE_SERIALIZER);
// object col
_mutators.get().addInsertion(spc_row, SPC_O, HFactory.createColumn(o_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
// predicate + context col
_mutators.get().addInsertion(spc_row, SPC_O, HFactory.createColumn(PC_COL, pc_val, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:41,代码来源:Cassandra12xQuadIndexDAO.java
示例19: spcQuery
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* A SPC query.
*
* @param query The query.
* @param limit The maximum amount of results to return.
* @return An iterator iterating over the query results.
*/
private Iterator<byte[][]> spcQuery(final byte[][] query, final int limit) {
final ColumnSliceIterator<byte[], Composite, byte[]> results = new ColumnSliceIterator<byte[], Composite, byte[]>(
HFactory.createSliceQuery(_dataAccessLayerFactory.getKeyspace(), BYTE_SERIALIZER, COMPOSITE_SERIALIZER, BYTE_SERIALIZER)
.setColumnFamily(SPC_O)
.setKey(_dictionary.compose(query[0], query[1], query[3]))
.setRange(INCLUDE_ALL_COMPOSITE_LOWER_BOUND, INCLUDE_ALL_COMPOSITE_HIGHER_BOUND, false, limit),
INCLUDE_ALL_COMPOSITE_LOWER_BOUND,
INCLUDE_ALL_COMPOSITE_HIGHER_BOUND,
false);
results.setFilter(DONT_INCLUDE_PREDICATE_COLUMN);
return new AbstractIterator<byte[][]>() {
@Override
protected byte[][] computeNext() {
if (!results.hasNext()) {
return endOfData();
}
return new byte[][] {
query[0],
query[1],
BYTE_SERIALIZER.fromByteBuffer((ByteBuffer) results.next().getName().get(0)),
query[3] };
}
};
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:34,代码来源:Cassandra12xQuadIndexDAO.java
示例20: doDeleteUser
import me.prettyprint.hector.api.beans.Composite; //导入依赖的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
注:本文中的me.prettyprint.hector.api.beans.Composite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论