Search in sources :

Example 1 with ObjectChannel

use of org.teiid.net.socket.ObjectChannel in project teiid by teiid.

the class EmbeddedServer method startTransport.

private SocketListener startTransport(SocketConfiguration socketConfig, BufferManager bm, int maxODBCLobSize) {
    InetSocketAddress address = null;
    try {
        address = new InetSocketAddress(socketConfig.getResolvedHostAddress(), socketConfig.getPortNumber());
    } catch (UnknownHostException e) {
        throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40065, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40065));
    }
    if (socketConfig.getProtocol() == WireProtocol.teiid) {
        return new SocketListener(address, socketConfig, this.services, bm) {

            @Override
            public ChannelListener createChannelListener(ObjectChannel channel) {
                // TODO: this is a little dirty, but allows us to inject the appropriate connection profile
                SocketClientInstance instance = (SocketClientInstance) super.createChannelListener(channel);
                instance.getWorkContext().setConnectionProfile(embeddedProfile);
                return instance;
            }
        };
    } else if (socketConfig.getProtocol() == WireProtocol.pg) {
        ODBCSocketListener odbc = new ODBCSocketListener(address, socketConfig, this.services, bm, maxODBCLobSize, this.logon, driver);
        return odbc;
    }
    // $NON-NLS-1$
    throw new AssertionError("Unknown protocol " + socketConfig.getProtocol());
}
Also used : UnknownHostException(java.net.UnknownHostException) InetSocketAddress(java.net.InetSocketAddress) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) ObjectChannel(org.teiid.net.socket.ObjectChannel)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 UnknownHostException (java.net.UnknownHostException)1 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)1 ObjectChannel (org.teiid.net.socket.ObjectChannel)1