Class Registry


  • public class Registry
    extends Object
    The class holding the keys to box and tying it all together. This is a remnant of the Java EE days an much that is stored here could be eventually moved into Source.
    • Constructor Detail

      • Registry

        public Registry​(List<SourceConfig> sources,
                        ThreadFactory threadFactory)
        Creates and initializes the registry given the source configs and thread factory.
        Parameters:
        sources - the source configs to register
        threadFactory - the thread factory to use
    • Method Detail

      • startSchedules

        public void startSchedules()
      • addDependency

        public void addDependency​(String dependent,
                                  String dependency)
        Adds a dependent of a dependency.
        Parameters:
        dependent - the dependent source
        dependency - the source as a dependency
      • getBoxHealthCheck

        public BoxHealthCheck getBoxHealthCheck()
        Returns the box health check.
        Returns:
        the box health check
      • getDependents

        public Set<String> getDependents​(String sourceName)
        Returns the dependents of the given dependency.
        Parameters:
        sourceName - the dependency
        Returns:
        the dependents
      • getDocumentHandler

        public DocumentHandler getDocumentHandler()
        Return the document handler.
        Returns:
        the documentHandler
      • getDocumentProcessor

        public DocumentProcessor getDocumentProcessor​(String sourceName)
        Get the document processor for the given source name.
        Parameters:
        sourceName - the source name
        Returns:
        the document processor
      • getPrincipalSource

        public SourceConfig getPrincipalSource()
        Returns the principal source config.
        Returns:
        the principal source config
      • getQueue

        public QueueRunner getQueue​(String name)
        Get queue for the given source.
        Parameters:
        name - the source name
        Returns:
        the queue for the given source
      • getSource

        public SourceConfig getSource​(String name)
        Returns the source config for the given source name.
        Parameters:
        name - the source name
        Returns:
        the source config
      • getSources

        public List<SourceConfig> getSources()
        Return the sources.
        Returns:
        the sources
      • getThreadFactory

        public ThreadFactory getThreadFactory()
        Returns the thread factory.
        Returns:
        the threadFactory
      • getUpdatesNotifier

        public UpdatesNotifier getUpdatesNotifier()
        Returns the updates notifier.
        Returns:
        the updates notifier
      • isClosed

        public boolean isClosed()
        Returns whether or no the registry is closed.
        Returns:
        if is closed
      • isConfigured

        public boolean isConfigured()
        Returns whether or not this registry is configured.
        Returns:
        whether or not this registry is configured
      • isPrimary

        public boolean isPrimary​(String sourceName)
        Whether or not the given source is primary.
        Parameters:
        sourceName - the source name
        Returns:
        whether it is primary or not
      • isSource

        public boolean isSource​(String name)
        Returns true if the given name represents a registered source.
        Parameters:
        name - source name
        Returns:
        if source exists
      • preDestroy

        public void preDestroy()
        Shuts down the registry.
      • triggerHarvest

        public void triggerHarvest​(String sourceName)
        Triggers a harvest for the given source.
        Parameters:
        sourceName - the source name
      • verifySource

        public String verifySource​(String sourceName)
        Verify this source name and return it if valid.
        Parameters:
        sourceName - the source name to verify
        Returns:
        the canonical source name
        Throws:
        IllegalArgumentException - if source is not recognized