Pure CORBA

Home   About Us   Downloads

Book Repository IDL

//IDL

module BookRepository {
    typedef long ISBN;

    struct PersonName {
        string first_name;
        string second_name;
    };

    struct Date {
        short day;
        short month;
        short year;
    };
    
    struct BookDetails {
        PersonName   author;
        string       title;
        ISBN         book_id;
        Date         publication_date;
    };
    typedef sequence BookDetailsSeq;

    enum FuzzyBoolean {NO, YES, UNKNOWN};

    interface Collection {
        readonly attribute long    number_of_books;
        attribute          string  name_of_collection;

        FuzzyBoolean is_in_collection(in ISBN book_id);
    };

    interface SearchableCollection : Collection {
        boolean find_by_title(
                    in string          title,
                    out BookDetailsSeq books_found
                );
    };

    interface BorrowableCollection : Collection {
        exception Unavailable {
            Date when_available;
        };

        void borrow_book(
                 in ISBN       book_id,
                 in PersonName borrower,
                 out Date      return_date
             )
             raises (Unavailable);
    };

    interface FlexibleCollection
      : BorrowableCollection, SearchableCollection { };
};