Formats/cleans up the mongo related files

Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/0a315ef8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/0a315ef8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/0a315ef8

Branch: refs/heads/master
Commit: 0a315ef893d87e2fb9f79b0448680249f504d123
Parents: 98a4e1e
Author: Yuri Zelikov <[email protected]>
Authored: Fri Jan 17 21:59:40 2014 +0200
Committer: Yuri Zelikov <[email protected]>
Committed: Fri Jan 17 22:40:17 2014 +0200

----------------------------------------------------------------------
 .../mongodb/MongoDbDeltaCollection.java         |  20 --
 .../mongodb/MongoDbDeltaStoreUtil.java          | 277 ++++++++-----------
 .../persistence/mongodb/MongoDbStore.java       |   6 +-
 3 files changed, 118 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/0a315ef8/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
index d61bea2..536f842 100644
--- 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
+++ 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaCollection.java
@@ -39,7 +39,6 @@ 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)
  * 
  */
@@ -51,7 +50,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
   /** MongoDB Collection object for delta storage */
   private final DBCollection deltaDbCollection;
 
-
   /**
    * Construct a new Delta Access object for the wavelet
    * 
@@ -65,7 +63,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
 
   @Override
   public WaveletName getWaveletName() {
-
     return waveletName;
   }
 
@@ -80,7 +77,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     query.put(MongoDbDeltaStoreUtil.FIELD_WAVE_ID, 
waveletName.waveId.serialise());
     query.put(MongoDbDeltaStoreUtil.FIELD_WAVELET_ID, 
waveletName.waveletId.serialise());
 
-
     return query;
   }
 
@@ -88,10 +84,8 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
   public boolean isEmpty() {
 
     return deltaDbCollection.count(createWaveletDBQuery()) == 0;
-
   }
 
-
   @Override
   public HashedVersion getEndVersion() {
 
@@ -102,7 +96,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     DBObject sort = new BasicDBObject();
     sort.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION_VERSION, 
-1); // Descending
 
-
     DBObject field = new BasicDBObject();
     field.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION, 1);
 
@@ -117,7 +110,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
   @Override
   public WaveletDeltaRecord getDelta(long version) throws IOException {
 
-
     DBObject query = createWaveletDBQuery();
     query.put(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_APPLIEDATVERSION, 
version);
 
@@ -130,13 +122,11 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     } 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);
 
@@ -145,13 +135,11 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     WaveletDeltaRecord waveletDelta = null;
 
     if (result != null)
-
     try {
       MongoDbDeltaStoreUtil.deserializeWaveletDeltaRecord(result);
     } catch (PersistenceException e) {
       throw new IOException(e);
     }
-
     return waveletDelta;
   }
 
@@ -166,15 +154,11 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     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);
 
@@ -183,7 +167,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
     if (result != null)
       return MongoDbDeltaStoreUtil.deserializeHashedVersion((DBObject) result
           .get(MongoDbDeltaStoreUtil.FIELD_TRANSFORMED_RESULTINGVERSION));
-
     return null;
   }
 
@@ -193,7 +176,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
 
     WaveletDeltaRecord delta = getDelta(version);
     return (delta != null) ? delta.getAppliedDelta() : null;
-
   }
 
   @Override
@@ -201,7 +183,6 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
 
     WaveletDeltaRecord delta = getDelta(version);
     return (delta != null) ? delta.getTransformedDelta() : null;
-
   }
 
   @Override
@@ -218,5 +199,4 @@ public class MongoDbDeltaCollection implements 
DeltaStore.DeltasAccess {
           waveletName.waveId.serialise(), waveletName.waveletId.serialise()));
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/0a315ef8/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
index d603d14..e93bfed 100644
--- 
a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
+++ 
b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbDeltaStoreUtil.java
@@ -29,6 +29,7 @@ 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;
@@ -46,16 +47,14 @@ 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)
+ * 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";
@@ -72,7 +71,8 @@ public class MongoDbDeltaStoreUtil {
   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_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";
@@ -80,173 +80,141 @@ public class MongoDbDeltaStoreUtil {
   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 final String FIELD_WAVE_ID = "waveid";
 
   public static DBObject serialize(WaveletDeltaRecord waveletDelta, String 
waveId, String waveletId) {
-    
-    BasicDBObject _waveletDelta = new BasicDBObject();
- 
-    // 
-    _waveletDelta.append(FIELD_WAVE_ID, waveId);
-    _waveletDelta.append(FIELD_WAVELET_ID, waveletId);
-    
-    _waveletDelta.append(FIELD_APPLIEDATVERSION, 
serialize(waveletDelta.getAppliedAtVersion()));
-    _waveletDelta.append(FIELD_APPLIED, 
waveletDelta.getAppliedDelta().getByteArray());
-    _waveletDelta.append(FIELD_TRANSFORMED, 
serialize(waveletDelta.getTransformedDelta()));
-    
-    return _waveletDelta;
+
+    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 _hashedVersion = new BasicDBObject();
-    _hashedVersion.append(FIELD_VERSION, hashedVersion.getVersion());
-    _hashedVersion.append(FIELD_HISTORYHASH, hashedVersion.getHistoryHash());
-    
-    return _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 _participantId = new BasicDBObject();
-    _participantId.append(FIELD_ADDRESS, participantId.getAddress());
-    
-    return _participantId;
-    
+    BasicDBObject mongoParticipantId = new BasicDBObject();
+    mongoParticipantId.append(FIELD_ADDRESS, participantId.getAddress());
+    return mongoParticipantId;
   }
-  
+
   public static DBObject serialize(TransformedWaveletDelta 
transformedWaveletDelta) {
-    
-    BasicDBObject _transformedWaveletDelta = new BasicDBObject();
-    _transformedWaveletDelta.append(FIELD_AUTHOR, 
serialize(transformedWaveletDelta.getAuthor()));
-    _transformedWaveletDelta.append(FIELD_RESULTINGVERSION, 
serialize(transformedWaveletDelta.getResultingVersion()));
-    _transformedWaveletDelta.append(FIELD_APPLICATIONTIMESTAMP, 
transformedWaveletDelta.getApplicationTimestamp());
-    
-    // Calculated value to provide DB implementation of 
MongoDBDeltaCollection.getDelta(long version)
-    _transformedWaveletDelta.append(FIELD_APPLIEDATVERSION, 
transformedWaveletDelta.getAppliedAtVersion());
-       
-    BasicDBList _waveletOperations = new BasicDBList();
-    
-    for (WaveletOperation op: transformedWaveletDelta) {
-      _waveletOperations.add(serialize(op));
+    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));
     }
-    
-    _transformedWaveletDelta.append(FIELD_OPS, _waveletOperations);
-     
-    return _transformedWaveletDelta;
 
+    mongoTransformedWaveletDelta.append(FIELD_OPS, mongoWaveletOperations);
+
+    return mongoTransformedWaveletDelta;
   }
-  
-  
+
   public static DBObject serialize(WaveletOperation waveletOp) {
-    
-    final BasicDBObject _op = new BasicDBObject();
-      
-      
+    final BasicDBObject mongoOp = new BasicDBObject();
+
     if (waveletOp instanceof NoOp) {
-      _op.append(FIELD_TYPE, WAVELET_OP_NOOP);
-   
+      mongoOp.append(FIELD_TYPE, WAVELET_OP_NOOP);
+
     } else if (waveletOp instanceof AddParticipant) {
-      _op.append(FIELD_TYPE, WAVELET_OP_ADD_PARTICIPANT);
-      _op.append(FIELD_PARTICIPANT, serialize(((AddParticipant) 
waveletOp).getParticipantId()));
-      
+      mongoOp.append(FIELD_TYPE, WAVELET_OP_ADD_PARTICIPANT);
+      mongoOp.append(FIELD_PARTICIPANT, serialize(((AddParticipant) 
waveletOp).getParticipantId()));
+
     } else if (waveletOp instanceof RemoveParticipant) {
-      
-      _op.append(FIELD_TYPE, WAVELET_OP_REMOVE_PARTICIPANT);
-      _op.append(FIELD_PARTICIPANT, serialize(((RemoveParticipant) 
waveletOp).getParticipantId()));
-      
+      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;
-   
-      _op.append(FIELD_TYPE, WAVELET_OP_WAVELET_BLIP_OPERATION);
-      _op.append(FIELD_BLIPID, waveletBlipOp.getBlipId());
+
+      mongoOp.append(FIELD_TYPE, WAVELET_OP_WAVELET_BLIP_OPERATION);
+      mongoOp.append(FIELD_BLIPID, waveletBlipOp.getBlipId());
 
       if (waveletBlipOp.getBlipOp() instanceof BlipContentOperation) {
-        
-        _op.append(FIELD_BLIPOP, serialize((BlipContentOperation) 
waveletBlipOp.getBlipOp()));
-        
+        mongoOp.append(FIELD_BLIPOP, serialize((BlipContentOperation) 
waveletBlipOp.getBlipOp()));
       } else {
-               
-        throw new IllegalArgumentException("Unsupported blip operation: " + 
waveletBlipOp.getBlipOp());
-      } 
-      
+        throw new IllegalArgumentException("Unsupported blip operation: "
+            + waveletBlipOp.getBlipOp());
+      }
     } else {
-      
       throw new IllegalArgumentException("Unsupported wavelet operation: " + 
waveletOp);
     }
-    
-    return _op;
+    return mongoOp;
   }
-  
-  
-  
+
   public static DBObject serialize(BlipContentOperation blipContentOp) {
-    
-    BasicDBObject _blipContentOp = new BasicDBObject();
-    _blipContentOp.append(FIELD_CONTENTOP, 
serialize(blipContentOp.getContentOp()));
-    return _blipContentOp;
+    BasicDBObject mongoBlipContentOp = new BasicDBObject();
+    mongoBlipContentOp.append(FIELD_CONTENTOP, 
serialize(blipContentOp.getContentOp()));
+    return mongoBlipContentOp;
   }
-  
-  
+
   public static DBObject serialize(DocOp docOp) {
-    
-    // This method relays on the provided CoreWaveletOperationSerializer, 
-    // because of complexity of serializing DocOp's
-    BasicDBObject _docOp = new BasicDBObject();
-    _docOp.append(FIELD_BYTES, 
CoreWaveletOperationSerializer.serialize(docOp).toByteArray());
-    return _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))),
+
+  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);
-  }   
 
+    } 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));
+    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 {
-    
+
+  public static TransformedWaveletDelta 
deserializeTransformedWaveletDelta(DBObject dbObject)
+      throws PersistenceException {
+
     ParticipantId author = deserializeParicipantId((DBObject) 
dbObject.get(FIELD_AUTHOR));
-    HashedVersion resultingVersion = deserializeHashedVersion((DBObject) 
dbObject.get(FIELD_RESULTINGVERSION)); 
+    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);
@@ -256,54 +224,41 @@ public class MongoDbDeltaStoreUtil {
       operations.add(deserializeWaveletOperation((DBObject) dbOps.get(i), 
context));
     }
 
-    
-    return new TransformedWaveletDelta(author, resultingVersion, 
applicationTimestamp, operations.build());
-    
+    return new TransformedWaveletDelta(author, resultingVersion, 
applicationTimestamp,
+        operations.build());
   }
-  
-  public static WaveletOperation deserializeWaveletOperation(DBObject 
dbObject, WaveletOperationContext context) throws PersistenceException {
-    
-    
+
+  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)));
+      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)));
+      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));
-          
-         
+      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)));
+    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))));
-    
+      return 
CoreWaveletOperationSerializer.deserialize(ProtocolDocumentOperation
+          .parseFrom(((byte[]) dbObject.get(FIELD_BYTES))));
     } catch (InvalidProtocolBufferException e) {
-       throw new PersistenceException(e);
+      throw new PersistenceException(e);
     }
-   
   }
-
-  
 }

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/0a315ef8/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
index c6228b3..ea85233 100644
--- a/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java
+++ b/src/org/waveprotocol/box/server/persistence/mongodb/MongoDbStore.java
@@ -35,6 +35,7 @@ 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.server.account.AccountData;
 import org.waveprotocol.box.server.account.HumanAccountData;
 import org.waveprotocol.box.server.account.HumanAccountDataImpl;
@@ -50,16 +51,13 @@ 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.id.WaveletName;
 import org.waveprotocol.wave.model.util.CollectionUtils;
 import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.media.model.AttachmentId;
-import org.waveprotocol.box.attachment.AttachmentMetadata;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;

Reply via email to