Open main menu

CDOT Wiki β

Changes

OSGi : Develop Simple Apps

816 bytes added, 14:39, 22 January 2011
book class
public interface BookFinder {
Book findBook(int isbn) throws BookNotFoundException;
}
</source>
Define in the same bundle the classes that you need such as: Book and BookNotFoundException
<source lang="java">
package cs.ecl.osgi.simple.bookfinder;
 
public class Book {
private int isbn;
private String title;
public Book(int isbn, String title) {
super();
this.isbn = isbn;
this.title = title;
}
 
public String getTitle() {
return title;
}
 
public void setTitle(String title) {
this.title = title;
}
 
public int getIsbn() {
return isbn;
}
 
public void setIsbn(int isbn) {
this.isbn = isbn;
}
}
 
package cs.ecl.osgi.simple.bookfinder;
 
public class BookNotFoundException extends Exception {
private static final long serialVersionUID = -6184839510952070091L;
 
public BookNotFoundException() {
super();
}
 
public BookNotFoundException(String arg0) {
super(arg0);
}
}
</source>