@Test(expected = PilosaException.class) public void importNodeTest() throws IOException { try (PilosaClient client = PilosaClient.withAddress("non-existent-domain-555.com:19000")) { Schema schema = Schema.defaultSchema(); Index index = schema.index("foo"); Field field = index.field("bar"); ImportRequest request = ImportRequest.createCSVImport(field, new byte[]{0}, false); client.importNode("non-existent-domain-555.com:19000", request); } }
void importNode(String hostUri, ImportRequest request) { ByteArrayEntity entity = new ByteArrayEntity(request.getPayload()); HttpRequestBase httpRequest = makeRequest("POST", request.getPath(), entity, request.getHeaders(), hostUri); try { clientExecute(httpRequest, "Error while importing", ReturnClientResponse.ERROR_CHECKED_RESPONSE); } catch (IOException e) { throw new PilosaException(String.format("Error connecting to host: %s", hostUri)); } }
PilosaClient implements AutoCloseable { void importNode(String hostUri, ImportRequest request) { ByteArrayEntity entity = new ByteArrayEntity(request.getPayload()); HttpRequestBase httpRequest = makeRequest("POST", request.getPath(), entity, request.getHeaders(), hostUri); try { clientExecute(httpRequest, "Error while importing", ReturnClientResponse.ERROR_CHECKED_RESPONSE); } catch (IOException e) { throw new PilosaException(String.format("Error connecting to host: %s", hostUri)); } } }
PilosaClient implements AutoCloseable { void importNode(String hostUri, ImportRequest request) { ByteArrayEntity entity = new ByteArrayEntity(request.getPayload()); HttpRequestBase httpRequest = makeRequest("POST", request.getPath(), entity, request.getHeaders(), hostUri); try { clientExecute(httpRequest, "Error while importing", ReturnClientResponse.ERROR_CHECKED_RESPONSE); } catch (IOException e) { throw new PilosaException(String.format("Error connecting to host: %s", hostUri)); } } protected  PilosaClient(Cluster cluster, ClientOptions options); protected  PilosaClient(URI uri, ClientOptions options); }
PilosaClient implements AutoCloseable { void importNode(String hostUri, ImportRequest request) { ByteArrayEntity entity = new ByteArrayEntity(request.getPayload()); HttpRequestBase httpRequest = makeRequest("POST", request.getPath(), entity, request.getHeaders(), hostUri); try { clientExecute(httpRequest, "Error while importing", ReturnClientResponse.ERROR_CHECKED_RESPONSE); } catch (IOException e) { throw new PilosaException(String.format("Error connecting to host: %s", hostUri)); } } protected  PilosaClient(Cluster cluster, ClientOptions options); protected  PilosaClient(URI uri, ClientOptions options); @SuppressWarnings("WeakerAccess") static PilosaClient defaultClient(); static PilosaClient withAddress(String address); static PilosaClient withURI(URI uri); static PilosaClient withURI(URI uri, ClientOptions options); static PilosaClient withCluster(Cluster cluster); @SuppressWarnings("WeakerAccess") static PilosaClient withCluster(Cluster cluster, ClientOptions options); void close(); QueryResponse query(PqlQuery query); QueryResponse query(PqlQuery query, QueryOptions options); void createIndex(Index index); void ensureIndex(Index index); void createField(Field field); void ensureField(Field field); void deleteIndex(Index index); void deleteField(Field field); void importField(Field field, RecordIterator iterator); @SuppressWarnings("WeakerAccess") void importField(Field field, RecordIterator iterator, ImportOptions options); @SuppressWarnings("WeakerAccess") void importField(Field field, RecordIterator iterator, ImportOptions options, final BlockingQueue<ImportStatusUpdate> statusQueue); SchemaInfo readServerSchema(); Schema readSchema(); void syncSchema(Schema schema); long[] translateRowKeys(Field field, String[] keys); long[] translateColumnKeys(Index index, String[] keys); long[] translateKeys(Internal.TranslateKeysRequest request); CloseableHttpResponse httpRequest(final String method, final String path); CloseableHttpResponse httpRequest(final String method, final String path, final ByteArrayEntity data,
                                             Header[] headers); }
PilosaClient implements AutoCloseable { void importNode(String hostUri, ImportRequest request) { ByteArrayEntity entity = new ByteArrayEntity(request.getPayload()); HttpRequestBase httpRequest = makeRequest("POST", request.getPath(), entity, request.getHeaders(), hostUri); try { clientExecute(httpRequest, "Error while importing", ReturnClientResponse.ERROR_CHECKED_RESPONSE); } catch (IOException e) { throw new PilosaException(String.format("Error connecting to host: %s", hostUri)); } } protected  PilosaClient(Cluster cluster, ClientOptions options); protected  PilosaClient(URI uri, ClientOptions options); @SuppressWarnings("WeakerAccess") static PilosaClient defaultClient(); static PilosaClient withAddress(String address); static PilosaClient withURI(URI uri); static PilosaClient withURI(URI uri, ClientOptions options); static PilosaClient withCluster(Cluster cluster); @SuppressWarnings("WeakerAccess") static PilosaClient withCluster(Cluster cluster, ClientOptions options); void close(); QueryResponse query(PqlQuery query); QueryResponse query(PqlQuery query, QueryOptions options); void createIndex(Index index); void ensureIndex(Index index); void createField(Field field); void ensureField(Field field); void deleteIndex(Index index); void deleteField(Field field); void importField(Field field, RecordIterator iterator); @SuppressWarnings("WeakerAccess") void importField(Field field, RecordIterator iterator, ImportOptions options); @SuppressWarnings("WeakerAccess") void importField(Field field, RecordIterator iterator, ImportOptions options, final BlockingQueue<ImportStatusUpdate> statusQueue); SchemaInfo readServerSchema(); Schema readSchema(); void syncSchema(Schema schema); long[] translateRowKeys(Field field, String[] keys); long[] translateColumnKeys(Index index, String[] keys); long[] translateKeys(Internal.TranslateKeysRequest request); CloseableHttpResponse httpRequest(final String method, final String path); CloseableHttpResponse httpRequest(final String method, final String path, final ByteArrayEntity data,
                                             Header[] headers); static String PQL_VERSION; }