Package tigase.vhosts

# Interface VHostManagerIfc

All Known Implementing Classes:
  `VHostManager`

public interface VHostManagerIfc
This is VHostManagerIfc interface which allows to access data for virtual domains server by this installation. There can be normally only one instance of this interface implementation loaded on the server at any given time. The instance is responsible for managing all virtual hosts and assigning correct component to each of the virtual hosts or non-local domains.
Created: 22 Nov 2008

Author:
  Artur Hefczyc

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addComponentDomain(String domain)`
  Adds a component domain to the collection of local component domains.
  `List<JID>`
  `getAllVHosts()`
  Method returns a list of all hosted VHosts.
  `ServerComponent[]`
  `getComponentsForLocalDomain(String domain)`
  The method returns an array with server components which can process packets for a given local domain.
  `ServerComponent[]`
  `getComponentsForNonLocalDomain(String domain)`
  The method returns an array of server components which can process packets sent to non-local domain.
  `BareJID`
  `getDefVHostItem()`
  Method `getDefVHostItem` returns a default VHost for the installation.
  `VHostItem`
  `getVHostItem(String domain)`
  Returns an object with all domain properties for given domain.
  `VHostItem`
  `getVHostItemDomainOrComponent(String domain)`
  Returns an object with all domain properties for a given domain or base domain if passed domain is name of subdomain used by component.
  `boolean`
  `isAnonymousEnabled(String domain)`
  This method checks whether anonymous login is enabled for a given domain.
  `boolean`
  `isLocalDomain(String domain)`
  This method checks whether given domain is server by this server instance.
  `boolean`
  `isLocalDomainOrComponent(String domain)`
  Method check if domains is locally hosted as a vhost or a component of a vhost.
  `void`
  `removeComponentDomain(String domain)`
  Removes a domain previously registered by a component.

- ## Method Details

  - ### isLocalDomain

    boolean isLocalDomain(String domain)
    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.
    Parameters:
      `domain` - is a String with domain name to check.
    Returns:
      a boolean value indicating whether given domain is local or not.

  - ### isLocalDomainOrComponent

    boolean isLocalDomainOrComponent(String domain)
    Method check if domains is locally hosted as a vhost or a component of a vhost.
    Returns:
      true - if domain is locally hosted as a vhost of a component of a vhost.

  - ### isAnonymousEnabled

    boolean isAnonymousEnabled(String domain)
    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.
    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.

  - ### getComponentsForLocalDomain

    ServerComponent[] getComponentsForLocalDomain(String domain)
    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()`
    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.

  - ### getComponentsForNonLocalDomain

    ServerComponent[] getComponentsForNonLocalDomain(String domain)
    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.
    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.

  - ### getVHostItem

    VHostItem getVHostItem(String domain)
    Returns an object with all domain properties for given domain.
    Parameters:
      `domain` - is a domain name
    Returns:
      a VHostItem object with all domain properties.

  - ### getVHostItemDomainOrComponent

    VHostItem getVHostItemDomainOrComponent(String domain)
    Returns an object with all domain properties for a given domain or base domain if passed domain is name of subdomain used by component.
    Parameters:
      `domain` - is a domain name
    Returns:
      a VHostItem object with all domain properties.

  - ### addComponentDomain

    void addComponentDomain(String domain)
    Adds a component domain to the collection of local component domains. This is mainly needed/used by an external components connecting to the server and binding hostnames. Normally the s2s component have no way of knowing about this new and temporary domains handled by the server and would refuse all connections for these domains. Adding them to a collection of component domains allows the s2s to detect them and accept connection for them.
    Parameters:
      `domain` - is a component domain name added to the collection.

  - ### removeComponentDomain

    void removeComponentDomain(String domain)
    Removes a domain previously registered by a component. It should not be normally used.
    Parameters:
      `domain` - is a component domain name being removed from the collection.

  - ### getDefVHostItem

    BareJID getDefVHostItem()
    Method `getDefVHostItem` returns a default VHost for the installation. In most cases this is the first VHost defined in the server configuration.
    Returns:
      a `BareJID` value of the default VHost for the installation.

  - ### getAllVHosts

    List<JID> getAllVHosts()
    Method returns a list of all hosted VHosts.