public class SchemaCache extends Object
If configured to permit downloading, schemas not present in the cache are downloaded from the network.
Only http/https URLs are supported.
Files are stored according to the Simple HTTP Resource Path (see SchemaResolver#getSimpleHttpResourcePath(URI))
.
Modifier and Type | Field and Description |
---|---|
static String |
PROVIDED_CACHE_LOCATION_KEY
Key that should be used to setup a system property that sets the location that should be used
for schema cache location.
|
Constructor and Description |
---|
SchemaCache(File directory,
boolean download)
A cache of XML schemas (or other file types) rooted in the given directory, with optional
downloading.
|
SchemaCache(File directory,
boolean download,
boolean keepQuery)
A cache of XML schemas (or other file types) rooted in the given directory, with optional
downloading.
|
Modifier and Type | Method and Description |
---|---|
static SchemaCache |
buildAutomaticallyConfiguredUsingFileUrl(URL url)
If automatic configuration is enabled, recursively search parent directories of file url for
a GeoServer data directory or directory containing an existing cache.
|
static void |
disableAutomaticConfiguration()
Turn off support for automatic configuration of a cache in GeoServer data directory or
detection of an existing cache.
|
static void |
enableAutomaticConfiguration()
The opposite of
disableAutomaticConfiguration() . |
File |
getDirectory()
Return the root directory of the cache.
|
File |
getTempDirectory()
Return the temp directory for not cached downloads (those occurring during another download,
to avoid conflicts among threads).
|
static boolean |
isAutomaticConfigurationEnabled()
Is automatic configuration enabled?
|
boolean |
isDownloadAllowed()
Are schemas not already present in the cache downloaded from the network?
|
String |
resolveLocation(String location)
Return the local file URL of a schema, downloading it if not found in the cache.
|
public static final String PROVIDED_CACHE_LOCATION_KEY
public SchemaCache(File directory, boolean download)
directory
- the directory in which downloaded schemas are storeddownload
- is downloading of schemas permitted. If false, only schemas already present
in the cache will be resolved.public SchemaCache(File directory, boolean download, boolean keepQuery)
directory
- the directory in which downloaded schemas are storeddownload
- is downloading of schemas permitted. If false, only schemas already present
in the cache will be resolved.keepQuery
- indicates whether or not the query components should be included in the
path. If this is set to true then the query portion is converted to an MD5 message digest
and that string is used to identify the file in the cache.public File getDirectory()
public File getTempDirectory()
public boolean isDownloadAllowed()
public String resolveLocation(String location)
location
- the absolute http/https URL of the schemapublic static SchemaCache buildAutomaticallyConfiguredUsingFileUrl(URL url)
url
- a URL for a file in a GeoServer data directory.public static void disableAutomaticConfiguration()
public static void enableAutomaticConfiguration()
disableAutomaticConfiguration()
. Automatic configuration is enabled
by default.public static boolean isAutomaticConfigurationEnabled()
disableAutomaticConfiguration()
Copyright © 1996–2019 Geotools. All rights reserved.