Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire
Class OfflineMessageStore

    java.lang.Object
      org.jivesoftware.openfire.container.BasicModule
          org.jivesoftware.openfire.OfflineMessageStore

All Implemented Interfaces:
  Module, UserEventListener

    public class OfflineMessageStore

extends BasicModule
implements UserEventListener

Represents the user's offline message storage. A message store holds messages that were sent to the user while they were unavailable. The user can retrieve their messages by setting their presence to "available". The messages will then be delivered normally. Offline message storage is optional, in which case a null implementation is returned that always throws UnauthorizedException when adding messages to the store.

Author:
  Iain Shigeoka

Constructor Summary
`OfflineMessageStore()` Constructs a new offline message store.

Method Summary
`void` | `addMessage(org.xmpp.packet.Message message)` Adds a message to this message store.
`void` | `deleteMessage(String username, Date creationDate)` Deletes the specified offline message in the store for a user.
`void` | `deleteMessages(String username)` Deletes all offline messages in the store for a user.
`static OfflineMessageStore` | `getInstance()` Returns the instance of `OfflineMessageStore` being used by the XMPPServer.
`OfflineMessage` | `getMessage(String username, Date creationDate)` Returns the offline message of the specified user with the given creation date.
`Collection<OfflineMessage>` | `getMessages(String username, boolean delete)` Returns a Collection of all messages in the store for a user.
`int` | `getSize()` Returns the approximate size (in bytes) of the XML messages stored for all users.
`int` | `getSize(String username)` Returns the approximate size (in bytes) of the XML messages stored for a particular user.
`void` | `start()` Starts the basic module.
`void` | `stop()` Stops the basic module.
`void` | `userCreated(User user, Map params)` A user was created.
`void` | `userDeleting(User user, Map params)` A user is being deleted.
`void` | `userModified(User user, Map params)` A user's name, email, or an extended property was changed.

Methods inherited from class org.jivesoftware.openfire.container.BasicModule
`destroy, getName, initialize`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OfflineMessageStore

    public OfflineMessageStore()

  Constructs a new offline message store.

Method Detail

### getInstance

    public static OfflineMessageStore getInstance()

  Returns the instance of `OfflineMessageStore` being used by the XMPPServer.

  Returns:
    the instance of `OfflineMessageStore` being used by the XMPPServer.

### addMessage

    public void addMessage(org.xmpp.packet.Message message)

  Adds a message to this message store. Messages will be stored and made available for later delivery.

  Parameters:
    `message` - the message to store.

### getMessages

    public Collection<OfflineMessage> getMessages(String username,
                                                  boolean delete)

  Returns a Collection of all messages in the store for a user. Messages may be deleted after being selected from the database depending on the delete param.

  Parameters:
    `username` - the username of the user who's messages you'd like to receive.
    `delete` - true if the offline messages should be deleted.
  Returns:
    An iterator of packets containing all offline messages.

### getMessage

    public OfflineMessage getMessage(String username,
                                     Date creationDate)

  Returns the offline message of the specified user with the given creation date. The returned message will NOT be deleted from the database.

  Parameters:
    `username` - the username of the user who's message you'd like to receive.
    `creationDate` - the date when the offline message was stored in the database.
  Returns:
    the offline message of the specified user with the given creation stamp.

### deleteMessages

    public void deleteMessages(String username)

  Deletes all offline messages in the store for a user.

  Parameters:
    `username` - the username of the user who's messages are going to be deleted.

### deleteMessage

    public void deleteMessage(String username,
                              Date creationDate)

  Deletes the specified offline message in the store for a user. The way to identify the message to delete is based on the creationDate and username.

  Parameters:
    `username` - the username of the user who's message is going to be deleted.
    `creationDate` - the date when the offline message was stored in the database.

### getSize

    public int getSize(String username)

  Returns the approximate size (in bytes) of the XML messages stored for a particular user.

  Parameters:
    `username` - the username of the user.
  Returns:
    the approximate size of stored messages (in bytes).

### getSize

    public int getSize()

  Returns the approximate size (in bytes) of the XML messages stored for all users.

  Returns:
    the approximate size of all stored messages (in bytes).

### userCreated

    public void userCreated(User user,
                            Map params)

  Description copied from interface: `UserEventListener`
  A user was created.

  Specified by:
    `userCreated` in interface `UserEventListener`
  Parameters:
    `user` - the user.
    `params` - event parameters.

### userDeleting

    public void userDeleting(User user,
                             Map params)

  Description copied from interface: `UserEventListener`
  A user is being deleted.

  Specified by:
    `userDeleting` in interface `UserEventListener`
  Parameters:
    `user` - the user.
    `params` - event parameters.

### userModified

    public void userModified(User user,
                             Map params)

  Description copied from interface: `UserEventListener`
  A user's name, email, or an extended property was changed.

  Specified by:
    `userModified` in interface `UserEventListener`
  Parameters:
    `user` - the user.
    `params` - event parameters.

### start

    public void start()
               throws IllegalStateException

  Description copied from class: `BasicModule`

  Starts the basic module.

  Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.

  Specified by:
    `start` in interface `Module`
  Overrides:
    `start` in class `BasicModule`
  Throws:
    `IllegalStateException` - If start is called before initialize successfully returns

### stop

    public void stop()

  Description copied from class: `BasicModule`

  Stops the basic module.

  Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.

  Specified by:
    `stop` in interface `Module`
  Overrides:
    `stop` in class `BasicModule`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.