• 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

36.76
/src/main/java/org/w3id/cwl/cwl1_1/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_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#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 URI that uniquely identifies
31
 the directory.  Implementations must support the file:// URI 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` assigend.
58
 
59
 Directory objects in CommandLineTool output must provide either a
60
 `location` URI 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 java.util.Map<String, Object> getExtensionFields() {
NEW
75
    return this.extensionFields_;
×
76
  }
77

78
  private Directory_class class_;
79

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

86
  public Directory_class getClass_() {
87
    return this.class_;
×
88
  }
89

90
  private java.util.Optional<String> location;
91

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

114
  public java.util.Optional<String> getLocation() {
115
    return this.location;
×
116
  }
117

118
  private java.util.Optional<String> path;
119

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

139
  public java.util.Optional<String> getPath() {
140
    return this.path;
×
141
  }
142

143
  private java.util.Optional<String> basename;
144

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

162
  public java.util.Optional<String> getBasename() {
163
    return this.basename;
×
164
  }
165

166
  private java.util.Optional<java.util.List<Object>> listing;
167

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

181
  public java.util.Optional<java.util.List<Object>> getListing() {
182
    return this.listing;
×
183
  }
184

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

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

240
    } else {
241
      location = null;
1✔
242
    }
243
    java.util.Optional<String> path;
244

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

257
    } else {
258
      path = null;
1✔
259
    }
260
    java.util.Optional<String> basename;
261

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

274
    } else {
275
      basename = null;
1✔
276
    }
277
    java.util.Optional<java.util.List<Object>> listing;
278

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

291
    } else {
292
      listing = null;
1✔
293
    }
294
    if (!__errors.isEmpty()) {
1✔
295
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
296
    }
297
    this.class_ = (Directory_class) class_;
×
298
    this.location = (java.util.Optional<String>) location;
×
299
    this.path = (java.util.Optional<String>) path;
×
300
    this.basename = (java.util.Optional<String>) basename;
×
301
    this.listing = (java.util.Optional<java.util.List<Object>>) listing;
×
302
  }
×
303
}
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