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 String
Default value for whether to use binary format.static final String
(Deprecated, use STORAGE_PATH) Property name to configure binary or xml format.static final String
Sets up default storage pathstatic final String
Property for storageFormatstatic final String
Property for storagePathstatic final String
Property 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_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 TypeMethodDescriptionvoid
Load the baseURL from configuration.protected ProductHandler
getProductHandlerFormat
(File file) A method for subclasses to override the storage format.A method for subclasses to override the storage path.protected ProductSource
getProductSourceFormat
(File file) A method for subclasses to override the storage format.Compute the URL to a product.void
void
setStoragePath
(String path) Methods inherited from class gov.usgs.earthquake.distribution.FileProductStorage
addStorageListener, getBaseDirectory, getHashedProductPath, getInMemoryProduct, getKeychain, getLegacyStorages, getNormalProductPath, getProduct, getProductFile, getProductSource, getStorageLocks, hasProduct, isRejectInvalidSignatures, isTestSignatures, notifyListeners, removeProduct, removeStorageListener, setBaseDirectory, setKeychain, setRejectInvalidSignatures, setTestSignatures, shutdown, startup, storeProduct, storeProductSource
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
configure
in interfaceConfigurable
- Overrides:
configure
in 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:
getProductPath
in 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:
getProductHandlerFormat
in 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:
getProductSourceFormat
in 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
-