Smack

org.jivesoftware.smack
Class ConnectionConfiguration

java.lang.Object
  extended by org.jivesoftware.smack.ConnectionConfiguration
All Implemented Interfaces:
Cloneable

public class ConnectionConfiguration
extends Object
implements Cloneable

Configuration to use while establishing the connection to the server. It is possible to configure the path to the trustore file that keeps the trusted CA root certificates and enable or disable all or some of the checkings done while verifying server certificates.

It is also possible to configure it TLs, SASL or compression are going to be used or not.

Author:
Gaston Dombiak

Constructor Summary
ConnectionConfiguration(String host, int port)
           
ConnectionConfiguration(String host, int port, String serviceName)
           
 
Method Summary
protected  Object clone()
           
 String getHost()
          Returns the host to use when establishing the connection.
 int getPort()
          Returns the port to use when establishing the connection.
 String getServiceName()
          Returns the server name of the target server.
 String getTruststorePassword()
          Returns the password to use to access the truststore file.
 String getTruststorePath()
          Retuns the path to the truststore file.
 String getTruststoreType()
           
 boolean isCompressionEnabled()
          Returns true if the connection is going to use stream compression.
 boolean isDebuggerEnabled()
          Returns true if the new connection about to be establish is going to be debugged.
 boolean isExpiredCertificatesCheckEnabled()
          Returns true if certificates presented by the server are going to be checked for their validity.
 boolean isNotMatchingDomainCheckEnabled()
          Returns true if certificates presented by the server are going to be checked for their domain.
 boolean isSASLAuthenticationEnabled()
          Returns true if the client is going to use SASL authentication when logging into the server.
 boolean isSelfSignedCertificateEnabled()
          Returns true if self-signed certificates are going to be accepted.
 boolean isTLSEnabled()
          Returns true if the client is going to try to secure the connection using TLS after the connection has been established.
 boolean isVerifyChainEnabled()
          Returns true if the whole chain of certificates presented by the server are going to be checked.
 boolean isVerifyRootCAEnabled()
          Returns true if root CA checking is going to be done.
 void setCompressionEnabled(boolean compressionEnabled)
          Sets if the connection is going to use stream compression.
 void setDebuggerEnabled(boolean debuggerEnabled)
          Sets if the new connection about to be establish is going to be debugged.
 void setExpiredCertificatesCheckEnabled(boolean expiredCertificatesCheckEnabled)
          Sets if certificates presented by the server are going to be checked for their validity.
 void setNotMatchingDomainCheckEnabled(boolean notMatchingDomainCheckEnabled)
          Sets if certificates presented by the server are going to be checked for their domain.
 void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled)
          Sets if the client is going to use SASL authentication when logging into the server.
 void setSelfSignedCertificateEnabled(boolean selfSignedCertificateEnabled)
          Sets if self-signed certificates are going to be accepted.
 void setTLSEnabled(boolean tlsEnabled)
          Sets if the client is going to try to secure the connection using TLS after the connection has been established.
 void setTruststorePassword(String truststorePassword)
          Sets the password to use to access the truststore file.
 void setTruststorePath(String truststorePath)
          Sets the path to the truststore file.
 void setTruststoreType(String truststoreType)
           
 void setVerifyChainEnabled(boolean verifyChainEnabled)
          Sets if the whole chain of certificates presented by the server are going to be checked.
 void setVerifyRootCAEnabled(boolean verifyRootCAEnabled)
          Sets if root CA checking is going to be done.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionConfiguration

public ConnectionConfiguration(String host,
                               int port,
                               String serviceName)

ConnectionConfiguration

public ConnectionConfiguration(String host,
                               int port)
Method Detail

getServiceName

public String getServiceName()
Returns the server name of the target server.

Returns:
the server name of the target server.

getHost

public String getHost()
Returns the host to use when establishing the connection. The host and port to use might have been resolved by a DNS lookup as specified by the XMPP spec.

Returns:
the host to use when establishing the connection.

getPort

public int getPort()
Returns the port to use when establishing the connection. The host and port to use might have been resolved by a DNS lookup as specified by the XMPP spec.

Returns:
the port to use when establishing the connection.

isTLSEnabled

public boolean isTLSEnabled()
Returns true if the client is going to try to secure the connection using TLS after the connection has been established.

Returns:
true if the client is going to try to secure the connection using TLS after the connection has been established.

setTLSEnabled

public void setTLSEnabled(boolean tlsEnabled)
Sets if the client is going to try to secure the connection using TLS after the connection has been established.

Parameters:
tlsEnabled - if the client is going to try to secure the connection using TLS after the connection has been established.

getTruststorePath

public String getTruststorePath()
Retuns the path to the truststore file. The truststore file contains the root certificates of several well?known CAs. By default Smack is going to use the file located in $JREHOME/lib/security/cacerts.

Returns:
the path to the truststore file.

setTruststorePath

public void setTruststorePath(String truststorePath)
Sets the path to the truststore file. The truststore file contains the root certificates of several well?known CAs. By default Smack is going to use the file located in $JREHOME/lib/security/cacerts.

Parameters:
truststorePath - the path to the truststore file.

getTruststoreType

