or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

application-providers.mddeployment-management.mdgraph-system.mdindex.mdlifecycle-management.md

index.mddocs/

0

# Jetty Deploy

1

2

Jetty Deploy provides a comprehensive web application deployment management system for the Eclipse Jetty web server. It implements a sophisticated deployment lifecycle management framework that can automatically detect, deploy, start, stop, and undeploy web applications from various sources including file system directories, WAR files, and other deployable artifacts.

3

4

## Package Information

5

6

- **Package Name**: org.eclipse.jetty:jetty-deploy

7

- **Package Type**: maven

8

- **Language**: Java

9

- **Installation**: Add to your Maven `pom.xml`:

10

11

```xml

12

<dependency>

13

<groupId>org.eclipse.jetty</groupId>

14

<artifactId>jetty-deploy</artifactId>

15

<version>12.0.21</version>

16

</dependency>

17

```

18

19

## Core Imports

20

21

```java

22

import org.eclipse.jetty.deploy.DeploymentManager;

23

import org.eclipse.jetty.deploy.App;

24

import org.eclipse.jetty.deploy.AppProvider;

25

import org.eclipse.jetty.deploy.providers.ContextProvider;

26

```

27

28

## Basic Usage

29

30

```java

31

import org.eclipse.jetty.deploy.DeploymentManager;

32

import org.eclipse.jetty.deploy.providers.ContextProvider;

33

import org.eclipse.jetty.server.Server;

34

import org.eclipse.jetty.server.handler.ContextHandlerCollection;

35

36

// Create deployment manager

37

DeploymentManager deploymentManager = new DeploymentManager();

38

deploymentManager.setContexts(new ContextHandlerCollection());

39

40

// Add a context provider for scanning webapps

41

ContextProvider contextProvider = new ContextProvider();

42

contextProvider.setMonitoredDirName("webapps");

43

deploymentManager.addAppProvider(contextProvider);

44

45

// Add to server

46

Server server = new Server(8080);

47

server.addBean(deploymentManager);

48

server.start();

49

```

50

51

## Architecture

52

53

Jetty Deploy is built around several key components:

54

55

- **DeploymentManager**: Central orchestrator that manages the complete deployment lifecycle of applications

56

- **AppProvider**: Pluggable interface for discovering and creating applications from various sources

57

- **App**: Wrapper representing an application with its metadata, lifecycle state, and context handler

58

- **AppLifeCycle**: State machine defining the deployment lifecycle with 8 standard states

59

- **Graph System**: Directed graph implementation for modeling state transitions and routing

60

- **Bindings**: Pluggable actions that execute during lifecycle state transitions

61

62

## Capabilities

63

64

### Deployment Management

65

66

Core deployment orchestration functionality providing centralized control over application lifecycles, provider management, and state coordination.

67

68

```java { .api }

69

public class DeploymentManager extends ContainerLifeCycle {

70

public DeploymentManager();

71

public void addApp(App app);

72

public void addAppProvider(AppProvider provider);

73

public void requestAppGoal(App app, String nodeName);

74

public Collection<App> getApps();

75

public App getApp(String appId);

76

public void undeployAll();

77

}

78

```

79

80

[Deployment Management](./deployment-management.md)

81

82

### Application Providers

83

84

Provider system for discovering and deploying applications from various sources like directories, WAR files, and XML descriptors.

85

86

```java { .api }

87

public interface AppProvider extends LifeCycle {

88

void setDeploymentManager(DeploymentManager deploymentManager);

89

ContextHandler createContextHandler(App app) throws Exception;

90

String getEnvironmentName();

91

}

92

93

public class ContextProvider extends ScanningAppProvider {

94

public ContextProvider();

95

public void setMonitoredDirName(String dir);

96

public void setScanInterval(int scanInterval);

97

}

98

```

99

100

[Application Providers](./application-providers.md)

101

102

### Lifecycle Management

103

104

State machine-based deployment lifecycle with standard states, bindings, and transition management.

105

106

```java { .api }

107

public class AppLifeCycle extends Graph {

108

public static final String UNDEPLOYED = "undeployed";

109

public static final String DEPLOYING = "deploying";

110

public static final String DEPLOYED = "deployed";

111

public static final String STARTING = "starting";

112

public static final String STARTED = "started";

113

public static final String STOPPING = "stopping";

114

public static final String UNDEPLOYING = "undeploying";

115

public static final String FAILED = "failed";

116

117

public void addBinding(AppLifeCycle.Binding binding);

118

public void runBindings(Node node, App app, DeploymentManager deploymentManager) throws Throwable;

119

}

120

```

121

122

[Lifecycle Management](./lifecycle-management.md)

123

124

### Graph-based State Machine

125

126

Directed graph system for modeling deployment states, transitions, and path finding through the deployment lifecycle.

127

128

```java { .api }

129

public class Graph {

130

public Graph();

131

public void addNode(Node node);

132

public void addEdge(Edge edge);

133

public Route getPath(Node from, Node to);

134

public Set<Node> getNodes();

135

}

136

137

public final class Node {

138

public Node(String name);

139

public String getName();

140

}

141

```

142

143

[Graph System](./graph-system.md)

144

145

## Types

146

147

### Core Types

148

149

```java { .api }

150

public class App {

151

public App(DeploymentManager manager, AppProvider provider, Path path);

152

public DeploymentManager getDeploymentManager();

153

public AppProvider getAppProvider();

154

public Path getPath();

155

public String getContextPath();

156

public ContextHandler getContextHandler() throws Exception;

157

public Map<String, String> getProperties();

158

}

159

160

public static class DeploymentManager.AppEntry {

161

public App getApp();

162

public Node getLifecyleNode();

163

public Map<Node, Long> getStateTimestamps();

164

public int getVersion();

165

}

166

```

167

168

### Lifecycle Types

169

170

```java { .api }

171

public interface AppLifeCycle.Binding {

172

String[] getBindingTargets();

173

void processBinding(Node node, App app) throws Exception;

174

}

175

```

176

177

### Graph Types

178

179

```java { .api }

180

public final class Edge {

181

public Edge(Node from, Node to);

182

public Node getFrom();

183

public Node getTo();

184

}

185

186

public class Route {

187

public Route();

188

public void add(Edge edge);

189

public List<Node> getNodes();

190

public Node firstNode();

191

public Node lastNode();

192

public boolean isEmpty();

193

}

194

```