• 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

52.63
/src/main/java/org/w3id/cwl/cwl1_2/DirectoryImpl.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#Directory</I><BR> <BLOCKQUOTE>
25
 Represents a directory to present to a command line tool.
26
 
27
 Directories are represented as objects with `class` of `Directory`.  Directory objects have
28
 a number of properties that provide metadata about the directory.
29
 
30
 The `location` property of a Directory is a IRI that uniquely identifies
31
 the directory.  Implementations must support the file:// IRI scheme and may
32
 support other schemes such as http://.  Alternately to `location`,
33
 implementations must also accept the `path` property on Directory, which
34
 must be a filesystem path available on the same host as the CWL runner (for
35
 inputs) or the runtime environment of a command line tool execution (for
36
 command line tool outputs).
37
 
38
 A Directory object may have a `listing` field.  This is a list of File and
39
 Directory objects that are contained in the Directory.  For each entry in
40
 `listing`, the `basename` property defines the name of the File or
41
 Subdirectory when staged to disk.  If `listing` is not provided, the
42
 implementation must have some way of fetching the Directory listing at
43
 runtime based on the `location` field.
44
 
45
 If a Directory does not have `location`, it is a Directory literal.  A
46
 Directory literal must provide `listing`.  Directory literals must be
47
 created on disk at runtime as needed.
48
 
49
 The resources in a Directory literal do not need to have any implied
50
 relationship in their `location`.  For example, a Directory listing may
51
 contain two files located on different hosts.  It is the responsibility of
52
 the runtime to ensure that those files are staged to disk appropriately.
53
 Secondary files associated with files in `listing` must also be staged to
54
 the same Directory.
55
 
56
 When executing a CommandLineTool, Directories must be recursively staged
57
 first and have local values of `path` assigned.
58
 
59
 Directory objects in CommandLineTool output must provide either a
60
 `location` IRI or a `path` property in the context of the tool execution
61
 runtime (local to the compute node, or within the executing container).
62
 
63
 An ExpressionTool may forward file references from input to output by using
64
 the same value for `location`.
65
 
66
 Name conflicts (the same `basename` appearing multiple times in `listing`
67
 or in any entry in `secondaryFiles` in the listing) is a fatal error.
68
  </BLOCKQUOTE>
69
 */
