1
2
3
4
5
6 package gov.nist.secauto.metaschema.core.metapath;
7
8 import gov.nist.secauto.metaschema.core.metapath.item.node.IDocumentNodeItem;
9 import gov.nist.secauto.metaschema.core.model.IResourceResolver;
10 import gov.nist.secauto.metaschema.core.model.IUriResolver;
11 import gov.nist.secauto.metaschema.core.util.ObjectUtils;
12
13 import java.io.File;
14 import java.io.IOException;
15 import java.net.URI;
16 import java.net.URISyntaxException;
17 import java.net.URL;
18 import java.nio.file.Path;
19
20 import edu.umd.cs.findbugs.annotations.NonNull;
21
22
23
24
25 public interface IDocumentLoader extends IResourceResolver {
26
27
28
29
30
31
32
33 void setUriResolver(@NonNull IUriResolver resolver);
34
35
36
37
38
39
40
41
42
43
44 @NonNull
45 default IDocumentNodeItem loadAsNodeItem(@NonNull File file) throws IOException {
46 return loadAsNodeItem(ObjectUtils.notNull(file.toPath()));
47 }
48
49
50
51
52
53
54
55
56
57
58 @NonNull
59 default IDocumentNodeItem loadAsNodeItem(@NonNull Path path) throws IOException {
60 return loadAsNodeItem(ObjectUtils.notNull(path.toUri()));
61 }
62
63
64
65
66
67
68
69
70
71
72
73
74 @NonNull
75 default IDocumentNodeItem loadAsNodeItem(@NonNull URL url) throws IOException, URISyntaxException {
76 return loadAsNodeItem(ObjectUtils.notNull(url.toURI()));
77 }
78
79
80
81
82
83
84
85
86
87
88
89
90 @NonNull
91 IDocumentNodeItem loadAsNodeItem(@NonNull URI uri) throws IOException;
92 }