@SuppressWarnings("unchecked") public List<StockBook> getBooks() throws BookStoreException { BookStoreResult result = null; do { ContentExchange exchange = new ContentExchange(); String urlString = getReplicaAddress() + "/" + BookStoreMessageTag.LISTBOOKS; exchange.setURL(urlString); result = BookStoreUtility.SendAndRecv(this.client, exchange); } while (result.getSnapshotId() < this.getSnapshotId()); this.setSnapshotId(result.getSnapshotId()); return (List<StockBook>) result.getResultList(); }
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()); }
public void updateEditorPicks(Set<BookEditorPick> editorPicksValues) throws BookStoreException { String xmlStringEditorPicksValues = BookStoreUtility.serializeObjectToXMLString(editorPicksValues); Buffer requestContent = new ByteArrayBuffer(xmlStringEditorPicksValues); BookStoreResult result = null; ContentExchange exchange = new ContentExchange(); String urlString = getMasterServerAddress() + "/" + BookStoreMessageTag.UPDATEEDITORPICKS + "?"; exchange.setMethod("POST"); exchange.setURL(urlString); exchange.setRequestContent(requestContent); result = BookStoreUtility.SendAndRecv(this.client, exchange); this.setSnapshotId(result.getSnapshotId()); }