94 |
brianR |
1 |
package net.brutex.xservices.util;
|
|
|
2 |
|
|
|
3 |
import java.io.PrintStream;
|
|
|
4 |
|
|
|
5 |
import org.netbeans.lib.cvsclient.command.FileInfoContainer;
|
|
|
6 |
import org.netbeans.lib.cvsclient.command.log.LogInformation;
|
|
|
7 |
import org.netbeans.lib.cvsclient.event.BinaryMessageEvent;
|
|
|
8 |
import org.netbeans.lib.cvsclient.event.CVSAdapter;
|
|
|
9 |
import org.netbeans.lib.cvsclient.event.CVSListener;
|
|
|
10 |
import org.netbeans.lib.cvsclient.event.FileAddedEvent;
|
|
|
11 |
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
|
|
|
12 |
import org.netbeans.lib.cvsclient.event.FileRemovedEvent;
|
|
|
13 |
import org.netbeans.lib.cvsclient.event.FileToRemoveEvent;
|
|
|
14 |
import org.netbeans.lib.cvsclient.event.FileUpdatedEvent;
|
|
|
15 |
import org.netbeans.lib.cvsclient.event.MessageEvent;
|
|
|
16 |
import org.netbeans.lib.cvsclient.event.ModuleExpansionEvent;
|
|
|
17 |
import org.netbeans.lib.cvsclient.event.TerminationEvent;
|
|
|
18 |
|
|
|
19 |
public abstract class BasicCVSListener implements CVSListener
|
|
|
20 |
{
|
|
|
21 |
/**
|
|
|
22 |
* Stores a tagged line
|
|
|
23 |
*/
|
|
|
24 |
private final StringBuffer taggedLine = new StringBuffer();
|
|
|
25 |
|
|
|
26 |
/**
|
|
|
27 |
* Called when the server wants to send a message to be displayed to
|
|
|
28 |
* the user. The message is only for information purposes and clients
|
|
|
29 |
* can choose to ignore these messages if they wish.
|
|
|
30 |
* @param e the event
|
|
|
31 |
*/
|
|
|
32 |
public void messageSent(MessageEvent e)
|
|
|
33 |
{
|
|
|
34 |
String line = e.getMessage();
|
|
|
35 |
PrintStream stream = e.isError() ? System.err
|
|
|
36 |
: System.out;
|
|
|
37 |
|
|
|
38 |
if (e.isTagged())
|
|
|
39 |
{
|
|
|
40 |
String message = e.parseTaggedMessage(taggedLine, line);
|
|
|
41 |
// if we get back a non-null line, we have something
|
|
|
42 |
// to output. Otherwise, there is more to come and we
|
|
|
43 |
// should do nothing yet.
|
|
|
44 |
if (message != null)
|
|
|
45 |
{
|
|
|
46 |
//stream.println("Message: " + message);
|
|
|
47 |
}
|
|
|
48 |
}
|
|
|
49 |
else
|
|
|
50 |
{
|
|
|
51 |
//stream.println("Message: " + line);
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
@Override
|
|
|
56 |
public void commandTerminated(TerminationEvent arg0) {
|
|
|
57 |
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
@Override
|
|
|
61 |
public void fileAdded(FileAddedEvent arg0) {
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
@Override
|
|
|
67 |
public void fileInfoGenerated(FileInfoEvent arg0) {
|
|
|
68 |
FileInfoContainer info = arg0.getInfoContainer();
|
|
|
69 |
LogInformation info2 = (LogInformation) info;
|
|
|
70 |
System.out.println(info2.getRepositoryFilename());
|
|
|
71 |
System.out.println(info2.getDescription());
|
|
|
72 |
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
@Override
|
|
|
76 |
public void fileRemoved(FileRemovedEvent arg0) {
|
|
|
77 |
// TODO Auto-generated method stub
|
|
|
78 |
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
@Override
|
|
|
82 |
public void fileToRemove(FileToRemoveEvent arg0) {
|
|
|
83 |
// TODO Auto-generated method stub
|
|
|
84 |
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
@Override
|
|
|
88 |
public void fileUpdated(FileUpdatedEvent arg0) {
|
|
|
89 |
// TODO Auto-generated method stub
|
|
|
90 |
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
@Override
|
|
|
94 |
public void messageSent(BinaryMessageEvent arg0) {
|
|
|
95 |
// TODO Auto-generated method stub
|
|
|
96 |
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
@Override
|
|
|
100 |
public void moduleExpanded(ModuleExpansionEvent arg0) {
|
|
|
101 |
// TODO Auto-generated method stub
|
|
|
102 |
|
|
|
103 |
}
|
|
|
104 |
}
|