BEA Systems, Inc.

theory.smart.axiom.messaging
Interface Mailbox


public interface Mailbox
extends Entity

A simple message collection with some specialized message handling methods. The Mailbox is managed by the PostOffice

 Primary Key = theory.smart.axiom.messaging.MailboxPk
 
                  ownerId
 [Mailbox] <*>------> [String] (Primary Key)

 
                  nextId
 [Mailbox] <*>------> [int] 

 
                  message (List)
 [Mailbox] <*>------> [theory.smart.axiom.messaging.Message] 
                     0..*
 

See Also:
MailboxPk, MailboxHome, MailboxImpl, MailboxValue

Method Summary
 void addFirstMessage(Message message)
          Inserts the given message at the beginning of the message list.
 void addLastMessage(Message message)
          Appends the given message to the end of the message list.
 void addMessage(int index, Message message)
          Inserts the specified message at the specified position in the message list.
 boolean addMessage(Message message)
          Appends the specified message to the end of the message list.
 void addMessage(java.lang.String body)
          Create a new nessage with the nextId and increment the nextId.
 boolean addMessages(int index, com.sun.java.util.collections.LinkedList messages)
          Inserts all of the messages in the specified collection into this list, starting at the specified position.
 boolean addMessages(com.sun.java.util.collections.LinkedList messages)
          Appends all of the messages in the specified collection to the end of the message list, in the order that they are returned by the specified collection's iterator.
 boolean containsMessage(Message message)
          Returns true if the message list contains the specified element.
 Message getFirstMessage()
          Returns the first message in the message list.
 Message getLastMessage()
          Returns the last message in the message list.
 MailboxValue getMailboxByValue()
          Get all of Mailbox's attributes.
 Message getMessage(int index)
          Returns the message at the specified position in the message list.
 com.sun.java.util.collections.LinkedList getMessages()
          Returns all of the messages in the message list.
 com.sun.java.util.collections.LinkedList getMessages(int fromIndex, int toIndex)
          Returns a view of the portion of the message list between fromIndex, inclusive, and toIndex, exclusive.
 int getNextId()
          Get the value of nextId
 int getNumberOfMessages()
          Returns the number of messages in the message list.
 java.lang.String getOwnerId()
           
 int indexOfMessage(Message message)
          Returns the index in the message list of the first occurrence of the specified element, or -1 if the message list does not contain this element.
 boolean isMessagesEmtpy()
          Returns true if the message list contains no messages.
 int lastIndexOfMessage(Message message)
          Returns the index in the message list of the last occurrence of the specified element, or -1 if the message list does not contain this element.
 void removeAllMessages()
          Removes all of the messages from the message list.
 Message removeFirstMessage()
          Removes and returns the first message from the message list.
 Message removeLastMessage()
          Removes and returns the last message from the message list.
 Message removeMessage(int index)
          Removes the message at the specified position in the message list.
 boolean removeMessage(Message message)
          Removes the first occurrence of the specified message in the message list.
 void setMailboxByValue(MailboxValue value)
          Set all of Mailbox's attributes to the passed in value.
 Message setMessage(int index, Message message)
          Replaces the message at the specified position in the message list with the specified element.
 void setNextId(int nextId)
          Set the value of nextId
 
Methods inherited from interface javax.ejb.EJBObject
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
 

Method Detail

getMailboxByValue

public MailboxValue getMailboxByValue()
                               throws java.rmi.RemoteException
Get all of Mailbox's attributes.
Returns:
MailboxValue the Mailbox value object

setMailboxByValue

public void setMailboxByValue(MailboxValue value)
                       throws java.rmi.RemoteException
Set all of Mailbox's attributes to the passed in value. Note: Primary key attributes are not set.
Parameters:
MailboxValue - the Mailbox value object

getOwnerId

public java.lang.String getOwnerId()
                            throws java.rmi.RemoteException

getNextId

public int getNextId()
              throws java.rmi.RemoteException
Get the value of nextId
Returns:
nextId.

setNextId

public void setNextId(int nextId)
               throws java.rmi.RemoteException
Set the value of nextId
Parameters:
nextIds - nextId to be added

addMessage

public void addMessage(int index,
                       Message message)
                throws java.rmi.RemoteException
Inserts the specified message at the specified position in the message list. Shifts the message currently at that position (if any) and any subsequent messages to the right (adds one to their indices).
Parameters:
index - index at which the specified message is to be inserted.
message - message to be inserted.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addMessage

public boolean addMessage(Message message)
                   throws java.rmi.RemoteException
Appends the specified message to the end of the message list.
Parameters:
message - message to be appended to the message list.
Returns:
true (as per the general contract of Collection.add).

addMessages

public boolean addMessages(int index,
                           com.sun.java.util.collections.LinkedList messages)
                    throws java.rmi.RemoteException
Inserts all of the messages in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent messages to the right (increases their indices). The new messages will appear in the message list in the order that they are returned by the specified collection's iterator.
Parameters:
index - index at which to insert first element from the specified collection.
messages - messages to be inserted into the message list.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addMessages

