tigase.vhosts
Class VHostJDBCRepository

java.lang.Object
  extended by tigase.vhosts.VhostConfigRepository
      extended by tigase.vhosts.VHostJDBCRepository
All Implemented Interfaces:
VHostRepository

public class VHostJDBCRepository
extends VhostConfigRepository

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. Created: Nov 29, 2008 2:32:48 PM

Version:
$Rev: 1260 $
Author:
Artur Hefczyc

Field Summary
static java.lang.String VHOST_REPO_CLASS_PROP_KEY
           
static java.lang.String VHOST_REPO_URI_PROP_KEY
           
 
Fields inherited from class tigase.vhosts.VhostConfigRepository
ANONYMOUS_DOMAINS_PROP_KEY, vhosts
 
Constructor Summary
VHostJDBCRepository()
           
 
Method Summary
 void getDefaults(java.util.Map<java.lang.String,java.lang.Object> defs, java.util.Map<java.lang.String,java.lang.Object> params)
          The method is called to obtain defualt configuration settings if there are any for this repository implementation The configuration settings are implementation dependent and there are no defaults set by the server.
 void reload()
          This method is called to reload virtual hosts from the database or other permanent storage.
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
          The method is called to set configuration for this repository implementation.
 void store()
           
 
Methods inherited from class tigase.vhosts.VhostConfigRepository
addVHost, contains, getVHost, removeVHost, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VHOST_REPO_CLASS_PROP_KEY

public static final java.lang.String VHOST_REPO_CLASS_PROP_KEY
See Also:
Constant Field Values

VHOST_REPO_URI_PROP_KEY

public static final java.lang.String VHOST_REPO_URI_PROP_KEY
See Also:
Constant Field Values
Constructor Detail

VHostJDBCRepository

public VHostJDBCRepository()
Method Detail

getDefaults

public void getDefaults(java.util.Map<java.lang.String,java.lang.Object> defs,
                        java.util.Map<java.lang.String,java.lang.Object> params)
Description copied from interface: VHostRepository
The method is called to obtain defualt configuration settings if there are any for this repository implementation The configuration settings are implementation dependent and there are no defaults set by the server. Default settings returned by this method are then saved in the configuration file and presented to the admin for further adjustements.

Specified by:
getDefaults in interface VHostRepository
Overrides:
getDefaults in class VhostConfigRepository
Parameters:
defs - is a Map collection where all repository configuration defaults must be put.
params - is a Map collection with some preset properties for the server. These settings can be used to adjust repository defaults, for example they can contain database connection URL or initial list of virtual domains.

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: VHostRepository
The method is called to set configuration for this repository implementation. The configuration is repository implementation dependent. There are no default settings for the repository.

Specified by:
setProperties in interface VHostRepository
Overrides:
setProperties in class VhostConfigRepository
Parameters:
properties - a Map with configuration settings. Content of this Map must not be modified. This read-only collection.

reload

public void reload()
Description copied from interface: VHostRepository
This method is called to reload virtual hosts from the database or other permanent storage. It is possible that virtual domains list is modified externally by third-party system. When all modifications are done this method is called to refresh the class cache. Whether the implementation load whole list or just last modifications is implementation dependent.

Specified by:
reload in interface VHostRepository
Overrides:
reload in class VhostConfigRepository

store

public void store()
Overrides:
store in class VhostConfigRepository


Copyright © 2008 Tigase. All Rights Reserved.