Methods Summary |
---|
public void | ejbActivate()Activation/passivations methods are also no-ops
|
public void | ejbCreate()
// Nothing to do in this example
|
public void | ejbPassivate()
|
public void | ejbRemove()
// Nothing to do in this example
|
private ora.jwsnut.chapter2.bookservice.BookInfo | findBook(java.lang.String name)Looks for a book whose title matches a given string.
The comparison is case-insensitive.
BookInfo[] books = BookServiceServantData.getBookInfo();
for (int i = 0; i < books.length; i++) {
if (books[i].getTitle().equalsIgnoreCase(name)) {
// Found a match
return books[i];
}
}
return null; // No match
|
public java.lang.String | getAuthor(java.lang.String name)Get the author for a book with a given name.
BookInfo book = findBook(name);
return book == null ? null : book.getAuthor();
|
public int | getBookCount()Gets the number of books known to the service
return BookServiceServantData.getBookInfo().length;
|
public ora.jwsnut.chapter2.bookservice.BookInfo[] | getBookInfo()Gets information for all known books, in the form of an array.
return BookServiceServantData.getBookInfo();
|
public java.util.HashMap | getBookMap()Returns all of the books known to the book
service in the form of a HashMap where the
key to each entry is the book title in upper case
and the value is a BookInfo object.
return BookServiceServantData.getBookInfoHashMap();
|
public java.lang.String | getEditor(java.lang.String name)Gets the name of the editor for a book.
BookInfo book = findBook(name);
return book == null ? null : book.getEditor();
|
public double | getPrice(java.lang.String name)Gets the price of a book with a given name. If the given
name does not match with a known book, a BookServiceException
is thrown.
BookInfo book = findBook(name);
if (book == null) {
// No such book - throw an exception
throw new BookServiceException("No matching book for '" + name + "'");
}
return book.getPrice();
|
public void | setSessionContext(javax.ejb.SessionContext sessionContext)Provides the bean with access to state
from the container.
this.sessionContext = sessionContext;
|