in src/main/java/org/apache/servicemix/store/mongo/MongoStore.java [98:123]
public void store(String id, Object data) throws IOException {
DBObject object = new BasicDBObject();
ObjectOutputStream out=null;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
out = new ObjectOutputStream(buffer);
out.writeObject(data);
object.put(ID, id);
object.put(DATA, buffer.toByteArray());
object.put(TIMESTAMP, System.currentTimeMillis());
} catch (Exception e) {
throw (IOException) new IOException("Error storing object").initCause(e);
} finally {
if(out != null) {
out.close();
}
}
WriteResult result = collection.insert(object);
// check result for errors
if (result.getError() != null) {
throw new IOException(result.getError());
}
fireAddedEvent(id,data);
}