01: package vicazh.hyperpool.stream.net.http;
02:
03: import java.io.*;
04: import java.text.*;
05: import java.util.*;
06:
07: /**
08: * The log service
09: *
10: * @author Victor Zhigunov
11: * @version 0.4.0
12: */
13: public class LogService extends ReportService implements
14: LogServiceMBean, Serializable {
15: public LogService() {
16: }
17:
18: /**
19: * @param cachesize
20: * cache size
21: */
22: public LogService(int cachesize) {
23: super (cachesize);
24: }
25:
26: public Connection getConnection() {
27: return new LogConnection(this );
28: }
29:
30: synchronized void store(Session session, Date date)
31: throws FileNotFoundException {
32: pack();
33: if (session.getClient().getFile() == null || date == null)
34: return;
35: store(date);
36: String delimiter = getDelimiter();
37: ps.print(DateFormat.getDateTimeInstance().format(date));
38: ps.print(delimiter);
39: ps
40: .print(session.getClient().getFields().containsKey(
41: "referer"));
42: ps.print(delimiter);
43: ps.print(((LogConnection) session.connection).client);
44: ps.print(delimiter);
45: ps.print(((LogStream) session.getServer()).count);
46: ps.print(delimiter);
47: ps.print(System.currentTimeMillis() - date.getTime());
48: ps.print(delimiter);
49: ps.println(session.getClient().getFile());
50: ps.flush();
51: }
52:
53: }
|