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