Search in sources :

Example 1 with SocketProtocolBuffersChannel

use of org.bimserver.shared.pb.SocketProtocolBuffersChannel in project BIMserver by opensourceBIM.

the class ProtocolBuffersChannel method connect.

public void connect(TokenHolder tokenHolder) throws ChannelConnectionException {
    protocolBuffersChannel = new SocketProtocolBuffersChannel(tokenHolder);
    protocolBuffersChannel.registerConnectDisconnectListener(this);
    ProtocolBuffersReflector reflector = new ProtocolBuffersReflector(protocolBuffersMetaData, servicesMap, protocolBuffersChannel);
    for (Class<? extends PublicInterface> interface1 : servicesMap.getInterfaceClasses()) {
        PublicInterface createReflector = reflectorFactory.createReflector(interface1, reflector);
        add(interface1.getName(), createReflector);
    }
    finish(reflector, reflectorFactory);
    try {
        protocolBuffersChannel.connect(new InetSocketAddress(address, port));
    } catch (IOException e) {
        throw new ChannelConnectionException(e);
    }
}
Also used : ProtocolBuffersReflector(org.bimserver.shared.pb.ProtocolBuffersReflector) PublicInterface(org.bimserver.shared.interfaces.PublicInterface) ChannelConnectionException(org.bimserver.shared.ChannelConnectionException) InetSocketAddress(java.net.InetSocketAddress) SocketProtocolBuffersChannel(org.bimserver.shared.pb.SocketProtocolBuffersChannel) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 ChannelConnectionException (org.bimserver.shared.ChannelConnectionException)1 PublicInterface (org.bimserver.shared.interfaces.PublicInterface)1 ProtocolBuffersReflector (org.bimserver.shared.pb.ProtocolBuffersReflector)1 SocketProtocolBuffersChannel (org.bimserver.shared.pb.SocketProtocolBuffersChannel)1