1 import java.io.IOException;
2 import java.text.ParseException;
3 import java.text.SimpleDateFormat;
4
5 import org.apache.commons.lang.StringUtils;
6
7 public class Deploy {
8 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd.hhmmss");
9
10 public static void main(final String[] args) {
11 Deploy deploy = new Deploy();
12 deploy.run();
13 }
14
15 public void run() {
16 try {
17 String url = getCurlUrl();
18 System.out.println("\n" + url);
19 } catch (Throwable t) {
20 t.printStackTrace();
21 }
22 }
23
24 protected String getCurlUrl() throws Exception {
25 return null;
26
27
28
29
30
31 }
32
33 protected String getFilename(final BuildInfo bi) {
34 StringBuffer sb = new StringBuffer();
35 sb.append(bi.getArtifactId());
36 sb.append("-");
37 String version = bi.getVersion();
38 if (version.endsWith("-SNAPSHOT")) {
39 version = StringUtils.replace(version, "-SNAPSHOT", "");
40 }
41 sb.append(version);
42 sb.append("-");
43 sb.append(sdf.format(bi.getTimestamp()));
44 sb.append("-");
45 sb.append(bi.getBuildNumber());
46 sb.append(".war");
47 return sb.toString();
48 }
49
50 protected BuildInfo getBuildInfo(final String contents) throws ParseException {
51 String artifactId = StringUtils.substringBetween(contents, "<artifactId>", "</artifactId>");
52 String version = StringUtils.substringBetween(contents, "<version>", "</version>");
53 String buildNumber = StringUtils.substringBetween(contents, "<buildNumber>", "</buildNumber>");
54 String timestamp = StringUtils.substringBetween(contents, "<timestamp>", "</timestamp>");
55
56 BuildInfo bi = new BuildInfo();
57 bi.setArtifactId(artifactId);
58 bi.setVersion(version);
59 bi.setBuildNumber(new Integer(buildNumber));
60 bi.setTimestamp(sdf.parse(timestamp));
61 return bi;
62 }
63
64 protected String getUrl(final String filename) {
65 String base = "http://maven.kuali.org/snapshot/org/kuali/student/web/ks-embedded/1.1.0-M9-SNAPSHOT/";
66 return base + filename;
67 }
68
69 protected String getContents(final String url) throws IOException {
70 return null;
71
72
73
74
75 }
76
77 }