Package org.opends.admin.ads.util
Class ServerLoader
- java.lang.Object
-
- java.lang.Thread
-
- org.opends.admin.ads.util.ServerLoader
-
- All Implemented Interfaces:
Runnable
public class ServerLoader extends Thread
Class used to load the configuration of a server. Basically the code uses some provided properties and authentication information to connect to the server and then generate a ServerDescriptor object based on the read configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ServerLoader(Map<ADSContext.ServerProperty,Object> serverProperties, DN dn, String pwd, ApplicationTrustManager trustManager, int timeout, Set<PreferredConnection> preferredLDAPURLs, TopologyCacheFilter filter)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionWrappercreateConnectionWrapper()Returns a Connection Wrapper.TopologyCacheExceptiongetLastException()Returns the last exception that occurred while trying to generate the ServerDescriptor object.ServerDescriptorgetServerDescriptor()Returns the ServerDescriptor that could be retrieved.voidinterrupt()voidrun()The method where we try to generate the ServerDescriptor object.static HostPorttoHostPort(String ldapUrl)Converts an ldapUrl to a HostPort.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
ServerLoader
public ServerLoader(Map<ADSContext.ServerProperty,Object> serverProperties, DN dn, String pwd, ApplicationTrustManager trustManager, int timeout, Set<PreferredConnection> preferredLDAPURLs, TopologyCacheFilter filter)
Constructor.- Parameters:
serverProperties- the server properties of the server we want to load.dn- the DN that we must use to bind to the server.pwd- the password that we must use to bind to the server.trustManager- the ApplicationTrustManager to be used when we try to connect to the server.timeout- the timeout to establish the connection in milliseconds. Use0to express no timeout.preferredLDAPURLs- the list of preferred LDAP URLs that we want to use to connect to the server. They will be used only if they correspond to the URLs that we found in the the server properties.filter- the topology cache filter to be used. This can be used not to retrieve all the information.
-
-
Method Detail
-
getServerDescriptor
public ServerDescriptor getServerDescriptor()
Returns the ServerDescriptor that could be retrieved.- Returns:
- the ServerDescriptor that could be retrieved.
-
getLastException
public TopologyCacheException getLastException()
Returns the last exception that occurred while trying to generate the ServerDescriptor object.- Returns:
- the last exception that occurred while trying to generate the ServerDescriptor object.
-
run
public void run()
The method where we try to generate the ServerDescriptor object.
-
createConnectionWrapper
public ConnectionWrapper createConnectionWrapper() throws LdapException
Returns a Connection Wrapper.- Returns:
- the connection wrapper
- Throws:
LdapException- If an error occurs.
-
toHostPort
public static HostPort toHostPort(String ldapUrl) throws LdapException
Converts an ldapUrl to a HostPort.- Parameters:
ldapUrl- the ldapUrl to convert- Returns:
- the host and port extracted from the ldapUrl
- Throws:
LdapException- if the ldapUrl is not a valid URL
-
-