Coverage report

  %line %branch
nl.toolforge.karma.core.vc.cvsimpl.LogParser
0% 
0% 

 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  
 // todo MUST comply to Sun Public License !
 16  
 //
 17  
 
 18  
 /**
 19  
  * @author D.A. Smedes
 20  
  * @version $Id: LogParser.java,v 1.1 2004/11/02 22:26:44 asmedes Exp $
 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  
    * Filters symbolic names from a cvs log. The rest of the messages are ignored.
 33  
    *
 34  
    * @param event
 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  
   // Empty implementations of CVSListener interface
 72  
   //
 73  
 
 74  
   /**
 75  
    * Not implemented for this implementation.
 76  
    * @param e Not implemented for this implementation.
 77  
    */
 78  0
   public void messageSent(org.netbeans.lib.cvsclient.event.MessageEvent e) { }
 79  
 
 80  
   /**
 81  
    * Not implemented for this implementation.
 82  
    * @param e Not implemented for this implementation.
 83  
    */
 84  0
   public void fileAdded(FileAddedEvent e) { }
 85  
 
 86  
   /**
 87  
    * Not implemented for this implementation.
 88  
    * @param e Not implemented for this implementation.
 89  
    */
 90  0
   public void fileRemoved(FileRemovedEvent e) { }
 91  
 
 92  
   /**
 93  
    * Not implemented for this implementation.
 94  
    * @param e Not implemented for this implementation.
 95  
    */
 96  0
   public void fileUpdated(FileUpdatedEvent e) { }
 97  
 
 98  
   /**
 99  
    * Not implemented for this implementation.
 100  
    * @param e Not implemented for this implementation.
 101  
    */
 102  0
   public void fileInfoGenerated(FileInfoEvent e) { }
 103  
 
 104  
   /**
 105  
    * Not implemented for this implementation.
 106  
    * @param e Not implemented for this implementation.
 107  
    */
 108  0
   public void commandTerminated(TerminationEvent e) { }
 109  
 
 110  
   /**
 111  
    * Not implemented for this implementation.
 112  
    * @param e Not implemented for this implementation.
 113  
    */
 114  0
   public void moduleExpanded(ModuleExpansionEvent e) { }
 115  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.