org.opends.admin.ads.util
Class PreferredConnection

java.lang.Object
  extended by org.opends.admin.ads.util.PreferredConnection

public class PreferredConnection
extends java.lang.Object

A simple class that is used to be able to specify which URL and connection type to use when we connect to a server.


Nested Class Summary
static class PreferredConnection.Type
          The type of the connection.
 
Constructor Summary
PreferredConnection(java.lang.String ldapUrl, PreferredConnection.Type type)
          The constructor of the PreferredConnection.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 java.lang.String getLDAPURL()
          Returns the LDAP URL to be used.
static PreferredConnection getPreferredConnection(javax.naming.ldap.InitialLdapContext ctx)
          Commodity method that returns a PreferredConnection object with the information on a given InitialLdapContext.
 PreferredConnection.Type getType()
          Returns the type of the connection.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferredConnection

public PreferredConnection(java.lang.String ldapUrl,
                           PreferredConnection.Type type)
The constructor of the PreferredConnection.

Parameters:
ldapUrl - the LDAP URL to connect to the server.
type - the type of connection to be used to connect (required to differentiate StartTLS and regular LDAP).
Method Detail

getLDAPURL

public java.lang.String getLDAPURL()
Returns the LDAP URL to be used.

Returns:
the LDAP URL to be used.

getType

public PreferredConnection.Type getType()
Returns the type of the connection.

Returns:
the type of the connection.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

getPreferredConnection

public static PreferredConnection getPreferredConnection(javax.naming.ldap.InitialLdapContext ctx)
Commodity method that returns a PreferredConnection object with the information on a given InitialLdapContext.

Parameters:
ctx - the connection we retrieve the inforamtion from.
Returns:
a preferred connection object.