http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/SearchWidget.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/SearchWidget.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/SearchWidget.java
deleted file mode 100644
index 076aa4b..0000000
--- a/wave/src/main/java/org/waveprotocol/box/webclient/search/SearchWidget.java
+++ /dev/null
@@ -1,150 +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.search;
-
-import com.google.common.base.Preconditions;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.TextBox;
-
-import org.waveprotocol.wave.client.common.util.QuirksConstants;
-
-/**
- * Widget implementation of the search area.
- *
- * @author [email protected] (David Hearnden)
- */
-public class SearchWidget extends Composite implements SearchView, 
ChangeHandler {
-
-  /** Resources used by this widget. */
-  interface Resources extends ClientBundle {
-    /** CSS */
-    @Source("Search.css")
-    Css css();
-  }
-
-  interface Css extends CssResource {
-    String self();
-    String search();
-    String query();
-    String searchButton();
-    String searchButtonsPanel();
-    String searchboxContainer();
-  }
-
-  @UiField(provided = true)
-  final static Css css = SearchPanelResourceLoader.getSearch().css();
-
-  interface Binder extends UiBinder<HTMLPanel, SearchWidget> {
-  }
-
-  private final static Binder BINDER = GWT.create(Binder.class);
-
-  private final static String DEFAULT_QUERY = "";
-
-  @UiField
-  TextBox query;
-  @UiField
-  Button searchButtonShared;
-  @UiField
-  Button searchButtonAll;
-  @UiField
-  Button searchButtonInbox;
-
-  private Listener listener;
-
-  /**
-   *
-   */
-  public SearchWidget() {
-    initWidget(BINDER.createAndBindUi(this));
-    if (QuirksConstants.SUPPORTS_SEARCH_INPUT) {
-      query.getElement().setAttribute("type", "search");
-      query.getElement().setAttribute("results", "10");
-      query.getElement().setAttribute("autosave", "QUERY_AUTO_SAVE");
-    }
-    query.addChangeHandler(this);
-  }
-
-  @Override
-  public void init(Listener listener) {
-    Preconditions.checkState(this.listener == null);
-    Preconditions.checkArgument(listener != null);
-    this.listener = listener;
-  }
-
-  @Override
-  public void reset() {
-    Preconditions.checkState(listener != null);
-    listener = null;
-  }
-
-  @Override
-  public String getQuery() {
-    return query.getValue();
-  }
-
-  @Override
-  public void setQuery(String text) {
-    query.setValue(text);
-  }
-
-  @Override
-  public void onChange(ChangeEvent event) {
-    if (query.getValue() == null || query.getValue().isEmpty()) {
-      query.setText(DEFAULT_QUERY);
-    }
-    onQuery();
-  }
-  
-  private void onQuery() {
-    if (listener != null) {
-      listener.onQueryEntered();
-    }
-  }
-  
-  @UiHandler("searchButtonShared")
-  public void onHandleShared(ClickEvent event) {
-    setQuery("with:@");
-    onQuery();
-  }
-  
-  @UiHandler("searchButtonAll")
-  public void onHandleAll(ClickEvent event) {
-    setQuery("");
-    onQuery();
-  }
-  
-  @UiHandler("searchButtonInbox")
-  public void onHandleInbox(ClickEvent event) {
-    setQuery("in:inbox");
-    onQuery();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/SimpleSearch.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/SimpleSearch.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/SimpleSearch.java
deleted file mode 100644
index b4822ae..0000000
--- a/wave/src/main/java/org/waveprotocol/box/webclient/search/SimpleSearch.java
+++ /dev/null
@@ -1,457 +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.search;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.gwt.http.client.Request;
-
-import org.waveprotocol.box.webclient.search.SearchService.Callback;
-import org.waveprotocol.box.webclient.search.SearchService.DigestSnapshot;
-import org.waveprotocol.wave.client.debug.logger.DomLogger;
-import org.waveprotocol.wave.common.logging.LoggerBundle;
-import org.waveprotocol.wave.model.document.WaveContext;
-import org.waveprotocol.wave.model.id.ModernIdSerialiser;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.util.CollectionUtils;
-import org.waveprotocol.wave.model.util.CopyOnWriteSet;
-import org.waveprotocol.wave.model.util.ReadableStringMap.ProcV;
-import org.waveprotocol.wave.model.util.StringMap;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.util.List;
-
-/**
- * A simple implementation of the search model, using a search service.
- * <p>
- * This search keeps a list that corresponds to the total search result size.
- * Segments of that list are filled in as necessary.
- *
- * @author [email protected] (David Hearnden)
- */
-public final class SimpleSearch implements Search, WaveStore.Listener {
-
-  private final static LoggerBundle log = new DomLogger("search");
-
-  /**
-   * Wraps a digest snapshot, but can switch to an optimistic wave-based digest
-   * if a wave is available ({@link #activate} and {@link #deactivate}). The
-   * snapshot this proxy wraps can also be replaced, e.g., from updated search
-   * results, with {@link #update}. This proxy supports liveness, notifying
-   * listeners of changes.
-   */
-  class DigestProxy implements Digest, WaveBasedDigest.Listener {
-    /** Snapshot from the search result. Never null. */
-    private DigestSnapshot staticDigest;
-    /** Optimistic digest from a wave. May be null. */
-    private WaveBasedDigest dynamicDigest;
-
-    DigestProxy(DigestSnapshot staticDigest) {
-      Preconditions.checkArgument(staticDigest != null);
-      this.staticDigest = staticDigest;
-    }
-
-    /**
-     * Destroys this object, releasing its resources.
-     */
-    void destroy() {
-      if (dynamicDigest != null) {
-        deactivate();
-      }
-    }
-
-    /**
-     * Switches to a live digest, sourced from a wave. This fires a change
-     * event.
-     */
-    void activate(WaveContext wave) {
-      Preconditions.checkState(dynamicDigest == null);
-      dynamicDigest = WaveBasedDigest.create(wave);
-      dynamicDigest.addListener(this);
-      fireOnChanged();
-    }
-
-    /**
-     * Abandons the live digest, falling back to a static digest. The state 
from
-     * the live digest is pushed into a static form, so this action should not
-     * cause any change to the digest state, and so does not fire a change 
event.
-     */
-    void deactivate() {
-      Preconditions.checkState(dynamicDigest != null);
-      staticDigest =
-          new DigestSnapshot(getTitle(), getSnippet(), getWaveId(), 
getAuthor(),
-              getParticipantsSnippet(), getLastModifiedTime(), 
getUnreadCount(), getBlipCount());
-      dynamicDigest.destroy();
-      dynamicDigest = null;
-    }
-
-    /**
-     * Updates the static digest. Do nothing if this digest is currently live.
-     */
-    void update(DigestSnapshot snapshot) {
-      staticDigest = snapshot;
-      if (dynamicDigest == null) {
-        fireOnChanged();
-      }
-    }
-
-    private Digest getDelegate() {
-      return dynamicDigest != null ? dynamicDigest : staticDigest;
-    }
-
-    //
-    // Forward Digest API to delegate.
-    //
-
-    @Override
-    public WaveId getWaveId() {
-      return getDelegate().getWaveId();
-    }
-
-    @Override
-    public ParticipantId getAuthor() {
-      return getDelegate().getAuthor();
-    }
-
-    @Override
-    public List<ParticipantId> getParticipantsSnippet() {
-      return getDelegate().getParticipantsSnippet();
-    }
-
-    @Override
-    public String getTitle() {
-      return getDelegate().getTitle();
-    }
-
-    @Override
-    public String getSnippet() {
-      return getDelegate().getSnippet();
-    }
-
-    @Override
-    public int getUnreadCount() {
-      return getDelegate().getUnreadCount();
-    }
-
-    @Override
-    public int getBlipCount() {
-      return getDelegate().getBlipCount();
-    }
-
-    @Override
-    public double getLastModifiedTime() {
-      return getDelegate().getLastModifiedTime();
-    }
-
-    //
-    // Events.
-    //
-
-    @Override
-    public void onChanged() {
-      // Fan out events from the live digest to this digest's listeners.
-      fireOnChanged();
-    }
-
-    private void fireOnChanged() {
-      // TODO(hearnden): make not linear.
-      fireOnDigestReady(results.indexOf(staticDigest), this);
-    }
-  }
-
-  /** Service that performs searches. */
-  private final SearchService searcher;
-
-  /**
-   * A list the size of the total search result, populated with digests that 
are
-   * known to this search model.
-   */
-  private final List<DigestSnapshot> results = CollectionUtils.newArrayList();
-
-  /**
-   * Map of all digests.
-   */
-  private final StringMap<DigestProxy> digests = 
CollectionUtils.createStringMap();
-
-  /** Store of all open waves in the client. */
-  private final WaveStore waveStore;
-
-  /** Listeners. */
-  private final CopyOnWriteSet<Listener> listeners = CopyOnWriteSet.create();
-
-  /** The request that is currently in flight, or {@code null}. */
-  private Callback outstanding;
-
-  /** Total size of the search result. */
-  private int total = 0;
-
-  private Request previousRequest;
-
-  private String previousQuery;
-
-  private int previousSize;
-
-  @VisibleForTesting
-  SimpleSearch(SearchService searcher, WaveStore store) {
-    this.searcher = searcher;
-    this.waveStore = store;
-  }
-
-  /**
-   * Creates a search model.
-   *
-   * @param searcher service that performs searches
-   * @param store store of open waves
-   */
-  public static SimpleSearch create(SearchService searcher, WaveStore store) {
-    SimpleSearch search = new SimpleSearch(searcher, store);
-    search.init();
-    return search;
-  }
-
-  private void init() {
-    waveStore.addListener(this);
-  }
-
-  /**
-   * Destroys this search model, releasing its resources.
-   */
-  public void destroy() {
-    destroyDigests();
-    waveStore.removeListener(this);
-    outstanding = null;
-  }
-
-  private void destroyDigests() {
-    digests.each(new ProcV<DigestProxy>() {
-      @Override
-      public void apply(String key, DigestProxy value) {
-        value.destroy();
-      }
-    });
-    digests.clear();
-    results.clear();
-    total = 0;
-  }
-
-  @Override
-  public void find(String query, int size) {
-    if (previousRequest != null && previousRequest.isPending()) {
-      if (query.equals(previousQuery) && size == previousSize) {
-        // Same query, we should wait to the response
-        return;
-      }
-    }
-    previousQuery = query;
-    previousSize = size;
-    Callback callback = new Callback() {
-      @Override
-      public void onFailure(String message) {
-        if (outstanding == this) {
-          outstanding = null;
-          previousRequest = null;
-          handleFailure(message);
-        }
-      }
-
-      @Override
-      public void onSuccess(int total, List<DigestSnapshot> snapshots) {
-        if (outstanding == this) {
-          outstanding = null;
-          previousRequest = null;
-          handleSuccess(total, 0, snapshots);
-        }
-      }
-    };
-
-    if (outstanding == null) {
-      outstanding = callback;
-      previousRequest = searcher.search(query, 0, size, callback);
-      fireOnStateChanged();
-    } else {
-      outstanding = callback;
-      previousRequest = searcher.search(query, 0, size, callback);
-    }
-  }
-
-  @Override
-  public void cancel() {
-    handleFailure("cancelled by user");
-  }
-
-  /**
-   * Logs an error.  Destroys the current results.
-   */
-  private void handleFailure(String message) {
-    log.error().log("Search failed: ", message);
-    destroyDigests();
-    fireOnStateChanged();
-  }
-
-  /**
-   * Copies the digest snapshots into this search result's state.
-   */
-  private void handleSuccess(int total, int from, List<DigestSnapshot> 
newDigests) {
-    if (this.total == total
-        && from + newDigests.size() <= results.size()
-        && results.subList(from, from + newDigests.size()).hashCode() == 
newDigests.hashCode()) {
-      log.trace().log("handling vacuous update");
-      // Assume no change, but notify listeners that the search is complete.
-      fireOnStateChanged();
-    } else {
-      // For an incremental search, the result must be changed in steps that 
can
-      // be communicated in the event language of the listener. Since the 
search
-      // service is not incremental, computing a minimal diff is complicated.
-      // Since the intent is eventually to make the search service itself
-      // incremental, a brute force re-rendering here is a stop-gap.
-
-      // Remove all digests.  Remove from last to first, so that remove is 
O(1).
-      log.trace().log("handling changed search");
-      for (int i = results.size() - 1; i >= 0; i--) {
-        DigestSnapshot oldSnapshot = results.get(i);
-        DigestProxy oldDigest = getDigest(i);
-        results.remove(i);
-        
digests.remove(ModernIdSerialiser.INSTANCE.serialiseWaveId(oldDigest.getWaveId()));
-        oldDigest.destroy();
-      }
-      // Now grow from nothing up to the new result size.
-      if (this.total != total) {
-        this.total = total;
-      }
-      ensureMinimumSize(total == Search.UNKNOWN_SIZE ? from + 
newDigests.size() : total);
-      for (int to = from + newDigests.size(), i = from; i < to; i++) {
-        results.set(i, newDigests.get(i - from));
-      }
-      fireOnTotalChanged(total);
-      fireOnStateChanged();
-    }
-  }
-
-  /**
-   * Ensures that the result list is at least a certain size.
-   */
-  private void ensureMinimumSize(int total) {
-    while (results.size() < total) {
-      results.add(null);
-    }
-  }
-
-  @Override
-  public State getState() {
-    return outstanding == null ? State.READY : State.SEARCHING;
-  }
-
-  @Override
-  public DigestProxy getDigest(int index) {
-    Preconditions.checkState(outstanding == null);
-    DigestSnapshot result = results.get(index);
-    WaveId waveId = result.getWaveId();
-    String id = ModernIdSerialiser.INSTANCE.serialiseWaveId(waveId);
-    DigestProxy proxy = digests.get(id);
-    if (proxy == null) {
-      proxy = new DigestProxy(result);
-      digests.put(id, proxy);
-
-      // Switch to a live digest if the wave is open.
-      WaveContext wave = waveStore.getOpenWaves().get(waveId);
-      if (wave != null) {
-        proxy.activate(wave);
-      }
-    }
-
-    return proxy;
-  }
-
-  @Override
-  public int getTotal() {
-    Preconditions.checkState(outstanding == null);
-    return total;
-  }
-
-  @Override
-  public int getMinimumTotal() {
-    return results.size();
-  }
-
-  //
-  // Events of interest to this search.
-  //
-
-  /**
-   * If the opened wave is in the search result, switches to an optimistic 
digest.
-   */
-  @Override
-  public void onOpened(WaveContext wave) {
-    String id = 
ModernIdSerialiser.INSTANCE.serialiseWaveId(wave.getWave().getWaveId());
-    DigestProxy digest = digests.get(id);
-    if (digest != null) {
-      log.trace().log("switching to active digest for: ", id);
-      digest.activate(wave);
-    }
-  }
-
-  @Override
-  public void onClosed(WaveContext wave) {
-    String id = 
ModernIdSerialiser.INSTANCE.serialiseWaveId(wave.getWave().getWaveId());
-    DigestProxy digest = digests.get(id);
-    if (digest != null) {
-      log.trace().log("switching to passive digest for: ", id);
-      digest.deactivate();
-    }
-  }
-
-  //
-  // Broadcast events.
-  //
-
-  @Override
-  public void addListener(Listener listener) {
-    listeners.add(listener);
-  }
-
-  @Override
-  public void removeListener(Listener listener) {
-    listeners.remove(listener);
-  }
-
-  private void fireOnStateChanged() {
-    for (Listener listener : listeners) {
-      listener.onStateChanged();
-    }
-  }
-
-  private void fireOnTotalChanged(int total) {
-    for (Listener listener : listeners) {
-      listener.onTotalChanged(total);
-    }
-  }
-
-  private void fireOnDigestReady(int index, Digest digest) {
-    for (Listener listener : listeners) {
-      listener.onDigestReady(index, digest);
-    }
-  }
-
-  private void fireOnDigestRemoved(int index, Digest digest) {
-    for (Listener listener : listeners) {
-      listener.onDigestRemoved(index, digest);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/ToppingUpPool.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/ToppingUpPool.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/ToppingUpPool.java
deleted file mode 100644
index 07d86fd..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/ToppingUpPool.java
+++ /dev/null
@@ -1,136 +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.search;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import org.waveprotocol.wave.client.scheduler.Scheduler.IncrementalTask;
-import org.waveprotocol.wave.client.scheduler.SchedulerInstance;
-import org.waveprotocol.wave.client.scheduler.TimerService;
-import org.waveprotocol.wave.model.util.CollectionUtils;
-
-import java.util.Queue;
-
-/**
- * An item pool that attempts to ensure that its free pool always has a minimum
- * number of items.
- *
- * @author [email protected] (David Hearnden)
- */
-public final class ToppingUpPool<T> implements Pool<T>, IncrementalTask {
-
-  /**
-   * Item factory.
-   */
-  public interface Factory<T> {
-    T create();
-  }
-
-  /** Timer for running the top-up task. */
-  private final TimerService timer;
-
-  /** Desired number of items to be ready in the free pool. */
-  private final int minimumFreeCount;
-
-  /** Store of freed items. */
-  private final Queue<T> free = CollectionUtils.createQueue();
-
-  /** Object factory. */
-  private final Factory<? extends T> factory;
-
-  /** Number of items created. */
-  private int created;
-
-  @VisibleForTesting
-  ToppingUpPool(TimerService timer, Factory<? extends T> factory, int 
minimumFreeCount) {
-    this.timer = timer;
-    this.factory = factory;
-    this.minimumFreeCount = minimumFreeCount;
-    warmUpLater();
-  }
-
-  /**
-   * Creates a pool.
-   *
-   * @param factory factory for creating items
-   * @param minSize number of items to keep free in the pool
-   */
-  public static <T> ToppingUpPool<T> create(Factory<? extends T> factory, int 
minSize) {
-    return new ToppingUpPool<T>(SchedulerInstance.getLowPriorityTimer(), 
factory, minSize);
-  }
-
-  /**
-   * @return a fresh, new, item.
-   */
-  private T summon() {
-    created++;
-    return factory.create();
-  }
-
-  @Override
-  public T get() {
-    T item;
-    if (free.isEmpty()) {
-      item = summon();
-    } else {
-      item = free.poll();
-      // If the free pool just became empty, schedule top-up.
-      if (free.isEmpty()) {
-        warmUpLater();
-      }
-    }
-    return item;
-  }
-
-  @Override
-  public void recycle(T itemUi) {
-    free.add(itemUi);
-  }
-
-  /**
-   * @return the number of items produced by this pool that are still in use
-   *         (i.e., have not been recycled).
-   */
-  public int getWildCount() {
-    return created - free.size();
-  }
-
-  //
-  // Task that, when triggered, ensures the free pool has a minimum size.
-  //
-
-  /**
-   * Warms up the item pool at some time in the future.
-   */
-  private void warmUpLater() {
-    if (!timer.isScheduled(this)) {
-      timer.schedule(this);
-    }
-  }
-
-  @Override
-  public boolean execute() {
-    if (free.size() < minimumFreeCount) {
-      free.add(summon());
-    }
-    // Keep running while still more items to create
-    return free.size() < minimumFreeCount;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveBasedDigest.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveBasedDigest.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveBasedDigest.java
deleted file mode 100644
index 04db9b6..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveBasedDigest.java
+++ /dev/null
@@ -1,338 +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.search;
-
-import org.waveprotocol.box.common.Snippets;
-import org.waveprotocol.wave.client.state.BlipReadStateMonitor;
-import org.waveprotocol.wave.model.conversation.Conversation;
-import org.waveprotocol.wave.model.conversation.ConversationStructure;
-import org.waveprotocol.wave.model.conversation.TitleHelper;
-import org.waveprotocol.wave.model.document.WaveContext;
-import org.waveprotocol.wave.model.id.IdUtil;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.util.CollectionUtils;
-import org.waveprotocol.wave.model.util.CopyOnWriteSet;
-import org.waveprotocol.wave.model.version.HashedVersion;
-import org.waveprotocol.wave.model.wave.Blip;
-import org.waveprotocol.wave.model.wave.ObservableWavelet;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.model.wave.WaveViewListener;
-import org.waveprotocol.wave.model.wave.Wavelet;
-import org.waveprotocol.wave.model.wave.WaveletListener;
-import org.waveprotocol.wave.model.wave.data.ObservableWaveletData;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * Produces a digest from a wave.
- *
- * @author [email protected] (David Hearnden)
- */
-public final class WaveBasedDigest
-    implements Digest, BlipReadStateMonitor.Listener, WaveViewListener, 
WaveletListener {
-
-  private final static int PARTICIPANT_SNIPPET_SIZE = 2;
-  private final static double NO_TIME = 1;
-
-  /** The wave to digest. */
-  private final WaveContext wave;
-  /** Observers of this digest. */
-  // TODO(hearnden): make a single listener.
-  private final CopyOnWriteSet<Listener> listeners = CopyOnWriteSet.create();
-
-  // Lazily-constructed cached answers.
-  private List<ParticipantId> participantSnippet;
-  private ParticipantId author;
-  private double lastModified = NO_TIME;
-  String snippet = null;
-
-  WaveBasedDigest(WaveContext wave) {
-    this.wave = wave;
-  }
-
-  /**
-   * Creates a digest.
-   */
-  public static WaveBasedDigest create(WaveContext wave) {
-    WaveBasedDigest digest = new WaveBasedDigest(wave);
-    digest.init();
-    return digest;
-  }
-
-  private void init() {
-    for (ObservableWavelet wavelet : wave.getWave().getWavelets()) {
-      wavelet.addListener(this);
-    }
-    wave.getWave().addListener(this);
-    wave.getBlipMonitor().addListener(this);
-  }
-
-  /**
-   * Releases listeners from observed resources.
-   */
-  void destroy() {
-    wave.getBlipMonitor().removeListener(this);
-    wave.getWave().removeListener(this);
-    for (ObservableWavelet wavelet : wave.getWave().getWavelets()) {
-      wavelet.removeListener(this);
-    }
-  }
-
-  private void ensureParticipants() {
-    if (participantSnippet != null) {
-      return;
-    }
-
-    // Participant order is defined as follows:
-    //
-    // 1. Let the conversations be in their natural order, except with the main
-    // conversation promoted to first. Project out the participants of those
-    // conversations into a list.
-    // 2. The digest author is the first participant in that list.
-    // 3. The participant snippet is the next PARTICIPANT_SNIPPET_SIZE unique
-    // participants in that list.
-    Conversation main = 
ConversationStructure.getMainConversation(wave.getConversations());
-    List<Conversation> conversations = CollectionUtils.newLinkedList();
-    conversations.addAll(wave.getConversations().getConversations());
-    // Waves are not forced to have conversations in them, so it is legitimate
-    // for main to be null.
-    if (main != null) {
-      conversations.remove(main);
-      conversations.add(0, main);
-    }
-
-    // Collect the author and participants in the same list, then partition
-    // afterwards.
-    participantSnippet = CollectionUtils.newArrayList();
-    outer: for (Conversation conversation : conversations) {
-      for (ParticipantId participant : conversation.getParticipantIds()) {
-        if (participantSnippet.size() < PARTICIPANT_SNIPPET_SIZE + 1) {
-          participantSnippet.add(participant);
-        } else {
-          break outer;
-        }
-      }
-    }
-
-    if (!participantSnippet.isEmpty()) {
-      author = participantSnippet.get(0);
-      participantSnippet = participantSnippet.subList(1, 
participantSnippet.size());
-    }
-  }
-
-  private void invalidateParticipants() {
-    author = null;
-    participantSnippet = null;
-  }
-
-  private void ensureLmt() {
-    if (lastModified != NO_TIME) {
-      return;
-    }
-    for (Wavelet wavelet : wave.getWave().getWavelets()) {
-      if (!IdUtil.isConversationalId(wavelet.getId())) {
-        // Skip non conversational wavelets.
-        continue;
-      }
-      lastModified = Math.max(lastModified, wavelet.getLastModifiedTime());
-    }
-  }
-
-  @SuppressWarnings("unused")
-  private void invalidateLmt() {
-    lastModified = NO_TIME;
-  }
-
-  @Override
-  public WaveId getWaveId() {
-    return wave.getWave().getWaveId();
-  }
-
-  @Override
-  public ParticipantId getAuthor() {
-    ensureParticipants();
-    return author;
-  }
-
-  @Override
-  public List<ParticipantId> getParticipantsSnippet() {
-    ensureParticipants();
-    return participantSnippet;
-  }
-
-  @Override
-  public String getTitle() {
-    return TitleHelper.getTitle(wave);
-  }
-
-  @Override
-  public String getSnippet() {
-    updateSnippet(wave.getWave().getRoot());
-    return snippet;
-  }
-
-  @Override
-  public int getBlipCount() {
-    return wave.getBlipMonitor().getReadCount() + 
wave.getBlipMonitor().getUnreadCount();
-  }
-
-  @Override
-  public int getUnreadCount() {
-    return wave.getBlipMonitor().getUnreadCount();
-  }
-
-  @Override
-  public double getLastModifiedTime() {
-    ensureLmt();
-    return lastModified;
-  }
-
-
-  //
-  // Events sent by this digest.
-  //
-
-
-  /**
-   * Observes digest changes.
-   */
-  interface Listener {
-    void onChanged();
-  }
-
-  public void addListener(Listener listener) {
-    listeners.add(listener);
-  }
-
-  public void removeListener(Listener listener) {
-    listeners.remove(listener);
-  }
-
-  private void fireOnChanged() {
-    for (Listener listener : listeners) {
-      listener.onChanged();
-    }
-  }
-
-  //
-  // Events of interest to this digest.
-  //
-
-  @Override
-  public void onReadStateChanged() {
-    fireOnChanged();
-  }
-
-  private void updateSnippet(ObservableWavelet wavelet) {
-    ObservableWaveletData waveletData = wavelet.getWaveletData();
-    if (waveletData != null){
-      Set<String> docsIds = waveletData.getDocumentIds();
-      if (!docsIds.contains("conversation")) {
-        return;
-      }
-      snippet = Snippets.renderSnippet(waveletData, 
Snippets.DIGEST_SNIPPET_LENGTH).trim();
-      String title = getTitle();
-      if (snippet.startsWith(title) && !title.isEmpty()) {
-        // Strip the title from the snippet if the snippet starts with the 
title.
-        snippet = snippet.substring(title.length());
-      }
-    }
-  }
-
-  @Override
-  public void onLastModifiedTimeChanged(ObservableWavelet wavelet, long 
oldTime, long newTime) {
-    if (newTime != oldTime) {
-      fireOnChanged();
-    }
-  }
-
-  @Override
-  public void onWaveletAdded(ObservableWavelet wavelet) {
-    wavelet.addListener(this);
-  }
-
-  @Override
-  public void onWaveletRemoved(ObservableWavelet wavelet) {
-    wavelet.removeListener(this);
-  }
-
-  @Override
-  public void onParticipantAdded(ObservableWavelet wavelet, ParticipantId 
participant) {
-    invalidateParticipants();
-    fireOnChanged();
-  }
-
-  @Override
-  public void onParticipantRemoved(ObservableWavelet wavelet, ParticipantId 
participant) {
-    invalidateParticipants();
-    fireOnChanged();
-  }
-
-  //
-  // Events not of interest.
-  //
-
-  @Override
-  public void onBlipAdded(ObservableWavelet wavelet, Blip blip) {
-  }
-
-  @Override
-  public void onBlipRemoved(ObservableWavelet wavelet, Blip blip) {
-  }
-
-  @Override
-  public void onBlipSubmitted(ObservableWavelet wavelet, Blip blip) {
-  }
-
-  @Override
-  public void onBlipContributorAdded(
-      ObservableWavelet wavelet, Blip blip, ParticipantId contributor) {
-  }
-
-  @Override
-  public void onBlipContributorRemoved(
-      ObservableWavelet wavelet, Blip blip, ParticipantId contributor) {
-  }
-
-  @Override
-  public void onBlipTimestampModified(
-      ObservableWavelet wavelet, Blip blip, long oldTime, long newTime) {
-  }
-
-  @Override
-  public void onBlipVersionModified(
-      ObservableWavelet wavelet, Blip blip, Long oldVersion, Long newVersion) {
-  }
-
-  @Override
-  @Deprecated
-  public void onRemoteBlipContentModified(ObservableWavelet wavelet, Blip 
blip) {
-  }
-
-  @Override
-  public void onHashedVersionChanged(
-      ObservableWavelet wavelet, HashedVersion oldHashedVersion, HashedVersion 
newHashedVersion) {
-  }
-
-  @Override
-  public void onVersionChanged(ObservableWavelet wavelet, long oldVersion, 
long newVersion) {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveStore.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveStore.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveStore.java
deleted file mode 100644
index 9b70f9d..0000000
--- a/wave/src/main/java/org/waveprotocol/box/webclient/search/WaveStore.java
+++ /dev/null
@@ -1,54 +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.search;
-
-import org.waveprotocol.wave.model.document.WaveContext;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.wave.SourcesEvents;
-
-import java.util.Map;
-
-/**
- * Reveals access to a group of open waves.
- *
- * @author [email protected] (David Hearnden)
- */
-public interface WaveStore extends SourcesEvents<WaveStore.Listener> {
-
-  interface Listener {
-    void onOpened(WaveContext wave);
-    void onClosed(WaveContext wave);
-  }
-
-  /**
-   * Adds a wave to the store.
-   */
-  void add(WaveContext wave);
-
-  /**
-   * Removes a wave from the store.
-   */
-  void remove(WaveContext wave);
-
-  /**
-   * @return the collection of currently open waves.
-   */
-  Map<WaveId, WaveContext> getOpenWaves();
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/DigestDomMessages.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/DigestDomMessages.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/DigestDomMessages.java
deleted file mode 100644
index 580b259..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/DigestDomMessages.java
+++ /dev/null
@@ -1,35 +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.search.i18n;
-
-import com.google.gwt.i18n.client.Messages;
-import com.google.gwt.i18n.client.Messages.DefaultMessage;
-
-/**
- *
- * @author akaplanov (Andrew Kaplanov)
- */
-public interface DigestDomMessages extends Messages {
-  @DefaultMessage("of {0}")
-  String of(int count);
-
-  @DefaultMessage("msgs")
-  public String msgs();
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchPresenterMessages.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchPresenterMessages.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchPresenterMessages.java
deleted file mode 100644
index 9e6c301..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchPresenterMessages.java
+++ /dev/null
@@ -1,41 +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.search.i18n;
-
-import com.google.gwt.i18n.client.Messages;
-import com.google.gwt.i18n.client.Messages.DefaultMessage;
-
-/**
- *
- * @author akaplanov (Andrew Kaplanov)
- */
-public interface SearchPresenterMessages extends Messages {
-  @DefaultMessage("New Wave")
-  String newWave();
-
-  @DefaultMessage("of {0}")
-  String of(int count);
-
-  @DefaultMessage("of unknown")
-  String ofUnknown();
-
-  @DefaultMessage("Searching...")
-  String searching();
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchWidgetMessages.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchWidgetMessages.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchWidgetMessages.java
deleted file mode 100644
index 490b839..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/i18n/SearchWidgetMessages.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.search.i18n;
-
-import com.google.gwt.i18n.client.Messages;
-import com.google.gwt.i18n.client.Messages.DefaultMessage;
-
-/**
- *
- * @author akaplanov (Andrew Kaplanov)
- */
-public interface SearchWidgetMessages extends Messages {
-  @DefaultMessage("Shared")
-  String shared();
-
-  @DefaultMessage("All")
-  public String all();
-
-  @DefaultMessage("Inbox")
-  public String inbox();
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/mock/search.html
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/mock/search.html 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/mock/search.html
deleted file mode 100644
index 026a0ed..0000000
--- a/wave/src/main/java/org/waveprotocol/box/webclient/search/mock/search.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd";>
-<!--
-  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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd";>
-<html>
-<head>
-<title>Title</title>
-<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
-<link rel="stylesheet" type="text/css" href="digest.css">
-<style type="text/css">
-body {
-  font-family: arial;
-  font-size: 13px;
-}
-
-#frame {
-  width: 540px;
-  margin: auto;  /* Horz center. */
-  height: 245px; /* 41 x 6 - 1. */
-  overflow-y: scroll;
-  border: 1px solid black;
-}
-</style>
-<script type="text/javascript">
-
-function clone() {
-  frame = document.getElementById('frame');
-  digest = document.getElementById('digest');
-
-  for (var i = 0; i < 15; i++) {
-    frame.appendChild(digest.cloneNode(true));
-  }
-  digest.className += ' selected';
-}
-</script>
-</head>
-<body onload='clone()'>
-<h2>Digests</h2>
-
-<div id='frame'>
-  <div id='digest' class='digest'>
-    <div class='inner'>
-      <div class='avatars'>
-        <img class='avatar' src='unknown.jpg' alt=''>
-        <img class='avatar' src='unknown.jpg' alt=''>
-        <img class='avatar' src='unknown.jpg' alt=''>
-      </div>
-      <div class='info'>
-        <div class='unread time'>30 Jan</div>
-        <div class='msgs'>
-          <span class='unreadCount'>4</span>
-          of
-          <span class='readCount'>14</span>
-        </div>
-      </div>
-      <div class='text'>
-        <span class='unread title'>Lorem ipsum dolor sit amet</span>
-        &mdash;
-        <span class='snippet'>consectetur adipisicing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span>
-      </div>
-    </div>
-  </div>
-</div>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/search/testing/FakeSearchService.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/testing/FakeSearchService.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/search/testing/FakeSearchService.java
deleted file mode 100644
index 818f62a..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/search/testing/FakeSearchService.java
+++ /dev/null
@@ -1,117 +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.search.testing;
-
-import com.google.common.base.Joiner;
-import com.google.gwt.http.client.Request;
-
-import org.waveprotocol.box.webclient.search.SearchService;
-import org.waveprotocol.wave.client.scheduler.Scheduler.Task;
-import org.waveprotocol.wave.client.scheduler.SchedulerInstance;
-import org.waveprotocol.wave.client.scheduler.TimerService;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.util.CollectionUtils;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
-/**
- * Serves up fake search results.
- *
- * @author [email protected] (David Hearnden)
- */
-public final class FakeSearchService implements SearchService {
-  private static final int FAKE_DELAY_MS = 300;
-  private final TimerService timer;
-  private final List<DigestSnapshot> canned;
-
-  public static class Factory {
-    private final static int FAKE_DIGEST_COUNT = 50;
-    /** A bunch of random words. */
-    private final static String[] FAKE_WORDS =
-        {"alien", "bellies", "cherry", "dustiest", "effected", "family", 
"milkweed", "sniffs",
-            "tunnel", "unofficially", "virtually", "withdrawal", "x-ray", 
"zippy"};
-
-    public static List<DigestSnapshot> createCanned(ParticipantId me) {
-      String domain = me.getDomain();
-      Random r = new Random();
-      double now = SchedulerInstance.getLowPriorityTimer().currentTimeMillis();
-      double week = 7 * 24 * 60 * 60 * 1000;
-      List<DigestSnapshot> digests = CollectionUtils.newArrayList();
-      List<ParticipantId> allParticipants =
-          Arrays.asList(me, ParticipantId.ofUnsafe("john@" + domain),
-              ParticipantId.ofUnsafe("jane@" + domain), 
ParticipantId.ofUnsafe("jill@" + domain));
-      for (int i = 0; i < FAKE_DIGEST_COUNT; i++) {
-        String title = randomSentence(r, 4);
-        String snippet = randomSentence(r, 15);
-        int msgs = Math.min(5, r.nextInt(20));
-        int unread = Math.max(0, r.nextInt(msgs + 5) - 5);
-        ParticipantId author = 
allParticipants.get(r.nextInt(allParticipants.size()));
-        List<ParticipantId> participants = randomSubsequence(r, 
allParticipants);
-        participants.remove(author);
-        WaveId wid = WaveId.of(domain, "fake" + i);
-        double lmt = now - r.nextDouble() * week;
-        digests.add(new DigestSnapshot(title, snippet, wid, author, 
participants, lmt, unread, msgs));
-      }
-      return digests;
-    }
-
-    private static String randomSentence(Random r, int wordCount) {
-      String[] words = new String[wordCount];
-      for (int j = 0; j < words.length; j++) {
-        words[j] = FAKE_WORDS[r.nextInt(FAKE_WORDS.length)];
-      }
-      return Joiner.on(' ').join(words);
-    }
-
-    private static <T> List<T> randomSubsequence(Random r, List<T> items) {
-      List<T> sub = CollectionUtils.newArrayList();
-      int length = r.nextInt(items.size());
-      for (int i = 0; i < length; i++) {
-        sub.add(items.get(r.nextInt(items.size())));
-      }
-      return sub;
-    }
-
-    public static FakeSearchService create(ParticipantId me) {
-      return new FakeSearchService(SchedulerInstance.getLowPriorityTimer(), 
createCanned(me));
-    }
-  }
-
-  public FakeSearchService(TimerService timer, List<DigestSnapshot> canned) {
-    this.timer = timer;
-    this.canned = canned;
-  }
-
-  @Override
-  public Request search(String query, final int index, final int numResults, 
final Callback callback) {
-    timer.scheduleDelayed(new Task() {
-      @Override
-      public void execute() {
-        int from = Math.min(index, canned.size() - 1);
-        int to = Math.max(index + numResults, canned.size());
-        callback.onSuccess(canned.size(), canned.subList(from, to));
-      }
-    }, FAKE_DELAY_MS);
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/SingleThreadedRequestScope.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/SingleThreadedRequestScope.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/SingleThreadedRequestScope.java
deleted file mode 100644
index 2dea436..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/SingleThreadedRequestScope.java
+++ /dev/null
@@ -1,90 +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.stat;
-
-import com.google.common.collect.Maps;
-
-import org.waveprotocol.box.stat.ExecutionTree;
-import org.waveprotocol.box.stat.RequestScope;
-
-import java.util.Map;
-
-/**
- * Request scope with execution tree and current execution node for use in 
single-thread environment.
- *
- * @author [email protected] (A. Kaplanov)
- */
-@SuppressWarnings({"unchecked", "rawtypes"})
-public class SingleThreadedRequestScope implements RequestScope {
-
-  private Map<Class, Value> values;
-
-  public SingleThreadedRequestScope() {
-  }
-
-  @Override
-  public void enter() {
-    values = Maps.<Class, Value>newHashMap();
-    values.put(ExecutionTree.class, new ExecutionTree());
-  }
-
-  @Override
-  public void enter(Map<Class, Value> values) {
-    this.values = Maps.<Class, Value>newHashMap(values);
-  }
-
-  @Override
-  public boolean isEntered() {
-    return values != null;
-  }
-
-  @Override
-  public void exit() {
-    checkScoping();
-    values = null;
-  }
-
-  @Override
-  public <T extends Value> void set(Class<T> clazz, T value) {
-    checkScoping();
-    values.put(clazz, value);
-  }
-
-  @Override
-  public <T extends Value> T get(Class<T> clazz) {
-    checkScoping();
-    return (T)values.get(clazz);
-  }
-
-  @Override
-  public Map<Class, Value> cloneValues() {
-    checkScoping();
-    Map<Class, Value> map = Maps.<Class, Value>newHashMap();
-    for (Map.Entry<Class, Value> entry : values.entrySet()) {
-      map.put(entry.getKey(), entry.getValue().clone());
-    }
-    return map;
-  }
-
-  private void checkScoping() {
-    if (values == null) {
-      enter();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/dialog/StatDialog.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/dialog/StatDialog.java 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/dialog/StatDialog.java
deleted file mode 100644
index 692a6d2..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/dialog/StatDialog.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.stat.dialog;
-
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-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 com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import org.waveprotocol.box.stat.StatService;
-
-import org.waveprotocol.box.stat.Timing;
-import org.waveprotocol.wave.client.widget.dialog.DialogBox;
-import org.waveprotocol.wave.client.widget.dialog.DialogBox.DialogButton;
-import org.waveprotocol.wave.client.widget.popup.CenterPopupPositioner;
-import org.waveprotocol.wave.client.widget.popup.PopupChrome;
-import org.waveprotocol.wave.client.widget.popup.PopupChromeFactory;
-import org.waveprotocol.wave.client.widget.popup.PopupFactory;
-import org.waveprotocol.wave.client.widget.popup.UniversalPopup;
-
-/**
- * Dialog to show client and server profiling statistics.
- *
- * @author [email protected] (A. Kaplanov)
- */
-public class StatDialog {
-  static private final String ID_ENABLE = "enable";
-  static private final String ID_DISABLE = "disable";
-  static private final String ID_CLEAR = "clear";
-
-  private boolean isClient;
-  private UniversalPopup popup;
-  private HTMLPanel htmlPanel;
-  private DialogButton targetButton;
-  private DialogButton exitButton;
-
-  static public void show() {
-    StatDialog dialog = new StatDialog();
-    dialog.showClientStatistic();
-  }
-
-  public StatDialog() {
-    PopupChrome chrome = PopupChromeFactory.createPopupChrome();
-    popup = PopupFactory.createPopup(
-        Document.get().getElementById("app"), new CenterPopupPositioner(), 
chrome, true);
-    htmlPanel = new HTMLPanel("");
-    htmlPanel.addDomHandler(new ClickHandler(){
-
-      @Override
-      public void onClick(ClickEvent event) {
-        Element e = event.getNativeEvent().getEventTarget().cast();
-        if (e.getTagName().toLowerCase().equals("a")) {
-          event.preventDefault();
-          if (isClient) {
-            if (ID_ENABLE.equals(e.getId()) || ID_DISABLE.equals(e.getId())) {
-              Timing.setEnabled(!Timing.isEnabled());
-              showClientStatistic();
-            } else if (ID_CLEAR.equals(e.getId())) {
-              Timing.clearStatistics();
-              showClientStatistic();
-            }
-          } else {
-            String href = e.getPropertyString("href");
-            int index = href.lastIndexOf('/');
-            if (index != -1) {
-              showUrl(StatService.STAT_URL + href.substring(index+1));
-            }
-          }
-        }
-      }
-    }, ClickEvent.getType());
-
-    ScrollPanel scroll = new ScrollPanel(htmlPanel);
-    scroll.setSize(RootPanel.get().getOffsetWidth()-100 + "px",
-            RootPanel.get().getOffsetHeight()-200 + "px");
-    targetButton = new DialogBox.DialogButton("", new Command() {
-
-      @Override
-      public void execute() {
-        if (isClient) {
-          showServerStatistic();
-        } else {
-          showClientStatistic();
-        }
-      }
-    });
-    exitButton = new DialogBox.DialogButton("Exit", new Command() {
-
-      @Override
-      public void execute() {
-        popup.hide();
-      }
-    });
-    DialogBox.create(popup, "", scroll,
-        new DialogBox.DialogButton[] { targetButton, exitButton });
-  }
-
-  private void showClientStatistic() {
-    isClient = true;
-    popup.getTitleBar().setTitleText("Client statistic");
-    String control =
-        (Timing.isEnabled()?
-        "<a id=\"" + ID_DISABLE + "\" href>Disable profiling</a>":
-        "<a id=\"" + ID_ENABLE + "\" href>Enable profiling</a>");
-    String clear = "<a id=\"" + ID_CLEAR + "\" href>Clear</a>";
-    show(control + " | " + clear + Timing.renderGlobalStatistics());
-    targetButton.setTitle("Server statistic");
-    popup.show();
-  }
-
-  private void showServerStatistic() {
-    isClient = false;
-    popup.getTitleBar().setTitleText("Server statistic");
-    showUrl(StatService.STAT_URL);
-    targetButton.setTitle("Client statistic");
-    popup.show();
-  }
-
-  private void clear() {
-    htmlPanel.getElement().setInnerHTML("");
-  }
-
-  private void showUrl(String url) {
-    clear();
-    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, 
url);
-
-    requestBuilder.setCallback(new RequestCallback() {
-
-      @Override
-      public void onResponseReceived(Request request, Response response) {
-        show(response.getText());
-      }
-
-      @Override
-      public void onError(Request request, Throwable ex) {
-        Window.alert(ex.getMessage());
-      }
-    });
-    try {
-      requestBuilder.send();
-    } catch (RequestException ex) {
-      Window.alert(ex.getMessage());
-    }
-  }
-
-  private void show(final String html) {
-    htmlPanel.getElement().setInnerHTML("<div style='padding: 10px'>" + html + 
"</div>");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent.java
deleted file mode 100644
index d9f2761..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent.java
+++ /dev/null
@@ -1,143 +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.stat.gwtevent;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-
-import java.util.Iterator;
-
-/**
- * Java "Overlay" object of the event objects fired by the GWT stats system.
- */
-public class GwtStatisticsEvent extends JavaScriptObject /*implements 
StatisticsEvent*/ {
-  protected GwtStatisticsEvent() {
-  }
-
-  public final native String getModuleName() /*-{
-    return this.moduleName == null ? null : "" + this.moduleName;
-  }-*/;
-
-  public final native String getSubSystem() /*-{
-    return this.subSystem == null ? null : "" + this.subSystem;
-  }-*/;
-
-  public final native String getEventGroupKey() /*-{
-    return this.evtGroup == null ? null : "" + this.evtGroup;
-  }-*/;
-
-  public final native double getMillis() /*-{
-    return this.millis == null ? 0 : this.millis;
-  }-*/;
-
-  private final native JsArrayString getExtraParameterNames0() /*-{
-    if (!this.extraParameters) {
-      var a = new Array();
-      for (name in this) {
-        if (name != "moduleName" && name != "subSystem" && name != "evtGroup" 
&& name != "millis") {
-          a.push(name);
-        }
-      }
-      this.extraParameters = a;
-    }
-    return this.extraParameters
-  }-*/;
-
-  public final native Object getExtraParameter(String name) /*-{
-    var r = this[name], t = typeof(r);
-    if (t == "number") {
-      r = @java.lang.Double::new(D)(r);
-    } else if (t == "boolean") {
-      r = @java.lang.Boolean::new(Z)(r);
-    }
-    return r;
-  }-*/;
-
-  public final StatisticsEvent asEvent() {
-    return new StatisticsEvent() {
-      //@Override
-      public String getModuleName() {
-        return GwtStatisticsEvent.this.getModuleName();
-      }
-      //@Override
-      public String getSubSystem() {
-        return GwtStatisticsEvent.this.getSubSystem();
-      }
-      //@Override
-      public String getEventGroupKey() {
-        return GwtStatisticsEvent.this.getEventGroupKey();
-      }
-      //@Override
-      public double getMillis() {
-        return GwtStatisticsEvent.this.getMillis();
-      }
-      //@Override
-      public Iterator<String> getExtraParameterNames() {
-        final JsArrayString names = getExtraParameterNames0();
-        return new Iterator<String>() {
-          private int idx = 0;
-
-          //@Override
-          public boolean hasNext() {
-            return idx < names.length();
-          }
-
-          //@Override
-          public String next() {
-            return names.get(idx++);
-          }
-
-          //@Override
-          public void remove() {
-            throw new RuntimeException("parameter names are read-only");
-          }
-        };
-      }
-      //@Override
-      public Object getExtraParameter(String name) {
-        return GwtStatisticsEvent.this.getExtraParameter(name);
-      }
-    };
-  }
-
-  public static GwtStatisticsEvent fromEvent(StatisticsEvent event) {
-    GwtStatisticsEvent result = fromEvent0(event.getModuleName(), 
event.getSubSystem(),
-        event.getEventGroupKey(), event.getMillis());
-    for (Iterator<String> it = event.getExtraParameterNames(); it.hasNext(); ) 
{
-      String name = it.next();
-      set(result, name, event.getExtraParameter(name));
-    }
-    return result;
-  }
-
-  private static native GwtStatisticsEvent fromEvent0(String moduleName, 
String subSystem,
-      String eventGroup, double millis) /*-{
-    var result = {
-      moduleName: moduleName,
-      subSystem: subSystem,
-      evtGroup: eventGroup,
-      millis: millis,
-    };
-    return result;
-  }-*/;
-
-  private static native void set(GwtStatisticsEvent event, String name, Object 
value) /*-{
-    event[name] = value;
-  }-*/;
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventDispatcher.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventDispatcher.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventDispatcher.java
deleted file mode 100644
index 22fd38b..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventDispatcher.java
+++ /dev/null
@@ -1,117 +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.stat.gwtevent;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.impl.RemoteServiceProxy;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Stats event dispatcher that uses the GWT global stats function to dispatch
- * events.
- */
-public class GwtStatisticsEventDispatcher implements StatisticsEventDispatcher 
{
-
-  //@Override
-  public boolean enabled() {
-    return RemoteServiceProxy.isStatsAvailable();
-  }
-
-  //@Override
-  public StatisticsEvent newEvent(String system, String group, double millis, 
String type) {
-    Event event = new Event(GWT.getModuleName(), system, group, millis);
-    if (type != null) {
-      setExtraParameter(event, "type", type);
-    }
-    return event;
-  }
-
-  //@Override
-  public void setExtraParameter(StatisticsEvent event, String name, String 
value) {
-    ((Event) event).set(name, value);
-  }
-
-  //@Override
-  public void setExtraParameter(StatisticsEvent event, String name, 
JavaScriptObject value) {
-    ((Event) event).set(name, value);
-  }
-
-  //@Override
-  public void dispatch(StatisticsEvent event) {
-    dispatch0(GwtStatisticsEvent.fromEvent(event));
-  }
-
-  private native void dispatch0(JavaScriptObject event) /*-{
-    $stats && $stats(event);
-  }-*/;
-
-  private static class Event implements StatisticsEvent {
-    private String module;
-    private String system;
-    private String group;
-    private double millis;
-    private Map<String, Object> params;
-
-    public Event(String module, String system, String group, double millis) {
-      this.module = module;
-      this.system = system;
-      this.group = group;
-      this.millis = millis;
-      this.params = new HashMap<String, Object>();
-    }
-
-    //@Override
-    public String getModuleName() {
-      return module;
-    }
-
-    //@Override
-    public String getSubSystem() {
-      return system;
-    }
-
-    //@Override
-    public String getEventGroupKey() {
-      return group;
-    }
-
-    //@Override
-    public double getMillis() {
-      return millis;
-    }
-
-    //@Override
-    public Iterator<String> getExtraParameterNames() {
-      return params.keySet().iterator();
-    }
-
-    //@Override
-    public Object getExtraParameter(String name) {
-      return params.get(name);
-    }
-
-    protected void set(String name, Object value) {
-      params.put(name, value);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventSystem.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventSystem.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventSystem.java
deleted file mode 100644
index 545825e..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEventSystem.java
+++ /dev/null
@@ -1,137 +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.stat.gwtevent;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * Implementation of the {@link StatisticsEventSystem} that dispatches all the
- * GWT events.
- */
-public class GwtStatisticsEventSystem implements StatisticsEventSystem {
-  private Listeners listeners;
-  private boolean enabled;
-
-  public GwtStatisticsEventSystem() {
-    this.listeners = new Listeners();
-    this.enabled = false;
-  }
-
-  public void enable(boolean replay) {
-    if (!enabled) {
-      enable0(listeners);
-      enabled = true;
-    }
-    if (replay) {
-      replay(listeners);
-    }
-  }
-
-  private native void enable0(StatisticsEventListener listener) /*-{
-    var old = $wnd.__stats_listener;
-    if (!old) {
-      old = function() {};
-    }
-    $wnd.__stats_listener = function(event) {
-      old(event);
-      
@org.waveprotocol.box.webclient.stat.gwtevent.GwtStatisticsEventSystem::onEvent(Lorg/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent;Lorg/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener;)
-        (event, listener);
-    };
-  }-*/;
-
-  protected static void onEvent(GwtStatisticsEvent event, 
StatisticsEventListener listener) {
-    listener.onStatisticsEvent(event.asEvent());
-  }
-
-  //@Override
-  public void addListener(StatisticsEventListener listener, boolean replay) {
-    if (replay) {
-      replay(listener);
-    }
-    listeners.add(listener);
-  }
-
-  private native void replay(StatisticsEventListener listener) /*-{
-    var stats = $wnd.__stats;
-    if (stats) {
-      for (var i in stats) {
-        
@org.waveprotocol.box.webclient.stat.gwtevent.GwtStatisticsEventSystem::onEvent(Lorg/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsEvent;Lorg/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener;)
-          (stats[i], listener);
-      }
-    }
-  }-*/;
-
-  //@Override
-  public void removeListener(StatisticsEventListener listener) {
-    listeners.remove(listener);
-  }
-
-
-  //@Override
-  public native void clearEventHistory() /*-{
-    $wnd.__stats.length = 0;
-  }-*/;
-
-  //@Override
-  public Iterator<StatisticsEvent> pastEvents() {
-    return new Iterator<StatisticsEvent>() {
-      private int idx = 0;
-
-      //@Override
-      public void remove() {
-        throw new RuntimeException("Illegal operation. Event history is 
read-only.");
-      }
-
-      //@Override
-      public boolean hasNext() {
-        return hasNext0(idx);
-      }
-
-      private native boolean hasNext0(int idx) /*-{
-        var stats = $wnd.__stats;
-        return stats && (idx < stats.length);
-      }-*/;
-
-      //@Override
-      public StatisticsEvent next() {
-        return next0(idx++).asEvent();
-      }
-
-      private native GwtStatisticsEvent next0(int idx) /*-{
-        var stats = $wnd.__stats;
-        return (stats && (idx < stats.length)) ? stats[idx] : null;
-      }-*/;
-    };
-  }
-
-  private static class Listeners
-      extends ArrayList<StatisticsEventListener> implements 
StatisticsEventListener {
-
-    public Listeners() {
-    }
-
-    //@Override
-    public void onStatisticsEvent(StatisticsEvent event) {
-      for (StatisticsEventListener l : this) {
-        l.onStatisticsEvent(event);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsHandler.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsHandler.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsHandler.java
deleted file mode 100644
index f3096c1..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/GwtStatisticsHandler.java
+++ /dev/null
@@ -1,94 +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.stat.gwtevent;
-
-import org.waveprotocol.box.stat.Timer;
-import org.waveprotocol.box.stat.Timing;
-
-import java.util.Iterator;
-
-/**
- * Transformer of GWT statistic.
- *
- * @author [email protected] (A. Kaplanov)
- */
-public class GwtStatisticsHandler implements StatisticsEventListener {
-  static private String GWT_PREFIX = "GWT.";
-
-  static private String PARAM_TYPE = "type";
-  static private String TYPE_BEGIN = "begin";
-  static private String TYPE_END = "end";
-
-  private Timer requestTimer;
-  private String currentGroup;
-  private long previousCallTimestamp;
-
-  @Override
-  public void onStatisticsEvent(StatisticsEvent event) {
-    String group = event.getEventGroupKey();
-    String type = (String)event.getExtraParameter(PARAM_TYPE);
-    if (TYPE_BEGIN.equals(type)) {
-      enterGroup(group, (long)event.getMillis());
-    } else {
-      if (TYPE_END.equals(type)) {
-        leaveGroup((long)event.getMillis());
-      } else {
-        if (!group.equals(currentGroup)) {
-          leaveGroup((long)event.getMillis());
-          enterGroup(group, (long)event.getMillis());
-        }
-        Timing.record(GWT_PREFIX + type, 
(int)((long)event.getMillis()-previousCallTimestamp));
-      }
-    }
-    previousCallTimestamp = (long)event.getMillis();
-  }
-
-  private void enterGroup(String group, long time) {
-    if (Timing.isEnabled()) {
-      Timing.enterScope();
-      requestTimer = Timing.startRequest(GWT_PREFIX + group);
-      requestTimer.start(time);
-      currentGroup = group;
-    }
-  }
-
-  private void leaveGroup(long time) {
-    if (Timing.isEnabled() && currentGroup != null) {
-      Timing.stop(requestTimer, time);
-      requestTimer = null;
-      currentGroup = null;
-      Timing.exitScope();
-    }
-  }
-
-  private static String getExtraParameters(StatisticsEvent event) {
-    StringBuilder sb = new StringBuilder();
-    sb.append("{");
-    Iterator<String> names = event.getExtraParameterNames();
-    if (names.hasNext()) {
-      String n = names.next();
-      sb.append(n).append(" = ").append(event.getExtraParameter(n));
-      while (names.hasNext()) {
-        sb.append(", ").append(n = names.next()).append(" = 
").append(event.getExtraParameter(n));
-      }
-    }
-    sb.append("}");
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEvent.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEvent.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEvent.java
deleted file mode 100644
index d833e67..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEvent.java
+++ /dev/null
@@ -1,67 +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.stat.gwtevent;
-
-import java.util.Iterator;
-
-/**
- * Java "Overlay" object of the JavaScript event objects fired by the stats
- * system.
- */
-public interface StatisticsEvent {
-
-  /**
-   * Answers with the name of the module that caused this event.
-   */
-  public String getModuleName();
-
-  /**
-   * Answers with the name of the sub system (rpc, boot strap, etc..) that
-   * caused this event.
-   */
-  public String getSubSystem();
-
-  /**
-   * Answers with a key unique to the group of events that this event belongs
-   * to. Along with the module and sub system this forms a unique key for
-   * timing related events. Note that each group requires at least two events:
-   * one to signal the start of the measured period and one to signal the end.
-   */
-  public String getEventGroupKey();
-
-  /**
-   * Answers with the time stamp (millis since the epoch) at which this event
-   * occurred. Using double, since long is not natively supported in
-   * JavaScript (see {@link com.google.gwt.core.client.Duration}).
-   */
-  public double getMillis();
-
-  /**
-   * Answers with a read-only iterator over the names of any extra parameters
-   * associated with this event.
-   */
-  public Iterator<String> getExtraParameterNames();
-
-  /**
-   * Answers with the given named extra parameter. Since most events are fired
-   * from within JavaScript or another module, the returned value is either a
-   * String, Double, Boolean or a JavaScriptObject.
-   */
-  public Object getExtraParameter(String name);
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventDispatcher.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventDispatcher.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventDispatcher.java
deleted file mode 100644
index 8809059..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventDispatcher.java
+++ /dev/null
@@ -1,64 +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.stat.gwtevent;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-/**
- * Helps with creating and dispatching the events for the debug panel.
- */
-public interface StatisticsEventDispatcher {
-
-  /**
-   * Returns {@code true} if there is somebody listening to events on the other
-   * side.
-   */
-  public boolean enabled();
-
-  /**
-   * Creates a new event object to be dispatched.
-
-   * @see StatisticsEvent
-   */
-  public StatisticsEvent newEvent(String system, String group, double millis, 
String type);
-
-  /**
-   * Sets the given extra parameter's value as a JavaScriptObject.
-   *
-   * @param event the event to set the parameter on. This has to be an instance
-   *        returned by @{link {@link #newEvent(String, String, double, 
String)}.
-   */
-  public void setExtraParameter(StatisticsEvent event, String name, 
JavaScriptObject value);
-
-  /**
-   * Sets the given extra parameter's value as a String.
-   *
-   * @param event the event to set the parameter on. This has to be an instance
-   *        returned by @{link {@link #newEvent(String, String, double, 
String)}.
-   */
-  public void setExtraParameter(StatisticsEvent event, String name, String 
value);
-
-  /**
-   * Dispatches the given event.
-   *
-   * @param event the event to dispatch. This has to be an instance
-   *        returned by @{link {@link #newEvent(String, String, double, 
String)}.
-   */
-  public void dispatch(StatisticsEvent event);
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener.java
deleted file mode 100644
index 42b9497..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventListener.java
+++ /dev/null
@@ -1,27 +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.stat.gwtevent;
-
-
-/**
- * Receiver of {@link StatisticsEvent} events.
- */
-public interface StatisticsEventListener {
-  public void onStatisticsEvent(StatisticsEvent event);
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/051db092/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventSystem.java
----------------------------------------------------------------------
diff --git 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventSystem.java
 
b/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventSystem.java
deleted file mode 100644
index e4bd203..0000000
--- 
a/wave/src/main/java/org/waveprotocol/box/webclient/stat/gwtevent/StatisticsEventSystem.java
+++ /dev/null
@@ -1,53 +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.stat.gwtevent;
-
-import java.util.Iterator;
-
-/**
- * The statistics event system is responsible for managing the statistics
- * {@link StatisticsEventListener event listeners} and dispatching the
- * {@link StatisticsEvent events}.
- */
-public interface StatisticsEventSystem {
-
-  /**
-   * Register a listener to receive future {@link StatisticsEvent events}.
-   *
-   * @param replay if true, past (recorded) events will be replayed on the
-   *               given listener.
-   */
-  public void addListener(StatisticsEventListener listener, boolean replay);
-
-  /**
-   * Removes a listener so it will no longer receive any
-   * {@link StatisticsEvent events}.
-   */
-  public void removeListener(StatisticsEventListener listener);
-
-  /**
-   * Provides read-only access to all the recorded events.
-   */
-  public Iterator<StatisticsEvent> pastEvents();
-
-  /**
-   * Clears the event history.
-   */
-  public void clearEventHistory();
-}

Reply via email to