Class BaseThumbnailGenerator

java.lang.Object
org.codelibs.fess.thumbnail.impl.BaseThumbnailGenerator
All Implemented Interfaces:
ThumbnailGenerator
Direct Known Subclasses:
CommandGenerator, EmptyGenerator, HtmlTagBasedGenerator

public abstract class BaseThumbnailGenerator extends Object implements ThumbnailGenerator
Abstract base class for thumbnail generators. Provides common functionality for thumbnail generation implementations.
  • Field Details

    • conditionMap

      protected final Map<String,String> conditionMap
      Map of conditions for thumbnail generation.
    • directoryNameLength

      protected int directoryNameLength
      Length for directory name generation.
    • generatorList

      protected List<String> generatorList
      List of generator names.
    • filePathMap

      protected Map<String,String> filePathMap
      Map of file paths for thumbnail generation.
    • name

      protected String name
      The name of this thumbnail generator.
    • maxRedirectCount

      protected int maxRedirectCount
      Maximum number of redirects to follow.
    • available

      protected Boolean available
      Availability status of this generator.
  • Constructor Details

    • BaseThumbnailGenerator

      public BaseThumbnailGenerator()
      Default constructor for BaseThumbnailGenerator.
  • Method Details

    • register

      public void register()
      Registers this thumbnail generator with the thumbnail manager.
    • addCondition

      public void addCondition(String key, String regex)
      Adds a condition for thumbnail generation.
      Parameters:
      key - The condition key.
      regex - The regex pattern for the condition.
    • isTarget

      public boolean isTarget(Map<String,Object> docMap)
      Description copied from interface: ThumbnailGenerator
      Checks if this generator can handle the given document.
      Specified by:
      isTarget in interface ThumbnailGenerator
      Parameters:
      docMap - The document map containing metadata.
      Returns:
      True if this generator can handle the document, false otherwise.
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: ThumbnailGenerator
      Checks if this thumbnail generator is available for use.
      Specified by:
      isAvailable in interface ThumbnailGenerator
      Returns:
      True if available, false otherwise.
    • createTask

      public org.codelibs.core.misc.Tuple3<String,String,String> createTask(String path, Map<String,Object> docMap)
      Description copied from interface: ThumbnailGenerator
      Creates a thumbnail generation task.
      Specified by:
      createTask in interface ThumbnailGenerator
      Parameters:
      path - The path to the source document.
      docMap - The document map containing metadata.
      Returns:
      A tuple containing task information.
    • setDirectoryNameLength

      public void setDirectoryNameLength(int directoryNameLength)
      Sets the directory name length for thumbnail storage.
      Parameters:
      directoryNameLength - The directory name length.
    • expandPath

      protected String expandPath(String value)
      Expands a file path using the file path mapping.
      Parameters:
      value - The original path value.
      Returns:
      The expanded path or the original value if no mapping exists.
    • updateThumbnailField

      protected void updateThumbnailField(String thumbnailId, String value)
      Updates the thumbnail field in the search index.
      Parameters:
      thumbnailId - The thumbnail ID.
      value - The thumbnail value to update.
    • process

      protected boolean process(String id, BiPredicate<String,String> consumer)
      Processes thumbnail generation with a consumer function.
      Parameters:
      id - The document ID.
      consumer - The consumer function to process thumbnail and config ID.
      Returns:
      True if processing was successful, false otherwise.
    • process

      protected boolean process(String id, Predicate<org.codelibs.fess.crawler.entity.ResponseData> consumer)
      Processes thumbnail generation with a response data consumer.
      Parameters:
      id - The document ID.
      consumer - The consumer function to process response data.
      Returns:
      True if processing was successful, false otherwise.
    • setGeneratorList

      public void setGeneratorList(List<String> generatorList)
      Sets the list of generator names.
      Parameters:
      generatorList - The list of generator names.
    • getName

      public String getName()
      Description copied from interface: ThumbnailGenerator
      Gets the name of this thumbnail generator.
      Specified by:
      getName in interface ThumbnailGenerator
      Returns:
      The generator name.
    • setName

      public void setName(String name)
      Sets the name of this thumbnail generator.
      Parameters:
      name - The generator name.
    • setMaxRedirectCount

      public void setMaxRedirectCount(int maxRedirectCount)
      Sets the maximum number of redirects to follow.
      Parameters:
      maxRedirectCount - The maximum redirect count.