1 package org.apache.maven.scm.provider.svn.svnexe.command.info;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.apache.maven.scm.command.info.InfoItem;
26 import org.codehaus.plexus.util.cli.StreamConsumer;
27
28
29
30
31
32 public class SvnInfoConsumer
33 implements StreamConsumer
34 {
35 private List<InfoItem> infoItems = new ArrayList<InfoItem>();
36
37 private InfoItem currentItem = new InfoItem();
38
39
40 public void consumeLine( String s )
41 {
42 if ( s.equals( "" ) )
43 {
44 if ( currentItem != null )
45 {
46 infoItems.add( currentItem );
47 }
48
49 currentItem = new InfoItem();
50 }
51 else if ( s.startsWith( "Path: " ) )
52 {
53 currentItem.setPath( getValue( s ) );
54 }
55 else if ( s.startsWith( "URL: " ) )
56 {
57 currentItem.setURL( getValue( s ) );
58 }
59 else if ( s.startsWith( "Repository Root: " ) )
60 {
61 currentItem.setRepositoryRoot( getValue( s ) );
62 }
63 else if ( s.startsWith( "Repository UUID: " ) )
64 {
65 currentItem.setRepositoryUUID( getValue( s ) );
66 }
67 else if ( s.startsWith( "Revision: " ) )
68 {
69 currentItem.setRevision( getValue( s ) );
70 }
71 else if ( s.startsWith( "Node Kind: " ) )
72 {
73 currentItem.setNodeKind( getValue( s ) );
74 }
75 else if ( s.startsWith( "Schedule: " ) )
76 {
77 currentItem.setSchedule( getValue( s ) );
78 }
79 else if ( s.startsWith( "Last Changed Author: " ) )
80 {
81 currentItem.setLastChangedAuthor( getValue( s ) );
82 }
83 else if ( s.startsWith( "Last Changed Rev: " ) )
84 {
85 currentItem.setLastChangedRevision( getValue( s ) );
86 }
87 else if ( s.startsWith( "Last Changed Date: " ) )
88 {
89 currentItem.setLastChangedDate( getValue( s ) );
90 }
91 }
92
93 private static String getValue( String s )
94 {
95 int idx = s.indexOf( ": " );
96
97 if ( idx < 0 )
98 {
99
100 return null;
101 }
102 else
103 {
104 return s.substring( idx + 2 );
105 }
106 }
107
108 public List<InfoItem> getInfoItems()
109 {
110 return infoItems;
111 }
112 }