tigase.vhosts

## Class VHostJDBCRepository

- java.lang.Object
- - tigase.db.comp.ConfigRepository<Item>
  - - tigase.db.comp.UserRepoRepository<VHostItem>
    - - tigase.vhosts.VHostJDBCRepository

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

      public class VHostJDBCRepository
      extends UserRepoRepository<VHostItem>

  This implementation stores virtual domains in the UserRepository database. It loads initial settings and virtual hosts from the configuration file and then loads more vhosts from the database. Virtual domains from the database can overwrite (disable) vhosts loaded from the configuration file. This implementation keeps all virtual hosts and their parameters in a single database field. This might not be very efficient if you want to manager big number of virtual domains. It is sufficient for hundreds of vhosts. If you need thousands of VHosts support I advice to implement this storage in more efficient way using separate database tables instead of UserRepository. Please note there is a limit of about 300 vhosts if you use Derby database.
  Since:
    Nov 29, 2008 2:32:48 PM
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DNS_DEF_IP_PROP_KEY` Configuration option allowing specify default IP to which VHost should resolve vhost-man/dns-def-ip=
    `static String` | `DNS_DEF_IP_PROP_VAL` Field description
    `static String` | `DNS_SRV_DEF_ADDR_PROP_KEY` Configuration option allowing specify default hostname to which VHost should resolve vhost-man/dns-srv-def-addr=
    `static String` | `DNS_SRV_DEF_ADDR_PROP_VAL` Field description
    `static String` | `DOMAINS_PER_USER_LIMIT_PROP_KEY` Configuration option allowing specify default maximum number that user can register in service vhost-man/domains-per-user-limit=
    `static int` | `DOMAINS_PER_USER_LIMIT_PROP_VAL` Field description

    - ### Fields inherited from class tigase.db.comp.UserRepoRepository

      `REPO_CLASS_PROP_KEY, REPO_URI_PROP_KEY`

    - ### Fields inherited from class tigase.db.comp.ConfigRepository

      `items`

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

      `COMP_REPO_BIND`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VHostJDBCRepository()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getConfigKey()` Method description
    `String[]` | `getDefaultPropetyItems()` Method description
    `void` | `getDefaults(Map<String,Object> defs, Map<String,Object> params)` Method description
    `VHostItem` | `getItemInstance()` Method description
    `String` | `getItemsListPKey()` Method description
    `String` | `getPropertyKey()` Method description
    `tigase.xmpp.BareJID` | `getRepoUser()` Method description
    `static void` | `main(String[] args)` Simple verification of VHost validation
    `void` | `setProperties(Map<String,Object> properties)` Method description
    `String` | `validateItem(VHostItem item)` Performs validation of given VHostItem

    - ### Methods inherited from class tigase.db.comp.UserRepoRepository

      `reload, store`

    - ### Methods inherited from class tigase.db.comp.ConfigRepository

      `addItem, addRepoChangeListener, allItems, contains, getItem, itemChanged, iterator, removeItem, removeRepoChangeListener, setAutoloadTimer, size, toString`

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

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

- - ### Field Detail

    - #### DNS_DEF_IP_PROP_KEY

          public static final String DNS_DEF_IP_PROP_KEY

      Configuration option allowing specify default IP to which VHost should resolve vhost-man/dns-def-ip=
      See Also:
        Constant Field Values

    - #### DNS_DEF_IP_PROP_VAL

          public static String DNS_DEF_IP_PROP_VAL

      Field description

    - #### DNS_SRV_DEF_ADDR_PROP_KEY

          public static final String DNS_SRV_DEF_ADDR_PROP_KEY

      Configuration option allowing specify default hostname to which VHost should resolve vhost-man/dns-srv-def-addr=
      See Also:
        Constant Field Values

    - #### DNS_SRV_DEF_ADDR_PROP_VAL

          public static String DNS_SRV_DEF_ADDR_PROP_VAL

      Field description

    - #### DOMAINS_PER_USER_LIMIT_PROP_KEY

          public static final String DOMAINS_PER_USER_LIMIT_PROP_KEY

      Configuration option allowing specify default maximum number that user can register in service vhost-man/domains-per-user-limit=
      See Also:
        Constant Field Values

    - #### DOMAINS_PER_USER_LIMIT_PROP_VAL

          public static final int DOMAINS_PER_USER_LIMIT_PROP_VAL

      Field description
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### VHostJDBCRepository

          public VHostJDBCRepository()

  - ### Method Detail

    - #### getConfigKey

          public String getConfigKey()

      Method description
      Specified by:
        `getConfigKey` in class `ConfigRepository<VHostItem>`

    - #### getDefaultPropetyItems

          public String[] getDefaultPropetyItems()

      Method description
      Specified by:
        `getDefaultPropetyItems` in class `ConfigRepository<VHostItem>`

    - #### getDefaults

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

      Method description
      Specified by:
        `getDefaults` in interface `ComponentRepository<VHostItem>`
      Overrides:
        `getDefaults` in class `UserRepoRepository<VHostItem>`
      Parameters:
        `defs` -
        `params` -

    - #### getItemInstance

          public VHostItem getItemInstance()

      Method description
      Returns:
        a new, uninitialized instance of the repository Item.

    - #### getItemsListPKey

          public String getItemsListPKey()

      Method description
      Overrides:
        `getItemsListPKey` in class `UserRepoRepository<VHostItem>`

    - #### getPropertyKey

          public String getPropertyKey()

      Method description
      Specified by:
        `getPropertyKey` in class `ConfigRepository<VHostItem>`

    - #### getRepoUser

          public tigase.xmpp.BareJID getRepoUser()

      Method description
      Specified by:
        `getRepoUser` in class `UserRepoRepository<VHostItem>`

    - #### setProperties

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

      Method description
      Specified by:
        `setProperties` in interface `ComponentRepository<VHostItem>`
      Overrides:
        `setProperties` in class `UserRepoRepository<VHostItem>`
      Parameters:
        `properties` -

    - #### validateItem

          public String validateItem(VHostItem item)

      Performs validation of given VHostItem
      Specified by:
        `validateItem` in interface `ComponentRepository<VHostItem>`
      Overrides:
        `validateItem` in class `ConfigRepository<VHostItem>`
      Parameters:
        `item` - VHostItem which should be validated
      Returns:
        `null` on success and an error message otherwise.

    - #### main

          public static void main(String[] args)

      Simple verification of VHost validation
      Parameters:
        `args` -

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