@Override public void verifyDelete(String id) { final Connection connection = locateConnection(id); connection.verifyCanDelete(); }
@Override public void verifyCanDelete(boolean ignoreConnections) throws IllegalStateException { if (ignoreConnections) { return; } readLock.lock(); try { for (final Connection connection : outgoingConnections) { connection.verifyCanDelete(); } for (final Connection connection : incomingConnections) { if (connection.getSource().equals(this)) { connection.verifyCanDelete(); } else { throw new IllegalStateException("Funnel " + this.getIdentifier() + " is the destination of another component"); } } } finally { readLock.unlock(); } }
@Override public void verifyCanDelete(final boolean ignoreConnections) { readLock.lock(); try { if (isRunning()) { throw new IllegalStateException(this.getIdentifier() + " is running"); } if (!ignoreConnections) { for (final Connection connection : outgoingConnections) { connection.verifyCanDelete(); } for (final Connection connection : incomingConnections) { if (connection.getSource().equals(this)) { connection.verifyCanDelete(); } else { throw new IllegalStateException(this.getIdentifier() + " is the destination of another component"); } } } } finally { readLock.unlock(); } }
@Override public void verifyCanDelete(final boolean ignoreConnections) { if (isRunning()) { throw new IllegalStateException(this.getIdentifier() + " is running"); } if (!ignoreConnections) { for (final Set<Connection> connectionSet : connections.values()) { for (final Connection connection : connectionSet) { connection.verifyCanDelete(); } } for (final Connection connection : getIncomingConnections()) { if (connection.getSource().equals(this)) { connection.verifyCanDelete(); } else { throw new IllegalStateException(this.getIdentifier() + " is the destination of another component"); } } } }
connection.verifyCanDelete(); for (final Connection connection : port.getIncomingConnections()) { if (connection.getSource().equals(port)) { connection.verifyCanDelete(); } else { throw new IllegalStateException("Cannot delete Process Group because Input Port " + port.getIdentifier() for (final Connection connection : port.getConnections()) { if (connection.getDestination().equals(port)) { connection.verifyCanDelete(); } else { throw new IllegalStateException("Cannot delete Process Group because Output Port " + port.getIdentifier()
@Override public void removeFunnel(final Funnel funnel) { writeLock.lock(); try { final Funnel existing = funnels.get(requireNonNull(funnel).getIdentifier()); if (existing == null) { throw new IllegalStateException("Funnel " + funnel.getIdentifier() + " is not a member of this ProcessGroup"); } funnel.verifyCanDelete(); for (final Connection conn : funnel.getConnections()) { conn.verifyCanDelete(); } stopFunnel(funnel); // must copy to avoid a concurrent modification final Set<Connection> copy = new HashSet<>(funnel.getConnections()); for (final Connection conn : copy) { removeConnection(conn); } funnels.remove(funnel.getIdentifier()); onComponentModified(); flowManager.onFunnelRemoved(funnel); LOG.info("{} removed from flow", funnel); } finally { writeLock.unlock(); } }
@Override public void verifyCanDelete(final boolean ignoreConnections) { readLock.lock(); try { if (isTransmitting()) { throw new IllegalStateException(this.getIdentifier() + " is transmitting"); } for (final Port port : inputPorts.values()) { if (!ignoreConnections && port.hasIncomingConnection()) { throw new IllegalStateException(this.getIdentifier() + " is the destination of another component"); } if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } for (final Port port : outputPorts.values()) { if (!ignoreConnections) { for (final Connection connection : port.getConnections()) { connection.verifyCanDelete(); } } if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } } finally { readLock.unlock(); } }
for (final RemoteGroupPort port : remoteGroup.getOutputPorts()) { for (final Connection connection : port.getConnections()) { connection.verifyCanDelete();
@Override public void removeConnection(final Connection connectionToRemove) { writeLock.lock(); try { // verify that Connection belongs to this group final Connection connection = connections.get(requireNonNull(connectionToRemove).getIdentifier()); if (connection == null) { throw new IllegalStateException("Connection " + connectionToRemove.getIdentifier() + " is not a member of this Process Group"); } connectionToRemove.verifyCanDelete(); connectionToRemove.getFlowFileQueue().stopLoadBalancing(); final Connectable source = connectionToRemove.getSource(); final Connectable dest = connectionToRemove.getDestination(); // update the source & destination source.removeConnection(connection); if (source != dest) { dest.removeConnection(connection); } // remove the connection from our map connections.remove(connection.getIdentifier()); LOG.info("{} removed from flow", connection); onComponentModified(); flowManager.onConnectionRemoved(connection); } finally { writeLock.unlock(); } }
connection.verifyCanDelete();
connections.get(id).verifyCanDelete();
@Override public void verifyCanDelete(boolean ignoreConnections) throws IllegalStateException { if (ignoreConnections) { return; } readLock.lock(); try { for (final Connection connection : outgoingConnections) { connection.verifyCanDelete(); } for (final Connection connection : incomingConnections) { if (connection.getSource().equals(this)) { connection.verifyCanDelete(); } else { throw new IllegalStateException("Funnel " + this.getIdentifier() + " is the destination of another component"); } } } finally { readLock.unlock(); } }
@Override public void verifyCanDelete(final boolean ignoreConnections) { readLock.lock(); try { if (isRunning()) { throw new IllegalStateException(this.getIdentifier() + " is running"); } if (!ignoreConnections) { for (final Connection connection : outgoingConnections) { connection.verifyCanDelete(); } for (final Connection connection : incomingConnections) { if (connection.getSource().equals(this)) { connection.verifyCanDelete(); } else { throw new IllegalStateException(this.getIdentifier() + " is the destination of another component"); } } } } finally { readLock.unlock(); } }