public boolean addMessages(com.sun.java.util.collections.LinkedList messages)
                    throws java.rmi.RemoteException
Appends all of the messages in the specified collection to the end of the message list, in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is the message list, and the message list is nonempty.)
Parameters:
messages - messages to be inserted into the message list.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addFirstMessage

public void addFirstMessage(Message message)
                     throws java.rmi.RemoteException
Inserts the given message at the beginning of the message list.

addLastMessage

public void addLastMessage(Message message)
                    throws java.rmi.RemoteException
Appends the given message to the end of the message list. (Identical in function to the add method; included only for consistency.)

containsMessage

public boolean containsMessage(Message message)
                        throws java.rmi.RemoteException
Returns true if the message list contains the specified element. More formally, returns true if and only if the message list contains at least one message e such that (o==null ? e==null : o.equals(e)).
Parameters:
message - message whose presence in the message list is to be tested.
Returns:
true if the message list contains the specified element.

getMessage

public Message getMessage(int index)
                   throws java.rmi.RemoteException
Returns the message at the specified position in the message list.
Parameters:
index - index of message to return.
Returns:
the message at the specified position in the message list.
Throws:
IndexOutOfBoundsException - if the specified index is is out of range (index < 0 || index >= size()).

getMessages

public com.sun.java.util.collections.LinkedList getMessages(int fromIndex,
                                                            int toIndex)
                                                     throws java.rmi.RemoteException
Returns a view of the portion of the message list between fromIndex, inclusive, and toIndex, exclusive.
Parameters:
fromIndex - low endpoint (inclusive) of the subList.
toKey - high endpoint (exclusive) of the subList.
Returns:
a view of the specified range within the message list.
Throws:
IndexOutOfBoundsException - endpoint index value out of range (fromIndex < 0 || toIndex > size)
java.lang.IllegalArgumentException - endpoint indices out of order (fromIndex > toIndex)

getMessages

public com.sun.java.util.collections.LinkedList getMessages()
                                                     throws java.rmi.RemoteException
Returns all of the messages in the message list.
Returns:
all of the messages in the message list.

getFirstMessage

public Message getFirstMessage()
                        throws java.rmi.RemoteException
Returns the first message in the message list.
Returns:
the first message in the message list.

getLastMessage

public Message getLastMessage()
                       throws java.rmi.RemoteException
Returns the last message in the message list.
Returns:
the last message in the message list.
Throws:
java.util.NoSuchElementException - if the message list is empty.

getNumberOfMessages

public int getNumberOfMessages()
                        throws java.rmi.RemoteException
Returns the number of messages in the message list.
Returns:
the number of messages in the message list.

indexOfMessage

public int indexOfMessage(Message message)
                   throws java.rmi.RemoteException
Returns the index in the message list of the first occurrence of the specified element, or -1 if the message list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
message - message to search for.
Returns:
the index in the message list of the first occurrence of the specified element, or -1 if the message list does not contain this element.

isMessagesEmtpy

public boolean isMessagesEmtpy()
                        throws java.rmi.RemoteException
Returns true if the message list contains no messages.

Returns:
true if the message list contains no messages.

lastIndexOfMessage

public int lastIndexOfMessage(Message message)
                       throws java.rmi.RemoteException
Returns the index in the message list of the last occurrence of the specified element, or -1 if the message list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
message - message to search for.
Returns:
the index in the message list of the last occurrence of the specified element, or -1 if the message list does not contain this element.

removeAllMessages

public void removeAllMessages()
                       throws java.rmi.RemoteException
Removes all of the messages from the message list.

removeMessage

public Message removeMessage(int index)
                      throws java.rmi.RemoteException
Removes the message at the specified position in the message list. Shifts any subsequent messages to the left (subtracts one from their indices). Returns the message that was removed from the message list.
Parameters:
index - the index of the message to removed.
Returns:
the message previously at the specified position.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()).

removeMessage

public boolean removeMessage(Message message)
                      throws java.rmi.RemoteException
Removes the first occurrence of the specified message in the message list. If the message list does not contain the element, it is unchanged. More formally, removes the message with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an message exists).
Parameters:
message - message to be removed from the message list, if present.
Returns:
true if the message list contained the specified element.

removeFirstMessage

public Message removeFirstMessage()
                           throws java.rmi.RemoteException
Removes and returns the first message from the message list.
Returns:
the first message from the message list.
Throws:
java.util.NoSuchElementException - if the message list is empty.

removeLastMessage

public Message removeLastMessage()
                          throws java.rmi.RemoteException
Removes and returns the last message from the message list.
Returns:
the last message from the message list.
Throws:
java.util.NoSuchElementException - if the message list is empty.

setMessage

public Message setMessage(int index,
                          Message message)
                   throws java.rmi.RemoteException
Replaces the message at the specified position in the message list with the specified element.
Parameters:
index - index of message to replace.
message - message to be stored at the specified position.
Returns:
the message previously at the specified position.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()).

addMessage

public void addMessage(java.lang.String body)
                throws java.rmi.RemoteException
Create a new nessage with the nextId and increment the nextId. Add the message to the end of the list.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved