Coverage Report - org.apache.maven.scm.provider.synergy.consumer.SynergyWorkareaConsumer
 
Classes in this File Line Coverage Branch Coverage Complexity
SynergyWorkareaConsumer
0 %
0/11
0 %
0/4
1,667
 
 1  
 package org.apache.maven.scm.provider.synergy.consumer;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  * http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.scm.log.ScmLogger;
 23  
 import org.codehaus.plexus.util.cli.StreamConsumer;
 24  
 
 25  
 import java.io.File;
 26  
 
 27  
 /**
 28  
  * Parse output of
 29  
  * <p/>
 30  
  * <pre>
 31  
  * ccm wa -show -p &lt;project_spec&gt;
 32  
  * </pre>
 33  
  *
 34  
  * @author <a href="mailto:julien.henry@capgemini.com">Julien Henry</a>
 35  
  * @version $Id: SynergyWorkareaConsumer.java 691832 2008-09-03 23:54:44Z vsiveton $
 36  
  */
 37  
 public class SynergyWorkareaConsumer
 38  
     implements StreamConsumer
 39  
 {
 40  
     private ScmLogger logger;
 41  
 
 42  
     private File workarea;
 43  
 
 44  
     public SynergyWorkareaConsumer( ScmLogger logger )
 45  0
     {
 46  0
         this.logger = logger;
 47  0
     }
 48  
 
 49  
     /**
 50  
      * We are expecting the following output:
 51  
      * <p/>
 52  
      * <pre>
 53  
      *            Project Maintain Copies Relative Time Translate Modify Path
 54  
      *            -------------------------------------------------------------------
 55  
      *            BGZBFZH&tilde;1 TRUE TRUE FALSE FALSE TRUE FALSE 'D:\cmsynergy\ccm_wa\LAPOSTE\BGZBFZH&tilde;1'
 56  
      * </pre>
 57  
      * <p/>
 58  
      * And we want to extract:
 59  
      * <p/>
 60  
      * <pre>
 61  
      *            D:\cmsynergy\ccm_wa\LAPOSTE\BGZBFZH&tilde;1
 62  
      *            &lt;pre&gt;
 63  
      *
 64  
      * {@inheritDoc}
 65  
      */
 66  
     public void consumeLine( String line )
 67  
     {
 68  0
         if ( logger.isDebugEnabled() )
 69  
         {
 70  0
             logger.debug( line );
 71  
         }
 72  0
         if ( line.indexOf( " '" ) > -1 )
 73  
         {
 74  0
             int beginIndex = line.indexOf( " '" );
 75  0
             String fileName = line.substring( beginIndex + 2, line.indexOf( "'", beginIndex + 2 ) );
 76  0
             workarea = new File( fileName );
 77  
         }
 78  0
     }
 79  
 
 80  
     public File getWorkAreaPath()
 81  
     {
 82  0
         return workarea;
 83  
     }
 84  
 }