@Override public boolean isTriggerWhenEmpty() { return getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT; }
@Override public TransferDirection getTransferDirection() { return (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) ? TransferDirection.SEND : TransferDirection.RECEIVE; }
@Override public boolean isValid() { if (!targetExists.get()) { return false; } if (getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty()) { // if it's an output port, ensure that there is an outbound connection return false; } final boolean groupValid = remoteGroup.validate().stream() .allMatch(result -> result.isValid()); return groupValid; }
@Override public void verifyCanStart() { super.verifyCanStart(); if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty()) { throw new IllegalStateException("Port " + getName() + " has no incoming connections"); } final Optional<ValidationResult> resultOption = remoteGroup.validate().stream() .filter(result -> !result.isValid()) .findFirst(); if (resultOption.isPresent()) { throw new IllegalStateException("Remote Process Group is not valid: " + resultOption.get().toString()); } }
@Override public Resource getResource() { final ResourceType resourceType = ConnectableType.REMOTE_INPUT_PORT.equals(getConnectableType()) ? ResourceType.InputPort : ResourceType.OutputPort; return ResourceFactory.getComponentResource(resourceType, getIdentifier(), getName()); }
@Override public Collection<ValidationResult> getValidationErrors() { final Collection<ValidationResult> validationErrors = new ArrayList<>(); if (getScheduledState() == ScheduledState.STOPPED) { ValidationResult error = null; if (!targetExists.get()) { error = new ValidationResult.Builder() .explanation(String.format("Remote instance indicates that port '%s' no longer exists.", getName())) .subject(String.format("Remote port '%s'", getName())) .valid(false) .build(); } else if (getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty()) { error = new ValidationResult.Builder() .explanation(String.format("Port '%s' has no outbound connections", getName())) .subject(String.format("Remote port '%s'", getName())) .valid(false) .build(); } if (error != null) { validationErrors.add(error); } } return validationErrors; }
if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && session.getQueueSize().getObjectCount() == 0) { logger.debug("{} No data to send", this); return; if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { firstFlowFile = session.get(); if (firstFlowFile == null) { if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { transferFlowFiles(transaction, context, session, firstFlowFile); } else {
@Override public boolean isTriggerWhenEmpty() { return getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT; }
@Override public TransferDirection getTransferDirection() { return (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) ? TransferDirection.SEND : TransferDirection.RECEIVE; }
@Override public boolean isValid() { if (!targetExists.get()) { return false; } if (getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty()) { // if it's an output port, ensure that there is an outbound connection return false; } final boolean groupValid = remoteGroup.validate().stream() .allMatch(result -> result.isValid()); return groupValid; }
@Override public void verifyCanStart() { super.verifyCanStart(); if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty()) { throw new IllegalStateException("Port " + getName() + " has no incoming connections"); } final Optional<ValidationResult> resultOption = remoteGroup.validate().stream() .filter(result -> !result.isValid()) .findFirst(); if (resultOption.isPresent()) { throw new IllegalStateException("Remote Process Group is not valid: " + resultOption.get().toString()); } }
@Override public Resource getResource() { final ResourceType resourceType = ConnectableType.REMOTE_INPUT_PORT.equals(getConnectableType()) ? ResourceType.InputPort : ResourceType.OutputPort; return ResourceFactory.getComponentResource(resourceType, getIdentifier(), getName()); }
@Override public Collection<ValidationResult> getValidationErrors() { final Collection<ValidationResult> validationErrors = new ArrayList<>(); if (getScheduledState() == ScheduledState.STOPPED) { ValidationResult error = null; if (!targetExists.get()) { error = new ValidationResult.Builder() .explanation(String.format("Remote instance indicates that port '%s' no longer exists.", getName())) .subject(String.format("Remote port '%s'", getName())) .valid(false) .build(); } else if (getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty()) { error = new ValidationResult.Builder() .explanation(String.format("Port '%s' has no outbound connections", getName())) .subject(String.format("Remote port '%s'", getName())) .valid(false) .build(); } if (error != null) { validationErrors.add(error); } } return validationErrors; }
if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && session.getQueueSize().getObjectCount() == 0) { logger.debug("{} No data to send", this); return; if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { firstFlowFile = session.get(); if (firstFlowFile == null) { if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { transferFlowFiles(transaction, context, session, firstFlowFile); } else {