1 package org.apache.maven.scm.provider.synergy.consumer;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.scm.ChangeFile;
23 import org.apache.maven.scm.log.ScmLogger;
24 import org.apache.maven.scm.provider.synergy.util.SynergyUtil;
25 import org.apache.maven.scm.util.AbstractConsumer;
26
27 import java.util.ArrayList;
28 import java.util.List;
29 import java.util.StringTokenizer;
30
31
32
33
34
35
36
37
38 public class SynergyGetTaskObjectsConsumer
39 extends AbstractConsumer
40 {
41
42 private List<ChangeFile> entries = new ArrayList<ChangeFile>();
43
44 public static final String OUTPUT_FORMAT = "%name" + SynergyUtil.SEPARATOR +
45 "%version" + SynergyUtil.SEPARATOR;
46
47
48
49
50 public List<ChangeFile> getFiles()
51 {
52 return entries;
53 }
54
55 public SynergyGetTaskObjectsConsumer( ScmLogger logger )
56 {
57 super( logger );
58 }
59
60
61 public void consumeLine( String line )
62 {
63 if ( getLogger().isDebugEnabled() )
64 {
65 getLogger().debug( "Consume: " + line );
66 }
67 StringTokenizer tokenizer = new StringTokenizer( line.trim(), SynergyUtil.SEPARATOR );
68 if ( tokenizer.countTokens() == 2 )
69 {
70 ChangeFile f = new ChangeFile( tokenizer.nextToken() );
71 f.setRevision( tokenizer.nextToken() );
72 entries.add( f );
73 }
74 else
75 {
76 if ( getLogger().isErrorEnabled() )
77 {
78 getLogger().error(
79 "Invalid token count in SynergyGetTaskObjects [" + tokenizer.countTokens()
80 + "]" );
81 }
82 }
83 }
84
85 }