| 1548 | 1 package goodjava.lucene.logging; | 
|  | 2 | 
|  | 3 import java.io.IOException; | 
|  | 4 import java.util.Map; | 
|  | 5 import org.apache.lucene.search.Query; | 
| 1549 | 6 import goodjava.lucene.api.GoodIndexWriter; | 
| 1548 | 7 | 
|  | 8 | 
| 1551 | 9 public class BasicOpDoer implements OpDoer { | 
| 1549 | 10 	protected final GoodIndexWriter writer; | 
| 1548 | 11 	protected boolean isActive = true; | 
|  | 12 | 
| 1551 | 13 	public BasicOpDoer(GoodIndexWriter writer) { | 
| 1548 | 14 		this.writer = writer; | 
|  | 15 	} | 
|  | 16 | 
|  | 17 	public void commit() throws IOException { | 
|  | 18 		if( !isActive ) | 
|  | 19 			return; | 
|  | 20 		writer.commit(); | 
|  | 21 	} | 
|  | 22 | 
| 1549 | 23 	public void deleteAll(long time) throws IOException { | 
| 1548 | 24 		if( !isActive ) | 
|  | 25 			return; | 
|  | 26 		writer.deleteAll(); | 
|  | 27 	} | 
|  | 28 | 
| 1549 | 29 	public void deleteDocuments(long time,Query query) throws IOException { | 
| 1548 | 30 		if( !isActive ) | 
|  | 31 			return; | 
|  | 32 		writer.deleteDocuments(query); | 
|  | 33 	} | 
|  | 34 | 
| 1549 | 35 	public void addDocument(long time,Map<String,Object> storedFields) throws IOException { | 
| 1548 | 36 		if( !isActive ) | 
|  | 37 			return; | 
|  | 38 		writer.addDocument(storedFields); | 
|  | 39 	} | 
|  | 40 | 
| 1549 | 41 	public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException { | 
| 1548 | 42 		if( !isActive ) | 
|  | 43 			return; | 
|  | 44 		writer.updateDocument(keyFieldName,storedFields); | 
|  | 45 	} | 
|  | 46 | 
| 1549 | 47 	public void tag(long time,String tag) throws IOException {} | 
| 1548 | 48 | 
|  | 49 } |