org.geotools.xml
Class AppSchemaCache

java.lang.Object
  extended by org.geotools.xml.AppSchemaCache

public class AppSchemaCache
extends java.lang.Object

Cache containing application schemas. (Should also work for other file types.)

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 AppSchemaResolver#getSimpleHttpResourcePath(URI)).

Author:
Ben Caradoc-Davies, CSIRO Earth Science and Resource Engineering

Constructor Summary
AppSchemaCache(java.io.File directory, boolean download)
          A cache of application schemas (or other file types) rooted in the given directory, with optional downloading.
 
Method Summary
static AppSchemaCache buildFromGeoserverUrl(java.net.URL url)
          Search parents of url for a GeoServer data directory.
static void disableGeoserverSupport()
          Turn off support for automatic construction of a cache in GeoServer data directory.
static void enableGeoserverSupport()
          The opposite of disableGeoserverSupport()
 java.io.File getDirectory()
          Return the root directory of the cache.
 boolean isDownloadAllowed()
          Are schemas not already present in the cache downloaded from the network?
static boolean isGeoserverSupportEnabled()
           
 java.lang.String resolveLocation(java.lang.String location)
          Return the local file URL of a schema, downloading it if not found in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppSchemaCache

public AppSchemaCache(java.io.File directory,
                      boolean download)
A cache of application schemas (or other file types) rooted in the given directory, with optional downloading.

Parameters:
directory - the directory in which downloaded schemas are stored
download - is downloading of schemas permitted. If false, only schemas already present in the cache will be resolved.
Method Detail

getDirectory

public java.io.File getDirectory()
Return the root directory of the cache.


isDownloadAllowed

public boolean isDownloadAllowed()
Are schemas not already present in the cache downloaded from the network?


resolveLocation

public java.lang.String resolveLocation(java.lang.String location)
Return the local file URL of a schema, downloading it if not found in the cache.

Parameters:
location - the absolute http/https URL of the schema
Returns:
the local file URL of the schema, or null if not found

buildFromGeoserverUrl

public static AppSchemaCache buildFromGeoserverUrl(java.net.URL url)
Search parents of url for a GeoServer data directory. If found, use it to create a cache in the "app-schema-cache" subdirectory, with downloading enabled.

Parameters:
url - a URL for a file in a GeoServer data directory.
Returns:
a cache in the "app-schema-cache" subdirectory

disableGeoserverSupport

public static void disableGeoserverSupport()
Turn off support for automatic construction of a cache in GeoServer data directory. Intended for testing.


enableGeoserverSupport

public static void enableGeoserverSupport()
The opposite of disableGeoserverSupport()


isGeoserverSupportEnabled

public static boolean isGeoserverSupportEnabled()
See Also:
disableGeoserverSupport()


Copyright © 1996-2010 Geotools. All Rights Reserved.