1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-08 20:11:08 +01:00

Rename ConnectionConfigurationBuilder to Builder

This commit is contained in:
Florian Schmaus 2014-12-17 17:01:53 +01:00
parent 31c53f094c
commit a87227c531
8 changed files with 38 additions and 41 deletions

View file

@ -40,7 +40,6 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionConfiguration.ConnectionConfigurationBuilder;
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.SmackException.AlreadyConnectedException;
import org.jivesoftware.smack.SmackException.AlreadyLoggedInException;
@ -348,12 +347,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* Before logging in (i.e. authenticate) to the server the connection must be connected.
*
* It is possible to log in without sending an initial available presence by using
* {@link ConnectionConfigurationBuilder#setSendPresence(boolean)}. If this connection is
* {@link ConnectionConfiguration.Builder#setSendPresence(boolean)}. If this connection is
* not interested in loading its roster upon login then use
* {@link ConnectionConfigurationBuilder#setRosterLoadedAtLogin(boolean)}.
* {@link ConnectionConfiguration.Builder#setRosterLoadedAtLogin(boolean)}.
* Finally, if you want to not pass a password and instead use a more advanced mechanism
* while using SASL then you may be interested in using
* {@link ConnectionConfigurationBuilder#setCallbackHandler(javax.security.auth.callback.CallbackHandler)}.
* {@link ConnectionConfiguration.Builder#setCallbackHandler(javax.security.auth.callback.CallbackHandler)}.
* For more advanced login settings see {@link ConnectionConfiguration}.
*
* @throws XMPPException if an error occurs on the XMPP protocol level.

View file

@ -93,7 +93,7 @@ public abstract class ConnectionConfiguration {
// Holds the proxy information (such as proxyhost, proxyport, username, password etc)
protected final ProxyInfo proxy;
protected ConnectionConfiguration(ConnectionConfigurationBuilder<?,?> builder) {
protected ConnectionConfiguration(Builder<?,?> builder) {
if (builder.username != null) {
// Do partial version of nameprep on the username.
username = builder.username.toLowerCase(Locale.US).trim();
@ -196,7 +196,7 @@ public abstract class ConnectionConfiguration {
}
/**
* Gets the custom SSLContext previously set with {@link ConnectionConfigurationBuilder#setCustomSSLContext(SSLContext)} for
* Gets the custom SSLContext previously set with {@link ConnectionConfiguration.Builder#setCustomSSLContext(SSLContext)} for
* SSL sockets. This is null by default.
*
* @return the custom SSLContext or null.
@ -390,7 +390,7 @@ public abstract class ConnectionConfiguration {
* @param <B> the builder type parameter.
* @param <C> the resulting connection configuration type parameter.
*/
public static abstract class ConnectionConfigurationBuilder<B extends ConnectionConfigurationBuilder<B, C>, C extends ConnectionConfiguration> {
public static abstract class Builder<B extends Builder<B, C>, C extends ConnectionConfiguration> {
private SecurityMode securityMode = SecurityMode.enabled;
private String keystorePath = System.getProperty("javax.net.ssl.keyStore");
private String keystoreType = "jks";
@ -415,7 +415,7 @@ public abstract class ConnectionConfiguration {
private String host;
private int port = 5222;
protected ConnectionConfigurationBuilder() {
protected Builder() {
}
/**

View file

@ -28,7 +28,6 @@ import java.util.Set;
import javax.net.ssl.HostnameVerifier;
import org.jivesoftware.smack.ConnectionConfiguration.ConnectionConfigurationBuilder;
import org.jivesoftware.smack.compression.XMPPInputOutputStream;
import org.jivesoftware.smack.debugger.ReflectionDebuggerFactory;
import org.jivesoftware.smack.debugger.SmackDebugger;
@ -268,7 +267,7 @@ public final class SmackConfiguration {
* Set the default HostnameVerifier that will be used by XMPP connections to verify the hostname
* of a TLS certificate. XMPP connections are able to overwrite this settings by supplying a
* HostnameVerifier in their ConnecitonConfiguration with
* {@link ConnectionConfigurationBuilder#setHostnameVerifier(HostnameVerifier)}.
* {@link ConnectionConfiguration.Builder#setHostnameVerifier(HostnameVerifier)}.
*/
public static void setDefaultHostnameVerifier(HostnameVerifier verifier) {
defaultHostnameVerififer = verifier;

View file

@ -30,7 +30,7 @@ import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.jivesoftware.smack.ConnectionConfiguration.ConnectionConfigurationBuilder;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.SmackException.SecurityNotPossibleException;
@ -55,7 +55,7 @@ public class TLSUtils {
*
* @param builder the configuration builder to apply this setting to
*/
public static <B extends ConnectionConfigurationBuilder<B,?>> B setTLSOnly(B builder) {
public static <B extends ConnectionConfiguration.Builder<B,?>> B setTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1 });
return builder;
}
@ -72,7 +72,7 @@ public class TLSUtils {
*
* @param builder the configuration builder to apply this setting to
*/
public static <B extends ConnectionConfigurationBuilder<B,?>> B setSSLv3AndTLSOnly(B builder) {
public static <B extends ConnectionConfiguration.Builder<B,?>> B setSSLv3AndTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
return builder;
}
@ -88,7 +88,7 @@ public class TLSUtils {
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
*/
public static <B extends ConnectionConfigurationBuilder<B,?>> B acceptAllCertificates(B builder) throws NoSuchAlgorithmException, KeyManagementException {
public static <B extends ConnectionConfiguration.Builder<B,?>> B acceptAllCertificates(B builder) throws NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance(TLS);
context.init(null, new TrustManager[] { new AcceptAllTrustManager() }, new SecureRandom());
builder.setCustomSSLContext(context);