|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| package org.apache.xindice.tools.command; |
|
20 |
| |
|
21 |
| import org.apache.xindice.server.Xindice; |
|
22 |
| import org.apache.xindice.util.StringUtilities; |
|
23 |
| import org.apache.xindice.tools.XMLTools; |
|
24 |
| |
|
25 |
| import java.util.List; |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public class HelpCommand extends Command { |
|
33 |
| |
|
34 |
0
| public boolean execute(XMLTools.Config table) throws Exception {
|
|
35 |
0
| List list = table.getActions();
|
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
0
| System.out.println();
|
|
42 |
0
| System.out.println("Xindice Command Tools v" + Xindice.Version);
|
|
43 |
0
| System.out.println();
|
|
44 |
0
| System.out.println("Format: xindice <action> [parameters]");
|
|
45 |
0
| System.out.println();
|
|
46 |
0
| System.out.println("General purpose switches:");
|
|
47 |
0
| System.out.println(" -c|--collection <context>");
|
|
48 |
0
| System.out.println(" Collection context (must always be specified), can be either");
|
|
49 |
0
| System.out.println(" canonical name of the collection or complete xmldb URL");
|
|
50 |
0
| System.out.println(" -l|--localdb");
|
|
51 |
0
| System.out.println(" Use a local database rather then going over the network.");
|
|
52 |
0
| System.out.println(" Should be combined with -d to specify the configuration to use");
|
|
53 |
0
| System.out.println(" -d|--dbconfig <path>");
|
|
54 |
0
| System.out.println(" Path to the database configuration to use for the local ");
|
|
55 |
0
| System.out.println(" database. Only applies if -l is specified.");
|
|
56 |
0
| System.out.println(" -v|--verbose");
|
|
57 |
0
| System.out.println(" Verbose. Outputs additional information and exceptions");
|
|
58 |
0
| System.out.println(" -h|--help");
|
|
59 |
0
| System.out.println(" Print help screen for an action");
|
|
60 |
0
| System.out.println();
|
|
61 |
0
| System.out.println("Actions:");
|
|
62 |
| |
|
63 |
0
| String helpClass;
|
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
0
| for (int i = 0; i < list.size(); i++) {
|
|
68 |
0
| XMLTools.Action action = (XMLTools.Action) list.get(i);
|
|
69 |
0
| helpClass = action.helpclass;
|
|
70 |
| |
|
71 |
0
| if (helpClass.equals("document")) {
|
|
72 |
0
| System.out.println(" " + StringUtilities.leftJustify(action.switchName, 13) + action.description);
|
|
73 |
| } |
|
74 |
| } |
|
75 |
| |
|
76 |
| |
|
77 |
0
| for (int i = 0; i < list.size(); i++) {
|
|
78 |
0
| XMLTools.Action action = (XMLTools.Action) list.get(i);
|
|
79 |
0
| helpClass = action.helpclass;
|
|
80 |
| |
|
81 |
0
| if (helpClass.equals("security")) {
|
|
82 |
0
| System.out.println(" " + StringUtilities.leftJustify(action.switchName, 13) + action.description);
|
|
83 |
| } |
|
84 |
| } |
|
85 |
| |
|
86 |
0
| System.out.println();
|
|
87 |
0
| System.out.println("For more information, please read the Xindice - Tools Reference Guide");
|
|
88 |
0
| System.out.println();
|
|
89 |
0
| return true;
|
|
90 |
| } |
|
91 |
| |
|
92 |
0
| public void usage() {
|
|
93 |
0
| System.out.println("Format: xindice help");
|
|
94 |
0
| System.out.println();
|
|
95 |
0
| System.out.println("Describes usage of Xindice Command Tools");
|
|
96 |
0
| System.out.println();
|
|
97 |
| } |
|
98 |
| } |