• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #389

30 Oct 2025 05:13PM UTC coverage: 58.693% (-0.8%) from 59.538%
#389

Pull #218

github

web-flow
Merge 98b159202 into befd7e4b9
Pull Request #218: Populate the extensionFields; add public accessors for LoadingOptions

230 of 569 new or added lines in 67 files covered. (40.42%)

28 existing lines in 27 files now uncovered.

7535 of 12838 relevant lines covered (58.69%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/main/java/org/w3id/cwl/cwl1_2/DockerRequirementImpl.java
1
// Copyright Common Workflow Language project contributors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package org.w3id.cwl.cwl1_2;
16

17
import org.w3id.cwl.cwl1_2.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_2.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_2.utils.SaveableImpl;
21
import org.w3id.cwl.cwl1_2.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#DockerRequirement</I><BR> <BLOCKQUOTE>
25
 Indicates that a workflow component should be run in a
26
 [Docker](https://docker.com) or Docker-compatible (such as
27
 [Singularity](https://www.sylabs.io/) and [udocker](https://github.com/indigo-dc/udocker)) container environment and
28
 specifies how to fetch or build the image.
29
 
30
 If a CommandLineTool lists `DockerRequirement` under
31
 `hints` (or `requirements`), it may (or must) be run in the specified Docker
32
 container.
33
 
34
 The platform must first acquire or install the correct Docker image as
35
 specified by `dockerPull`, `dockerImport`, `dockerLoad` or `dockerFile`.
36
 
37
 The platform must execute the tool in the container using `docker run` with
38
 the appropriate Docker image and tool command line.
39
 
40
 The workflow platform may provide input files and the designated output
41
 directory through the use of volume bind mounts.  The platform should rewrite
42
 file paths in the input object to correspond to the Docker bind mounted
43
 locations. That is, the platform should rewrite values in the parameter context
44
 such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths
45
 within the container. The platform must ensure that `runtime.outdir` and
46
 `runtime.tmpdir` are distinct directories.
47
 
48
 When running a tool contained in Docker, the workflow platform must not
49
 assume anything about the contents of the Docker container, such as the
50
 presence or absence of specific software, except to assume that the
51
 generated command line represents a valid command within the runtime
52
 environment of the container.
53
 
54
 A container image may specify an
55
 [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#entrypoint)
56
 and/or
57
 [CMD](https://docs.docker.com/engine/reference/builder/#cmd).
58
 Command line arguments will be appended after all elements of
59
 ENTRYPOINT, and will override all elements specified using CMD (in
60
 other words, CMD is only used when the CommandLineTool definition
61
 produces an empty command line).
62
 
63
 Use of implicit ENTRYPOINT or CMD are discouraged due to reproducibility
64
 concerns of the implicit hidden execution point (For further discussion, see
65
 [https://doi.org/10.12688/f1000research.15140.1](https://doi.org/10.12688/f1000research.15140.1)). Portable
66
 CommandLineTool wrappers in which use of a container is optional must not rely on ENTRYPOINT or CMD.
67
 CommandLineTools which do rely on ENTRYPOINT or CMD must list `DockerRequirement` in the
68
 `requirements` section.
69
 
70
 ## Interaction with other requirements
71
 
72
 If [EnvVarRequirement](#EnvVarRequirement) is specified alongside a
73
 DockerRequirement, the environment variables must be provided to Docker
74
 using `--env` or `--env-file` and interact with the container's preexisting
75
 environment as defined by Docker.
76
  </BLOCKQUOTE>
77
 */
78
public class DockerRequirementImpl extends SaveableImpl implements DockerRequirement {
79
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
80
  private java.util.Map<String, Object> extensionFields_ =
1✔
81
      new java.util.HashMap<String, Object>();
82
  public LoadingOptions getLoadingOptions() {
NEW
83
    return this.loadingOptions_;
×
84
  }
85
  public java.util.Map<String, Object> getExtensionFields() {
86
    return this.extensionFields_;
×
87
  }
88

89
  private DockerRequirement_class class_;
90

91
  /**
92
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/class</I><BR>
93
   * <BLOCKQUOTE>
94
   * Always 'DockerRequirement'   * </BLOCKQUOTE>
95
   */
96

97
  public DockerRequirement_class getClass_() {
98
    return this.class_;
×
99
  }
100

101
  private java.util.Optional<String> dockerPull;
102

103
  /**
104
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerPull</I><BR>
105
   * <BLOCKQUOTE>
106
   * Specify a Docker image to retrieve using `docker pull`. Can contain the
107
   * immutable digest to ensure an exact container is used:
108
   * `dockerPull: ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2`
109
   *    * </BLOCKQUOTE>
110
   */
111

112
  public java.util.Optional<String> getDockerPull() {
113
    return this.dockerPull;
×
114
  }
115

116
  private java.util.Optional<String> dockerLoad;
117

118
  /**
119
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerLoad</I><BR>
120
   * <BLOCKQUOTE>
121
   * Specify an HTTP URL from which to download a Docker image using `docker load`.   * </BLOCKQUOTE>
122
   */
123

124
  public java.util.Optional<String> getDockerLoad() {
125
    return this.dockerLoad;
×
126
  }
127

128
  private java.util.Optional<String> dockerFile;
129

130
  /**
131
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerFile</I><BR>
132
   * <BLOCKQUOTE>
133
   * Supply the contents of a Dockerfile which will be built using `docker build`.   * </BLOCKQUOTE>
134
   */
135

136
  public java.util.Optional<String> getDockerFile() {
137
    return this.dockerFile;
×
138
  }
139

140
  private java.util.Optional<String> dockerImport;
141

142
  /**
143
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerImport</I><BR>
144
   * <BLOCKQUOTE>
145
   * Provide HTTP URL to download and gunzip a Docker images using `docker import.   * </BLOCKQUOTE>
146
   */
147

148
  public java.util.Optional<String> getDockerImport() {
149
    return this.dockerImport;
×
150
  }
151

152
  private java.util.Optional<String> dockerImageId;
153

154
  /**
155
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerImageId</I><BR>
156
   * <BLOCKQUOTE>
157
   * The image id that will be used for `docker run`.  May be a
158
   * human-readable image name or the image identifier hash.  May be skipped
159
   * if `dockerPull` is specified, in which case the `dockerPull` image id
160
   * must be used.
161
   *    * </BLOCKQUOTE>
162
   */
163

164
  public java.util.Optional<String> getDockerImageId() {
165
    return this.dockerImageId;
×
166
  }
167

168
  private java.util.Optional<String> dockerOutputDirectory;
169

170
  /**
171
   * Getter for property <I>https://w3id.org/cwl/cwl#DockerRequirement/dockerOutputDirectory</I><BR>
172
   * <BLOCKQUOTE>
173
   * Set the designated output directory to a specific location inside the
174
   * Docker container.
175
   *    * </BLOCKQUOTE>
176
   */
177

178
  public java.util.Optional<String> getDockerOutputDirectory() {
179
    return this.dockerOutputDirectory;
×
180
  }
181

182
  /**
183
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of DockerRequirementImpl.
184
   *
185
   * @param __doc_            Document fragment to load this record object from (presumably a
186
                              {@link java.util.Map}).
187
   * @param __baseUri_        Base URI to generate child document IDs against.
188
   * @param __loadingOptions  Context for loading URIs and populating objects.
189
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
190
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
191
   *                             or validation of fields fails.
192
   */
193
  public DockerRequirementImpl(
194
      final Object __doc_,
195
      final String __baseUri_,
196
      LoadingOptions __loadingOptions,
197
      final String __docRoot_) {
198
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
199
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
200
    // generated names.
201
    String __baseUri = __baseUri_;
1✔
202
    String __docRoot = __docRoot_;
1✔
203
    if (!(__doc_ instanceof java.util.Map)) {
1✔
204
      throw new ValidationException("DockerRequirementImpl called on non-map");
×
205
    }
206
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
207
    final java.util.List<ValidationException> __errors =
1✔
208
        new java.util.ArrayList<ValidationException>();
209
    if (__loadingOptions != null) {
1✔
210
      this.loadingOptions_ = __loadingOptions;
1✔
211
    }
212
    DockerRequirement_class class_;
213
    try {
214
      class_ =
1✔
215
          LoaderInstances
216
              .uri_DockerRequirement_class_False_True_None_None
217
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
218
    } catch (ValidationException e) {
1✔
219
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
220
      final String __message = "the `class` field is not valid because:";
1✔
221
      __errors.add(new ValidationException(__message, e));
1✔
222
    }
1✔
223
    java.util.Optional<String> dockerPull;
224

225
    if (__doc.containsKey("dockerPull")) {
1✔
226
      try {
227
        dockerPull =
1✔
228
            LoaderInstances
229
                .optional_StringInstance
230
                .loadField(__doc.get("dockerPull"), __baseUri, __loadingOptions);
1✔
231
      } catch (ValidationException e) {
×
232
        dockerPull = null; // won't be used but prevents compiler from complaining.
×
233
        final String __message = "the `dockerPull` field is not valid because:";
×
234
        __errors.add(new ValidationException(__message, e));
×
235
      }
1✔
236

237
    } else {
238
      dockerPull = null;
1✔
239
    }
240
    java.util.Optional<String> dockerLoad;
241

242
    if (__doc.containsKey("dockerLoad")) {
1✔
243
      try {
244
        dockerLoad =
×
245
            LoaderInstances
246
                .optional_StringInstance
247
                .loadField(__doc.get("dockerLoad"), __baseUri, __loadingOptions);
×
248
      } catch (ValidationException e) {
×
249
        dockerLoad = null; // won't be used but prevents compiler from complaining.
×
250
        final String __message = "the `dockerLoad` field is not valid because:";
×
251
        __errors.add(new ValidationException(__message, e));
×
252
      }
×
253

254
    } else {
255
      dockerLoad = null;
1✔
256
    }
257
    java.util.Optional<String> dockerFile;
258

259
    if (__doc.containsKey("dockerFile")) {
1✔
260
      try {
261
        dockerFile =
×
262
            LoaderInstances
263
                .optional_StringInstance
264
                .loadField(__doc.get("dockerFile"), __baseUri, __loadingOptions);
×
265
      } catch (ValidationException e) {
×
266
        dockerFile = null; // won't be used but prevents compiler from complaining.
×
267
        final String __message = "the `dockerFile` field is not valid because:";
×
268
        __errors.add(new ValidationException(__message, e));
×
269
      }
×
270

271
    } else {
272
      dockerFile = null;
1✔
273
    }
274
    java.util.Optional<String> dockerImport;
275

276
    if (__doc.containsKey("dockerImport")) {
1✔
277
      try {
278
        dockerImport =
×
279
            LoaderInstances
280
                .optional_StringInstance
281
                .loadField(__doc.get("dockerImport"), __baseUri, __loadingOptions);
×
282
      } catch (ValidationException e) {
×
283
        dockerImport = null; // won't be used but prevents compiler from complaining.
×
284
        final String __message = "the `dockerImport` field is not valid because:";
×
285
        __errors.add(new ValidationException(__message, e));
×
286
      }
×
287

288
    } else {
289
      dockerImport = null;
1✔
290
    }
291
    java.util.Optional<String> dockerImageId;
292

293
    if (__doc.containsKey("dockerImageId")) {
1✔
294
      try {
295
        dockerImageId =
×
296
            LoaderInstances
297
                .optional_StringInstance
298
                .loadField(__doc.get("dockerImageId"), __baseUri, __loadingOptions);
×
299
      } catch (ValidationException e) {
×
300
        dockerImageId = null; // won't be used but prevents compiler from complaining.
×
301
        final String __message = "the `dockerImageId` field is not valid because:";
×
302
        __errors.add(new ValidationException(__message, e));
×
303
      }
×
304

305
    } else {
306
      dockerImageId = null;
1✔
307
    }
308
    java.util.Optional<String> dockerOutputDirectory;
309

310
    if (__doc.containsKey("dockerOutputDirectory")) {
1✔
311
      try {
312
        dockerOutputDirectory =
1✔
313
            LoaderInstances
314
                .optional_StringInstance
315
                .loadField(__doc.get("dockerOutputDirectory"), __baseUri, __loadingOptions);
1✔
316
      } catch (ValidationException e) {
×
317
        dockerOutputDirectory = null; // won't be used but prevents compiler from complaining.
×
318
        final String __message = "the `dockerOutputDirectory` field is not valid because:";
×
319
        __errors.add(new ValidationException(__message, e));
×
320
      }
1✔
321

322
    } else {
323
      dockerOutputDirectory = null;
1✔
324
    }
325
    if (!__errors.isEmpty()) {
1✔
326
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
327
    }
328
    this.class_ = (DockerRequirement_class) class_;
1✔
329
    this.dockerPull = (java.util.Optional<String>) dockerPull;
1✔
330
    this.dockerLoad = (java.util.Optional<String>) dockerLoad;
1✔
331
    this.dockerFile = (java.util.Optional<String>) dockerFile;
1✔
332
    this.dockerImport = (java.util.Optional<String>) dockerImport;
1✔
333
    this.dockerImageId = (java.util.Optional<String>) dockerImageId;
1✔
334
    this.dockerOutputDirectory = (java.util.Optional<String>) dockerOutputDirectory;
1✔
335
    for (String field:__doc.keySet()) {
1✔
336
      if (!attrs.contains(field)) {
1✔
NEW
337
        if (field.contains(":")) {
×
NEW
338
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
339
          extensionFields_.put(expanded_field, __doc.get(field));
×
340
        }
341
      }
342
    }
1✔
343
  }
1✔
344
  private java.util.List<String> attrs = java.util.Arrays.asList("class", "dockerPull", "dockerLoad", "dockerFile", "dockerImport", "dockerImageId", "dockerOutputDirectory");
1✔
345
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc