exceptionfactory commented on code in PR #7191: URL: https://github.com/apache/nifi/pull/7191#discussion_r1188592421
########## nifi-api/src/main/java/org/apache/nifi/flowanalysis/FlowAnalysisRuleContext.java: ########## @@ -0,0 +1,73 @@ +/* + * 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.flowanalysis; + +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.state.StateManager; +import org.apache.nifi.context.PropertyContext; +import org.apache.nifi.controller.VersionedControllerServiceLookup; + +import java.util.Map; + +/** + * This interface provides a bridge between the NiFi Framework and a + * {@link FlowAnalysisRule}. This context allows a FlowAnalysisRule to access + * configuration supplied by the user. + */ +public interface FlowAnalysisRuleContext extends PropertyContext { + /** + * @return the name of the rule that is being triggered + */ + String getRuleName(); + + /** + * @return a Map of all known {@link PropertyDescriptor}s to their + * configured properties. This Map will contain a <code>null</code> for any + * Property that has not been configured by the user, even if the + * PropertyDescriptor has a default value + */ + Map<PropertyDescriptor, String> getProperties(); + + /** + * @return the {@link VersionedControllerServiceLookup} which can be used to obtain + * Versioned Controller Services during flow analysis + */ + VersionedControllerServiceLookup getVersionedControllerServiceLookup(); + + /** + * @return the StateManager that can be used to store and retrieve state for this component + */ + StateManager getStateManager(); + + /** + * @return <code>true</code> if this instance of NiFi is configured to be part of a cluster, <code>false</code> + * if this instance of NiFi is a standalone instance + */ + boolean isClustered(); + + /** + * @return the currently configured maximum number of threads that can be + * used for executing processors at any given time. + */ + int getMaxTimerDrivenThreadCount(); Review Comment: On further consideration, having the scope of potential evaluation include anything in the application flow configuration flow.json.gz seems reasonable. However, given that this property and others exist as Controller Settings, it seems best to introduce an interface that will contain this property, and potentially other properties. Perhaps something like `ControllerSettingsContext` with a `getControllerSettingsContext()` as a method on `FlowAnalysisRuleContext`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
