code: public static void useResource(String host, int port, String user, String password, Authentication authType)
      throws IOException, ParserConfigurationException, ResourceNotFoundException, ForbiddenUserException, FailedRequestException
    {
      // create the client
      DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);
  
      // create the CSV splitter
      OpenCSVBatcher splitter = new OpenCSVBatcher(client);
      splitter.setHasHeader(true);
  
      // acquire the CSV input
      InputStream listingStream = Util.openStream(
        "data"+File.separator+"listings.csv");
      if (listingStream == null)
        throw new RuntimeException("Could not read example listings");
  
      // write the CSV input to the database
      long docs = splitter.write(
        new InputStreamReader(listingStream), "/listings/", "listing"
      );
  
      System.out.println("split CSV file into "+docs+" documents");
      XMLDocumentManager docMgr = client.newXMLDocumentManager();
      StringHandle       handle = new StringHandle();
      for (int i=1; i <= docs; i++) {
        System.out.println(
          docMgr.read("/listings/listing"+i+".xml", handle).get()
        );
      }
  
      // release the client
      client.release();
    }
docs: use the resource manager