Class DataManager

java.lang.Object
io.goobi.viewer.controller.DataManager

public final class DataManager extends Object
Application-scoped singleton that acts as the central access point for the DAO, configuration, and other core services.
  • Method Details

    • getInstance

      public static DataManager getInstance()
      Getter for the field instance.
      Returns:
      the singleton DataManager instance
    • getModules

      public List<IModule> getModules()
      Getter for the field modules.

      Returns a defensive copy to prevent ConcurrentModificationException when JSF's c:forEach iterates the list while a background thread registers a new module via registerModule(IModule).

      Returns:
      a snapshot of all registered viewer modules
    • getUrlBuilder

      public IURLBuilder getUrlBuilder()
      getUrlBuilder.
      Returns:
      the URL builder provided by a registered module, or the default URL builder if no module provides one
    • getModule

      public IModule getModule(String id) throws ModuleMissingException
      getModule.
      Parameters:
      id - unique identifier of the module to look up
      Returns:
      the registered IModule with the given ID
      Throws:
      ModuleMissingException - if any.
    • isModuleLoaded

      public boolean isModuleLoaded(String id)
      isModuleLoaded.
      Parameters:
      id - unique identifier of the module to check
      Returns:
      true if a module with the given ID is currently registered, false otherwise
    • registerModule

      public boolean registerModule(IModule module)
      registerModule.
      Parameters:
      module - module instance to register
      Returns:
      true if the module was successfully registered, false if a module with the same ID is already registered
    • getSessionCount

      public int getSessionCount()
      getSessionCount.
      Returns:
      a int.
    • getSessionMap

      public Map<String,Map<String,String>> getSessionMap()
      Getter for the field sessionMap.
      Returns:
      the map of active HTTP session data, keyed by session ID
    • getConfiguration

      public Configuration getConfiguration()
      Getter for the field configuration.
      Returns:
      the global viewer configuration instance, initialised lazily on first access
    • getLanguageHelper

      public LanguageHelper getLanguageHelper()
      Getter for the field languageHelper.
      Returns:
      the language helper instance for ISO language code lookups, initialised lazily on first access
    • getSearchIndex

      public SolrSearchIndex getSearchIndex()
      Getter for the field searchIndex.
      Returns:
      the Solr search index instance, initialised lazily on first access
    • closeSearchIndex

      public void closeSearchIndex() throws IOException
      Closes the Solr search index client directly, without triggering SolrSearchIndex.checkReloadNeeded().

      Use this during application shutdown instead of getSearchIndex().close() to prevent a closed client from being silently replaced by a new one.

      Throws:
      IOException - if closing the client fails
    • getDao

      public IDAO getDao() throws DAOException
      Getter for the field dao.
      Returns:
      the data access object for database operations, initialised lazily on first access
      Throws:
      DAOException - if any.
    • injectConfiguration

      public void injectConfiguration(Configuration configuration)
      Sets custom Configuration object (used for unit testing).
      Parameters:
      configuration - configuration instance to inject
    • injectSearchIndex

      public void injectSearchIndex(SolrSearchIndex searchIndex)
      Sets custom SolrSearchIndex object (used for unit testing).
      Parameters:
      searchIndex - Solr search index instance to inject
    • injectDao

      public void injectDao(IDAO dao)
      Sets custom IDAO object (used for unit testing).
      Parameters:
      dao - DAO instance to inject
    • getBookmarkManager

      public SessionStoreBookmarkManager getBookmarkManager()
      Getter for the field bookmarkManager.
      Returns:
      the session-scoped bookmark manager, creating one if not yet initialized
    • injectBookmarkManager

      public void injectBookmarkManager(SessionStoreBookmarkManager bookmarkManager)
      injectBookmarkManager.
      Parameters:
      bookmarkManager - bookmark manager instance to inject
    • injectAuthResponseListener

      public void injectAuthResponseListener(AuthResponseListener<HttpAuthenticationProvider> listener)
      injectAuthResponseListener.
      Parameters:
      listener - authentication response listener to inject
    • getAuthResponseListener

      public AuthResponseListener<HttpAuthenticationProvider> getAuthResponseListener()
      Getter for the field authResponseListener.
      Returns:
      the authentication response listener, creating one if not yet initialized
    • getRecordCampaignMap

      public Map<String,List<Campaign>> getRecordCampaignMap()
      Getter for the field recordCampaignMap.
      Returns:
      the map of persistent identifiers (PI) to associated crowdsourcing campaigns
    • setRecordCampaignMap

      public void setRecordCampaignMap(Map<String,List<Campaign>> recordCampaignMap)
      Setter for the field recordCampaignMap.
      Parameters:
      recordCampaignMap - map of PI to associated crowdsourcing campaigns
    • getIndexerVersion

      public String getIndexerVersion()
    • setIndexerVersion

      public void setIndexerVersion(String indexerVersion)
      Parameters:
      indexerVersion - version string of the Goobi viewer indexer
    • getConnectorVersion

      public String getConnectorVersion()
    • setConnectorVersion

      public void setConnectorVersion(String connectorVersion)
      Parameters:
      connectorVersion - version string of the Goobi viewer connector
    • getHotfolderFileCount

      public int getHotfolderFileCount()
    • setHotfolderFileCount

      public void setHotfolderFileCount(int hotfolderFileCount)
      Parameters:
      hotfolderFileCount - number of files currently in the hotfolder
    • getRestApiManager

      public RestApiManager getRestApiManager()
    • setRestApiManager

      public void setRestApiManager(RestApiManager restApiManager)
      Parameters:
      restApiManager - REST API manager instance to set
    • getRecordLockManager

      public RecordLockManager getRecordLockManager()
    • getTiming

      public de.intranda.monitoring.timer.TimeAnalysis getTiming()
    • resetTiming

      public void resetTiming()
    • getFileResourceManager

      public FileResourceManager getFileResourceManager()
    • getRestApiJobManager

      public TaskManager getRestApiJobManager()
    • getArchiveManager

      public ArchiveManager getArchiveManager()
    • getClientManager

      public ClientApplicationManager getClientManager() throws DAOException
      Throws:
      DAOException
    • getSecurityManager

      public SecurityManager getSecurityManager()
    • setClientManager

      public void setClientManager(ClientApplicationManager manager)
    • getUsageStatisticsRecorder

      public UsageStatisticsRecorder getUsageStatisticsRecorder() throws DAOException
      Throws:
      DAOException
    • setUsageStatisticsRecorder

      public void setUsageStatisticsRecorder(UsageStatisticsRecorder usageStatisticsRecorder)
    • getBearerTokenManager

      public BearerTokenManager getBearerTokenManager()