Package com.ibm.dbb.dependency
Class DependencyScannerRegistry
- java.lang.Object
-
- com.ibm.dbb.dependency.DependencyScannerRegistry
-
public class DependencyScannerRegistry extends java.lang.ObjectTheDependencyScannerRegistrymaintains a map of file extensions toIDependencyScannerinstances that allows for the easy identification and retrieval of the correctIDependencyScannerfor a given file path. Users can add and delete scanner mappings. The registry is loaded at startup with the following mappings:File Extension IDependencyScanner asm DependencyScanner+ languageHint='ASM'bzucfg ZUnitConfigScannerc DependencyScanner+ languageHint='C'cbl DependencyScanner+ languageHint='COB'cpp DependencyScanner+ languageHint='CPP'cpy DependencyScanner+ languageHint='COB'h DependencyScanner+ languageHint='C'hpp DependencyScanner+ languageHint='CPP'inc DependencyScanner+ languageHint='PLI'mac DependencyScanner+ languageHint='ASM'pli DependencyScanner+ languageHint='PLI'
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddExcludeListPattern(java.lang.String pattern)Add pattern to the exclude list.static voidaddExcludeListPatterns(java.util.List<java.lang.String> list)Add patterns to the exclude list.static voidaddScanner(java.lang.String fileExtension, IDependencyScanner scanner)Adds an instance of IDependencyScanner to the registrystatic voidclear()Clear the static variables created by this class and remove all default filetype associations.static java.util.List<java.lang.String>getExcludeList()Get excluded file patterns.static IDependencyScannergetScanner(java.lang.String filepath)Returns the instance of IDependencyScanner registered for this file's file extension or the default scanner if no scanner is registered to the file extension.static java.util.List<java.lang.String>listFileExtensions()static voidremoveScanner(java.lang.String fileExtension)Removes a scanner from the registrystatic voidsetDefaultScanner(IDependencyScanner scanner)Sets the default scanner returned bygetScanner()when no scanner is defined.static voidsetExcludeList(java.util.List<java.lang.String> list)Set the exclude list.static voidstaticReset()Resets the static variables created by this class and sets default filetype associations.
-
-
-
Method Detail
-
setDefaultScanner
public static void setDefaultScanner(IDependencyScanner scanner)
Sets the default scanner returned bygetScanner()when no scanner is defined.- Parameters:
scanner- A scanner object
-
getScanner
public static IDependencyScanner getScanner(java.lang.String filepath)
Returns the instance of IDependencyScanner registered for this file's file extension or the default scanner if no scanner is registered to the file extension. If the filepath matches a pattern in the excluded files list, getScanner() returns null. The default scanner isDummyScannerbut can be overridden usingsetDefaultScanner. If no '.' is found in the filepath, then the string is assumed to be a file extension.- Parameters:
filepath- - the path of the file that needs to be scanned or a file extension used to register a scanner- Returns:
- the matched, or new,
IDependencyScanner, or null if the filepath is on the Exclude List.
-
addScanner
public static void addScanner(java.lang.String fileExtension, IDependencyScanner scanner)Adds an instance of IDependencyScanner to the registry- Parameters:
fileExtension- - the file extension used to register the scanner. Example 'cob'scanner- - An instance of IDependencyScanner
-
removeScanner
public static void removeScanner(java.lang.String fileExtension)
Removes a scanner from the registry- Parameters:
fileExtension- - the file extension used to register the scanner. Example 'cob'
-
listFileExtensions
public static java.util.List<java.lang.String> listFileExtensions()
- Returns:
- A list of file extensions which have a default scanner defined.
-
addExcludeListPatterns
public static void addExcludeListPatterns(java.util.List<java.lang.String> list)
Add patterns to the exclude list.- Parameters:
list- The list of patterns to be added.
-
addExcludeListPattern
public static void addExcludeListPattern(java.lang.String pattern)
Add pattern to the exclude list.- Parameters:
pattern- The pattern to be added to the exclude list.
-
setExcludeList
public static void setExcludeList(java.util.List<java.lang.String> list)
Set the exclude list.- Parameters:
list- The exclude list to set.
-
getExcludeList
public static java.util.List<java.lang.String> getExcludeList()
Get excluded file patterns.- Returns:
- The list of excluded patterns.
-
staticReset
public static void staticReset()
Resets the static variables created by this class and sets default filetype associations. For use with the DBB Shared Daemon
-
clear
public static void clear()
Clear the static variables created by this class and remove all default filetype associations.
-
-