{
Object[] parameters = cycle.getServiceParameters();
Integer bookPK = (Integer) parameters[0];
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
Book book = null;
int i = 0;
while (true)
{
try
{
IOperations operations = vengine.getOperations();
book = operations.deleteBook(bookPK);
break;
}
catch (RemoveException ex)
{
throw new ApplicationRuntimeException(ex);
}
catch (RemoteException ex)
{
vengine.rmiFailure("Remote exception deleting book #" + bookPK + ".", ex, i++);
}
}
MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
myLibrary.setMessage(format("book-deleted", book.getTitle()));
myLibrary.activate(cycle);
}