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

common-workflow-language / cwljava / #352

07 Apr 2025 10:22AM UTC coverage: 59.538% (-0.6%) from 60.167%
#352

Pull #193

github

web-flow
Merge d636f9333 into 46536cad2
Pull Request #193: Add accessor for the extension field.

0 of 129 new or added lines in 129 files covered. (0.0%)

7347 of 12340 relevant lines covered (59.54%)

0.6 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_1/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_1;
16

17
import org.w3id.cwl.cwl1_1.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_1.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_1.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_1.utils.SaveableImpl;
21
import org.w3id.cwl.cwl1_1.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](http://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 java.util.Map<String, Object> getExtensionFields() {
NEW
83
    return this.extensionFields_;
×
84
  }
85

86
  private DockerRequirement_class class_;
87

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

94
  public DockerRequirement_class getClass_() {
95
    return this.class_;
×
96
  }
97

98
  private java.util.Optional<String> dockerPull;
99

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

109
  public java.util.Optional<String> getDockerPull() {
110
    return this.dockerPull;
×
111
  }
112

113
  private java.util.Optional<String> dockerLoad;
114

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

121
  public java.util.Optional<String> getDockerLoad() {
122
    return this.dockerLoad;
×
123
  }
124

125
  private java.util.Optional<String> dockerFile;
126

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

133
  public java.util.Optional<String> getDockerFile() {
134
    return this.dockerFile;
×
135
  }
136

137
  private java.util.Optional<String> dockerImport;
138

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

145
  public java.util.Optional<String> getDockerImport() {
146
    return this.dockerImport;
×
147
  }
148

149
  private java.util.Optional<String> dockerImageId;
150

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

161
  public java.util.Optional<String> getDockerImageId() {
162
    return this.dockerImageId;
×
163
  }
164

165
  private java.util.Optional<String> dockerOutputDirectory;
166

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

175
  public java.util.Optional<String> getDockerOutputDirectory() {
176
    return this.dockerOutputDirectory;
×
177
  }
178

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

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

234
    } else {
235
      dockerPull = null;
1✔
236
    }
237
    java.util.Optional<String> dockerLoad;
238

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

251
    } else {
252
      dockerLoad = null;
1✔
253
    }
254
    java.util.Optional<String> dockerFile;
255

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

268
    } else {
269
      dockerFile = null;
1✔
270
    }
271
    java.util.Optional<String> dockerImport;
272

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

285
    } else {
286
      dockerImport = null;
1✔
287
    }
288
    java.util.Optional<String> dockerImageId;
289

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

302
    } else {
303
      dockerImageId = null;
1✔
304
    }
305
    java.util.Optional<String> dockerOutputDirectory;
306

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

319
    } else {
320
      dockerOutputDirectory = null;
1✔
321
    }
322
    if (!__errors.isEmpty()) {
1✔
323
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
324
    }
325
    this.class_ = (DockerRequirement_class) class_;
1✔
326
    this.dockerPull = (java.util.Optional<String>) dockerPull;
1✔
327
    this.dockerLoad = (java.util.Optional<String>) dockerLoad;
1✔
328
    this.dockerFile = (java.util.Optional<String>) dockerFile;
1✔
329
    this.dockerImport = (java.util.Optional<String>) dockerImport;
1✔
330
    this.dockerImageId = (java.util.Optional<String>) dockerImageId;
1✔
331
    this.dockerOutputDirectory = (java.util.Optional<String>) dockerOutputDirectory;
1✔
332
  }
1✔
333
}
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