tigase.vhosts
Class VHostManager

java.lang.Object
  extended by tigase.server.AbstractComponentRegistrator<VHostListener>
      extended by tigase.vhosts.VHostManager
All Implemented Interfaces:
Configurable, XMPPService, ComponentRegistrator, ServerComponent, StatisticsContainer, VHostManagerIfc

public class VHostManager
extends AbstractComponentRegistrator<VHostListener>
implements XMPPService, VHostManagerIfc, Configurable, StatisticsContainer

Describe class VHostManager here. Created: Fri Nov 21 14:28:20 2008

Version:
$Rev: 1279 $
Author:
Artur Hefczyc

Field Summary
static java.lang.String VHOSTS_REPO_CLASS_PROP_KEY
           
static java.lang.String VHOSTS_REPO_CLASS_PROP_VAL
           
static java.lang.String VHOSTS_REPO_CLASS_PROPERTY
           
 
Fields inherited from class tigase.server.AbstractComponentRegistrator
components
 
Fields inherited from interface tigase.disco.XMPPService
CMD_FEATURES, DEF_FEATURES, INFO_XMLNS, ITEMS_XMLNS
 
Fields inherited from interface tigase.conf.Configurable
ADMINS_PROP_KEY, BOSH_COMP_CLASS_NAME, C2S_CLUST_COMP_CLASS_NAME, C2S_COMP_CLASS_NAME, CL_COMP_CLASS_NAME, CLUSTER_CONECT, CLUSTER_CONTR_CLASS_NAME, CLUSTER_LISTEN, CLUSTER_MODE, CLUSTER_NODES, CLUSTER_NODES_PROP_KEY, COMPONENT_ID_PROP_KEY, DEF_BOSH_NAME, DEF_C2S_NAME, DEF_CL_COMP_NAME, DEF_CLUST_CONTR_NAME, DEF_EXT_COMP_NAME, DEF_HOSTNAME_PROP_KEY, DEF_S2S_NAME, DEF_SM_NAME, DEF_SRECV_NAME, DEF_SSEND_NAME, DEF_STATS_NAME, DEF_VHOST_MAN_NAME, DERBY_REPO_CLASS_PROP_VAL, DERBY_REPO_URL_PROP_VAL, DRUPAL_REPO_CLASS_PROP_VAL, DRUPAL_REPO_URL_PROP_VAL, EXT_COMP_CLASS_NAME, GEN_ADMINS, GEN_AUTH_DB, GEN_AUTH_DB_URI, GEN_COMP_CLASS, GEN_COMP_NAME, GEN_CONF, GEN_CONFIG, GEN_CONFIG_ALL, GEN_CONFIG_COMP, GEN_CONFIG_CS, GEN_CONFIG_DEF, GEN_CONFIG_SM, GEN_DEBUG, GEN_EXT_COMP, GEN_MAX_QUEUE_SIZE, GEN_SM_PLUGINS, GEN_SREC_ADMINS, GEN_SREC_DB, GEN_SREC_DB_URI, GEN_TEST, GEN_TRUSTED, GEN_USER_DB, GEN_USER_DB_URI, GEN_VIRT_HOSTS, HOSTNAMES_PROP_KEY, LIBRESOURCE_REPO_CLASS_PROP_VAL, LIBRESOURCE_REPO_URL_PROP_VAL, MYSQL_REPO_CLASS_PROP_VAL, MYSQL_REPO_URL_PROP_VAL, NULL_ROUTING, PGSQL_REPO_CLASS_PROP_VAL, PGSQL_REPO_URL_PROP_VAL, ROUTER_COMP_CLASS_NAME, S2S_CLUST_COMP_CLASS_NAME, S2S_COMP_CLASS_NAME, SM_CLUS_COMP_CLASS_NAME, SM_COMP_CLASS_NAME, SRECV_COMP_CLASS_NAME, SSEND_COMP_CLASS_NAME, STATS_CLASS_NAME, TIGASE_AUTH_REPO_CLASS_PROP_VAL, TIGASE_AUTH_REPO_URL_PROP_VAL, TIGASE_CUSTOM_AUTH_REPO_CLASS_PROP_VAL, TRUSTED_PROP_KEY, VHOST_MAN_CLASS_NAME, XML_REPO_CLASS_PROP_VAL, XML_REPO_URL_PROP_VAL
 
Constructor Summary
VHostManager()
          Creates a new VHostManager instance.
 
Method Summary
 void componentAdded(VHostListener component)
           
 void componentRemoved(VHostListener component)
           
 ServerComponent[] getComponentsForLocalDomain(java.lang.String domain)
          The method returns an array with server components which can process packets for a given local domain.
 ServerComponent[] getComponentsForNonLocalDomain(java.lang.String domain)
          The method returns an array of server components which can process packets sent to non-local domain.
 java.util.Map<java.lang.String,java.lang.Object> getDefaults(java.util.Map<java.lang.String,java.lang.Object> params)
          Returns defualt configuration settings for this object.
 java.util.List<tigase.xml.Element> getDiscoFeatures()
          Returns features for top level disco info
 tigase.xml.Element getDiscoInfo(java.lang.String node, java.lang.String jid)
           
 java.util.List<tigase.xml.Element> getDiscoItems(java.lang.String node, java.lang.String jid)
           
 java.util.List<StatRecord> getStatistics()
           
 boolean isAnonymousEnabled(java.lang.String domain)
          This method checks whether anonymous login is enabled for a given domain.
 boolean isCorrectType(ServerComponent component)
           
 boolean isLocalDomain(java.lang.String domain)
          This method checks whether given domain is server by this server instance.
 boolean isLocalDomainOrComponent(java.lang.String domain)
           
 void processPacket(Packet packet, java.util.Queue<Packet> results)
          processPacket is a blocking processing method implemented by all components.
 void setName(java.lang.String name)
           
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
          Sets all configuration properties for the object.
 
