01: /*
02: * snapper
03: *
04: * Enhydra super-servlet business object
05: *
06: */
07:
08: package org.enhydra.snapperAdmin.business;
09:
10: import org.enhydra.snapper.SnapperManager;
11: import org.enhydra.snapperAdmin.SnapperAdmin;
12: import org.enhydra.snapperAdmin.spec.Index;
13: import org.enhydra.snapperAdmin.spec.IndexAll;
14: import org.enhydra.snapperAdmin.spec.IndexFactory;
15:
16: import com.lutris.logging.Logger;
17:
18: // Enhydra SuperServlet specification imports
19:
20: /**
21: * @author Igor Smirnov
22: * IndexAllImpl class starts indexing threads for all sites by
23: * starting indexing threads one-by-one.
24: * Start-waitToFinish-StartNext
25: */
26:
27: public class IndexAllImpl implements IndexAll, Runnable {
28:
29: private String[] ids;
30:
31: public void run() {
32: for (int numSites = 0; numSites < ids.length; numSites++) {
33: try {
34: Index index = IndexFactory
35: .getIndex("org.enhydra.snapperAdmin.business.IndexImpl");
36: String id = ids[numSites];
37: index.index(id);
38: SnapperManager.getInstance().addThread(id, index);
39:
40: new Thread((Runnable) index, id).run();
41:
42: } catch (Exception e) {
43: SnapperAdmin.logError("Could not index site");
44: }
45: }
46:
47: }
48:
49: public void stop() {
50: };
51:
52: public IndexAllImpl() {
53: }
54:
55: public void index(String[] ids) {
56: this.ids = ids;
57: }
58:
59: }
|