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 StringArgument for attachstatic final StringWhether created products should be converted to internal types.static final StringWhether created products should be converted to scenario types.static final StringDefault status of CREATE_INTERNAL_PRODUCTSstatic final StringDefault status of CREATE_SCENARIO_PRODUCTSstatic final StringDefault status of DO_BUFFER_FIX propertystatic final StringDefault parser classstatic final StringDefault status of sendMechanism...static final StringDefault status of sendOrigin...static final StringDefault status of validatestatic final StringProperty for doBufferFixstatic final StringArgument for filestatic final StringArgument for helpstatic final StringProperty for parser classstatic final StringArgument for pollstatic final Stringstatic final StringProperty for sendMechanismWhenPhasesExiststatic final StringProperty for sendOriginWhenPhasesExiststatic final StringArgument for serversstatic final StringArgument for testingstatic final StringProperty 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_PROPERTYFields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess configuration settings.booleanbooleanvoidParses given file, looking for send exceptions and reports statisticsvoidparseAndSend(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 voidUsage for interfacevoidrun()voidBootstrappable interface.voidsetCreateInternalProducts(boolean createInternalProducts) voidsetCreateScenarioProducts(boolean createScenarioProducts) voidvoidsetProductCreator(ProductCreator productCreator) voidshutdown()Stop any processing/background threads.voidstartup()Start any processing/background threads.Methods inherited from class gov.usgs.earthquake.distribution.ProductBuilder
addProductSender, getPrivateKey, getProductSenders, getSignatureVersion, parallelSendProduct, removeProductSender, sendProduct, setPrivateKey, setSignatureVersionMethods 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:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classProductBuilder- Parameters:
config- the Config object with settings.- Throws:
Exception- if configuration exceptions occur.
-
startup
Description copied from class:DefaultConfigurableStart any processing/background threads.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classProductBuilder- Throws:
Exception- if exceptions occur while starting.
-
shutdown
Description copied from class:DefaultConfigurableStop any processing/background threads.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin 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:
onFilein 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:
runin interfaceBootstrappable- Parameters:
args- array of command line arguments.- Throws:
Exception- Exception
-
printUsage
public static void printUsage()Usage for interface -
run
public void run()
-