Class SourceConfig.Builder

    • Method Detail

      • enabled

        public SourceConfig.Builder enabled​(boolean enabled)
        Whether to enable or disable this source. A disabled source behaves like it doesn't even exist. Default true.
        Parameters:
        enabled - true if enabled, false if disabled
        Returns:
        this
      • principal

        public SourceConfig.Builder principal​(boolean principal)
        Whether to mark this source as the principal source or in other words the main source of the box. Also some apis are simplified for the principal source because no source name has to be specified. If no source is explicitly marked as principal, the first one added to the configuration will be considered as principal. Default false.
        Parameters:
        principal - true if principal, otherwise false
        Returns:
        this
      • processor

        public SourceConfig.Builder processor​(Processor processor)
        The processor to use for this source. Setting this enables direct processing of documents.
        Parameters:
        processor - sets the processor
        Returns:
        this
      • batchDelay

        public SourceConfig.Builder batchDelay​(Duration batchDelay)
        How long to wait before running a batch at less than capacity. Only valid for the processor. Default Duration.ZERO.
        Parameters:
        batchDelay - sets batch delay
        Returns:
        this
      • batchCapacity

        public SourceConfig.Builder batchCapacity​(int batchCapacity)
        The maximum size a batch can grow before processing occurs. Default 1.
        Parameters:
        batchCapacity - sets batch capacity
        Returns:
        this
      • threadCount

        public SourceConfig.Builder threadCount​(int threadCount)
        How many threads should be processing batches. Default 1.
        Parameters:
        threadCount - sets thread count
        Returns:
        this
      • processEnabled

        public SourceConfig.Builder processEnabled​(boolean processEnabled)
        Whether or not to enable or disable this processor. If disabled, this source behaves as if it doesn't have a processor. Default true.
        Parameters:
        processEnabled - true or false to enable processor
        Returns:
        this
      • harvester

        public SourceConfig.Builder harvester​(Harvester harvester)
        The harvester to use for this source. Setting this enables harvesting of documents. Default null.
        Parameters:
        harvester - the harvest to set
        Returns:
        this
      • harvestEnabled

        public SourceConfig.Builder harvestEnabled​(boolean harvestEnabled)
        Whether or not to enable or disable this harvester. If disabled, this source behaves as if it doesn't have a harvester. Default true.
        Parameters:
        harvestEnabled - true or false to enable harvests
        Returns:
        this
      • harvestSchedule

        public SourceConfig.Builder harvestSchedule​(edu.byu.hbll.scheduler.Schedule harvestSchedule)
        A cron-like schedule of when to run the harvester. Default every minute.
        Parameters:
        harvestSchedule - the schedule to set
        Returns:
        this
      • harvestResetSchedule

        public SourceConfig.Builder harvestResetSchedule​(edu.byu.hbll.scheduler.Schedule harvestResetSchedule)
        A cron-like schedule of when to reset the harvester and cause it to start from the very beginning. Default null (never).
        Parameters:
        harvestResetSchedule - schedule to set
        Returns:
        this
      • saveDeleted

        public SourceConfig.Builder saveDeleted​(boolean saveDeleted)
        Whether or not to save new deleted documents during harvests. Default false.
        Parameters:
        saveDeleted - true or false to save new deleted documents
        Returns:
        this
      • suspend

        public SourceConfig.Builder suspend​(Duration suspend)
        How long to suspend processing threads after each batch. Default Duration.ZERO.
        Parameters:
        suspend - the suspend to set
        Returns:
        this
      • quota

        public SourceConfig.Builder quota​(int quota)
        Stop processing when quota is reached. Default 0 (no quota).
        Parameters:
        quota - the quota to set
        Returns:
        this
      • quotaReset

        public SourceConfig.Builder quotaReset​(edu.byu.hbll.scheduler.Schedule quotaReset)
        When to reset the processed count to zero to allow more processing to occur until the quota is reached again. Default midnight each day.
        Parameters:
        quotaReset - schedule to set
        Returns:
        this
      • on

        public SourceConfig.Builder on​(edu.byu.hbll.scheduler.Schedule on)
        When to turn on processing for a window of time. Default null (always on).
        Parameters:
        on - when to turn on processing
        Returns:
        this
      • off

        public SourceConfig.Builder off​(edu.byu.hbll.scheduler.Schedule off)
        When to turn of processing for a window of time. Default null (always on).
        Parameters:
        off - when to turn off processing
        Returns:
        this
      • reprocessAge

        public SourceConfig.Builder reprocessAge​(Duration reprocessAge)
        Reprocess old documents that haven't been processed for this long. Default null (never).
        Parameters:
        reprocessAge - the age to set
        Returns:
        this
      • reprocessSchedule

        public SourceConfig.Builder reprocessSchedule​(edu.byu.hbll.scheduler.Schedule reprocessSchedule)
        When to go looking for old documents to reprocess. Default every minute.
        Parameters:
        reprocessSchedule - the schedule to set
        Returns:
        this
      • removeAge

        public SourceConfig.Builder removeAge​(Duration removeAge)
        Remove deleted documents that have been deleted for this long. Default null (never).
        Parameters:
        removeAge - the age to set
        Returns:
        this
      • removeSchedule

        public SourceConfig.Builder removeSchedule​(edu.byu.hbll.scheduler.Schedule removeSchedule)
        When to run the remove process. Default every minute.
        Parameters:
        removeSchedule - the schedule to set
        Returns:
        this
      • facetFields

        public SourceConfig.Builder facetFields​(String name,
                                                String... path)
        Each time a document is saved, fields that match the dot-notated paths will be added as facets with the given name.
        Parameters:
        name - name of the facet
        path - path to the field in the document
        Returns:
        this
      • facetFields

        public SourceConfig.Builder facetFields​(String name,
                                                Collection<String> path)
        Each time a document is saved, fields that match the dot-notated paths will be added as facets with the given name.
        Parameters:
        name - name of facet
        path - path to the field in the document
        Returns:
        this
      • save

        public SourceConfig.Builder save​(boolean save)
        Whether or not to save documents to the database. This is important for sources that need to always process in real-time. Default true.
        Parameters:
        save - true or false to save documents
        Returns:
        this
      • process

        public SourceConfig.Builder process​(boolean process)
        Whether or not to always process documents synchronously in real-time. Default false.
        Parameters:
        process - true or false to always process
        Returns:
        this
      • dependencyOnly

        public SourceConfig.Builder dependencyOnly​(boolean dependencyOnly)
        Whether or not this source is only a dependency for other sources. When set to true, documents from this source are only saved if they are dependencies for other sources. Default false.
        Parameters:
        dependencyOnly - true or false if dependency only
        Returns:
        this
      • defaultLimit

        public SourceConfig.Builder defaultLimit​(int defaultLimit)
        The default limit of documents to return for harvest type queries. Default 10.
        Parameters:
        defaultLimit - the default limit to set
        Returns:
        this
      • db

        public SourceConfig.Builder db​(BoxDatabase db)
        Use this database for storing documents and other info for Box. Databases are source specific so do not use the same one for multiple sources. Default MemoryDatabase.
        Parameters:
        db - the database to set
        Returns:
        this
      • cursorDb

        public SourceConfig.Builder cursorDb​(BoxDatabase cursorDb)
        In the case that the database is read-only database, it's still important to know where a harvest left off. This will override the regular db if set. Default null.
        Parameters:
        cursorDb - the cursor db to set
        Returns:
        this
      • other

        public SourceConfig.Builder other​(BoxConfigurable other)
        If there is any other extension class that you want Box to manage.
        Parameters:
        other - the other to add
        Returns:
        this
      • overwrite

        public SourceConfig.Builder overwrite​(boolean overwrite)
        Whether or not to overwrite existing documents on every save attempt. If false Box will detect if a saved document is different than the currently processed or harvested document. If the document has not changed since last time, the document will not be overwritten and only the processed date is updated. The document keeps its current modified date and cursor. When set to true, the document is always detected as modified and the full save process will occur. Default false.

        Note: Even with this set to true, unprocessed documents will never overwrite processed documents.

        Parameters:
        overwrite - the overwrite to set
        Returns:
        this
      • postEnabled

        public SourceConfig.Builder postEnabled​(boolean postEnabled)
        Whether or not to enable posting of documents to web endpoints.
        Parameters:
        postEnabled - the postEnabled to set
        Returns:
        this