本文整理汇总了Java中org.waveprotocol.wave.model.wave.ParticipantId类的典型用法代码示例。如果您正苦于以下问题:Java ParticipantId类的具体用法?Java ParticipantId怎么用?Java ParticipantId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParticipantId类属于org.waveprotocol.wave.model.wave包,在下文中一共展示了ParticipantId类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getProfile
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public Profile getProfile(ParticipantId pid) {
String id = pid.getAddress();
ProfileImpl profile = profiles.get(id);
if (profile == null) {
if (contacts.containsKey(id)) {
try {
profile = profileFromContact(contacts.get(id));
} catch (InvalidParticipantAddress e) {
LOG.log(Level.WARNING, "Invalid contact address: ", contacts.get(id).getAddress());
contacts.remove(id);
profile = profileFromThinAir(pid);
}
} else {
profile = profileFromThinAir(pid);
}
profiles.put(id, profile);
}
return profile;
}
开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:21,
代码来源:ContactsManager.java
示例2: buildSupplement
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Builds the supplement model for a wave.
*
* @param operation the operation.
* @param context the operation context.
* @param participant the viewer.
* @return the wave supplement.
* @throws InvalidRequestException if the wave id provided in the operation is
* invalid.
*/
public static SupplementedWave buildSupplement(OperationRequest operation,
OperationContext context, ParticipantId participant) throws InvalidRequestException, OperationException {
OpBasedWavelet wavelet = context.openWavelet(operation, participant);
ConversationView conversationView = context.getConversationUtil().buildConversation(wavelet);
// TODO (Yuri Z.) Find a way to obtain an instance of IdGenerator and use it
// to create udwId.
String waveIdStr = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID);
WaveId waveId = null;
try {
waveId = ApiIdSerializer.instance().deserialiseWaveId(waveIdStr);
} catch (InvalidIdException e) {
throw new InvalidRequestException("Invalid WAVE_ID parameter: " + waveIdStr, operation, e);
}
WaveletId udwId = buildUserDataWaveletId(participant, waveId.getDomain());
OpBasedWavelet udw = context.openWavelet(waveId, udwId, participant);
PrimitiveSupplement udwState = WaveletBasedSupplement.create(udw);
SupplementedWave supplement =
SupplementedWaveImpl.create(udwState, conversationView, participant, DefaultFollow.ALWAYS);
return supplement;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:34,
代码来源:OperationUtil.java
示例3: initializeAllWavesSeens
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public synchronized void initializeAllWavesSeens() throws WaveletStateException, WaveServerException {
ExceptionalIterator<WaveId, WaveServerException> witr = waveletProvider.getWaveIds();
int i=0;
while (witr.hasNext()) {
WaveId waveId = witr.next();
LOG.info("Initialize seens on wave " + waveId.serialise() + " ...");
for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
try {
if (IdUtil.isUserDataWavelet(waveletId)) {
ParticipantId participant = ParticipantId.of(IdUtil.getUserDataWaveletAddress(waveletId));
LOG.info("Initialize seen on wavelet " + waveletId.serialise() + " ...");
setSeenVersion(WaveletName.of(waveId, waveletId), participant);
}
} catch (Exception ex) {
LOG.log(Level.SEVERE, "Initialize seen on wavelet " + waveletId.serialise() + " error", ex);
}
}
LOG.info("Seens on " + ++i + " waves has been initialized");
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:21,
代码来源:InitSeensWavelet.java
示例4: DataApiOAuthServlet
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Inject
public DataApiOAuthServlet(@Named("request_token_path") String requestTokenPath,
@Named("authorize_token_path") String authorizeTokenPath,
@Named("access_token_path") String accessTokenPath,
@Named("all_tokens_path") String allTokensPath,
OAuthServiceProvider serviceProvider,
OAuthValidator validator, DataApiTokenContainer tokenContainer,
SessionManager sessionManager, TokenGenerator tokenGenerator) {
this.requestTokenPath = requestTokenPath;
this.authorizeTokenPath = authorizeTokenPath;
this.accessTokenPath = accessTokenPath;
this.allTokensPath = allTokensPath;
this.serviceProvider = serviceProvider;
this.validator = validator;
this.tokenContainer = tokenContainer;
this.sessionManager = sessionManager;
this.tokenGenerator = tokenGenerator;
this.xsrfTokens =
CacheBuilder.newBuilder()
.expireAfterWrite(XSRF_TOKEN_TIMEOUT_HOURS, TimeUnit.HOURS)
.<ParticipantId, String>build().asMap();
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:23,
代码来源:DataApiOAuthServlet.java
示例5: continueThread
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Implementation of the {@link OperationType#BLIP_CONTINUE_THREAD} method. It
* appends a new blip to the end of the thread of the blip specified in the
* operation.
*
* @param operation the operation to execute.
* @param context the context of the operation.
* @param participant the participant performing this operation.
* @param conversation the conversation to operate on.
* @throws InvalidRequestException if the operation fails to perform
*/
private void continueThread(OperationRequest operation, OperationContext context,
ParticipantId participant, ObservableConversation conversation)
throws InvalidRequestException, OperationException {
Preconditions.checkArgument(
OperationUtil.getOperationType(operation) == OperationType.BLIP_CONTINUE_THREAD,
"Unsupported operation " + operation);
BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);
String parentBlipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
ConversationBlip parentBlip = context.getBlip(conversation, parentBlipId);
ConversationBlip newBlip = parentBlip.getThread().appendBlip();
context.putBlip(blipData.getBlipId(), newBlip);
putContentForNewBlip(newBlip, blipData.getContent());
processBlipCreatedEvent(operation, context, participant, conversation, newBlip);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:29,
代码来源:BlipOperationServices.java
示例6: run
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public void run(CheckedTransaction tx, SlobId convId, List<ChangeData<String>> newDeltas,
long resultingVersion, ReadableSlob resultingState)
throws RetryableFailure, PermanentFailure {
ImmutableSet.Builder<ParticipantId> out = ImmutableSet.builder();
for (ChangeData<String> delta : newDeltas) {
WaveletOperation op;
try {
op = SERIALIZER.deserializeDelta(delta.getPayload());
} catch (MessageException e) {
throw new RuntimeException("Malformed op: " + delta, e);
}
if (op instanceof RemoveParticipant) {
out.add(((RemoveParticipant) op).getParticipantId());
}
}
ImmutableSet<ParticipantId> removedParticipants = out.build();
if (!removedParticipants.isEmpty()) {
log.info("Will unindex " + convId + " for " + removedParticipants);
tx.enqueueTask(postCommitActionQueue,
TaskOptions.Builder.withPayload(
new HandleRemovedParticipantsTask(convId, removedParticipants)));
}
}
开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:25,
代码来源:IndexTask.java
示例7: serializeBlip
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public Blob serializeBlip(RawBlipSnapshot snapshot) {
Timer timer = Timing.start("RawBlipSerializer.serializeBlip");
try {
ProtoBlipSnapshot serialized = adaptor.createBlipSnapshot();
serialized.setAuthor(snapshot.getAuthor().toString());
for (ParticipantId contributor : snapshot.getContributors()) {
serialized.addContributor(contributor.getAddress());
}
serialized.setCreationTime(snapshot.getCreationTime());
serialized.setCreationVersion(snapshot.getCreationVersion());
serialized.setLastModifiedTime(snapshot.getLastModifiedTime());
serialized.setLastModifiedVersion(snapshot.getLastModifiedVersion());
ProtoDocumentSnapshot docSnapshot = adaptor.createDocumentSnapshot();
docSnapshot.setDocumentSnapshot(operationSerializer.serialize(snapshot.getContent()));
serialized.setRawDocumentSnapshot(adaptor.toJson(docSnapshot));
return new Blob(adaptor.toJson(serialized));
} finally {
Timing.stop(timer);
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:22,
代码来源:RawBlipSerializer.java
示例8: StagesProvider
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* @param waveElement the DOM element to become the conversationView panel.
* @param waveFrame the conversationView frame.
* @param waveHolder a panel that this an ancestor of waveElement. This is
* used for adopting to the GWT widget tree.
* @param waveRef the id of the conversationView to open. If null, it means, install a new
* conversationView.
* @param webSocket the WebSocket of connection.
* @param isNewWave true if the conversationView is a new client-created conversationView
* @param profileManager the manager of user profiles.
* @param waveStore access to a group of open waves.
* @param idGenerator the generator of Ids.
* @param localDomain local domain.
* @param participants the participants to add to the newly created conversationView. null
* if only the creator should be added
* @param fromLastRead if true, the wave should be opened with diffs
* @param searchPresenter the search presenter.
* @param loadingIndicator the indicator of loading.
* @param errorPopup the error popup.
*/
public StagesProvider(Element waveElement, FramedPanel waveFrame, ImplPanel waveHolder,
WaveRef waveRef, WaveWebSocketClient webSocket, IdGenerator idGenerator, ProfileManager profileManager,
WaveStore waveStore, boolean isNewWave, String localDomain, Set<ParticipantId> participants,
boolean fromLastRead, SearchPresenter searchPresenter, LoadingIndicator loadingIndicator,
UniversalPopup errorPopup) {
this.waveElement = waveElement;
this.waveFrame = waveFrame;
this.waveHolder = waveHolder;
this.waveRef = waveRef;
this.webSocket = webSocket;
this.idGenerator = idGenerator;
this.profileManager = profileManager;
this.waveStore = waveStore;
this.newWave = isNewWave;
this.localDomain = localDomain;
this.participants = participants;
this.fromLastRead = fromLastRead;
this.searchPresenter = searchPresenter;
this.loadingIndicator = loadingIndicator;
this.errorPopup = errorPopup;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:42,
代码来源:StagesProvider.java
示例9: appendBlip
点赞 3
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Implementation for the {@link OperationType#WAVELET_APPEND_BLIP} method. It
* appends a blip at the end of the root thread.
*
* @param operation the operation to execute.
* @param context the context of the operation.
* @param participant the participant performing this operation.
* @param conversation the conversation to operate on.
* @throws InvalidRequestException if the operation fails to perform
*/
private void appendBlip(OperationRequest operation, OperationContext context,
ParticipantId participant, ObservableConversation conversation)
throws InvalidRequestException, OperationException {
Preconditions.checkArgument(
OperationUtil.getOperationType(operation) == OperationType.WAVELET_APPEND_BLIP,
"Unsupported operation " + operation);
BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);
ObservableConversationBlip newBlip = conversation.getRootThread().appendBlip();
context.putBlip(blipData.getBlipId(), newBlip);
putContentForNewBlip(newBlip, blipData.getContent());
processBlipCreatedEvent(operation, context, participant, conversation, newBlip);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:26,
代码来源:BlipOperationServices.java
示例10: deserializeOperation
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* The extra parameters are required because they are not present in the
* serialized form of a wavelet operation.
*/
public WaveletOperation deserializeOperation(ProtocolWaveletOperation message,
ParticipantId creator, long timestamp) throws MessageException {
try {
return OperationFactory.createWaveletOperation(
new WaveletOperationContext(creator, timestamp, 1), message);
} catch (InvalidInputException e) {
throw new MessageException(e);
}
}
开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:14,
代码来源:WaveSerializer.java
示例11: internalCreateBlip
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public LazyContentBlipDataImpl internalCreateBlip(String docId, ParticipantId author,
Collection<ParticipantId> contributors, DocInitialization content,
long creationTime, long creationVersion,
long lastModifiedTime, long lastModifiedVersion) {
LazyContentBlipDataImpl blip = createBlip(docId);
blip.setDocInitialization(content);
blip.setAuthor(author);
blip.setContributors(contributors);
blip.setCreationTime(creationTime);
blip.setCreationVersion(creationVersion);
blip.setLastModifiedTime(lastModifiedTime);
blip.setLastModifiedVersion(lastModifiedVersion);
return blip;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:16,
代码来源:WaveletFragmentDataImpl.java
示例12: onBlipDataContributorRemoved
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public void onBlipDataContributorRemoved(BlipData blip, ParticipantId contributorId) {
OpBasedBlip oblip = adapt(blip);
for (WaveletListener l : listeners) {
l.onBlipContributorRemoved(OpBasedWavelet.this, oblip, contributorId);
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:8,
代码来源:OpBasedWavelet.java
示例13: BlipDataImpl
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Creates a blip.
*
* @param id the id of this blip
* @param waveletInterface the interface to wavelet containing this blip
* @param author the author of this blip
* @param contributors the contributors of this blip
* @param content XML document of this blip
* @param lastModifiedTime the last modified time of this blip
* @param lastModifiedVersion the last modified version of this blip
*/
BlipDataImpl(String id, WaveletDataListenerManager listenerManager,
ParticipantId author, Collection<ParticipantId> contributors, DocumentOperationSink content,
long creationTime, long creationVersion,
long lastModifiedTime, long lastModifiedVersion) {
super(id, listenerManager, author, content, creationTime, creationVersion, lastModifiedTime, lastModifiedVersion);
this.contributors = new LinkedHashSet<>();
if (contributors != null) {
for (ParticipantId contributor : contributors) {
Preconditions.checkNotNull(contributor, "contributor is null");
this.contributors.add(contributor);
}
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:25,
代码来源:BlipDataImpl.java
示例14: initializePodium
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
private void initializePodium() {
if (!isActive()) {
// If the widget does not exist, exit.
return;
}
log("GW.initializePodium");
for (ParticipantId participant : blip.getConversation().getParticipantIds()) {
String myId = participants.getMyId();
if ((myId != null) && !participant.getAddress().equals(myId)) {
String opponentId = participant.getAddress();
try {
log("GW.sendPodiumOnInitializedRpc");
GadgetRpcSender.sendPodiumOnInitializedRpc(getGadgetName(), myId, opponentId);
log("Sent Podium initialization: " + myId + " " + opponentId);
String podiumState = state.get(PODIUM_STATE_NAME);
if (podiumState != null) {
log("GWT.sendPodiumOnStateChangedRpc");
GadgetRpcSender.sendPodiumOnStateChangedRpc(getGadgetName(), podiumState);
log("Sent Podium state update.");
}
} catch (Exception e) {
// This is a catch to avoid sending RPCs to deleted gadgets.
log("Podium initialization failure");
}
return;
}
}
log("Podium is not initialized: less than two participants.");
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:30,
代码来源:GadgetWidget.java
示例15: getProfile
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public ProfileImpl getProfile(ParticipantId participantId) {
ProfileImpl profile = profiles.get(participantId.getAddress());
if (profile == null) {
profile = new ProfileImpl(this, participantId);
profiles.put(participantId.getAddress(), profile);
}
return profile;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:11,
代码来源:ProfileManagerImpl.java
示例16: storeContacts
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public synchronized void storeContacts(ParticipantId participantId, List<Contact> contacts)
throws PersistenceException {
lifeCycle.enter();
try {
LOG.info("Store contacts for " + participantId.getAddress());
File file = getContactsFile(participantId);
FileOutputStream out = null;
try {
ProtoContacts.Builder proto = ProtoContacts.newBuilder();
for (Contact contact : contacts) {
proto.addContact(
ProtoContacts.Contact.newBuilder()
.setParticipant(contact.getParticipantId().getAddress())
.setLastContactTime(contact.getLastContactTime())
.setScoreBonus(contact.getScoreBonus()));
}
byte bytes[] = proto.build().toByteArray();
out = new FileOutputStream(file);
out.write(bytes);
out.flush();
} catch (IOException ex) {
throw new PersistenceException(ex);
} finally {
FileUtils.closeAndIgnoreException(out, file, LOG);
}
} finally {
lifeCycle.leave();
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:31,
代码来源:FileContactStore.java
示例17: monitorContribution
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Starts propagating updates of contributor {@code c}'s profile to the
* contributor rendering of blip {@code b}.
*/
public void monitorContribution(ConversationBlip b, ParticipantId c) {
IdentitySet<ConversationBlip> blips = contributions.get(c.getAddress());
if (blips == null) {
blips = CollectionUtils.createIdentitySet();
contributions.put(c.getAddress(), blips);
}
blips.add(b);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:13,
代码来源:LiveProfileRenderer.java
示例18: removeParticipant
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public boolean removeParticipant(ParticipantId p, WaveletOperationContext opContext) {
Set<ParticipantId> participants = getMutableParticipants();
if (!participants.remove(p)) {
return false;
}
getListenerManager().onParticipantRemoved(p, opContext);
return true;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:AbstractWaveletData.java
示例19: serialize
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/** Serialize to protobuf. */
@Override
public VersionInfoRecord serialize(List<ParticipantId> authors) {
VersionInfoRecord.Builder record = VersionInfoRecord.newBuilder();
record.setVersion(version);
if (author != null) {
int authorIndex = authors.indexOf(author);
Preconditions.checkArgument(authorIndex != -1, "Author " + author.toString() + " is not registered");
record.setAuthor(authorIndex);
}
if (timestamp !=0) {
record.setTimestamp(timestamp);
}
return record.build();
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:16,
代码来源:VersionInfoImpl.java
示例20: insertInlineBlip
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Implementation for the {@link OperationType#DOCUMENT_INSERT_INLINE_BLIP}
* method. It inserts an inline blip at the location specified in the
* operation.
*
* @param operation the operation to execute.
* @param context the context of the operation.
* @param participant the participant performing this operation.
* @param wavelet the wavelet to operate on.
* @param conversation the conversation to operate on.
* @throws InvalidRequestException if the operation fails to perform
*/
private void insertInlineBlip(OperationRequest operation, OperationContext context,
ParticipantId participant, ObservableWavelet wavelet, ObservableConversation conversation)
throws InvalidRequestException, OperationException {
Preconditions.checkArgument(
OperationUtil.getOperationType(operation) == OperationType.DOCUMENT_INSERT_INLINE_BLIP,
"Unsupported operation " + operation);
BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);
String parentBlipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
ConversationBlip parentBlip = context.getBlip(conversation, parentBlipId);
Integer index = OperationUtil.getRequiredParameter(operation, ParamsProperty.INDEX);
if (index <= 0) {
throw new InvalidRequestException(
"Can't inline a blip on position <= 0, got " + index, operation);
}
ApiView view = new ApiView(parentBlip.getDocument(), wavelet);
int xmlLocation = view.transformToXmlOffset(index);
// Insert new inline thread with the blip at the location as specified.
ConversationBlip newBlip = parentBlip.addReplyThread(xmlLocation).appendBlip();
context.putBlip(blipData.getBlipId(), newBlip);
putContentForNewBlip(newBlip, blipData.getContent());
processBlipCreatedEvent(operation, context, participant, conversation, newBlip);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:40,
代码来源:BlipOperationServices.java
示例21: BlockHeader
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
BlockHeader(BlockHeaderRecord serialized, List<SegmentId> serializedSegmentIds, List<ParticipantId> authors) {
this.blockId = serialized.getBlockId();
this.serialized = serialized;
this.serializedSegmentIds = serializedSegmentIds;
this.authors = authors;
this.lastModifiedVersion = serialized.getLastModifiedVersion();
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:8,
代码来源:BlockHeader.java
示例22: put
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public void put(final Record record) throws PermanentFailure {
Preconditions.checkNotNull(record, "Null record");
log.info("Putting record " + record);
final StableUserId userId = record.getUserId();
ParticipantId participantId = record.getParticipantId();
OAuthCredentials credentials = record.getOAuthCredentials();
String refreshToken = credentials == null ? null : credentials.getRefreshToken();
String accessToken = credentials == null ? null : credentials.getAccessToken();
final Entity entity = new Entity(makeKey(userId));
DatastoreUtil.setNonNullIndexedProperty(entity, STABLE_USER_ID_PROPERTY, userId.getId());
DatastoreUtil.setNonNullIndexedProperty(
entity, USER_EMAIL_PROPERTY, participantId.getAddress());
DatastoreUtil.setOrRemoveUnindexedProperty(entity, REFRESH_TOKEN_PROPERTY, refreshToken);
DatastoreUtil.setOrRemoveUnindexedProperty(entity, ACCESS_TOKEN_PROPERTY, accessToken);
new RetryHelper().run(new RetryHelper.VoidBody() {
@Override public void run() throws RetryableFailure, PermanentFailure {
CheckedTransaction tx = datastore.beginTransaction();
log.info("About to put " + entity);
tx.put(entity);
memcache.enqueuePutNull(tx, userId);
tx.commit();
log.info("Committed " + tx);
}
});
memcache.delete(userId);
}
开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:30,
代码来源:AccountStore.java
示例23: create
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Creates a blip.
*/
static public BlipData create(String id,
WaveletDataListenerManager waveletListenerManager,
ParticipantId author, Collection<ParticipantId> contributors, DocumentOperationSink operationSink,
long creationTime, long creationVersion, long lastModifiedTime, long lastModifiedVersion) {
return new BlipDataImpl(id, waveletListenerManager, author, contributors, operationSink,
creationTime, creationVersion, lastModifiedTime, lastModifiedVersion);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:11,
代码来源:BlipDataImpl.java
示例24: create
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public OpBasedWavelet create(WaveId waveId, WaveletId waveletId, ParticipantId creator) {
long now = System.currentTimeMillis();
HashedVersion v0 = HashedVersion.unsigned(0);
ObservableWaveletData waveData = holderFactory
.create(new EmptyWaveletSnapshot(waveId, waveletId, creator, v0, now));
lastContextFactory = new MockWaveletOperationContextFactory().setParticipantId(author);
lastAuthoriser = new MockParticipationHelper();
SilentOperationSink<WaveletOperation> executor =
Executor.<WaveletOperation, WaveletData>build(waveData);
SilentOperationSink<WaveletOperation> out = new VersionIncrementingSink(waveData, sink);
return new OpBasedWavelet(waveId, waveData, lastContextFactory, lastAuthoriser, executor, out);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:14,
代码来源:OpBasedWaveletFactory.java
示例25: compose
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Composes the given aggregate operations.
*
* @param operations The aggregate operations to compose.
* @return The composition of the given operations.
*/
static AggregateOperation compose(Iterable<AggregateOperation> operations) {
// NOTE(user): It's possible to replace the following two sets with a single map.
Set<SegmentId> segmentsToRemove = new TreeSet<SegmentId>(segmentComparator);
Set<SegmentId> segmentsToAdd = new TreeSet<SegmentId>(segmentComparator);
Set<SegmentId> segmentsToEndModifying = new TreeSet<SegmentId>(segmentComparator);
Set<SegmentId> segmentsToStartModifying = new TreeSet<SegmentId>(segmentComparator);
Set<ParticipantId> participantsToRemove = new TreeSet<ParticipantId>(participantComparator);
Set<ParticipantId> participantsToAdd = new TreeSet<ParticipantId>(participantComparator);
Map<String, DocOpList> docOps = new TreeMap<String, DocOpList>();
for (AggregateOperation operation : operations) {
composeIds(operation.segmentsToRemove, segmentsToRemove, segmentsToAdd);
composeIds(operation.segmentsToAdd, segmentsToAdd, segmentsToRemove);
composeIds(operation.segmentsToEndModifying, segmentsToEndModifying, segmentsToStartModifying);
composeIds(operation.segmentsToStartModifying, segmentsToStartModifying, segmentsToEndModifying);
composeIds(operation.participantsToRemove, participantsToRemove, participantsToAdd);
composeIds(operation.participantsToAdd, participantsToAdd, participantsToRemove);
for (DocumentOperations documentOps : operation.docOps) {
DocOpList docOpList = docOps.get(documentOps.id);
if (docOpList != null) {
docOps.put(documentOps.id, docOpList.concatenateWith(documentOps.operations));
} else {
docOps.put(documentOps.id, documentOps.operations);
}
}
}
return new AggregateOperation(
new ArrayList<SegmentId>(segmentsToRemove),
new ArrayList<SegmentId>(segmentsToAdd),
new ArrayList<SegmentId>(segmentsToEndModifying),
new ArrayList<SegmentId>(segmentsToStartModifying),
new ArrayList<ParticipantId>(participantsToRemove),
new ArrayList<ParticipantId>(participantsToAdd),
mapToList(docOps));
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:41,
代码来源:AggregateOperation.java
示例26: doGet
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Creates HTTP response to the search query. Main entrypoint for this class.
*/
@Override
@VisibleForTesting
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws IOException {
ParticipantId user = sessionManager.getLoggedInUser(req.getSession(false));
if (user == null) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
SearchRequest searchRequest = parseSearchRequest(req, response);
SearchResult searchResult = performSearch(searchRequest, user);
serializeObjectToServlet(searchResult.getDigests(), response);
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:16,
代码来源:NotificationServlet.java
示例27: MemorySearchImpl
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Inject
public MemorySearchImpl(final WaveMap waveMap) {
// Let the view expire if it not accessed for some time.
explicitPerUserWaveViews =
CacheBuilder.newBuilder().expireAfterAccess(PER_USER_WAVES_VIEW_CACHE_MINUTES, TimeUnit.MINUTES).build(new CacheLoader<ParticipantId, Multimap<WaveId, WaveletId>>() {
@Override
public Multimap<WaveId, WaveletId> load(ParticipantId user) throws Exception {
Multimap<WaveId, WaveletId> userView = HashMultimap.create();
// Create initial per user waves view by looping over all waves
// in the waves store.
ExceptionalIterator<WaveId, WaveServerException> waveIds = waveMap.getWaveIds();
while (waveIds.hasNext()) {
WaveId waveId = waveIds.next();
ImmutableSet<WaveletId> wavelets = waveMap.getWaveletIds(waveId);
for (WaveletId waveletId : wavelets) {
LocalWaveletContainer c = waveMap.getLocalWavelet(WaveletName.of(waveId, waveletId));
try {
if (!c.hasParticipant(user)) {
continue;
}
// Add this wave to the user view.
userView.put(waveId, waveletId);
} catch (WaveletStateException e) {
LOG.warning("Failed to access wavelet " + c.getWaveletName(), e);
}
}
}
LOG.info("Initalized waves view for user: " + user.getAddress()
+ ", number of waves in view: " + userView.size());
return userView;
}
});
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:35,
代码来源:MemorySearchImpl.java
示例28: testPasswordDigestVerifies
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public void testPasswordDigestVerifies() {
HumanAccountData account =
new HumanAccountDataImpl(ParticipantId.ofUnsafe("[email protected]"),
new PasswordDigest("wonderflownium".toCharArray()));
assertNotNull(account.getPasswordDigest());
assertTrue(account.getPasswordDigest().verify("wonderflownium".toCharArray()));
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:9,
代码来源:HumanAccountDataImplTest.java
示例29: CoreAddParticipant
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Creates an add-participant operation.
*
* @param participant participant to add
*/
public CoreAddParticipant(ParticipantId participant) {
if (participant == null) {
throw new NullPointerException("Null participant ID");
}
this.participant = participant;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:12,
代码来源:CoreAddParticipant.java
示例30: unregister
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public RobotAccountData unregister(ParticipantId robotId) throws RobotRegistrationException,
PersistenceException {
Preconditions.checkNotNull(robotId);
AccountData accountData = accountStore.getAccount(robotId);
if (accountData == null) {
return null;
}
throwExceptionIfNotRobot(accountData);
RobotAccountData robotAccount = accountData.asRobot();
removeRobotAccount(robotAccount);
return robotAccount;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:14,
代码来源:RobotRegistrarImpl.java
示例31: getCreator
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public ParticipantId getCreator() throws WaveletStateException {
long version = getLastModifiedVersion().getVersion();
if (version == 0) {
return null;
}
Map<SegmentId, Interval> intervals =
getIntervals(Collections.singleton(SegmentId.PARTICIPANTS_ID), version, true);
Preconditions.checkArgument(intervals.size() == 1, "Can't get participant segment");
Interval interval = intervals.values().iterator().next();
ReadableParticipantsSnapshot snapshot = (ReadableParticipantsSnapshot)interval.getSnapshot(version);
return snapshot.getCreator();
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:14,
代码来源:SegmentWaveletStateImpl.java
示例32: RawBlipSnapshot
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public RawBlipSnapshot(Serializer serializer, String documentId, ParticipantId author,
ImmutableSet<ParticipantId> contributors, DocInitialization content,
long creationTime, long creationVersion,
long lastModifiedTime, long lastModifiedVersion) {
this.serializer = serializer;
this.documentId = documentId;
this.author = author;
this.contributors = contributors;
this.content = content;
this.creationTime = creationTime;
this.creationVersion = creationVersion;
this.lastModifiedTime = lastModifiedTime;
this.lastModifiedVersion = lastModifiedVersion;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:RawBlipSnapshot.java
示例33: subscribe
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public synchronized WaveletSubscription subscribe(WaveletName waveletName, ParticipantId participantId,
String channelId, String connectionId, ClientFrontend.UpdateChannelListener listener) {
WaveletSubscription subscription =
new WaveletSubscription(waveletName, participantId, channelId, connectionId, listener);
waveletSubscriptions.put(waveletName, subscription);
channelSubscriptions.put(channelId, subscription);
connectionSubscriptions.put(connectionId, subscription);
return subscription;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:WaveletSubscriptions.java
示例34: computeParticipant
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Computes participant ID using optional {@link ParamsProperty.PROXYING_FOR}
* parameter.
*
* @param operation the operation to be executed.
* @param participant the base participant id.
* @return new participant instance in the format
* [email protected] If proxyFor is null then just
* returns unmodified participant.
* @throws InvalidRequestException if participant address and/or proxyFor are
* invalid.
*/
public static ParticipantId computeParticipant(OperationRequest operation,
ParticipantId participant) throws InvalidRequestException {
String proxyAddress =
OperationUtil.getOptionalParameter(operation, ParamsProperty.PROXYING_FOR);
try {
return toProxyParticipant(participant, proxyAddress);
} catch (InvalidParticipantAddress e) {
throw new InvalidRequestException(
participant.getAddress()
+ (proxyAddress != null ? "+" + proxyAddress : ""
+ " is not a valid participant address"), operation);
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:26,
代码来源:OperationUtil.java
示例35: setUp
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
AccountStore store = new MemoryStore();
store.putAccount(new HumanAccountDataImpl(
ParticipantId.ofUnsafe("[email protected]"), new PasswordDigest("pwd".toCharArray())));
store.putAccount(new HumanAccountDataImpl(ParticipantId.ofUnsafe("[email protected]")));
AccountStoreHolder.init(store, "example.com");
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:9,
代码来源:AccountStoreLoginModuleTest.java
示例36: OpenWaveData
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
public OpenWaveData(WaveRef waveRef, boolean newWave, Set<ParticipantId> participants,
boolean fromLastRead) {
this.waveRef = waveRef;
this.newWave = newWave;
this.participants = participants;
this.fromLastRead = fromLastRead;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:8,
代码来源:WebClient.java
示例37: create
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Creates a Permissions view on top of the document.
*/
public static DocumentBasedIndexability create(final DocEventRouter doc) {
DocumentBasedBasicMap<Doc.E, ParticipantId, IndexDecision> map =
DocumentBasedBasicMap.create(doc,
doc.getDocument().getDocumentElement(),
ParticipantIdSerializer.INSTANCE,
new Serializer.EnumSerializer<IndexDecision>(IndexDecision.class),
INDEX_TAG, ADDRESS_ATTR, VALUE_ATTR);
DocumentBasedIndexability indexability = new DocumentBasedIndexability(map);
map.addListener(indexability);
return indexability;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:DocumentBasedIndexability.java
示例38: deserialize
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
private WaveletFragmentDataImpl deserialize(WaveletFragment waveletFragment) {
WaveletId id = deserializeWaveletId(waveletFragment.getWaveletId());
ParticipantId creator = null;
long creationTime = 0;
Map<SegmentId, RawFragment> fragments = new HashMap();
for (SegmentFragment rawFragment : waveletFragment.getFragment()) {
RawFragment fragment = deserialize(rawFragment);
SegmentId segmentId = SegmentId.of(rawFragment.getSegmentId());
if (segmentId.isIndex()) {
creationTime = fragment.getIndexSnapshot().getCreationTime();
} else if (segmentId.isParticipants()) {
creator = fragment.getParticipantsSnapshot().getCreator();
}
fragments.put(segmentId, fragment);
}
HashedVersion lastModifiedVersion = deserialize(waveletFragment.getLastModifiedVersion());
long lastModifiedTime = waveletFragment.getLastModifiedTime();
WaveletFragmentDataImpl waveletData =
new WaveletFragmentDataImpl(id, creator, creationTime,
lastModifiedVersion, lastModifiedTime, waveId, docFactory);
try {
for (Map.Entry<SegmentId, RawFragment> entry : fragments.entrySet()) {
waveletData.applyRawFragment(entry.getKey(), entry.getValue());
}
} catch (OperationException ex) {
throw new OperationRuntimeException("Fragment applying error", ex);
}
return waveletData;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:31,
代码来源:RemoteWaveViewService.java
示例39: TestConfig
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
/**
* Constructor for test config.
* @param injectV0Delta by default we inject a NoOp at V0 due to a security constraint on
* OT, where you can't transform against V0. By injecting an op at v0, all clients can
* happily submit deltas concurrently.
*/
public TestConfig(String intialBlipXml, int numClients, boolean injectV0Delta)
throws TransformException, OperationException {
for (int i = 0; i < numClients; i++) {
ServerConnectionMock serverConnectionMock = new ServerConnectionMock();
serverConnectionMock.setServerMock(serverMock);
serverMock.addClientConnection(serverConnectionMock);
ConcurrencyControl clientCC = new ConcurrencyControl(logger, genSignature(0));
serverConnectionMock.setListener(clientCC);
ClientMock clientMock =
new ClientMock(clientCC, parse(intialBlipXml), new ParticipantId(i + "@example.com"),
serverConnectionMock);
clientCC.initialise(serverConnectionMock, clientMock);
clientMocks.add(clientMock);
// Always start at version 0.
try {
HashedVersion signature = genSignature(0);
clientCC.onOpen(signature, signature, null, null);
} catch (ChannelException e) {
fail("onOpen failed: " + e);
}
}
if (injectV0Delta) {
// Inject a single NoOp from a null connection, this ensures that all
// clients submit AFTER version 0.
WaveletDelta initialDelta = new WaveletDelta(NOBODY_UTIL.getAuthor(),
genSignature(0), Arrays.asList(NOBODY_UTIL.noOp()));
serverMock.receive(null, initialDelta);
serverProcessDeltas();
}
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:41,
代码来源:ClientAndServerTest.java
示例40: getParticipantView
点赞 2
import org.waveprotocol.wave.model.wave.ParticipantId; //导入依赖的package包/类
@Override
public ParticipantView getParticipantView(Conversation conv, ParticipantId source) {
if (conv != null && source != null) {
Element e = Document.get().getElementById(viewIdMapper.participantOf(conv, source));
return viewProvider.asParticipant(e);
}
return null;
}
开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:9,
代码来源:ModelAsViewProviderImpl.java