com.ibm.dbb.dependency

Class SearchPathDependencyResolver

  • java.lang.Object
    • com.ibm.dbb.dependency.SearchPathDependencyResolver


  • public class SearchPathDependencyResolver
    extends java.lang.Object
    The SearchPathDependenceyResolver class is used to resolve build dependencies identified by the DBB dependency scanners to physical source files on the local file system. The returned list of physical dependencies from the resolveDependencies method can then be used to copy the source files from the z/OS Unix file system to SYSLIB data sets to be used when compiling the program.

    Dependency search path
    The SearchPathDependenceyResolver constructor requires a searchPath argument that is a simple formatted String used to resolve logical dependencies in a source file (ex. COPY ABC) to physical files in z/OS Unix file system (ex. /u/usr1/build/repo/abc.cpy). Examples of dependency search paths are listed below.

    // Search workspace or archive file using a specific file extension
    String copybookSearch = "search:/u/build/repo?path=** /*.cpy";
    String copybookArchiveSearch = "search:/u/build/lib/copybooks.tar.gz?path=** /*.cpy";

    // Targeted search with specific path
    String copybookSearch = "search:/u/build/repo?path=MortgageApplication/copybook/*.cpy";
    String copybookArchiveSearch = "search:/u/build/lib/copybooks.tar.gz?path=copybook/*.cpy";

    // Search paths using dependency filters
    String syslibFilterSearch = "search:[SYSLIB]/u/build/repo?path=${application}/copybook/*.cpy";
    String syslibCopylibFilterSearch = search:[SYSLIB,COPYLIB]/u/build/repo?path=${application}/copybook/*.cpy";
    String linkCategoryFilterSearch = search:[:LINK]/u/build/repo?path=${application}/cobol;${application}/link";
    String lnameWildcardFilterSearch = search:[::EPSN*,EPSC*]/u/build/repo?path=${application}/copybook/*.cpy";

    // Dependency exclude list filter search
    String lnameExcludes = "^DFH*,^CEE*,^XCH*,^XWS*,^SQLCA,^DSN*";
    String excludeDependencyFilterSearch = "search:[SYSLIB::" + lnameExcludes + "]/u/build/repo?path=${application}/copybook/";

    For more information about the Dependency search path see DBB documentation on How to manage build dependencies

    • Constructor Summary

      Constructors 
      Constructor and Description
      SearchPathDependencyResolver(java.lang.String searchPath)
      Used to create an instance of the SearchPathDependencyResolver
      SearchPathDependencyResolver(java.lang.String searchPath, boolean disableCache)
      Used to create an instance of the SearchPathDependencyResolver
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static LogicalFile getArchivedLogicalFile(java.lang.String file, java.lang.String archive)
      Returns the logical file for the source file in an archive from the logical file cache.
      static LogicalFile getArchivedLogicalFile(java.lang.String file, java.lang.String archive, boolean disableCache)
      Returns the logical file for the source file in an archive from the logical file cache.
      static LogicalFile getLogicalFile(java.lang.String file, java.lang.String sourceDir)
      Returns the logical file for the source file from the logical file cache.
      static LogicalFile getLogicalFile(java.lang.String file, java.lang.String sourceDir, boolean disableCache)
      Returns the logical file for the source file from the logical file cache.
      java.lang.String getSearchPath()
      Returns the dependency search path for the dependency resolver
      java.util.List<com.ibm.dbb.dependency.internal.SearchPath> getSearchPathList() 
      boolean isDisableCache()
      Returns true if the LogicalFile cache is disabled.
      java.util.List<PhysicalDependency> resolveDependencies(java.lang.String file, java.lang.String sourceDir)
      Resolves logical dependencies in a source file (ex.
      LogicalFile resolveSubsystems(java.lang.String file, java.lang.String sourceDir)
      Updates the source file's logical file subsystem flags i.e.
      • Methods inherited from class java.lang.Object

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

      • SearchPathDependencyResolver

        public SearchPathDependencyResolver(java.lang.String searchPath)
        Used to create an instance of the SearchPathDependencyResolver
        Parameters:
        searchPath - Dependency search path
      • SearchPathDependencyResolver

        public SearchPathDependencyResolver(java.lang.String searchPath,
                                            boolean disableCache)
        Used to create an instance of the SearchPathDependencyResolver
        Parameters:
        searchPath - Dependency search path
        disableCache - Used to disable the logical file cache.
    • Method Detail

      • resolveDependencies

        public java.util.List<PhysicalDependency> resolveDependencies(java.lang.String file,
                                                                      java.lang.String sourceDir)
                                                               throws BuildException,
                                                                      DependencyException,
                                                                      java.io.IOException
        Resolves logical dependencies in a source file (ex. COPY ABC) to physical files in z/OS Unix file system (ex. /u/usr1/build/repo/abc.cpy) using the searchPath that this class was instantiated with. This method uses the #getLogicalFile(String, String, boolean) method to retrieve the file's list of {@link LogicalDependency} to resolve.
        Parameters:
        file - The source file to look up or scan
        sourceDir - The source directory which contains the source file
        Returns:
        a list of PhysicalDependency for each source file logical dependency
        Throws:
        BuildException - If no scanner for the source file is not registered
        DependencyException - If an error occurs during dependency resolution
        java.io.IOException - If an IO error occurs during dependency resolution
      • resolveSubsystems

        public LogicalFile resolveSubsystems(java.lang.String file,
                                             java.lang.String sourceDir)
                                      throws BuildException,
                                             DependencyException,
                                             java.io.IOException
        Updates the source file's logical file subsystem flags i.e. isCICS(), isSQL(), isDLI(), isMQ() with information from resolved dependency logical file subsystem flags that are set to true. This is needed when a program's EXEC SQL or EXEC CICS statements reside in COBOL copy books or PL/I include files rather in the program's source file. This method uses the #resolveDependencies() method to retrieve the file's resolved physical dependencies.
        Parameters:
        file - The source file to identify subsystems used
        sourceDir - The source directory which contains the source file
        Returns:
        the program's LogicalFile with updated subsystem flags
        Throws:
        BuildException - If no scanner for the source file is not registered
        DependencyException - If an error occurs during dependency resolution
        java.io.IOException - If an IO error occurs during dependency resolution
      • getLogicalFile

        public static LogicalFile getLogicalFile(java.lang.String file,
                                                 java.lang.String sourceDir)
                                          throws BuildException
        Returns the logical file for the source file from the logical file cache. If the logical file is not found in the cache, then the file is scanned and the resulting logical file is returned. This method uses the DependencyScannerRegistry to identify which scanner to scan the file with. If no scanner is registered for the source file's extension then a BuildException is thrown
        Parameters:
        file - The source file to look up or scan
        sourceDir - The source directory which contains the source file
        Throws:
        BuildException - If no scanner for the source file is not registered
      • getLogicalFile

        public static LogicalFile getLogicalFile(java.lang.String file,
                                                 java.lang.String sourceDir,
                                                 boolean disableCache)
                                          throws BuildException
        Returns the logical file for the source file from the logical file cache. If the logical file is not found in the cache or the logical file cache is disabled, then the file is scanned and the resulting logical file is returned. This method uses the DependencyScannerRegistry to identify which scanner to scan the file with. If no scanner is registered for the source file's extension then a BuildException is thrown
        Parameters:
        file - The source file to look up or scan
        sourceDir - The source directory which contains the source file
        disableCache - Used to disable the logical file cache.
        Throws:
        BuildException - If no scanner for the source file is not registered
      • getArchivedLogicalFile

        public static LogicalFile getArchivedLogicalFile(java.lang.String file,
                                                         java.lang.String archive)
                                                  throws BuildException
        Returns the logical file for the source file in an archive from the logical file cache. If the logical file is not found in the cache, then the file is scanned and the resulting logical file is returned. This method uses the DependencyScannerRegistry to identify which scanner to scan the file with. If no scanner is registered for the source file's extension then a BuildException is thrown
        Parameters:
        file - The source file to look up or scan
        archive - The archive file (*.tar, *.tar.gz) the source file is located in
        Throws:
        BuildException - If no scanner for the source file is not registered
      • getArchivedLogicalFile

        public static LogicalFile getArchivedLogicalFile(java.lang.String file,
                                                         java.lang.String archive,
                                                         boolean disableCache)
                                                  throws BuildException
        Returns the logical file for the source file in an archive from the logical file cache. If the logical file is not found in the cache or the logical file cache is disabled, then the file is scanned and the resulting logical file is returned. This method uses the DependencyScannerRegistry to identify which scanner to scan the file with. If no scanner is registered for the source file's extension then a BuildException is thrown
        Parameters:
        file - The source file to look up or scan
        archive - The archive file (*.tar, *.tar.gz) the source file is located in
        disableCache - Used to disable the logical file cache.
        Throws:
        BuildException - If no scanner for the source file is not registered
      • isDisableCache

        public boolean isDisableCache()
        Returns true if the LogicalFile cache is disabled.
      • getSearchPath

        public java.lang.String getSearchPath()
        Returns the dependency search path for the dependency resolver
      • getSearchPathList

        public java.util.List<com.ibm.dbb.dependency.internal.SearchPath> getSearchPathList()
                                                                                     throws BuildException
        Throws:
        BuildException

<IBM Copyright © 2018 IBM Corp. All Rights Reserved.