You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/28 12:54:51 UTC
[2/2] camel git commit: Add the _id of the file just persisted to the
context
Add the _id of the file just persisted to the context
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f683d96d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f683d96d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f683d96d
Branch: refs/heads/camel-2.17.x
Commit: f683d96d69751a6da8a86edf858fa29bceab3f70
Parents: 31e45f4
Author: Joseluis Pedrosa <jo...@elephanttalk.com>
Authored: Thu Apr 28 12:41:45 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 28 12:54:27 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/gridfs/GridFsEndpoint.java | 1 +
.../java/org/apache/camel/component/gridfs/GridFsProducer.java | 2 ++
2 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f683d96d/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsEndpoint.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsEndpoint.java
index 4856a7f..cfd8831 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsEndpoint.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsEndpoint.java
@@ -47,6 +47,7 @@ public class GridFsEndpoint extends DefaultEndpoint {
public static final String GRIDFS_OPERATION = "gridfs.operation";
public static final String GRIDFS_METADATA = "gridfs.metadata";
public static final String GRIDFS_CHUNKSIZE = "gridfs.chunksize";
+ public static final String GRIDFS_FILE_ID_PRODUCED = "gridfs.fileid";
private static final Logger LOG = LoggerFactory.getLogger(GridFsEndpoint.class);
http://git-wip-us.apache.org/repos/asf/camel/blob/f683d96d/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsProducer.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsProducer.java
index dccb499..397cc03 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsProducer.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/gridfs/GridFsProducer.java
@@ -61,7 +61,9 @@ public class GridFsProducer extends DefaultProducer {
DBObject dbObject = (DBObject) JSON.parse(metaData);
gfsFile.setMetaData(dbObject);
gfsFile.save();
+ //add headers with the id and file name produced by the driver.
exchange.getIn().setHeader(Exchange.FILE_NAME_PRODUCED, gfsFile.getFilename());
+ exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_FILE_ID_PRODUCED, gfsFile.getId());
} else if ("remove".equals(operation)) {
final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
endpoint.getGridFs().remove(filename);