Class DriverFiles
driver.file. data source options.
Some JDBC drivers — the CData drivers in particular — take configuration through properties whose value is a
path on the machine running the driver rather than the configuration itself. The CData REST driver's
Location (a directory of .rsd schema files) and OAuthJWTCert (a certificate file) are
typical. Passing those through as ext.-prefixed options requires the client to have filesystem access to
the Stardog server, which a client of a hosted Stardog does not have, and makes the data source definition
node-local rather than something that replicates with the rest of the registry.
The driver.file. options let a client supply the contents instead. Stardog writes them into a
directory of its own and sets the driver property to the path of what it wrote there, a file or a directory
depending on the form the option takes, so the definition stays portable:
# a single file: the driver property is set to the path of a file holding this content driver.file.OAuthJWTCert = -----BEGIN PRIVATE KEY----- ... # a directory: the part after '/' is the entry's path within the materialized directory, and the # driver property is set to the path of the directory itself driver.file.Location/people.rsd = <rsd content> driver.file.Location/cars.rsd = <rsd content> # binary content, base64-encoded driver.file.base64.SSLClientCert = MIIKuAIBAzCCCnQGCS ...A
driver.file. option takes precedence over the ext. option for the same driver property, which
continues to work for deployments where server-side paths are available.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne file supplied by the client, destined for a single driver property. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMarker followingPREFIXindicating the value is base64-encoded rather than UTF-8 text.static final charSeparates the driver property name from an entry's path within a directory-valued property.Driver properties that take a local target as readily as a remote one, so that neither the name nor the shape of the value alone says whether the driver will go to the network or to the disk.static final intCap on the total decoded content one data source may supply.Driver properties whose value is itself a list of driver properties, so that setting one is a way to set any of the others without naming them whererejectServerPaths(java.util.Map<?, ?>)would look.Driver properties whose value is a path to a file or directory on the machine running the driver, and which therefore have to be supplied as content when the server's filesystem is not available to the client.static final StringPrefix identifying an option whose value is the content of a file the driver expects a path to.Driver properties naming a file the driver writes, rather than one it reads. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcontentHash(String dataSourceName, SortedMap<String, List<DriverFiles.Entry>> files) A hash of a data source's parsed content, stable across servers and restarts, used to name the directory the content is materialized into.static booleanhasDriverFiles(Map<?, ?> dsOptions) Whether any of the supplied data source options is adriver.file.option.static booleanisDirectory(List<DriverFiles.Entry> entries) Whether the property was supplied as a directory of entries rather than as a single file.static booleanisDriverFileKey(Object key) Whether the option is adriver.file.option.static SortedMap<String, List<DriverFiles.Entry>> Parses thedriver.file.options into the files to materialize, grouped by driver property.static voidrejectServerPaths(Map<?, ?> dsOptions) Rejects the data source options that would have a JDBC driver read from or write to the Stardog server's filesystem, for deployments where that filesystem is not the client's.
-
Field Details
-
PREFIX
Prefix identifying an option whose value is the content of a file the driver expects a path to.- See Also:
-
BASE64_MARKER
Marker followingPREFIXindicating the value is base64-encoded rather than UTF-8 text. No driver property may be namedbase64.<something>; the token is reserved.- See Also:
-
ENTRY_SEPARATOR
public static final char ENTRY_SEPARATORSeparates the driver property name from an entry's path within a directory-valued property.- See Also:
-
MAX_TOTAL_BYTES
public static final int MAX_TOTAL_BYTESCap on the total decoded content one data source may supply. The content is stored — encrypted — as a single literal in the system database and replicated to every node in the cluster, so it is not a place for bulk data.- See Also:
-
PATH_VALUED_PROPERTIES
Driver properties whose value is a path to a file or directory on the machine running the driver, and which therefore have to be supplied as content when the server's filesystem is not available to the client.Compiled from the connection properties of the CData drivers Stardog bundles, which share property names, plus the file-valued properties of the other drivers Stardog is commonly configured with. Matched ignoring case, as the drivers themselves treat property names. Best effort: a driver property not listed here is not restricted, so keep this in step with the drivers as they add properties.
-
WRITE_TARGET_PROPERTIES
Driver properties naming a file the driver writes, rather than one it reads.Refused outright while server file paths are disabled, in every form, because none of them has an answer here. A path on the server is what the policy exists to prevent. And supplying the contents, which is what the other path-valued properties are told to do, makes no sense for a file whose contents the driver produces: the driver would write its log into the materialized directory, where nothing reads it, nothing bounds its size, and whatever the driver's verbosity puts in it, connection strings and tokens among it, stays until the data source is removed.
-
NESTED_PROPERTIES
Driver properties whose value is itself a list of driver properties, so that setting one is a way to set any of the others without naming them whererejectServerPaths(java.util.Map<?, ?>)would look.The CData drivers'
Otheris the one Stardog is used with: the driver documents it as "additional hidden properties for specific use cases", andOther=RecordToFile=/var/opt/stardog/xwrites the socket trace to a file of the client's choosing. Rejected outright rather than picked apart, which would mean parsing the driver's own escaping, and no deployment that has just declared the server filesystem off limits has a use for it. -
LOCAL_OR_REMOTE_PROPERTIES
Driver properties that take a local target as readily as a remote one, so that neither the name nor the shape of the value alone says whether the driver will go to the network or to the disk.The CData REST driver's
URIis the one Stardog is used with: it reads/etc/shadowoff the disk as readily as it fetches anhttp://URL, and it does so while generating the mappings, before any query is run. It cannot go inPATH_VALUED_PROPERTIES, which would forbid the remote use it is normally put to, so its value is what gets looked at.
-
-
Method Details
-
rejectServerPaths
Rejects the data source options that would have a JDBC driver read from or write to the Stardog server's filesystem, for deployments where that filesystem is not the client's. What those options configured has to be supplied as content, with the correspondingPREFIXoption, instead.A driver property reaches the driver three ways, and all three are checked: an
ext.option, apassthrough.option, whichOAuthPassthroughDataSourcehands to the driver with the prefix stripped, and the JDBC URL, which for the CData drivers carries the same properties inline —jdbc:rest:Location=/srv/schemas;Format=JSONsets the propertyext.Locationwould.Two rules, because neither covers the other. A property in
PATH_VALUED_PROPERTIESmay not be set at all, whatever its value. And no value reaching the driver may be afile:URL, whichever property carries it: a property that usually names something remote often takes a local file just as happily, as the CData REST driver'sURIdoes, so it cannot be listed but must not be pointed at the server.Best effort, like
PATH_VALUED_PROPERTIESitself. In particular a JDBC URL that takes a path positionally rather than as a named property, asjdbc:h2:/var/data/dbdoes, is not recognized here; restricting that means restricting which drivers a deployment offers at all.- Throws:
StardogException- if an option configures the driver with a path on this server
-
isDriverFileKey
Whether the option is adriver.file.option. Such options are consumed byDriverFileStoreand never reach the driver. -
hasDriverFiles
Whether any of the supplied data source options is adriver.file.option. -
parse
Parses thedriver.file.options into the files to materialize, grouped by driver property. Properties and the entries within each are ordered by name so that the result is a canonical representation of the content, suitable forcontentHash(java.lang.String, java.util.SortedMap<java.lang.String, java.util.List<com.complexible.stardog.virtual.api.DriverFiles.Entry>>).- Throws:
StardogException- if an option is malformed, if a property mixes the single-file and directory forms, or if the total content exceedsMAX_TOTAL_BYTES
-
isDirectory
Whether the property was supplied as a directory of entries rather than as a single file. Only valid for a list that has been throughvalidateProperty(java.lang.String, java.util.List<com.complexible.stardog.virtual.api.DriverFiles.Entry>). -
contentHash
public static String contentHash(String dataSourceName, SortedMap<String, List<DriverFiles.Entry>> files) A hash of a data source's parsed content, stable across servers and restarts, used to name the directory the content is materialized into. Changing any property, path or byte changes the hash and so the directory, which keeps an updated data source from disturbing the files a previous version is still using.The data source name is part of the hash so that a directory belongs to exactly one data source, even when two names are indistinguishable once reduced to something a directory can be named after. That is what lets the files be removed along with the data source that supplied them.
-