Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-13609 Correct Component Search Configuration #9131

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@
import org.apache.nifi.web.dao.impl.ComponentDAO;
import org.apache.nifi.web.revision.RevisionManager;
import org.apache.nifi.web.search.query.RegexSearchQueryParser;
import org.apache.nifi.web.search.resultenrichment.ComponentSearchResultEnricherFactory;
import org.apache.nifi.web.util.ClusterReplicationComponentLifecycle;
import org.apache.nifi.web.util.LocalComponentLifecycle;
import org.apache.nifi.web.util.ParameterContextNameCollisionResolver;
@@ -97,6 +96,8 @@ public class WebApplicationConfiguration {

private final RuntimeManifestService runtimeManifestService;

private final ControllerSearchService controllerSearchService;

private ClusterCoordinator clusterCoordinator;

private RequestReplicator requestReplicator;
@@ -113,7 +114,8 @@ public WebApplicationConfiguration(
final FlowService flowService,
final NiFiProperties properties,
final RevisionManager revisionManager,
final RuntimeManifestService runtimeManifestService
final RuntimeManifestService runtimeManifestService,
final ControllerSearchService controllerSearchService
) {
this.authorizer = authorizer;
this.accessPolicyDao = accessPolicyDao;
@@ -125,6 +127,7 @@ public WebApplicationConfiguration(
this.properties = properties;
this.revisionManager = revisionManager;
this.runtimeManifestService = runtimeManifestService;
this.controllerSearchService = controllerSearchService;
}

@Autowired(required = false)
@@ -232,27 +235,11 @@ public RegexSearchQueryParser searchQueryParser() {
return new RegexSearchQueryParser();
}

@Bean
public ComponentSearchResultEnricherFactory resultEnricherFactory() {
final ComponentSearchResultEnricherFactory factory = new ComponentSearchResultEnricherFactory();
factory.setAuthorizer(authorizer);
return factory;
}

@Bean
public StandardReloadComponent reloadComponent() {
return new StandardReloadComponent(flowController);
}

@Bean
public ControllerSearchService controllerSearchService() {
final ControllerSearchService controllerSearchService = new ControllerSearchService();
controllerSearchService.setAuthorizer(authorizer);
controllerSearchService.setFlowController(flowController);
controllerSearchService.setResultEnricherFactory(resultEnricherFactory());
return controllerSearchService;
}

@Bean
public NiFiWebConfigurationContext nifiWebConfigurationContext() {
final StandardNiFiWebConfigurationContext context = new StandardNiFiWebConfigurationContext();
@@ -276,6 +263,7 @@ public ControllerFacade controllerFacade() {
controllerFacade.setProperties(properties);
controllerFacade.setFlowService(flowService);
controllerFacade.setRuntimeManifestService(runtimeManifestService);
controllerFacade.setControllerSearchService(controllerSearchService);
controllerFacade.setSearchQueryParser(searchQueryParser());
return controllerFacade;
}
Original file line number Diff line number Diff line change
@@ -58,16 +58,19 @@ public class WebSearchConfiguration {

private final FlowController flowController;

private final ComponentSearchResultEnricherFactory resultEnricherFactory;

public WebSearchConfiguration(
final Authorizer authorizer,
final FlowController flowController,
final ComponentSearchResultEnricherFactory resultEnricherFactory
final FlowController flowController
) {
this.authorizer = authorizer;
this.flowController = flowController;
this.resultEnricherFactory = resultEnricherFactory;
}

@Bean
public ComponentSearchResultEnricherFactory resultEnricherFactory() {
final ComponentSearchResultEnricherFactory factory = new ComponentSearchResultEnricherFactory();
factory.setAuthorizer(authorizer);
return factory;
}

@Bean
@@ -76,7 +79,7 @@ public ControllerSearchService controllerSearchService() {

controllerSearchService.setAuthorizer(authorizer);
controllerSearchService.setFlowController(flowController);
controllerSearchService.setResultEnricherFactory(resultEnricherFactory);
controllerSearchService.setResultEnricherFactory(resultEnricherFactory());
final ComponentMatcherFactory factory = new ComponentMatcherFactory();

controllerSearchService.setMatcherForConnection(factory.getInstanceForConnection(
@@ -139,6 +142,9 @@ public ControllerSearchService controllerSearchService() {
new PortScheduledStateMatcher()
)
));

final SearchableMatcher searchableMatcher = new SearchableMatcher();
searchableMatcher.setFlowController(flowController);
controllerSearchService.setMatcherForProcessor(factory.getInstanceForConnectable(
List.of(
new ExtendedMatcher<>(),
@@ -148,7 +154,7 @@ public ControllerSearchService controllerSearchService() {
new RelationshipMatcher<>(),
new ProcessorMetadataMatcher(),
new PropertyMatcher<>(),
new SearchableMatcher()
searchableMatcher
)
));