tigase.vhosts
Interface VHostRepository

All Known Implementing Classes:
VhostConfigRepository, VHostJDBCRepository

public interface VHostRepository

Implementation of this interface is responsible for loading and storing virtual hosts for the server installation. Configuration based storage is normally read-only. Database storage is read-write. Created: Nov 27, 2008 1:52:25 PM

Version:
$Rev: 1260 $
Author:
Artur Hefczyc

Method Summary
 void addVHost(VHostItem vhost)
          The method adds a new or updates existing virtual hosts in the repository.
 boolean contains(java.lang.String domain)
          The method checks whether the given domain is stored in the repository.
 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.
 VHostItem getVHost(java.lang.String domain)
          The method returns all domain configuration parameters for a given domain or null if the domain does not exist in the repository.
 void reload()
          This method is called to reload virtual hosts from the database or other permanent storage.
 void removeVHost(java.lang.String vh)
          The method is called to remove given VHost from the memory cache and 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.
 int size()
          The method returns number of virtual domains in the repository.
 

Method Detail

removeVHost

void removeVHost(java.lang.String vh)
The method is called to remove given VHost from the memory cache and permanent storage. After this method is completed the vhosts should no longer be availble as a local domain.

Parameters:
vh - a String with domain name to remove.

addVHost

void addVHost(VHostItem vhost)
The method adds a new or updates existing virtual hosts in the repository. It needs to have all fields set correctly. By the default VHostItem has all fields set to "enabled". After this method call is finished a new added virtual domain must be available as a local domain for the server installation. The method adds the vhosts to memory cache and permamnent storage.

Parameters:
vhost - a VHostItem with virtual domain and all it's configuration parameters.

getVHost

VHostItem getVHost(java.lang.String domain)
The method returns all domain configuration parameters for a given domain or null if the domain does not exist in the repository. In other words it returns null if given domain is not local.

Parameters:
domain - a String with domain name to search for.
Returns:
a VHostItem for a given domain or null if the domain is not in the repository.

contains

boolean contains(java.lang.String domain)
The method checks whether the given domain is stored in the repository. In other words the method checks whether this is a local domain.

Parameters:
domain - a String with domain name to search for.
Returns:
a boolean value true if domain exist in the repository or false of domain does not exist.

setProperties

void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
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.

Parameters:
properties - a Map with configuration settings. Content of this Map must not be modified. This read-only collection.

getDefaults

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. Default settings returned by this method are then saved in the configuration file and presented to the admin for further adjustements.

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.

reload

void reload()
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.


size

int size()
The method returns number of virtual domains in the repository.

Returns:
an int value with number of virtual hosts in the repository.


Copyright © 2008 Tigase. All Rights Reserved.