Class AbstractMetadataExtractor

java.lang.Object
org.craftercms.search.metadata.impl.AbstractMetadataExtractor
All Implemented Interfaces:
MetadataExtractor
Direct Known Subclasses:
ContentTypeMetadataExtractor, FileSizeMetadataExtractor, InternalNameMetadataExtractor

public abstract class AbstractMetadataExtractor extends Object implements MetadataExtractor
Base implementation of MetadataExtractor
Since:
3.1.1
Author:
joseross
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<String>
    Pattern of files that should be included
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Map<String,Object>
    doExtract(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
    Performs the actual metadata extraction
    extract(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
    Performs the metadata extraction on the given file
    protected abstract boolean
    isCompatible(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
    Checks if a given file should be processed by the current instance
    void
    setIncludePatterns(List<String> includePatterns)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • includePatterns

      protected List<String> includePatterns
      Pattern of files that should be included
  • Constructor Details

    • AbstractMetadataExtractor

      public AbstractMetadataExtractor()
  • Method Details

    • setIncludePatterns

      public void setIncludePatterns(List<String> includePatterns)
    • extract

      public Map<String,Object> extract(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
      Performs the metadata extraction on the given file
      Specified by:
      extract in interface MetadataExtractor
      Parameters:
      path - the path of the file to process
      contentStoreService - the content store service
      context - the current context
      Returns:
      the extracted metadata
    • isCompatible

      protected abstract boolean isCompatible(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
      Checks if a given file should be processed by the current instance
      Parameters:
      path - the path of the file to check
      contentStoreService - the content store service
      context - the current context
      Returns:
      true if the file should be processed
    • doExtract

      protected abstract Map<String,Object> doExtract(String path, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context)
      Performs the actual metadata extraction
      Parameters:
      path - the path of the file
      contentStoreService - the content store service
      context - the current context
      Returns:
      the extracted metadata