Class DictionaryCreator

java.lang.Object
org.codelibs.fess.dict.DictionaryCreator
Direct Known Subclasses:
CharMappingCreator, KuromojiCreator, ProtwordsCreator, StemmerOverrideCreator, StopwordsCreator, SynonymCreator

public abstract class DictionaryCreator extends Object
Abstract base class for creating dictionary files from file paths. Dictionary creators are responsible for recognizing specific file patterns and creating appropriate DictionaryFile instances for them.
  • Field Details

    • pattern

      protected Pattern pattern
      Pattern used to match file paths that this creator can handle.
    • dictionaryManager

      protected DictionaryManager dictionaryManager
      Manager for dictionary operations and lifecycle.
  • Constructor Details

    • DictionaryCreator

      protected DictionaryCreator(String pattern)
      Creates a new DictionaryCreator with the specified pattern.
      Parameters:
      pattern - the regular expression pattern to match file paths
  • Method Details

    • create

      public DictionaryFile<? extends DictionaryItem> create(String path, Date timestamp)
      Creates a dictionary file for the given path and timestamp if it matches this creator's pattern.
      Parameters:
      path - the file path to create a dictionary file for
      timestamp - the timestamp of the dictionary file
      Returns:
      a DictionaryFile instance if the path matches, null otherwise
    • encodePath

      protected String encodePath(String path)
      Encodes a file path using Base64 URL-safe encoding.
      Parameters:
      path - the file path to encode
      Returns:
      the Base64 encoded path
    • isTarget

      protected boolean isTarget(String path)
      Checks if the given path matches this creator's pattern.
      Parameters:
      path - the file path to check
      Returns:
      true if the path matches the pattern, false otherwise
    • newDictionaryFile

      protected abstract DictionaryFile<? extends DictionaryItem> newDictionaryFile(String id, String path, Date timestamp)
      Creates a new dictionary file instance for the given parameters.
      Parameters:
      id - the encoded identifier for the dictionary file
      path - the file path of the dictionary
      timestamp - the timestamp of the dictionary file
      Returns:
      a new DictionaryFile instance
    • setDictionaryManager

      public void setDictionaryManager(DictionaryManager dictionaryManager)
      Sets the dictionary manager for this creator.
      Parameters:
      dictionaryManager - the dictionary manager to set