001package org.xbib.elasticsearch.http;
002
003import org.elasticsearch.common.component.LifecycleComponent;
004import org.elasticsearch.common.transport.BoundTransportAddress;
005import org.elasticsearch.common.xcontent.XContentBuilder;
006import org.jboss.netty.channel.Channel;
007
008/**
009 * HttpServerTransport extended by Websocket services
010 */
011public interface HttpServerTransport extends LifecycleComponent<HttpServerTransport> {
012
013    /**
014     * Return the bound transport addess
015     *
016     * @return the bound transport addess
017     */
018    BoundTransportAddress boundAddress();
019
020    HttpInfo info();
021
022    /**
023     * Get HTTP statistics
024     *
025     * @return a statistics object
026     */
027    HttpStats stats();
028
029    /**
030     * Set HTTP server adapter
031     *
032     * @param httpServerAdapter
033     */
034    void httpServerAdapter(HttpServerAdapter httpServerAdapter);
035
036    /**
037     * Set WebSocket server adapter
038     *
039     * @param webSocketServerAdapter
040     */
041    void webSocketServerAdapter(WebSocketServerAdapter webSocketServerAdapter);
042
043    /**
044     * Find channel for a given channel ID
045     *
046     * @param id
047     * @return channel or null
048     */
049    Channel channel(Integer id);
050
051    /**
052     * Forward a message to a node for a given channel ID
053     *
054     * @param nodeAdress
055     * @param channelId
056     * @param message
057     */
058    void forward(String nodeAdress, Integer channelId, XContentBuilder message);
059}