1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.web.deployer.jetty;
18
19 import org.mortbay.jetty.webapp.WebAppContext;
20 import org.osgi.framework.Bundle;
21 import org.springframework.osgi.web.deployer.OsgiWarDeploymentException;
22 import org.springframework.osgi.web.deployer.WarDeployment;
23 import org.springframework.osgi.web.deployer.WarDeploymentContext;
24 import org.springframework.osgi.web.deployer.internal.support.DefaultWarDeploymentContext;
25
26
27
28
29
30
31
32
33 class JettyWarDeployment implements WarDeployment {
34
35
36 private boolean active = true;
37
38 private final WebAppContext webAppCtx;
39
40 private final JettyContextUndeployer undeployer;
41
42 private final WarDeploymentContext deploymentContext;
43
44
45 public JettyWarDeployment(JettyContextUndeployer jettyWarUndeployer, Bundle bundle, WebAppContext wac) {
46 this.undeployer = jettyWarUndeployer;
47 this.webAppCtx = wac;
48
49
50 this.deploymentContext = new DefaultWarDeploymentContext(bundle, wac.getContextPath(), wac.getServletContext());
51 }
52
53 public WarDeploymentContext getDeploymentContext() {
54 return deploymentContext;
55 }
56
57 public boolean isActive() {
58 return active;
59 }
60
61 public void undeploy() throws OsgiWarDeploymentException {
62 if (!active)
63 return;
64
65 active = false;
66 undeployer.undeploy(webAppCtx);
67 }
68
69
70 WebAppContext getWebAppContext() {
71 return webAppCtx;
72 }
73 }