public static Handler getHandler(Record r) { return r.get(Handler.class, Handler.class); }
/** * Gets the principal representing an authenticated peer. * * @param record The attachments to retrieve the principal from. * @return The principal representing the authenticated client or {@link Constants#PRINCIPAL_ANONYMOUS} * if the client has not been authenticated or record is {@code null}. */ public static HonoUser getClientPrincipal(final Record record) { if (record != null) { final HonoUser client = record.get(KEY_CLIENT_PRINCIPAL, HonoUser.class); return client != null ? client : PRINCIPAL_ANONYMOUS; } else { return PRINCIPAL_ANONYMOUS; } }
public static Handler getHandler(Record r) { return r.get(Handler.class, Handler.class); }
public static Handler getHandler(Record r) { return r.get(Handler.class, Handler.class); }
/** * Gets the principal representing an authenticated peer. * * @param record The attachments to retrieve the principal from. * @return The principal representing the authenticated client or {@link Constants#PRINCIPAL_ANONYMOUS} * if the client has not been authenticated or record is {@code null}. */ public static HonoUser getClientPrincipal(final Record record) { if (record != null) { final HonoUser client = record.get(KEY_CLIENT_PRINCIPAL, HonoUser.class); return client != null ? client : PRINCIPAL_ANONYMOUS; } else { return PRINCIPAL_ANONYMOUS; } }
/** * Gets the (surrogate) identifier of the AMQP connection that a link is part of. * * @param link The link to determine the connection id for. * @return The identifier retrieved from the link's <em>attachment</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonLink<?> link) { return link.attachments().get(KEY_CONNECTION_ID, String.class); }
/** * Gets the (surrogate) identifier of an AMQP connection. * * @param connection The connection to determine the connection id for. * @return The identifier retrieved from the connection's <em>attachments</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonConnection connection) { return connection.attachments().get(KEY_CONNECTION_ID, String.class); }
/** * Gets the (surrogate) identifier of an AMQP connection. * * @param connection The connection to determine the connection id for. * @return The identifier retrieved from the connection's <em>attachments</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonConnection connection) { return connection.attachments().get(KEY_CONNECTION_ID, String.class); }
@SuppressWarnings("unchecked") private static Handler<Void> getConnectionLossHandler(final ProtonConnection con) { return con.attachments().get("connectionLossHandler", Handler.class); }
public T get(E e) { return e.attachments().get(this, klass); }
public static Handler getHandler(Extendable ext) { return ext.attachments().get(Handler.class, Handler.class); }
/** * Gets the (surrogate) identifier of the AMQP connection that a link is part of. * * @param link The link to determine the connection id for. * @return The identifier retrieved from the link's <em>attachment</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonLink<?> link) { return link.attachments().get(KEY_CONNECTION_ID, String.class); }
public static Handler getHandler(Extendable ext) { return ext.attachments().get(Handler.class, Handler.class); }
public T get(E e) { return e.attachments().get(this, klass); }
public static Handler getHandler(Extendable ext) { return ext.attachments().get(Handler.class, Handler.class); }
private static void copyConnectionId(final Record source, final Record target) { target.set(Constants.KEY_CONNECTION_ID, String.class, source.get(Constants.KEY_CONNECTION_ID, String.class)); }
@Override public String getConnectionAddress(Connection connection) { Record r = connection.attachments(); Address addr = r.get(CONNECTION_PEER_ADDRESS_KEY, Address.class); if (addr != null) { StringBuilder sb = new StringBuilder(addr.getHost()); if (addr.getPort() != null) sb.append(":" + addr.getPort()); return sb.toString(); } return null; }
private void throwIfSchedulerError() { // throw when the scheduler on which Reactor is running is already closed final RejectedExecutionException rejectedException = this.reactor.attachments() .get(RejectedExecutionException.class, RejectedExecutionException.class); if (rejectedException != null) { throw new RejectedExecutionException(rejectedException.getMessage(), rejectedException); } // throw when the pipe is in closed state - in which case, // signalling the new event-dispatch will fail if (!this.ioSignal.sink().isOpen()) { throw new RejectedExecutionException("ReactorDispatcher instance is closed."); } }
private void publishConnectionClosedEvent(final ProtonConnection con) { String conId = con.attachments().get(Constants.KEY_CONNECTION_ID, String.class); if (conId != null) { vertx.eventBus().publish( Constants.EVENT_BUS_ADDRESS_CONNECTION_CLOSED, conId); } }
@Override public void setConnectionHost(Connection connection, String host, int port) { Record r = connection.attachments(); // cannot set the address on an incoming connection if (r.get(AcceptorImpl.CONNECTION_ACCEPTOR_KEY, Acceptor.class) == null) { Address addr = new Address(); addr.setHost(host); if (port == 0) { port = 5672; } addr.setPort(Integer.toString(port)); r.set(CONNECTION_PEER_ADDRESS_KEY, Address.class, addr); } else { throw new IllegalStateException("Cannot set the host address on an incoming Connection"); } }