Search in sources :

Example 1 with JsonChannel

use of org.bimserver.client.json.JsonChannel in project BIMserver by opensourceBIM.

the class NotificationsManager method getChannel.

public Channel getChannel(Service service) throws ChannelConnectionException {
    switch(service.getNotificationProtocol()) {
        case JSON:
            JsonChannel jsonChannel = new JsonChannel(null, bimServer.getReflectorFactory(), jsonSocketReflectorFactory, service.getUrl() + "/json", bimServer.getServicesMap());
            jsonChannel.connect(new SimpleTokenHolder());
            return jsonChannel;
        case INTERNAL:
            DirectChannel directChannel = new DirectChannel(null, bimServer.getServiceFactory(), bimServer.getServicesMap());
            try {
                directChannel.connect();
            } catch (UserException e) {
                LOGGER.error("", e);
            }
            return directChannel;
        default:
            LOGGER.error("Unimplemented AccessMethod: " + service.getNotificationProtocol());
            return null;
    }
}
Also used : JsonChannel(org.bimserver.client.json.JsonChannel) DirectChannel(org.bimserver.client.DirectChannel) SimpleTokenHolder(org.bimserver.client.SimpleTokenHolder) UserException(org.bimserver.shared.exceptions.UserException)

Aggregations

DirectChannel (org.bimserver.client.DirectChannel)1 SimpleTokenHolder (org.bimserver.client.SimpleTokenHolder)1 JsonChannel (org.bimserver.client.json.JsonChannel)1 UserException (org.bimserver.shared.exceptions.UserException)1