public void addConnection(Connection conn) { if (conn.getProtocol() != Connection.Protocol.DICOM) throw new IllegalArgumentException("protocol != DICOM - " + conn.getProtocol()); if (device != null && device != conn.getDevice()) throw new IllegalStateException(conn + " not contained by Device: " + device.getDeviceName()); connections.add(conn); }
public CompatibleConnection findCompatibelConnection(ApplicationEntity remote) throws IncompatibleConnectionException { CompatibleConnection cc = null; for (Connection remoteConn : remote.connections) if (remoteConn.isInstalled() && remoteConn.isServer()) for (Connection conn : connections) if (conn.isInstalled() && conn.isCompatible(remoteConn)) { if (cc == null || conn.isTls() || conn.getProtocol() == Connection.Protocol.SYSLOG_TLS) cc = new CompatibleConnection(conn, remoteConn); } if (cc == null) throw new IncompatibleConnectionException( "No compatible connection to " + remote + " available on " + this); return cc; }