| 1 |
|
package nl.toolforge.karma.core.vc.cvsimpl; |
| 2 |
|
|
| 3 |
|
import org.apache.tools.ant.BuildEvent; |
| 4 |
|
import org.apache.tools.ant.DefaultLogger; |
| 5 |
|
import org.netbeans.lib.cvsclient.command.log.LogInformation; |
| 6 |
|
import org.netbeans.lib.cvsclient.event.CVSListener; |
| 7 |
|
import org.netbeans.lib.cvsclient.event.FileAddedEvent; |
| 8 |
|
import org.netbeans.lib.cvsclient.event.FileInfoEvent; |
| 9 |
|
import org.netbeans.lib.cvsclient.event.FileRemovedEvent; |
| 10 |
|
import org.netbeans.lib.cvsclient.event.FileUpdatedEvent; |
| 11 |
|
import org.netbeans.lib.cvsclient.event.ModuleExpansionEvent; |
| 12 |
|
import org.netbeans.lib.cvsclient.event.TerminationEvent; |
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
0 |
public class LogParser extends DefaultLogger implements CVSListener { |
| 23 |
|
|
| 24 |
|
private static final String SYM_NAME = "symbolic names:"; |
| 25 |
|
private static final String KEYWORD_SUBST = "keyword substitution: "; |
| 26 |
|
|
| 27 |
0 |
private LogInformation logInfo = new LogInformation(); |
| 28 |
|
|
| 29 |
|
private boolean addingSymNames; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
public void messageLogged(BuildEvent event) { |
| 37 |
|
|
| 38 |
0 |
int priority = event.getPriority(); |
| 39 |
|
|
| 40 |
0 |
if (priority <= msgOutputLevel) { |
| 41 |
|
|
| 42 |
0 |
String line = event.getMessage(); |
| 43 |
|
|
| 44 |
0 |
if (addingSymNames) { |
| 45 |
0 |
processSymbolicName(line); |
| 46 |
0 |
} else if (line.startsWith(SYM_NAME)) { |
| 47 |
0 |
addingSymNames = true; |
| 48 |
0 |
} else if (line.startsWith(KEYWORD_SUBST)) { |
| 49 |
0 |
addingSymNames = false; |
| 50 |
|
} |
| 51 |
|
} |
| 52 |
0 |
System.out.println(event.getMessage()); |
| 53 |
0 |
} |
| 54 |
|
|
| 55 |
|
private void processSymbolicName(String line) { |
| 56 |
0 |
if (!line.startsWith(KEYWORD_SUBST)) { |
| 57 |
0 |
line = line.trim(); |
| 58 |
0 |
int index = line.indexOf(':'); |
| 59 |
0 |
if (index > 0) { |
| 60 |
0 |
String symName = line.substring(0, index).trim(); |
| 61 |
0 |
String revName = line.substring(index + 1, line.length()).trim(); |
| 62 |
0 |
logInfo.addSymbolicName(symName.intern(), revName.intern()); |
| 63 |
|
} |
| 64 |
|
} |
| 65 |
0 |
} |
| 66 |
|
|
| 67 |
|
public LogInformation getLogInformation() { |
| 68 |
0 |
return logInfo; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
0 |
public void messageSent(org.netbeans.lib.cvsclient.event.MessageEvent e) { } |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
0 |
public void fileAdded(FileAddedEvent e) { } |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
0 |
public void fileRemoved(FileRemovedEvent e) { } |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
0 |
public void fileUpdated(FileUpdatedEvent e) { } |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
0 |
public void fileInfoGenerated(FileInfoEvent e) { } |
| 103 |
|
|
| 104 |
|
|
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
0 |
public void commandTerminated(TerminationEvent e) { } |
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
0 |
public void moduleExpanded(ModuleExpansionEvent e) { } |
| 115 |
|
} |