]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/main/java/org/argeo/slc/support/deploy/HttpdApplicationDeployment.java
Introduce maven deploy environment
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / support / deploy / HttpdApplicationDeployment.java
1 package org.argeo.slc.support.deploy;
2
3 import java.io.File;
4
5 import org.apache.commons.logging.Log;
6 import org.apache.commons.logging.LogFactory;
7 import org.argeo.slc.core.SlcException;
8 import org.argeo.slc.core.build.Distribution;
9 import org.argeo.slc.core.deploy.DeployEnvironment;
10 import org.argeo.slc.core.deploy.DeployedSystem;
11 import org.argeo.slc.core.deploy.DeploymentData;
12 import org.argeo.slc.core.deploy.ExecutableDeployment;
13 import org.argeo.slc.core.deploy.TargetData;
14
15 public class HttpdApplicationDeployment implements ExecutableDeployment {
16 private static final Log log = LogFactory
17 .getLog(HttpdApplicationDeployment.class);
18
19 private HttpdApplicationTargetData targetData;
20 private DeploymentData deploymentData;
21 private SimpleHttpdApplication deployedSystem;
22 private Distribution distribution;
23
24 private DeployEnvironment deployEnvironment;
25
26 public void execute() {
27 try {
28 deployEnvironment.unpackTo(getDistribution(), targetData
29 .getTargetRootLocation(), null);
30
31 // FIXME: make it generic
32 String deployDataPath = targetData.getTargetRootLocation()
33 .getCanonicalPath();
34
35 deployEnvironment.unpackTo(getDeploymentData(), new File(
36 deployDataPath), null);
37 deployedSystem = new SimpleHttpdApplication();
38 deployedSystem.setTargetData(targetData);
39
40 } catch (Exception e) {
41 throw new SlcException("Cannot deploy " + deploymentData + " to "
42 + targetData, e);
43 }
44
45 }
46
47 public void setTargetData(TargetData targetData) {
48 this.targetData = (HttpdApplicationTargetData) targetData;
49 }
50
51 public void setDeploymentData(DeploymentData deploymentData) {
52 this.deploymentData = deploymentData;
53 }
54
55 public DeployedSystem getDeployedSystem() {
56 return deployedSystem;
57 }
58
59 public DeploymentData getDeploymentData() {
60 return deploymentData;
61 }
62
63 public TargetData getTargetData() {
64 return targetData;
65 }
66
67 public Distribution getDistribution() {
68 return distribution;
69 }
70
71 public void setDistribution(Distribution distribution) {
72 this.distribution = distribution;
73 }
74
75 public void setDeployEnvironment(DeployEnvironment deployEnvironment) {
76 this.deployEnvironment = deployEnvironment;
77 }
78
79 }