mirror of https://github.com/apache/nifi.git
NIFI-13196: Added new isAutoTerminated(Relationship) method to ProcessContext, which simply delegates to Connectable.isAutoTerminated(Relationship)
This closes #8790 Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
parent
196f6bb6b1
commit
62fbd8e8b1
|
@ -108,6 +108,13 @@ public interface ProcessContext extends PropertyContext, ClusterContext {
|
|||
*/
|
||||
Set<Relationship> getAvailableRelationships();
|
||||
|
||||
/**
|
||||
* Indicates whether or not the given relationship is configured to be auto-terminated
|
||||
* @param relationship the relationship
|
||||
* @return <code>true</code> if the given relationship is auto-terminated, <code>false</code> otherwise
|
||||
*/
|
||||
boolean isAutoTerminated(Relationship relationship);
|
||||
|
||||
/**
|
||||
* @return true if the processor has one or more incoming connections,
|
||||
* false otherwise
|
||||
|
|
|
@ -16,15 +16,6 @@
|
|||
*/
|
||||
package org.apache.nifi.controller.repository.scheduling;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.PropertyValue;
|
||||
import org.apache.nifi.components.resource.ResourceReference;
|
||||
|
@ -43,6 +34,15 @@ import org.apache.nifi.processor.exception.ProcessException;
|
|||
import org.apache.nifi.scheduling.ExecutionNode;
|
||||
import org.apache.nifi.util.Connectables;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* This class is essentially an empty shell for {@link Connectable}s that are not Processors
|
||||
*/
|
||||
|
@ -250,6 +250,11 @@ public class ConnectableProcessContext implements ProcessContext {
|
|||
return new HashSet<>(connectable.getRelationships());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoTerminated(final Relationship relationship) {
|
||||
return connectable.isAutoTerminated(relationship);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIncomingConnection() {
|
||||
return connectable.hasIncomingConnection();
|
||||
|
|
|
@ -309,6 +309,11 @@ public class StandardProcessContext implements ProcessContext, ControllerService
|
|||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoTerminated(final Relationship relationship) {
|
||||
return procNode.isAutoTerminated(relationship);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControllerServiceName(final String serviceIdentifier) {
|
||||
verifyTaskActive();
|
||||
|
|
|
@ -85,6 +85,11 @@ public class MockProcessContext implements ProcessContext {
|
|||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoTerminated(final Relationship relationship) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIncomingConnection() {
|
||||
return true;
|
||||
|
|
|
@ -444,6 +444,11 @@ public class MockProcessContext extends MockControllerServiceLookup implements P
|
|||
return relationships;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoTerminated(final Relationship relationship) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUnavailableRelationships(final Set<Relationship> relationships) {
|
||||
this.unavailableRelationships = Collections.unmodifiableSet(new HashSet<>(relationships));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue