]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/support/deploy/HttpdApplicationDeployment.java
Introduce org.argeo.slc.support.simple
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / 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.Deployment;
12 import org.argeo.slc.core.deploy.DeploymentData;
13 import org.argeo.slc.core.deploy.TargetData;
14
15 public class HttpdApplicationDeployment implements Deployment {
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(distribution, targetData
29 .getTargetRootLocation(), null);
30
31 // FIXME: make it generic
32 String deployDataPath = targetData.getTargetRootLocation()
33 .getCanonicalPath();
34
35 deployEnvironment.unpackTo(deploymentData,
36 new File(deployDataPath), null);
37 deployedSystem = new SimpleHttpdApplication();
38 deployedSystem.setTargetData(targetData);
39
40 log.info("Deployed " + distribution + " to " + targetData);
41 } catch (Exception e) {
42 throw new SlcException("Cannot deploy " + distribution + " to "
43 + targetData, e);
44 }
45
46 }
47
48 public void setTargetData(TargetData targetData) {
49 this.targetData = (HttpdApplicationTargetData) targetData;
50 }
51
52 public void setDeploymentData(DeploymentData deploymentData) {
53 this.deploymentData = deploymentData;
54 }
55
56 public DeployedSystem getDeployedSystem() {
57 return deployedSystem;
58 }
59
60 public void setDistribution(Distribution distribution) {
61 this.distribution = distribution;
62 }
63
64 public void setDeployEnvironment(DeployEnvironment deployEnvironment) {
65 this.deployEnvironment = deployEnvironment;
66 }
67
68 }