@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 removeConnection(final Connection connection) throws IllegalArgumentException, IllegalStateException { super.removeConnection(connection); // If the Port no longer exists on the remote instance and this is the last Connection, tell // RemoteProcessGroup to remove me if (!getTargetExists() && !hasIncomingConnection() && getConnections().isEmpty()) { remoteGroup.removeNonExistentPort(this); } }
if (!port.getConnections().isEmpty() && !port.getTargetExists()) { throw new IllegalStateException(this.getIdentifier() + " has a Connection to Port " + port.getIdentifier() + ", but that Port no longer exists on the remote system"); if (!port.getConnections().isEmpty()) { port.verifyCanStart();
if (port.getConnections().isEmpty()) { itr.remove();
@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; }
@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 removeConnection(final Connection connection) throws IllegalArgumentException, IllegalStateException { super.removeConnection(connection); // If the Port no longer exists on the remote instance and this is the last Connection, tell // RemoteProcessGroup to remove me if (!getTargetExists() && !hasIncomingConnection() && getConnections().isEmpty()) { remoteGroup.removeNonExistentPort(this); } }
@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; }