Package gov.usgs.earthquake.distribution
Class ProductKey
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.distribution.ProductKey
-
- All Implemented Interfaces:
Configurable
public class ProductKey extends DefaultConfigurable
This represents a public key used to verify product signatures. A key should have at least one source and/or one type.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
KEY_PROPERTY_NAME
Property name for key.java.util.logging.Logger
LOGGER
Logger for use in filejava.lang.String
SOURCES_PROPERTY_NAME
Property name for sources.java.lang.String
TYPES_PROPERTY_NAME
Property name for types.
-
Constructor Summary
Constructors Constructor Description ProductKey()
Empty constructor for the Configurable interface.ProductKey(java.security.PublicKey key, java.util.List<java.lang.String> sources, java.util.List<java.lang.String> types)
Construct a new ProductPublicKey.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Config config)
Process configuration settings.java.security.PublicKey
getKey()
java.util.List<java.lang.String>
getSources()
java.util.List<java.lang.String>
getTypes()
boolean
isForProduct(ProductId id)
Check whether this key is a candidate for verifying a signature.void
setKey(java.security.PublicKey key)
void
shutdown()
Stop any processing/background threads.void
startup()
Start any processing/background threads.-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
-
-
-
Field Detail
-
LOGGER
public final java.util.logging.Logger LOGGER
Logger for use in file
-
SOURCES_PROPERTY_NAME
public final java.lang.String SOURCES_PROPERTY_NAME
Property name for sources.- See Also:
- Constant Field Values
-
TYPES_PROPERTY_NAME
public final java.lang.String TYPES_PROPERTY_NAME
Property name for types.- See Also:
- Constant Field Values
-
KEY_PROPERTY_NAME
public final java.lang.String KEY_PROPERTY_NAME
Property name for key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProductKey
public ProductKey()
Empty constructor for the Configurable interface.
-
ProductKey
public ProductKey(java.security.PublicKey key, java.util.List<java.lang.String> sources, java.util.List<java.lang.String> types)
Construct a new ProductPublicKey. Sources- Parameters:
key
- the public key.sources
- the sources to use with this key.types
- the types to use with this key.
-
-
Method Detail
-
isForProduct
public boolean isForProduct(ProductId id)
Check whether this key is a candidate for verifying a signature. If any sources, product source must be in list. If any types, product type must be in list.- Parameters:
id
- which product to check.- Returns:
- true if this key might verify the signature for given product.
-
configure
public void configure(Config config) throws java.lang.Exception
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultConfigurable
- Parameters:
config
- the Config object with settings.- Throws:
java.lang.Exception
- if configuration exceptions occur.
-
shutdown
public void shutdown() throws java.lang.Exception
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
startup
public void startup() throws java.lang.Exception
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
getKey
public java.security.PublicKey getKey()
- Returns:
- the key
-
setKey
public void setKey(java.security.PublicKey key)
- Parameters:
key
- the key to set
-
getSources
public java.util.List<java.lang.String> getSources()
- Returns:
- the sources
-
getTypes
public java.util.List<java.lang.String> getTypes()
- Returns:
- the types
-
-