This is an automated email from the ASF dual-hosted git repository. markap14 pushed a commit to branch NIFI-15258 in repository https://gitbox.apache.org/repos/asf/nifi-api.git
commit 86b0a89bd85bbad1e414b9d298163c46b5166a98 Author: Mark Payne <[email protected]> AuthorDate: Wed Jan 21 12:25:20 2026 -0500 NIFI-15451: Provide ability for Connectors to lookup Bundles available for a given component type (#46) --- .../connector/ComponentBundleLookup.java | 33 ++++++++++++++++++++++ .../connector/ConnectorInitializationContext.java | 7 +++++ ...ocumentationConnectorInitializationContext.java | 10 ++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/nifi/components/connector/ComponentBundleLookup.java b/src/main/java/org/apache/nifi/components/connector/ComponentBundleLookup.java new file mode 100644 index 0000000..7abe996 --- /dev/null +++ b/src/main/java/org/apache/nifi/components/connector/ComponentBundleLookup.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.components.connector; + +import org.apache.nifi.flow.Bundle; + +import java.util.List; + +public interface ComponentBundleLookup { + + /** + * Determines which bundles are available for the given component type. + * @param componentType the component type + * @return the list of available bundles that contain the component type + */ + List<Bundle> getAvailableBundles(String componentType); + +} diff --git a/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java b/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java index 3626a47..88880f9 100644 --- a/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java +++ b/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java @@ -51,6 +51,13 @@ public interface ConnectorInitializationContext { */ ComponentLog getLogger(); + /** + * Returns the ComponentBundleLookup that can be used to determine which bundles are available + * for a given component type. + * @return the ComponentBundleLookup + */ + ComponentBundleLookup getComponentBundleLookup(); + /** * <p> * Updates the Connector's flow to the given VersionedExternalFlow. This may be a long-running process, as it involves diff --git a/src/main/java/org/apache/nifi/documentation/init/DocumentationConnectorInitializationContext.java b/src/main/java/org/apache/nifi/documentation/init/DocumentationConnectorInitializationContext.java index 3529a9f..75bc7e0 100644 --- a/src/main/java/org/apache/nifi/documentation/init/DocumentationConnectorInitializationContext.java +++ b/src/main/java/org/apache/nifi/documentation/init/DocumentationConnectorInitializationContext.java @@ -16,13 +16,16 @@ */ package org.apache.nifi.documentation.init; -import java.util.UUID; +import org.apache.nifi.components.connector.ComponentBundleLookup; import org.apache.nifi.components.connector.ConnectorInitializationContext; import org.apache.nifi.components.connector.FlowUpdateException; import org.apache.nifi.components.connector.components.FlowContext; import org.apache.nifi.flow.VersionedExternalFlow; import org.apache.nifi.logging.ComponentLog; +import java.util.List; +import java.util.UUID; + /** * A ConnectorInitializationContext implementation for use during documentation generation. * This context provides minimal functionality needed to initialize a Connector for the purposes @@ -46,6 +49,11 @@ public class DocumentationConnectorInitializationContext implements ConnectorIni return new NopComponentLog(); } + @Override + public ComponentBundleLookup getComponentBundleLookup() { + return componentType -> List.of(); + } + @Override public void updateFlow(final FlowContext flowContext, final VersionedExternalFlow versionedExternalFlow) throws FlowUpdateException { // No-op for documentation purposes - we don't actually update any flows
