Package gov.usgs.earthquake.eids
Class EIDSInputWedge
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.distribution.ProductBuilder
-
- gov.usgs.earthquake.eids.EIDSInputWedge
-
- All Implemented Interfaces:
Bootstrappable,Configurable,java.lang.Runnable
public class EIDSInputWedge extends ProductBuilder implements java.lang.Runnable, Bootstrappable
Read messages from files or a poll directory, and push products into PDL. This is supports EIDS/QDDS style polling. 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
Fields Modifier and Type Field Description static java.lang.String[]ARGSGlobal reference to arguments array, when EIDSInputWedge is run via Bootstrap.static java.lang.StringATTACH_ARGUMENTArgument for attachstatic java.lang.StringBINARY_FORMAT_ARGUMENTArgument for binaryFormatstatic java.lang.StringCONNECT_TIMEOUT_ARGUMENTArgument for connection timeoutstatic java.lang.StringCREATE_INTERNAL_PRODUCTSArgument for creating internal productsstatic java.lang.StringCREATE_INTERNAL_PRODUCTS_PROPERTYWhether created products should be converted to internal types.static java.lang.StringCREATE_SCENARIO_PRODUCTSArgument for creating scenario productsstatic java.lang.StringCREATE_SCENARIO_PRODUCTS_PROPERTYWhether created products should be converted to scenario types.static java.lang.IntegerDEFAULT_CONNECT_TIMEOUTDefault timeout for connectionstatic java.lang.StringDEFAULT_CREATE_INTERNAL_PRODUCTSDefault status of CREATE_INTERNAL_PRODUCTSstatic java.lang.StringDEFAULT_CREATE_SCENARIO_PRODUCTSDefault status of CREATE_SCENARIO_PRODUCTSstatic java.lang.StringDEFAULT_DO_BUFFER_FIXDefault status of DO_BUFFER_FIX propertystatic java.lang.StringDEFAULT_ERRORDIRDefault error directorystatic java.lang.StringDEFAULT_PARSER_CLASSDefault parser classstatic java.lang.StringDEFAULT_POLL_CAREFULLYDefault status of POLL_CAREFULLYstatic java.lang.StringDEFAULT_POLLDIRDefault polldirstatic java.lang.StringDEFAULT_POLLINTERVALDefault interval for POLLINTERVALstatic java.lang.StringDEFAULT_SEND_MECHANISM_WHEN_PHASES_EXISTDefault status of sendMechanism...static java.lang.StringDEFAULT_SEND_ORIGIN_WHEN_PHASES_EXISTDefault status of sendOrigin...static java.lang.StringDEFAULT_STORAGEDIRDefault storage directorystatic java.lang.StringDEFAULT_VALIDATEDefault status of validatestatic java.lang.StringDISABLE_DEFLATE_ARGUMENTArgument for disableDeflatestatic java.lang.StringDO_BUFFER_FIX_PROPERTYProperty for doBufferFixstatic java.lang.StringERRORDIR_ARGUMENTArgument for errordirstatic java.lang.StringERRORDIR_PROPERTYProperty for error directorystatic java.lang.StringFILE_ARGUMENTArgument for filestatic java.lang.StringHELP_ARGUMENTArgument for helpstatic java.lang.StringPARSER_ARGUMENTArgument for parserstatic java.lang.StringPARSER_CLASS_PROPERTYProperty for parser classstatic java.lang.StringPOLL_ARGUMENTArgument for pollstatic java.lang.StringPOLL_CAREFULLY_ARGUMENTArgument for poleCarefullystatic java.lang.StringPOLL_CAREFULLY_PROPERTYProperty for pollCarefullystatic java.lang.StringPOLL_INTERVAL_ARGUMENTArgument for poll intervalstatic java.lang.StringPOLLDIR_ARGUMENTArgument for polldirstatic java.lang.StringPOLLDIR_PROPERTYProperty for polldirstatic java.lang.StringPOLLINTERVAL_PROPERTYPoll interval propertystatic java.lang.StringPRIVATE_KEY_ARGUMENTArgument for privateKeystatic java.lang.StringSEND_MECHANISM_WHEN_PHASES_EXIST_PROPERTYProperty for sendMechanismWhenPhasesExiststatic java.lang.StringSEND_MECHANISMS_WITH_PHASESArgument for sending mechanisms with phasesstatic java.lang.StringSEND_ORIGIN_WHEN_PHASES_EXIST_PROPERTYProperty for sendOriginWhenPhasesExiststatic java.lang.StringSEND_ORIGINS_WITH_PHASESArgument for sending origin with phasesstatic java.lang.StringSERVERS_ARGUMENTArgument for serversstatic java.lang.StringSERVERS_DEFAULTDefault server for server argumentstatic java.lang.StringSIGNATURE_VERSION_ARGUMENTArgument for signatureVersionstatic java.lang.StringSTORAGEDIR_ARGUMENTArgument for storagedirstatic java.lang.StringSTORAGEDIR_PROPERTYProperty for storage directorystatic java.lang.StringTEST_ARGUMENTArgument for testingstatic java.lang.StringTRACKER_URL_ARGUMENTArgument for tracker urlstatic java.lang.StringVALIDATE_ARGUMENTArgument for validatestatic java.lang.StringVALIDATE_PROPERTYProperty for validate-
Fields inherited from class gov.usgs.earthquake.distribution.ProductBuilder
DEFAULT_PARALLEL_SEND, DEFAULT_PARALLEL_SEND_TIMEOUT, DEFAULT_TRACKER_URL, PARALLEL_SEND_PROPERTY, PARALLEL_SEND_TIMEOUT_PROPERTY, parallelSend, parallelSendTimeout, PRIVATE_KEY_PROPERTY, SENDERS_PROPERTY, SIGNATURE_VERSION_PROPERTY, TRACKER_URL_PROPERTY
-
Fields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE
-
-
Constructor Summary
Constructors Constructor Description EIDSInputWedge()Empty constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Config config)Process configuration settings.DirectoryPollergetDirectoryPoller()java.io.FilegetErrordir()java.io.FilegetPolldir()longgetPollInterval()ProductCreatorgetProductCreator()java.io.FilegetStoragedir()booleanisCreateInternalProducts()booleanisCreateScenarioProducts()booleanisPollCarefully()voidonFile(java.io.File file)Parses given file, looking for send exceptions and reports statisticsjava.util.Map<ProductId,java.util.Map<ProductSender,java.lang.Exception>>parseAndSend(java.io.File file, java.util.Map<java.lang.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 java.util.List<ProductSender>parseServers(java.lang.String servers, java.lang.Integer connectTimeout, boolean binaryFormat, boolean enableDeflate)Parses a string of servers into SocketProductSenders, all put into a list of product sendersstatic voidprintUsage()Usage for interfacevoidrun()voidrun(java.lang.String[] args)Bootstrappable interface.voidsetCreateInternalProducts(boolean createInternalProducts)voidsetCreateScenarioProducts(boolean createScenarioProducts)voidsetDirectoryPoller(DirectoryPoller directoryPoller)voidsetErrordir(java.io.File errordir)voidsetPollCarefully(boolean pollCarefully)voidsetPolldir(java.io.File polldir)voidsetPollInterval(long pollInterval)voidsetProductCreator(ProductCreator productCreator)voidsetStoragedir(java.io.File storagedir)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, getTrackerURL, parallelSendProduct, removeProductSender, sendProduct, setPrivateKey, setSignatureVersion, setTrackerURL
-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
-
-
-
Field Detail
-
ARGS
public static java.lang.String[] ARGS
Global reference to arguments array, when EIDSInputWedge is run via Bootstrap.
-
PARSER_CLASS_PROPERTY
public static final java.lang.String PARSER_CLASS_PROPERTY
Property for parser class- See Also:
- Constant Field Values
-
DEFAULT_PARSER_CLASS
public static final java.lang.String DEFAULT_PARSER_CLASS
Default parser class- See Also:
- Constant Field Values
-
POLLDIR_PROPERTY
public static final java.lang.String POLLDIR_PROPERTY
Property for polldir- See Also:
- Constant Field Values
-
DEFAULT_POLLDIR
public static final java.lang.String DEFAULT_POLLDIR
Default polldir- See Also:
- Constant Field Values
-
STORAGEDIR_PROPERTY
public static final java.lang.String STORAGEDIR_PROPERTY
Property for storage directory- See Also:
- Constant Field Values
-
DEFAULT_STORAGEDIR
public static final java.lang.String DEFAULT_STORAGEDIR
Default storage directory- See Also:
- Constant Field Values
-
ERRORDIR_PROPERTY
public static final java.lang.String ERRORDIR_PROPERTY
Property for error directory- See Also:
- Constant Field Values
-
DEFAULT_ERRORDIR
public static final java.lang.String DEFAULT_ERRORDIR
Default error directory- See Also:
- Constant Field Values
-
VALIDATE_PROPERTY
public static final java.lang.String VALIDATE_PROPERTY
Property for validate- See Also:
- Constant Field Values
-
DEFAULT_VALIDATE
public static final java.lang.String DEFAULT_VALIDATE
Default status of validate- See Also:
- Constant Field Values
-
SEND_ORIGIN_WHEN_PHASES_EXIST_PROPERTY
public static final java.lang.String SEND_ORIGIN_WHEN_PHASES_EXIST_PROPERTY
Property for sendOriginWhenPhasesExist- See Also:
- Constant Field Values
-
DEFAULT_SEND_ORIGIN_WHEN_PHASES_EXIST
public static final java.lang.String DEFAULT_SEND_ORIGIN_WHEN_PHASES_EXIST
Default status of sendOrigin...- See Also:
- Constant Field Values
-
SEND_MECHANISM_WHEN_PHASES_EXIST_PROPERTY
public static final java.lang.String SEND_MECHANISM_WHEN_PHASES_EXIST_PROPERTY
Property for sendMechanismWhenPhasesExist- See Also:
- Constant Field Values
-
DEFAULT_SEND_MECHANISM_WHEN_PHASES_EXIST
public static final java.lang.String DEFAULT_SEND_MECHANISM_WHEN_PHASES_EXIST
Default status of sendMechanism...- See Also:
- Constant Field Values
-
CREATE_INTERNAL_PRODUCTS_PROPERTY
public static final java.lang.String CREATE_INTERNAL_PRODUCTS_PROPERTY
Whether created products should be converted to internal types.- See Also:
- Constant Field Values
-
DEFAULT_CREATE_INTERNAL_PRODUCTS
public static final java.lang.String DEFAULT_CREATE_INTERNAL_PRODUCTS
Default status of CREATE_INTERNAL_PRODUCTS- See Also:
- Constant Field Values
-
CREATE_SCENARIO_PRODUCTS_PROPERTY
public static final java.lang.String CREATE_SCENARIO_PRODUCTS_PROPERTY
Whether created products should be converted to scenario types.- See Also:
- Constant Field Values
-
DEFAULT_CREATE_SCENARIO_PRODUCTS
public static final java.lang.String DEFAULT_CREATE_SCENARIO_PRODUCTS
Default status of CREATE_SCENARIO_PRODUCTS- See Also:
- Constant Field Values
-
POLLINTERVAL_PROPERTY
public static final java.lang.String POLLINTERVAL_PROPERTY
Poll interval property- See Also:
- Constant Field Values
-
DEFAULT_POLLINTERVAL
public static final java.lang.String DEFAULT_POLLINTERVAL
Default interval for POLLINTERVAL- See Also:
- Constant Field Values
-
POLL_CAREFULLY_PROPERTY
public static final java.lang.String POLL_CAREFULLY_PROPERTY
Property for pollCarefully- See Also:
- Constant Field Values
-
DEFAULT_POLL_CAREFULLY
public static final java.lang.String DEFAULT_POLL_CAREFULLY
Default status of POLL_CAREFULLY- See Also:
- Constant Field Values
-
DO_BUFFER_FIX_PROPERTY
public static final java.lang.String DO_BUFFER_FIX_PROPERTY
Property for doBufferFix- See Also:
- Constant Field Values
-
DEFAULT_DO_BUFFER_FIX
public static final java.lang.String DEFAULT_DO_BUFFER_FIX
Default status of DO_BUFFER_FIX property- See Also:
- Constant Field Values
-
HELP_ARGUMENT
public static final java.lang.String HELP_ARGUMENT
Argument for help- See Also:
- Constant Field Values
-
POLL_ARGUMENT
public static final java.lang.String POLL_ARGUMENT
Argument for poll- See Also:
- Constant Field Values
-
POLL_CAREFULLY_ARGUMENT
public static final java.lang.String POLL_CAREFULLY_ARGUMENT
Argument for poleCarefully- See Also:
- Constant Field Values
-
POLLDIR_ARGUMENT
public static final java.lang.String POLLDIR_ARGUMENT
Argument for polldir- See Also:
- Constant Field Values
-
ERRORDIR_ARGUMENT
public static final java.lang.String ERRORDIR_ARGUMENT
Argument for errordir- See Also:
- Constant Field Values
-
STORAGEDIR_ARGUMENT
public static final java.lang.String STORAGEDIR_ARGUMENT
Argument for storagedir- See Also:
- Constant Field Values
-
POLL_INTERVAL_ARGUMENT
public static final java.lang.String POLL_INTERVAL_ARGUMENT
Argument for poll interval- See Also:
- Constant Field Values
-
TRACKER_URL_ARGUMENT
public static final java.lang.String TRACKER_URL_ARGUMENT
Argument for tracker url- See Also:
- Constant Field Values
-
FILE_ARGUMENT
public static final java.lang.String FILE_ARGUMENT
Argument for file- See Also:
- Constant Field Values
-
PARSER_ARGUMENT
public static final java.lang.String PARSER_ARGUMENT
Argument for parser- See Also:
- Constant Field Values
-
VALIDATE_ARGUMENT
public static final java.lang.String VALIDATE_ARGUMENT
Argument for validate- See Also:
- Constant Field Values
-
PRIVATE_KEY_ARGUMENT
public static final java.lang.String PRIVATE_KEY_ARGUMENT
Argument for privateKey- See Also:
- Constant Field Values
-
SIGNATURE_VERSION_ARGUMENT
public static final java.lang.String SIGNATURE_VERSION_ARGUMENT
Argument for signatureVersion- See Also:
- Constant Field Values
-
SERVERS_ARGUMENT
public static final java.lang.String SERVERS_ARGUMENT
Argument for servers- See Also:
- Constant Field Values
-
SERVERS_DEFAULT
public static final java.lang.String SERVERS_DEFAULT
Default server for server argument- See Also:
- Constant Field Values
-
CONNECT_TIMEOUT_ARGUMENT
public static final java.lang.String CONNECT_TIMEOUT_ARGUMENT
Argument for connection timeout- See Also:
- Constant Field Values
-
DEFAULT_CONNECT_TIMEOUT
public static final java.lang.Integer DEFAULT_CONNECT_TIMEOUT
Default timeout for connection
-
BINARY_FORMAT_ARGUMENT
public static final java.lang.String BINARY_FORMAT_ARGUMENT
Argument for binaryFormat- See Also:
- Constant Field Values
-
DISABLE_DEFLATE_ARGUMENT
public static final java.lang.String DISABLE_DEFLATE_ARGUMENT
Argument for disableDeflate- See Also:
- Constant Field Values
-
ATTACH_ARGUMENT
public static final java.lang.String ATTACH_ARGUMENT
Argument for attach- See Also:
- Constant Field Values
-
SEND_ORIGINS_WITH_PHASES
public static final java.lang.String SEND_ORIGINS_WITH_PHASES
Argument for sending origin with phases- See Also:
- Constant Field Values
-
SEND_MECHANISMS_WITH_PHASES
public static final java.lang.String SEND_MECHANISMS_WITH_PHASES
Argument for sending mechanisms with phases- See Also:
- Constant Field Values
-
CREATE_INTERNAL_PRODUCTS
public static final java.lang.String CREATE_INTERNAL_PRODUCTS
Argument for creating internal products- See Also:
- Constant Field Values
-
CREATE_SCENARIO_PRODUCTS
public static final java.lang.String CREATE_SCENARIO_PRODUCTS
Argument for creating scenario products- See Also:
- Constant Field Values
-
TEST_ARGUMENT
public static final java.lang.String TEST_ARGUMENT
Argument for testing- See Also:
- Constant Field Values
-
-
Method Detail
-
parseAndSend
public java.util.Map<ProductId,java.util.Map<ProductSender,java.lang.Exception>> parseAndSend(java.io.File file, java.util.Map<java.lang.String,Content> attachContent) throws java.lang.Exception
Gets 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:
java.lang.Exception- if error occurs
-
onFile
public void onFile(java.io.File file)
Parses given file, looking for send exceptions and reports statistics- Parameters:
file- to parse and look for errors
-
configure
public void configure(Config config) throws java.lang.Exception
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:
java.lang.Exception- if configuration exceptions occur.
-
shutdown
public void shutdown() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStop any processing/background threads.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classProductBuilder- Throws:
java.lang.Exception- if exceptions occur while starting.
-
startup
public void startup() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStart any processing/background threads.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classProductBuilder- Throws:
java.lang.Exception- if exceptions occur while starting.
-
getPolldir
public java.io.File getPolldir()
- Returns:
- polldir
-
setPolldir
public void setPolldir(java.io.File polldir)
- Parameters:
polldir- File to set
-
getStoragedir
public java.io.File getStoragedir()
- Returns:
- storagedir
-
setStoragedir
public void setStoragedir(java.io.File storagedir)
- Parameters:
storagedir- File to set
-
getErrordir
public java.io.File getErrordir()
- Returns:
- errordir
-
setErrordir
public void setErrordir(java.io.File errordir)
- Parameters:
errordir- File to send
-
getProductCreator
public ProductCreator getProductCreator()
- Returns:
- productCreator
-
setProductCreator
public void setProductCreator(ProductCreator productCreator)
- Parameters:
productCreator- to set
-
getDirectoryPoller
public DirectoryPoller getDirectoryPoller()
- Returns:
- directoryPoller
-
setDirectoryPoller
public void setDirectoryPoller(DirectoryPoller directoryPoller)
- Parameters:
directoryPoller- to set
-
getPollInterval
public long getPollInterval()
- Returns:
- pollInterval long
-
setPollInterval
public void setPollInterval(long pollInterval)
- Parameters:
pollInterval- long to set
-
isPollCarefully
public boolean isPollCarefully()
- Returns:
- pollCarefully boolean
-
setPollCarefully
public void setPollCarefully(boolean pollCarefully)
- Parameters:
pollCarefully- boolean 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
-
parseServers
public static java.util.List<ProductSender> parseServers(java.lang.String servers, java.lang.Integer connectTimeout, boolean binaryFormat, boolean enableDeflate)
Parses a string of servers into SocketProductSenders, all put into a list of product senders- Parameters:
servers- String of servers, split by commasconnectTimeout- int timeoutbinaryFormat- boolean if binary formatenableDeflate- boolean if Deflate should be enabled- Returns:
- List of product senders
-
run
public void run(java.lang.String[] args) throws java.lang.ExceptionBootstrappable interface.- Specified by:
runin interfaceBootstrappable- Parameters:
args- array of command line arguments.- Throws:
java.lang.Exception- Exception
-
printUsage
public static void printUsage()
Usage for interface
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-