1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.support.deploy;
17
18 import java.io.File;
19 import java.net.MalformedURLException;
20 import java.net.URL;
21
22 import org.argeo.slc.SlcException;
23 import org.argeo.slc.deploy.TargetData;
24
25 public class HttpdApplicationTargetData implements TargetData {
26 private HttpdServer webServer;
27 private String relativePath;
28 private String targetRootPath;
29
30 public HttpdServer getWebServer() {
31 return webServer;
32 }
33
34 public void setWebServer(HttpdServer webServer) {
35 this.webServer = webServer;
36 }
37
38 public String getRelativePath() {
39 return relativePath;
40 }
41
42
43
44
45
46 public void setRelativePath(String relativePath) {
47 this.relativePath = relativePath;
48 }
49
50 public String getTargetRootPath() {
51 return targetRootPath;
52 }
53
54 public void setTargetRootPath(String targetRootPath) {
55 this.targetRootPath = targetRootPath;
56 }
57
58 public URL getTargetBaseUrl() {
59 try {
60 URL wsUrl = getWebServer().getBaseUrl();
61
62 return new URL(wsUrl, wsUrl.getFile() + '/' + relativePath);
63 } catch (MalformedURLException e) {
64 throw new SlcException("Cannot get base url for " + relativePath, e);
65 }
66 }
67
68 public File getTargetRootLocation() {
69 if (targetRootPath != null && !targetRootPath.equals("")) {
70 return new File(targetRootPath);
71 } else {
72 HttpdServerTargetData targetData = (HttpdServerTargetData) getWebServer()
73 .getTargetData();
74 String path = targetData.getServerRoot() + File.separator
75 + getRelativePath();
76 return new File(path);
77 }
78 }
79
80 }