Class RegExpAndDurationTimeCoverageEnhancer

  • All Implemented Interfaces:
    DatasetEnhancer

    public class RegExpAndDurationTimeCoverageEnhancer
    extends Object
    implements DatasetEnhancer
    Try to add timeCoverage to the InvDataset using a regular expression match, capturing group replacement, and a duration string.

    1. Look for a match to the given matchPattern in the CrawlableDataset name.
    2. Substitute all replacment patterns ("$n") in the substitionPattern with the capturing groups from the regular expression match.
    3. Use the string obtained from the substitution as the start time and the given duration string to form a timeCoverage element for the InvDataset.
    Since:
    Dec 6, 2005 10:59:21 AM
    • Method Detail

      • getInstanceToMatchOnDatasetName

        public static RegExpAndDurationTimeCoverageEnhancer getInstanceToMatchOnDatasetName​(String matchPattern,
                                                                                            String substitutionPattern,
                                                                                            String duration)
        Factory method that returns a RegExpAndDurationTimeCoverageEnhancer instance that will apply the match pattern to the dataset name.
        Parameters:
        matchPattern - a regular expression used to match against the CrawlableDataset name.
        substitutionPattern - the time coverage start time (which may contain regular expression capturing group substitution strings).
        duration - the time coverage duration string.
        Returns:
        a RegExpAndDurationTimeCoverageEnhancer that will apply the match pattern to the dataset name.
      • getInstanceToMatchOnDatasetPath

        public static RegExpAndDurationTimeCoverageEnhancer getInstanceToMatchOnDatasetPath​(String matchPattern,
                                                                                            String substitutionPattern,
                                                                                            String duration)
        Factory method that returns a RegExpAndDurationTimeCoverageEnhancer instance that will apply the match pattern to the dataset path.
        Parameters:
        matchPattern - a regular expression used to match against the CrawlableDataset path.
        substitutionPattern - the time coverage start time (which may contain regular expression capturing group substitution strings).
        duration - the time coverage duration string.
        Returns:
        a RegExpAndDurationTimeCoverageEnhancer that will apply the match pattern to the dataset path.
      • getMatchTarget

        public thredds.cataloggen.datasetenhancer.RegExpAndDurationTimeCoverageEnhancer.MatchTarget getMatchTarget()
      • getMatchPattern

        public String getMatchPattern()
      • getSubstitutionPattern

        public String getSubstitutionPattern()
      • getDuration

        public String getDuration()
      • addMetadata

        public boolean addMetadata​(InvDataset dataset,
                                   CrawlableDataset crDataset)
        Description copied from interface: DatasetEnhancer
        Add metadata to the given InvDataset possibly using information from the corresponding CrawlableDataset.
        Specified by:
        addMetadata in interface DatasetEnhancer
        Parameters:
        dataset - the InvDataset to enhance with additional metadata.
        crDataset - the CrawlableDataset that corresponds with the given InvDataset, possibly used to gather information not available from the InvDataset.
        Returns:
        true if the InvDataset is successfully enhanced, otherwise false.