Class 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 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
    • Constructor Detail

      • EIDSInputWedge

        public EIDSInputWedge()
                       throws java.lang.Exception
        Empty constructor
        Throws:
        java.lang.Exception - if error occurs
    • 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 products
        attachContent - 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 interface Configurable
        Overrides:
        configure in class ProductBuilder
        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 interface Configurable
        Overrides:
        shutdown in class ProductBuilder
        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 interface Configurable
        Overrides:
        startup in class ProductBuilder
        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 commas
        connectTimeout - int timeout
        binaryFormat - boolean if binary format
        enableDeflate - 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 interface Bootstrappable
        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 interface java.lang.Runnable