-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
DeploymentDescriptor.java
227 lines (192 loc) · 7.13 KB
/
DeploymentDescriptor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.plugins.ear.descriptor;
import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import org.gradle.api.Action;
import org.gradle.api.XmlProvider;
import java.io.Reader;
import java.io.Writer;
import java.util.Map;
import java.util.Set;
/**
* A deployment descriptor such as application.xml.
*/
public interface DeploymentDescriptor {
/**
* The name of the descriptor file, typically "application.xml"
*/
String getFileName();
void setFileName(String fileName);
/**
* The version of application.xml. Required. Valid versions are "1.3", "1.4", "5", "6", "7", "8", "9" and "10". Defaults to "6".
*/
String getVersion();
void setVersion(String version);
/**
* The application name. Optional. Only valid with version 6.
*/
String getApplicationName();
void setApplicationName(String applicationName);
/**
* Whether to initialize modules in the order they appear in the descriptor, with the exception of client modules.
* Optional. Only valid with version 6.
*/
Boolean getInitializeInOrder();
void setInitializeInOrder(Boolean initializeInOrder);
/**
* The application description. Optional.
*/
String getDescription();
void setDescription(String description);
/**
* The application display name. Optional.
*/
String getDisplayName();
void setDisplayName(String displayName);
/**
* The name of the directory to look for libraries in. Optional. If not specified, {@link org.gradle.plugins.ear.Ear#getLibDirName()} is used.
* Typically, this should be set via {@link org.gradle.plugins.ear.EarPluginConvention#setLibDirName(String)} instead of this property
* when using the <code>ear</code> plugin.
*/
String getLibraryDirectory();
void setLibraryDirectory(String libraryDirectory);
/**
* List of module descriptors. Must not be empty. Non-null and order-maintaining by default. Must maintain order if
* initializeInOrder is <code>true</code>.
*/
Set<EarModule> getModules();
void setModules(Set<EarModule> modules);
/**
* Add a module to the deployment descriptor.
*
* @param module
* The module to add.
* @param type
* The type of the module, such as "ejb", "java", etc.
* @return this.
*/
DeploymentDescriptor module(EarModule module, String type);
/**
* Add a module to the deployment descriptor.
*
* @param path
* The path of the module to add.
* @param type
* The type of the module, such as "ejb", "java", etc.
* @return this.
*/
DeploymentDescriptor module(String path, String type);
/**
* Add a web module to the deployment descriptor.
*
* @param path
* The path of the module to add.
* @param contextRoot
* The context root type of the web module.
* @return this.
*/
DeploymentDescriptor webModule(String path, String contextRoot);
/**
* List of security roles. Optional. Non-null and order-maintaining by default.
*/
Set<EarSecurityRole> getSecurityRoles();
void setSecurityRoles(Set<EarSecurityRole> securityRoles);
/**
* Add a security role to the deployment descriptor.
*
* @param role
* The security role to add.
* @return this.
*/
DeploymentDescriptor securityRole(EarSecurityRole role);
/**
* Add a security role to the deployment descriptor.
*
* @param role
* The name of the security role to add.
* @return this.
*/
DeploymentDescriptor securityRole(String role);
/**
* Add a security role to the deployment descriptor after configuring it with the given action.
*
* @param action an action to configure the security role
* @return this.
*/
DeploymentDescriptor securityRole(Action<? super EarSecurityRole> action);
/**
* Mapping of module paths to module types. Non-null by default. For example, to specify that a module is a java
* module, set <code>moduleTypeMappings["myJavaModule.jar"] = "java"</code>.
*/
Map<String, String> getModuleTypeMappings();
void setModuleTypeMappings(Map<String, String> moduleTypeMappings);
/**
* Adds a closure to be called when the XML document has been created. The XML is passed to the closure as a
* parameter in form of a {@link groovy.util.Node}. The closure can modify the XML before it is written to the
* output file. This allows additional JavaEE version 6 elements like "data-source" or "resource-ref" to be
* included.
*
* @param closure
* The closure to execute when the XML has been created
* @return this
*/
DeploymentDescriptor withXml(@DelegatesTo(XmlProvider.class) Closure closure);
/**
* Adds an action to be called when the XML document has been created. The XML is passed to the action as a
* parameter in form of a {@link groovy.util.Node}. The action can modify the XML before it is written to the output
* file. This allows additional JavaEE version 6 elements like "data-source" or "resource-ref" to be included.
*
* @param action
* The action to execute when the XML has been created
* @return this
*/
DeploymentDescriptor withXml(Action<? super XmlProvider> action);
/**
* Reads the deployment descriptor from a reader.
*
* @param reader
* The reader to read the deployment descriptor from
* @return this
*/
DeploymentDescriptor readFrom(Reader reader);
/**
* Reads the deployment descriptor from a file. The paths are resolved as defined by
* {@link org.gradle.api.Project#file(Object)}
*
* @param path
* The path of the file to read the deployment descriptor from
* @return whether the descriptor could be read from the given path
*/
boolean readFrom(Object path);
/**
* Writes the deployment descriptor into a writer.
*
* @param writer
* The writer to write the deployment descriptor to
* @return this
*/
DeploymentDescriptor writeTo(Writer writer);
/**
* Writes the deployment descriptor into a file. The paths are resolved as defined by
* {@link org.gradle.api.Project#file(Object)}
*
* @param path
* The path of the file to write the deployment descriptor into.
* @return this
*/
DeploymentDescriptor writeTo(Object path);
}