public class VHostItem extends RepositoryItemAbstract implements Comparable<VHostItem>
<vhost hostname="vhost.something.com" enabled="true" anon="true" register="true" max-users="99999999999L">
<comps/> <other/>
--virt-hosts = devel.tigase.org,test.tigase.org:-anon:-register:max-users=100
--virt-hosts = test.tigase.org:pres-forw=lpart@domain/res:mess-forw=lpart@domain/res
Modifier and Type | Class and Description |
---|---|
static class |
VHostItem.DataType |
Modifier and Type | Field and Description |
---|---|
static String |
ANONYMOUS_ENABLED_ATT
This is an attribute name for storing information whether anonymous user can login for this domain.
|
static String |
ANONYMOUS_ENABLED_LABEL |
static String |
C2S_PORTS_ALLOWED_ATT
This is an attribute name for storing information on which ports VHost should be enabled.
|
static String |
C2S_PORTS_ALLOWED_LABEL |
static String |
COMPONENTS_ATT |
static String |
COMPONENTS_ELEM
Element name for the VHostItem XML child keeping list of the server component which can handle packets for this
domain.
|
protected static Map<String,VHostItem.DataType> |
dataTypes |
static String |
DOMAIN_FILTER_POLICY_ATT |
static String |
DOMAIN_FILTER_POLICY_DOMAINS_ATT |
static String |
DOMAIN_FILTER_POLICY_DOMAINS_LABEL |
static String |
DOMAIN_FILTER_POLICY_LABEL |
protected static DomainFilterPolicy |
DOMAIN_FILTER_POLICY_PROP_DEF |
protected static String |
DOMAIN_FILTER_POLICY_PROP_KEY |
static String |
ENABLED_ATT
This is an attribute name for storing information whether the VHost is enabled or disabled.
|
static String |
ENABLED_LABEL |
static String |
HOSTNAME_ATT
This is an attribute name for storing the VHost name.
|
static String |
HOSTNAME_LABEL |
static String |
MAX_USERS_NUMBER_ATT
This is an attribute name for storing the maximum number of users for this virtual domain.
|
static String |
MAX_USERS_NUMBER_LABEL |
static String |
MESSAGE_FORWARD_ADDRESS_ATT |
static String |
MESSAGE_FORWARD_ADDRESS_LABEL |
static String |
OTHER_PARAMS_ELEM
Element name for the VHostItem XML child keeping all the extra parameters for the domain.
|
static String |
OTHER_PARAMS_LABEL |
static String |
PRESENCE_FORWARD_ADDRESS_ATT |
static String |
PRESENCE_FORWARD_ADDRESS_LABEL |
static String |
REGISTER_ENABLED_ATT
This is an attribute name for storing information whether user registration is allowed for this domain.
|
static String |
REGISTER_ENABLED_LABEL |
static String |
S2S_SECRET_ATT |
static String |
S2S_SECRET_LABEL |
protected static String |
S2S_SECRET_PROP_DEF |
protected static String |
S2S_SECRET_PROP_KEY |
static String |
SASL_MECHANISM_ATT
List of SASL mechanisms allowed for domain
|
static String |
SASL_MECHANISM_LABEL |
static String |
TLS_REQUIRED_ATT |
static String |
TLS_REQUIRED_LABEL |
static String |
TRUSTED_JIDS_ATT |
protected static Boolean |
VHOST_ANONYMOUS_ENABLED_PROP_DEF |
protected static String |
VHOST_ANONYMOUS_ENABLED_PROP_KEY |
protected static String[] |
VHOST_COMPONENTS_PATH |
static String |
VHOST_ELEM
Element name to for the VHostItem XML storage.
|
protected static Long |
VHOST_MAX_USERS_PROP_DEF |
protected static String |
VHOST_MAX_USERS_PROP_KEY |
protected static String |
VHOST_MESSAGE_FORWARD_PROP_DEF |
protected static String |
VHOST_MESSAGE_FORWARD_PROP_KEY |
protected static String[] |
VHOST_OTHER_PARAMS_PATH |
protected static String |
VHOST_PRESENCE_FORWARD_PROP_DEF |
protected static String |
VHOST_PRESENCE_FORWARD_PROP_KEY |
protected static Boolean |
VHOST_REGISTER_ENABLED_PROP_DEF |
protected static String |
VHOST_REGISTER_ENABLED_PROP_KEY |
protected static Boolean |
VHOST_TLS_REQUIRED_PROP_DEF |
protected static String |
VHOST_TLS_REQUIRED_PROP_KEY |
ADMINS_ATT, ADMINS_LABEL, OWNER_ATT, OWNER_LABEL
Constructor and Description |
---|
VHostItem() |
VHostItem(Element elem)
The constructor creates the
VHostItem instance from a given XML element. |
VHostItem(JID vhost)
The constructor creates the
VHostItem instance for a given domain name with default values for all
other parameters. |
VHostItem(String vhost)
The constructor creates the
VHostItem instance for a given domain name with default values for all
other parameters. |
Modifier and Type | Method and Description |
---|---|
void |
addCommandFields(Packet packet)
The method is used for handling ad-hoc commands.
|
int |
compareTo(VHostItem o) |
boolean |
equals(Object v) |
int[] |
getC2SPortsAllowed()
Returns an array with ports on which C2S connections for this VHosts are allowed.
|
String[] |
getComps()
Returns an array with the server components names which should process packets sent to this domain or
null (default) if there is no specific component assigned to this domain. |
<T> T |
getData(String key)
Return value for key for this VHost
|
DomainFilterPolicy |
getDomainFilter() |
String[] |
getDomainFilterDomains() |
String |
getElemName() |
String |
getKey()
Returns a unique key for the item in the repository.
|
long |
getMaxUsersNumber()
This method returns the maximum number of user accounts allowed for this domain.
|
JID |
getMessageForward() |
JID |
getMessageForwardAddress() |
String |
getOtherDomainParams()
This method allows to access the virtual domain other configuration parameters.
|
JID |
getPresenceForward() |
JID |
getPresenceForwardAddress() |
String |
getS2sSecret() |
String[] |
getSaslAllowedMechanisms() |
Set<String> |
getTrustedJIDs() |
VHostItem |
getUnmodifiableVHostItem() |
JID |
getVhost()
This method return a virtual host name as a
String value. |
int |
hashCode() |
void |
initFromCommand(Packet packet)
The method used for handling ad-hoc commands.
|
void |
initFromElement(Element elem)
The item can be also initialized from a more complex repositories: XML repository or SQL database.
|
void |
initFromPropertyString(String propString)
The item can be initialized based on the data loaded from a configuration file.
|
protected void |
initializeFromDefaults(VHostItemDefaults vhostDefaults) |
boolean |
isAnonymousEnabled()
This method checks whether anonymous login is enabled for this domain.
|
boolean |
isData(String key)
Get boolean value contained by this VHost for key
|
boolean |
isEnabled()
Checks whether this domain is set as enabled or not.
|
boolean |
isRegisterEnabled()
The method checks whether user registration is enabled for this domain or not.
|
boolean |
isTlsRequired()
The method returns TLS required settings for the vhost.
|
boolean |
isTrustedJID(JID jid) |
void |
parseDataValue(String key,
String valueStr) |
static void |
registerData(List<VHostItem.DataType> types) |
void |
setAnonymousEnabled(boolean value)
This method allows to enable or disable anonymous logins for this domain.
|
void |
setC2SPortsAllowed(int[] ports)
Sets an array of ports for which C2S connections for this VHost will be allowed.
|
void |
setComps(String[] comps)
Sets an array with the server component names by which packets to this domain can be processed.
|
void |
setData(String key,
Object value)
Set value for specified key for this VHost
|
void |
setDomainFilter(DomainFilterPolicy domainFilter)
This method allow configure DomainFilterPolicy to be applied during packet filtering.
|
void |
setDomainFilterDomains(String[] domainFilterDomains)
This method allow specify list of domains that will be used for packet filtering when DomainFilteringPolicy is
set to either LIST or BLACKLIST.
|
void |
setEnabled(boolean value)
This method allows to enable or disable local domain.
|
protected void |
setKey(String key) |
void |
setMaxUsersNumber(long maxUsersNumber)
This method allows to set the maximum number of user accounts allowed for this domain.
|
void |
setMessageForward(JID messageForward) |
void |
setOtherDomainParams(String otherParams)
This method allows to set extra configuration parameters for the virtual domain.
|
void |
setPresenceForward(JID presenceForward) |
void |
setRegisterEnabled(boolean value)
This method allows to enable or disable user account registration for this domain.
|
void |
setS2sSecret(String s2sSecret) |
void |
setSaslAllowedMechanisms(String[] saslAllowedMechanisms) |
void |
setTlsRequired(boolean value)
The method sets TLS required property for the vhost.
|
void |
setTrustedJIDs(JID[] trustedJids) |
void |
setVHost(JID vhost) |
void |
setVHost(String vhost) |
Element |
toElement()
Item data can be stored in a more complex form than a simple property string.
|
String |
toPropertyString()
The item can be initialized based on the data loaded from a configuration file.
|
String |
toString() |
public static final String ANONYMOUS_ENABLED_ATT
public static final String ANONYMOUS_ENABLED_LABEL
public static final String SASL_MECHANISM_ATT
public static final String SASL_MECHANISM_LABEL
public static final String COMPONENTS_ATT
public static final String COMPONENTS_ELEM
public static final String C2S_PORTS_ALLOWED_ATT
public static final String C2S_PORTS_ALLOWED_LABEL
public static final String DOMAIN_FILTER_POLICY_ATT
public static final String DOMAIN_FILTER_POLICY_DOMAINS_ATT
public static final String DOMAIN_FILTER_POLICY_LABEL
public static final String DOMAIN_FILTER_POLICY_DOMAINS_LABEL
public static final String ENABLED_ATT
public static final String ENABLED_LABEL
public static final String HOSTNAME_ATT
public static final String HOSTNAME_LABEL
public static final String MAX_USERS_NUMBER_ATT
public static final String MAX_USERS_NUMBER_LABEL
public static final String MESSAGE_FORWARD_ADDRESS_ATT
public static final String MESSAGE_FORWARD_ADDRESS_LABEL
public static final String OTHER_PARAMS_ELEM
public static final String OTHER_PARAMS_LABEL
public static final String PRESENCE_FORWARD_ADDRESS_ATT
public static final String PRESENCE_FORWARD_ADDRESS_LABEL
public static final String REGISTER_ENABLED_ATT
public static final String REGISTER_ENABLED_LABEL
public static final String S2S_SECRET_ATT
public static final String S2S_SECRET_LABEL
public static final String TLS_REQUIRED_ATT
public static final String TLS_REQUIRED_LABEL
public static final String TRUSTED_JIDS_ATT
public static final String VHOST_ELEM
protected static final String DOMAIN_FILTER_POLICY_PROP_KEY
protected static final String S2S_SECRET_PROP_DEF
protected static final String S2S_SECRET_PROP_KEY
protected static final String VHOST_ANONYMOUS_ENABLED_PROP_KEY
protected static final Boolean VHOST_ANONYMOUS_ENABLED_PROP_DEF
protected static final String VHOST_MAX_USERS_PROP_KEY
protected static final Long VHOST_MAX_USERS_PROP_DEF
protected static final String VHOST_MESSAGE_FORWARD_PROP_DEF
protected static final String VHOST_MESSAGE_FORWARD_PROP_KEY
protected static final String VHOST_PRESENCE_FORWARD_PROP_DEF
protected static final String VHOST_PRESENCE_FORWARD_PROP_KEY
protected static final String VHOST_REGISTER_ENABLED_PROP_KEY
protected static final Boolean VHOST_REGISTER_ENABLED_PROP_DEF
protected static final String VHOST_TLS_REQUIRED_PROP_KEY
protected static final Boolean VHOST_TLS_REQUIRED_PROP_DEF
protected static final DomainFilterPolicy DOMAIN_FILTER_POLICY_PROP_DEF
protected static final String[] VHOST_OTHER_PARAMS_PATH
protected static final String[] VHOST_COMPONENTS_PATH
protected static final Map<String,VHostItem.DataType> dataTypes
public VHostItem()
public VHostItem(Element elem)
VHostItem
instance from a given XML element. Please refer to the class
documentation for more details of the XML element.elem
- is an Element
object with virtual domain settings.public VHostItem(JID vhost)
VHostItem
instance for a given domain name with default values for all
other parameters. By the default all domain parameters are set to true.vhost
- is a String
value with a domain name.public VHostItem(String vhost) throws TigaseStringprepException
VHostItem
instance for a given domain name with default values for all
other parameters. By the default all domain parameters are set to true.vhost
- is a String
value with a domain name.TigaseStringprepException
- if the provided string causes stringprep processing errors.public static void registerData(List<VHostItem.DataType> types)
public void addCommandFields(Packet packet)
RepositoryItem
addCommandFields
in interface RepositoryItem
addCommandFields
in class RepositoryItemAbstract
packet
- with empty ad-hoc command to fill with fieldspublic int compareTo(VHostItem o)
compareTo
in interface Comparable<VHostItem>
public void initFromCommand(Packet packet)
RepositoryItem
initFromCommand
in interface RepositoryItem
initFromCommand
in class RepositoryItemAbstract
packet
- with ad-hoc command filled by the user.public void initFromElement(Element elem)
RepositoryItem
initFromElement
in interface RepositoryItem
initFromElement
in class RepositoryItemAbstract
elem
- XML Element with all the item initialization data.protected void setKey(String key)
setKey
in class RepositoryItemAbstract
public void initFromPropertyString(String propString)
RepositoryItem
initFromPropertyString
in interface RepositoryItem
propString
- is a property string to initialize the RepositoryItem.public Element toElement()
VHostItem
object to XML representation.toElement
in interface RepositoryItem
toElement
in class RepositoryItemAbstract
Element
object with VHost information.public String toPropertyString()
RepositoryItem
toPropertyString
in interface RepositoryItem
public String[] getComps()
null
(default) if there is no specific component assigned to this domain.String[]
object with server component names.public void setComps(String[] comps)
VHostListener
which returns true
for
handlesLocalDomains()
method call and by all components set via this method.comps
- is an String[]
array with server component names.public int[] getC2SPortsAllowed()
int[]
object with allowed C2S ports.public void setC2SPortsAllowed(int[] ports)
ports
- is an int[]
array of allowed C2S ports.public <T> T getData(String key)
T
- key
- public DomainFilterPolicy getDomainFilter()
public void setDomainFilter(DomainFilterPolicy domainFilter)
domainFilter
- name of the DomainFilterPolicy to be appliedpublic String[] getDomainFilterDomains()
public void setDomainFilterDomains(String[] domainFilterDomains)
domainFilterDomains
- array of domains to be applied during filteringpublic String getElemName()
getElemName
in class RepositoryItemAbstract
public String getKey()
RepositoryItem
getKey
in interface RepositoryItem
public long getMaxUsersNumber()
long
value indicating the maximum number of user accounts allowed for this domain.public void setMaxUsersNumber(long maxUsersNumber)
0L
.maxUsersNumber
- is a long
value specifying the maximum number of user accounts allowed for
this domain.public JID getMessageForward()
public void setMessageForward(JID messageForward)
public JID getMessageForwardAddress()
public String getOtherDomainParams()
String
value with domain extra parameters.public void setOtherDomainParams(String otherParams)
otherParams
- is a String
value with domain extra parameters.public JID getPresenceForward()
public void setPresenceForward(JID presenceForward)
public JID getPresenceForwardAddress()
public String getS2sSecret()
public void setS2sSecret(String s2sSecret)
public void setTrustedJIDs(JID[] trustedJids)
public VHostItem getUnmodifiableVHostItem()
public JID getVhost()
String
value.String
value with the virtual domain name.public boolean isAnonymousEnabled()
boolean
value indicating whether anonymous logins are allowed for this domain.public void setAnonymousEnabled(boolean value)
value
- public boolean isData(String key)
key
- public boolean isEnabled()
boolean
value true
if the domain is enabled and false
if the
domain is disabled.public void setEnabled(boolean value)
value
- public boolean isRegisterEnabled()
boolean
value indicating whether user account registration is allowed for this domain.public void setRegisterEnabled(boolean value)
value
- public boolean isTlsRequired()
boolean
value whether TLS is required for the vhost or not.public void setTlsRequired(boolean value)
value
- is a boolean
parameter specifying whether TLS is required for the virtual domain.public boolean isTrustedJID(JID jid)
public void setData(String key, Object value)
key
- value
- public void setVHost(String vhost) throws TigaseStringprepException
TigaseStringprepException
public void setVHost(JID vhost)
public String[] getSaslAllowedMechanisms()
public void setSaslAllowedMechanisms(String[] saslAllowedMechanisms)
protected void initializeFromDefaults(VHostItemDefaults vhostDefaults)
Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.