Class DiscoverSourceDirectories


  • public class DiscoverSourceDirectories
    extends java.lang.Object
    Based on the contents of the application directories/archives in a Project, and a "root" source directory (under which some number of "real" source directories may be located), scan to find the source directories containing the application's source files.
    • Field Detail

      • DEBUG

        private static boolean DEBUG
      • rootSourceDirectory

        private java.lang.String rootSourceDirectory
      • discoveredSourceDirectoryList

        private final java.util.List<java.lang.String> discoveredSourceDirectoryList
    • Constructor Detail

      • DiscoverSourceDirectories

        public DiscoverSourceDirectories()
        Constructor.
    • Method Detail

      • setProject

        public void setProject​(Project project)
        Set the Project for which we want to find source directories.
        Parameters:
        project - Project for which we want to find source directories
      • setRootSourceDirectory

        public void setRootSourceDirectory​(java.lang.String rootSourceDirectory)
        Set the "root" source directory: we expect all of the actual source directories to be underneath it.
        Parameters:
        rootSourceDirectory - the root source directory
      • setErrorLogger

        public void setErrorLogger​(IErrorLogger errorLogger)
        Set the error logger to use to report errors during scanning. By default, a no-op error logger is used.
        Parameters:
        errorLogger - error logger to use to report errors during scanning
      • setProgress

        public void setProgress​(DiscoverSourceDirectories.Progress progress)
        Set the progress callback to which scanning progress should be reported.
        Parameters:
        progress - the progress callback
      • getDiscoveredSourceDirectoryList

        public java.util.List<java.lang.String> getDiscoveredSourceDirectoryList()
        Get the list of discovered source directories. These can be added to a Project.
        Returns:
        list of discovered source directories.
      • execute

        public void execute()
                     throws CheckedAnalysisException,
                            java.io.IOException,
                            java.lang.InterruptedException
        Execute the search for source directories.
        Throws:
        CheckedAnalysisException
        java.io.IOException
        java.lang.InterruptedException
      • findFullyQualifiedSourceFileNames

        private java.util.List<java.lang.String> findFullyQualifiedSourceFileNames​(IClassPathBuilder builder,
                                                                                   IClassPath classPath)
      • findSourceDirectoriesForAllSourceFiles

        private void findSourceDirectoriesForAllSourceFiles​(java.util.List<java.lang.String> fullyQualifiedSourceFileNameList,
                                                            java.util.List<java.lang.String> candidateSourceDirList)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException,
                                CheckedAnalysisException,
                                java.lang.InterruptedException
        Just for testing.
        Throws:
        java.io.IOException
        CheckedAnalysisException
        java.lang.InterruptedException