// Path: src/main/java/de/fhg/igd/mongomvcc/VCounter.java
// public interface VCounter {
// 	/**
// 	 * A thread safe method to get the next unique id
// 	 * @return a unique id
// 	 */
// 	public long getNextId();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/VCursor.java
// public interface VCursor extends Iterable<Map<String, Object>> {
// 	/**
// 	 * @return the number of database objects this cursor points to
// 	 */
// 	int size();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/VLargeCollection.java
// public interface VLargeCollection extends VCollection {
// 	//nothing to add yet
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/Filter.java
// public interface Filter<T> {
// 	/**
// 	 * Checks if the given element passes the filter
// 	 * @param t the element
// 	 * @return true if the element passes the filter, false otherwise
// 	 */
// 	boolean filter(T t);
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/TransformingIterator.java
// public abstract class TransformingIterator<I, O> implements Iterator<O> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<I> _delegate;
// 	
// 	/**
// 	 * Constructs a new transforming iterator
// 	 * @param delegate the iterator to wrap
// 	 */
// 	public TransformingIterator(Iterator<I> delegate) {
// 		_delegate = delegate;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		return _delegate.hasNext();
// 	}
// 
// 	@Override
// 	public O next() {
// 		return transform(_delegate.next());
// 	}
// 	
// 	/**
// 	 * Transforms an element
// 	 * @param input the element
// 	 * @return the transformed element
// 	 */
// 	abstract protected O transform(I input);
// 
// 	@Override
// 	public void remove() {
// 		_delegate.remove();
// 	}
// }


import de.fhg.igd.mongomvcc.helper.Filter;
import de.fhg.igd.mongomvcc.helper.TransformingIterator;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Map;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.gridfs.GridFS;
import com.mongodb.gridfs.GridFSInputFile;
import de.fhg.igd.mongomvcc.VCounter;
import de.fhg.igd.mongomvcc.VCursor;
import de.fhg.igd.mongomvcc.VLargeCollection;
// This file is part of MongoMVCC.
//
// Copyright (c) 2012 Fraunhofer IGD
//
// MongoMVCC is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// MongoMVCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with MongoMVCC. If not, see <http://www.gnu.org/licenses/>.

package de.fhg.igd.mongomvcc.impl;




/**
 * Saves primitive byte arrays and {@link InputStream}s in MongoDB's
 * {@link GridFS}.
 * @author Michel Kraemer
 */
public class MongoDBVLargeCollection extends MongoDBVCollection implements
		VLargeCollection {
	/**
	 * A cursor which calls {@link AccessStrategy#onResolve(Map)} for
	 * each object
	 */
	private class MongoDBVLargeCursor extends MongoDBVCursor {
		/**
		 * @see MongoDBVCursor#MongoDBVCursor(DBCursor, Filter)
		 */
// Path: src/main/java/de/fhg/igd/mongomvcc/VCounter.java
// public interface VCounter {
// 	/**
// 	 * A thread safe method to get the next unique id
// 	 * @return a unique id
// 	 */
// 	public long getNextId();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/VCursor.java
// public interface VCursor extends Iterable<Map<String, Object>> {
// 	/**
// 	 * @return the number of database objects this cursor points to
// 	 */
// 	int size();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/VLargeCollection.java
// public interface VLargeCollection extends VCollection {
// 	//nothing to add yet
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/Filter.java
// public interface Filter<T> {
// 	/**
// 	 * Checks if the given element passes the filter
// 	 * @param t the element
// 	 * @return true if the element passes the filter, false otherwise
// 	 */
// 	boolean filter(T t);
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/TransformingIterator.java
// public abstract class TransformingIterator<I, O> implements Iterator<O> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<I> _delegate;
// 	
// 	/**
// 	 * Constructs a new transforming iterator
// 	 * @param delegate the iterator to wrap
// 	 */
// 	public TransformingIterator(Iterator<I> delegate) {
// 		_delegate = delegate;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		return _delegate.hasNext();
// 	}
// 
// 	@Override
// 	public O next() {
// 		return transform(_delegate.next());
// 	}
// 	
// 	/**
// 	 * Transforms an element
// 	 * @param input the element
// 	 * @return the transformed element
// 	 */
// 	abstract protected O transform(I input);
// 
// 	@Override
// 	public void remove() {
// 		_delegate.remove();
// 	}
// }


// Path: src/main/java/de/fhg/igd/mongomvcc/impl/MongoDBVLargeCollection.java
import de.fhg.igd.mongomvcc.helper.Filter;
import de.fhg.igd.mongomvcc.helper.TransformingIterator;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Map;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.gridfs.GridFS;
import com.mongodb.gridfs.GridFSInputFile;
import de.fhg.igd.mongomvcc.VCounter;
import de.fhg.igd.mongomvcc.VCursor;
import de.fhg.igd.mongomvcc.VLargeCollection;

// This file is part of MongoMVCC.
//
// Copyright (c) 2012 Fraunhofer IGD
//
// MongoMVCC is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// MongoMVCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with MongoMVCC. If not, see <http://www.gnu.org/licenses/>.

package de.fhg.igd.mongomvcc.impl;




/**
 * Saves primitive byte arrays and {@link InputStream}s in MongoDB's
 * {@link GridFS}.
 * @author Michel Kraemer
 */
public class MongoDBVLargeCollection extends MongoDBVCollection implements
		VLargeCollection {
	/**
	 * A cursor which calls {@link AccessStrategy#onResolve(Map)} for
	 * each object
	 */
	private class MongoDBVLargeCursor extends MongoDBVCursor {
		/**
		 * @see MongoDBVCursor#MongoDBVCursor(DBCursor, Filter)
		 */
		public MongoDBVLargeCursor(DBCursor delegate, Filter<DBObject> filter) {