1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| package org.apache.xindice.tools.command; |
21 |
| |
22 |
| import org.apache.xindice.client.xmldb.services.CollectionManager; |
23 |
| import org.apache.xindice.tools.XMLTools; |
24 |
| |
25 |
| import org.xmldb.api.DatabaseManager; |
26 |
| import org.xmldb.api.base.Collection; |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| public class ListIndexers extends Command { |
35 |
| |
36 |
0
| public boolean execute(XMLTools.Config table) throws Exception {
|
37 |
| |
38 |
0
| if (table.getString(XMLTools.COLLECTION) == null) {
|
39 |
0
| System.out.println("ERROR : Collection and switch required");
|
40 |
0
| return false;
|
41 |
| } |
42 |
| |
43 |
0
| Collection col = null;
|
44 |
0
| try {
|
45 |
| |
46 |
| |
47 |
0
| String colstring = normalizeCollectionURI(table.getString(XMLTools.COLLECTION),
|
48 |
| table.getBoolean(XMLTools.LOCAL)); |
49 |
| |
50 |
0
| col = DatabaseManager.getCollection(colstring);
|
51 |
0
| if (col == null) {
|
52 |
0
| System.out.println("ERROR : Collection not found!");
|
53 |
0
| return false;
|
54 |
| } |
55 |
| |
56 |
| |
57 |
0
| CollectionManager colman = (CollectionManager) col.getService("CollectionManager", XMLDBAPIVERSION);
|
58 |
| |
59 |
0
| String[] idx = colman.listIndexers();
|
60 |
| |
61 |
0
| System.out.println("Indexes:\n");
|
62 |
| |
63 |
0
| for (int i = 0; i < idx.length; i++) {
|
64 |
0
| System.out.println(idx[i]);
|
65 |
| } |
66 |
| |
67 |
0
| System.out.println("\nTotal Indexes: " + idx.length);
|
68 |
| |
69 |
| } finally { |
70 |
0
| if (col != null) {
|
71 |
0
| col.close();
|
72 |
| } |
73 |
| } |
74 |
| |
75 |
0
| return true;
|
76 |
| } |
77 |
| |
78 |
0
| public void usage() {
|
79 |
0
| System.out.println("Format: xindice li -c <context> [-l [-d <path>]] [-v]");
|
80 |
0
| System.out.println();
|
81 |
0
| System.out.println("Recalls a list of indexers from a specific collection");
|
82 |
0
| System.out.println();
|
83 |
| } |
84 |
| } |