http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryChangeListener.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryChangeListener.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryChangeListener.java deleted file mode 100644 index ca046a6..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryChangeListener.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.event.logical.shared.ValueChangeEvent; -import com.google.gwt.event.logical.shared.ValueChangeHandler; -import com.google.gwt.user.client.History; - -import org.waveprotocol.wave.client.events.ClientEvents; -import org.waveprotocol.wave.client.events.Log; -import org.waveprotocol.wave.client.events.WaveSelectionEvent; -import org.waveprotocol.wave.model.waveref.InvalidWaveRefException; -import org.waveprotocol.wave.model.waveref.WaveRef; -import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder; - -/** - * The listener interface for receiving historyChange events from browser history. - * - * @author [email protected] - * - * @see {@link ValueChangeEvent} - */ -public class HistoryChangeListener { - private static final Log LOG = Log.get(HistoryChangeListener.class); - - /** - * Commonly we start to listen history changes when webclient starts calling this - * method. If you are using wave client integrated with other different GWT application - * and with a different History management, you can avoid to use this and just - * call to the {@link WaveSelectionEvent} events (for example) or other uses. - */ - public static void init() { - History.addValueChangeHandler(new ValueChangeHandler<String>() { - @Override - public void onValueChange(ValueChangeEvent<String> event) { - String encodedToken = event.getValue(); - if (encodedToken == null || encodedToken.length() == 0) { - return; - } - WaveRef waveRef; - try { - waveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken); - } catch (InvalidWaveRefException e) { - LOG.info("History token contains invalid path: " + encodedToken); - return; - } - LOG.info("Changing selected wave based on history event to " + waveRef.toString()); - ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef)); - } - }); - } - - public HistoryChangeListener() { - } -}
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProvider.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProvider.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProvider.java deleted file mode 100644 index fa3ef58..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.event.logical.shared.ValueChangeHandler; - -/** - * The Interface HistoryProvider gives access to the browser history stack in - * order to access to the wave tokens. - * - * Also this give us the opportunity to intercept these wave token petitions. - * Imagine that you are in fact using #clean-urls in your client you can return - * the waveref equivalent to the #clean-url when the wave webclient ask for the - * current token. - * - * @author [email protected] - */ -public interface HistoryProvider { - - /** - * Gets the current wave history token. The handler will not receive a - * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} - * event for the initial token; requiring that an application request the - * token explicitly on startup gives it an opportunity to run different - * initialization code in the presence or absence of an initial token. - * - * @return the initial token, or the empty string if none is present. - */ - String getToken(); - -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProviderDefault.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProviderDefault.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProviderDefault.java deleted file mode 100644 index a2dae4a..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistoryProviderDefault.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.user.client.History; - -/** - * The Class HistoryProviderDefault implements the common use of HistoryProvider in Webclient. - * @see org.waveprotocol.box.webclient.client.HistoryProvider - * - * @author [email protected] - * - */ -public class HistoryProviderDefault implements HistoryProvider { - - /* (non-Javadoc) - * @see org.waveprotocol.box.webclient.client.HistoryProvider#getToken() - */ - @Override - public String getToken() { - return History.getToken(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/HistorySupport.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistorySupport.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/HistorySupport.java deleted file mode 100644 index 93fe852..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/HistorySupport.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -/** - * Contains the code to interface the history event mechanism with the client's - * event bus. At the moment, a history token encodes a wave id or wave ref. - */ -public class HistorySupport { - - private static HistoryProvider historyProvider; - - public static void init(HistoryProvider historyProvider) { - HistorySupport.historyProvider = historyProvider; - } - - private HistorySupport() { - } - - public static String getToken() { - return historyProvider.getToken(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/LocaleService.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/LocaleService.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/LocaleService.java deleted file mode 100644 index 0cf8033..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/LocaleService.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.waveprotocol.box.webclient.client; - -/** - * Stores locale into user's account. - * - * @author [email protected] (Andrew Kaplanov) - */ -public interface LocaleService { - public void storeLocale(String locale); -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteLocaleService.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteLocaleService.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteLocaleService.java deleted file mode 100644 index 570e9a7..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteLocaleService.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.http.client.Request; -import com.google.gwt.http.client.RequestBuilder; -import com.google.gwt.http.client.RequestCallback; -import com.google.gwt.http.client.RequestException; -import com.google.gwt.http.client.Response; - -import org.waveprotocol.wave.client.debug.logger.DomLogger; -import org.waveprotocol.wave.common.logging.LoggerBundle; - -/** - * Manage locale settings on the server. - * - * @author [email protected] (Andrew Kaplanov) - */ -public final class RemoteLocaleService implements LocaleService { - - private static final LoggerBundle LOG = new DomLogger(RemoteLocaleService.class.getName()); - - private static final String LOCALE_URL_BASE = "/locale"; - - public RemoteLocaleService() { - } - - @Override - public void storeLocale(String locale) { - RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, - LOCALE_URL_BASE + "/?locale=" + locale); - - LOG.trace().log("Store locale"); - - requestBuilder.setCallback(new RequestCallback() { - @Override - public void onResponseReceived(Request request, Response response) { - if (response.getStatusCode() != Response.SC_OK) { - LOG.error().log("Got back status code " + response.getStatusCode()); - } else { - LOG.error().log("Locale was stored"); - } - } - - @Override - public void onError(Request request, Throwable exception) { - LOG.error().log("Storing locale error: ", exception); - } - }); - - try { - requestBuilder.send(); - } catch (RequestException e) { - LOG.error().log(e.getMessage()); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteViewServiceMultiplexer.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteViewServiceMultiplexer.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteViewServiceMultiplexer.java deleted file mode 100644 index 2c6438c..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteViewServiceMultiplexer.java +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import org.waveprotocol.box.common.comms.ProtocolWaveletUpdate; -import org.waveprotocol.box.common.comms.jso.ProtocolOpenRequestJsoImpl; -import org.waveprotocol.box.common.comms.jso.ProtocolSubmitRequestJsoImpl; -import org.waveprotocol.wave.model.id.IdFilter; -import org.waveprotocol.wave.model.id.InvalidIdException; -import org.waveprotocol.wave.model.id.ModernIdSerialiser; -import org.waveprotocol.wave.model.id.WaveId; -import org.waveprotocol.wave.model.id.WaveletId; -import org.waveprotocol.wave.model.id.WaveletName; -import org.waveprotocol.wave.model.util.CollectionUtils; - -import java.util.Map; - -/** - * Distributes the incoming update stream (from wave-in-a-box's client/server - * protocol) into per-wave streams. - */ -public final class RemoteViewServiceMultiplexer implements WaveWebSocketCallback { - - /** Per-wave streams. */ - private final Map<WaveId, WaveWebSocketCallback> streams = CollectionUtils.newHashMap(); - - // - // Workaround for issue 128. - // http://code.google.com/p/wave-protocol/issues/detail?id=128 - // - // Filtering logic is as follows. Since not every update has a channel id, but - // all updates have a wavelet name, wave ids remain the primary key. This - // map's domain is a subset of streams' domain, and is monotonically set with - // the first channel id observed for an open wave. Only updates that have no - // channel id, or an equal channel id, are passed through to the stream. - // Closing the stream removes any known channel id from this map (this follows - // from the contraint that this maps's domain is a subset of streams' domain). - // - private final Map<WaveId, String> knownChannels = CollectionUtils.newHashMap(); - - /** Underlying socket. */ - private final WaveWebSocketClient socket; - - /** Identity, for authoring messages. */ - private final String userId; - - /** - * Creates a multiplexer. - * - * @param socket communication object - * @param userId identity of viewer - */ - public RemoteViewServiceMultiplexer(WaveWebSocketClient socket, String userId) { - this.socket = socket; - this.userId = userId; - - // Note: Currently, the client's communication stack (websocket) is opened - // too early, before an identity is established. Once that is fixed, this - // object will be registered as a callback when the websocket is opened, - // rather than afterwards here. - socket.attachHandler(this); - } - - /** Dispatches an update to the appropriate wave stream. */ - @Override - public void onWaveletUpdate(ProtocolWaveletUpdate message) { - WaveletName wavelet = deserialize(message.getWaveletName()); - - // Route to the appropriate stream handler. - WaveWebSocketCallback stream = streams.get(wavelet.waveId); - if (stream != null) { - boolean drop; - - String knownChannelId = knownChannels.get(wavelet.waveId); - if (knownChannelId != null) { - // Drop updates with known mismatched channel ids. - drop = message.hasChannelId() && !message.getChannelId().equals(knownChannelId); - } else { - if (message.hasChannelId()) { - knownChannels.put(wavelet.waveId, message.getChannelId()); - } - drop = false; - } - - if (!drop) { - stream.onWaveletUpdate(message); - } - } else { - // This is either a server error, or a message after a stream has been - // locally closed (there is no way to tell the server to stop sending - // updates). - } - } - - /** - * Opens a wave stream. - * - * @param id wave to open - * @param stream handler to updates directed at that wave - */ - public void open(WaveId id, IdFilter filter, WaveWebSocketCallback stream) { - // Prepare to receive updates for the new stream. - streams.put(id, stream); - - // Request those updates. - ProtocolOpenRequestJsoImpl request = ProtocolOpenRequestJsoImpl.create(); - request.setWaveId(ModernIdSerialiser.INSTANCE.serialiseWaveId(id)); - request.setParticipantId(userId); - for (String prefix : filter.getPrefixes()) { - request.addWaveletIdPrefix(prefix); - } - // Issue 161: http://code.google.com/p/wave-protocol/issues/detail?id=161 - // The box protocol does not support explicit wavelet ids in the filter. - // As a workaround, include them in the prefix list. - for (WaveletId wid : filter.getIds()) { - request.addWaveletIdPrefix(wid.getId()); - } - socket.open(request); - } - - /** - * Closes a wave stream. - * - * @param id wave to close - * @param stream stream previously registered against that wave - */ - public void close(WaveId id, WaveWebSocketCallback stream) { - if (streams.get(id) == stream) { - streams.remove(id); - knownChannels.remove(id); - } - - // Issue 117: the client server protocol does not support closing a wave stream. - } - - /** - * Submits a delta. - * - * @param request delta to submit - * @param callback callback for submit response - */ - public void submit(ProtocolSubmitRequestJsoImpl request, SubmitResponseCallback callback) { - request.getDelta().setAuthor(userId); - socket.submit(request, callback); - } - - public static WaveletName deserialize(String name) { - try { - return ModernIdSerialiser.INSTANCE.deserialiseWaveletName(name); - } catch (InvalidIdException e) { - throw new IllegalArgumentException(e); - } - } - - public static String serialize(WaveletName name) { - return ModernIdSerialiser.INSTANCE.serialiseWaveletName(name); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteWaveViewService.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteWaveViewService.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteWaveViewService.java deleted file mode 100644 index 8166632..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/RemoteWaveViewService.java +++ /dev/null @@ -1,431 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; - -import org.waveprotocol.box.common.comms.DocumentSnapshot; -import org.waveprotocol.box.common.comms.ProtocolSubmitResponse; -import org.waveprotocol.box.common.comms.ProtocolWaveletUpdate; -import org.waveprotocol.box.common.comms.WaveletSnapshot; -import org.waveprotocol.box.common.comms.jso.ProtocolSubmitRequestJsoImpl; -import org.waveprotocol.box.common.comms.jso.ProtocolWaveletUpdateJsoImpl; -import org.waveprotocol.box.webclient.common.WaveletOperationSerializer; -import org.waveprotocol.wave.client.common.util.ClientPercentEncoderDecoder; -import org.waveprotocol.wave.client.events.Log; -import org.waveprotocol.wave.concurrencycontrol.channel.WaveViewService; -import org.waveprotocol.wave.concurrencycontrol.common.ResponseCode; -import org.waveprotocol.wave.federation.ProtocolHashedVersion; -import org.waveprotocol.wave.federation.ProtocolWaveletDelta; -import org.waveprotocol.wave.federation.jso.ProtocolWaveletDeltaJsoImpl; -import org.waveprotocol.wave.model.document.operation.DocInitialization; -import org.waveprotocol.wave.model.document.operation.impl.DocOpUtil; -import org.waveprotocol.wave.model.id.IdFilter; -import org.waveprotocol.wave.model.id.IdURIEncoderDecoder; -import org.waveprotocol.wave.model.id.InvalidIdException; -import org.waveprotocol.wave.model.id.ModernIdSerialiser; -import org.waveprotocol.wave.model.id.WaveId; -import org.waveprotocol.wave.model.id.WaveletId; -import org.waveprotocol.wave.model.id.WaveletName; -import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta; -import org.waveprotocol.wave.model.operation.wave.WaveletDelta; -import org.waveprotocol.wave.model.operation.wave.WaveletOperation; -import org.waveprotocol.wave.model.util.CollectionUtils; -import org.waveprotocol.wave.model.version.HashedVersion; -import org.waveprotocol.wave.model.version.HashedVersionFactory; -import org.waveprotocol.wave.model.version.HashedVersionZeroFactoryImpl; -import org.waveprotocol.wave.model.wave.ParticipantId; -import org.waveprotocol.wave.model.wave.data.DocumentFactory; -import org.waveprotocol.wave.model.wave.data.ObservableWaveletData; -import org.waveprotocol.wave.model.wave.data.impl.WaveletDataImpl; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.waveprotocol.box.stat.AsyncCallContext; - -/** - * Implements the {@link WaveViewService} using RPCs. - */ -public final class RemoteWaveViewService implements WaveViewService, WaveWebSocketCallback { - - private static final Log LOG = Log.get(RemoteWaveViewService.class); - - /** - * Provides an update notification by lazily extracting and deserializing - * components out of a serialized update message. - */ - private class WaveViewServiceUpdateImpl implements WaveViewServiceUpdate { - private final ProtocolWaveletUpdate update; - - // Cache expensive values - private List<TransformedWaveletDelta> deltas; - private ObservableWaveletData snapshot; - - WaveViewServiceUpdateImpl(ProtocolWaveletUpdate update) { - this.update = update; - } - - @Override - public boolean hasChannelId() { - return update.hasChannelId(); - } - - @Override - public String getChannelId() { - return update.getChannelId(); - } - - @Override - public boolean hasCurrentVersion() { - return update.hasResultingVersion(); - } - - @Override - public HashedVersion getCurrentVersion() { - return deserialize(update.getResultingVersion()); - } - - @Override - public boolean hasDeltas() { - return update.getAppliedDeltaSize() > 0; - } - - @Override - public List<TransformedWaveletDelta> getDeltaList() { - return deltas == null // - ? deltas = deserialize(update.getAppliedDelta(), update.getResultingVersion()) : deltas; - } - - @Override - public boolean hasLastCommittedVersion() { - return update.hasCommitNotice(); - } - - @Override - public HashedVersion getLastCommittedVersion() { - return deserialize(update.getCommitNotice()); - } - - @Override - public boolean hasWaveletId() { - // The proto definition is incorrect, and is marked as a required field, - // so there is no generated hasWaveletName(). - return update.getWaveletName() != null; - } - - @Override - public WaveletId getWaveletId() { - return deserialize(update.getWaveletName()).waveletId; - } - - @Override - public boolean hasWaveletSnapshot() { - return update.hasSnapshot(); - } - - @Override - public ObservableWaveletData getWaveletSnapshot() { - return snapshot == null ? snapshot = deserialize(waveId, update.getSnapshot()) : snapshot; - } - - @Override - public boolean hasMarker() { - return update.hasMarker() && update.getMarker(); - } - } - - /** - * The box server uses an incompatible signature scheme to the wave-protocol - * libraries. This manager resolves those incompatibilities. - */ - private static class VersionSignatureManager { - private static final HashedVersionFactory HASHER = - new HashedVersionZeroFactoryImpl(new IdURIEncoderDecoder(new ClientPercentEncoderDecoder())); - - /** Most recent signed versions. */ - private final Map<WaveletName, ProtocolHashedVersion> versions = CollectionUtils.newHashMap(); - - /** - * Records a signed server version. - */ - void updateHistory(WaveletName wavelet, ProtocolHashedVersion update) { - ProtocolHashedVersion current = versions.get(wavelet); - if (current != null && current.getVersion() > update.getVersion()) { - LOG.info("Ignoring superceded hash update: " + update); - return; - } - versions.put(wavelet, update); - } - - /** - * Finds the most recent signed version for a delta. - */ - ProtocolHashedVersion getServerVersion(WaveletName wavelet, WaveletDelta delta) { - if (delta.getTargetVersion().getVersion() == 0) { - return serialize(HASHER.createVersionZero(wavelet)); - } else { - ProtocolHashedVersion current = versions.get(wavelet); - Preconditions.checkNotNull(current); - double prevVersion = current.getVersion(); - double deltaVersion = delta.getTargetVersion().getVersion(); - if (deltaVersion != prevVersion) { - throw new IllegalArgumentException( - "Client delta expressed against non-server version. Server version: " + prevVersion - + ", client delta: " + deltaVersion); - } - return current; - } - } - } - - private final WaveId waveId; - private final RemoteViewServiceMultiplexer mux; - private final DocumentFactory<?> docFactory; - private final VersionSignatureManager versions = new VersionSignatureManager(); - - /** Filter for client-side filtering. */ - // TODO: remove after Issue 124 is addressed. - // http://code.google.com/p/wave-protocol/issues/detail?id=124 - private IdFilter filter; - - /** Callback once opened. */ - private OpenCallback callback; - - private AsyncCallContext openContext; - - /** - * Creates a service. - * - * @param waveId wave this service serves - * @param mux underlying communication channel - * @param docFactory document factory to use when deserializing snapshots - */ - public RemoteWaveViewService(WaveId waveId, RemoteViewServiceMultiplexer mux, - DocumentFactory<?> docFactory) { - this.waveId = waveId; - this.mux = mux; - this.docFactory = docFactory; - } - - // - // ViewService API. - // - - @Override - public void viewOpen(final IdFilter filter, - final Map<WaveletId, List<HashedVersion>> knownWavelets, final OpenCallback callback) { - LOG.info("viewOpen called on " + waveId + " with " + filter); - - // Some legacy hack. Important updates are sent to a "dummy+root" wavelet. - // TODO: remove this once Issue 125 is fixed. - // http://code.google.com/p/wave-protocol/issues/detail?id=125 - Set<String> newPrefixes = new HashSet<String>(filter.getPrefixes()); - newPrefixes.add("dummy"); - this.filter = IdFilter.of(filter.getIds(), newPrefixes); - this.callback = callback; - - openContext = AsyncCallContext.start("ProtocolOpenRequest"); - mux.open(waveId, filter, this); - } - - @Override - public String viewSubmit(final WaveletName wavelet, WaveletDelta delta, String channelId, - final SubmitCallback callback) { - ProtocolSubmitRequestJsoImpl submitRequest = ProtocolSubmitRequestJsoImpl.create(); - submitRequest.setWaveletName(serialize(wavelet)); - submitRequest.setDelta(serialize(wavelet, delta)); - submitRequest.setChannelId(channelId); - - final AsyncCallContext callContext = AsyncCallContext.start("SubmitRequest"); - mux.submit(submitRequest, new SubmitResponseCallback() { - @Override - public void run(ProtocolSubmitResponse response) { - callContext.stop(); - HashedVersion resultVersion = HashedVersion.unsigned(0); - if (response.hasHashedVersionAfterApplication()) { - resultVersion = - WaveletOperationSerializer.deserialize(response.getHashedVersionAfterApplication()); - versions.updateHistory(wavelet, response.getHashedVersionAfterApplication()); - } - callback.onSuccess(resultVersion, response.getOperationsApplied(), null, ResponseCode.OK); - } - }); - - // We don't support the getDebugProfiling thing anyway. - return null; - } - - @Override - public void viewClose(final WaveId waveId, final String channelId, final CloseCallback callback) { - Preconditions.checkArgument(this.waveId.equals(waveId)); - LOG.info("closing channel " + waveId); - callback.onSuccess(); - mux.close(waveId, this); - } - - @Override - public String debugGetProfilingInfo(final String requestId) { - throw new UnsupportedOperationException(); - } - - // - // Incoming updates. - // - - @Override - public void onWaveletUpdate(ProtocolWaveletUpdate update) { - if (shouldAccept(update)) { - // Update last-known-version map, so that outgoing deltas can be - // appropriately rewritten. - if (update.hasResultingVersion()) { - versions.updateHistory(getTarget(update), update.getResultingVersion()); - } - - // Adapt broken parts of the box server, to make them speak the proper - // wave protocol: - // 1. Channel id must be in its own message. - // 2. Synthesize the open-finished marker that the box server leaves out. - if (update.hasChannelId() - && (update.hasCommitNotice() || update.hasMarker() || update.hasSnapshot() || update - .getAppliedDeltaSize() > 0)) { - ProtocolWaveletUpdate fake = ProtocolWaveletUpdateJsoImpl.create(); - fake.setChannelId(update.getChannelId()); - update.clearChannelId(); - callback.onUpdate(deserialize(fake)); - callback.onUpdate(deserialize(update)); - } else { - if (update.hasMarker()) { - openContext.stop(); - } - callback.onUpdate(deserialize(update)); - } - } - } - - private WaveViewServiceUpdateImpl deserialize(ProtocolWaveletUpdate update) { - return new WaveViewServiceUpdateImpl(update); - } - - /** @return the target wavelet of an update. */ - private WaveletName getTarget(ProtocolWaveletUpdate update) { - WaveletName name = deserialize(update.getWaveletName()); - Preconditions.checkState(name.waveId.equals(waveId)); - return name; - } - - /** @return true if this update matches this service's filter. */ - private boolean shouldAccept(ProtocolWaveletUpdate update) { - return IdFilter.accepts(filter, getTarget(update).waveletId); - } - - // - // Serialization. - // - - private ProtocolWaveletDelta serialize(WaveletName wavelet, WaveletDelta delta) { - ProtocolWaveletDeltaJsoImpl protocolDelta = ProtocolWaveletDeltaJsoImpl.create(); - for (WaveletOperation op : delta) { - protocolDelta.addOperation(WaveletOperationSerializer.serialize(op)); - } - protocolDelta.setAuthor(delta.getAuthor().getAddress()); - protocolDelta.setHashedVersion(versions.getServerVersion(wavelet, delta)); - return protocolDelta; - } - - private static List<TransformedWaveletDelta> deserialize( - List<? extends ProtocolWaveletDelta> deltas, ProtocolHashedVersion end) { - if (deltas == null) { - return null; - } else { - List<TransformedWaveletDelta> parsed = new ArrayList<TransformedWaveletDelta>(); - for (int i = 0; i < deltas.size(); i++) { - ProtocolHashedVersion thisEnd = // - i < deltas.size() - 1 ? deltas.get(i + 1).getHashedVersion() : end; - parsed.add(deserialize(deltas.get(i), thisEnd)); - } - return parsed; - } - } - - private static TransformedWaveletDelta deserialize(ProtocolWaveletDelta delta, - ProtocolHashedVersion end) { - return WaveletOperationSerializer.deserialize(delta, deserialize(end)); - } - - private ObservableWaveletData deserialize(WaveId waveId, WaveletSnapshot snapshot) { - WaveletId id; - try { - id = ModernIdSerialiser.INSTANCE.deserialiseWaveletId(snapshot.getWaveletId()); - } catch (InvalidIdException e) { - throw new IllegalArgumentException(e); - } - ParticipantId creator = ParticipantId.ofUnsafe(snapshot.getParticipantId(0)); - HashedVersion version = deserialize(snapshot.getVersion()); - long lmt = snapshot.getLastModifiedTime(); - long ctime = snapshot.getCreationTime(); - long lmv = version.getVersion(); - - WaveletDataImpl waveletData = - new WaveletDataImpl(id, creator, ctime, lmv, version, lmt, waveId, docFactory); - for (String participant : snapshot.getParticipantId()) { - waveletData.addParticipant(new ParticipantId(participant)); - } - for (DocumentSnapshot docSnapshot : snapshot.getDocument()) { - deserialize(waveletData, docSnapshot); - } - return waveletData; - } - - private static void deserialize(WaveletDataImpl waveletData, DocumentSnapshot docSnapshot) { - DocInitialization content = - DocOpUtil.asInitialization(WaveletOperationSerializer.deserialize(docSnapshot - .getDocumentOperation())); - String docId = docSnapshot.getDocumentId(); - ParticipantId author = ParticipantId.ofUnsafe(docSnapshot.getAuthor()); - List<ParticipantId> contributors = Lists.newArrayList(); - for (String contributor : docSnapshot.getContributor()) { - contributors.add(ParticipantId.ofUnsafe(contributor)); - } - long lmt = docSnapshot.getLastModifiedTime(); - long lmv = docSnapshot.getLastModifiedVersion(); - waveletData.createDocument(docId, author, contributors, content, lmt, lmv); - } - - private static String serialize(WaveletName wavelet) { - return RemoteViewServiceMultiplexer.serialize(wavelet); - } - - private static WaveletName deserialize(String wavelet) { - WaveletName name = RemoteViewServiceMultiplexer.deserialize(wavelet); - return name; - } - - private static ProtocolHashedVersion serialize(HashedVersion version) { - return WaveletOperationSerializer.serialize(version); - } - - private static HashedVersion deserialize(ProtocolHashedVersion version) { - return WaveletOperationSerializer.deserialize(version); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/SavedStateIndicator.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/SavedStateIndicator.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/SavedStateIndicator.java deleted file mode 100644 index 8a2b104..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/SavedStateIndicator.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Element; - -import org.waveprotocol.box.webclient.client.i18n.SavedStateMessages; -import org.waveprotocol.wave.client.scheduler.Scheduler; -import org.waveprotocol.wave.client.scheduler.SchedulerInstance; -import org.waveprotocol.wave.client.scheduler.TimerService; -import org.waveprotocol.wave.concurrencycontrol.common.UnsavedDataListener; - -/** - * Simple saved state indicator. - * - * @author [email protected] (Daniel Danilatos) - * @author [email protected] (Yuri Zelikov) - */ -public class SavedStateIndicator implements UnsavedDataListener { - - private static final SavedStateMessages messages = GWT.create(SavedStateMessages.class); - - private enum SavedState { - SAVED(messages.saved()), - UNSAVED(messages.unsaved()); - - final String message; - - private SavedState(String message) { - this.message = message; - } - } - - private static final int UPDATE_DELAY_MS = 300; - - private final Scheduler.Task updateTask = new Scheduler.Task() { - @Override - public void execute() { - updateDisplay(); - } - }; - - private final Element element; - private final TimerService scheduler; - - private SavedState visibleSavedState = SavedState.SAVED; - private SavedState currentSavedState = null; - - private static final String UNSAVED_HTML = - "<span style='color: red; text-align: center;'>" + SavedState.UNSAVED.message - + "</span>"; - private static final String SAVED_HTML = - "<span style='color: green; text-align: center;'>" + SavedState.SAVED.message - + "</span>"; - - public SavedStateIndicator(Element element) { - this.element = element; - this.scheduler = SchedulerInstance.getLowPriorityTimer(); - scheduler.schedule(updateTask); - } - - public void saved() { - maybeUpdateDisplay(); - } - - public void unsaved() { - maybeUpdateDisplay(); - } - - private void maybeUpdateDisplay() { - if (needsUpdating()) { - switch (currentSavedState) { - case SAVED: - scheduler.scheduleDelayed(updateTask, UPDATE_DELAY_MS); - break; - case UNSAVED: - updateDisplay(); - break; - default: - throw new AssertionError("unknown " + currentSavedState); - } - } else { - scheduler.cancel(updateTask); - } - } - - private boolean needsUpdating() { - return visibleSavedState != currentSavedState; - } - - private void updateDisplay() { - visibleSavedState = currentSavedState; - String innerHtml = visibleSavedState == SavedState.SAVED ? SAVED_HTML : UNSAVED_HTML; - element.setInnerHTML(innerHtml); - } - - @Override - public void onUpdate(UnsavedDataInfo unsavedDataInfo) { - if (unsavedDataInfo.estimateUnacknowledgedSize() != 0) { - currentSavedState = SavedState.UNSAVED; - unsaved(); - } else { - currentSavedState = SavedState.SAVED; - saved(); - } - } - - @Override - public void onClose(boolean everythingCommitted) { - if (everythingCommitted) { - saved(); - } else { - unsaved(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/Session.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/Session.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/Session.java deleted file mode 100644 index 0007797..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/Session.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.Window; - -import org.waveprotocol.box.common.SessionConstants; -import org.waveprotocol.box.webclient.client.i18n.SessionMessages; - -/** - * Session data for the web client. - * - * @author [email protected] (Benjamin Kalman) - */ -public abstract class Session implements SessionConstants { - - private static final Session INSTANCE; - - private static SessionMessages messages = GWT.create(SessionMessages.class); - - static { - // In the future we could inject other Session instances for testing. - if (JsSession.isAvailable()) { - INSTANCE = new JsSession(); - } else { - Window.alert(messages.sessionDataNotAvailable()); - INSTANCE = new StubSession(); - } - } - - private Session() { - } - - /** - * @return the singleton {@link Session} instance - */ - public static Session get() { - return INSTANCE; - } - - /** - * @return the domain the wave server serves waves for - */ - public abstract String getDomain(); - - /** - * @return the user's logged in address, or null if the user is not logged in. - */ - public abstract String getAddress(); - - /** - * @return true if the user is currently logged in. - */ - public boolean isLoggedIn() { - return getAddress() != null; - } - - /** - * @return the id seed that's going to be used for generating ids for the session - */ - public abstract String getIdSeed(); - - - /** - * A {@link Session} which gets its data from the __session JS variable. - */ - private static final class JsSession extends Session { - /** - * @return whether it is possible to have a JsSession - */ - public static native boolean isAvailable() /*-{ - return typeof($wnd.__session) !== "undefined"; - }-*/; - - @Override - public String getDomain() { - return getFieldAsString(DOMAIN); - } - - @Override - public String getAddress() { - return getFieldAsString(ADDRESS); - } - - @Override - public String getIdSeed() { - return getFieldAsString(ID_SEED); - } - - private native String getFieldAsString(String s) /*-{ - return $wnd.__session[s]; - }-*/; - } - - /** - * A {@link Session} which returns stub values. - */ - private static final class StubSession extends Session { - @Override - public String getDomain() { - return DOMAIN; - } - - @Override - public String getAddress() { - return ADDRESS; - } - - @Override - public String getIdSeed() { - return ID_SEED; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/SimpleWaveStore.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/SimpleWaveStore.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/SimpleWaveStore.java deleted file mode 100644 index 5a5491d..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/SimpleWaveStore.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.common.base.Preconditions; - -import org.waveprotocol.box.webclient.search.WaveStore; -import org.waveprotocol.wave.model.document.WaveContext; -import org.waveprotocol.wave.model.id.WaveId; -import org.waveprotocol.wave.model.util.CollectionUtils; -import org.waveprotocol.wave.model.util.CopyOnWriteSet; - -import java.util.Collections; -import java.util.Map; - -/** - * A trivial implementation of a wave store. - * - * @author [email protected] (David Hearnden) - */ -public final class SimpleWaveStore implements WaveStore { - - private final CopyOnWriteSet<Listener> listeners = CopyOnWriteSet.create(); - private final Map<WaveId, WaveContext> waves = CollectionUtils.newHashMap(); - private final Map<WaveId, WaveContext> wavesView = Collections.unmodifiableMap(waves); - - /** - * Creates a wave store. - */ - public SimpleWaveStore() { - } - - @Override - public void add(WaveContext wave) { - WaveId id = wave.getWave().getWaveId(); - Preconditions.checkArgument(!waves.containsKey(id)); - waves.put(id, wave); - fireOnWaveOpened(wave); - } - - @Override - public void remove(WaveContext wave) { - WaveId id = wave.getWave().getWaveId(); - Preconditions.checkArgument(waves.get(id) == wave); - waves.remove(id); - fireOnWaveClosed(wave); - } - - @Override - public Map<WaveId, WaveContext> getOpenWaves() { - return wavesView; - } - - // - // Events - // - - @Override - public void addListener(Listener listener) { - listeners.add(listener); - } - - @Override - public void removeListener(Listener listener) { - listeners.remove(listener); - } - - private void fireOnWaveOpened(WaveContext wave) { - for (Listener listener : listeners) { - listener.onOpened(wave); - } - } - - private void fireOnWaveClosed(WaveContext wave) { - for (Listener listener : listeners) { - listener.onClosed(wave); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/SnapshotFetcher.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/SnapshotFetcher.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/SnapshotFetcher.java deleted file mode 100644 index e4cde86..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/SnapshotFetcher.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.http.client.Request; -import com.google.gwt.http.client.RequestBuilder; -import com.google.gwt.http.client.RequestCallback; -import com.google.gwt.http.client.RequestException; -import com.google.gwt.http.client.Response; - -import org.waveprotocol.box.common.comms.jso.WaveViewSnapshotJsoImpl; -import org.waveprotocol.box.webclient.common.SnapshotSerializer; -import org.waveprotocol.box.webclient.common.communication.callback.SimpleCallback; -import org.waveprotocol.wave.client.debug.logger.DomLogger; -import org.waveprotocol.wave.common.logging.LoggerBundle; -import org.waveprotocol.wave.communication.gwt.JsonMessage; -import org.waveprotocol.wave.communication.json.JsonException; -import org.waveprotocol.wave.model.id.InvalidIdException; -import org.waveprotocol.wave.model.id.WaveId; -import org.waveprotocol.wave.model.operation.OperationException; -import org.waveprotocol.wave.model.wave.InvalidParticipantAddress; -import org.waveprotocol.wave.model.wave.data.DocumentFactory; -import org.waveprotocol.wave.model.wave.data.WaveViewData; -import org.waveprotocol.wave.model.waveref.WaveRef; -import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder; - -/** - * Helper class to fetch wavelet snapshots using the snapshot fetch service. - * - * @author [email protected] (Joseph Gentle) - */ -public final class SnapshotFetcher { - private static final LoggerBundle LOG = new DomLogger("SnapshotFetcher"); - private static final String FETCH_URL_BASE = "/fetch"; - - private SnapshotFetcher() { - } - - private static String getUrl(WaveRef waveRef) { - String pathSegment = GwtWaverefEncoder.encodeToUriPathSegment(waveRef); - return FETCH_URL_BASE + "/" + pathSegment; - } - - /** - * Fetches a wave view snapshot from the static fetch servlet. - * - * @param waveId The wave to fetch - * @param callback A callback through which the fetched wave will be returned. - */ - public static void fetchWave(WaveId waveId, - final SimpleCallback<WaveViewData, Throwable> callback, - final DocumentFactory<?> docFactory) { - String url = getUrl(WaveRef.of(waveId)); - LOG.trace().log("Fetching wavelet ", waveId.toString(), " at ", url); - - RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url); - requestBuilder.setCallback(new RequestCallback() { - @Override - public void onResponseReceived(Request request, Response response) { - LOG.trace().log("Snapshot response recieved: ", response.getText()); - // Pull the snapshot out of the response object and return it using - // the provided callback function. - if (response.getStatusCode() != Response.SC_OK) { - callback.onFailure( - new RequestException("Got back status code " + response.getStatusCode())); - } else if (!response.getHeader("Content-Type").startsWith("application/json")) { - callback.onFailure(new RuntimeException("Fetch service did not return json")); - } else { - WaveViewData waveView; - try { - WaveViewSnapshotJsoImpl snapshot = JsonMessage.parse(response.getText()); - waveView = SnapshotSerializer.deserializeWave(snapshot, docFactory); - } catch (OperationException e) { - callback.onFailure(e); - return; - } catch (InvalidParticipantAddress e) { - callback.onFailure(e); - return; - } catch (InvalidIdException e) { - callback.onFailure(e); - return; - } catch (JsonException e) { - callback.onFailure(e); - return; - } - callback.onSuccess(waveView); - } - } - - @Override - public void onError(Request request, Throwable exception) { - LOG.error().log("Snapshot error: ", exception); - callback.onFailure(exception); - } - }); - - try { - requestBuilder.send(); - } catch (RequestException e) { - callback.onFailure(e); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/StageTwoProvider.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/StageTwoProvider.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/StageTwoProvider.java deleted file mode 100644 index 0599c67..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/StageTwoProvider.java +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.common.base.Preconditions; -import com.google.gwt.user.client.Command; - -import org.waveprotocol.wave.client.StageOne; -import org.waveprotocol.wave.client.StageTwo; -import org.waveprotocol.wave.client.account.ProfileManager; -import org.waveprotocol.wave.client.common.util.AsyncHolder; -import org.waveprotocol.wave.concurrencycontrol.channel.WaveViewService; -import org.waveprotocol.wave.concurrencycontrol.common.UnsavedDataListener; -import org.waveprotocol.wave.model.id.IdGenerator; -import org.waveprotocol.wave.model.schema.SchemaProvider; -import org.waveprotocol.wave.model.schema.conversation.ConversationSchemas; -import org.waveprotocol.wave.model.wave.ParticipantId; -import org.waveprotocol.wave.model.wave.data.WaveViewData; -import org.waveprotocol.wave.model.wave.data.impl.WaveViewDataImpl; -import org.waveprotocol.wave.model.waveref.WaveRef; - -import java.util.Set; - -/** - * Provides stage 2 of the staged loading of the wave panel - * - * @author [email protected] (David Wang) - */ -public class StageTwoProvider extends StageTwo.DefaultProvider { - - private final WaveRef waveRef; - private final RemoteViewServiceMultiplexer channel; - private final boolean isNewWave; - // TODO: Remove this after WebClientBackend is deleted. - private final IdGenerator idGenerator; - - // shared across other client components - private final ProfileManager profiles; - - /** - * Continuation to progress to the next stage. This will disappear with the - * new protocol. - */ - private AsyncHolder.Accessor<StageTwo> whenReady; - private final Set<ParticipantId> otherParticipants; - - /** - * @param waveId the id of the wave to open, or null to create a new wave - * @param channel communication channel - * @param idGenerator - * @param otherParticipants the participants to add to the newly created wave, - * in addition to the creator. {@code null} if only the creator - * should be added. - * @param unsavedIndicatorElement - */ - public StageTwoProvider(StageOne stageOne, WaveRef waveRef, RemoteViewServiceMultiplexer channel, - boolean isNewWave, IdGenerator idGenerator, ProfileManager profiles, - UnsavedDataListener unsavedDataListener, Set<ParticipantId> otherParticipants) { - super(stageOne, unsavedDataListener); - Preconditions.checkArgument(stageOne != null); - Preconditions.checkArgument(waveRef != null); - Preconditions.checkArgument(waveRef.getWaveId() != null); - this.waveRef = waveRef; - this.channel = channel; - this.isNewWave = isNewWave; - this.idGenerator = idGenerator; - this.profiles = profiles; - this.otherParticipants = otherParticipants; - } - - @Override - protected SchemaProvider createSchemas() { - return new ConversationSchemas(); - } - - @Override - public String createSessionId() { - return Session.get().getIdSeed(); - } - - @Override - protected IdGenerator createIdGenerator() { - return idGenerator; - } - - @Override - protected ParticipantId createSignedInUser() { - return ParticipantId.ofUnsafe(Session.get().getAddress()); - } - - @Override - protected WaveViewService createWaveViewService() { - return new RemoteWaveViewService(waveRef.getWaveId(), channel, getDocumentRegistry()); - } - - /** - * Swaps order of open and render. - */ - @Override - protected void install() { - if (isNewWave) { - // For a new wave, initial state comes from local initialization. - getConversations().createRoot().getRootThread().appendBlip(); - - // Adding any initial participant to the new wave - getConversations().getRoot().addParticipantIds(otherParticipants); - super.install(); - whenReady.use(StageTwoProvider.this); - } else { - // For an existing wave, while we're still using the old protocol, - // rendering must be delayed until the channel is opened, because the - // initial state snapshots come from the channel. - getConnector().connect(new Command() { - @Override - public void execute() { - // This code must be kept in sync with the default install() - // method, but excluding the connect() call. - - // Install diff control before rendering, because logical diff state - // may - // need to be adjusted due to arbitrary UI policies. - getDiffController().install(); - - // Ensure the wave is rendered. - stageOne.getDomAsViewProvider().setRenderer(getRenderer()); - ensureRendered(); - - // Install eager UI. - installFeatures(); - - // Rendering, and therefore the whole stage is now ready. - whenReady.use(StageTwoProvider.this); - } - }); - } - } - - @Override - protected ProfileManager createProfileManager() { - return profiles; - } - - @Override - protected void create(final AsyncHolder.Accessor<StageTwo> whenReady) { - this.whenReady = whenReady; - super.create(new AsyncHolder.Accessor<StageTwo>() { - @Override - public void use(StageTwo x) { - // Delay progression until rendering is ready. - } - }); - } - - @Override - protected void fetchWave(final AsyncHolder.Accessor<WaveViewData> whenReady) { - whenReady.use(WaveViewDataImpl.create(waveRef.getWaveId())); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/StagesProvider.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/StagesProvider.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/StagesProvider.java deleted file mode 100644 index d024f11..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/StagesProvider.java +++ /dev/null @@ -1,251 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.dom.client.Element; - -import org.waveprotocol.box.webclient.search.WaveStore; -import org.waveprotocol.box.webclient.widget.frame.FramedPanel; -import org.waveprotocol.wave.client.StageOne; -import org.waveprotocol.wave.client.StageThree; -import org.waveprotocol.wave.client.StageTwo; -import org.waveprotocol.wave.client.StageZero; -import org.waveprotocol.wave.client.Stages; -import org.waveprotocol.wave.client.account.ProfileManager; -import org.waveprotocol.wave.client.common.util.AsyncHolder; -import org.waveprotocol.wave.client.common.util.AsyncHolder.Accessor; -import org.waveprotocol.wave.client.common.util.LogicalPanel; -import org.waveprotocol.wave.client.wavepanel.impl.focus.FocusBlipSelector; -import org.waveprotocol.wave.client.wavepanel.impl.focus.FocusFramePresenter; -import org.waveprotocol.wave.client.wavepanel.impl.focus.ViewTraverser; -import org.waveprotocol.wave.client.wavepanel.impl.reader.Reader; -import org.waveprotocol.wave.client.wavepanel.view.BlipView; -import org.waveprotocol.wave.client.wavepanel.view.dom.ModelAsViewProvider; -import org.waveprotocol.wave.client.wavepanel.view.dom.full.BlipQueueRenderer; -import org.waveprotocol.wave.model.conversation.ConversationView; -import org.waveprotocol.wave.model.document.WaveContext; -import org.waveprotocol.wave.model.id.IdGenerator; -import org.waveprotocol.wave.model.wave.ParticipantId; -import org.waveprotocol.wave.model.waveref.WaveRef; - -import java.util.Set; - -/** - * Stages for loading the undercurrent Wave Panel - * - * @author [email protected] (David Wang) - */ -public class StagesProvider extends Stages { - - private final static AsyncHolder<Object> HALT = new AsyncHolder<Object>() { - @Override - public void call(Accessor<Object> accessor) { - // Never ready, so never notify the accessor. - } - }; - - private final Element wavePanelElement; - private final Element unsavedIndicatorElement; - private final FramedPanel waveFrame; - private final LogicalPanel rootPanel; - private final WaveRef waveRef; - private final RemoteViewServiceMultiplexer channel; - private final IdGenerator idGenerator; - private final ProfileManager profiles; - private final WaveStore waveStore; - private final boolean isNewWave; - private final String localDomain; - - private boolean closed; - private StageOne one; - private StageTwo two; - private StageThree three; - private WaveContext wave; - - private Set<ParticipantId> participants; - - /** - * @param wavePanelElement the DOM element to become the wave panel. - * @param unsavedIndicatorElement the element that displays the wave saved state. - * @param rootPanel a panel that this an ancestor of wavePanelElement. This is - * used for adopting to the GWT widget tree. - * @param waveFrame the wave frame. - * @param waveRef the id of the wave to open. If null, it means, create a new - * wave. - * @param channel the communication channel. - * @param isNewWave true if the wave is a new client-created wave - * @param idGenerator - * @param participants the participants to add to the newly created wave. null - * if only the creator should be added - */ - public StagesProvider(Element wavePanelElement, Element unsavedIndicatorElement, - LogicalPanel rootPanel, FramedPanel waveFrame, WaveRef waveRef, RemoteViewServiceMultiplexer channel, - IdGenerator idGenerator, ProfileManager profiles, WaveStore store, boolean isNewWave, - String localDomain, Set<ParticipantId> participants) { - this.wavePanelElement = wavePanelElement; - this.unsavedIndicatorElement = unsavedIndicatorElement; - this.waveFrame = waveFrame; - this.rootPanel = rootPanel; - this.waveRef = waveRef; - this.channel = channel; - this.idGenerator = idGenerator; - this.profiles = profiles; - this.waveStore = store; - this.isNewWave = isNewWave; - this.localDomain = localDomain; - this.participants = participants; - } - - @Override - protected AsyncHolder<StageZero> createStageZeroLoader() { - return haltIfClosed(super.createStageZeroLoader()); - } - - @Override - protected AsyncHolder<StageOne> createStageOneLoader(StageZero zero) { - return haltIfClosed(new StageOne.DefaultProvider(zero) { - @Override - protected Element createWaveHolder() { - return wavePanelElement; - } - - @Override - protected LogicalPanel createWaveContainer() { - return rootPanel; - } - }); - } - - @Override - protected AsyncHolder<StageTwo> createStageTwoLoader(StageOne one) { - return haltIfClosed(new StageTwoProvider(this.one = one, waveRef, channel, isNewWave, - idGenerator, profiles, new SavedStateIndicator(unsavedIndicatorElement), participants)); - } - - @Override - protected AsyncHolder<StageThree> createStageThreeLoader(final StageTwo two) { - return haltIfClosed(new StageThree.DefaultProvider(this.two = two) { - @Override - protected void create(final Accessor<StageThree> whenReady) { - // Prepend an init wave flow onto the stage continuation. - super.create(new Accessor<StageThree>() { - @Override - public void use(StageThree x) { - onStageThreeLoaded(x, whenReady); - } - }); - } - - @Override - protected String getLocalDomain() { - return localDomain; - } - }); - } - - private void onStageThreeLoaded(StageThree x, Accessor<StageThree> whenReady) { - if (closed) { - // Stop the loading process. - return; - } - three = x; - if (isNewWave) { - initNewWave(x); - } else { - handleExistingWave(x); - } - wave = new WaveContext( - two.getWave(), two.getConversations(), two.getSupplement(), two.getReadMonitor()); - waveStore.add(wave); - install(); - whenReady.use(x); - } - - private void initNewWave(StageThree three) { - // Do the new-wave flow. - ModelAsViewProvider views = two.getModelAsViewProvider(); - BlipQueueRenderer blipQueue = two.getBlipQueue(); - ConversationView wave = two.getConversations(); - - // Force rendering to finish. - blipQueue.flush(); - BlipView blipUi = views.getBlipView(wave.getRoot().getRootThread().getFirstBlip()); - three.getEditActions().startEditing(blipUi); - } - - private void handleExistingWave(StageThree three) { - if (waveRef.hasDocumentId()) { - BlipQueueRenderer blipQueue = two.getBlipQueue(); - blipQueue.flush(); - selectAndFocusOnBlip(two.getReader(), two.getModelAsViewProvider(), two.getConversations(), - one.getFocusFrame(), waveRef); - } - } - - /** - * A hook to install features that are not dependent an a certain stage. - */ - protected void install() { - WindowTitleHandler.install(waveStore, waveFrame); - } - - public void destroy() { - if (wave != null) { - waveStore.remove(wave); - wave = null; - } - if (three != null) { - three.getEditActions().stopEditing(); - three = null; - } - if (two != null) { - two.getConnector().close(); - two = null; - } - if (one != null) { - one.getWavePanel().destroy(); - one = null; - } - closed = true; - } - - /** - * Finds the blip that should receive the focus and selects it. - */ - private static void selectAndFocusOnBlip(Reader reader, ModelAsViewProvider views, - ConversationView wave, FocusFramePresenter focusFrame, WaveRef waveRef) { - FocusBlipSelector blipSelector = - FocusBlipSelector.create(wave, views, reader, new ViewTraverser()); - BlipView blipUi = blipSelector.selectBlipByWaveRef(waveRef); - // Focus on the selected blip. - if (blipUi != null) { - focusFrame.focus(blipUi); - } - } - - /** - * @return a halting provider if this stage is closed. Otherwise, returns the - * given provider. - */ - @SuppressWarnings("unchecked") // HALT is safe as a holder for any type - private <T> AsyncHolder<T> haltIfClosed(AsyncHolder<T> provider) { - return closed ? (AsyncHolder<T>) HALT : provider; - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/SubmitResponseCallback.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/SubmitResponseCallback.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/SubmitResponseCallback.java deleted file mode 100644 index 4866bb3..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/SubmitResponseCallback.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.waveprotocol.box.webclient.client; - -import org.waveprotocol.box.common.comms.ProtocolSubmitResponse; - -/** - * @author [email protected] (Anthony Baxter) - */ -public interface SubmitResponseCallback { - - public void run(ProtocolSubmitResponse response); -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocket.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocket.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocket.java deleted file mode 100644 index be1e649..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocket.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -/** - * This interface serves as a proxy interface wrapper for concrete socket implementations - * like {@link com.google.gwt.websockets.client.WebSocket}. - * - * @author [email protected] (Tad Glines) - */ -public interface WaveSocket { - interface WaveSocketCallback { - void onConnect(); - void onDisconnect(); - void onMessage(String message); - } - - void connect(); - void disconnect(); - void sendMessage(String message); -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocketFactory.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocketFactory.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocketFactory.java deleted file mode 100644 index d79ce4e..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveSocketFactory.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import com.google.gwt.websockets.client.WebSocket; -import com.google.gwt.websockets.client.WebSocketCallback; - -import org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnection; -import org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnectionImpl; -import org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnectionListener; - - -/** - * Factory to create proxy wrappers around either {@link com.google.gwt.websockets.client.WebSocket} - * or {@link org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnection}. - * - * @author [email protected] (Tad Glines) - */ -public class WaveSocketFactory { - - /** - * Create a WaveSocket instance that wraps a concrete socket implementation. - * If useWebSocketAlt is true an instance of {@link org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnection} - * is wrapped, otherwise an instance of {@link com.google.gwt.websockets.client.WebSocket} is - * wrapped. - */ - public static WaveSocket create(boolean useWebSocketAlt, final String urlBase, - final WaveSocket.WaveSocketCallback callback) { - if (useWebSocketAlt) { - return new WaveSocket() { - - private final AtmosphereConnection socket - = new AtmosphereConnectionImpl(new AtmosphereConnectionListener() { - - @Override - public void onConnect() { - callback.onConnect(); - } - - @Override - public void onDisconnect() { - callback.onDisconnect(); - } - - @Override - public void onMessage(String message) { - callback.onMessage(message); - }}, urlBase); - - @Override - public void connect() { - socket.connect(); - - } - - @Override - public void disconnect() { - socket.close(); - } - - @Override - public void sendMessage(String message) { - socket.sendMessage(message); - } - - }; - - } else { - return new WaveSocket() { - final WebSocket socket = new WebSocket(new WebSocketCallback() { - @Override - public void onConnect() { - callback.onConnect(); - } - - @Override - public void onDisconnect() { - callback.onDisconnect(); - } - - @Override - public void onMessage(String message) { - callback.onMessage(message); - } - }); - - @Override - public void connect() { - socket.connect(urlBase + "socket"); - } - - @Override - public void disconnect() { - socket.close(); - } - - @Override - public void sendMessage(String message) { - socket.send(message); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveWebSocketCallback.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveWebSocketCallback.java b/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveWebSocketCallback.java deleted file mode 100644 index 60eca6c..0000000 --- a/wave/src/main/java/org/waveprotocol/box/webclient/client/WaveWebSocketCallback.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.waveprotocol.box.webclient.client; - -import org.waveprotocol.box.common.comms.ProtocolWaveletUpdate; - -/** - * Callback for a wave websocket. - * - * @author [email protected] (Anthony Baxter) - */ -public interface WaveWebSocketCallback { - - void onWaveletUpdate(ProtocolWaveletUpdate message); -}
