com.tibbo.aggregate.common.dao

## Interface EventStorageManager

-     public interface EventStorageManager

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `EventStorage` | `addStorage(Context context, EventDefinition def)` Add a dedicated event storage for events of a certain type.
    `void` | `addStorage(EventStorage storage)` Add a new storage.
    `java.util.List<? extends EventStorage>` | `fetchEventStorages()` Returns a list of all event storages available on the server.
    `DataTable` | `fetchEventStoragesTable()` Returns a list of all event storages in form of a DataTable.
    `EventStorage` | `getDefaultStorage()` Get an event storage used to keep events that are not forwarded to any other custom storage.
    `DaoFactory` | `getFactory()` Returns storage manager's DAO factory
    `EventStorage` | `getStorage(java.lang.String table)` Returns an event storage descriptor by a specified table name.
    `EventStorage` | `getStorage(java.lang.String context, java.lang.String event)` Get event storage to used to keep certain events.
    `EventStorage` | `getStorageByContextAndEvent(java.lang.String context, java.lang.String event)` Returns an event storage descriptor by a specified context name.
    `java.util.Collection<EventStorage>` | `getStorages()` Returns a list of all event storages available on the server.
    `DataTable` | `getStoragesAsTable()` Returns a list of all event storages in form of a DataTable.
    `void` | `initializeEventStorages(java.util.List<? extends EventStorage> eventStorages, boolean create)` Perform initialization of all storages.
    `void` | `prepareDedicatedStorage(Context context, EventDefinition def, boolean create)` Setup a dedicated event storage for specific events.
    `void` | `removeStorage(EventStorage storage)` Remove a storage
    `void` | `removeStorages(java.lang.String context)` Remove all storages associated with a context.
    `void` | `saveEventStorages()` Persistently save information about currently configured event storages
    `void` | `saveEventStorages(java.util.Collection<EventStorage> eventStorages)` Persistently save information about specified event storages
    `void` | `updateStorages(DataTable oldStoragesTable, DataTable newStoragesTable, boolean create)` Update event storages

- - ### Method Detail

    - #### addStorage

          EventStorage addStorage(Context context,
                                  EventDefinition def)

      Add a dedicated event storage for events of a certain type.
      Parameters:
        `context` - Context those events should be kept in the storage or null if the storage is valid for all contexts
        `def` - Type of events to keep in the storage
      Returns:
        Newly created storage descriptor

    - #### getStorage

          EventStorage getStorage(java.lang.String context,
                                  java.lang.String event)

      Get event storage to used to keep certain events.
      Parameters:
        `context` - Path of context to find the storage for
        `event` - Name of event to find the storage for
      Returns:
        Event storage descriptor

    - #### getFactory

          DaoFactory getFactory()

      Returns storage manager's DAO factory
      Returns:
        The DAO factory being used

    - #### getDefaultStorage

          EventStorage getDefaultStorage()

      Get an event storage used to keep events that are not forwarded to any other custom storage.
      Returns:
        Default event storage descriptor

    - #### getStorages

          java.util.Collection<EventStorage> getStorages()

      Returns a list of all event storages available on the server.
      Returns:
        List of event storages

    - #### getStoragesAsTable

          DataTable getStoragesAsTable()
                                throws DataTableException

      Returns a list of all event storages in form of a DataTable.
      Returns:
        DataTable containing all event storages
      Throws:
        `DataTableException` - If conversion to a DataTable has failed

    - #### getStorage

          EventStorage getStorage(java.lang.String table)

      Returns an event storage descriptor by a specified table name.
      Parameters:
        `table` - Name of storage table
      Returns:
        Event storage descriptor

    - #### addStorage

          void addStorage(EventStorage storage)

      Add a new storage.
      Parameters:
        `storage` - A storage to add

    - #### removeStorage

          void removeStorage(EventStorage storage)

      Remove a storage
      Parameters:
        `storage` - A storage to remove.

    - #### removeStorages

          void removeStorages(java.lang.String context)
                       throws DaoException,
                              ContextException

      Remove all storages associated with a context.
      Parameters:
        `context` - The context those storages should be removed
      Throws:
        `DaoException` - If a removal has failed
        `ContextException` - If any other error occurred

    - #### updateStorages

          void updateStorages(DataTable oldStoragesTable,
                              DataTable newStoragesTable,
                              boolean create)
                       throws DaoException

      Update event storages
      Parameters:
        `oldStoragesTable` - Old storages table
        `newStoragesTable` - New storages table
        `create` - True if any newly added storage should be created
      Throws:
        `DaoException` - If updating has failed

    - #### initializeEventStorages

          void initializeEventStorages(java.util.List<? extends EventStorage> eventStorages,
                                       boolean create)
                                throws DaoException

      Perform initialization of all storages. This normally happens during DAO system startup.
      Parameters:
        `eventStorages` - A list of storages to initialize
        `create` - Defines whether storages should be created
      Throws:
        `DaoException` - If initialization has failed

    - #### fetchEventStorages

          java.util.List<? extends EventStorage> fetchEventStorages()
                                                             throws DaoException

      Returns a list of all event storages available on the server.
      Returns:
        List of event storages
      Throws:
        `DaoException`

    - #### fetchEventStoragesTable

          DataTable fetchEventStoragesTable()
                                     throws DaoException,
                                            ContextException

      Returns a list of all event storages in form of a DataTable.
      Returns:
        DataTable containing all event storages
      Throws:
        `DataTableException` - If conversion to a DataTable has failed
        `DaoException`
        `ContextException`

    - #### saveEventStorages

          void saveEventStorages()
                          throws DaoException,
                                 ContextException

      Persistently save information about currently configured event storages
      Throws:
        `DaoException`
        `ContextException`

    - #### saveEventStorages

          void saveEventStorages(java.util.Collection<EventStorage> eventStorages)
                          throws DaoException,
                                 ContextException

      Persistently save information about specified event storages
      Throws:
        `DaoException`
        `ContextException`

    - #### prepareDedicatedStorage

          void prepareDedicatedStorage(Context context,
                                       EventDefinition def,
                                       boolean create)
                                throws DaoException,
                                       ContextException

      Setup a dedicated event storage for specific events.
      Parameters:
        `context` - Context to configure the storage for or null if the storage should be valid for all contexts
        `def` - Event definition
        `create` - Defines whether the storage should be created
      Throws:
        `DaoException` - If storage creation has failed
        `ContextException` - If any other error occurred

    - #### getStorageByContextAndEvent

          EventStorage getStorageByContextAndEvent(@Nonnull
                                                   java.lang.String context,
                                                   @Nonnull
                                                   java.lang.String event)

      Returns an event storage descriptor by a specified context name.
      Parameters:
        `context` - Name of storage context
        `event` - Name of context event
      Returns:
        Event storage descriptor