http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/stat/RequestScopeFilter.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/stat/RequestScopeFilter.java 
b/src/org/waveprotocol/box/server/stat/RequestScopeFilter.java
deleted file mode 100644
index b925f78..0000000
--- a/src/org/waveprotocol/box/server/stat/RequestScopeFilter.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.server.stat;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-import org.waveprotocol.box.server.authentication.SessionManager;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.io.IOException;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import org.waveprotocol.box.stat.RequestScope;
-import org.waveprotocol.box.stat.SessionContext;
-import org.waveprotocol.box.stat.Timing;
-
-
-/**
- * Filter that executes the http servlet request in the request scope.
- *
- * @author [email protected] (A. Kaplanov)
- */
-@Singleton
-@SuppressWarnings("rawtypes")
-public class RequestScopeFilter implements Filter {
-
-  @Override
-  public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
-      throws IOException, ServletException {
-    if (Timing.isEnabled()) {
-      Timing.enterScope();
-      final HttpSession session = ((HttpServletRequest)request).getSession();
-      final ParticipantId loggedInUser = 
(ParticipantId)session.getAttribute(SessionManager.USER_FIELD);
-      Timing.setScopeValue(SessionContext.class, new SessionContext() {
-        @Override
-        public boolean isAuthenticated() {
-          return session != null;
-        }
-
-        @Override
-        public String getSessionKey() {
-          return session.getId();
-        }
-
-        @Override
-        public ParticipantId getParticipantId() {
-          return loggedInUser;
-        }
-
-        @Override
-        public RequestScope.Value clone() {
-          return this;
-        }
-      });
-    }
-
-    try {
-      chain.doFilter(request, response);
-    } finally {
-      Timing.exitScope();
-    }
-  }
-
-  @Override
-  public void init(FilterConfig config) {
-  }
-
-  @Override
-  public void destroy() {
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/stat/StatuszServlet.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/stat/StatuszServlet.java 
b/src/org/waveprotocol/box/server/stat/StatuszServlet.java
deleted file mode 100644
index 4cf4253..0000000
--- a/src/org/waveprotocol/box/server/stat/StatuszServlet.java
+++ /dev/null
@@ -1,88 +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.server.stat;
-
-import com.google.inject.Singleton;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.waveprotocol.box.stat.Timing;
-
-/**
- * Servlet to show server statistic.
- *
- * @author [email protected] (Dhanji R. Prasanna)
- * @author [email protected] (A. Kaplanov)
- */
-@Singleton
-public class StatuszServlet extends HttpServlet {
-  private final String SHOW_SESSION_MEASUREMENTS = "session-measurements";
-  private final String SHOW_GLOBAL_MEASUREMENTS = "global-measurements";
-  private final String SHOW_STATS = "stats";
-
-  @Override
-  protected void service(HttpServletRequest req, HttpServletResponse resp) 
throws IOException {
-    resp.setContentType("text/html");
-
-    PrintWriter writer = resp.getWriter();
-    writeHeader(writer);
-
-    String show = req.getParameter("show");
-    if (show == null) {
-      show = SHOW_SESSION_MEASUREMENTS;
-    }
-    switch (show) {
-      case SHOW_SESSION_MEASUREMENTS:
-        writeSessionMeasurements(writer);
-        break;
-      case SHOW_GLOBAL_MEASUREMENTS:
-        writeGlobalMeasurements(writer);
-        break;
-      case SHOW_STATS:
-        writeStats(writer);
-        break;
-    }
-  }
-
-  protected void writeHeader(PrintWriter writer) {
-    writer.write("<a href=\"?show=" + SHOW_SESSION_MEASUREMENTS + "\">Session 
measurements</a>");
-    writer.write(" | <a href=\"?show=" + SHOW_GLOBAL_MEASUREMENTS + "\">Global 
measurements</a>");
-    writer.write(" | <a href=\"?show=" + SHOW_STATS + "\">Stats</a>");
-  }
-
-  protected void writeSessionMeasurements(PrintWriter writer) {
-    writer.write(Timing.renderTitle("Session measurements", 2));
-    writer.write(Timing.renderSessionStatistics());
-  }
-
-  protected void writeGlobalMeasurements(PrintWriter writer) {
-    writer.write(Timing.renderTitle("Global measurements", 2));
-    writer.write(Timing.renderGlobalStatistics());
-  }
-
-  protected void writeStats(PrintWriter writer) {
-    writer.write(Timing.renderTitle("Stats", 2));
-    writer.write(Timing.renderStats());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/stat/TimingFilter.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/stat/TimingFilter.java 
b/src/org/waveprotocol/box/server/stat/TimingFilter.java
deleted file mode 100644
index 14123fb..0000000
--- a/src/org/waveprotocol/box/server/stat/TimingFilter.java
+++ /dev/null
@@ -1,68 +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.server.stat;
-
-import org.waveprotocol.box.stat.Timer;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.waveprotocol.box.stat.Timing;
-
-/**
- * A filter that times an entire request.
- *
- * @author David Byttow
- */
-@Singleton
-public class TimingFilter implements Filter {
-
-  @Inject
-  TimingFilter() {
-  }
-
-  @Override
-  public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
-      throws IOException, ServletException {
-    HttpServletRequest req = (HttpServletRequest) request;
-    Timer timer = Timing.startRequest(req.getRequestURI());
-    try {
-      chain.doFilter(req, response);
-    } finally {
-      Timing.stop(timer);
-    }
-  }
-
-  @Override
-  public void init(FilterConfig unused) {
-  }
-
-  @Override
-  public void destroy() {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/stat/TimingInterceptor.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/stat/TimingInterceptor.java 
b/src/org/waveprotocol/box/server/stat/TimingInterceptor.java
deleted file mode 100644
index 54d265c..0000000
--- a/src/org/waveprotocol/box/server/stat/TimingInterceptor.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.server.stat;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Singleton;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-
-import org.waveprotocol.box.stat.Timed;
-import org.waveprotocol.box.stat.Timer;
-import org.waveprotocol.box.stat.Timing;
-
-import java.lang.reflect.Method;
-
-/**
- * Intercepts method calls that have a {@link Timed} annotation.
- *
- * @author [email protected] (Dhanji R. Prasanna)
- * @author David Byttow
- */
-@Singleton
-public class TimingInterceptor implements MethodInterceptor {
-
-  private LoadingCache<Method, String> nameCache =
-      CacheBuilder.newBuilder().build(new CacheLoader<Method, String>() {
-        @Override
-        public String load(Method method) throws Exception {
-          return method.getDeclaringClass().getSimpleName() + "." + 
method.getName();
-        }
-      });
-
-  @Override
-  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
-    Method method = methodInvocation.getMethod();
-    Timed timed = method.getAnnotation(Timed.class);
-    String name = timed.value();
-    if (name.isEmpty()) {
-      name = nameCache.get(methodInvocation.getMethod());
-    }
-    Timer timer;
-    if (timed.isRequest()) {
-      timer = Timing.startRequest(name, timed.threshold());
-    } else {
-      timer = Timing.start(name, timed.threshold());
-    }
-    try {
-      return methodInvocation.proceed();
-    } finally {
-      Timing.stop(timer);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/BlockingSuccessFailCallback.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/util/BlockingSuccessFailCallback.java 
b/src/org/waveprotocol/box/server/util/BlockingSuccessFailCallback.java
deleted file mode 100644
index bdc9a0d..0000000
--- a/src/org/waveprotocol/box/server/util/BlockingSuccessFailCallback.java
+++ /dev/null
@@ -1,102 +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.server.util;
-
-import com.google.common.base.Preconditions;
-
-import org.waveprotocol.wave.model.util.Pair;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * A {@code SuccessFailCallback} which supports blocking for a response.  Note 
that neither
- * {@link #onSuccess} not {@link #onFailure} will accept a null argument.
- *
- * TODO: the behaviour for unexpected conditions is a bit harsh, should log 
not crash (but it
- * requires more work, currently unwarranted).
- */
-public class BlockingSuccessFailCallback<S, F> implements 
SuccessFailCallback<S, F> {
-
-  private final static Log LOG = Log.get(BlockingSuccessFailCallback.class);
-
-  private final AtomicReference<S> successResult = new 
AtomicReference<S>(null);
-  private final AtomicReference<F> failureResult = new 
AtomicReference<F>(null);
-  private final CountDownLatch awaitLatch = new CountDownLatch(1);
-  private final String description;
-
-  private BlockingSuccessFailCallback(String description) {
-    this.description = description;
-  }
-
-  public static <S, F> BlockingSuccessFailCallback<S, F> create() {
-    StackTraceElement caller = new Throwable().getStackTrace()[1];
-    return new BlockingSuccessFailCallback<S, F>("Created at " + 
caller.getClassName() + "."
-        + caller.getMethodName() + ":" + caller.getLineNumber());
-  }
-
-  /**
-   * Wait for either {@link #onSuccess} or {@link #onFailure} to be called and 
return both results.
-   * Either the first of the pair (success value) or second of the pair 
(failure value) will hold
-   * a not-null result indicating which method was run, while the other is 
guaranteed to contain
-   * null.
-   *
-   * The return result may be null if the await did not return within the 
timeout.
-   *
-   * @param timeout
-   * @param unit
-   * @return pair of (success value, failure value) where exactly one will be 
not-null, or null
-   *         if the await timed out
-   */
-  public Pair<S, F> await(long timeout, TimeUnit unit) {
-    try {
-      long startMs = System.currentTimeMillis();
-      if (!awaitLatch.await(timeout, unit)) {
-        LOG.warning(description + ": timed out while waiting for " + timeout + 
" " + unit);
-        return null;
-      }
-      LOG.fine(description + ": await took " + (System.currentTimeMillis() - 
startMs) + " ms");
-    } catch (InterruptedException e) {
-      LOG.severe(description + ": interrupted while waiting", e);
-      throw new IllegalStateException(e);
-    }
-    return Pair.of(successResult.get(), failureResult.get());
-  }
-
-  @Override
-  public void onFailure(F failureValue) {
-    LOG.warning(description + ": onFailure(" + failureValue + ")");
-    Preconditions.checkArgument(failureValue != null);
-    Preconditions.checkState(failureResult.getAndSet(failureValue) == null);
-    Preconditions.checkState(successResult.get() == null);
-    awaitLatch.countDown();
-  }
-
-  @Override
-  public void onSuccess(S successValue) {
-    LOG.fine(description + ": onSuccess(" + successValue + ")");
-    Preconditions.checkArgument(successResult != null);
-    Preconditions.checkState(successResult.getAndSet(successValue) == null);
-    Preconditions.checkState(failureResult.get() == null);
-    awaitLatch.countDown();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/NetUtils.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/NetUtils.java 
b/src/org/waveprotocol/box/server/util/NetUtils.java
deleted file mode 100644
index 4e4dd79..0000000
--- a/src/org/waveprotocol/box/server/util/NetUtils.java
+++ /dev/null
@@ -1,65 +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.server.util;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-
-/**
- * Networking utility methods.
- *
- * @author [email protected] (Soren Lassen)
- */
-public class NetUtils {
-
-  /** Default port number for HTTP server addresses. */
-  public static final short HTTP_DEFAULT_PORT = 80;
-
-  /**
-   * Parses a string of format "host[:port]" into a InetSocketAddress.
-   * The port defaults to HTTP_DEFAULT_PORT.
-   */
-  public static InetSocketAddress parseHttpAddress(String address) throws 
IOException {
-    String[] parts = address.split(":");
-    if (parts.length < 1) {
-      throw new IOException("Empty address");
-    }
-    if (parts.length > 2) {
-      throw new IOException("Too many colons");
-    }
-    String host = parts[0];
-    short port = HTTP_DEFAULT_PORT;
-    if (parts.length == 2) {
-      try {
-        port = Short.parseShort(parts[1]);
-        if (port <= 0) {
-          throw new IOException("Invalid port number: " + parts[1]);
-        }
-      } catch (NumberFormatException e) {
-        throw new IOException("Invalid port number: " + parts[1], e);
-      }
-    }
-    InetAddress addr = InetAddress.getByName(host);
-    return new InetSocketAddress(addr, port);
-  }
-
-
-  private NetUtils() { } // prevents instantiation
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/OAuthUtil.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/OAuthUtil.java 
b/src/org/waveprotocol/box/server/util/OAuthUtil.java
deleted file mode 100644
index 3f0b021..0000000
--- a/src/org/waveprotocol/box/server/util/OAuthUtil.java
+++ /dev/null
@@ -1,42 +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.server.util;
-
-import net.oauth.OAuth;
-import net.oauth.OAuthProblemException;
-import net.oauth.http.HttpMessage;
-
-/**
- * {@link OAuth} utility methods.
- *
- * @author [email protected] (Lennard de Rijk)
- */
-public class OAuthUtil {
-
-  /**
-   * Returns a {@link OAuthProblemException} with the given problem and the
-   * correct status code. The problem should come from {@link OAuth.Problems}.
-   */
-  public static OAuthProblemException newOAuthProblemException(String problem) 
{
-    OAuthProblemException exception = new OAuthProblemException(problem);
-    exception.setParameter(HttpMessage.STATUS_CODE, 
OAuth.Problems.TO_HTTP_CODE.get(problem));
-    return exception;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/RandomBase64Generator.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/RandomBase64Generator.java 
b/src/org/waveprotocol/box/server/util/RandomBase64Generator.java
deleted file mode 100644
index bb047f9..0000000
--- a/src/org/waveprotocol/box/server/util/RandomBase64Generator.java
+++ /dev/null
@@ -1,76 +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.server.util;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import java.security.SecureRandom;
-import java.util.Random;
-
-/**
- * Produces sequence of pseudo-random id strings.
- * Thread-safe.
- *
- *
- */
-public class RandomBase64Generator {
-
-  /** The 64 valid web-safe characters. */
-  @VisibleForTesting static final char[] WEB64_ALPHABET =
-      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
-      .toCharArray();
-
-  private final Random random;
-
-  /**
-   * @param random Pseudo-random generator,
-   *        use Random for speed, SecureRandom for cryptographic strength.
-   */
-  public RandomBase64Generator(Random random) {
-    this.random = random;
-  }
-
-  /**
-   * Default constructor using Random.
-   */
-  public RandomBase64Generator() {
-    this(new SecureRandom());
-  }
-
-  /**
-   * @param length The requested number of random base 64 characters.
-   * @return string with length many random base 64 characters.
-   */
-  public String next(int length) {
-    StringBuilder result = new StringBuilder(length);
-    int bits = 0;
-    int bitCount = 0;
-    while (result.length() < length) {
-      if (bitCount < 6) {
-        bits = random.nextInt();
-        bitCount = 32;
-      }
-      result.append(WEB64_ALPHABET[bits & 0x3F]);
-      bits >>= 6;
-      bitCount -= 6;
-    }
-    return result.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/RegistrationUtil.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/RegistrationUtil.java 
b/src/org/waveprotocol/box/server/util/RegistrationUtil.java
deleted file mode 100644
index 993fa96..0000000
--- a/src/org/waveprotocol/box/server/util/RegistrationUtil.java
+++ /dev/null
@@ -1,110 +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.server.util;
-
-import org.waveprotocol.box.server.account.HumanAccountDataImpl;
-import org.waveprotocol.box.server.authentication.PasswordDigest;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.robots.agent.welcome.WelcomeRobot;
-import org.waveprotocol.wave.model.wave.InvalidParticipantAddress;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.io.IOException;
-
-/**
- * User Registration utility methods.
- *
- * @author [email protected] (Ali Lown)
- */
-public class RegistrationUtil {
-
-  private static final Log LOG = Log.get(RegistrationUtil.class);
-
-  private RegistrationUtil() {
-  }
-
-  /**
-   * Checks if a new username is correct and generates its ParticipantId. On 
error returns
-   * exception containing an error message. On success, returns the id.
-   *
-   * @param domain the domain
-   * @param username the new username
-   * @return the new participant id
-   * @throws InvalidParticipantAddress if the new username is an invalid 
participant address
-   */
-  public static ParticipantId checkNewUsername(String domain, String username) 
throws InvalidParticipantAddress {
-    ParticipantId id = null;
-
-      // First, some cleanup on the parameters.
-      if (username == null) {
-        throw new InvalidParticipantAddress(username, "Username portion of 
address cannot be empty");
-      }
-      username = username.trim().toLowerCase();
-      if (username.contains(ParticipantId.DOMAIN_PREFIX)) {
-        id = ParticipantId.of(username);
-      } else {
-        id = ParticipantId.of(username + ParticipantId.DOMAIN_PREFIX + domain);
-      }
-      if (id.getAddress().indexOf("@") < 1) {
-        throw new InvalidParticipantAddress(username, "Username portion of 
address cannot be empty");
-      }
-      String[] usernameSplit = id.getAddress().split("@");
-      if (usernameSplit.length != 2 || !usernameSplit[0].matches("[\\w\\.]+")) 
{
-        throw new InvalidParticipantAddress(username, "Only letters (a-z), 
numbers (0-9), and periods (.) are allowed in Username");
-      }
-      if (!id.getDomain().equals(domain)) {
-        throw new InvalidParticipantAddress(username,"You can only create 
users at the " + domain + " domain");
-      }
-    return id;
-  }
-
-  public static boolean createAccountIfMissing(AccountStore accountStore, 
ParticipantId id,
-      PasswordDigest password, WelcomeRobot welcomeBot) {
-    HumanAccountDataImpl account = new HumanAccountDataImpl(id, password);
-    try {
-      LOG.info("Registering new account for" + id);
-      accountStore.putAccount(account);
-    } catch (PersistenceException e) {
-      LOG.severe("Failed to cretaea new account for " + id, e);
-      return false;
-    }
-    try {
-      welcomeBot.greet(account.getId());
-    } catch (IOException e) {
-      LOG.warning("Failed to create a welcome wavelet for " + id, e);;
-    }
-    return true;
-  }
-
-  public static boolean doesAccountExist(AccountStore accountStore, 
ParticipantId id) {
-    try {
-      if (accountStore.getAccount(id) != null) {
-        return true;
-      }
-    }
-    catch (PersistenceException e) {
-      LOG.severe("Failed to retrieve account data for " + id, e);
-      throw new RuntimeException("An unexpected error occurred trying to 
retrieve account status");
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/SuccessFailCallback.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/SuccessFailCallback.java 
b/src/org/waveprotocol/box/server/util/SuccessFailCallback.java
deleted file mode 100644
index f0769da..0000000
--- a/src/org/waveprotocol/box/server/util/SuccessFailCallback.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.server.util;
-
-/**
- * A generic onSuccess/onFailure callback interface.
- */
-public interface SuccessFailCallback<S, F> {
-  void onSuccess(S successValue);
-  void onFailure(F failureValue);
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/UrlParameters.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/UrlParameters.java 
b/src/org/waveprotocol/box/server/util/UrlParameters.java
deleted file mode 100644
index 5f2d112..0000000
--- a/src/org/waveprotocol/box/server/util/UrlParameters.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.server.util;
-
-import com.google.common.collect.Maps;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Map;
-
-/**
- * Processes URL parameters.
- *
- * @author [email protected] (Andrew Kaplanov)
- */
-public class UrlParameters {
-  private UrlParameters() {}
-
-  public static String addParameter(String url, String name, String value) {
-    int qpos = url.indexOf('?');
-    int hpos = url.indexOf('#');
-    char sep = qpos == -1 ? '?' : '&';
-    String seg = sep + encodeUrl(name) + '=' + encodeUrl(value);
-    return hpos == -1 ? url + seg : url.substring(0, hpos) + seg
-        + url.substring(hpos);
-  }
-
-  public static Map<String, String> getParameters(String query) {
-    Map<String, String> map = Maps.newHashMap();
-    if (query != null) {
-      String[] params = query.split("&");
-      for (String param : params) {
-        String[] parts = param.split("=");
-        if (parts.length == 2) {
-          map.put(parts[0], parts[1]);
-        }
-      }
-    }
-    return map;
-  }
-
-  private static String encodeUrl(String url) {
-    try {
-      return URLEncoder.encode(url, "UTF-8");
-    } catch (UnsupportedEncodingException uee) {
-      throw new IllegalArgumentException(uee);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/WaveletDataUtil.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/WaveletDataUtil.java 
b/src/org/waveprotocol/box/server/util/WaveletDataUtil.java
deleted file mode 100644
index 10c4552..0000000
--- a/src/org/waveprotocol/box/server/util/WaveletDataUtil.java
+++ /dev/null
@@ -1,237 +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.server.util;
-
-import com.google.common.base.Preconditions;
-
-import org.waveprotocol.wave.model.document.util.EmptyDocument;
-import org.waveprotocol.wave.model.id.IdUtil;
-import org.waveprotocol.wave.model.id.WaveletId;
-import org.waveprotocol.wave.model.id.WaveletName;
-import org.waveprotocol.wave.model.operation.OperationException;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.wave.model.operation.wave.WaveletOperation;
-import org.waveprotocol.wave.model.schema.SchemaCollection;
-import org.waveprotocol.wave.model.version.HashedVersion;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.model.wave.data.BlipData;
-import org.waveprotocol.wave.model.wave.data.ObservableWaveletData;
-import org.waveprotocol.wave.model.wave.data.ReadableWaveletData;
-import org.waveprotocol.wave.model.wave.data.WaveViewData;
-import org.waveprotocol.wave.model.wave.data.WaveletData;
-import org.waveprotocol.wave.model.wave.data.impl.EmptyWaveletSnapshot;
-import 
org.waveprotocol.wave.model.wave.data.impl.ObservablePluggableMutableDocument;
-import org.waveprotocol.wave.model.wave.data.impl.WaveletDataImpl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-/**
- * Utility methods for {@link WaveletData}.
- *
- * @author [email protected] (Lennard de Rijk)
- */
-public final class WaveletDataUtil {
-
-  // TODO(ljvderijk): Schemas should be enforced, see issue 109.
-  private static final ObservableWaveletData.Factory<?> WAVELET_FACTORY =
-      WaveletDataImpl.Factory.create(
-          
ObservablePluggableMutableDocument.createFactory(SchemaCollection.empty()));
-
-  private WaveletDataUtil() {
-  }
-
-  /**
-   * Returns the {@link WaveletName} for the given wavelet.
-   *
-   * @param wavelet the wavelet to get the name for
-   */
-  public static WaveletName waveletNameOf(ReadableWaveletData wavelet) {
-    return WaveletName.of(wavelet.getWaveId(), wavelet.getWaveletId());
-  }
-
-  /**
-   * Apply a delta to the given wavelet. Rolls back the operation if it fails.
-   *
-   * @param delta delta to apply.
-   * @param wavelet the wavelet to apply the operations to.
-   *
-   * @throws OperationException if the operations fail to apply (and are
-   *         successfully rolled back).
-   * @throws IllegalStateException if the operations have failed and can not be
-   *         rolled back.
-   */
-  public static void applyWaveletDelta(TransformedWaveletDelta delta, 
WaveletData wavelet)
-      throws OperationException {
-    Preconditions.checkState(wavelet != null, "wavelet may not be null");
-    Preconditions.checkState(delta.getAppliedAtVersion() == 
wavelet.getVersion(),
-        "Delta's version %s doesn't apply to wavelet at %s", 
delta.getAppliedAtVersion(),
-        wavelet.getVersion());
-
-    List<WaveletOperation> reverseOps = new ArrayList<WaveletOperation>();
-    WaveletOperation lastOp = null;
-    int opsApplied = 0;
-    try {
-      for (WaveletOperation op : delta) {
-        lastOp = op;
-        List<? extends WaveletOperation> reverseOp = 
op.applyAndReturnReverse(wavelet);
-        reverseOps.addAll(reverseOp);
-        opsApplied++;
-      }
-    } catch (OperationException e) {
-      // Deltas are atomic, so roll back all operations that were successful
-      rollbackWaveletOperations(wavelet, reverseOps);
-      throw new OperationException("Only applied " + opsApplied + " of "
-          + delta.size() + " operations at version " + wavelet.getVersion()
-          + ", rolling back, failed op was " + lastOp, e);
-    }
-  }
-
-  /**
-   * Like applyWaveletOperations, but throws an {@link IllegalStateException}
-   * when ops fail to apply. Is used for rolling back operations.
-   *
-   * @param ops to apply for rollback
-   */
-  private static void rollbackWaveletOperations(WaveletData wavelet, 
List<WaveletOperation> ops) {
-    for (int i = ops.size() - 1; i >= 0; i--) {
-      try {
-        ops.get(i).apply(wavelet);
-      } catch (OperationException e) {
-        throw new IllegalStateException(
-            "Failed to roll back operation with inverse " + ops.get(i), e);
-      }
-    }
-  }
-
-  /**
-   * Creates an empty wavelet.
-   *
-   * @param waveletName the name of the wavelet.
-   * @param author the author of the wavelet.
-   * @param creationTimestamp the time at which the wavelet is created.
-   */
-  public static ObservableWaveletData createEmptyWavelet(WaveletName 
waveletName,
-      ParticipantId author, HashedVersion version, long creationTimestamp) {
-    return copyWavelet(new EmptyWaveletSnapshot(waveletName.waveId, 
waveletName.waveletId, author,
-        version, creationTimestamp));
-  }
-
-  /**
-   * Constructs the wavelet state after the application of the first delta.
-   *
-   * @param waveletName the name of the wavelet.
-   * @param delta first delta to apply at version zero.
-   */
-  public static ObservableWaveletData buildWaveletFromFirstDelta(WaveletName 
waveletName,
-      TransformedWaveletDelta delta) throws OperationException {
-    Preconditions.checkArgument(delta.getAppliedAtVersion() == 0,
-        "first delta has non-zero version: %s", delta.getAppliedAtVersion());
-    ObservableWaveletData wavelet =
-        createEmptyWavelet(
-            waveletName,
-            delta.getAuthor(), // creator
-            HashedVersion.unsigned(0), // garbage hash, is overwritten by 
first delta below
-            delta.getApplicationTimestamp()); // creation time
-    applyWaveletDelta(delta, wavelet);
-    return wavelet;
-  }
-
-  /**
-   * Reads all deltas from the given iterator and constructs the end
-   * wavelet state by successive application of all deltas beginning
-   * from the empty wavelet.
-   *
-   * @param waveletName the name of the wavelet.
-   * @param deltas non-empty, contiguous sequence of non-empty deltas beginning
-   *        from version zero.
-   */
-  public static ObservableWaveletData buildWaveletFromDeltas(WaveletName 
waveletName,
-      Iterator<TransformedWaveletDelta> deltas) throws OperationException {
-    Preconditions.checkArgument(deltas.hasNext(), "empty deltas");
-    ObservableWaveletData wavelet = buildWaveletFromFirstDelta(waveletName, 
deltas.next());
-    while (deltas.hasNext()) {
-      TransformedWaveletDelta delta = deltas.next();
-      applyWaveletDelta(delta, wavelet);
-    }
-    return wavelet;
-  }
-
-  /**
-   * Copies a wavelet.
-   *
-   * @param wavelet the wavelet to copy.
-   * @return A mutable copy.
-   */
-  public static ObservableWaveletData copyWavelet(ReadableWaveletData wavelet) 
{
-    return WAVELET_FACTORY.create(wavelet);
-  }
-
-  /**
-   * Adds an empty blip to the given wavelet.
-   *
-   * @param wavelet the wavelet to add the blip to.
-   * @param blipId the id of the blip to add.
-   * @param author the author of this blip (will also be the only participant).
-   * @param time the time to set in the blip as creation/lastmodified time.
-   */
-  public static BlipData addEmptyBlip(
-      WaveletData wavelet, String blipId, ParticipantId author, long time) {
-    return wavelet.createDocument(blipId, author, 
Collections.<ParticipantId>singleton(author),
-        EmptyDocument.EMPTY_DOCUMENT, time, time);
-  }
-  
-  /**
-   * @return true if the wave has conversational root wavelet.
-   */
-  public static boolean hasConversationalRootWavelet(@Nullable WaveViewData 
wave) {
-    if (wave == null) {
-      return false;
-    }
-    for (ObservableWaveletData waveletData : wave.getWavelets()) {
-      WaveletId waveletId = waveletData.getWaveletId();
-      if (IdUtil.isConversationRootWaveletId(waveletId)) {
-        return true;
-      }
-    }
-    return false;
-  }
-  
-  /**
-   * Checks if the user has access to the wavelet.
-   * 
-   * @param snapshot the wavelet data.
-   * @param user the user that wants to access the wavelet.
-   * @param sharedDomainParticipantId the shared domain participant id.
-   * @return true if the user has access to the wavelet.
-   */
-  public static boolean checkAccessPermission(ReadableWaveletData snapshot, 
ParticipantId user,
-      ParticipantId sharedDomainParticipantId) {
-    return user != null
-    && (snapshot == null
-        || snapshot.getParticipants().contains(user)
-        || (sharedDomainParticipantId != null
-            && 
snapshot.getParticipants().contains(sharedDomainParticipantId)));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/testing/ExceptionLogHandler.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/util/testing/ExceptionLogHandler.java 
b/src/org/waveprotocol/box/server/util/testing/ExceptionLogHandler.java
deleted file mode 100644
index 7ea3550..0000000
--- a/src/org/waveprotocol/box/server/util/testing/ExceptionLogHandler.java
+++ /dev/null
@@ -1,65 +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.server.util.testing;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-/**
- * A log handler which throws a runtime exception at and above a set log level.
- * Useful for catching erroneous conditions during testing, which are only
- * reported to the logs.
- *
- * @author [email protected] (Michael Kuntzman)
- */
-public class ExceptionLogHandler extends Handler {
-  /** The integer value of the minimum fatal log level. */
-  private final int fatalLevel;
-
-  /**
-   * Constructs an ExceptionLogHandler that throws a runtime exception at and 
above the specified
-   * log level.
-   *
-   * @param fatalLevel the minimum log level for which to throw an exception.
-   */
-  public ExceptionLogHandler(Level fatalLevel) {
-    this.fatalLevel = fatalLevel.intValue();
-  }
-
-  /**
-   * @throws RuntimeException if the log record is at or above the fatal log 
level.
-   */
-  @Override
-  public void publish(LogRecord record) {
-    if (record.getLevel().intValue() >= fatalLevel) {
-      throw new RuntimeException(record.getLevel() + ": " + 
record.getMessage(),
-          record.getThrown());
-    }
-  }
-
-  @Override
-  public void flush() {
-  }
-
-  @Override
-  public void close() {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/testing/Matchers.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/testing/Matchers.java 
b/src/org/waveprotocol/box/server/util/testing/Matchers.java
deleted file mode 100644
index 72be27a..0000000
--- a/src/org/waveprotocol/box/server/util/testing/Matchers.java
+++ /dev/null
@@ -1,172 +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.server.util.testing;
-
-import org.hamcrest.Description;
-import org.hamcrest.TypeSafeMatcher;
-
-import java.util.Collection;
-
-/**
- * Additional matchers to go with JUnit4's assertThat and assumeThat.
- *
- * @author [email protected] (Michael Kuntzman)
- */
-// TODO(Michael): Maybe move this class to the libraries repository/branch.
-public class Matchers {
-  /**
-   * Nicer aliases for some of the methods in this class, which may conflict 
with methods in other
-   * packages (potential conficts noted for each alias).
-   */
-  public static class Aliases {
-    /**
-     * Alias for "containsString". May conflict with 
"org.mockito.Mockito.contains".
-     *
-     * @param substring to look for.
-     * @return a matcher for checking that a string contains the specified 
substring.
-     */
-    public static TypeSafeMatcher<String> contains(final String substring) {
-      return containsString(substring);
-    }
-
-    /**
-     * Alias for "matchesRegex". May conflict with 
"org.mockito.Mockito.matches".
-     *
-     * @param regularExpression to match against.
-     * @return a matcher for checking that a string matches the specified 
regular expression.
-     */
-    public static TypeSafeMatcher<String> matches(final String 
regularExpression) {
-      return matchesRegex(regularExpression);
-    }
-  }
-
-  /**
-   * A more user-friendly version of 
org.junit.matchers.JUnitMatchers.hasItem(T element). Allows a
-   * more verbose failure than assertTrue(collection.contains(item)). The 
matcher produces
-   * "Expected: a collection containing '...' got: '...'", whereas assertTrue 
produces merely
-   * "AssertionFailedError".
-   * Usage: static import, then assertThat(collection, contains(item)).
-   *
-   * @param item to look for.
-   * @return a matcher for checking that a collection contains the specified 
item.
-   */
-  public static <T> TypeSafeMatcher<Collection<? super T>> contains(final T 
item) {
-    return new TypeSafeMatcher<Collection<? super T>>() {
-          @Override
-          public boolean matchesSafely(Collection<? super T> collection) {
-            return collection.contains(item);
-          }
-
-          @Override
-          public void describeTo(Description description) {
-            description.appendText("a collection containing 
").appendValue(item);
-          }
-        };
-  }
-
-  /**
-   * Same as JUnitMatchers.containsString. Allows a more verbose failure than
-   * assertTrue(str.contains(substring)).
-   * Usage: static import, then assertThat(str, containsString(substring)).
-   *
-   * @param substring to look for.
-   * @return a matcher for checking that a string contains the specified 
substring.
-   */
-  public static TypeSafeMatcher<String> containsString(final String substring) 
{
-    return new TypeSafeMatcher<String>() {
-          @Override
-          public boolean matchesSafely(String str) {
-            return str.contains(substring);
-          }
-
-          @Override
-          public void describeTo(Description description) {
-            description.appendText("a string containing 
").appendValue(substring);
-          }
-        };
-  }
-
-  /**
-   * The negative version of "contains" for a collection. Allows a more 
verbose failure than
-   * assertFalse(collection.contains(item)).
-   * Usage: static import, then assertThat(collection, doesNotContain(item)).
-   *
-   * @param item to look for.
-   * @return a matcher for checking that a collection does not contain the 
specified item.
-   */
-  public static <T> TypeSafeMatcher<Collection<? super T>> 
doesNotContain(final T item) {
-    return new TypeSafeMatcher<Collection<? super T>>() {
-          @Override
-          public boolean matchesSafely(Collection<? super T> collection) {
-            return !collection.contains(item);
-          }
-
-          @Override
-          public void describeTo(Description description) {
-            description.appendText("a collection NOT containing 
").appendValue(item);
-          }
-        };
-  }
-
-  /**
-   * The negative version of "contains" for a string (or "containsString"). 
Allows a more verbose
-   * failure than assertFalse(str.contains(substring)).
-   * Usage: static import, then assertThat(str, doesNotContain(substring)).
-   *
-   * @param substring to look for.
-   * @return a matcher for checking that a string contains the specified 
substring.
-   */
-  public static TypeSafeMatcher<String> doesNotContain(final String substring) 
{
-    return new TypeSafeMatcher<String>() {
-          @Override
-          public boolean matchesSafely(String str) {
-            return !str.contains(substring);
-          }
-
-          @Override
-          public void describeTo(Description description) {
-            description.appendText("a string NOT containing 
").appendValue(substring);
-          }
-        };
-  }
-
-  /**
-   * Allows a more verbose failure than assertTrue(str.matches(regex)). The 
matcher produces
-   * "Expected: a string matching regex '...' got: '...'", whereas assertTrue 
produces merely
-   * "AssertionFailedError".
-   * Usage: static import, then assertThat(str, matchesRegex(regex)).
-   *
-   * @param regularExpression to match against.
-   * @return a matcher for checking that a string matches the specified 
regular expression.
-   */
-  public static TypeSafeMatcher<String> matchesRegex(final String 
regularExpression) {
-    return new TypeSafeMatcher<String>() {
-          @Override
-          public boolean matchesSafely(String str) {
-            return str.matches(regularExpression);
-          }
-
-          @Override
-          public void describeTo(Description description) {
-            description.appendText("a string matching regex 
").appendValue(regularExpression);
-          }
-        };
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/util/testing/TestingConstants.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/util/testing/TestingConstants.java 
b/src/org/waveprotocol/box/server/util/testing/TestingConstants.java
deleted file mode 100644
index ed0d95f..0000000
--- a/src/org/waveprotocol/box/server/util/testing/TestingConstants.java
+++ /dev/null
@@ -1,66 +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.server.util.testing;
-
-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.wave.ParticipantId;
-
-/**
- * Commonly used constants for unit testing. Some constants taken from
- * previously existing test cases.
- *
- * @author [email protected] (Michael Kuntzman)
- */
-// TODO(Michael): Maybe move this class to the libraries repository/branch.
-public interface TestingConstants {
-  public static final String BLIP_ID = "b+blip";
-
-  public static final String MESSAGE = "The quick brown fox jumps over the 
lazy dog";
-
-  public static final String MESSAGE2 = "Why's the rum gone?";
-
-  public static final String MESSAGE3 = "There is no spoon";
-
-  public static final String DOMAIN = "host.com";
-
-  public static final String OTHER_USER_NAME = "other";
-
-  public static final String OTHER_USER = OTHER_USER_NAME + "@" + DOMAIN;
-
-  public static final ParticipantId OTHER_PARTICIPANT = new 
ParticipantId(OTHER_USER);
-
-  public static final int PORT = 9876;
-
-  public static final String USER_NAME = "user";
-
-  public static final String USER = USER_NAME + "@" + DOMAIN;
-
-  public static final char[] PASSWORD = "password".toCharArray();
-
-  public static final ParticipantId PARTICIPANT = new ParticipantId(USER);
-
-  public static final WaveId WAVE_ID = WaveId.of(DOMAIN, "w+wave");
-
-  public static final WaveletId WAVELET_ID = WaveletId.of(DOMAIN, "wavelet");
-
-  public static final WaveletName WAVELET_NAME = WaveletName.of(WAVE_ID, 
WAVELET_ID);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/AbstractSearchProviderImpl.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/waveserver/AbstractSearchProviderImpl.java 
b/src/org/waveprotocol/box/server/waveserver/AbstractSearchProviderImpl.java
deleted file mode 100644
index b5e81ad..0000000
--- a/src/org/waveprotocol/box/server/waveserver/AbstractSearchProviderImpl.java
+++ /dev/null
@@ -1,179 +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.server.waveserver;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.waveprotocol.box.server.util.WaveletDataUtil;
-import org.waveprotocol.wave.model.id.IdConstants;
-import org.waveprotocol.wave.model.id.IdUtil;
-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.wave.ParticipantId;
-import org.waveprotocol.wave.model.wave.ParticipantIdUtil;
-import org.waveprotocol.wave.model.wave.data.ObservableWaveletData;
-import org.waveprotocol.wave.model.wave.data.ReadableWaveletData;
-import org.waveprotocol.wave.model.wave.data.WaveViewData;
-import org.waveprotocol.wave.model.wave.data.impl.WaveViewDataImpl;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Base implementation of search provider.
- *
- * @author [email protected] (Yuri Zelikov)
- */
-public abstract class AbstractSearchProviderImpl implements SearchProvider {
-  private static final Log LOG = Log.get(AbstractSearchProviderImpl.class);
-
-  protected final WaveDigester digester;
-  protected final ParticipantId sharedDomainParticipantId;
-  private final WaveMap waveMap;
-
-  public AbstractSearchProviderImpl(final String waveDomain, WaveDigester 
digester, WaveMap waveMap) {
-    this.digester = digester;
-    sharedDomainParticipantId = 
ParticipantIdUtil.makeUnsafeSharedDomainParticipantId(waveDomain);
-    this.waveMap = waveMap;
-  }
-
-  protected List<WaveViewData> computeSearchResult(final ParticipantId user, 
int startAt,
-      int numResults, List<WaveViewData> results) {
-    int searchResultSize = results.size();
-    // Check if we have enough results to return.
-    if (searchResultSize < startAt) {
-      return Collections.emptyList();
-    } else {
-      int endAt = Math.min(startAt + numResults, searchResultSize);
-      return Lists.newArrayList(results.subList(startAt, endAt));
-    }
-  }
-
-  // TODO (yurize) : Refactor this method. It does two things: filtering and
-  // building waves.
-  protected LinkedHashMap<WaveId, WaveViewData> 
filterWavesViewBySearchCriteria(
-      Function<ReadableWaveletData, Boolean> matchesFunction,
-      LinkedHashMultimap<WaveId, WaveletId> currentUserWavesView) {
-    // Must use a map with stable ordering, since indices are meaningful.
-    LinkedHashMap<WaveId, WaveViewData> results = Maps.newLinkedHashMap();
-
-    // Loop over the user waves view.
-    for (WaveId waveId : currentUserWavesView.keySet()) {
-      Set<WaveletId> waveletIds = currentUserWavesView.get(waveId);
-      WaveViewData view = buildWaveViewData(waveId, waveletIds, 
matchesFunction, waveMap);
-      Iterable<? extends ObservableWaveletData> wavelets = view.getWavelets();
-      boolean hasConversation = false;
-      for (ObservableWaveletData waveletData : wavelets) {
-        if (IdUtil.isConversationalId(waveletData.getWaveletId())) {
-          hasConversation = true;
-          break;
-        }
-      }
-      if ((view != null) && hasConversation) {
-        results.put(waveId, view);
-      }
-    }
-    return results;
-  }
-
-  public static WaveViewData buildWaveViewData(WaveId waveId, Set<WaveletId> 
waveletIds,
-      Function<ReadableWaveletData, Boolean> matchesFunction, WaveMap waveMap) 
{
-
-    WaveViewData view = WaveViewDataImpl.create(waveId); // Copy of the wave 
built up for search hits.
-    for (WaveletId waveletId : waveletIds) {
-      WaveletContainer waveletContainer = null;
-      WaveletName waveletname = WaveletName.of(waveId, waveletId);
-
-
-      // TODO (Yuri Z.) This loop collects all the wavelets that match the
-      // query, so the view is determined by the query. Instead we should
-      // look at the user's wave view and determine if the view matches the
-      // query.
-      try {
-        waveletContainer = waveMap.getWavelet(waveletname);
-        if ((waveletContainer == null) || 
!waveletContainer.applyFunction(matchesFunction)) {
-          continue;
-        }
-        // Just keep adding all the relevant wavelets in this wave.
-        view.addWavelet(waveletContainer.copyWaveletData());
-      } catch (WaveletStateException e) {
-        LOG.warning("Failed to access wavelet " + 
waveletContainer.getWaveletName(), e);
-      }
-    }
-    return view;
-  }
-
-  /**
-   * Verifies whether the wavelet matches the filter criteria.
-   *
-   * @param wavelet the wavelet.
-   * @param user the logged in user.
-   * @param sharedDomainParticipantId the shared domain participant id.
-   * @param isAllQuery true if the search results should include shared for 
this
-   *        domain waves.
-   */
-  protected boolean isWaveletMatchesCriteria(ReadableWaveletData wavelet, 
ParticipantId user,
-      ParticipantId sharedDomainParticipantId, boolean isAllQuery)
-          throws WaveletStateException {
-    Preconditions.checkNotNull(wavelet);
-    // If it is user data wavelet for the user - return true.
-    if (IdUtil.isUserDataWavelet(wavelet.getWaveletId()) && 
wavelet.getCreator().equals(user)) {
-      return true;
-    }
-    // The wavelet should have logged in user as participant for 'in:inbox'
-    // query.
-    if (!isAllQuery && !wavelet.getParticipants().contains(user)) {
-      return false;
-    }
-    // Or if it is an 'all' query - then either logged in user or shared domain
-    // participant should be present in the wave.
-    if (isAllQuery
-        && !WaveletDataUtil.checkAccessPermission(wavelet, user, 
sharedDomainParticipantId)) {
-      return false;
-    }
-    // If not returned 'false' above - then logged in user is either
-    // explicit or implicit participant and therefore has access permission.
-    return true;
-  }
-
-  /**
-   * Ensures that each wave in the current waves view has the user data 
wavelet by always adding
-   *  it to the view.
-   */
-  protected void ensureWavesHaveUserDataWavelet(
-      LinkedHashMultimap<WaveId, WaveletId> currentUserWavesView, 
ParticipantId user) {
-    WaveletId udw =
-        WaveletId.of(user.getDomain(),
-            IdUtil.join(IdConstants.USER_DATA_WAVELET_PREFIX, 
user.getAddress()));
-    Set<WaveId> waveIds = currentUserWavesView.keySet();
-    for (WaveId waveId : waveIds) {
-      Set<WaveletId> waveletIds = currentUserWavesView.get(waveId);
-      waveletIds.add(udw);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/AbstractWaveIndexer.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/waveserver/AbstractWaveIndexer.java 
b/src/org/waveprotocol/box/server/waveserver/AbstractWaveIndexer.java
deleted file mode 100644
index 13f1283..0000000
--- a/src/org/waveprotocol/box/server/waveserver/AbstractWaveIndexer.java
+++ /dev/null
@@ -1,81 +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.server.waveserver;
-
-import org.waveprotocol.box.common.ExceptionalIterator;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.id.WaveletId;
-import org.waveprotocol.wave.model.id.WaveletName;
-
-/**
- * Base implementation of {@link WaveIndexer}.
- *
- * @author [email protected] (Yuri Zelikov)
- */
-public abstract class AbstractWaveIndexer implements WaveIndexer {
-
-  protected final WaveMap waveMap;
-  protected final WaveletProvider waveletProvider;
-
-  public AbstractWaveIndexer(WaveMap waveMap, WaveletProvider waveletProvider) 
{
-    this.waveletProvider = waveletProvider;
-    this.waveMap = waveMap;
-  }
-
-  /**
-   * Forces all waves to be loaded into memory and processes each wavelet.
-   */
-  @Override
-  public synchronized void remakeIndex() throws WaveletStateException, 
WaveServerException {
-    waveMap.loadAllWavelets();
-
-    ExceptionalIterator<WaveId, WaveServerException> witr = 
waveletProvider.getWaveIds();
-    while (witr.hasNext()) {
-      WaveId waveId = witr.next();
-      for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
-        WaveletName waveletName = WaveletName.of(waveId, waveletId);
-
-        // Required to call this method to load the wavelet into memory.
-        waveletProvider.getSnapshot(waveletName);
-        processWavelet(waveletName);
-      }
-    }
-  }
-
-  /**
-   * Provdes a hook to process the wavelet.
-   *
-   * @param waveletName
-   */
-  protected abstract void processWavelet(WaveletName waveletName);
-
-  /**
-   * Provides a hook to perform some logic after indexing was completed.
-   */
-  protected abstract void postIndexHook();
-
-  protected WaveMap getWaveMap() {
-    return waveMap;
-  }
-
-  protected WaveletProvider getWaveletProvider() {
-    return waveletProvider;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/AccessControlException.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/waveserver/AccessControlException.java 
b/src/org/waveprotocol/box/server/waveserver/AccessControlException.java
deleted file mode 100644
index 776253b..0000000
--- a/src/org/waveprotocol/box/server/waveserver/AccessControlException.java
+++ /dev/null
@@ -1,37 +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.server.waveserver;
-
-/**
- * Indicates a caller tried to submit or request deltas for a
- * participant that is not a particiant on the wavelet.
- */
-
-public class AccessControlException extends WaveServerException {
-  public AccessControlException(String message) {
-    super(message);
-  }
-  public AccessControlException(Throwable cause) {
-    super(cause);
-  }
-  public AccessControlException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/AppliedDeltaUtil.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/waveserver/AppliedDeltaUtil.java 
b/src/org/waveprotocol/box/server/waveserver/AppliedDeltaUtil.java
deleted file mode 100644
index c45e6a9..0000000
--- a/src/org/waveprotocol/box/server/waveserver/AppliedDeltaUtil.java
+++ /dev/null
@@ -1,125 +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.server.waveserver;
-
-import com.google.common.base.Preconditions;
-import com.google.protobuf.InvalidProtocolBufferException;
-
-import org.waveprotocol.box.server.common.CoreWaveletOperationSerializer;
-import org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta;
-import org.waveprotocol.wave.federation.Proto.ProtocolSignedDelta;
-import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta;
-import org.waveprotocol.wave.model.id.IdURIEncoderDecoder;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.wave.model.operation.wave.WaveletDelta;
-import org.waveprotocol.wave.model.version.HashedVersion;
-import org.waveprotocol.wave.model.version.HashedVersionFactory;
-import org.waveprotocol.wave.model.version.HashedVersionFactoryImpl;
-import org.waveprotocol.wave.util.escapers.jvm.JavaUrlCodec;
-
-/**
- * Utility methods for {@code ProtocolAppliedWaveletDelta}s.
- */
-public class AppliedDeltaUtil {
-
-  private static final IdURIEncoderDecoder URI_CODEC =
-      new IdURIEncoderDecoder(new JavaUrlCodec());
-
-  private static final HashedVersionFactory HASH_FACTORY =
-      new HashedVersionFactoryImpl(URI_CODEC);
-
-  /**
-   * Inspects the given applied delta to determine the {@code HashedVersion} it
-   * was applied at.
-   * This may require looking at the contained {@code ProtocolWaveletDelta}.
-   *
-   * @param appliedDeltaBytes to inspect
-   * @return hashed version the delta was applied at
-   * @throws InvalidProtocolBufferException if the contained
-   *         {@code ProtocolWaveletDelta} is invalid
-   *         (is only inspected if the applied delta has the hashed version 
set)
-   */
-  public static HashedVersion getHashedVersionAppliedAt(
-      ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDeltaBytes)
-      throws InvalidProtocolBufferException {
-    ProtocolAppliedWaveletDelta appliedDelta = appliedDeltaBytes.getMessage();
-    return CoreWaveletOperationSerializer.deserialize(
-        // If the delta was transformed, the version it was actually applied 
at is specified
-        // in the top-level message, otherwise we take if from the original 
signed delta.
-        appliedDelta.hasHashedVersionAppliedAt()
-        ? appliedDelta.getHashedVersionAppliedAt()
-        : 
ProtocolWaveletDelta.parseFrom(appliedDelta.getSignedOriginalDelta().getDelta())
-              .getHashedVersion());
-  }
-
-  /**
-   * Calculates the hashed version after an applied delta is applied.
-   */
-  public static HashedVersion calculateResultingHashedVersion(
-      ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDelta)
-      throws InvalidProtocolBufferException {
-    return HASH_FACTORY.create(
-        appliedDelta.getByteArray(),
-        getHashedVersionAppliedAt(appliedDelta),
-        appliedDelta.getMessage().getOperationsApplied());
-  }
-
-  /**
-   * Creates an applied delta message from a signed protocol delta and
-   * application metadata.
-   *
-   * @param signedDelta the original delta
-   * @param appliedAtVersion version at which the delta applied
-   * @param operationsApplied number of ops in the delta
-   * @param applicationTimestamp timestamp of application
-   */
-  public static ByteStringMessage<ProtocolAppliedWaveletDelta> 
buildAppliedDelta(
-      ProtocolSignedDelta signedDelta, HashedVersion appliedAtVersion, int 
operationsApplied,
-      long applicationTimestamp) {
-    ProtocolAppliedWaveletDelta.Builder appliedDeltaBuilder = 
ProtocolAppliedWaveletDelta
-        .newBuilder()
-        .setSignedOriginalDelta(signedDelta)
-        .setOperationsApplied(operationsApplied)
-        .setApplicationTimestamp(applicationTimestamp);
-    // TODO(soren): Only set hashedVersionAppliedAt when different from the
-    // signed delta's target version if we rev the protocol.
-    appliedDeltaBuilder.setHashedVersionAppliedAt(
-        CoreWaveletOperationSerializer.serialize(appliedAtVersion));
-    return ByteStringMessage.serializeMessage(appliedDeltaBuilder.build());
-  }
-
-  /**
-   * Builds a transformed delta from an applied delta and its transformed ops.
-   */
-  public static TransformedWaveletDelta buildTransformedDelta(
-      ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDeltaBytes, 
WaveletDelta transformed)
-      throws InvalidProtocolBufferException {
-    ProtocolAppliedWaveletDelta appliedDelta = appliedDeltaBytes.getMessage();
-    Preconditions.checkArgument(
-        
getHashedVersionAppliedAt(appliedDeltaBytes).equals(transformed.getTargetVersion()));
-    Preconditions.checkArgument(appliedDelta.getOperationsApplied() == 
transformed.size());
-    HashedVersion resultingVersion = 
HASH_FACTORY.create(appliedDeltaBytes.getByteArray(),
-        transformed.getTargetVersion(), appliedDelta.getOperationsApplied());
-    return TransformedWaveletDelta.cloneOperations(resultingVersion,
-        appliedDelta.getApplicationTimestamp(), transformed);
-  }
-
-  private AppliedDeltaUtil() { } // prevent instantiation
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/ByteStringMessage.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/waveserver/ByteStringMessage.java 
b/src/org/waveprotocol/box/server/waveserver/ByteStringMessage.java
deleted file mode 100644
index 8f754d2..0000000
--- a/src/org/waveprotocol/box/server/waveserver/ByteStringMessage.java
+++ /dev/null
@@ -1,157 +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.server.waveserver;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.Message;
-
-import org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta;
-import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta;
-
-/**
- * Bundles a protocol buffer with its serialised representation.
- * <p>
- * This class is used to represent objects whose serialised representation
- * must be kept intact, because signatures or hashes depend
- * on the exact representation as bytes.
- * <p>
- * This would not be an issue if
- * protocol buffer serialisation was unique, but that's not the case.
- * We can only count on the equality
- *
- *   {@code message.equals(T.parseFrom(message.toByteString()))},
- *
- * but not
- *
- *   {@code byteString.equals(T.parseFrom(byteString).toByteString())}.
- *
- * @param <T> the protocol buffer {@link Message} type.
- */
-public final class ByteStringMessage<T extends Message> {
-
-  /**
-   * Parses a {@link ByteStringMessage} from its {@link ByteString}
-   * representation.
-   *
-   * @param prototype used to create a {@link Message.Builder} to parse the
-   *        message
-   * @param byteString representation of the message
-   * @throws InvalidProtocolBufferException if {@code byteString} is not a
-   *         valid protocol buffer
-   */
-  public static <K extends Message> ByteStringMessage<K> parseFrom(K prototype,
-      ByteString byteString) throws InvalidProtocolBufferException {
-    return new ByteStringMessage<K>(parse(prototype, byteString), byteString);
-  }
-
-  @SuppressWarnings("unchecked")
-  private static <K extends Message> K parse(K prototype, ByteString 
byteString)
-      throws InvalidProtocolBufferException {
-    return (K) prototype.newBuilderForType().mergeFrom(byteString).build();
-  }
-
-  /**
-   * Parses a {@link ProtocolWaveletDelta}. Convenience method, equivalent to
-   * {@code from(ProtocolWaveletDelta.getDefaultInstanceForType(), 
byteString)}.
-   */
-  public static ByteStringMessage<ProtocolWaveletDelta> 
parseProtocolWaveletDelta(
-      ByteString byteString) throws InvalidProtocolBufferException {
-    return new ByteStringMessage<ProtocolWaveletDelta>(
-        ProtocolWaveletDelta.parseFrom(byteString), byteString);
-  }
-
-  /**
-   * Parses a {@link ProtocolAppliedWaveletDelta}. Convenience method, 
equivalent to
-   * {@code from(ProtocolAppliedWaveletDelta.getDefaultInstanceForType(), 
byteString)}.
-   */
-  public static ByteStringMessage<ProtocolAppliedWaveletDelta> 
parseProtocolAppliedWaveletDelta(
-      ByteString byteString) throws InvalidProtocolBufferException {
-    return new ByteStringMessage<ProtocolAppliedWaveletDelta>(
-        ProtocolAppliedWaveletDelta.parseFrom(byteString), byteString);
-  }
-
-  /**
-   * Serialises a {@link Message} into a {@link ByteStringMessage}.
-   * This should only be used once, when the message is originally created.
-   *
-   * @param message to form the serialised version of
-   */
-  public static <K extends Message> ByteStringMessage<K> serializeMessage(K 
message) {
-    return new ByteStringMessage<K>(message, message.toByteString());
-  }
-
-  private final ByteString byteString;
-  private final T message;
-
-  /**
-   * Constructs a {@link ByteStringMessage} from corresponding {@link Message}
-   * and serialised {@link ByteString} representations of protocol buffer.
-   *
-   * @param message a protocol message equal to {@code T.parseFrom(byteString)}
-   * @param byteString representation of {@code message}
-   */
-  private ByteStringMessage(T message, ByteString byteString) {
-    this.message = message;
-    this.byteString = byteString;
-  }
-
-  /**
-   * @return the immutable underlying {@code Message}
-   */
-  public T getMessage() {
-    return message;
-  }
-
-  /**
-   * @return the serialised representation of this message
-   */
-  public ByteString getByteString() {
-    return this.byteString;
-  }
-
-  /**
-   * @return the serialised byte array representation of this message
-   */
-  public byte[] getByteArray() {
-    return this.byteString.toByteArray();
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public boolean equals(Object o) {
-    if (!(o instanceof ByteStringMessage)) {
-      return false;
-    } else {
-      ByteStringMessage<Message> bsm = (ByteStringMessage<Message>) o;
-      return byteString.equals(bsm.byteString);
-    }
-  }
-
-  @Override
-  public int hashCode() {
-    return byteString.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return "ByteStringMessage: " + message;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/waveserver/CertificateManager.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/waveserver/CertificateManager.java 
b/src/org/waveprotocol/box/server/waveserver/CertificateManager.java
deleted file mode 100644
index f662c00..0000000
--- a/src/org/waveprotocol/box/server/waveserver/CertificateManager.java
+++ /dev/null
@@ -1,111 +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.server.waveserver;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.protobuf.ByteString;
-
-import org.waveprotocol.wave.crypto.SignatureException;
-import org.waveprotocol.wave.crypto.SignerInfo;
-import org.waveprotocol.wave.crypto.UnknownSignerException;
-import org.waveprotocol.wave.federation.WaveletFederationProvider;
-import org.waveprotocol.wave.federation.FederationErrorProto.FederationError;
-import org.waveprotocol.wave.federation.Proto.ProtocolSignedDelta;
-import org.waveprotocol.wave.federation.Proto.ProtocolSignerInfo;
-import org.waveprotocol.wave.federation.Proto.ProtocolWaveletDelta;
-import org.waveprotocol.wave.model.id.WaveletName;
-import org.waveprotocol.wave.model.version.HashedVersion;
-
-/**
- * Stand-in interface for the certificate manager.
- *
- *
- */
-public interface CertificateManager {
-
-  ImmutableSet<String> getLocalDomains();
-
-  /**
-   * @return the signer info for the local wave signer.
-   */
-  SignatureHandler getLocalSigner();
-
-  /**
-   * Verify the signature in the Signed Delta. Use the local WSP's certificate
-   * to sign the delta.
-   *
-   * @param delta as a byte string (the serialised representation of a 
ProtocolWaveletDelta)
-   * @return signed delta
-   */
-  ProtocolSignedDelta signDelta(ByteStringMessage<ProtocolWaveletDelta> delta);
-
-  /**
-   * Verify the signature in the Signed Delta. Use the delta's author's WSP
-   * address to identify the certificate.
-   *
-   * @param signedDelta to verify
-   * @return verified serialised ProtocolWaveletDelta, if signatures can be 
verified
-   * @throws SignatureException if the signatures cannot be verified.
-   */
-  ByteStringMessage<ProtocolWaveletDelta> verifyDelta(ProtocolSignedDelta 
signedDelta)
-      throws SignatureException, UnknownSignerException;
-
-  /**
-   * Stores information about a signer (i.e., its certificate chain) in a
-   * permanent store. In addition to a certificate chain, a {@link SignerInfo}
-   * also contains an identifier of hash algorithm. Signers will use the hash
-   * of the cert chain to refer to this signer info in their signatures.
-   *
-   * @param signerInfo
-   * @throws SignatureException if the {@link SignerInfo} doesn't check out
-   */
-  void storeSignerInfo(ProtocolSignerInfo signerInfo) throws 
SignatureException;
-
-  /**
-   * Retrieves information about a signer.
-   *
-   * @param signerId identifier of the signer (the hash of its certificate 
chain)
-   * @return the signer information, if found, null otherwise
-   */
-  ProtocolSignerInfo retrieveSignerInfo(ByteString signerId);
-
-  /**
-   * Callback interface for {@code prefetchSignerInfo}.
-   */
-  interface SignerInfoPrefetchResultListener {
-    void onSuccess(ProtocolSignerInfo signerInfo);
-    void onFailure(FederationError error);
-  }
-
-  /**
-   * Prefetch the signer info for a signed delta, calling back when the signer 
info is available.
-   * Note that the signer info may be immediately available, in which case the 
callback is
-   * immediately called in the same thread.
-   *
-   * @param provider of signer information
-   * @param signerId to prefetch the signer info for
-   * @param deltaEndVersion of delta to use for validating a 
getDeltaSignerInfo call, if necessary
-   * @param waveletName of the wavelet to prefetch the signer info for
-   * @param callback when the signer info is available, or on failure
-   */
-  void prefetchDeltaSignerInfo(WaveletFederationProvider provider, ByteString 
signerId,
-      WaveletName waveletName, HashedVersion deltaEndVersion,
-      SignerInfoPrefetchResultListener callback);
-}

Reply via email to