public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public CassandraManagedConnection(CassandraProperties properties) throws ResourceException { try { transport = new TFramedTransport(new TSocket( properties.getServer(), properties.getPort(), properties.getTimeout())); TProtocol framedProtocol = new TBinaryProtocol(transport); iface = new Cassandra.Client(framedProtocol); transport.open(); if (StringUtils.isNotBlank(properties.getUsername()) && StringUtils.isNotBlank(properties.getPassword())) { Map<String, String> credentials = new HashMap<String, String>(); //TODO AuthenticationRequest request = new AuthenticationRequest(credentials); request.validate(); iface.login(request); } if (StringUtils.isNotBlank(properties.getKeyspace())) { iface.set_keyspace(properties.getKeyspace()); } } catch (Exception ex) { throw new ResourceException(ex); } }