-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-15355 Refactor ConnectorRepository API for extension point #10857
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...amework-api/src/main/java/org/apache/nifi/components/connector/ComponentBundleLookup.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * 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; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * Provides the ability to look up available bundles for a given component type. | ||
| */ | ||
| public interface ComponentBundleLookup { | ||
|
|
||
| /** | ||
| * Returns the available bundles that provide the given component type. | ||
| * | ||
| * @param componentType the fully qualified class name of the component type | ||
| * @return the list of bundles that provide the component type | ||
| */ | ||
| List<Bundle> getAvailableBundles(String componentType); | ||
|
|
||
| /** | ||
| * Returns the latest version of a bundle that provides the given component type. | ||
| * | ||
| * @param componentType the fully qualified class name of the component type | ||
| * @return an Optional containing the latest bundle, or empty if no bundles are available | ||
| */ | ||
| Optional<Bundle> getLatestBundle(String componentType); | ||
| } |
88 changes: 88 additions & 0 deletions
88
...k-api/src/main/java/org/apache/nifi/components/connector/ConnectorClusterCoordinator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| /* | ||
| * 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 java.io.IOException; | ||
| import java.time.Duration; | ||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * <p> | ||
| * Provides cluster coordination capabilities for connector operations. This interface | ||
| * is implemented by the framework and provided to {@link ConnectorLifecycleManager} | ||
| * implementations to enable coordination across cluster nodes. | ||
| * </p> | ||
| * | ||
| * <p> | ||
| * This interface is not intended to be implemented by third parties. The framework | ||
| * provides a standard implementation that handles cluster communication. | ||
| * </p> | ||
| */ | ||
| public interface ConnectorClusterCoordinator { | ||
|
|
||
| /** | ||
| * Gets the connector state as reported by the cluster. This queries other nodes | ||
| * in the cluster to determine the consensus state of the connector. | ||
| * | ||
| * @param connectorId the identifier of the connector | ||
| * @return the cluster-wide connector state | ||
| * @throws IOException if an I/O error occurs during cluster communication | ||
| */ | ||
| ConnectorState getClusterState(String connectorId) throws IOException; | ||
|
|
||
| /** | ||
| * Waits for the cluster to reach one of the desired states for the specified connector. | ||
| * This method polls the cluster nodes until all nodes report a state in the desired set, | ||
| * or until the timeout is reached. | ||
| * | ||
| * @param connectorId the identifier of the connector | ||
| * @param desiredStates the set of acceptable final states to wait for | ||
| * @param allowableIntermediateStates the set of acceptable intermediate states while waiting | ||
| * @param timeout the maximum time to wait for the cluster to reach the desired state | ||
| * @throws IOException if an I/O error occurs during cluster communication | ||
| * @throws InterruptedException if the wait is interrupted | ||
| * @throws ConnectorLifecycleException if the cluster fails to reach the desired state | ||
| * within the timeout or if an unexpected state is encountered | ||
| */ | ||
| void awaitClusterState(String connectorId, Set<ConnectorState> desiredStates, | ||
| Set<ConnectorState> allowableIntermediateStates, | ||
| Duration timeout) throws IOException, InterruptedException, ConnectorLifecycleException; | ||
|
|
||
| /** | ||
| * Indicates whether this node is currently connected to a cluster. | ||
| * | ||
| * @return true if this node is clustered and connected, false otherwise | ||
| */ | ||
| boolean isClustered(); | ||
|
|
||
| /** | ||
| * Indicates whether this node is the primary node in the cluster. | ||
| * | ||
| * @return true if this node is the primary node, false otherwise | ||
| */ | ||
| boolean isPrimaryNode(); | ||
|
|
||
| /** | ||
| * Returns a no-op implementation of ConnectorClusterCoordinator for standalone mode. | ||
| * | ||
| * @return a standalone (no-op) cluster coordinator | ||
| */ | ||
| static ConnectorClusterCoordinator standalone() { | ||
| return StandaloneConnectorClusterCoordinator.INSTANCE; | ||
| } | ||
| } |
76 changes: 76 additions & 0 deletions
76
...ork-api/src/main/java/org/apache/nifi/components/connector/ConnectorLifecycleContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * 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.controller.NodeTypeProvider; | ||
| import org.apache.nifi.events.EventReporter; | ||
|
|
||
| import java.util.Map; | ||
| import java.util.concurrent.ScheduledExecutorService; | ||
|
|
||
| /** | ||
| * Provides context information for initializing a {@link ConnectorLifecycleManager}. | ||
| */ | ||
| public interface ConnectorLifecycleContext { | ||
|
|
||
| /** | ||
| * Returns the configuration properties for the lifecycle manager. | ||
| * These properties are typically specified in nifi.properties. | ||
| * | ||
| * @return the configuration properties | ||
| */ | ||
| Map<String, String> getProperties(); | ||
|
|
||
| /** | ||
| * Returns the event reporter that can be used to report events and create bulletins. | ||
| * | ||
| * @return the event reporter | ||
| */ | ||
| EventReporter getEventReporter(); | ||
|
|
||
| /** | ||
| * Returns the node type provider that provides information about the node's | ||
| * cluster status (e.g., whether it is clustered, primary, etc.). | ||
| * | ||
| * @return the node type provider | ||
| */ | ||
| NodeTypeProvider getNodeTypeProvider(); | ||
|
|
||
| /** | ||
| * Returns the cluster coordinator that provides cluster coordination capabilities. | ||
| * May be null if running in standalone mode or if cluster coordination is not available. | ||
| * | ||
| * @return the cluster coordinator, or null if not available | ||
| */ | ||
| ConnectorClusterCoordinator getClusterCoordinator(); | ||
|
|
||
| /** | ||
| * Returns the connector repository for persistence operations. | ||
| * | ||
| * @return the connector repository | ||
| */ | ||
| ConnectorRepository getConnectorRepository(); | ||
|
|
||
| /** | ||
| * Returns a scheduled executor service that can be used for scheduling | ||
| * lifecycle-related tasks. | ||
| * | ||
| * @return the scheduled executor service | ||
| */ | ||
| ScheduledExecutorService getScheduledExecutorService(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONNECTOR_MANAGER_IMPLEMENTATIONas that is no longer intended to be configurable via properties