FileDocCategorySizeDatePackage
DataAdapter.javaAPI DocExample2689Sun Sep 02 14:59:06 BST 2001com.oreilly.forum.adapter

DataAdapter

public abstract class DataAdapter extends Object
Defines an interface to a data source.

Fields Summary
private static DataAdapter
instance
Constructors Summary
Methods Summary
public abstract java.util.IteratorgetAllBoards()

return
an iterator of all BoardSummary objects.

public abstract java.util.IteratorgetAllMessages(long boardID, MonthYear month)
If no messages exist for the specified board and month, return an empty iterator.

return
an iterator of MessageSummary objects.
throws
DataException if the boardID is illegal or a database error occurs.

public abstract BoardSummarygetBoardSummary(long boardID)

return
a board summary for the given id.
throws
DataException if boardID is illegal or a database error occurs.

public static synchronized com.oreilly.forum.adapter.DataAdaptergetInstance()

return
the singleton instance of this class.

        if (instance == null) {
            String adapterClassName = ForumConfig.getAdapterClassName();
            try {
                Class adapterClass = Class.forName(adapterClassName);
                instance = (DataAdapter) adapterClass.newInstance();
            } catch (Exception ex) {
                throw new DataException("Unable to instantiate "
                        + adapterClassName);
            }
        }
        return instance;
    
public abstract MessagegetMessage(long msgID)

param
msgID must be a valid message identifier.
return
the message with the specified id.
throws
DataException if msgID does not exist or a database error occurs.

public abstract MessagepostNewMessage(long boardID, java.lang.String msgSubject, java.lang.String authorEmail, java.lang.String msgText)
Post a new message.

return
the newly created message.
throws
DataException if a database error occurs, or if any parameter is illegal.

public abstract MessagereplyToMessage(long origMsgID, java.lang.String msgSubject, java.lang.String authorEmail, java.lang.String msgText)
Add a reply to an existing message.

throws
DataException if a database error occurs, or if any parameter is illegal.