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[]
ARGS
Global reference to arguments array, when EIDSInputWedge is run via Bootstrap.static java.lang.String
ATTACH_ARGUMENT
Argument for attachstatic java.lang.String
BINARY_FORMAT_ARGUMENT
Argument for binaryFormatstatic java.lang.String
CONNECT_TIMEOUT_ARGUMENT
Argument for connection timeoutstatic java.lang.String
CREATE_INTERNAL_PRODUCTS
Argument for creating internal productsstatic java.lang.String
CREATE_INTERNAL_PRODUCTS_PROPERTY
Whether created products should be converted to internal types.static java.lang.String
CREATE_SCENARIO_PRODUCTS
Argument for creating scenario productsstatic java.lang.String
CREATE_SCENARIO_PRODUCTS_PROPERTY
Whether created products should be converted to scenario types.static java.lang.Integer
DEFAULT_CONNECT_TIMEOUT
Default timeout for connectionstatic java.lang.String
DEFAULT_CREATE_INTERNAL_PRODUCTS
Default status of CREATE_INTERNAL_PRODUCTSstatic java.lang.String
DEFAULT_CREATE_SCENARIO_PRODUCTS
Default status of CREATE_SCENARIO_PRODUCTSstatic java.lang.String
DEFAULT_DO_BUFFER_FIX
Default status of DO_BUFFER_FIX propertystatic java.lang.String
DEFAULT_ERRORDIR
Default error directorystatic java.lang.String
DEFAULT_PARSER_CLASS
Default parser classstatic java.lang.String
DEFAULT_POLL_CAREFULLY
Default status of POLL_CAREFULLYstatic java.lang.String
DEFAULT_POLLDIR
Default polldirstatic java.lang.String
DEFAULT_POLLINTERVAL
Default interval for POLLINTERVALstatic java.lang.String
DEFAULT_SEND_MECHANISM_WHEN_PHASES_EXIST
Default status of sendMechanism...static java.lang.String
DEFAULT_SEND_ORIGIN_WHEN_PHASES_EXIST
Default status of sendOrigin...static java.lang.String
DEFAULT_STORAGEDIR
Default storage directorystatic java.lang.String
DEFAULT_VALIDATE
Default status of validatestatic java.lang.String
DISABLE_DEFLATE_ARGUMENT
Argument for disableDeflatestatic java.lang.String
DO_BUFFER_FIX_PROPERTY
Property for doBufferFixstatic java.lang.String
ERRORDIR_ARGUMENT
Argument for errordirstatic java.lang.String
ERRORDIR_PROPERTY
Property for error directorystatic java.lang.String
FILE_ARGUMENT
Argument for filestatic java.lang.String
HELP_ARGUMENT
Argument for helpstatic java.lang.String
PARSER_ARGUMENT
Argument for parserstatic java.lang.String
PARSER_CLASS_PROPERTY
Property for parser classstatic java.lang.String
POLL_ARGUMENT
Argument for pollstatic java.lang.String
POLL_CAREFULLY_ARGUMENT
Argument for poleCarefullystatic java.lang.String
POLL_CAREFULLY_PROPERTY
Property for pollCarefullystatic java.lang.String
POLL_INTERVAL_ARGUMENT
Argument for poll intervalstatic java.lang.String
POLLDIR_ARGUMENT
Argument for polldirstatic java.lang.String
POLLDIR_PROPERTY
Property for polldirstatic java.lang.String
POLLINTERVAL_PROPERTY
Poll interval propertystatic java.lang.String
PRIVATE_KEY_ARGUMENT
Argument for privateKeystatic java.lang.String
SEND_MECHANISM_WHEN_PHASES_EXIST_PROPERTY
Property for sendMechanismWhenPhasesExiststatic java.lang.String
SEND_MECHANISMS_WITH_PHASES
Argument for sending mechanisms with phasesstatic java.lang.String
SEND_ORIGIN_WHEN_PHASES_EXIST_PROPERTY
Property for sendOriginWhenPhasesExiststatic java.lang.String
SEND_ORIGINS_WITH_PHASES
Argument for sending origin with phasesstatic java.lang.String
SERVERS_ARGUMENT
Argument for serversstatic java.lang.String
SERVERS_DEFAULT
Default server for server argumentstatic java.lang.String
SIGNATURE_VERSION_ARGUMENT
Argument for signatureVersionstatic java.lang.String
STORAGEDIR_ARGUMENT
Argument for storagedirstatic java.lang.String
STORAGEDIR_PROPERTY
Property for storage directorystatic java.lang.String
TEST_ARGUMENT
Argument for testingstatic java.lang.String
TRACKER_URL_ARGUMENT
Argument for tracker urlstatic java.lang.String
VALIDATE_ARGUMENT
Argument for validatestatic java.lang.String
VALIDATE_PROPERTY
Property 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 void
configure(Config config)
Process configuration settings.DirectoryPoller
getDirectoryPoller()
java.io.File
getErrordir()
java.io.File
getPolldir()
long
getPollInterval()
ProductCreator
getProductCreator()
java.io.File
getStoragedir()
boolean
isCreateInternalProducts()
boolean
isCreateScenarioProducts()
boolean
isPollCarefully()
void
onFile(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 void
printUsage()
Usage for interfacevoid
run()
void
run(java.lang.String[] args)
Bootstrappable interface.void
setCreateInternalProducts(boolean createInternalProducts)
void
setCreateScenarioProducts(boolean createScenarioProducts)
void
setDirectoryPoller(DirectoryPoller directoryPoller)
void
setErrordir(java.io.File errordir)
void
setPollCarefully(boolean pollCarefully)
void
setPolldir(java.io.File polldir)
void
setPollInterval(long pollInterval)
void
setProductCreator(ProductCreator productCreator)
void
setStoragedir(java.io.File storagedir)
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, 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:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classProductBuilder
- 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 classProductBuilder
- 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 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.Exception
Bootstrappable interface.- Specified by:
run
in 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:
run
in interfacejava.lang.Runnable
-
-