Package gov.usgs.earthquake.distribution
Class InputWedge
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.ProductBuilder
gov.usgs.earthquake.distribution.InputWedge
- All Implemented Interfaces:
Bootstrappable
,Configurable
,FileListenerInterface
,Runnable
public class InputWedge
extends ProductBuilder
implements Runnable, Bootstrappable, FileListenerInterface
Read messages from files or a poll directory, and push products into PDL.
The input messages are converted to Quakeml using the FileToQuakemlConverter
interface, then sent as Quakeml based products.
Much of the configuration can be supplied using either a configuration file,
or command line arguments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Argument for attachstatic final String
Whether created products should be converted to internal types.static final String
Whether created products should be converted to scenario types.static final String
Default status of CREATE_INTERNAL_PRODUCTSstatic final String
Default status of CREATE_SCENARIO_PRODUCTSstatic final String
Default status of DO_BUFFER_FIX propertystatic final String
Default parser classstatic final String
Default status of sendMechanism...static final String
Default status of sendOrigin...static final String
Default status of validatestatic final String
Property for doBufferFixstatic final String
Argument for filestatic final String
Argument for helpstatic final String
Property for parser classstatic final String
Argument for pollstatic final String
static final String
Property for sendMechanismWhenPhasesExiststatic final String
Property for sendOriginWhenPhasesExiststatic final String
Argument for serversstatic final String
Argument for testingstatic final String
Property for validateFields inherited from class gov.usgs.earthquake.distribution.ProductBuilder
DEFAULT_PARALLEL_SEND, DEFAULT_PARALLEL_SEND_TIMEOUT, PARALLEL_SEND_PROPERTY, PARALLEL_SEND_TIMEOUT_PROPERTY, parallelSend, parallelSendTimeout, PRIVATE_KEY_FILE_PROPERTY, SENDERS_PROPERTY, SIGNATURE_VERSION_PROPERTY
Fields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process configuration settings.boolean
boolean
void
Parses given file, looking for send exceptions and reports statisticsvoid
parseAndSend
(File file, Map<String, Content> attachContent) Gets products from file and iterates through each product During iteration, sets type to internal/scenario if createInternalProducts or createScenarioProducts is true.static void
Usage for interfacevoid
run()
void
Bootstrappable interface.void
setCreateInternalProducts
(boolean createInternalProducts) void
setCreateScenarioProducts
(boolean createScenarioProducts) void
void
setProductCreator
(ProductCreator productCreator) void
shutdown()
Stop any processing/background threads.void
startup()
Start any processing/background threads.Methods inherited from class gov.usgs.earthquake.distribution.ProductBuilder
addProductSender, getPrivateKey, getProductSenders, getSignatureVersion, parallelSendProduct, removeProductSender, sendProduct, setPrivateKey, setSignatureVersion
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
Field Details
-
PARSER_CLASS_PROPERTY
Property for parser class- See Also:
-
DEFAULT_PARSER_CLASS
Default parser class- See Also:
-
VALIDATE_PROPERTY
Property for validate- See Also:
-
DEFAULT_VALIDATE
Default status of validate- See Also:
-
SEND_ORIGIN_WHEN_PHASES_EXIST_PROPERTY
Property for sendOriginWhenPhasesExist- See Also:
-
DEFAULT_SEND_ORIGIN_WHEN_PHASES_EXIST
Default status of sendOrigin...- See Also:
-
SEND_MECHANISM_WHEN_PHASES_EXIST_PROPERTY
Property for sendMechanismWhenPhasesExist- See Also:
-
DEFAULT_SEND_MECHANISM_WHEN_PHASES_EXIST
Default status of sendMechanism...- See Also:
-
CREATE_INTERNAL_PRODUCTS_PROPERTY
Whether created products should be converted to internal types.- See Also:
-
DEFAULT_CREATE_INTERNAL_PRODUCTS
Default status of CREATE_INTERNAL_PRODUCTS- See Also:
-
CREATE_SCENARIO_PRODUCTS_PROPERTY
Whether created products should be converted to scenario types.- See Also:
-
DEFAULT_CREATE_SCENARIO_PRODUCTS
Default status of CREATE_SCENARIO_PRODUCTS- See Also:
-
POLLER_CLASS_PROPERTY
- See Also:
-
DO_BUFFER_FIX_PROPERTY
Property for doBufferFix- See Also:
-
DEFAULT_DO_BUFFER_FIX
Default status of DO_BUFFER_FIX property- See Also:
-
HELP_ARGUMENT
Argument for help- See Also:
-
POLL_ARGUMENT
Argument for poll- See Also:
-
TEST_ARGUMENT
Argument for testing- See Also:
-
FILE_ARGUMENT
Argument for file- See Also:
-
SENDERS_ARGUMENT
Argument for servers- See Also:
-
ATTACH_ARGUMENT
Argument for attach- See Also:
-
-
Constructor Details
-
InputWedge
Empty constructor- Throws:
Exception
- if error occurs
-
-
Method Details
-
configure
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classProductBuilder
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
startup
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classProductBuilder
- Throws:
Exception
- if exceptions occur while starting.
-
shutdown
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classProductBuilder
- Throws:
Exception
- if exceptions occur while starting.
-
parseAndSend
public Map<ProductId,Map<ProductSender, parseAndSendException>> (File file, Map<String, Content> attachContent) throws ExceptionGets products from file and iterates through each product During iteration, sets type to internal/scenario if createInternalProducts or createScenarioProducts is true. Attaches Content files to product, Sends product- Parameters:
file
- File containing productsattachContent
- Map of String and Content- Returns:
- Map of product IDs and sent products
- Throws:
Exception
- if error occurs
-
onFile
Parses given file, looking for send exceptions and reports statistics- Specified by:
onFile
in interfaceFileListenerInterface
- Parameters:
file
- to parse and look for errors- Throws:
Exception
-
onFile
- Throws:
Exception
-
getProductCreator
- Returns:
- productCreator
-
setProductCreator
- Parameters:
productCreator
- to set
-
getPoller
- Returns:
- poller
-
setPoller
- Parameters:
poller
- to set
-
isCreateInternalProducts
public boolean isCreateInternalProducts()- Returns:
- the createInternalProducts
-
setCreateInternalProducts
public void setCreateInternalProducts(boolean createInternalProducts) - Parameters:
createInternalProducts
- the createInternalProducts to set
-
isCreateScenarioProducts
public boolean isCreateScenarioProducts()- Returns:
- the createScenarioProducts
-
setCreateScenarioProducts
public void setCreateScenarioProducts(boolean createScenarioProducts) - Parameters:
createScenarioProducts
- the createScenarioProducts to set
-
run
Bootstrappable interface.- Specified by:
run
in interfaceBootstrappable
- Parameters:
args
- array of command line arguments.- Throws:
Exception
- Exception
-
printUsage
public static void printUsage()Usage for interface -
run
public void run()
-