70
public class DirectoryImpl extends SaveableImpl implements Directory {
71
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
72
  private java.util.Map<String, Object> extensionFields_ =
1✔
73
      new java.util.HashMap<String, Object>();
74
  public LoadingOptions getLoadingOptions() {
NEW
75
    return this.loadingOptions_;
×
76
  }
77
  public java.util.Map<String, Object> getExtensionFields() {
78
    return this.extensionFields_;
×
79
  }
80

81
  private Directory_class class_;
82

83
  /**
84
   * Getter for property <I>https://w3id.org/cwl/cwl#Directory/class</I><BR>
85
   * <BLOCKQUOTE>
86
   * Must be `Directory` to indicate this object describes a Directory.   * </BLOCKQUOTE>
87
   */
88

89
  public Directory_class getClass_() {
90
    return this.class_;
×
91
  }
92

93
  private java.util.Optional<String> location;
94

95
  /**
96
   * Getter for property <I>https://w3id.org/cwl/cwl#Directory/location</I><BR>
97
   * <BLOCKQUOTE>
98
   * An IRI that identifies the directory resource.  This may be a relative
99
   * reference, in which case it must be resolved using the base IRI of the
100
   * document.  The location may refer to a local or remote resource.  If
101
   * the `listing` field is not set, the implementation must use the
102
   * location IRI to retrieve directory listing.  If an implementation is
103
   * unable to retrieve the directory listing stored at a remote resource (due to
104
   * unsupported protocol, access denied, or other issue) it must signal an
105
   * error.
106
   * 
107
   * If the `location` field is not provided, the `listing` field must be
108
   * provided.  The implementation must assign a unique identifier for
109
   * the `location` field.
110
   * 
111
   * If the `path` field is provided but the `location` field is not, an
112
   * implementation may assign the value of the `path` field to `location`,
113
   * then follow the rules above.
114
   *    * </BLOCKQUOTE>
115
   */
116

117
  public java.util.Optional<String> getLocation() {
118
    return this.location;
×
119
  }
120

121
  private java.util.Optional<String> path;
122

123
  /**
124
   * Getter for property <I>https://w3id.org/cwl/cwl#path</I><BR>
125
   * <BLOCKQUOTE>
126
   * The local path where the Directory is made available prior to executing a
127
   * CommandLineTool.  This must be set by the implementation.  This field
128
   * must not be used in any other context.  The command line tool being
129
   * executed must be able to access the directory at `path` using the POSIX
130
   * `opendir(2)` syscall.
131
   * 
132
   * If the `path` contains [POSIX shell metacharacters](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02)
133
   * (`|`,`&`, `;`, `<`, `>`, `(`,`)`, `$`,`` ` ``, `\`, `"`, `'`,
134
   * `<space>`, `<tab>`, and `<newline>`) or characters
135
   * [not allowed](http://www.iana.org/assignments/idna-tables-6.3.0/idna-tables-6.3.0.xhtml)
136
   * for [Internationalized Domain Names for Applications](https://tools.ietf.org/html/rfc6452)
137
   * then implementations may terminate the process with a
138
   * `permanentFailure`.
139
   *    * </BLOCKQUOTE>
140
   */
141

142
  public java.util.Optional<String> getPath() {
143
    return this.path;
×
144
  }
145

146
  private java.util.Optional<String> basename;
147

148
  /**
149
   * Getter for property <I>https://w3id.org/cwl/cwl#Directory/basename</I><BR>
150
   * <BLOCKQUOTE>
151
   * The base name of the directory, that is, the name of the file without any
152
   * leading directory path.  The base name must not contain a slash `/`.
153
   * 
154
   * If not provided, the implementation must set this field based on the
155
   * `location` field by taking the final path component after parsing
156
   * `location` as an IRI.  If `basename` is provided, it is not required to
157
   * match the value from `location`.
158
   * 
159
   * When this file is made available to a CommandLineTool, it must be named
160
   * with `basename`, i.e. the final component of the `path` field must match
161
   * `basename`.
162
   *    * </BLOCKQUOTE>
163
   */
164

165
  public java.util.Optional<String> getBasename() {
166
    return this.basename;
×
167
  }
168

169
  private java.util.Optional<java.util.List<Object>> listing;
170

171
  /**
172
   * Getter for property <I>https://w3id.org/cwl/cwl#listing</I><BR>
173
   * <BLOCKQUOTE>
174
   * List of files or subdirectories contained in this directory.  The name
175
   * of each file or subdirectory is determined by the `basename` field of
176
   * each `File` or `Directory` object.  It is an error if a `File` shares a
177
   * `basename` with any other entry in `listing`.  If two or more
178
   * `Directory` object share the same `basename`, this must be treated as
179
   * equivalent to a single subdirectory with the listings recursively
180
   * merged.
181
   *    * </BLOCKQUOTE>
182
   */
183

184
  public java.util.Optional<java.util.List<Object>> getListing() {
185
    return this.listing;
×
186
  }
187

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

231
    if (__doc.containsKey("location")) {
1✔
232
      try {
233
        location =
1✔
234
            LoaderInstances
235
                .uri_optional_StringInstance_False_False_None_None
236
                .loadField(__doc.get("location"), __baseUri, __loadingOptions);
1✔
237
      } catch (ValidationException e) {
×
238
        location = null; // won't be used but prevents compiler from complaining.
×
239
        final String __message = "the `location` field is not valid because:";
×
240
        __errors.add(new ValidationException(__message, e));
×
241
      }
1✔
242

243
    } else {
244
      location = null;
1✔
245
    }
246
    java.util.Optional<String> path;
247

248
    if (__doc.containsKey("path")) {
1✔
249
      try {
250
        path =
×
251
            LoaderInstances
252
                .uri_optional_StringInstance_False_False_None_None
253
                .loadField(__doc.get("path"), __baseUri, __loadingOptions);
×
254
      } catch (ValidationException e) {
×
255
        path = null; // won't be used but prevents compiler from complaining.
×
256
        final String __message = "the `path` field is not valid because:";
×
257
        __errors.add(new ValidationException(__message, e));
×
258
      }
×
259

260
    } else {
261
      path = null;
1✔
262
    }
263
    java.util.Optional<String> basename;
264

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

277
    } else {
278
      basename = null;
1✔
279
    }
280
    java.util.Optional<java.util.List<Object>> listing;
281

282
    if (__doc.containsKey("listing")) {
1✔
283
      try {
284
        listing =
×
285
            LoaderInstances
286
                .optional_array_of_union_of_File_or_Directory
287
                .loadField(__doc.get("listing"), __baseUri, __loadingOptions);
×
288
      } catch (ValidationException e) {
×
289
        listing = null; // won't be used but prevents compiler from complaining.
×
290
        final String __message = "the `listing` field is not valid because:";
×
291
        __errors.add(new ValidationException(__message, e));
×
292
      }
×
293

294
    } else {
295
      listing = null;
1✔
296
    }
297
    if (!__errors.isEmpty()) {
1✔
298
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
299
    }
300
    this.class_ = (Directory_class) class_;
1✔
301
    this.location = (java.util.Optional<String>) location;
1✔
302
    this.path = (java.util.Optional<String>) path;
1✔
303
    this.basename = (java.util.Optional<String>) basename;
1✔
304
    this.listing = (java.util.Optional<java.util.List<Object>>) listing;
1✔
305
    for (String field:__doc.keySet()) {
1✔
306
      if (!attrs.contains(field)) {
1✔
NEW
307
        if (field.contains(":")) {
×
NEW
308
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
309
          extensionFields_.put(expanded_field, __doc.get(field));
×
310
        }
311
      }
312
    }
1✔
313
  }
1✔
314
  private java.util.List<String> attrs = java.util.Arrays.asList("class", "location", "path", "basename", "listing");
1✔
315
}
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