2929
3030import io .konveyor .tackle .core .internal .query .AnnotationQuery ;
3131import io .konveyor .tackle .core .internal .util .OpenSourceFilteredSearchScope ;
32+ import io .konveyor .tackle .core .internal .util .OpenSourceLibraryExclusionManager ;
3233
3334public class SampleDelegateCommandHandler implements IDelegateCommandHandler {
3435
@@ -37,19 +38,19 @@ public class SampleDelegateCommandHandler implements IDelegateCommandHandler {
3738
3839 private static final String FullAnalysisMode = "full" ;
3940 private static final String sourceOnlyAnalysisMode = "source-only" ;
40-
4141
4242 @ Override
4343 public Object executeCommand (String commandId , List <Object > arguments , IProgressMonitor progress ) throws Exception {
4444 switch (commandId ) {
4545 case COMMAND_ID :
4646 return "Hello World" ;
4747 case RULE_ENTRY_COMMAND_ID :
48- logInfo ("Here we get the arguments for rule entry: " + arguments );
48+ logInfo ("Here we get the arguments for rule entry: " + arguments );
4949 RuleEntryParams params = new RuleEntryParams (commandId , arguments );
5050 return search (params .getProjectName (), params .getIncludedPaths (), params .getQuery (),
51- params .getAnnotationQuery (), params .getLocation (), params .getAnalysisMode (),
52- params .getIncludeOpenSourceLibraries (), progress );
51+ params .getAnnotationQuery (), params .getLocation (), params .getAnalysisMode (),
52+ params .getIncludeOpenSourceLibraries (), params .getMavenLocalRepoPath (),
53+ params .getMavenIndexPath (), progress );
5354 default :
5455 throw new UnsupportedOperationException (format ("Unsupported command '%s'!" , commandId ));
5556 }
@@ -59,7 +60,7 @@ private static void waitForJavaSourceDownloads() {
5960 JobHelpers .waitForInitializeJobs ();
6061 JobHelpers .waitForBuildJobs (JobHelpers .MAX_TIME_MILLIS );
6162 JobHelpers .waitForDownloadSourcesJobs (JobHelpers .MAX_TIME_MILLIS );
62-
63+
6364 }
6465
6566 // mapLocationToSearchPatternLocation will create the correct search pattern or throw an error if one can not be built.
@@ -189,7 +190,8 @@ private static SearchPattern getPatternSingleQuery(int location, String query) t
189190 throw new Exception ("unable to create search pattern" );
190191 }
191192
192- private static List <SymbolInformation > search (String projectName , ArrayList <String > includedPaths , String query , AnnotationQuery annotationQuery , int location , String analsysisMode , boolean includeOpenSourceLibraries , IProgressMonitor monitor ) throws Exception {
193+ private static List <SymbolInformation > search (String projectName , ArrayList <String > includedPaths , String query , AnnotationQuery annotationQuery , int location , String analysisMode ,
194+ boolean includeOpenSourceLibraries , String mavenLocalRepoPath , String mavenIndexPath , IProgressMonitor monitor ) throws Exception {
193195 IJavaProject [] targetProjects ;
194196 IJavaProject project = ProjectUtils .getJavaProject (projectName );
195197 if (project != null ) {
@@ -202,7 +204,7 @@ private static List<SymbolInformation> search(String projectName, ArrayList<Stri
202204
203205 // For Partial results, we are going to filter out based on a list in the engine
204206 int s = IJavaSearchScope .SOURCES | IJavaSearchScope .REFERENCED_PROJECTS | IJavaSearchScope .APPLICATION_LIBRARIES ;
205- if (analsysisMode .equals (sourceOnlyAnalysisMode )) {
207+ if (analysisMode .equals (sourceOnlyAnalysisMode )) {
206208 logInfo ("KONVEYOR_LOG: source-only analysis mode only scoping to Sources" );
207209 s = IJavaSearchScope .SOURCES ;
208210 } else {
@@ -293,7 +295,8 @@ private static List<SymbolInformation> search(String projectName, ArrayList<Stri
293295
294296 // Use a filtered scope when open source libraries are not included
295297 if (!includeOpenSourceLibraries ) {
296- scope = new OpenSourceFilteredSearchScope (scope );
298+ scope = new OpenSourceFilteredSearchScope (scope ,
299+ OpenSourceLibraryExclusionManager .getInstance (mavenLocalRepoPath , mavenIndexPath ));
297300 }
298301 logInfo ("scope: " + scope );
299302
@@ -320,7 +323,7 @@ private static List<SymbolInformation> search(String projectName, ArrayList<Stri
320323 try {
321324 searchEngine .search (pattern , participents , scope , requestor , monitor );
322325 } catch (Exception e ) {
323- //TODO: handle exception
326+ // TODO: handle exception
324327 logInfo ("KONVEYOR_LOG: unable to get search " + e .toString ().replace ("\n " , " " ));
325328 }
326329
0 commit comments