]> 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
Download process log
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / support / deploy / HttpdApplicationDeployment.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.slc.support.deploy;
18
19 import java.io.File;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.argeo.slc.SlcException;
24 import org.argeo.slc.build.Distribution;
25 import org.argeo.slc.deploy.DeployEnvironment;
26 import org.argeo.slc.deploy.DeployedSystem;
27 import org.argeo.slc.deploy.Deployment;
28 import org.argeo.slc.deploy.DeploymentData;
29 import org.argeo.slc.deploy.TargetData;
30
31 public class HttpdApplicationDeployment implements Deployment {
32 private static final Log log = LogFactory
33 .getLog(HttpdApplicationDeployment.class);
34
35 private HttpdApplicationTargetData targetData;
36 private DeploymentData deploymentData;
37 private SimpleHttpdApplication deployedSystem;
38 private Distribution distribution;
39
40 private DeployEnvironment deployEnvironment;
41
42 public void run() {
43 try {
44 deployEnvironment.unpackTo(distribution, targetData
45 .getTargetRootLocation(), null);
46
47 // FIXME: make it generic
48 String deployDataPath = targetData.getTargetRootLocation()
49 .getCanonicalPath();
50
51 deployEnvironment.unpackTo(deploymentData,
52 new File(deployDataPath), null);
53 deployedSystem = new SimpleHttpdApplication();
54 deployedSystem.setTargetData(targetData);
55
56 log.info("Deployed " + distribution + " to " + targetData);
57 } catch (Exception e) {
58 throw new SlcException("Cannot deploy " + distribution + " to "
59 + targetData, e);
60 }
61
62 }
63
64 public void setTargetData(TargetData targetData) {
65 this.targetData = (HttpdApplicationTargetData) targetData;
66 }
67
68 public void setDeploymentData(DeploymentData deploymentData) {
69 this.deploymentData = deploymentData;
70 }
71
72 public DeployedSystem getDeployedSystem() {
73 return deployedSystem;
74 }
75
76 public void setDistribution(Distribution distribution) {
77 this.distribution = distribution;
78 }
79
80 public void setDeployEnvironment(DeployEnvironment deployEnvironment) {
81 this.deployEnvironment = deployEnvironment;
82 }
83
84 }