Пример #1
0
  public void addBooks(Set<StockBook> bookSet) throws BookStoreException {
    ContentExchange exchange = new ContentExchange();
    String urlString;
    urlString = serverAddress + "/" + BookStoreMessageTag.ADDBOOKS;

    String listBooksxmlString = BookStoreUtility.serializeObjectToXMLString(bookSet);
    exchange.setMethod("POST");
    exchange.setURL(urlString);
    Buffer requestContent = new ByteArrayBuffer(listBooksxmlString);
    exchange.setRequestContent(requestContent);

    BookStoreUtility.SendAndRecv(this.client, exchange);
  }
Пример #2
0
  @SuppressWarnings("unchecked")
  public List<StockBook> getBooksByISBN(Set<Integer> isbns) throws BookStoreException {
    ContentExchange exchange = new ContentExchange();
    String urlString;
    urlString = serverAddress + "/" + BookStoreMessageTag.GETSTOCKBOOKSBYISBN;

    String listBooksxmlString = BookStoreUtility.serializeObjectToXMLString(isbns);
    exchange.setMethod("POST");
    exchange.setURL(urlString);
    Buffer requestContent = new ByteArrayBuffer(listBooksxmlString);
    exchange.setRequestContent(requestContent);

    return (List<StockBook>) BookStoreUtility.SendAndRecv(this.client, exchange);
  }
  public void addCopies(Set<BookCopy> bookCopiesSet) throws BookStoreException {

    String listBookCopiesxmlString = BookStoreUtility.serializeObjectToXMLString(bookCopiesSet);
    Buffer requestContent = new ByteArrayBuffer(listBookCopiesxmlString);
    BookStoreResult result = null;

    ContentExchange exchange = new ContentExchange();
    String urlString = getMasterServerAddress() + "/" + BookStoreMessageTag.ADDCOPIES;
    exchange.setMethod("POST");
    exchange.setURL(urlString);
    exchange.setRequestContent(requestContent);
    result = BookStoreUtility.SendAndRecv(this.client, exchange);
    this.setSnapshotId(result.getSnapshotId());
  }
Пример #4
0
  public void updateEditorPicks(Set<BookEditorPick> editorPicksValues) throws BookStoreException {
    ContentExchange exchange = new ContentExchange();
    String urlString = serverAddress + "/" + BookStoreMessageTag.UPDATEEDITORPICKS + "?";

    String xmlStringEditorPicksValues =
        BookStoreUtility.serializeObjectToXMLString(editorPicksValues);

    exchange.setMethod("POST");
    exchange.setURL(urlString);
    Buffer requestContent = new ByteArrayBuffer(xmlStringEditorPicksValues);

    exchange.setRequestContent(requestContent);

    BookStoreUtility.SendAndRecv(this.client, exchange);
  }