Class ScriptMappings


  • public class ScriptMappings
    extends java.lang.Object
    The ScriptMappings class is a convenient 'wrapper' class for BuildProperties that provides utility methods to work specifically with script mappings.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DBB_SCRIPT_MAPPING_KEY
      Script mapping BuildProperties key (added in DBB 1.0.2)
      static java.lang.String SCRIPT_MAPPING_KEY
      Deprecated.
      - Use DBB_SCRIPT_MAPPING_KEY
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptMappings()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addFilePattern​(java.lang.String scriptName, java.lang.String filePattern)
      Appends a file pattern to the list of associated file patterns for the script mapping
      static void addFilePatterns​(java.lang.String scriptName, java.util.List<java.lang.String> filePatterns)
      Appends a list of file patterns to the list of associated file patterns for the script mapping
      static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName, java.io.File file)
      Returns a sublist of files that are mapped the the script name
      static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName, java.io.File file, java.lang.String encoding)
      Returns a sublist of files that are mapped the the script name
      static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName, java.util.List<java.lang.String> files)
      Returns a sublist of files that are mapped the the script name
      static java.lang.String getScriptName​(java.lang.String file)
      Returns the script name associated to the relative path file or NULL if no script name is found for the file.
      static java.util.Set<java.lang.String> getScriptNames()
      Returns all the script mappings names
      static boolean isMapped​(java.lang.String scriptName, java.lang.String file)
      Returns true if the list contains the script mapping
      static void setScriptName​(java.lang.String scriptName, java.util.List<java.lang.String> filePatterns)
      Sets a script mapping association.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SCRIPT_MAPPING_KEY

        public static final java.lang.String SCRIPT_MAPPING_KEY
        Deprecated.
        - Use DBB_SCRIPT_MAPPING_KEY
        Script mapping BuildProperties key
        See Also:
        Constant Field Values
      • DBB_SCRIPT_MAPPING_KEY

        public static final java.lang.String DBB_SCRIPT_MAPPING_KEY
        Script mapping BuildProperties key (added in DBB 1.0.2)
        See Also:
        Constant Field Values
    • Constructor Detail

      • ScriptMappings

        public ScriptMappings()
    • Method Detail

      • getScriptName

        public static java.lang.String getScriptName​(java.lang.String file)
        Returns the script name associated to the relative path file or NULL if no script name is found for the file.
        Parameters:
        file - The relative path of the file to search for.
        Returns:
        The name of the script associated to the file or NULL if none found
      • setScriptName

        public static void setScriptName​(java.lang.String scriptName,
                                         java.util.List<java.lang.String> filePatterns)
        Sets a script mapping association. If the script mapping already exists, the existing file pattern associations are replaced with the new file patterns
        Parameters:
        scriptName - The name of the script to associate
        filePatterns - The list of file patterns to associate to this script
      • addFilePattern

        public static void addFilePattern​(java.lang.String scriptName,
                                          java.lang.String filePattern)
        Appends a file pattern to the list of associated file patterns for the script mapping
        Parameters:
        scriptName - The name of the script
        filePattern - The file pattern to add to the script mapping
      • addFilePatterns

        public static void addFilePatterns​(java.lang.String scriptName,
                                           java.util.List<java.lang.String> filePatterns)
        Appends a list of file patterns to the list of associated file patterns for the script mapping
        Parameters:
        scriptName - The name of the script
        filePatterns - The list of file patterns to add to the script mapping
      • isMapped

        public static boolean isMapped​(java.lang.String scriptName,
                                       java.lang.String file)
        Returns true if the list contains the script mapping
        Parameters:
        scriptName - The name of the script
        file - The relative file associated to the script name
        Returns:
        true if the list contains the script mapping
      • getMappedList

        public static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName,
                                                                     java.util.List<java.lang.String> files)
        Returns a sublist of files that are mapped the the script name
        Parameters:
        scriptName - The name of the script be matched
        files - The list of files to match
        Returns:
        A list of relative path files that are associated to the script name
      • getMappedList

        public static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName,
                                                                     java.io.File file)
                                                              throws java.io.IOException
        Returns a sublist of files that are mapped the the script name
        Parameters:
        scriptName - The name of the script be matched
        file - An external file containing a list of files to match
        Returns:
        A list of relative path files that are associated to the script name
        Throws:
        java.io.IOException - If an error occurred when reading the file.
      • getMappedList

        public static java.util.List<java.lang.String> getMappedList​(java.lang.String scriptName,
                                                                     java.io.File file,
                                                                     java.lang.String encoding)
                                                              throws java.io.IOException
        Returns a sublist of files that are mapped the the script name
        Parameters:
        scriptName - The name of the script be matched
        file - An external file containing a list of files to match
        encoding - The encoding of the input file
        Returns:
        A list of relative path files that are associated to the script name
        Throws:
        java.io.IOException - If an error occurred when reading the file.
      • getScriptNames

        public static java.util.Set<java.lang.String> getScriptNames()
        Returns all the script mappings names
        Returns:
        A set of all script mapping names