1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util;
17
18 import java.io.PrintStream;
19
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23
24
25
26
27
28 @Deprecated
29 public abstract class AbstractProgressInformer {
30
31 private static final Logger logger = LoggerFactory.getLogger(AbstractProgressInformer.class);
32
33 protected long progress;
34
35 PrintStream printStream = System.out;
36 String startToken = "[INFO] Progress: ";
37 String progressToken = ".";
38 String completeToken = "\n";
39 LogMsg startMessage;
40 LogMsg stopMessage;
41
42
43
44
45 public synchronized long getProgress() {
46 return progress;
47 }
48
49
50
51
52 public void start() {
53 if (startMessage != null) {
54 LoggerUtils.log(startMessage, logger);
55 }
56
57 Assert.notNull(printStream, "printStream is null");
58 this.progress = 0;
59
60 printStream.print(startToken);
61 }
62
63
64
65
66 public void stop() {
67 printStream.print(completeToken);
68
69 if (stopMessage != null) {
70 LoggerUtils.log(stopMessage, logger);
71 }
72 }
73
74 public PrintStream getPrintStream() {
75 return printStream;
76 }
77
78 public void setPrintStream(PrintStream printStream) {
79 this.printStream = printStream;
80 }
81
82 public String getStartToken() {
83 return startToken;
84 }
85
86 public void setStartToken(String startToken) {
87 this.startToken = startToken;
88 }
89
90 public String getCompleteToken() {
91 return completeToken;
92 }
93
94 public void setCompleteToken(String completeToken) {
95 this.completeToken = completeToken;
96 }
97
98 public String getProgressToken() {
99 return progressToken;
100 }
101
102 public void setProgressToken(String progressToken) {
103 this.progressToken = progressToken;
104 }
105
106 public LogMsg getStartMessage() {
107 return startMessage;
108 }
109
110 public void setStartMessage(LogMsg startMessage) {
111 this.startMessage = startMessage;
112 }
113
114 public LogMsg getStopMessage() {
115 return stopMessage;
116 }
117
118 public void setStopMessage(LogMsg stopMessage) {
119 this.stopMessage = stopMessage;
120 }
121
122 }