Class AbstractDependencyScanner

  • All Implemented Interfaces:
    IDependencyScanner
    Direct Known Subclasses:
    DependencyScanner, DummyScanner, ZUnitConfigScanner

    public abstract class AbstractDependencyScanner
    extends java.lang.Object
    implements IDependencyScanner
    Abstract dependency scanner class to help jump start creating a new DBB source code scanner. Implements IDependencyScanner. Users just need to extend this class and implement methods:
     protected Object runScan(String file, InputStream is, String encoding);
     protected abstract LogicalFile createLogicalFile(String file, Object scanMetadata);
     
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String createLogicalName​(java.lang.String fileName)
      Create a logical name from a file name, for example: /u/user/test/cobol/myfile.cbl will create logical name MYFILE
      LogicalFile scan​(java.lang.String file, java.io.InputStream inputStream)
      Deprecated.
      As of release 2.0.1, replaced by scanStream(String, InputStream)
      LogicalFile scan​(java.lang.String file, java.io.InputStream inputStream, java.lang.String encoding)
      Deprecated.
      As of release 2.0.1, replaced by scanStream(String, InputStream, String)
      LogicalFile scan​(java.lang.String file, java.lang.String sourceDir)
      Scan and collect logical dependency of a file
      LogicalFile scan​(java.lang.String file, java.lang.String sourceDir, java.lang.String encoding)
      Scan and collect logical dependency of a file
      java.util.List<LogicalFile> scanArchive​(java.lang.String archive, java.lang.String sourceDir)
      Scan and collect logical dependencies from an archive
      java.util.List<LogicalFile> scanArchive​(java.lang.String archive, java.lang.String sourceDir, java.lang.String encoding)
      Scan and collect logical dependencies from an archive
      LogicalFile scanArchivedFile​(java.lang.String archive, java.lang.String sourceDir, java.lang.String file)
      Scan and collect the logical dependency from an archived file
      LogicalFile scanArchivedFile​(java.lang.String archive, java.lang.String sourceDir, java.lang.String file, java.lang.String encoding)
      Scan and collect the logical dependency from an archived file
      LogicalFile scanStream​(java.lang.String file, java.io.InputStream inputStream)
      Scan and collect logical dependency of a file
      LogicalFile scanStream​(java.lang.String file, java.io.InputStream inputStream, java.lang.String encoding)
      Scan and collect logical dependency of a file
      • Methods inherited from class java.lang.Object

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

      • AbstractDependencyScanner

        public AbstractDependencyScanner()
    • Method Detail

      • scan

        public LogicalFile scan​(java.lang.String file,
                                java.lang.String sourceDir)
                         throws java.io.FileNotFoundException
        Scan and collect logical dependency of a file
        Specified by:
        scan in interface IDependencyScanner
        Parameters:
        file - the relative path of the file, or absolute path if sourceDir is null.
        sourceDir - absolute path to the directory where the file is located, or null to use an absolute file path.
        Returns:
        the scanned LogicalFile
        Throws:
        java.io.FileNotFoundException - an exception occurred
      • scan

        public LogicalFile scan​(java.lang.String file,
                                java.lang.String sourceDir,
                                java.lang.String encoding)
                         throws java.io.FileNotFoundException
        Scan and collect logical dependency of a file
        Specified by:
        scan in interface IDependencyScanner
        Parameters:
        file - the relative path of the file, or absolute path if sourceDir is null.
        sourceDir - absolute path to the directory where the file is located, or null to use an absolute file path.
        encoding - the encoding to be used to read the content of the file
        Returns:
        the scanned LogicalFile
        Throws:
        java.io.FileNotFoundException - an exception occurred
      • scanStream

        public LogicalFile scanStream​(java.lang.String file,
                                      java.io.InputStream inputStream)
        Scan and collect logical dependency of a file
        Parameters:
        file - the name of the file
        inputStream - the file content
        Returns:
        the scanned LogicalFile
      • scanStream

        public LogicalFile scanStream​(java.lang.String file,
                                      java.io.InputStream inputStream,
                                      java.lang.String encoding)
        Scan and collect logical dependency of a file
        Parameters:
        file - the name of the file
        inputStream - the file content
        encoding - the encoding to be used to read the content of the file
        Returns:
        the scanned LogicalFile
      • scan

        @Deprecated
        public LogicalFile scan​(java.lang.String file,
                                java.io.InputStream inputStream)
        Deprecated.
        As of release 2.0.1, replaced by scanStream(String, InputStream)
        Scan and collect logical dependency of a file
        Specified by:
        scan in interface IDependencyScanner
        Parameters:
        file - the name of the file
        inputStream - the file content
        Returns:
        the scanned LogicalFile
      • scan

        @Deprecated
        public LogicalFile scan​(java.lang.String file,
                                java.io.InputStream inputStream,
                                java.lang.String encoding)
        Deprecated.
        As of release 2.0.1, replaced by scanStream(String, InputStream, String)
        Scan and collect logical dependency of a file
        Specified by:
        scan in interface IDependencyScanner
        Parameters:
        file - the name of the file
        inputStream - the file content
        encoding - the encoding to be used to read the content of the file
        Returns:
        the scanned LogicalFile
      • scanArchive

        public java.util.List<LogicalFile> scanArchive​(java.lang.String archive,
                                                       java.lang.String sourceDir)
                                                throws BuildException
        Scan and collect logical dependencies from an archive
        Specified by:
        scanArchive in interface IDependencyScanner
        Parameters:
        archive - the name of the archive
        sourceDir - the directory where the archive can be located
        Returns:
        the scanned List<LogicalFile>
        Throws:
        BuildException - an exception occurred
      • scanArchive

        public java.util.List<LogicalFile> scanArchive​(java.lang.String archive,
                                                       java.lang.String sourceDir,
                                                       java.lang.String encoding)
                                                throws BuildException
        Scan and collect logical dependencies from an archive
        Specified by:
        scanArchive in interface IDependencyScanner
        Parameters:
        archive - the name of the archive
        sourceDir - the directory where the archive can be located
        encoding - the encoding of the file content
        Returns:
        the scanned List<LogicalFile>
        Throws:
        BuildException - an exception occurred
      • scanArchivedFile

        public LogicalFile scanArchivedFile​(java.lang.String archive,
                                            java.lang.String sourceDir,
                                            java.lang.String file)
                                     throws BuildException
        Scan and collect the logical dependency from an archived file
        Specified by:
        scanArchivedFile in interface IDependencyScanner
        Parameters:
        archive - the name of the archive
        sourceDir - the directory where the archive can be located
        file - the name of the file
        Returns:
        the scanned LogicalFile
        Throws:
        BuildException - an exception occurred
      • scanArchivedFile

        public LogicalFile scanArchivedFile​(java.lang.String archive,
                                            java.lang.String sourceDir,
                                            java.lang.String file,
                                            java.lang.String encoding)
                                     throws BuildException
        Scan and collect the logical dependency from an archived file
        Specified by:
        scanArchivedFile in interface IDependencyScanner
        Parameters:
        archive - the name of the archive
        sourceDir - the directory where the archive can be located
        file - the name of the file
        encoding - the encoding
        Returns:
        the scanned LogicalFile
        Throws:
        BuildException - an exception occurred
      • createLogicalName

        public java.lang.String createLogicalName​(java.lang.String fileName)
        Create a logical name from a file name, for example: /u/user/test/cobol/myfile.cbl will create logical name MYFILE
        Parameters:
        fileName - the name of the file on HFS
        Returns:
        the logical name