Package edu.byu.hbll.box.internal.core
Class Registry
- java.lang.Object
-
- edu.byu.hbll.box.internal.core.Registry
-
-
Field Summary
Fields Modifier and Type Field Description static String
PRINCIPAL_SOURCE_ALIAS
-
Constructor Summary
Constructors Constructor Description Registry(List<SourceConfig> sources, ThreadFactory threadFactory)
Creates and initializes the registry given the source configs and thread factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDependency(String dependent, String dependency)
Adds a dependent of a dependency.BoxHealthCheck
getBoxHealthCheck()
Returns the box health check.Set<String>
getDependents(String sourceName)
Returns the dependents of the given dependency.DocumentHandler
getDocumentHandler()
Return the document handler.DocumentProcessor
getDocumentProcessor(String sourceName)
Get the document processor for the given source name.SourceConfig
getPrincipalSource()
Returns the principal source config.QueueRunner
getQueue(String name)
Get queue for the given source.SourceConfig
getSource(String name)
Returns the source config for the given source name.List<SourceConfig>
getSources()
Return the sources.ThreadFactory
getThreadFactory()
Returns the thread factory.UpdatesNotifier
getUpdatesNotifier()
Returns the updates notifier.boolean
isClosed()
Returns whether or no the registry is closed.boolean
isConfigured()
Returns whether or not this registry is configured.boolean
isPrimary(String sourceName)
Whether or not the given source is primary.boolean
isSource(String name)
Returns true if the given name represents a registered source.void
preDestroy()
Shuts down the registry.void
startSchedules()
void
triggerHarvest(String sourceName)
Triggers a harvest for the given source.String
verifySource(String sourceName)
Verify this source name and return it if valid.
-
-
-
Field Detail
-
PRINCIPAL_SOURCE_ALIAS
public static final String PRINCIPAL_SOURCE_ALIAS
- See Also:
- Constant Field Values
-
-
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 registerthreadFactory
- 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 sourcedependency
- 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
-
-