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
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.argeo.slc.SlcException;
23 import org.argeo.slc.build.Distribution;
24 import org.argeo.slc.deploy.DeployEnvironment;
25 import org.argeo.slc.deploy.DeployedSystem;
26 import org.argeo.slc.deploy.Deployment;
27 import org.argeo.slc.deploy.DeploymentData;
28 import org.argeo.slc.deploy.TargetData;
29
30 public class HttpdApplicationDeployment implements Deployment {
31 private static final Log log = LogFactory
32 .getLog(HttpdApplicationDeployment.class);
33
34 private HttpdApplicationTargetData targetData;
35 private DeploymentData deploymentData;
36 private SimpleHttpdApplication deployedSystem;
37 private Distribution distribution;
38
39 private DeployEnvironment deployEnvironment;
40
41 public void run() {
42 try {
43 deployEnvironment.unpackTo(distribution, targetData
44 .getTargetRootLocation(), null);
45
46
47 String deployDataPath = targetData.getTargetRootLocation()
48 .getCanonicalPath();
49
50 deployEnvironment.unpackTo(deploymentData,
51 new File(deployDataPath), null);
52 deployedSystem = new SimpleHttpdApplication();
53 deployedSystem.setTargetData(targetData);
54
55 log.info("Deployed " + distribution + " to " + targetData);
56 } catch (Exception e) {
57 throw new SlcException("Cannot deploy " + distribution + " to "
58 + targetData, e);
59 }
60
61 }
62
63 public void setTargetData(TargetData targetData) {
64 this.targetData = (HttpdApplicationTargetData) targetData;
65 }
66
67 public void setDeploymentData(DeploymentData deploymentData) {
68 this.deploymentData = deploymentData;
69 }
70
71 public DeployedSystem getDeployedSystem() {
72 return deployedSystem;
73 }
74
75 public void setDistribution(Distribution distribution) {
76 this.distribution = distribution;
77 }
78
79 public void setDeployEnvironment(DeployEnvironment deployEnvironment) {
80 this.deployEnvironment = deployEnvironment;
81 }
82
83 }