Class FrameworkRegistry

java.lang.Object
org.dlese.dpc.schemedit.FrameworkRegistry
All Implemented Interfaces:
EventListener, MetadataVocabReloadListener

public class FrameworkRegistry extends Object implements MetadataVocabReloadListener
A map holding MetaDataFramework instances, and keyed by the short name (e.g., "adn") of each particular framework.

The Registry is populated at system startup time. It reads framework config files and instantiates a MetaDataFramework instance for each one.

Author:
ostwald
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the FrameworkRegistry object
    FrameworkRegistry(String configDirPath, String docRoot)
    Constructor for the FrameworkRegistry object for specified configuration directory and docRoot (used for debugging - docRoot is normally calculated from servletContext).
    FrameworkRegistry constructure with ServletContext
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the load errors
    void
    Clear the load warnings
    void
    Destroys the loaded frameworks
    void
    Initialize each framework with information about which fields can be formatted using MUI Groups files.
    Return a list of formats for registered frameworks.
    Gets the directory in which framework config files are located.
    getFramework(String xmlFormat)
    Gets the framework for the specified xmlFormat
    boolean
    getIsLoaded(String xmlFormat)
    Returns true if the framework for provided xmlFormat is currently loaded in this FrameworkRegistry
    Gets the registered formats that are "item" frameworks (e.g., "adn", "dlese_anno", as opposed to frameworks used internally (e.g., "dcs_data") by the system.
    Gets the loadErrors attribute of the FrameworkRegistry object
    Gets the loadWarnings attribute of the FrameworkRegistry object
    Return the formats of the registered frameworks, excluding "dlese_collect"
    Gets the formats that are available to oai services, which are the itemFrameworks plus "dlese_collect"
    Returns a list of xmlFormats corresponding to framework config files that are present in the framework config directory, but are not currently loaded in the FrameworkRegistry object
    void
    Loads the FrameworkRegistry by traversing the framework config files in the config directory.
    void
    loadFramework(String xmlFormat)
    Loads the framework for specified xmlformat after finding the framework config file
    static void
    main(String[] args)
    NOT YET DOCUMENTED
    void
    Event handler for MetadataVocabReloadEvent registers MUI groups with appropriate frameworks and then re-renders the editors for frameworks that have registered MUI groups.
    void
    Register provided MetaDataFramework.
    int
    The number of registered frameworks
    Return a string representation of the registry for debugging purposes.
    void
    unregister(String xmlFormat)
    Remove the framework for provided xmlFormat from the registry

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FrameworkRegistry

      public FrameworkRegistry()
      Constructor for the FrameworkRegistry object
    • FrameworkRegistry

      public FrameworkRegistry(ServletContext servletContext)
      FrameworkRegistry constructure with ServletContext
      Parameters:
      servletContext - the servletContext
    • FrameworkRegistry

      public FrameworkRegistry(String configDirPath, String docRoot)
      Constructor for the FrameworkRegistry object for specified configuration directory and docRoot (used for debugging - docRoot is normally calculated from servletContext).
      Parameters:
      configDirPath - path to directory containing framework config files
      docRoot - path to servlet baseDir
  • Method Details

    • getConfigDir

      public File getConfigDir()
      Gets the directory in which framework config files are located.
      Returns:
      The configDir value
    • loadFramework

      public void loadFramework(String xmlFormat) throws Exception
      Loads the framework for specified xmlformat after finding the framework config file
      Parameters:
      xmlFormat - the xmlFormat for the framework (e.g., "adn")
      Throws:
      Exception - if the framework could not be loaded
    • load

      public void load()
      Loads the FrameworkRegistry by traversing the framework config files in the config directory.
    • getLoadErrors

      public ErrorLog getLoadErrors()
      Gets the loadErrors attribute of the FrameworkRegistry object
      Returns:
      The loadErrors value
    • clearLoadErrors

      public void clearLoadErrors()
      Clear the load errors
    • getLoadWarnings

      public ErrorLog getLoadWarnings()
      Gets the loadWarnings attribute of the FrameworkRegistry object
      Returns:
      The loadWarnings value
    • clearLoadWarnings

      public void clearLoadWarnings()
      Clear the load warnings
    • metadataVocabReloaded

      public void metadataVocabReloaded(MetadataVocabReloadEvent event)
      Event handler for MetadataVocabReloadEvent registers MUI groups with appropriate frameworks and then re-renders the editors for frameworks that have registered MUI groups.
      Specified by:
      metadataVocabReloaded in interface MetadataVocabReloadListener
      Parameters:
      event - NOT YET DOCUMENTED
    • extractMuiGroups

      public void extractMuiGroups()
      Initialize each framework with information about which fields can be formatted using MUI Groups files.
    • register

      public void register(MetaDataFramework mdf)
      Register provided MetaDataFramework.
      Parameters:
      mdf - the framework to be loaded
    • unregister

      public void unregister(String xmlFormat)
      Remove the framework for provided xmlFormat from the registry
      Parameters:
      xmlFormat - format (e.g., "adn") corresponding to a loaded framework
    • getFramework

      public MetaDataFramework getFramework(String xmlFormat)
      Gets the framework for the specified xmlFormat
      Parameters:
      xmlFormat - format (e.g., "adn") corresponding to a loaded framework
      Returns:
      The framework
    • size

      public int size()
      The number of registered frameworks
      Returns:
      the number of registered frameworks
    • getIsLoaded

      public boolean getIsLoaded(String xmlFormat)
      Returns true if the framework for provided xmlFormat is currently loaded in this FrameworkRegistry
      Parameters:
      xmlFormat - e.g., ("adn")
      Returns:
      true if framework is loaded.
    • getUnloadedFrameworks

      public List getUnloadedFrameworks()
      Returns a list of xmlFormats corresponding to framework config files that are present in the framework config directory, but are not currently loaded in the FrameworkRegistry object
      Returns:
      The unloadedFrameworks
    • toString

      public String toString()
      Return a string representation of the registry for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      Description of the Return Value
    • getAllFormats

      public List getAllFormats()
      Return a list of formats for registered frameworks.
      Returns:
      The allFormats value
    • getItemFormats

      public List getItemFormats()
      Gets the registered formats that are "item" frameworks (e.g., "adn", "dlese_anno", as opposed to frameworks used internally (e.g., "dcs_data") by the system.
      Returns:
      The itemFormats value
    • getOaiFormats

      public List getOaiFormats()
      Gets the formats that are available to oai services, which are the itemFrameworks plus "dlese_collect"
      Returns:
      The oaiFormats value
    • getNames

      public List getNames()
      Return the formats of the registered frameworks, excluding "dlese_collect"
      Returns:
      The names value
    • destroy

      public void destroy()
      Destroys the loaded frameworks
    • main

      public static void main(String[] args)
      NOT YET DOCUMENTED
      Parameters:
      args - NOT YET DOCUMENTED