Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011-2013 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.springframework.data.mongodb.gridfs;
 
 import java.util.List;
 
 import  org.springframework.core.io.support.ResourcePatternResolver;
 
Collection of operations to store and read files from MongoDB GridFS.

Author(s):
Oliver Gierke
Philipp Schneider
Thomas Darimont
 
 public interface GridFsOperations extends ResourcePatternResolver {

Stores the given content into a file with the given name.

Parameters:
content must not be null.
filename must not be null or empty.
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filename);

Stores the given content into a file with the given name and content type.

Parameters:
content must not be null.
filename must not be null or empty.
contentType can be null.
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filenameString contentType);

Stores the given content into a file with the given name using the given metadata. The metadata object will be marshalled before writing.

Parameters:
content must not be null.
filename must not be null or empty.
metadata can be null.
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filenameObject metadata);

Stores the given content into a file with the given name and content type using the given metadata. The metadata object will be marshalled before writing.

Parameters:
content must not be null.
filename must not be null or empty.
contentType can be null.
metadata can be null
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filenameString contentTypeObject metadata);

Stores the given content into a file with the given name using the given metadata.

Parameters:
content must not be null.
filename must not be null or empty.
metadata can be null.
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filenameDBObject metadata);

Stores the given content into a file with the given name and content type using the given metadata.

Parameters:
content must not be null.
filename must not be null or empty.
contentType can be null.
metadata can be null.
Returns:
the GridFSFile just created
 
 	GridFSFile store(InputStream contentString filenameString contentTypeDBObject metadata);

Returns all files matching the given query. Note, that currently Sort criterias defined at the Query will not be regarded as MongoDB does not support ordering for GridFS file access.

Parameters:
query
Returns:
See also:
https://jira.mongodb.org/browse/JAVA-431
Returns a single file matching the given query or null in case no file matches.

Parameters:
query
Returns:
Deletes all files matching the given Query.

Parameters:
query
	void delete(Query query);

Returns all GridFsResource with the given file name.

Parameters:
filename
Returns:
the resource if it exists or null.
See also:
ResourcePatternResolver.getResource(String)
Returns all GridFsResources matching the given file name pattern.

Parameters:
filenamePattern
Returns:
See also:
ResourcePatternResolver.getResources(String)
	GridFsResource[] getResources(String filenamePattern);
New to GrepCode? Check out our FAQ X