Project

General

Profile

« Previous | Next » 

Revision 41466

implemented Drop content action

View differences:

FileSystemObjectStoreDao.java
8 8
import java.nio.file.Files;
9 9
import java.nio.file.Path;
10 10
import java.util.List;
11

  
12 11
import javax.annotation.Resource;
13 12

  
14
import org.apache.commons.lang.StringUtils;
15
import org.apache.commons.logging.Log;
16
import org.apache.commons.logging.LogFactory;
17
import org.springframework.beans.factory.annotation.Autowired;
18

  
19
import com.mongodb.BasicDBObject;
20
import com.mongodb.DB;
21
import com.mongodb.DBCollection;
22
import com.mongodb.DBObject;
23
import com.mongodb.QueryBuilder;
24

  
13
import com.mongodb.*;
25 14
import eu.dnetlib.data.objectstore.modular.connector.ObjectStore;
26 15
import eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao;
27 16
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFileNotFoundException;
28 17
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
29 18
import eu.dnetlib.miscutils.collections.MappedCollection;
30 19
import eu.dnetlib.miscutils.functional.UnaryFunction;
20
import org.apache.commons.lang.StringUtils;
21
import org.apache.commons.logging.Log;
22
import org.apache.commons.logging.LogFactory;
23
import org.springframework.beans.factory.annotation.Autowired;
31 24

  
32 25
/**
33 26
 * @author sandro
......
105 98
	 * {@inheritDoc}
106 99
	 *
107 100
	 * @throws ObjectStoreServiceException
108
	 * @see eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao#createObjectStore(java.lang.String, java.lang.String)
109 101
	 */
110 102
	@Override
111 103
	public boolean createObjectStore(final String obsId, final String interpretation, final String basePath) throws ObjectStoreServiceException {
......
173 165
		if (Files.exists(basePathFS)) {
174 166

  
175 167
		} else throw new ObjectStoreServiceException("Can't Delete Objectstore the path of the objectStore doesn't exists :" + basePathFS);
176

  
177 168
		try {
178 169
			fsUtility.deleteFolderRecursive(basePathFS);
179 170
		} catch (IOException e) {
180 171
			throw new ObjectStoreServiceException("Can't Delete Objectstore ", e);
181 172
		}
182 173
		coll.remove(new BasicDBObject(OBJECTSTORE_ID_FIELD, obsId));
183

  
184

  
185 174
		getDb().getCollection(obsId).drop();
186 175
		return true;
187 176
	}
188 177

  
178
	@Override
179
	public boolean dropContent(final String obsId) throws ObjectStoreServiceException {
180
		return getObjectStore(obsId).dropContent();
181
	}
189 182

  
190 183
	public boolean isUpsert() {
191 184
		return upsert;

Also available in: Unified diff