01: package org.space4j.indexing;
02:
03: import java.util.*;
04: import org.space4j.*;
05: import org.space4j.indexing.*;
06:
07: class CreateIndexCmd extends Command {
08:
09: private Index indx;
10: private String sourcemap;
11: private Map map;
12:
13: public CreateIndexCmd(Index indx, String sourcemap, Map map) {
14: this .indx = indx;
15: this .sourcemap = sourcemap;
16: this .map = map;
17: }
18:
19: public int execute(Space space) throws CommandException {
20: IndexManager im = space.getIndexManager();
21: if (im == null)
22: return 0;
23:
24: Map list = (Map) space.getObject(sourcemap);
25: Collection coll = null;
26: if (list != null)
27: coll = list.values();
28: boolean ok = im.createIndexImpl(indx, coll, map);
29: if (ok)
30: return 1;
31: return 0;
32: }
33: }
|