1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.ci.maven;
17
18 import org.apache.maven.settings.Server;
19 import org.codehaus.plexus.util.StringUtils;
20
21
22
23
24 public final class CiServer extends Server
25 {
26
27
28
29
30
31
32 private static final long serialVersionUID = 1L;
33
34
35
36
37 private final String url;
38
39
40
41
42
43
44
45
46 public CiServer(final Logger logger, final Server server, final String url)
47 {
48 checkParameter(logger, server, url);
49
50 this.url = url;
51
52 if (server != null)
53 {
54 this.setId(server.getId());
55 this.setUsername(server.getUsername());
56
57 this.setPassword(server.getPassword());
58 this.setPassphrase(server.getPassphrase());
59 this.setPrivateKey(server.getPrivateKey());
60
61 this.setDirectoryPermissions(server.getDirectoryPermissions());
62 this.setFilePermissions(server.getFilePermissions());
63 this.setConfiguration(server.getConfiguration());
64
65 this.setSourceLevel(server.getSourceLevel());
66 }
67 }
68
69 private void checkParameter(final Logger logger, final Server server,
70 final String url)
71 {
72 if (logger != null)
73 {
74 if (StringUtils.isBlank(url))
75 {
76 logger.warn("Ci-Server URL is null");
77 }
78 if (server == null || StringUtils.isBlank(server.getId())
79 || StringUtils.isBlank(server.getUsername())
80 || StringUtils.isBlank(server.getPassword()))
81 {
82 logger.warn("Server in settings is not correct id, username and "
83 + "password are needed (passphrase and private key are"
84 + " not supported right now).");
85 }
86 }
87 }
88
89
90
91
92
93
94 public String getUrl()
95 {
96 return url;
97 }
98 }