public abstract class AccountID
extends java.lang.Object
Every instance of the ProtocolProviderService, created through the ProtocolProviderFactory is assigned an AccountID instance, that uniquely represents it and whose string representation (obtained through the getAccountUID() method) can be used for identification of persistently stored account details.
Account id's are guaranteed to be different for different accounts and in the same time are bound to be equal for multiple installations of the same account.
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
accountProperties
Contains all implementation specific properties that define the account.
|
protected static java.lang.String |
DEFAULTS_PREFIX
The default properties key prefix used in lib/jitsi-defaults.properties
|
Modifier | Constructor and Description |
---|---|
protected |
AccountID(java.lang.String userID,
java.util.Map<java.lang.String,java.lang.String> accountProperties,
java.lang.String protocolName,
java.lang.String serviceName)
Creates an account id for the specified provider userid and
accountProperties.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this account id.
|
java.lang.String |
getAccountAddress()
Returns a string that could be directly used (or easily converted to) an
address that other users of the protocol can use to communicate with us.
|
java.lang.String |
getAccountIconPath()
Returns the protocol icon path stored under
ProtocolProviderFactory.ACCOUNT_ICON_PATH key. |
java.util.Map<java.lang.String,java.lang.String> |
getAccountProperties()
Returns a Map containing protocol and implementation account
initialization properties.
|
boolean |
getAccountPropertyBoolean(java.lang.Object key,
boolean defaultValue)
Returns the specific account property.
|
int |
getAccountPropertyInt(java.lang.Object key,
int defaultValue)
Gets the value of a specific property as a signed decimal integer.
|
java.lang.String |
getAccountPropertyString(java.lang.Object key)
Returns the account property string corresponding to the given key.
|
java.lang.String |
getAccountPropertyString(java.lang.Object key,
java.lang.String defValue)
Returns the account property string corresponding to the given key.
|
java.lang.String |
getAccountUniqueID()
Returns a String uniquely identifying this account, guaranteed to remain
the same across multiple installations of the same account and to always
be unique for differing accounts.
|
java.lang.String |
getAuthorizationName()
The authorization name
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getBooleanPropertiesByPrefix(java.lang.String prefix,
boolean exactPrefixMatch,
boolean defaultValue)
Returns a java.util.Map of Strings containing the
all property names that have the specified prefix and Boolean
containing the value for each property selected.
|
static java.lang.String |
getDefaultStr(java.lang.String key)
Gets default property value for given key.
|
protected java.lang.String |
getDefaultString(java.lang.String key)
Gets default property value for given key.
|
java.lang.String |
getDisplayName()
Returns a name that can be displayed to the user when referring to this
account.
|
java.lang.String |
getDTMFMethod()
Returns the DTMF method.
|
java.lang.String |
getDtmfMinimalToneDuration()
Returns the minimal DTMF tone duration.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getIntegerPropertiesByPrefix(java.lang.String prefix,
boolean exactPrefixMatch)
Returns a java.util.Map of Strings containing the
all property names that have the specified prefix and Integer
containing the value for each property selected.
|
java.lang.String |
getPassword()
Returns the password of the account.
|
java.util.List<java.lang.String> |
getPropertyNamesByPrefix(java.lang.String prefix,
boolean exactPrefixMatch)
Returns a java.util.List of Strings containing the
all property names that have the specified prefix.
|
java.lang.String |
getProtocolDisplayName()
Returns the display name of the protocol.
|
java.lang.String |
getProtocolIconPath()
Returns the protocol icon path stored under
ProtocolProviderFactory.PROTOCOL_ICON_PATH key. |
java.lang.String |
getProtocolName()
Returns the name of the protocol.
|
java.lang.String |
getServerAddress()
The address of the server we will use for this account
|
java.lang.String |
getServerPort()
The port on the specified server
|
java.lang.String |
getService()
Returns the name of the service that defines the context for this
account.
|
java.util.List<org.jitsi.service.neomedia.SrtpControlType> |
getSortedEnabledEncryptionProtocolList()
Sorts the enabled encryption protocol list given in parameter to match
the preferences set for this account.
|
java.util.List<StunServerDescriptor> |
getStunServers(org.osgi.framework.BundleContext bundleContext)
Returns the list of STUN servers that this account is currently
configured to use.
|
java.lang.String |
getSystemProtocolName()
Returns the actual name of the protocol used rather than a branded
variant.
|
java.lang.String |
getTlsClientCertificate()
Gets the ID of the client certificate configuration.
|
java.lang.String |
getUserID()
Returns the user id associated with this account.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isConfigHidden()
Checks if the account config is hidden.
|
boolean |
isEnabled()
Indicates if this account is currently enabled.
|
boolean |
isEncryptionProtocolEnabled(org.jitsi.service.neomedia.SrtpControlType type)
Returns if the encryption protocol given in parameter is enabled.
|
boolean |
isHidden()
Checks if the account is hidden.
|
boolean |
isPreferredProvider()
Returns the first ProtocolProviderService implementation
corresponding to the preferred protocol
|
boolean |
isReadOnly()
Checks if the account is marked as readonly.
|
boolean |
isServerOverridden()
Returns true if server was overriden.
|
boolean |
isStatusMenuHidden()
Checks if the account status menu is hidden.
|
boolean |
isStunServerDiscoveryEnabled()
Determines whether this account's provider is supposed to auto discover
STUN and TURN servers.
|
boolean |
isUPNPEnabled()
Determines whether this account's provider uses UPnP (if available).
|
boolean |
isUseDefaultStunServer()
Determines whether this account's provider uses the default STUN server
provided by Jitsi (stun.jitsi.net) if there is no other STUN/TURN server
discovered/configured.
|
protected static java.lang.String |
loadStunPassword(org.osgi.framework.BundleContext bundleContext,
AccountID accountID,
java.lang.String namePrefix)
Returns the password for the STUN server with the specified prefix.
|
static void |
mergeProperties(java.util.Map<java.lang.String,java.lang.String> input,
java.util.Map<java.lang.String,java.lang.String> output)
Copies all properties from input map to output map.
|
void |
putAccountProperty(java.lang.String key,
java.lang.Object value)
Adds property to the map of properties for this account
identifier.
|
void |
putAccountProperty(java.lang.String key,
java.lang.String value)
Adds a property to the map of properties for this account identifier.
|
void |
removeAccountProperty(java.lang.String key)
Removes specified account property.
|
void |
setAccountIconPath(java.lang.String iconPath)
Sets the account icon path that will be held under
ProtocolProviderFactory.ACCOUNT_ICON_PATH key. |
void |
setAccountProperties(java.util.Map<java.lang.String,java.lang.String> accountProperties)
Set the account properties.
|
void |
setAuthorizationName(java.lang.String authName)
Sets authorization name.
|
void |
setDisplayName(java.lang.String displayName)
Sets
ProtocolProviderFactory.DISPLAY_NAME property value. |
void |
setDTMFMethod(java.lang.String dtmfMethod)
Sets the DTMF method.
|
void |
setDtmfMinimalToneDuration(java.lang.String dtmfMinimalToneDuration)
Sets the minimal DTMF tone duration.
|
void |
setOrRemoveIfEmpty(java.lang.String key,
java.lang.String value)
Puts the new property value if it's not null nor empty.
|
void |
setOrRemoveIfEmpty(java.lang.String key,
java.lang.String value,
boolean trim)
Puts the new property value if it's not null nor empty.
|
void |
setOrRemoveIfNull(java.lang.String key,
java.lang.String value)
Sets the property a new value, but only if it's not null or
the property is removed from the map.
|
void |
setPassword(java.lang.String password)
Sets the password of the account.
|
void |
setProtocolIconPath(java.lang.String iconPath)
Sets the protocl icon path that will be held under
ProtocolProviderFactory.PROTOCOL_ICON_PATH key. |
void |
setServerAddress(java.lang.String serverAddress)
Sets the server
|
void |
setServerOverridden(boolean isServerOverridden)
Sets isServerOverridden property.
|
void |
setServerPort(java.lang.String port)
Sets the server port.
|
void |
setTlsClientCertificate(java.lang.String id)
Sets the ID of the client certificate configuration.
|
void |
storeProperties(java.lang.String protocolIconPath,
java.lang.String accountIconPath,
java.util.Map<java.lang.String,java.lang.String> accountProperties)
Stores configuration properties held by this object into given
accountProperties map.
|
java.lang.String |
toString()
Returns a string representation of this account id (same as calling
getAccountUniqueID()).
|
protected static final java.lang.String DEFAULTS_PREFIX
protected java.util.Map<java.lang.String,java.lang.String> accountProperties
protected AccountID(java.lang.String userID, java.util.Map<java.lang.String,java.lang.String> accountProperties, java.lang.String protocolName, java.lang.String serviceName)
userID
- a String that uniquely identifies the user.accountProperties
- a Map containing any other protocol and
implementation specific account initialization propertiesprotocolName
- the name of the protocol implemented by the provider
that this id is meant for.serviceName
- the name of the service (e.g. iptel.org, jabber.org,
icq.com) that this account is registered with.public java.lang.String getUserID()
public java.lang.String getDisplayName()
ACCOUNT_DISPLAY_NAME
!public void setDisplayName(java.lang.String displayName)
ProtocolProviderFactory.DISPLAY_NAME
property value.displayName
- the display name value to set.public java.lang.String getProtocolDisplayName()
public java.lang.String getProtocolName()
public java.lang.String getAccountUniqueID()
public java.util.Map<java.lang.String,java.lang.String> getAccountProperties()
public boolean getAccountPropertyBoolean(java.lang.Object key, boolean defaultValue)
key
- property keydefaultValue
- default value if the property does not existpublic int getAccountPropertyInt(java.lang.Object key, int defaultValue)
Integer.parseInt(String)
. If parsing the value as a signed
decimal integer fails or there is no value associated with the specified
property key, defaultValue is returned.key
- the key of the property to get the value of as a
signed decimal integerdefaultValue
- the value to be returned if parsing the value of the
specified property key as a signed decimal integer fails or there is no
value associated with the specified property key in this
AccountIDpublic java.lang.String getAccountPropertyString(java.lang.Object key)
key
- the key, corresponding to the property string we're looking
forpublic java.lang.String getAccountPropertyString(java.lang.Object key, java.lang.String defValue)
key
- the key, corresponding to the property string we're looking
fordefValue
- the default value returned when given key
is not presentpublic void putAccountProperty(java.lang.String key, java.lang.String value)
key
- the key of the propertyvalue
- the property valuepublic void putAccountProperty(java.lang.String key, java.lang.Object value)
key
- the key of the propertyvalue
- the property valuepublic void removeAccountProperty(java.lang.String key)
key
- the key to remove.public int hashCode()
hashCode
in class java.lang.Object
Object.equals(java.lang.Object)
,
Hashtable
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.hashCode()
,
Hashtable
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getService()
public java.lang.String getAccountAddress()
public boolean isEnabled()
public java.lang.String getServerAddress()
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- the password of the account.public java.lang.String getAuthorizationName()
public void setAuthorizationName(java.lang.String authName)
authName
- Stringpublic java.lang.String getServerPort()
public void setServerPort(java.lang.String port)
port
- intpublic void setServerAddress(java.lang.String serverAddress)
serverAddress
- Stringpublic boolean isServerOverridden()
public void setServerOverridden(boolean isServerOverridden)
isServerOverridden
- indicates if the server is overriddenpublic java.lang.String getProtocolIconPath()
ProtocolProviderFactory.PROTOCOL_ICON_PATH
key.public void setProtocolIconPath(java.lang.String iconPath)
ProtocolProviderFactory.PROTOCOL_ICON_PATH
key.iconPath
- a path to the protocol icon to set.public java.lang.String getAccountIconPath()
ProtocolProviderFactory.ACCOUNT_ICON_PATH
key.public void setAccountIconPath(java.lang.String iconPath)
ProtocolProviderFactory.ACCOUNT_ICON_PATH
key.iconPath
- a path to the account icon to set.public java.lang.String getDTMFMethod()
public void setDTMFMethod(java.lang.String dtmfMethod)
dtmfMethod
- the DTMF method to setpublic java.lang.String getDtmfMinimalToneDuration()
public void setDtmfMinimalToneDuration(java.lang.String dtmfMinimalToneDuration)
dtmfMinimalToneDuration
- The minimal DTMF tone duration to set.public java.lang.String getTlsClientCertificate()
public void setTlsClientCertificate(java.lang.String id)
id
- the client certificate configuration template ID.public boolean isHidden()
public boolean isConfigHidden()
public boolean isStatusMenuHidden()
public boolean isReadOnly()
public boolean isPreferredProvider()
public void setAccountProperties(java.util.Map<java.lang.String,java.lang.String> accountProperties)
accountProperties
- the properties of the accountpublic boolean isEncryptionProtocolEnabled(org.jitsi.service.neomedia.SrtpControlType type)
encryptionProtocolName
- The name of the encryption protocol
("ZRTP", "SDES" or "MIKEY").public java.util.List<StunServerDescriptor> getStunServers(org.osgi.framework.BundleContext bundleContext)
protected static java.lang.String loadStunPassword(org.osgi.framework.BundleContext bundleContext, AccountID accountID, java.lang.String namePrefix)
bundleContext
- the OSGi bundle context that we are currently
running in.accountID
- account IDnamePrefix
- name prefixpublic boolean isStunServerDiscoveryEnabled()
public boolean isUPNPEnabled()
public boolean isUseDefaultStunServer()
public java.lang.String getSystemProtocolName()
public java.util.List<org.jitsi.service.neomedia.SrtpControlType> getSortedEnabledEncryptionProtocolList()
public java.util.Map<java.lang.String,java.lang.Boolean> getBooleanPropertiesByPrefix(java.lang.String prefix, boolean exactPrefixMatch, boolean defaultValue)
Example:
Imagine a configuration service instance containing 2 properties
only:
net.java.sip.communicator.PROP1=value1
net.java.sip.communicator.service.protocol.PROP1=value2
A call to this method with a prefix="net.java.sip.communicator" and exactPrefixMatch=true would only return the first property - net.java.sip.communicator.PROP1, whereas the same call with exactPrefixMatch=false would return both properties as the second prefix includes the requested prefix string.
prefix
- a String containing the prefix (the non dotted non-caps
part of a property name) that we're looking for.exactPrefixMatch
- a boolean indicating whether the returned
property names should all have a prefix that is an exact match of the
the prefix param or whether properties with prefixes that
contain it but are longer than it are also accepted.defaultValue
- the default value if the key is not set.public java.util.Map<java.lang.String,java.lang.Integer> getIntegerPropertiesByPrefix(java.lang.String prefix, boolean exactPrefixMatch)
Example:
Imagine a configuration service instance containing 2 properties
only:
net.java.sip.communicator.PROP1=value1
net.java.sip.communicator.service.protocol.PROP1=value2
A call to this method with a prefix="net.java.sip.communicator" and exactPrefixMatch=true would only return the first property - net.java.sip.communicator.PROP1, whereas the same call with exactPrefixMatch=false would return both properties as the second prefix includes the requested prefix string.
prefix
- a String containing the prefix (the non dotted non-caps
part of a property name) that we're looking for.exactPrefixMatch
- a boolean indicating whether the returned
property names should all have a prefix that is an exact match of the
the prefix param or whether properties with prefixes that
contain it but are longer than it are also accepted.public java.util.List<java.lang.String> getPropertyNamesByPrefix(java.lang.String prefix, boolean exactPrefixMatch)
Example:
Imagine a configuration service instance containing 2 properties
only:
net.java.sip.communicator.PROP1=value1
net.java.sip.communicator.service.protocol.PROP1=value2
A call to this method with a prefix="net.java.sip.communicator" and exactPrefixMatch=true would only return the first property - net.java.sip.communicator.PROP1, whereas the same call with exactPrefixMatch=false would return both properties as the second prefix includes the requested prefix string.
prefix
- a String containing the prefix (the non dotted non-caps
part of a property name) that we're looking for.exactPrefixMatch
- a boolean indicating whether the returned
property names should all have a prefix that is an exact match of the
the prefix param or whether properties with prefixes that
contain it but are longer than it are also accepted.public void setOrRemoveIfNull(java.lang.String key, java.lang.String value)
key
- the property keyvalue
- the property valuepublic void setOrRemoveIfEmpty(java.lang.String key, java.lang.String value)
key
- the property keyvalue
- the property valuepublic void setOrRemoveIfEmpty(java.lang.String key, java.lang.String value, boolean trim)
key
- the property keyvalue
- the property valuetrim
- true if the value will be trimmed, before
isEmpty() is called.public void storeProperties(java.lang.String protocolIconPath, java.lang.String accountIconPath, java.util.Map<java.lang.String,java.lang.String> accountProperties)
protocolIconPath
- the path to the protocol icon is usedaccountIconPath
- the path to the account icon if usedaccountProperties
- output properties mapprotected java.lang.String getDefaultString(java.lang.String key)
key
- the property keypublic static java.lang.String getDefaultStr(java.lang.String key)
key
- the property keypublic static void mergeProperties(java.util.Map<java.lang.String,java.lang.String> input, java.util.Map<java.lang.String,java.lang.String> output)
input
- source properties mapoutput
- destination properties map
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.