Package gov.usgs.earthquake.distribution
Class URLProductStorage
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.FileProductStorage
gov.usgs.earthquake.distribution.URLProductStorage
- All Implemented Interfaces:
ProductStorage,Configurable
Store products in a file system which is also available at a URL.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault value for whether to use binary format.static final String(Deprecated, use STORAGE_PATH) Property name to configure binary or xml format.static final StringSets up default storage pathstatic final StringProperty for storageFormatstatic final StringProperty for storagePathstatic final StringProperty name representing base URL.Fields inherited from class gov.usgs.earthquake.distribution.FileProductStorage
DEFAULT_DIRECTORY, DIRECTORY_NAME_LENGTH, DIRECTORY_PROPERTY_NAME, LEGACY_STORAGES_PROPERTY, STORAGE_LISTENER_PROPERTY, USE_ATOMIC_DOWNLOAD_DEFAULT, USE_ATOMIC_DOWNLOAD_PROPERTY, USE_HASH_PATHS_DEFAULT, USE_HASH_PATHS_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the Configurable interface.URLProductStorage(File baseDirectory, URL baseURL) Construct a new ProductStorage object -
Method Summary
Modifier and TypeMethodDescriptionvoidLoad the baseURL from configuration.protected ProductHandlergetProductHandlerFormat(File file) A method for subclasses to override the storage format.A method for subclasses to override the storage path.protected ProductSourcegetProductSourceFormat(File file) A method for subclasses to override the storage format.Compute the URL to a product.voidvoidsetStoragePath(String path) Methods inherited from class gov.usgs.earthquake.distribution.FileProductStorage
addStorageListener, getBaseDirectory, getHashedProductPath, getInMemoryProduct, getKeychain, getLegacyStorages, getNormalProductPath, getProduct, getProductFile, getProductSource, getStorageLocks, getTempProductFile, hasProduct, isRejectInvalidSignatures, isTestSignatures, notifyListeners, removeProduct, removeStorageListener, setBaseDirectory, setKeychain, setRejectInvalidSignatures, setTestSignatures, shutdown, startup, storeProduct, storeProductSourceMethods inherited from class gov.usgs.util.DefaultConfigurable
getName, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.usgs.util.Configurable
getName, setName
-
Field Details
-
URL_PROPERTY_NAME
Property name representing base URL.- See Also:
-
STORAGE_FORMAT_PROPERTY
Property for storageFormat- See Also:
-
STORAGE_PATH_PROPERTY
Property for storagePath- See Also:
-
DEFAULT_STORAGE_PATH
Sets up default storage path- See Also:
-
BINARY_FORMAT_PROPERTY
(Deprecated, use STORAGE_PATH) Property name to configure binary or xml format.- See Also:
-
BINARY_FORMAT_DEFAULT
Default value for whether to use binary format.- See Also:
-
-
Constructor Details
-
URLProductStorage
public URLProductStorage()Constructor for the Configurable interface. -
URLProductStorage
Construct a new ProductStorage object- Parameters:
baseDirectory- the storage directory where products are stored.baseURL- the url where storage directory is available.
-
-
Method Details
-
configure
Load the baseURL from configuration.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classFileProductStorage- Parameters:
config- the configuration object.- Throws:
Exception- if configuration exceptions occur.
-
getProductURL
Compute the URL to a product.- Parameters:
id- which product.- Returns:
- the URL to a product.
- Throws:
Exception- if error occurs
-
getProductPath
A method for subclasses to override the storage path. The returned path is appended to the base directory when storing and retrieving products.- Overrides:
getProductPathin classFileProductStorage- Parameters:
id- the product id to convert.- Returns:
- the directory used to store id.
-
getProductHandlerFormat
A method for subclasses to override the storage format. When overriding this method, the method getProductInputForFile should also be overridden.- Overrides:
getProductHandlerFormatin classFileProductStorage- Parameters:
file- a file that should be converted into a ProductOutput.- Returns:
- the ProductOutput.
- Throws:
Exception- if error occurs
-
getProductSourceFormat
A method for subclasses to override the storage format. When overriding this method, the method getProductOutputForFile should also be overridden.- Overrides:
getProductSourceFormatin classFileProductStorage- Parameters:
file- a file that should be converted into a ProductInput.- Returns:
- the ProductInput.
- Throws:
Exception- if error occurs
-
getStorageFormat
- Returns:
- storageFormat
-
setStorageFormat
- Parameters:
format- set a storageFormat
-
getStoragePath
- Returns:
- storagePath
-
setStoragePath
- Parameters:
path- set a string as the storagePath
-