1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package gnu.hylafax.util;
30
31
32 import gnu.hylafax.HylaFAXClient;
33 import gnu.hylafax.HylaFAXClientProtocol;
34 import gnu.hylafax.Job;
35
36 import java.util.Enumeration;
37 import java.util.StringTokenizer;
38 import java.util.Vector;
39
40 /***
41 * This class implements most of the faxstat program as supplied with the
42 * HylaFAX distribution. The following command line options are supported.
43 * <P>
44 *
45 * <PRE>
46 *
47 * -a get status of archive/ (IGNORED) -d get status of doneq/ -f get status of
48 * docq/ -g display GMT timestamps -h<host>specifiy server hostname -l display
49 * local timestamps -i get additional status info -r get status of receive queue
50 * -s get status of send queue -u user to login to the server with -v verbose
51 * mode
52 *
53 * </PRE>
54 *
55 * <P>
56 * Refer to the faxstat man page (from the HylaFAX distribution) for more
57 * information. This program depends on the gnu.getopt package for command line
58 * parsing. gnu.getopt (java-getopt) can be found at <a
59 * href="http://www.urbanophile.com/arenn/">http://www.urbanophile.com/arenn/
60 * </a>
61 */
62 public class FaxStat {
63
64 public static void main(String arguments[]) {
65 Vector list = new Vector();
66 HylaFAXClient c = new HylaFAXClient();
67 try {
68 c.open("10.0.0.205");
69
70 try {
71 c.user("fax");
72
73 c.tzone(HylaFAXClientProtocol.TZONE_LOCAL);
74 for (int i = 1; i <= 2; i++) {
75 list = c.getList(i == 1 ? "sendq" : "doneq");
76 list.addAll(c.getList(""));
77 Enumeration lines = list.elements();
78 String line;
79 long jobidL = -1;
80 while (lines.hasMoreElements()) {
81 try {
82 line = (String) lines.nextElement();
83 String jobid = new StringTokenizer(line)
84 .nextToken();
85
86
87 jobidL = Long.parseLong(jobid);
88 Job j = c.getJob(jobidL);
89 String etatEnvoi = j.getProperty("STATE");
90
91 etatEnvoi = j.getProperty("STATE");
92
93 etatEnvoi = j.getProperty("STATE");
94
95 etatEnvoi = j.getProperty("STATE");
96
97 String status = j.getProperty("STATUS");
98
99 status = j.getProperty("STATUS");
100
101 status = j.getProperty("STATUS");
102
103 status = j.getProperty("STATUS");
104
105
106
107
108 String sDateEnvoi = j.getProperty("SENDTIME");
109
110 sDateEnvoi = j.getProperty("SENDTIME");
111
112 sDateEnvoi = j.getProperty("SENDTIME");
113
114 sDateEnvoi = j.getProperty("SENDTIME");
115
116 sDateEnvoi = j.getProperty("SENDTIME");
117
118 int nbPages = Integer.parseInt(j
119 .getProperty("TOTPAGES"));
120 nbPages = Integer.parseInt(j
121 .getProperty("TOTPAGES"));
122 nbPages = Integer.parseInt(j
123 .getProperty("TOTPAGES"));
124 nbPages = Integer.parseInt(j
125 .getProperty("TOTPAGES"));
126 nbPages = Integer.parseInt(j
127 .getProperty("TOTPAGES"));
128
129
130 String correspondant = j.getProperty("EXTERNAL");
131
132 correspondant = j.getProperty("EXTERNAL");
133
134 correspondant = j.getProperty("EXTERNAL");
135
136 correspondant = j.getProperty("EXTERNAL");
137
138 correspondant = j.getProperty("EXTERNAL");
139
140 String initColl = j.getProperty("OWNER");
141
142 initColl = j.getProperty("OWNER");
143
144 initColl = j.getProperty("OWNER");
145
146 initColl = j.getProperty("OWNER");
147
148 initColl = j.getProperty("OWNER");
149
150
151
152
153
154
155
156
157
158
159
160 } finally {
161 if (i == 2)
162 c.jdele(jobidL);
163 }
164 }
165 }
166 } catch (Exception e) {
167 e.printStackTrace();
168
169 }
170 } catch (Exception e) {
171 e.printStackTrace();
172
173 }
174
175 }
176 }
177
178