Class DefaultNotificationSender

    • Field Detail

      • SERVER_HOST_PROPERTY

        public static final java.lang.String SERVER_HOST_PROPERTY
        Property referencing the server host
        See Also:
        Constant Field Values
      • SERVER_PORT_PROPERTY

        public static final java.lang.String SERVER_PORT_PROPERTY
        Property referencing the server port
        See Also:
        Constant Field Values
      • PRODUCT_STORAGE_PROPERTY

        public static final java.lang.String PRODUCT_STORAGE_PROPERTY
        Property referencing product storage object to use
        See Also:
        Constant Field Values
      • PRODUCT_STORAGE_MAX_AGE_PROPERTY

        public static final java.lang.String PRODUCT_STORAGE_MAX_AGE_PROPERTY
        Property referencing the length of time products should be held in storage
        See Also:
        Constant Field Values
      • DEFAULT_PRODUCT_STORAGE_MAX_AGE

        public static final java.lang.String DEFAULT_PRODUCT_STORAGE_MAX_AGE
        property for max age of product in storage. 7000 days?
        See Also:
        Constant Field Values
      • serverHost

        protected java.lang.String serverHost
        Variable for String serverHost
      • serverPort

        protected java.lang.String serverPort
        Variable for String serverPort
      • productStorage

        protected URLProductStorage productStorage
        Variable for URL productStorage
      • productStorageMaxAge

        protected long productStorageMaxAge
        Variable for long productStorageMaxAge
    • Constructor Detail

      • DefaultNotificationSender

        public DefaultNotificationSender()
    • Method Detail

      • configure

        public void configure​(Config config)
                       throws java.lang.Exception
        Configures based on configuration section.
        Specified by:
        configure in interface Configurable
        Overrides:
        configure in class DefaultNotificationListener
        Parameters:
        config - The config
        Throws:
        java.lang.Exception - if something goes wrong
      • onProduct

        public void onProduct​(Product product)
                       throws java.lang.Exception
        Called on receipt of a new product. Stores this product and calls sendMessage() Most of this logic was lifted from the pre-08/2019 EIDSNotificationSender class.
        Overrides:
        onProduct in class DefaultNotificationListener
        Parameters:
        product - a product whose notification was accepted.
        Throws:
        java.lang.Exception - if something goes wrong
      • onBeforeProcessNotification

        protected boolean onBeforeProcessNotification​(Notification notification)
                                               throws java.lang.Exception
        Called just before this listener processes a notification.
        Overrides:
        onBeforeProcessNotification in class DefaultNotificationListener
        Parameters:
        notification - notification about to be processed.
        Returns:
        true to process the notification, false to skip
        Throws:
        java.lang.Exception - if something goes wrong
      • sendNotification

        protected void sendNotification​(Notification notification)
                                 throws java.lang.Exception
        Utility method to do the actual notification sending. Should be overridden by subclasses.
        Parameters:
        notification - The notification to send
        Throws:
        java.lang.Exception - if something goes wrong
      • getServerHost

        public java.lang.String getServerHost()
        Returns:
        serverHost
      • setServerHost

        public void setServerHost​(java.lang.String serverHost)
        Parameters:
        serverHost - string to set
      • getServerPort

        public java.lang.String getServerPort()
        Returns:
        serverPort
      • setServerPort

        public void setServerPort​(java.lang.String serverPort)
        Parameters:
        serverPort - string to set
      • getProductStorage

        public URLProductStorage getProductStorage()
        Returns:
        productStorage
      • setProductStorage

        public void setProductStorage​(URLProductStorage productStorage)
        Parameters:
        productStorage - URLProductStorage to set
      • getProductStorageMaxAge

        public long getProductStorageMaxAge()
        Returns:
        productStorageMaxAge
      • setProductStorageMaxAge

        public void setProductStorageMaxAge​(long productStorageMaxAge)
        Parameters:
        productStorageMaxAge - long to set