tigase.server.ext

## Class CompSQLRepository

- java.lang.Object
- - tigase.server.ext.CompSQLRepository

- All Implemented Interfaces:
    Iterable<CompRepoItem>, ComponentRepository<CompRepoItem>

      public class CompSQLRepository
      extends Object
      implements ComponentRepository<CompRepoItem>

  Created: Nov 7, 2009 11:26:10 AM
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `REPO_URI_PROP_KEY` Field description
    `static String` | `TABLE_NAME` Field description

    - ### Fields inherited from interface tigase.db.comp.ComponentRepository

      `COMP_REPO_BIND`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompSQLRepository()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addItem(CompRepoItem item)` Method description
    `void` | `addRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)` Method description
    `Collection<CompRepoItem>` | `allItems()` Method description
    `boolean` | `contains(String key)` Method description
    `void` | `getDefaults(Map<String,Object> defs, Map<String,Object> params)` Method description
    `CompRepoItem` | `getItem(String key)` Method description
    `CompRepoItem` | `getItemInstance()` Method description
    `void` | `initRepository(String conn_str, Map<String,String> params)` Method description
    `Iterator<CompRepoItem>` | `iterator()` Method description
    `void` | `reload()` Method description
    `void` | `removeItem(String key)` Method description
    `void` | `removeRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)` Method description
    `void` | `setAutoloadTimer(long delay)` Method description
    `void` | `setProperties(Map<String,Object> properties)` Method description
    `int` | `size()` Method description
    `void` | `store()` Method description
    `String` | `validateItem(CompRepoItem item)` Method description

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REPO_URI_PROP_KEY

          public static final String REPO_URI_PROP_KEY

      Field description
      See Also:
        Constant Field Values

    - #### TABLE_NAME

          public static final String TABLE_NAME

      Field description
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CompSQLRepository

          public CompSQLRepository()

  - ### Method Detail

    - #### addRepoChangeListener

          public void addRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)

      Method description
      Specified by:
        `addRepoChangeListener` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `repoChangeListener` -

    - #### removeRepoChangeListener

          public void removeRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)

      Method description
      Specified by:
        `removeRepoChangeListener` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `repoChangeListener` -

    - #### addItem

          public void addItem(CompRepoItem item)

      Method description
      Specified by:
        `addItem` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `item` -

    - #### allItems

          public Collection<CompRepoItem> allItems()

      Method description
      Specified by:
        `allItems` in interface `ComponentRepository<CompRepoItem>`

    - #### contains

          public boolean contains(String key)

      Method description
      Specified by:
        `contains` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `key` -
      Returns:
        a `boolean` value `true` if the item exists in the repository or `false` of it does not.

    - #### getDefaults

          public void getDefaults(Map<String,Object> defs,
                         Map<String,Object> params)

      Method description
      Specified by:
        `getDefaults` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `defs` -
        `params` -

    - #### getItem

          public CompRepoItem getItem(String key)

      Method description
      Specified by:
        `getItem` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `key` -
      Returns:
        a `Item` for a given key or `null` if the item is not in the repository.

    - #### getItemInstance

          public CompRepoItem getItemInstance()

      Method description
      Specified by:
        `getItemInstance` in interface `ComponentRepository<CompRepoItem>`
      Returns:
        a new, uninitialized instance of the repository Item.

    - #### initRepository

          public void initRepository(String conn_str,
                            Map<String,String> params)
                              throws SQLException

      Method description
      Parameters:
        `conn_str` -
        `params` -
      Throws:
        `SQLException`

    - #### iterator

          public Iterator<CompRepoItem> iterator()

      Method description
      Specified by:
        `iterator` in interface `Iterable<CompRepoItem>`

    - #### reload

          public void reload()

      Method description
      Specified by:
        `reload` in interface `ComponentRepository<CompRepoItem>`

    - #### removeItem

          public void removeItem(String key)

      Method description
      Specified by:
        `removeItem` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `key` -

    - #### setProperties

          public void setProperties(Map<String,Object> properties)

      Method description
      Specified by:
        `setProperties` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `properties` -

    - #### size

          public int size()

      Method description
      Specified by:
        `size` in interface `ComponentRepository<CompRepoItem>`
      Returns:
        an `int` value with number of items in the repository.

    - #### store

          public void store()

      Method description
      Specified by:
        `store` in interface `ComponentRepository<CompRepoItem>`

    - #### validateItem

          public String validateItem(CompRepoItem item)

      Method description
      Specified by:
        `validateItem` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `item` -
      Returns:
        `null` on success and an error message otherwise.

    - #### setAutoloadTimer

          public void setAutoloadTimer(long delay)

      Method description
      Specified by:
        `setAutoloadTimer` in interface `ComponentRepository<CompRepoItem>`
      Parameters:
        `delay` -

Copyright © 2014 "Tigase, Inc.". All rights reserved.