public String getTruststoreType()

setTruststoreType

public void setTruststoreType(String truststoreType)

getTruststorePassword

public String getTruststorePassword()
Returns the password to use to access the truststore file. It is assumed that all certificates share the same password of the truststore file.

Returns:
the password to use to access the truststore file.

setTruststorePassword

public void setTruststorePassword(String truststorePassword)
Sets the password to use to access the truststore file. It is assumed that all certificates share the same password of the truststore file.

Parameters:
truststorePassword - the password to use to access the truststore file.

isVerifyChainEnabled

public boolean isVerifyChainEnabled()
Returns true if the whole chain of certificates presented by the server are going to be checked. By default the certificate chain is not verified.

Returns:
true if the whole chaing of certificates presented by the server are going to be checked.

setVerifyChainEnabled

public void setVerifyChainEnabled(boolean verifyChainEnabled)
Sets if the whole chain of certificates presented by the server are going to be checked. By default the certificate chain is not verified.

Parameters:
verifyChainEnabled - if the whole chaing of certificates presented by the server are going to be checked.

isVerifyRootCAEnabled

public boolean isVerifyRootCAEnabled()
Returns true if root CA checking is going to be done. By default checking is disabled.

Returns:
true if root CA checking is going to be done.

setVerifyRootCAEnabled

public void setVerifyRootCAEnabled(boolean verifyRootCAEnabled)
Sets if root CA checking is going to be done. By default checking is disabled.

Parameters:
verifyRootCAEnabled - if root CA checking is going to be done.

isSelfSignedCertificateEnabled

public boolean isSelfSignedCertificateEnabled()
Returns true if self-signed certificates are going to be accepted. By default this option is disabled.

Returns:
true if self-signed certificates are going to be accepted.

setSelfSignedCertificateEnabled

public void setSelfSignedCertificateEnabled(boolean selfSignedCertificateEnabled)
Sets if self-signed certificates are going to be accepted. By default this option is disabled.

Parameters:
selfSignedCertificateEnabled - if self-signed certificates are going to be accepted.

isExpiredCertificatesCheckEnabled

public boolean isExpiredCertificatesCheckEnabled()
Returns true if certificates presented by the server are going to be checked for their validity. By default certificates are not verified.

Returns:
true if certificates presented by the server are going to be checked for their validity.

setExpiredCertificatesCheckEnabled

public void setExpiredCertificatesCheckEnabled(boolean expiredCertificatesCheckEnabled)
Sets if certificates presented by the server are going to be checked for their validity. By default certificates are not verified.

Parameters:
expiredCertificatesCheckEnabled - if certificates presented by the server are going to be checked for their validity.

isNotMatchingDomainCheckEnabled

public boolean isNotMatchingDomainCheckEnabled()
Returns true if certificates presented by the server are going to be checked for their domain. By default certificates are not verified.

Returns:
true if certificates presented by the server are going to be checked for their domain.

setNotMatchingDomainCheckEnabled

public void setNotMatchingDomainCheckEnabled(boolean notMatchingDomainCheckEnabled)
Sets if certificates presented by the server are going to be checked for their domain. By default certificates are not verified.

Parameters:
notMatchingDomainCheckEnabled - if certificates presented by the server are going to be checked for their domain.

isCompressionEnabled

public boolean isCompressionEnabled()
Returns true if the connection is going to use stream compression. Stream compression will be requested after TLS was established (if TLS was enabled) and only if the server offered stream compression. With stream compression network traffic can be reduced up to 90%. By default compression is disabled.

Returns:
true if the connection is going to use stream compression.

setCompressionEnabled

public void setCompressionEnabled(boolean compressionEnabled)
Sets if the connection is going to use stream compression. Stream compression will be requested after TLS was established (if TLS was enabled) and only if the server offered stream compression. With stream compression network traffic can be reduced up to 90%. By default compression is disabled.

Parameters:
compressionEnabled - if the connection is going to use stream compression.

isSASLAuthenticationEnabled

public boolean isSASLAuthenticationEnabled()
Returns true if the client is going to use SASL authentication when logging into the server. If SASL authenticatin fails then the client will try to use non-sasl authentication. By default SASL is enabled.

Returns:
true if the client is going to use SASL authentication when logging into the server.

setSASLAuthenticationEnabled

public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled)
Sets if the client is going to use SASL authentication when logging into the server. If SASL authenticatin fails then the client will try to use non-sasl authentication. By default SASL is enabled.

Parameters:
saslAuthenticationEnabled - if the client is going to use SASL authentication when logging into the server.

isDebuggerEnabled

public boolean isDebuggerEnabled()
Returns true if the new connection about to be establish is going to be debugged. By default the value of XMPPConnection.DEBUG_ENABLED is used.

Returns:
true if the new connection about to be establish is going to be debugged.

setDebuggerEnabled

public void setDebuggerEnabled(boolean debuggerEnabled)
Sets if the new connection about to be establish is going to be debugged. By default the value of XMPPConnection.DEBUG_ENABLED is used.

Parameters:
debuggerEnabled - if the new connection about to be establish is going to be debugged.

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

Smack

Copyright © 2003 Jive Software.