%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
nl.toolforge.karma.core.vc.VersionControlSystem |
|
|
1 | /* |
|
2 | Karma core - Core of the Karma application |
|
3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
4 | ||
5 | This library is free software; you can redistribute it and/or |
|
6 | modify it under the terms of the GNU Lesser General Public |
|
7 | License as published by the Free Software Foundation; either |
|
8 | version 2.1 of the License, or (at your option) any later version. |
|
9 | ||
10 | This library is distributed in the hope that it will be useful, |
|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | Lesser General Public License for more details. |
|
14 | ||
15 | You should have received a copy of the GNU Lesser General Public |
|
16 | License along with this library; if not, write to the Free Software |
|
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | */ |
|
19 | package nl.toolforge.karma.core.vc; |
|
20 | ||
21 | import nl.toolforge.karma.core.location.BaseLocation; |
|
22 | import nl.toolforge.karma.core.location.LocationType; |
|
23 | ||
24 | /** |
|
25 | * <p>A reference for a VCS (Version Control System). Everybody knows what a version |
|
26 | * control system is (otherwise you are not entitled to use this codebase anyway ...), |
|
27 | * so I'll stick to this message as a documentation snippet for this interface. |
|
28 | * |
|
29 | * <p> |
|
30 | * |
|
31 | * @author D.A. Smedes |
|
32 | * @version $Id: VersionControlSystem.java,v 1.11 2004/11/02 22:26:44 asmedes Exp $ |
|
33 | */ |
|
34 | public abstract class VersionControlSystem extends BaseLocation { |
|
35 | ||
36 | 1680 | private String host = null; |
37 | 3000 | private String username = null; |
38 | 3000 | private String protocol = null; |
39 | 3000 | private int port = -1; |
40 | 3000 | private String repository = null; |
41 | 1320 | |
42 | private String offset; |
|
43 | ||
44 | public VersionControlSystem(String id, LocationType type) { |
|
45 | 1680 | super(id, type); |
46 | 3000 | } |
47 | 1320 | |
48 | public void setHost(String host) { |
|
49 | 1424 | this.host = host; |
50 | 2584 | } |
51 | 1160 | |
52 | ||
53 | public String getHost() { |
|
54 | 32 | return host; |
55 | 20 | } |
56 | ||
57 | /** |
|
58 | * The protocol determines the way a client can communicate to a version control system. |
|
59 | * |
|
60 | * @param protocol The protocol for the version control system. |
|
61 | */ |
|
62 | public void setProtocol(String protocol) { |
|
63 | 1680 | this.protocol = protocol; |
64 | 3000 | } |
65 | 1320 | |
66 | ||
67 | public String getProtocol() { |
|
68 | 1920 | return protocol; |
69 | 1090 | } |
70 | ||
71 | ||
72 | public void setPort(int port) { |
|
73 | 1424 | this.port = port; |
74 | 2584 | } |
75 | 1160 | |
76 | /** |
|
77 | * Sets the server port. When <code>port</code> is not a number, <code>-1</code> is set. |
|
78 | * |
|
79 | * @param port |
|
80 | */ |
|
81 | public void setPort(String port) { |
|
82 | ||
83 | try { |
|
84 | 128 | setPort(Integer.parseInt(port)); |
85 | 140 | } catch (NumberFormatException n) { |
86 | 0 | setPort(-1); |
87 | 128 | } |
88 | 268 | } |
89 | 140 | |
90 | public int getPort() { |
|
91 | 32 | return port; |
92 | 20 | } |
93 | ||
94 | ||
95 | public void setOffset(String offset) { |
|
96 | 1408 | this.offset = offset; |
97 | 2558 | } |
98 | 1150 | |
99 | public String getModuleOffset() { |
|
100 | 500 | if ("".equals(offset)) { |
101 | 460 | return null; |
102 | 140 | } |
103 | 500 | return offset; |
104 | 320 | } |
105 | ||
106 | public void setRepository(String repository) { |
|
107 | ||
108 | 1680 | if ((repository == null) || (repository.length() == 0)) { |
109 | 1320 | throw new IllegalArgumentException("Repository cannot be null."); |
110 | } |
|
111 | ||
112 | 1680 | this.repository = repository; |
113 | 3000 | } |
114 | 1320 | |
115 | ||
116 | public String getRepository() { |
|
117 | 2848 | return repository; |
118 | 2160 | } |
119 | ||
120 | ||
121 | public void setUsername(String username) { |
|
122 | ||
123 | 480 | if ((username == null) || (username.length() == 0)) { |
124 | 350 | throw new IllegalArgumentException("Username cannot be null."); |
125 | } |
|
126 | 480 | this.username = username; |
127 | 830 | } |
128 | 350 | |
129 | public String getUsername() { |
|
130 | 48 | return username; |
131 | 30 | } |
132 | ||
133 | ||
134 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |