log.trace("Created transport {}", transport); TBinaryProtocol protocol = new TBinaryProtocol(transport); Cassandra.Client client = new Cassandra.Client(protocol); if (!transport.isOpen()) { transport.open();
/** * {@inheritDoc} */ public Cassandra.Client getCassandra() { if ( !isOpen() ) { throw new IllegalStateException("getCassandra called on client that was not open. You should not have gotten here."); } if ( cassandraClient == null ) { cassandraClient = new Cassandra.Client(new TBinaryProtocol(transport)); } return cassandraClient; }
TTransport transport = new TFramedTransport(socket); TProtocol protocol = new TBinaryProtocol(transport, true, true); cassandra_client = new Cassandra.Client(protocol); try
/** * Tries to connect to Cassandra. * * @throws OpenRate.exception.InitializationException */ public void initCassandraConnection() throws InitializationException { tr = new TFramedTransport(new TSocket(cassandraIPAddr, cassandraPort)); TProtocol proto = new TBinaryProtocol(tr); client = new Cassandra.Client(proto); try { tr.open(); } catch (TTransportException ex) { message = "Transport exception opening Cassandra transport"; throw new InitializationException(message, ex, getSymbolicName()); } }
private static Cassandra.Client createThriftClient(String host, int port, String user, String passwd, ITransportFactory transportFactory) throws Exception { TTransport trans = transportFactory.openTransport(host, port); TProtocol protocol = new TBinaryProtocol(trans); Cassandra.Client client = new Cassandra.Client(protocol); if (user != null && passwd != null) { Map<String, String> credentials = new HashMap<>(); credentials.put(IAuthenticator.USERNAME_KEY, user); credentials.put(IAuthenticator.PASSWORD_KEY, passwd); AuthenticationRequest authenticationRequest = new AuthenticationRequest(credentials); client.login(authenticationRequest); } return client; } }
@SuppressWarnings("resource") public static Cassandra.Client createConnection(Configuration conf, String host, Integer port) throws IOException { try { TTransport transport = getClientTransportFactory(conf).openTransport(host, port); return new Cassandra.Client(new TBinaryProtocol(transport, true, true)); } catch (Exception e) { throw new IOException("Unable to connect to server " + host + ":" + port, e); } }
private static void initClient(String username, String password) throws InvalidRequestException, TException, AuthenticationException, AuthorizationException { TTransport tr = new TFramedTransport(new TSocket(nodeListenAddress, 9160)); tr.open(); client = new Cassandra.Client(new TBinaryProtocol(tr)); client.set_keyspace(keyspace); if(username != null && password != null) { client.login(new AuthenticationRequest(ImmutableMap.of("username", username, "password", password))); } }
public Cassandra.Client getClient() { Cassandra.Client client = new Cassandra.Client(proto); return client; } }
public CassandraThriftFacade(TFramedTransport transport) { _transport = transport; _client = new Cassandra.Client(new TBinaryProtocol(_transport)); try { _transport.open(); } catch (Exception e) { throw Throwables.propagate(e); } }
private void dropOldKeyspace() throws InvalidRequestException, SchemaDisagreementException, TException { TTransport tr = new TFramedTransport(new TSocket("localhost", 9160)); TProtocol proto = new TBinaryProtocol(tr); Cassandra.Client client = new Cassandra.Client(proto); tr.open(); client.system_drop_keyspace(JANUSGRAPH); LOGGER.info("DROPPED keyspace janusgraph"); tr.close(); }
private Cassandra.Client client(Instance instance) throws TException { TTransport trans = new TFramedTransport(new TSocket( instance.getPublicIp(), CassandraClusterActionHandler.CLIENT_PORT)); trans.open(); TBinaryProtocol protocol = new TBinaryProtocol(trans); return new Cassandra.Client(protocol); }
@SuppressWarnings("resource") public static Cassandra.Client createConnection(Configuration conf, String host, Integer port) throws IOException { try { TTransport transport = getClientTransportFactory(conf).openTransport(host, port); return new Cassandra.Client(new TBinaryProtocol(transport, true, true)); } catch (Exception e) { throw new IOException("Unable to connect to server " + host + ":" + port, e); } }
public static Cassandra.Client createConnection(Configuration conf, String host, Integer port) throws IOException { try { TTransport transport = getClientTransportFactory(conf).openTransport(host, port); return new Cassandra.Client(new TBinaryProtocol(transport, true, true)); } catch (Exception e) { throw new IOException("Unable to connect to server " + host + ":" + port, e); } }
public static Cassandra.Client createConnection(Configuration conf, String host, Integer port) throws IOException { try { TTransport transport = getClientTransportFactory(conf).openTransport(host, port); return new Cassandra.Client(new TBinaryProtocol(transport, true, true)); } catch (Exception e) { throw new IOException("Unable to connect to server " + host + ":" + port, e); } }
private static Cassandra.Client createThriftClient(String host, int port) throws TTransportException { TSocket socket = new TSocket(host, port); TTransport trans = new TFramedTransport(socket); trans.open(); TProtocol protocol = new org.apache.thrift.protocol.TBinaryProtocol(trans); return new Cassandra.Client(protocol); } }
/** * {@inheritDoc} */ public Cassandra.Client getCassandra() { if ( !isOpen() ) { throw new IllegalStateException("getCassandra called on client that was not open. You should not have gotten here."); } if ( cassandraClient == null ) { cassandraClient = new Cassandra.Client(new TBinaryProtocol(transport)); } return cassandraClient; }
/** * {@inheritDoc} */ public Cassandra.Client getCassandra() { if ( !isOpen() ) { throw new IllegalStateException("getCassandra called on client that was not open. You should not have gotten here."); } if ( cassandraClient == null ) { cassandraClient = new Cassandra.Client(new TBinaryProtocol(transport)); } return cassandraClient; }
new TFramedTransport(thriftSocket, CassandraConstants.CLIENT_MAX_THRIFT_FRAME_SIZE_BYTES); TProtocol protocol = new TBinaryProtocol(thriftFramedTransport); Cassandra.Client client = new Cassandra.Client(protocol);
/** * Inits the client. * * @param port * @param ip * * @throws TTransportException * the t transport exception */ public static void initClient(String ip, int port) throws TTransportException { TSocket socket = new TSocket(ip, port); TTransport transport = new TFramedTransport(socket); TProtocol protocol = new TBinaryProtocol(transport, true, true); client = new Cassandra.Client(protocol); socket.open(); }
/** * Inits the client. * * @throws TTransportException * the t transport exception */ public static void initClient() throws TTransportException { TSocket socket = new TSocket("127.0.0.1", 9160); TTransport transport = new TFramedTransport(socket); TProtocol protocol = new TBinaryProtocol(transport, true, true); client = new Cassandra.Client(protocol); socket.open(); }