http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/memory/MemoryStore.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/memory/MemoryStore.java 
b/src/org/waveprotocol/box/server/persistence/memory/MemoryStore.java
deleted file mode 100644
index de0cbda..0000000
--- a/src/org/waveprotocol/box/server/persistence/memory/MemoryStore.java
+++ /dev/null
@@ -1,99 +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.persistence.memory;
-
-import org.waveprotocol.box.server.account.AccountData;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.persistence.SignerInfoStore;
-import org.waveprotocol.wave.crypto.CertPathStore;
-import org.waveprotocol.wave.crypto.DefaultCertPathStore;
-import org.waveprotocol.wave.crypto.SignatureException;
-import org.waveprotocol.wave.crypto.SignerInfo;
-import org.waveprotocol.wave.federation.Proto.ProtocolSignerInfo;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * In-memory implementation of persistence.
- *
- * <p>
- * {@link CertPathStore} implementation just forwards to the
- * {@link DefaultCertPathStore}.
- *
- *<p>
- *{@link AccountStore} implementation stores {@link AccountData} in a map 
keyed by username.
- *
- * @author [email protected] (Lennard de Rijk)
- *
- */
-public class MemoryStore implements SignerInfoStore, AccountStore {
-
-  private final CertPathStore certPathStore;
-
-  public MemoryStore() {
-    certPathStore = new DefaultCertPathStore();
-    accountStore = new ConcurrentHashMap<ParticipantId, AccountData>();
-  }
-
-  @Override
-  public void initializeSignerInfoStore() throws PersistenceException {
-    // Nothing to initialize
-  }
-
-  @Override
-  public SignerInfo getSignerInfo(byte[] signerId) throws SignatureException {
-    return certPathStore.getSignerInfo(signerId);
-  }
-
-  @Override
-  public void putSignerInfo(ProtocolSignerInfo protobuff) throws 
SignatureException {
-    certPathStore.putSignerInfo(protobuff);
-  }
-
-
-  /*
-   *  AccountStore
-   */
-
-  private final Map<ParticipantId, AccountData> accountStore;
-
-  @Override
-  public void initializeAccountStore() {
-    // Nothing to initialize
-  }
-
-  @Override
-  public AccountData getAccount(ParticipantId id) {
-    return accountStore.get(id);
-  }
-
-  @Override
-  public void putAccount(AccountData account) {
-    accountStore.put(account.getId(), account);
-  }
-
-  @Override
-  public void removeAccount(ParticipantId id) {
-    accountStore.remove(id);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/migration/DeltaMigrator.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/migration/DeltaMigrator.java 
b/src/org/waveprotocol/box/server/persistence/migration/DeltaMigrator.java
deleted file mode 100644
index 3b68937..0000000
--- a/src/org/waveprotocol/box/server/persistence/migration/DeltaMigrator.java
+++ /dev/null
@@ -1,142 +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.persistence.migration;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.waveprotocol.box.common.ExceptionalIterator;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.waveserver.DeltaStore;
-import org.waveprotocol.box.server.waveserver.DeltaStore.DeltasAccess;
-import org.waveprotocol.box.server.waveserver.WaveletDeltaRecord;
-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.version.HashedVersion;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- *
- * An utility class to copy all deltas between storages. Already existing Waves
- * in the target store wont be changed.
- *
- * It is NOT an incremental process.
- *
- * @author [email protected] (Pablo Ojanguren)
- *
- */
-public class DeltaMigrator {
-
-  private static final Log LOG = Log.get(DeltaMigrator.class);
-
-  protected DeltaStore sourceStore = null;
-  protected DeltaStore targetStore = null;
-
-
-  public DeltaMigrator(DeltaStore sourceStore, DeltaStore targetStore) {
-    this.sourceStore = sourceStore;
-    this.targetStore = targetStore;
-  }
-
-
-
-  public void run() {
-
-
-    LOG.info("Starting Wave migration from " + 
sourceStore.getClass().getSimpleName() + " to "
-        + targetStore.getClass().getSimpleName());
-
-    long startTime = System.currentTimeMillis();
-
-
-    try {
-
-      ExceptionalIterator<WaveId, PersistenceException> srcItr = 
sourceStore.getWaveIdIterator();
-
-      // Waves
-      while (srcItr.hasNext()) {
-
-        WaveId waveId = srcItr.next();
-
-        ImmutableSet<WaveletId> waveletIds = sourceStore.lookup(waveId);
-
-        if (!targetStore.lookup(waveId).isEmpty()) {
-          LOG.info("Skipping Wave because it's found in target store : " + 
waveId.toString());
-          continue;
-        }
-
-        LOG.info("Migrating Wave : " + waveId.toString() + " with " + 
waveletIds.size()
-            + " wavelets");
-
-        int waveletsTotal = waveletIds.size();
-        int waveletsCount = 0;
-
-        // Wavelets
-        for (WaveletId waveletId : waveletIds) {
-
-          waveletsCount++;
-
-          LOG.info("Migrating wavelet " + waveletsCount + "/" + waveletsTotal 
+ " : "
-              + waveletId.toString());
-
-          DeltasAccess sourceDeltas = sourceStore.open(WaveletName.of(waveId, 
waveletId));
-          DeltasAccess targetDeltas = targetStore.open(WaveletName.of(waveId, 
waveletId));
-
-          // Get all deltas from last version to initial version (0): reverse
-          // order
-          int deltasCount = 0;
-
-          ArrayList<WaveletDeltaRecord> deltas = new 
ArrayList<WaveletDeltaRecord>();
-          HashedVersion deltaResultingVersion = sourceDeltas.getEndVersion();
-
-          // Deltas
-          while (deltaResultingVersion != null && 
deltaResultingVersion.getVersion() != 0) {
-            deltasCount++;
-            WaveletDeltaRecord deltaRecord =
-                
sourceDeltas.getDeltaByEndVersion(deltaResultingVersion.getVersion());
-            deltas.add(deltaRecord);
-            // get the previous delta, this is the appliedAt
-            deltaResultingVersion = deltaRecord.getAppliedAtVersion();
-          }
-          LOG.info("Appending " + deltasCount + "deltas to target");
-          targetDeltas.append(deltas);
-        }
-      } // While Waves
-
-      long endTime = System.currentTimeMillis();
-
-      LOG.info("Migration completed. Total time = " + (endTime - startTime) + 
"ms");
-
-    } catch (PersistenceException e) {
-
-      throw new RuntimeException(e);
-
-    } catch (IOException e) {
-
-      throw new RuntimeException(e);
-
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
deleted file mode 100644
index e9a326b..0000000
--- 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
+++ /dev/null
@@ -1,205 +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.persistence.mongodb;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.WriteConcern;
-
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.waveserver.ByteStringMessage;
-import org.waveprotocol.box.server.waveserver.DeltaStore;
-import org.waveprotocol.box.server.waveserver.WaveletDeltaRecord;
-import org.waveprotocol.wave.federation.Proto.ProtocolAppliedWaveletDelta;
-import org.waveprotocol.wave.model.id.WaveletName;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.wave.model.version.HashedVersion;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * A MongoDB based Delta Access implementation using a simple <b>deltas</b>
- * collection, storing a delta record per each MongoDb document.
- *
- * @author [email protected] (Pablo Ojanguren)
- *
- */
-public class MongoDbDeltaCollection implements DeltaStore.DeltasAccess {
-
-  /** Wavelet name to work with. */
-  private final WaveletName waveletName;
-
-  /** MongoDB Collection object for delta storage */
-  private final DBCollection deltaDbCollection;
-
-  /**
-   * Construct a new Delta Access object for the wavelet
-   *
-   * @param waveletName The wavelet name.
-   * @param deltaDbCollection The MongoDB deltas collection
-   */
-  public MongoDbDeltaCollection(WaveletName waveletName, DBCollection 
deltaDbCollection) {
-    this.waveletName = waveletName;
-    this.deltaDbCollection = deltaDbCollection;
-  }
-
-  @Override
-  public WaveletName getWaveletName() {
-    return waveletName;
-  }
-
-  /**
-   * Create a new DBObject for a common query to select this wavelet
-   *
-   * @return DBObject query
-   */
-  protected DBObject createWaveletDBQuery() {
-
-    DBObject query = new BasicDBObject();
-    query.put(MongoDbDeltaStoreUtil.FIELD_WAVE_ID, 
waveletName.waveId.serialise());
-    query.put(MongoDbDeltaStoreUtil.FIELD_WAVELET_ID, 
waveletName.waveletId.serialise());
-
-    return query;
-  }
-
-  @Override
-  public boolean isEmpty() {
-
-    return deltaDbCollection.count(createWaveletDBQuery()) == 0;
-  }
-
-  @Override
-  public HashedVersion getEndVersion() {
-
-    // Search the max of delta.getTransformedDelta().getResultingVersion()
-
-    DBObject query = createWaveletDBQuery();
-
-    DBObject sort = new BasicDBObject();
-    sort.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION_VERSION, 
-1); // Descending
-
-    DBObject field = new BasicDBObject();
-    field.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION, 1);
-
-    DBObject result = deltaDbCollection.findOne(query, field, sort);
-
-    return result != null ? MongoDbDeltaStoreUtil
-        .deserializeHashedVersion((DBObject) ((DBObject) result
-            .get(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED))
-            .get(MongoDbDeltaStoreUtil.FIELD_RESULTINGVERSION)) : null;
-  }
-
-  @Override
-  public WaveletDeltaRecord getDelta(long version) throws IOException {
-
-    DBObject query = createWaveletDBQuery();
-    query.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_APPLIEDATVERSION, 
version);
-
-    DBObject result = deltaDbCollection.findOne(query);
-
-    WaveletDeltaRecord waveletDelta = null;
-
-    if (result != null) try {
-      waveletDelta = 
MongoDbDeltaStoreUtil.deserializeWaveletDeltaRecord(result);
-    } catch (PersistenceException e) {
-      throw new IOException(e);
-    }
-    return waveletDelta;
-  }
-
-  @Override
-  public WaveletDeltaRecord getDeltaByEndVersion(long version) throws 
IOException {
-    DBObject query = createWaveletDBQuery();
-    
query.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION_VERSION, 
version);
-
-    DBObject result = deltaDbCollection.findOne(query);
-
-    WaveletDeltaRecord waveletDelta = null;
-
-    if (result != null)
-    try {
-      MongoDbDeltaStoreUtil.deserializeWaveletDeltaRecord(result);
-    } catch (PersistenceException e) {
-      throw new IOException(e);
-    }
-    return waveletDelta;
-  }
-
-  @Override
-  public HashedVersion getAppliedAtVersion(long version) throws IOException {
-
-    DBObject query = createWaveletDBQuery();
-    query.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_APPLIEDATVERSION, 
version);
-
-    DBObject result = deltaDbCollection.findOne(query);
-
-    if (result != null)
-      return MongoDbDeltaStoreUtil.deserializeHashedVersion((DBObject) result
-          .get(MongoDbDeltaStoreUtil.FIELD_APPLIEDATVERSION));
-    return null;
-  }
-
-  @Override
-  public HashedVersion getResultingVersion(long version) throws IOException {
-    DBObject query = createWaveletDBQuery();
-    query.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_APPLIEDATVERSION, 
version);
-
-    DBObject result = deltaDbCollection.findOne(query);
-
-    if (result != null)
-      return MongoDbDeltaStoreUtil.deserializeHashedVersion((DBObject) result
-          .get(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION));
-    return null;
-  }
-
-  @Override
-  public ByteStringMessage<ProtocolAppliedWaveletDelta> getAppliedDelta(long 
version)
-      throws IOException {
-
-    WaveletDeltaRecord delta = getDelta(version);
-    return (delta != null) ? delta.getAppliedDelta() : null;
-  }
-
-  @Override
-  public TransformedWaveletDelta getTransformedDelta(long version) throws 
IOException {
-
-    WaveletDeltaRecord delta = getDelta(version);
-    return (delta != null) ? delta.getTransformedDelta() : null;
-  }
-
-  @Override
-  public void close() throws IOException {
-    // Does nothing.
-  }
-
-  @Override
-  public void append(Collection<WaveletDeltaRecord> newDeltas) throws 
PersistenceException {
-
-    for (WaveletDeltaRecord delta : newDeltas) {
-      // Using Journaled Write Concern
-      // (http://docs.mongodb.org/manual/core/write-concern/#journaled)
-      deltaDbCollection.insert(MongoDbDeltaStoreUtil.serialize(delta,
-          waveletName.waveId.serialise(), waveletName.waveletId.serialise()),
-          WriteConcern.JOURNALED);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStore.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStore.java 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStore.java
deleted file mode 100644
index 05aacbd..0000000
--- a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStore.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.server.persistence.mongodb;
-
-import com.google.common.collect.ImmutableSet;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBCursor;
-import com.mongodb.DBObject;
-import com.mongodb.MongoException;
-import com.mongodb.WriteConcern;
-
-import org.waveprotocol.box.common.ExceptionalIterator;
-import 
org.waveprotocol.box.server.persistence.FileNotFoundPersistenceException;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.waveserver.DeltaStore;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.id.WaveletId;
-import org.waveprotocol.wave.model.id.WaveletName;
-
-import java.util.List;
-
-/**
- * A MongoDB based Delta Store implementation using a simple <b>deltas</b>
- * collection, storing a delta record per each MongoDb document.
- *
- * @author [email protected] (Pablo Ojanguren)
- *
- */
-public class MongoDbDeltaStore implements DeltaStore {
-
-  /** Name of the MongoDB collection to store Deltas */
-  private static final String DELTAS_COLLECTION = "deltas";
-
-  /** Database connection object */
-  private final DB database;
-
-  /**
-   * Construct a new store
-   *
-   * @param database the database connection object
-   */
-  public MongoDbDeltaStore(DB database) {
-    this.database = database;
-  }
-
-  @Override
-  public DeltasAccess open(WaveletName waveletName) throws 
PersistenceException {
-
-    return new MongoDbDeltaCollection(waveletName, getDeltaDbCollection());
-  }
-
-  @Override
-  public void delete(WaveletName waveletName) throws PersistenceException,
-      FileNotFoundPersistenceException {
-
-    DBObject criteria = new BasicDBObject();
-    criteria.put(MongoDbDeltaStoreUtil.FIELD_WAVE_ID, 
waveletName.waveId.serialise());
-    criteria.put(MongoDbDeltaStoreUtil.FIELD_WAVELET_ID, 
waveletName.waveletId.serialise());
-
-    try {
-      // Using Journaled Write Concern
-      // (http://docs.mongodb.org/manual/core/write-concern/#journaled)
-      getDeltaDbCollection().remove(criteria, WriteConcern.JOURNALED);
-    } catch (MongoException e) {
-      throw new PersistenceException(e);
-    }
-  }
-
-  @Override
-  public ImmutableSet<WaveletId> lookup(WaveId waveId) throws 
PersistenceException {
-
-
-    DBObject query = new BasicDBObject();
-    query.put(MongoDbDeltaStoreUtil.FIELD_WAVE_ID, waveId.serialise());
-
-    DBObject projection = new BasicDBObject();
-    projection.put(MongoDbDeltaStoreUtil.FIELD_WAVELET_ID, 1);
-
-    DBCursor cursor = null;
-
-    try {
-      cursor = getDeltaDbCollection().find(query, projection);
-    } catch (MongoException e) {
-      throw new PersistenceException(e);
-    }
-
-
-    if (cursor == null || !cursor.hasNext()) {
-      return ImmutableSet.of();
-    } else {
-      ImmutableSet.Builder<WaveletId> builder = ImmutableSet.builder();
-      for (DBObject waveletIdDBObject : cursor) {
-        builder.add(WaveletId.deserialise((String) waveletIdDBObject
-            .get(MongoDbDeltaStoreUtil.FIELD_WAVELET_ID)));
-      }
-      return builder.build();
-    }
-  }
-
-  @Override
-  public ExceptionalIterator<WaveId, PersistenceException> getWaveIdIterator()
-      throws PersistenceException {
-
-    ImmutableSet.Builder<WaveId> builder = ImmutableSet.builder();
-
-    try {
-
-      @SuppressWarnings("rawtypes")
-      List results = 
getDeltaDbCollection().distinct(MongoDbDeltaStoreUtil.FIELD_WAVE_ID);
-
-      for (Object o : results)
-        builder.add(WaveId.deserialise((String) o));
-
-    } catch (MongoException e) {
-      throw new PersistenceException(e);
-    }
-
-
-    return ExceptionalIterator.FromIterator.create(builder.build().iterator());
-  }
-
-  /**
-   * Access to deltas collection
-   *
-   * @return DBCollection of deltas
-   */
-  private DBCollection getDeltaDbCollection() {
-    return database.getCollection(DELTAS_COLLECTION);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
deleted file mode 100644
index e93bfed..0000000
--- 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
+++ /dev/null
@@ -1,264 +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.persistence.mongodb;
-
-import com.google.common.collect.ImmutableList;
-import com.google.protobuf.ByteString;
-import com.google.protobuf.InvalidProtocolBufferException;
-
-import com.mongodb.BasicDBList;
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-
-import org.waveprotocol.box.server.common.CoreWaveletOperationSerializer;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoDeltaStoreDataSerializer;
-import org.waveprotocol.box.server.waveserver.ByteStringMessage;
-import org.waveprotocol.box.server.waveserver.WaveletDeltaRecord;
-import org.waveprotocol.wave.federation.Proto.ProtocolDocumentOperation;
-import org.waveprotocol.wave.model.document.operation.DocOp;
-import org.waveprotocol.wave.model.operation.wave.AddParticipant;
-import org.waveprotocol.wave.model.operation.wave.BlipContentOperation;
-import org.waveprotocol.wave.model.operation.wave.BlipOperation;
-import org.waveprotocol.wave.model.operation.wave.NoOp;
-import org.waveprotocol.wave.model.operation.wave.RemoveParticipant;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.wave.model.operation.wave.WaveletBlipOperation;
-import org.waveprotocol.wave.model.operation.wave.WaveletOperation;
-import org.waveprotocol.wave.model.operation.wave.WaveletOperationContext;
-import org.waveprotocol.wave.model.version.HashedVersion;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-/**
- * A utility class to serialize/deserialize delta objects to/from MongoDB. The
- * implementation approach is analog to the provided at
- * {@link CoreWaveletOperationSerializer} and
- * {@link ProtoDeltaStoreDataSerializer}
- *
- * @author [email protected] (Pablo Ojanguren)
- */
-public class MongoDbDeltaStoreUtil {
-  public static final String WAVELET_OP_WAVELET_BLIP_OPERATION = 
"WaveletBlipOperation";
-  public static final String WAVELET_OP_REMOVE_PARTICIPANT = 
"RemoveParticipant";
-  public static final String WAVELET_OP_ADD_PARTICIPANT = "AddParticipant";
-  public static final String WAVELET_OP_NOOP = "NoOp";
-  public static final String FIELD_BYTES = "bytes";
-  public static final String FIELD_CONTENTOP = "contentop";
-  public static final String FIELD_BLIPOP = "blipop";
-  public static final String FIELD_BLIPID = "blipid";
-  public static final String FIELD_PARTICIPANT = "participant";
-  public static final String FIELD_TYPE = "type";
-  public static final String FIELD_OPS = "ops";
-  public static final String FIELD_APPLICATIONTIMESTAMP = 
"applicationtimestamp";
-  public static final String FIELD_AUTHOR = "author";
-  public static final String FIELD_ADDRESS = "address";
-  public static final String FIELD_HISTORYHASH = "historyhash";
-  public static final String FIELD_VERSION = "version";
-  public static final String FIELD_TRANSFORMED_RESULTINGVERSION_VERSION =
-      "transformed.resultingversion.version";
-  public static final String FIELD_TRANSFORMED_APPLIEDATVERSION = 
"transformed.appliedatversion";
-  public static final String FIELD_TRANSFORMED_RESULTINGVERSION = 
"transformed.resultingversion";
-  public static final String FIELD_APPLIEDATVERSION = "appliedatversion";
-  public static final String FIELD_RESULTINGVERSION = "resultingversion";
-  public static final String FIELD_TRANSFORMED = "transformed";
-  public static final String FIELD_APPLIED = "applied";
-  public static final String FIELD_WAVELET_ID = "waveletid";
-  public static final String FIELD_WAVE_ID = "waveid";
-
-  public static DBObject serialize(WaveletDeltaRecord waveletDelta, String 
waveId, String waveletId) {
-
-    BasicDBObject mongoWaveletDelta = new BasicDBObject();
-
-    mongoWaveletDelta.append(FIELD_WAVE_ID, waveId);
-    mongoWaveletDelta.append(FIELD_WAVELET_ID, waveletId);
-
-    mongoWaveletDelta.append(FIELD_APPLIEDATVERSION, 
serialize(waveletDelta.getAppliedAtVersion()));
-    mongoWaveletDelta.append(FIELD_APPLIED, 
waveletDelta.getAppliedDelta().getByteArray());
-    mongoWaveletDelta.append(FIELD_TRANSFORMED, 
serialize(waveletDelta.getTransformedDelta()));
-
-    return mongoWaveletDelta;
-  }
-
-  public static DBObject serialize(HashedVersion hashedVersion) {
-    BasicDBObject mongoHashedVersion = new BasicDBObject();
-    mongoHashedVersion.append(FIELD_VERSION, hashedVersion.getVersion());
-    mongoHashedVersion.append(FIELD_HISTORYHASH, 
hashedVersion.getHistoryHash());
-    return mongoHashedVersion;
-  }
-
-  public static DBObject serialize(ParticipantId participantId) {
-    BasicDBObject mongoParticipantId = new BasicDBObject();
-    mongoParticipantId.append(FIELD_ADDRESS, participantId.getAddress());
-    return mongoParticipantId;
-  }
-
-  public static DBObject serialize(TransformedWaveletDelta 
transformedWaveletDelta) {
-    BasicDBObject mongoTransformedWaveletDelta = new BasicDBObject();
-    mongoTransformedWaveletDelta.append(FIELD_AUTHOR,
-        serialize(transformedWaveletDelta.getAuthor()));
-    mongoTransformedWaveletDelta.append(FIELD_RESULTINGVERSION,
-        serialize(transformedWaveletDelta.getResultingVersion()));
-    mongoTransformedWaveletDelta.append(FIELD_APPLICATIONTIMESTAMP,
-        transformedWaveletDelta.getApplicationTimestamp());
-
-    mongoTransformedWaveletDelta.append(FIELD_APPLIEDATVERSION,
-        transformedWaveletDelta.getAppliedAtVersion());
-
-    BasicDBList mongoWaveletOperations = new BasicDBList();
-
-    for (WaveletOperation op : transformedWaveletDelta) {
-      mongoWaveletOperations.add(serialize(op));
-    }
-
-    mongoTransformedWaveletDelta.append(FIELD_OPS, mongoWaveletOperations);
-
-    return mongoTransformedWaveletDelta;
-  }
-
-  public static DBObject serialize(WaveletOperation waveletOp) {
-    final BasicDBObject mongoOp = new BasicDBObject();
-
-    if (waveletOp instanceof NoOp) {
-      mongoOp.append(FIELD_TYPE, WAVELET_OP_NOOP);
-
-    } else if (waveletOp instanceof AddParticipant) {
-      mongoOp.append(FIELD_TYPE, WAVELET_OP_ADD_PARTICIPANT);
-      mongoOp.append(FIELD_PARTICIPANT, serialize(((AddParticipant) 
waveletOp).getParticipantId()));
-
-    } else if (waveletOp instanceof RemoveParticipant) {
-      mongoOp.append(FIELD_TYPE, WAVELET_OP_REMOVE_PARTICIPANT);
-      mongoOp.append(FIELD_PARTICIPANT,
-          serialize(((RemoveParticipant) waveletOp).getParticipantId()));
-    } else if (waveletOp instanceof WaveletBlipOperation) {
-      final WaveletBlipOperation waveletBlipOp = (WaveletBlipOperation) 
waveletOp;
-
-      mongoOp.append(FIELD_TYPE, WAVELET_OP_WAVELET_BLIP_OPERATION);
-      mongoOp.append(FIELD_BLIPID, waveletBlipOp.getBlipId());
-
-      if (waveletBlipOp.getBlipOp() instanceof BlipContentOperation) {
-        mongoOp.append(FIELD_BLIPOP, serialize((BlipContentOperation) 
waveletBlipOp.getBlipOp()));
-      } else {
-        throw new IllegalArgumentException("Unsupported blip operation: "
-            + waveletBlipOp.getBlipOp());
-      }
-    } else {
-      throw new IllegalArgumentException("Unsupported wavelet operation: " + 
waveletOp);
-    }
-    return mongoOp;
-  }
-
-  public static DBObject serialize(BlipContentOperation blipContentOp) {
-    BasicDBObject mongoBlipContentOp = new BasicDBObject();
-    mongoBlipContentOp.append(FIELD_CONTENTOP, 
serialize(blipContentOp.getContentOp()));
-    return mongoBlipContentOp;
-  }
-
-  public static DBObject serialize(DocOp docOp) {
-    BasicDBObject mongoDocOp = new BasicDBObject();
-    mongoDocOp.append(FIELD_BYTES, 
CoreWaveletOperationSerializer.serialize(docOp).toByteArray());
-    return mongoDocOp;
-  }
-
-  public static WaveletDeltaRecord deserializeWaveletDeltaRecord(DBObject 
dbObject)
-      throws PersistenceException {
-    try {
-      return new WaveletDeltaRecord(
-          deserializeHashedVersion((DBObject) 
dbObject.get(FIELD_APPLIEDATVERSION)),
-          
ByteStringMessage.parseProtocolAppliedWaveletDelta(ByteString.copyFrom((byte[]) 
dbObject
-              .get(FIELD_APPLIED))),
-          deserializeTransformedWaveletDelta((DBObject) 
dbObject.get(FIELD_TRANSFORMED)));
-
-    } catch (InvalidProtocolBufferException e) {
-      throw new PersistenceException(e);
-    }
-  }
-
-  public static HashedVersion deserializeHashedVersion(DBObject dbObject) {
-    return HashedVersion.of((Long) dbObject.get(FIELD_VERSION),
-        (byte[]) dbObject.get(FIELD_HISTORYHASH));
-  }
-
-  public static ParticipantId deserializeParicipantId(DBObject dbObject) {
-    return ParticipantId.ofUnsafe((String) dbObject.get(FIELD_ADDRESS));
-  }
-
-  public static TransformedWaveletDelta 
deserializeTransformedWaveletDelta(DBObject dbObject)
-      throws PersistenceException {
-
-    ParticipantId author = deserializeParicipantId((DBObject) 
dbObject.get(FIELD_AUTHOR));
-    HashedVersion resultingVersion =
-        deserializeHashedVersion((DBObject) 
dbObject.get(FIELD_RESULTINGVERSION));
-    long applicationTimestamp = (Long) 
dbObject.get(FIELD_APPLICATIONTIMESTAMP);
-
-    BasicDBList dbOps = (BasicDBList) dbObject.get(FIELD_OPS);
-    ImmutableList.Builder<WaveletOperation> operations = 
ImmutableList.builder();
-
-    int numOperations = dbOps.size();
-
-    // Code analog to ProtoDeltaStoreDataSerializer.deserialize
-    for (int i = 0; i < numOperations; i++) {
-
-      WaveletOperationContext context;
-      if (i == numOperations - 1) {
-        context = new WaveletOperationContext(author, applicationTimestamp, 1, 
resultingVersion);
-      } else {
-        context = new WaveletOperationContext(author, applicationTimestamp, 1);
-      }
-      operations.add(deserializeWaveletOperation((DBObject) dbOps.get(i), 
context));
-    }
-
-    return new TransformedWaveletDelta(author, resultingVersion, 
applicationTimestamp,
-        operations.build());
-  }
-
-  public static WaveletOperation deserializeWaveletOperation(DBObject dbObject,
-      WaveletOperationContext context) throws PersistenceException {
-    String type = (String) dbObject.get(FIELD_TYPE);
-    if (type.equals(WAVELET_OP_NOOP)) {
-      return new NoOp(context);
-    } else if (type.equals(WAVELET_OP_ADD_PARTICIPANT)) {
-      return new AddParticipant(context,
-          deserializeParicipantId((DBObject) dbObject.get(FIELD_PARTICIPANT)));
-    } else if (type.equals(WAVELET_OP_REMOVE_PARTICIPANT)) {
-      return new RemoveParticipant(context,
-          deserializeParicipantId((DBObject) dbObject.get(FIELD_PARTICIPANT)));
-    } else if (type.equals(WAVELET_OP_WAVELET_BLIP_OPERATION)) {
-      return new WaveletBlipOperation((String) dbObject.get(FIELD_BLIPID),
-          deserializeBlipContentOperation((DBObject) 
dbObject.get(FIELD_BLIPOP), context));
-    } else {
-      throw new IllegalArgumentException("Unsupported operation: " + type);
-    }
-  }
-
-  public static BlipOperation deserializeBlipContentOperation(DBObject 
dbObject,
-      WaveletOperationContext context) throws PersistenceException {
-    return new BlipContentOperation(context,
-        deserializeDocOp((DBObject) dbObject.get(FIELD_CONTENTOP)));
-  }
-
-  private static DocOp deserializeDocOp(DBObject dbObject) throws 
PersistenceException {
-    try {
-      return 
CoreWaveletOperationSerializer.deserialize(ProtocolDocumentOperation
-          .parseFrom(((byte[]) dbObject.get(FIELD_BYTES))));
-    } catch (InvalidProtocolBufferException e) {
-      throw new PersistenceException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbProvider.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbProvider.java 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbProvider.java
deleted file mode 100644
index 8ff53ca..0000000
--- a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbProvider.java
+++ /dev/null
@@ -1,167 +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.persistence.mongodb;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-import com.mongodb.DB;
-import com.mongodb.Mongo;
-import com.mongodb.MongoClient;
-import com.mongodb.MongoException;
-
-import org.waveprotocol.box.server.persistence.PersistenceStartException;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.net.UnknownHostException;
-
-/**
- * Class to lazily setup and manage the MongoDb connection.
- *
- * @author [email protected] (Lennard de Rijk)
- *
- */
-public class MongoDbProvider {
-  private static final Log LOG = Log.get(MongoDbProvider.class);
-
-  private String dbHost;
-
-  private String dbPort;
-
-  private String dbName;
-
-  /**
-   * Our {@link MongoClient} instance, should be accessed by getMongo unless 
during
-   * start().
-   */
-  private Mongo mongo;
-
-  /**
-   * Lazily instantiated {@link MongoDbStore}.
-   */
-  private MongoDbStore mongoDbStore;
-
-  /**
-   * Separated store for Deltas {@link MongoDbDeltaStore}
-   */
-  private MongoDbDeltaStore mongoDbDeltaStore;
-
-  /** Stores whether we have successfully setup a live {@link Mongo} instance. 
*/
-  private boolean isRunning;
-
-  /**
-   * Constructs a new empty {@link MongoDbProvider}.
-   */
-  public MongoDbProvider(String dbHost, String dbPort, String dbName) {
-    this.dbHost = dbHost;
-    this.dbPort = dbPort;
-    this.dbName = dbName;
-  }
-
-  /**
-   * Starts the {@link Mongo} instance and explicitly checks whether it is
-   * actually alive.
-   *
-   * @throws PersistenceStartException if we can't make a connection to 
MongoDb.
-   */
-  private void start() {
-    Preconditions.checkState(!isRunning(), "Can't start after a connection has 
been established");
-
-    String host = dbHost;
-    int port = Integer.parseInt(dbPort);
-    try {
-      // New MongoDB Client, see 
http://docs.mongodb.org/manual/release-notes/drivers-write-concern/
-      mongo = new MongoClient(host, port);
-    } catch (UnknownHostException e) {
-      throw new PersistenceStartException("Unable to resolve the MongoDb 
hostname", e);
-    }
-
-    try {
-      // Check to see if we are alive
-      mongo.getDB(dbName).command("ping");
-    } catch (MongoException e) {
-      throw new PersistenceStartException("Can't ping MongoDb", e);
-    }
-
-    isRunning = true;
-    LOG.info("Started MongoDb persistence");
-  }
-
-
-  /**
-   * Returns the {@link DB} with the name that is specified in the properties
-   * file.
-   */
-  private DB getDatabase() {
-    return getDatabaseForName(dbName);
-  }
-
-  /**
-   * Returns a {@link DB} instance for the database with the given name
-   *
-   * @param name the name of the database
-   */
-  @VisibleForTesting
-  DB getDatabaseForName(String name) {
-    return getMongo().getDB(name);
-  }
-
-  /**
-   * Return the {@link Mongo} instance that we are managing.
-   */
-  private Mongo getMongo() {
-    if (!isRunning) {
-      start();
-    }
-    return mongo;
-  }
-
-  /**
-   * Returns true iff the {@link MongoDbProvider} is running.
-   */
-  public boolean isRunning() {
-    return isRunning;
-  }
-
-  /**
-   * Returns a {@link MongoDbStore} instance created from the settings in this
-   * provider.
-   */
-  public MongoDbStore provideMongoDbStore() {
-    if (mongoDbStore == null) {
-      mongoDbStore = new MongoDbStore(getDatabase());
-    }
-    return mongoDbStore;
-  }
-
-  /**
-   * Returns a {@link MongoDbDeltaStore} instance created from the settings in 
this
-   * provider.
-   */
-  public MongoDbDeltaStore provideMongoDbDeltaStore() {
-    if (mongoDbDeltaStore == null) {
-      mongoDbDeltaStore = new MongoDbDeltaStore(getDatabase());
-    }
-
-    return mongoDbDeltaStore;
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java
deleted file mode 100644
index c5a0087..0000000
--- a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java
+++ /dev/null
@@ -1,433 +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.persistence.mongodb;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.wave.api.Context;
-import com.google.wave.api.ProtocolVersion;
-import com.google.wave.api.event.EventType;
-import com.google.wave.api.robot.Capability;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.MongoException;
-import com.mongodb.gridfs.GridFS;
-import com.mongodb.gridfs.GridFSDBFile;
-import com.mongodb.gridfs.GridFSInputFile;
-
-import org.bson.types.BasicBSONList;
-import org.waveprotocol.box.attachment.AttachmentMetadata;
-import org.waveprotocol.box.attachment.AttachmentProto;
-import org.waveprotocol.box.attachment.proto.AttachmentMetadataProtoImpl;
-import org.waveprotocol.box.server.account.AccountData;
-import org.waveprotocol.box.server.account.HumanAccountData;
-import org.waveprotocol.box.server.account.HumanAccountDataImpl;
-import org.waveprotocol.box.server.account.RobotAccountData;
-import org.waveprotocol.box.server.account.RobotAccountDataImpl;
-import org.waveprotocol.box.server.authentication.PasswordDigest;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.box.server.persistence.AttachmentStore;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.persistence.SignerInfoStore;
-import org.waveprotocol.box.server.robots.RobotCapabilities;
-import org.waveprotocol.wave.crypto.SignatureException;
-import org.waveprotocol.wave.crypto.SignerInfo;
-import org.waveprotocol.wave.federation.Proto.ProtocolSignerInfo;
-import org.waveprotocol.wave.media.model.AttachmentId;
-import org.waveprotocol.wave.model.util.CollectionUtils;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * <b>CertPathStore:</b><br/>
- * <i>Collection(signerInfo):</i>
- * <ul>
- * <li>_id : signerId byte array.</li>
- * <li>protoBuff : byte array representing the protobuff message of a
- * {@link ProtocolSignerInfo}.</li>
- * </ul>
- * <p>
- *
- * @author [email protected] (Lennard de Rijk)
- * @author [email protected] (Joseph Gentle)
- *
- */
-public final class MongoDbStore implements SignerInfoStore, AttachmentStore, 
AccountStore {
-
-  private static final String ACCOUNT_COLLECTION = "account";
-  private static final String ACCOUNT_HUMAN_DATA_FIELD = "human";
-  private static final String ACCOUNT_ROBOT_DATA_FIELD = "robot";
-
-  private static final String HUMAN_PASSWORD_FIELD = "passwordDigest";
-
-  private static final String PASSWORD_DIGEST_FIELD = "digest";
-  private static final String PASSWORD_SALT_FIELD = "salt";
-
-  private static final String ROBOT_URL_FIELD = "url";
-  private static final String ROBOT_SECRET_FIELD = "secret";
-  private static final String ROBOT_CAPABILITIES_FIELD = "capabilities";
-  private static final String ROBOT_VERIFIED_FIELD = "verified";
-
-  private static final String CAPABILITIES_VERSION_FIELD = "version";
-  private static final String CAPABILITIES_HASH_FIELD = "capabilitiesHash";
-  private static final String CAPABILITIES_CAPABILITIES_FIELD = "capabilities";
-  private static final String CAPABILITY_CONTEXTS_FIELD = "contexts";
-  private static final String CAPABILITY_FILTER_FIELD = "filter";
-
-  private static final Logger LOG = 
Logger.getLogger(MongoDbStore.class.getName());
-
-  private final DB database;
-  private final GridFS attachmentGrid;
-  private final GridFS thumbnailGrid;
-  private final GridFS metadataGrid;
-
-  MongoDbStore(DB database) {
-    this.database = database;
-    attachmentGrid = new GridFS(database, "attachments");
-    thumbnailGrid = new GridFS(database, "thumbnails");
-    metadataGrid = new GridFS(database, "metadata");
-  }
-
-  @Override
-  public void initializeSignerInfoStore() throws PersistenceException {
-    // Nothing to initialize
-  }
-
-  @Override
-  public SignerInfo getSignerInfo(byte[] signerId) {
-    DBObject query = getDBObjectForSignerId(signerId);
-    DBCollection signerInfoCollection = getSignerInfoCollection();
-    DBObject signerInfoDBObject = signerInfoCollection.findOne(query);
-
-    // Sub-class contract specifies return null when not found
-    SignerInfo signerInfo = null;
-
-    if (signerInfoDBObject != null) {
-      byte[] protobuff = (byte[]) signerInfoDBObject.get("protoBuff");
-      try {
-        signerInfo = new SignerInfo(ProtocolSignerInfo.parseFrom(protobuff));
-      } catch (InvalidProtocolBufferException e) {
-        LOG.log(Level.SEVERE, "Couldn't parse the protobuff stored in MongoDB: 
" + protobuff, e);
-      } catch (SignatureException e) {
-        LOG.log(Level.SEVERE, "Couldn't parse the certificate chain or domain 
properly", e);
-      }
-    }
-    return signerInfo;
-  }
-
-  @Override
-  public void putSignerInfo(ProtocolSignerInfo protocolSignerInfo) throws 
SignatureException {
-    SignerInfo signerInfo = new SignerInfo(protocolSignerInfo);
-    byte[] signerId = signerInfo.getSignerId();
-
-    // Not using a modifier here because rebuilding the object is not a lot of
-    // work. Doing implicit upsert by using save with a DBOBject that has an 
_id
-    // set.
-    DBObject signerInfoDBObject = getDBObjectForSignerId(signerId);
-    signerInfoDBObject.put("protoBuff", protocolSignerInfo.toByteArray());
-    getSignerInfoCollection().save(signerInfoDBObject);
-  }
-
-  /**
-   * Returns an instance of {@link DBCollection} for storing SignerInfo.
-   */
-  private DBCollection getSignerInfoCollection() {
-    return database.getCollection("signerInfo");
-  }
-
-  /**
-   * Returns a {@link DBObject} which contains the key-value pair used to
-   * signify the signerId.
-   *
-   * @param signerId the signerId value to set.
-   * @return a new {@link DBObject} with the (_id,signerId) entry.
-   */
-  private DBObject getDBObjectForSignerId(byte[] signerId) {
-    DBObject query = new BasicDBObject();
-    query.put("_id", signerId);
-    return query;
-  }
-
-  // *********** Attachments.
-
-  @Override
-  public AttachmentData getAttachment(AttachmentId attachmentId) {
-
-    final GridFSDBFile attachment = 
attachmentGrid.findOne(attachmentId.serialise());
-    return fileToAttachmentData(attachment);
-  }
-
-  @Override
-  public void storeAttachment(AttachmentId attachmentId, InputStream data)
-      throws IOException {
-    saveFile(attachmentGrid.createFile(data, attachmentId.serialise()));
-  }
-
-  @Override
-  public void deleteAttachment(AttachmentId attachmentId) {
-    attachmentGrid.remove(attachmentId.serialise());
-    thumbnailGrid.remove(attachmentId.serialise());
-    metadataGrid.remove(attachmentId.serialise());
-  }
-
-
-  @Override
-  public AttachmentMetadata getMetadata(AttachmentId attachmentId) throws 
IOException {
-    final GridFSDBFile metadata = 
metadataGrid.findOne(attachmentId.serialise());
-
-    if (metadata == null) {
-      return null;
-    }
-    AttachmentProto.AttachmentMetadata protoMetadata =
-        
AttachmentProto.AttachmentMetadata.parseFrom(metadata.getInputStream());
-    return new AttachmentMetadataProtoImpl(protoMetadata);
-  }
-
-  @Override
-  public AttachmentData getThumbnail(AttachmentId attachmentId) throws 
IOException {
-    final GridFSDBFile thumbnail = 
thumbnailGrid.findOne(attachmentId.serialise());
-    return fileToAttachmentData(thumbnail);
-  }
-
-  @Override
-  public void storeMetadata(AttachmentId attachmentId, AttachmentMetadata 
metaData)
-      throws IOException {
-    AttachmentMetadataProtoImpl proto = new 
AttachmentMetadataProtoImpl(metaData);
-    byte[] bytes = proto.getPB().toByteArray();
-    GridFSInputFile file =
-        metadataGrid.createFile(new ByteArrayInputStream(bytes), 
attachmentId.serialise());
-    saveFile(file);
-  }
-
-  @Override
-  public void storeThumbnail(AttachmentId attachmentId, InputStream dataData) 
throws IOException {
-    saveFile(thumbnailGrid.createFile(dataData, attachmentId.serialise()));
-  }
-
-  private void saveFile(GridFSInputFile file) throws IOException {
-    try {
-      file.save();
-    } catch (MongoException e) {
-      // Unfortunately, file.save() wraps any IOException thrown in a
-      // 'MongoException'. Since the interface explicitly throws IOExceptions,
-      // we unwrap any IOExceptions thrown.
-      Throwable innerException = e.getCause();
-      if (innerException instanceof IOException) {
-        throw (IOException) innerException;
-      } else {
-        throw e;
-      }
-    };
-  }
-
-  private AttachmentData fileToAttachmentData(final GridFSDBFile attachmant) {
-    if (attachmant == null) {
-      return null;
-    } else {
-      return new AttachmentData() {
-
-        @Override
-        public InputStream getInputStream() throws IOException {
-          return attachmant.getInputStream();
-        }
-
-        @Override
-        public long getSize() {
-          return attachmant.getLength();
-        }
-      };
-    }
-  }
-
-  // ******** AccountStore
-
-  @Override
-  public void initializeAccountStore() throws PersistenceException {
-    // TODO: Sanity checks not handled by MongoDBProvider???
-  }
-
-  @Override
-  public AccountData getAccount(ParticipantId id) {
-    DBObject query = getDBObjectForParticipant(id);
-    DBObject result = getAccountCollection().findOne(query);
-
-    if (result == null) {
-      return null;
-    }
-
-    DBObject human = (DBObject) result.get(ACCOUNT_HUMAN_DATA_FIELD);
-    if (human != null) {
-      return objectToHuman(id, human);
-    }
-
-    DBObject robot = (DBObject) result.get(ACCOUNT_ROBOT_DATA_FIELD);
-    if (robot != null) {
-      return objectToRobot(id, robot);
-    }
-
-    throw new IllegalStateException("DB object contains neither a human nor a 
robot");
-  }
-
-  @Override
-  public void putAccount(AccountData account) {
-    DBObject object = getDBObjectForParticipant(account.getId());
-
-    if (account.isHuman()) {
-      object.put(ACCOUNT_HUMAN_DATA_FIELD, humanToObject(account.asHuman()));
-    } else if (account.isRobot()) {
-      object.put(ACCOUNT_ROBOT_DATA_FIELD, robotToObject(account.asRobot()));
-    } else {
-      throw new IllegalStateException("Account is neither a human nor a 
robot");
-    }
-
-    getAccountCollection().save(object);
-  }
-
-  @Override
-  public void removeAccount(ParticipantId id) {
-    DBObject object = getDBObjectForParticipant(id);
-    getAccountCollection().remove(object);
-  }
-
-  private DBObject getDBObjectForParticipant(ParticipantId id) {
-    DBObject query = new BasicDBObject();
-    query.put("_id", id.getAddress());
-    return query;
-  }
-
-  private DBCollection getAccountCollection() {
-    return database.getCollection(ACCOUNT_COLLECTION);
-  }
-
-  // ****** HumanAccountData serialization
-
-  private DBObject humanToObject(HumanAccountData account) {
-    DBObject object = new BasicDBObject();
-
-    PasswordDigest digest = account.getPasswordDigest();
-    if (digest != null) {
-      DBObject digestObj = new BasicDBObject();
-      digestObj.put(PASSWORD_SALT_FIELD, digest.getSalt());
-      digestObj.put(PASSWORD_DIGEST_FIELD, digest.getDigest());
-
-      object.put(HUMAN_PASSWORD_FIELD, digestObj);
-    }
-
-    return object;
-  }
-
-  private HumanAccountData objectToHuman(ParticipantId id, DBObject object) {
-    PasswordDigest passwordDigest = null;
-
-    DBObject digestObj = (DBObject) object.get(HUMAN_PASSWORD_FIELD);
-    if (digestObj != null) {
-      byte[] salt = (byte[]) digestObj.get(PASSWORD_SALT_FIELD);
-      byte[] digest = (byte[]) digestObj.get(PASSWORD_DIGEST_FIELD);
-      passwordDigest = PasswordDigest.from(salt, digest);
-    }
-
-    return new HumanAccountDataImpl(id, passwordDigest);
-  }
-
-  // ****** RobotAccountData serialization
-
-  private DBObject robotToObject(RobotAccountData account) {
-    return new BasicDBObject()
-        .append(ROBOT_URL_FIELD, account.getUrl())
-        .append(ROBOT_SECRET_FIELD, account.getConsumerSecret())
-        .append(ROBOT_CAPABILITIES_FIELD, 
capabilitiesToObject(account.getCapabilities()))
-        .append(ROBOT_VERIFIED_FIELD, account.isVerified());
-  }
-
-  private DBObject capabilitiesToObject(RobotCapabilities capabilities) {
-    if (capabilities == null) {
-      return null;
-    }
-
-    BasicDBObject capabilitiesObj = new BasicDBObject();
-    for (Capability capability : capabilities.getCapabilitiesMap().values()) {
-      BasicBSONList contexts = new BasicBSONList();
-      for (Context c : capability.getContexts()) {
-        contexts.add(c.name());
-      }
-      capabilitiesObj.put(capability.getEventType().name(),
-          new BasicDBObject()
-              .append(CAPABILITY_CONTEXTS_FIELD, contexts)
-              .append(CAPABILITY_FILTER_FIELD, capability.getFilter()));
-    }
-
-    BasicDBObject object =
-        new BasicDBObject()
-            .append(CAPABILITIES_CAPABILITIES_FIELD, capabilitiesObj)
-            .append(CAPABILITIES_HASH_FIELD, 
capabilities.getCapabilitiesHash())
-            .append(CAPABILITIES_VERSION_FIELD, 
capabilities.getProtocolVersion().name());
-
-    return object;
-  }
-
-  private AccountData objectToRobot(ParticipantId id, DBObject robot) {
-    String url = (String) robot.get(ROBOT_URL_FIELD);
-    String secret = (String) robot.get(ROBOT_SECRET_FIELD);
-    RobotCapabilities capabilities =
-        objectToCapabilities((DBObject) robot.get(ROBOT_CAPABILITIES_FIELD));
-    boolean verified = (Boolean) robot.get(ROBOT_VERIFIED_FIELD);
-    return new RobotAccountDataImpl(id, url, secret, capabilities, verified);
-  }
-
-  @SuppressWarnings("unchecked")
-  private RobotCapabilities objectToCapabilities(DBObject object) {
-    if (object == null) {
-      return null;
-    }
-
-    Map<String, Object> capabilitiesObj =
-       (Map<String, Object>) object.get(CAPABILITIES_CAPABILITIES_FIELD);
-    Map<EventType, Capability> capabilities = CollectionUtils.newHashMap();
-
-    for (Entry<String, Object> capability : capabilitiesObj.entrySet()) {
-      EventType eventType = EventType.valueOf(capability.getKey());
-      List<Context> contexts = CollectionUtils.newArrayList();
-      DBObject capabilityObj = (DBObject) capability.getValue();
-      DBObject contextsObj = (DBObject) 
capabilityObj.get(CAPABILITY_CONTEXTS_FIELD);
-      for (String contextId : contextsObj.keySet()) {
-        contexts.add(Context.valueOf((String) contextsObj.get(contextId)));
-      }
-      String filter = (String) capabilityObj.get(CAPABILITY_FILTER_FIELD);
-
-      capabilities.put(eventType, new Capability(eventType, contexts, filter));
-    }
-
-    String capabilitiesHash = (String) object.get(CAPABILITIES_HASH_FIELD);
-    ProtocolVersion version =
-        ProtocolVersion.valueOf((String) 
object.get(CAPABILITIES_VERSION_FIELD));
-
-    return new RobotCapabilities(capabilities, capabilitiesHash, version);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/mongodb/mongodb.properties
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/mongodb/mongodb.properties 
b/src/org/waveprotocol/box/server/persistence/mongodb/mongodb.properties
deleted file mode 100644
index 0f95fa4..0000000
--- a/src/org/waveprotocol/box/server/persistence/mongodb/mongodb.properties
+++ /dev/null
@@ -1,25 +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.
-#
-#
-
-# Mongo DB options, configure these if you are using the "mongo" option for 
one of your stores
-mongoDbHost=127.0.0.1
-mongoDbPort=27017
-mongoDbDatabase=fedone

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/protos/ProtoAccountDataSerializer.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/protos/ProtoAccountDataSerializer.java
 
b/src/org/waveprotocol/box/server/persistence/protos/ProtoAccountDataSerializer.java
deleted file mode 100644
index 24b7e4c..0000000
--- 
a/src/org/waveprotocol/box/server/persistence/protos/ProtoAccountDataSerializer.java
+++ /dev/null
@@ -1,185 +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.persistence.protos;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.protobuf.ByteString;
-import com.google.wave.api.Context;
-import com.google.wave.api.ProtocolVersion;
-import com.google.wave.api.event.EventType;
-import com.google.wave.api.robot.Capability;
-
-import org.waveprotocol.box.server.account.AccountData;
-import org.waveprotocol.box.server.account.HumanAccountData;
-import org.waveprotocol.box.server.account.HumanAccountDataImpl;
-import org.waveprotocol.box.server.account.RobotAccountData;
-import org.waveprotocol.box.server.account.RobotAccountDataImpl;
-import org.waveprotocol.box.server.authentication.PasswordDigest;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoAccountData;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoAccountData.AccountDataType;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoHumanAccountData;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoPasswordDigest;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoRobotAccountData;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoRobotCapabilities;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData.ProtoRobotCapability;
-import org.waveprotocol.box.server.robots.RobotCapabilities;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is used to serialize and deserialize {@link AccountData} and 
{@link ProtoAccountData}
- *
- * @author [email protected] (Tad Glines)
- */
-public class ProtoAccountDataSerializer {
-  /**
-   * Serialize {@link AccountData} into {@link ProtoAccountData}.
-   */
-  public static ProtoAccountData serialize(AccountData account) {
-    Preconditions.checkNotNull(account, "account is null");
-    Preconditions.checkArgument(account.isHuman() || account.isRobot(),
-        "account is neither a human or robot account!");
-    ProtoAccountData.Builder builder = ProtoAccountData.newBuilder();
-    builder.setAccountId(account.getId().getAddress());
-    if (account.isHuman()) {
-      builder.setAccountType(AccountDataType.HUMAN_ACCOUNT);
-      builder.setHumanAccountData(serialize(account.asHuman()));
-    } else if (account.isRobot()) {
-      builder.setAccountType(AccountDataType.ROBOT_ACCOUNT);
-      builder.setRobotAccountData(serialize(account.asRobot()));
-    }
-    return builder.build();
-  }
-
-  private static ProtoHumanAccountData serialize(HumanAccountData account) {
-    Preconditions.checkNotNull(account, "account is null");
-    ProtoHumanAccountData.Builder builder = ProtoHumanAccountData.newBuilder();
-    if (account.getPasswordDigest() != null) {
-      builder.setPasswordDigest(serialize(account.getPasswordDigest()));
-    }
-    return builder.build();
-  }
-
-  private static ProtoPasswordDigest serialize(PasswordDigest digest) {
-    Preconditions.checkNotNull(digest, "digest is null");
-    return ProtoPasswordDigest.newBuilder()
-      .setSalt(ByteString.copyFrom(digest.getSalt()))
-      .setDigest(ByteString.copyFrom(digest.getDigest()))
-      .build();
-  }
-
-  private static ProtoRobotAccountData serialize(RobotAccountData account) {
-    Preconditions.checkNotNull(account, "account is null");
-    ProtoRobotAccountData.Builder builder = ProtoRobotAccountData.newBuilder();
-    builder.setUrl(account.getUrl());
-    builder.setConsumerSecret(account.getConsumerSecret());
-    builder.setIsVerified(account.isVerified());
-    if (account.getCapabilities() != null) {
-      builder.setRobotCapabilities(serialize(account.getCapabilities()));
-    }
-    return builder.build();
-  }
-
-  private static ProtoRobotCapabilities serialize(RobotCapabilities 
capabilities) {
-    ProtoRobotCapabilities.Builder builder = 
ProtoRobotCapabilities.newBuilder();
-    
builder.setProtocolVersion(capabilities.getProtocolVersion().getVersionString());
-    builder.setCapabilitiesHash(capabilities.getCapabilitiesHash());
-    if (capabilities.getCapabilitiesMap() != null) {
-      for (Capability capability: capabilities.getCapabilitiesMap().values()) {
-        builder.addCapability(serialize(capability));
-      }
-    }
-    return builder.build();
-  }
-
-  private static ProtoRobotCapability serialize(Capability capability) {
-    ProtoRobotCapability.Builder builder = ProtoRobotCapability.newBuilder();
-    builder.setEventType(capability.getEventType().name());
-    builder.setFilter(capability.getFilter());
-    for (Context context: capability.getContexts()) {
-      builder.addContext(context.name());
-    }
-    return builder.build();
-  }
-
-  /**
-   * Deserialize {@link ProtoAccountData} into {@link AccountData}.
-   */
-  public static AccountData deserialize(ProtoAccountData data) {
-    switch (data.getAccountType()) {
-      case HUMAN_ACCOUNT:
-        Preconditions.checkArgument(data.hasHumanAccountData(),
-            "ProtoAccountData is missing the human_account_data field");
-        return deserialize(data.getAccountId(), data.getHumanAccountData());
-      case ROBOT_ACCOUNT:
-        Preconditions.checkArgument(data.hasRobotAccountData(),
-            "ProtoAccountData is missing the robot_account_data field");
-        return deserialize(data.getAccountId(), data.getRobotAccountData());
-      default:
-        throw new IllegalArgumentException(
-            "ProtoAccountData contains neither HumanAccountData nor 
RobotAccountData.");
-    }
-  }
-
-  private static HumanAccountData deserialize(String account_id, 
ProtoHumanAccountData data) {
-    ParticipantId id = ParticipantId.ofUnsafe(account_id);
-    if (data.hasPasswordDigest()) {
-      return new HumanAccountDataImpl(id, 
deserialize(data.getPasswordDigest()));
-    } else {
-      return new HumanAccountDataImpl(id);
-    }
-  }
-
-  private static PasswordDigest deserialize(ProtoPasswordDigest data) {
-    return PasswordDigest.from(data.getSalt().toByteArray(), 
data.getDigest().toByteArray());
-  }
-
-  private static RobotAccountData deserialize(String account_id, 
ProtoRobotAccountData data) {
-    ParticipantId id = ParticipantId.ofUnsafe(account_id);
-    RobotCapabilities capabilities = null;
-    if (data.hasRobotCapabilities()) {
-      capabilities = deserialize(data.getRobotCapabilities());
-    }
-    return new RobotAccountDataImpl(id, data.getUrl(), 
data.getConsumerSecret(),
-        capabilities, data.getIsVerified());
-  }
-
-  private static RobotCapabilities deserialize(ProtoRobotCapabilities data) {
-    Map<EventType, Capability> capabilities = Maps.newHashMap();
-    for (ProtoRobotCapability capabilityData: data.getCapabilityList()) {
-      Capability capability = deserialize(capabilityData);
-      capabilities.put(capability.getEventType(), capability);
-    }
-    return new RobotCapabilities(capabilities, data.getCapabilitiesHash(),
-        ProtocolVersion.fromVersionString(data.getProtocolVersion()));
-  }
-
-  private static Capability deserialize(ProtoRobotCapability data) {
-    List<Context> contexts = Lists.newArrayList();
-    for (String str: data.getContextList()) {
-      contexts.add(Context.valueOf(str));
-    }
-    return new Capability(EventType.valueOf(data.getEventType()), contexts, 
data.getFilter());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/protos/ProtoDeltaStoreDataSerializer.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/protos/ProtoDeltaStoreDataSerializer.java
 
b/src/org/waveprotocol/box/server/persistence/protos/ProtoDeltaStoreDataSerializer.java
deleted file mode 100644
index 048665d..0000000
--- 
a/src/org/waveprotocol/box/server/persistence/protos/ProtoDeltaStoreDataSerializer.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.persistence.protos;
-
-import com.google.common.collect.ImmutableList;
-
-import org.waveprotocol.box.server.common.CoreWaveletOperationSerializer;
-import 
org.waveprotocol.box.server.persistence.protos.ProtoDeltaStoreData.ProtoTransformedWaveletDelta;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.wave.model.operation.wave.WaveletOperation;
-import org.waveprotocol.wave.model.operation.wave.WaveletOperationContext;
-import org.waveprotocol.wave.model.version.HashedVersion;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-/**
- * This class is used to serialize and deserialize {@link 
TransformedWavelwetDelta}
- * and {@link ProtoTransformedWavelwetDelta}
- *
- * @author [email protected] (Tad Glines)
- */
-public class ProtoDeltaStoreDataSerializer {
-
-  /**
-   * Serialize a {@link TransformedWaveletDelta} into a {@link 
ProtoTransformedWaveletDelta}
-   */
-  public static ProtoTransformedWaveletDelta serialize(TransformedWaveletDelta 
delta) {
-    ProtoTransformedWaveletDelta.Builder builder = 
ProtoTransformedWaveletDelta.newBuilder();
-    builder.setAuthor(delta.getAuthor().getAddress());
-    builder.setResultingVersion(
-        CoreWaveletOperationSerializer.serialize(delta.getResultingVersion()));
-    builder.setApplicationTimestamp(delta.getApplicationTimestamp());
-    for (WaveletOperation op : delta) {
-      builder.addOperation(CoreWaveletOperationSerializer.serialize(op));
-    }
-    return builder.build();
-  }
-
-  /**
-   * Deserialize a {@link ProtoTransformedWaveletDelta} into a {@link 
TransformedWaveletDelta}
-   */
-  public static TransformedWaveletDelta 
deserialize(ProtoTransformedWaveletDelta delta) {
-    long applicationTimestamp = delta.getApplicationTimestamp();
-    HashedVersion resultingVersion =
-        
CoreWaveletOperationSerializer.deserialize(delta.getResultingVersion());
-    ParticipantId author = ParticipantId.ofUnsafe(delta.getAuthor());
-    ImmutableList.Builder<WaveletOperation> operations = 
ImmutableList.builder();
-    int numOperations = delta.getOperationCount();
-    for (int i = 0; i < numOperations; i++) {
-      WaveletOperationContext context;
-      if (i == numOperations - 1) {
-        context = new WaveletOperationContext(author, applicationTimestamp, 1, 
resultingVersion);
-      } else {
-        context = new WaveletOperationContext(author, applicationTimestamp, 1);
-      }
-      
operations.add(CoreWaveletOperationSerializer.deserialize(delta.getOperation(i),
 context));
-    }
-    return new TransformedWaveletDelta(author, resultingVersion, 
applicationTimestamp, operations.build());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/protos/account-store.proto
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/protos/account-store.proto 
b/src/org/waveprotocol/box/server/persistence/protos/account-store.proto
deleted file mode 100644
index 0837ddd..0000000
--- a/src/org/waveprotocol/box/server/persistence/protos/account-store.proto
+++ /dev/null
@@ -1,78 +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.
-//
-// Account Data data structures. These are used as the on-disk representation 
of the internal
-// AccountData classes.
-//
-// Author: [email protected] (Tad Glines)
-
-syntax = "proto2";
-
-package protoaccountstore;
-
-option java_package = "org.waveprotocol.box.server.persistence.protos";
-option java_outer_classname = "ProtoAccountStoreData";
-
-// Represents an AccountData instance
-message ProtoAccountData {
-       enum AccountDataType {
-               HUMAN_ACCOUNT = 1;
-               ROBOT_ACCOUNT = 2;
-       }
-
-       required AccountDataType account_type = 1;
-       
-       // The participant id
-       required string account_id = 2;
-
-       // One must be provided depending on the value of account_type. 
-       optional ProtoHumanAccountData human_account_data = 3;
-       optional ProtoRobotAccountData robot_account_data = 4;
-}
-
-// Data specific to a human account
-message ProtoHumanAccountData {
-       optional ProtoPasswordDigest password_digest = 1;
-}
-
-// The values from a PAsswordDigest instance
-message ProtoPasswordDigest {
-       required bytes salt = 1;
-       required bytes digest = 2;
-}
-
-// Data specific to a robot account
-message ProtoRobotAccountData {
-       required string url = 1;
-       required string consumer_secret = 2;
-       optional ProtoRobotCapabilities robot_capabilities = 3;
-       required bool is_verified = 4;
-}
-
-// Data found in a RobotCapabilities instance
-message ProtoRobotCapabilities {
-       required string capabilities_hash = 1;
-       required string protocol_version = 2;
-       repeated ProtoRobotCapability capability = 3;
-}
-
-// Data found in a com.google.api.robot.Capability instance
-message ProtoRobotCapability {
-       required string event_type = 1;
-       repeated string context = 2;
-       required string filter = 3;
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/persistence/protos/delta-store.proto
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/persistence/protos/delta-store.proto 
b/src/org/waveprotocol/box/server/persistence/protos/delta-store.proto
deleted file mode 100644
index a160b9b..0000000
--- a/src/org/waveprotocol/box/server/persistence/protos/delta-store.proto
+++ /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.
-//
-// Account Data data structures. These are used as the on-disk representation 
of the internal
-// AccountData classes.
-//
-// Author: [email protected] (Tad Glines)
-
-syntax = "proto2";
-
-import "org/waveprotocol/wave/federation/federation.protodevel";
-
-package protodeltastore;
-
-option java_package = "org.waveprotocol.box.server.persistence.protos";
-option java_outer_classname = "ProtoDeltaStoreData";
-
-message ProtoTransformedWaveletDelta {
-  required string author = 1;
-  required federation.ProtocolHashedVersion resulting_version = 2;
-  required int64 application_timestamp = 3;
-  repeated federation.ProtocolWaveletOperation operation = 4;
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/robots/AbstractOperationServiceRegistry.java
----------------------------------------------------------------------
diff --git 
a/src/org/waveprotocol/box/server/robots/AbstractOperationServiceRegistry.java 
b/src/org/waveprotocol/box/server/robots/AbstractOperationServiceRegistry.java
deleted file mode 100644
index 11e2e7f..0000000
--- 
a/src/org/waveprotocol/box/server/robots/AbstractOperationServiceRegistry.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.robots;
-
-import com.google.common.collect.Maps;
-import com.google.wave.api.InvalidRequestException;
-import com.google.wave.api.OperationType;
-
-import org.waveprotocol.box.server.robots.operations.OperationService;
-import org.waveprotocol.wave.util.logging.Log;
-
-import java.util.Map;
-
-/**
- * Abstract class for registering and accessing {@link OperationService} to
- * execute operations for use in the Robot APIs. Note that this class is not
- * thread safe.
- *
- * Implementations of this class are expected to define the way and moment when
- * operations are registered.
- *
- * @author [email protected] (Lennard de Rijk)
- */
-public abstract class AbstractOperationServiceRegistry implements 
OperationServiceRegistry {
-
-  private static Log LOG = Log.get(AbstractOperationServiceRegistry.class);
-
-  private Map<OperationType, OperationService> operationMap = 
Maps.newHashMap();
-
-  public AbstractOperationServiceRegistry() {
-  }
-
-  @Override
-  public final OperationService getServiceFor(OperationType opType) throws 
InvalidRequestException {
-    OperationService service = operationMap.get(opType);
-    if (service == null) {
-      throw new InvalidRequestException("No OperationService found for " + 
opType);
-    }
-    return service;
-  }
-
-  /**
-   * Registers the {@link OperationService} for the given {@link 
OperationType}.
-   *
-   * @param operation the type of the operation to register for
-   * @param service the {@link OperationService} to be registered
-   */
-  protected final void register(OperationType operation, OperationService 
service) {
-    // Do a put first so we can make it use a concurrent map if needed.
-    OperationService oldValue = operationMap.put(operation, service);
-    if (oldValue != null) {
-      LOG.warning("The OperationService for " + operation.name() + " was 
overwritten");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/org/waveprotocol/box/server/robots/OperationContext.java
----------------------------------------------------------------------
diff --git a/src/org/waveprotocol/box/server/robots/OperationContext.java 
b/src/org/waveprotocol/box/server/robots/OperationContext.java
deleted file mode 100644
index 155f0e4..0000000
--- a/src/org/waveprotocol/box/server/robots/OperationContext.java
+++ /dev/null
@@ -1,224 +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.robots;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.wave.api.InvalidRequestException;
-import com.google.wave.api.JsonRpcConstant.ParamsProperty;
-import com.google.wave.api.OperationRequest;
-import com.google.wave.api.data.converter.EventDataConverter;
-import com.google.wave.api.event.Event;
-
-import org.waveprotocol.box.server.robots.util.ConversationUtil;
-import org.waveprotocol.wave.model.conversation.Conversation;
-import org.waveprotocol.wave.model.conversation.ConversationBlip;
-import org.waveprotocol.wave.model.conversation.ObservableConversationView;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.id.WaveletId;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet;
-import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta;
-import org.waveprotocol.box.server.frontend.CommittedWaveletSnapshot;
-import org.waveprotocol.wave.model.id.WaveletName;
-import org.waveprotocol.box.common.Receiver;
-import org.waveprotocol.wave.model.version.HashedVersion;
-
-import java.util.Map;
-
-/**
- * Context for performing robot operations.
- *
- * <p>
- * {@link OperationContext} throws {@link InvalidRequestException} because it 
is
- * expected to be used together with an {@link OperationRequest}.
- *
- * @author [email protected] (Lennard de Rijk)
- */
-public interface OperationContext {
-
-  /** Marks temporary wave and blip ID's since V2 */
-  final String TEMP_ID_MARKER = "TBD_";
-
-  /**
-   * @return true iff this context is bound to a wavelet.
-   */
-  boolean isBound();
-
-  /**
-   * @param operationId the id of the robot operation.
-   * @return True iff a response has been set for the given id.
-   */
-  boolean hasResponse(String operationId);
-
-  /**
-   * Constructs a response with the given data in its payload field.
-   *
-   * @param data the data to be put in the repsonse.
-   */
-  void constructResponse(OperationRequest operation, Map<ParamsProperty, 
Object> data);
-
-  /**
-   * Constructs and stores a response signifying an error to be put in the
-   * context.
-   *
-   * @param errorMessage the error message to be put in the response.
-   */
-  void constructErrorResponse(OperationRequest operation, String errorMessage);
-
-  /**
-   * Processes the event and sets the proper response.
-   *
-   * @param event the event to process.
-   * @throws InvalidRequestException If the event could not be properly
-   *         processed.
-   */
-  void processEvent(OperationRequest operation, Event event) throws 
InvalidRequestException;
-
-  /**
-   * Stores a reference from a temporary wavelet id to a real wavelet id. If 
the
-   * given id is not a temporary id no reference will be stored.
-   *
-   * @param waveId the wave id.
-   * @param waveletId the wavelet id.
-   * @param newWavelet the new wavelet to remember.
-   */
-  void putWavelet(WaveId waveId, WaveletId waveletId, RobotWaveletData 
newWavelet);
-
-  /**
-   * Opens a wavelet for the given wave id and wavelet id. Note: Usually if the
-   * wavelet for specified wavelet id doesn't exist - the method returns
-   * null. However, for user data wavelets the method will create a new empty 
one
-   * and return it.
-   *
-   * @param waveId the wave id of the wavelet to open.
-   * @param waveletId the wavelet id of the wavelet to open.
-   * @param participant the id of the participant that wants to open the
-   *        wavelet.
-   * @throws InvalidRequestException if the wavelet can not be opened.
-   */
-  OpBasedWavelet openWavelet(WaveId waveId, WaveletId waveletId, ParticipantId 
participant)
-      throws InvalidRequestException;
-
-  /**
-   * Opens the wavelet specified in the given operation. Note: Usually if the
-   * wavelet for specified wavelet id doesn't exist - the method returns
-   * null. However, for user data wavelets the method will create a new empty 
one
-   * and return it.
-   *
-   * @param operation the operation specifying which wavelet to open.
-   * @param participant the id of the participant that wants to open the
-   *        wavelet.
-   * @throws InvalidRequestException if the wavelet can not be opened or the
-   *         operation does not define the wave and wavelet id.
-   */
-  OpBasedWavelet openWavelet(OperationRequest operation, ParticipantId 
participant)
-      throws InvalidRequestException;
-
-  /**
-   * Gets the conversation for of wavelet for the given wave id and wavelet id.
-   * Tries to retrieve and open the wavelet if that has not already been done.
-   *
-   * @param waveId the wave id of the wavelet.
-   * @param waveletId the wavelet id of.
-   * @param participant the id of the participant that wants to operation on 
the
-   *        conversation.
-   * @throws InvalidRequestException if the wavelet can not be opened.
-   */
-  ObservableConversationView openConversation(
-      WaveId waveId, WaveletId waveletId, ParticipantId participant) throws 
InvalidRequestException;
-
-  /**
-   * Gets the conversation for of wavelet specified in the operation. Tries to
-   * retrieve and open the wavelet if that has not already been done.
-   *
-   * @param operation the operation specifying which wavelet to get the
-   *        conversation for.
-   * @param participant the id of the participant that wants to operation on 
the
-   *        conversation.
-   * @throws InvalidRequestException if the wavelet can not be opened or the
-   *         operation does not define the wave and wavelet id.
-   */
-  ObservableConversationView openConversation(OperationRequest operation, 
ParticipantId participant)
-      throws InvalidRequestException;
-
-  /**
-   * Stores a reference from a temporary blip id to a real blip id. If the 
given
-   * id is not a temporary id it will be ignored.
-   *
-   * @param blipId the temporary blip id.
-   * @param newBlip the blip that this id should reference.
-   */
-  void putBlip(String blipId, ConversationBlip newBlip);
-
-  /**
-   * Retrieve a blip with the given, possible temporary id, from the
-   * conversation.
-   *
-   * @param conversation the conversation the blip belongs to.
-   * @param blipId the id of the blip, may be be a temporary id.
-   * @throws InvalidRequestException if the blip could not be retrieved or has
-   *         been deleted.
-   */
-  ConversationBlip getBlip(Conversation conversation, String blipId) throws 
InvalidRequestException;
-
-  /**
-   * @return the converter to convert to API objects
-   */
-  EventDataConverter getConverter();
-
-  /**
-   * Returns {@link ConversationUtil} which is used to generate conversations
-   * and ids.
-   */
-  ConversationUtil getConversationUtil();
-
-  /**
-   * Gets the list of wavelet Ids that are visible to the user.
-   *
-   * @param operation the operation specifying wave.
-   * @param participant the user.
-   * @return set of wavelet Ids, visible to the user.
-   */
-  ImmutableSet<WaveletId> getVisibleWaveletIds(OperationRequest operation, 
ParticipantId participant)
-      throws InvalidRequestException;
-
-  /**
-   * Takes snapshot of a wavelet, checking access for the given participant.
-   *
-   * @param waveletName the wavelet name of the wavelet to get.
-   * @param participant the user.
-   * @return snapshot on success, null on failure
-   */
-  CommittedWaveletSnapshot getWaveletSnapshot(WaveletName waveletName, 
ParticipantId participant)
-      throws InvalidRequestException;
-
-  /**
-   * Takes deltas history of a wavelet, checking access for the given 
participant.
-   *
-   * @param waveletName the wavelet name of the wavelet to get.
-   * @param participant the user.
-   * @param fromVersion start version (inclusive), minimum 0.
-   * @param toVersion start version (exclusive).
-   * @param receiver the transformed deltas receiver.
-   */
-  void getDeltas(WaveletName waveletName, ParticipantId participant,
-      HashedVersion fromVersion, HashedVersion toVersion, 
Receiver<TransformedWaveletDelta> receiver)
-      throws InvalidRequestException;
-}

Reply via email to