Class DefaultIndexerListener

  • All Implemented Interfaces:
    IndexerListener, Configurable
    Direct Known Subclasses:
    ExternalIndexerListener, ReliableIndexerListener

    public class DefaultIndexerListener
    extends AbstractListener
    implements IndexerListener
    DefaultIndexerListener provides a starting point from which all IndexerListeners may extend. As a child-class of the AbstractListener, this may be configured with all of the parent parameters and also accepts the following:
    command
    (Required) The command to execute. This must be an executable command and may include arguments. Any product-specific arguments are appended at the end of command.
    storage
    (Required) A directory used to store all products. Each product is extracted into a separate directory within this directory and is referenced by the --directory=/path/to/directory argument when command is executed.
    processUnassociated
    (Optional, Default = false) Whether or not to process unassociated products. Valid values are "true" and "false".
    processPreferredOnly
    (Optional, Default = false) Whether or not to process only preferred products of the type accepted by this listener. Valid values are "true" and "false".
    ignoreArchive
    (Optional, Default = false) Whether or not to ignore EVENT_ARCHIVED and PRODUCT_ARCHIVED indexer events. Value values are "true" and "false".
    • Field Detail

      • PROCESS_PREFERRED_ONLY_PROPERTY

        public static final java.lang.String PROCESS_PREFERRED_ONLY_PROPERTY
        Property for process preferred only
        See Also:
        Constant Field Values
      • PROCESS_PREFERRED_ONLY_DEFAULT

        public static final java.lang.String PROCESS_PREFERRED_ONLY_DEFAULT
        Default state of process preferred only
        See Also:
        Constant Field Values
      • PROCESS_UNASSOCIATED_PROPERTY

        public static final java.lang.String PROCESS_UNASSOCIATED_PROPERTY
        Property for process unassociated
        See Also:
        Constant Field Values
      • PROCESS_UNASSOCIATED_DEFAULT

        public static final java.lang.String PROCESS_UNASSOCIATED_DEFAULT
        Default state of process unassociated
        See Also:
        Constant Field Values
      • PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY

        public static final java.lang.String PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY
        Property for process only when event change
        See Also:
        Constant Field Values
      • PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT

        public static final java.lang.String PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT
        Default state of process only when event change
        See Also:
        Constant Field Values
      • IGNORE_ARCHIVE_PROPERTY

        public static final java.lang.String IGNORE_ARCHIVE_PROPERTY
        Property for Ignore archive
        See Also:
        Constant Field Values
      • IGNORE_ARCHIVE_DEFAULT

        public static final java.lang.String IGNORE_ARCHIVE_DEFAULT
        Default state of ignore archive
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultIndexerListener

        public DefaultIndexerListener()
    • Method Detail

      • onIndexerEvent

        public void onIndexerEvent​(IndexerEvent event)
                            throws java.lang.Exception
        Description copied from interface: IndexerListener
        This method is called when the indexer makes a change to the ProductIndex.
        Specified by:
        onIndexerEvent in interface IndexerListener
        Parameters:
        event - description of the change.
        Throws:
        java.lang.Exception - if error occurs
      • accept

        public boolean accept​(IndexerEvent change)
                       throws java.lang.Exception
        Parameters:
        change - the indexer event that has occurred
        Returns:
        whether this external indexer listener handles this product type
        Throws:
        java.lang.Exception - if error occurs
      • accept

        public boolean accept​(IndexerEvent event,
                              IndexerChange change)
                       throws java.lang.Exception
        Returns a boolean based on if the preferred event params have changed Returns false if change is an archive indexer
        Parameters:
        event - an IndexerEvent
        change - and IndexerChange
        Returns:
        boolean
        Throws:
        java.lang.Exception - if error occurs
      • configure

        public void configure​(Config config)
                       throws java.lang.Exception
        Description copied from class: AbstractListener
        Read the include and exclude types from config.
        Specified by:
        configure in interface Configurable
        Overrides:
        configure in class AbstractListener
        Parameters:
        config - the Config object with settings.
        Throws:
        java.lang.Exception - if configuration exceptions occur.
      • getProcessOnlyPreferredProducts

        public boolean getProcessOnlyPreferredProducts()
        Returns:
        whether only preferred products are processed
      • setProcessOnlyPreferredProducts

        public void setProcessOnlyPreferredProducts​(boolean processOnlyPreferredProducts)
        Parameters:
        processOnlyPreferredProducts - whether to process ony preferred products
      • setProcessUnassociatedProducts

        public void setProcessUnassociatedProducts​(boolean processUnassociatedProducts)
        Parameters:
        processUnassociatedProducts - to set
      • getProcessUnassociatedProducts

        public boolean getProcessUnassociatedProducts()
        Returns:
        boolean processUnassociatedProducts
      • isProcessOnlyWhenEventChanged

        public boolean isProcessOnlyWhenEventChanged()
        Returns:
        boolean processOnlyWhenEventChanged
      • setProcessOnlyWhenEventChanged

        public void setProcessOnlyWhenEventChanged​(boolean processOnlyWhenEventChanged)
        Parameters:
        processOnlyWhenEventChanged - to set
      • isIgnoreArchive

        public boolean isIgnoreArchive()
        Returns:
        ignoreArchive
      • setIgnoreArchive

        public void setIgnoreArchive​(boolean ignoreArchive)
        Parameters:
        ignoreArchive - to set