[JAVA-26] support meta data in gridfs Created: 01/Sep/09  Updated: 02/Oct/09  Resolved: 01/Sep/09

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 0.8

Type: Improvement Priority: Major - P3
Reporter: Eliot Horowitz (Inactive) Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

there already is a _metadata variable, just not used



 Comments   
Comment by Jason Sachs [ 04/Sep/09 ]

The class's members were also changed from protected to private. Probably a good idea but there's no setters for _metadata available even to subclasses.

C:\bin\install\servers\mongodb>javap -private -classpath ./mongo-0.8.1.jar com.m
ongodb.util.gridfs.GridFSObject
Compiled from "GridFSObject.java"
public class com.mongodb.util.gridfs.GridFSObject extends java.lang.Object{
private com.mongodb.ObjectId _id;
private java.lang.String _filename;
private java.lang.String _contentType;
private long _length;
private int _chunkSize;
private java.util.Date _uploadDate;
private java.util.List _aliases;
private com.mongodb.DBObject _metadata;
private byte[] _myBuffer;
private java.io.InputStream _inStream;
private int _nextChunkID;
private com.mongodb.util.gridfs.GridFS _gridfs;
private com.mongodb.DBCursor _chunkCursor;
public com.mongodb.util.gridfs.GridFSObject(java.lang.String, java.io.InputS
tream);
public com.mongodb.util.gridfs.GridFSObject(com.mongodb.util.gridfs.GridFS,
com.mongodb.DBObject);
public com.mongodb.util.gridfs.GridFSObject(com.mongodb.util.gridfs.GridFS,
com.mongodb.DBObject, com.mongodb.DBObject);
public java.io.InputStream getInputStream();
protected com.mongodb.util.gridfs.GridFSChunk getNextChunkFromDB();
protected com.mongodb.util.gridfs.GridFSChunk getNextChunkFromStream()
throws java.io.IOException;
public java.lang.String getFilename();
public void setFilename(java.lang.String);
public java.lang.String getContentType();
public void setContentType(java.lang.String);
protected void setLength(long);
public com.mongodb.ObjectId getID();
public com.mongodb.DBObject getMetadata();
public com.mongodb.DBObject getDBObject();
}

Comment by Jason Sachs [ 04/Sep/09 ]

please reopen.... looks like it is possible to read metadata but not write metadata. There are still some things missing:

1) GridFSObject has a constructor (GridFS, DBObject, DBObject metadata) as an alternative to constructtor (GridFS, DBObject), but not a constructor (String, InputStream, DBObject metadata) as an alternative to constructor (String, InputStream). By the way, what is the proper use for the different constructors? The String/InputStream one makes sense (then you call GridFS.write(gridFSObject) on the GridFSObject you created, but I can't make heads or tails of the (GridFS, DBObject) constructor. Does it automatically write to the GridFS in question? What data gets stored?
2) GridFSObject.getMetadata() exists, but not GridFSObject.setMetadata()

Generated at Thu Feb 08 08:51:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.