Methods inherited from class tigase.server.AbstractComponentRegistrator
addComponent, deleteComponent, getComponent, getComponentId, getName, initializationCompleted, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tigase.conf.Configurable
getName
 
Methods inherited from interface tigase.server.ServerComponent
getComponentId, initializationCompleted, release
 

Field Detail

VHOSTS_REPO_CLASS_PROPERTY

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

VHOSTS_REPO_CLASS_PROP_KEY

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

VHOSTS_REPO_CLASS_PROP_VAL

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

VHostManager

public VHostManager()
Creates a new VHostManager instance.

Method Detail

setName

public void setName(java.lang.String name)
Specified by:
setName in interface ServerComponent
Overrides:
setName in class AbstractComponentRegistrator<VHostListener>

componentAdded

public void componentAdded(VHostListener component)
Specified by:
componentAdded in class AbstractComponentRegistrator<VHostListener>

componentRemoved

public void componentRemoved(VHostListener component)
Specified by:
componentRemoved in class AbstractComponentRegistrator<VHostListener>

isCorrectType

public boolean isCorrectType(ServerComponent component)
Specified by:
isCorrectType in class AbstractComponentRegistrator<VHostListener>

processPacket

public void processPacket(Packet packet,
                          java.util.Queue<Packet> results)
Description copied from interface: ServerComponent
processPacket is a blocking processing method implemented by all components. This method processes packet and returns results instantly without waiting for any resources.

Specified by:
processPacket in interface ServerComponent
Parameters:
packet - a Packet value

getDiscoFeatures

public java.util.List<tigase.xml.Element> getDiscoFeatures()
Description copied from interface: XMPPService
Returns features for top level disco info

Specified by:
getDiscoFeatures in interface XMPPService
Returns:

getDiscoInfo

public tigase.xml.Element getDiscoInfo(java.lang.String node,
                                       java.lang.String jid)
Specified by:
getDiscoInfo in interface XMPPService

getDiscoItems

public java.util.List<tigase.xml.Element> getDiscoItems(java.lang.String node,
                                                        java.lang.String jid)
Specified by:
getDiscoItems in interface XMPPService

isLocalDomain

public boolean isLocalDomain(java.lang.String domain)
Description copied from interface: VHostManagerIfc
This method checks whether given domain is server by this server instance. That is if this domain is local to this server installation. It doesn't check however whether the domain is disabled or enabled. It only checks if tthe list of local domains contains this virtual host.

Specified by:
isLocalDomain in interface VHostManagerIfc
Parameters:
domain - is a String with domain name to check.
Returns:
a boolean value indicating whether given domain is local or not.

isLocalDomainOrComponent

public boolean isLocalDomainOrComponent(java.lang.String domain)
Specified by:
isLocalDomainOrComponent in interface VHostManagerIfc

isAnonymousEnabled

public boolean isAnonymousEnabled(java.lang.String domain)
Description copied from interface: VHostManagerIfc
This method checks whether anonymous login is enabled for a given domain. That is it checks whether this domains is local and anonymousEnabled parameter for this domain is set to true.

Specified by:
isAnonymousEnabled in interface VHostManagerIfc
Parameters:
domain - is a String with domain name to check.
Returns:
a boolean value indicating whether given domain is enabled for anonymous logins or not.

getComponentsForNonLocalDomain

public ServerComponent[] getComponentsForNonLocalDomain(java.lang.String domain)
Description copied from interface: VHostManagerIfc
The method returns an array of server components which can process packets sent to non-local domain. Most commonly there is only one such component: server-2-server connections manager. It is possible however there might be more such components. All of them will get the packet for processing.

Specified by:
getComponentsForNonLocalDomain in interface VHostManagerIfc
Parameters:
domain - is a String with a domain to check. At the moment this parameter is ignored. In the future it will be possible to assign a specific component for any non-local domain.
Returns:
an array with ServerComponents which can handle packets to non-local domains.

getComponentsForLocalDomain

public ServerComponent[] getComponentsForLocalDomain(java.lang.String domain)
Description copied from interface: VHostManagerIfc
The method returns an array with server components which can process packets for a given local domain. If the domain is not local null is returned. The given domain may also consist of: component name ServerComponent.getName() plus any local domain but only if the component returns true from method call: VHostListener.handlesNameSubdomains()

Specified by:
getComponentsForLocalDomain in interface VHostManagerIfc
Parameters:
domain - is a String with a domain name to check. It may by just a local domain or string created with component name and localdomain.
Returns:
an array with ServerComponents which can handle packets for a given domain or null if no component found for a given domain.

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: Configurable
Sets all configuration properties for the object.

Specified by:
setProperties in interface Configurable

getDefaults

public java.util.Map<java.lang.String,java.lang.Object> getDefaults(java.util.Map<java.lang.String,java.lang.Object> params)
Description copied from interface: Configurable
Returns defualt configuration settings for this object.

Specified by:
getDefaults in interface Configurable

getStatistics

public java.util.List<StatRecord> getStatistics()
Specified by:
getStatistics in interface StatisticsContainer


Copyright © 2008 Tigase. All Rights Reserved.